-
Notifications
You must be signed in to change notification settings - Fork 375
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
Adds backwards compatibility in UsingPrecompile
contract.
#11236
Adds backwards compatibility in UsingPrecompile
contract.
#11236
Conversation
Adds backwards compatibility in
|
Severity Level | Results | |
---|---|---|
Contracts | Critical High Medium Low Note Total |
3 2 0 14 43 62 |
Dependencies | Critical High Medium Low Note Total |
0 0 0 0 0 0 |
For more details view the full report in OpenZeppelin Code Inspector
As of 50bec5c Testing is not fully implemented for registry functions, but the plan was to use stCELO only uses To get the epoch info based on block number, I used binary search to avoid looping through all the epoch 1x1. This was required for We could further improve the compute cost by introducing a mapping of blocksToEpoch,
but that would be a more complex change and increase the gas cost of processing an epoch as we'd have to store this info during processing. NOTE: Not all functions have backwards compatibility. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but there's a few, potentially very impactful, gas optimizations possible. There's no need to read the entire elected
array into memory when we only need one field of the Epoch struct, or just one of the elected addresses. These should be fairly simple changes that would reduce the number of SLOAD
s by a factor of ~100 where relevant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to fix all precompiles in all contracts
…backward-compatibility-fix
…backward-compatibility-fix
… to be in use by external parties
Description
Updated
UsingPrecompile
contract to maintain backwards compatibility after L2 migration.Fucntions that maintained backwards compatibility query the required information from the
EpochManager
contract instead of the precompiles.Other changes
Was required to add the list of elected validators to the
Epoch
struct of the EpochManager contract to keep the historical list of elected validators at a given epoch number.Tested
Added unit test.
Related issues
Backwards compatibility
for some select functions