ethereum: Add verifyCurrentQuorum method to core bridge #3540
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TODO:
Summary
Added a new method to the core bridge that makes it easier to verify the validity of a message against the current guardian set. This is useful for cases like CCQ since using this new method will reduce the number of external calls from
QueryResponse.sol
from 4 to 1 which will save gas and therefore make an even stronger case for the message pull pattern.Gas analysis
Previous
The current verification looks like it does in https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/b9e129e65d34827d92fceeed8c87d3ecdfc801d0/src/QueryResponse.sol#L631-L663, with 4 unique external calls into the core bridge. This gas usage for this was tested with a sample test case:
We exclude the call to
storeGuardianSetPub
, and the total gas for this sums to 12,284.New verifyCurrentQuorum method
The gas to call this new method is 10,313.
Summary
This helper method saves 12,284 - 10,313 = 1971 gas