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

Cache verifier callers #1331

Merged
merged 4 commits into from
Feb 26, 2025
Merged

Cache verifier callers #1331

merged 4 commits into from
Feb 26, 2025

Conversation

litt3
Copy link
Contributor

@litt3 litt3 commented Feb 26, 2025

Why are these changes needed?

  • This PR caches cert verifier callers, instead of constructing a new one for every call

Checks

  • I've made sure the tests are passing. Note that there might be a few flaky tests, in that case, please comment that they are not relevant.
  • I've checked the new test coverage and the coverage percentage didn't drop.
  • Testing Strategy
    • Unit tests
    • Integration tests
    • This PR is not tested :(

Signed-off-by: litt3 <102969658+litt3@users.noreply.github.com>
@litt3 litt3 self-assigned this Feb 26, 2025
Signed-off-by: litt3 <102969658+litt3@users.noreply.github.com>
@litt3 litt3 marked this pull request as ready for review February 26, 2025 14:23
Comment on lines +59 to +60
// maps contract address to a ContractEigenDACertVerifierCaller object
verifierCallers sync.Map
Copy link
Contributor

Choose a reason for hiding this comment

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

should there be a size constraint imposed on this mapping? ie if we take the design route where proxy takes in arbitrary addresses then this could present a DoS vector

Copy link
Contributor Author

@litt3 litt3 Feb 26, 2025

Choose a reason for hiding this comment

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

if we take the design route where proxy takes in arbitrary addresses then this could present a DoS vector

Valid point, but I can't think of a reason we would pursue a design route where proxy accepts arbitrary addresses: the two cases I can imagine are either cert verifier address being managed by an EigenDACertVerifierRouter, or a hardcoded or config value in proxy for cases where the address isn't permitted to change.

Can you think of a reason we'd allow arbitrary definitions for this?

If we can't think of a potential reason here, I think it makes sense to not limit the size of the map: doing so is non-trivial in complexity and would present a cost in the standard mode of operation. Perhaps just a comment calling out the concern, so it's more likely to attract notice if it ever needs to be changed?

Copy link
Contributor

Choose a reason for hiding this comment

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

comment makes sense!


existingCaller, valueExists := cv.verifierCallers.Load(certVerifierAddress)
if valueExists {
return existingCaller.(*verifierBindings.ContractEigenDACertVerifierCaller), nil
Copy link
Contributor

Choose a reason for hiding this comment

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

any value in instead safe casting the caster to the binding type? looking at this code it should be impossible but without an invariant enforcement this does present a hypothetical panic

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, fixed in 74ec1b9e

Signed-off-by: litt3 <102969658+litt3@users.noreply.github.com>
@litt3 litt3 requested a review from ethenotethan February 26, 2025 15:39
Copy link
Contributor

@ethenotethan ethenotethan left a comment

Choose a reason for hiding this comment

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

LGTM

@litt3 litt3 merged commit e36cbb4 into master Feb 26, 2025
12 checks passed
@litt3 litt3 deleted the cache-verifier-callers branch February 26, 2025 19:17
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.

3 participants