Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: elcontracts/reader interface #465

Closed

Conversation

damiramirez
Copy link
Contributor

@damiramirez damiramirez commented Jan 23, 2025

What Changed?

This PR aims to improve the elcontracts/reader interface by implementing a request-response pattern. For the exposed functions, we create structs that represent the request (specific fields + BlockNumber) and the response.

Because the function signatures change, we also refactor the tests to align with the new pattern.

Below is a simple example of the new request-response pattern:

Example:

func(r *ChainReader) Foo(
	ctx context.Context,
	request FooRequest,
) (FooResponse, error) {
	...
}

type FooRequest struct {
	BlockNumber *big.Int,
        ...
}

This is a work in progress and changes may occur.

Reviewer Checklist

  • Code is well-documented
  • Code adheres to Go naming conventions
  • Code deprecates any old functionality before removing it

…oken and update tests. change logic in writer, need to review after this PR
…onDigestHash and update tests. change logic in writer, need to review after this PR
@damiramirez damiramirez changed the title refactor: elcontracts interface refactor: elcontracts/reader interface Jan 24, 2025
@damiramirez damiramirez marked this pull request as ready for review January 28, 2025 15:00
Copy link
Contributor

@maximopalopoli maximopalopoli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just leave you a comment:

@@ -161,17 +158,21 @@ func (w *ChainWriter) RegisterOperatorInQuorumWithAVSRegistryCoordinator(
}

// params to register operator in delegation manager's operator-avs mapping
msgToSign, err := w.elReader.CalculateOperatorAVSRegistrationDigestHash(
// TODO: Review this function after finishing the refactor of the ChainReader
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question, should this line be left in? Or is the chainReader refactoring not finished yet? The same in the other call to elcontracts.CalculateOperatorAVSRegistrationDigestHashRequest

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same in the TODO of elcontracts's ChainWriter related to this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added that comment because the avsregistry and elcontracts/writer refactors are being handled in separate PRs. It might be unnecessary to keep this comment since conflicts are expected during merging and will need to be handled regardless. So I will remove the comments!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done d110c54!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants