-
Notifications
You must be signed in to change notification settings - Fork 82
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
Feat(engine): Hashchain integration #831
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
birchmd
added
C-enhancement
Category: New feature or request
A-standalone
Area: the standalone engine EVM
A-engine
Area: purely engine EVM related
labels
Aug 30, 2023
birchmd
requested review from
joshuajbouw,
RomanHodulak and
aleksuss
as code owners
August 30, 2023 14:37
aleksuss
reviewed
Sep 1, 2023
aleksuss
approved these changes
Sep 1, 2023
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.
Amazing work 👍🏻
mrLSD
approved these changes
Sep 1, 2023
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.
LGTM!
Closed
aleksuss
pushed a commit
that referenced
this pull request
Sep 25, 2023
## Description This PR integrates the hashchain feature into the Aurora Engine contract (see aurora-is-near/AIPs#8). This change is fully backwards compatible because by default there is no hashchain present in the contract state and therefore no hashchain computation is done. The method to activate the hashchain is `start_hashchain` requires the contract to be paused and can only be called by a privileged account (I chose to use the key manager instead of introducing a new role). These restrictions are necessary because the hashchain is initialized with a value based on the Engine's transaction history (to enable validating Aurora blocks starting from the deployment of the contract). ## Performance / NEAR gas cost considerations After activating the hashchain there will be a small increase in gas usage because of the hashchain computation. It's not very much for most transactions (as seen in the performance regression tests), but the amount of gas is proportional to the size of the input + output of the transaction (because we compute a hash from this data). ## Testing The tests have been changed to enable the hashchain by default. Therefore all existing tests are running the hashchain code and testing that the Wasm and Standalone results match (this is important because the Refiner will be computing hashchain values off-chain using the Standalone Engine). An additional test has been added for the hashchain feature itself. ## Additional information Note: the diff in `contract_methods` is relatively large, but the code changes are minimal. All that happened is the existing function bodies were wrapped in `with_hashchain`, which changed the indentation. Viewing the PR with whitespace changes ignored may make this section easier to review.
Merged
aleksuss
added a commit
that referenced
this pull request
Sep 25, 2023
- Added the possibility to use native NEAR instead of wNEAR on Aurora by [@karim-en]. ([#750]) - Added hashchain integration by [@birchmd]. ([#831]) - Added functions for setting and getting metadata of ERC-20 contracts deployed with `deploy_erc20_token` transaction by [@aleksuss]. ([#837]) --------- Co-authored-by: Michael Birch <[email protected]> Co-authored-by: Evgeny Ukhanov <[email protected]> Co-authored-by: Karim <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-engine
Area: purely engine EVM related
A-standalone
Area: the standalone engine EVM
C-enhancement
Category: New feature or request
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.
Description
This PR integrates the hashchain feature into the Aurora Engine contract (see aurora-is-near/AIPs#8). This change is fully backwards compatible because by default there is no hashchain present in the contract state and therefore no hashchain computation is done.
The method to activate the hashchain is
start_hashchain
requires the contract to be paused and can only be called by a privileged account (I chose to use the key manager instead of introducing a new role). These restrictions are necessary because the hashchain is initialized with a value based on the Engine's transaction history (to enable validating Aurora blocks starting from the deployment of the contract).Performance / NEAR gas cost considerations
After activating the hashchain there will be a small increase in gas usage because of the hashchain computation. It's not very much for most transactions (as seen in the performance regression tests), but the amount of gas is proportional to the size of the input + output of the transaction (because we compute a hash from this data).
Testing
The tests have been changed to enable the hashchain by default. Therefore all existing tests are running the hashchain code and testing that the Wasm and Standalone results match (this is important because the Refiner will be computing hashchain values off-chain using the Standalone Engine). An additional test has been added for the hashchain feature itself.
Additional information
Note: the diff in
contract_methods
is relatively large, but the code changes are minimal. All that happened is the existing function bodies were wrapped inwith_hashchain
, which changed the indentation. Viewing the PR with whitespace changes ignored may make this section easier to review.