-
Notifications
You must be signed in to change notification settings - Fork 80
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(standalone): logic for parsing TransactionKind from raw Near data #810
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-testing
Area: If something has added tests, or changed them.
rust
Pull requests that update Rust code
labels
Aug 2, 2023
aleksuss
reviewed
Aug 3, 2023
joshuajbouw
approved these changes
Aug 3, 2023
birchmd
force-pushed
the
chore/birchmd/tests-refactor
branch
from
August 3, 2023 14:16
6f99fa6
to
8b41e8e
Compare
aleksuss
approved these changes
Aug 3, 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
aleksuss
pushed a commit
that referenced
this pull request
Aug 10, 2023
#810) ## Description This is the first in a series of PRs that is meant to split up #705 . The idea is to merge the changes which are made in that PR in logical chunks until eventually the whole hashchain implementation is in. Doing the work in smaller pieces will both make it easier to review and prevent us from needing to maintain large, long-lived feature branches. This first PR pulls in the transaction transaction parsing logic from [borealis-engine-lib](https://github.com/aurora-is-near/borealis-engine-lib) into this repo (in a future PR we will remove the duplicated code from borealis-engine-lib). The logic is used here to simplify how transactions are handled in tests because all transactions can automatically be passed to both the Near runtime (processed by the Engine as Wasm) and the standalone engine. In particular we remove the large `if` statement that was starting to get unwieldy. This work is important both because it makes future tests easier to write and because it synchronizes the standalone and wasm engine instances in our tests (this latter point is a prerequisite for properly testing the hashchain). Some notes about the PR: 1. I renamed the constant `ORIGIN` to `DEFAULT_AURORA_ACCOUNT_ID` because I felt the latter is a more descriptive name for what the constant represents. 2. The standalone engine is now present in `AuroraRunner` by default to make out testing more robust (for example tests will now automatically fail if a new state-mutating method is added to the Engine's `lib.rs` without also being added to the standalone implementation). This means there are a few places were I need to explicitly remove the standalone instance where `AuroraRunner` is used as something other than an Engine instance (modexp and xcc tests). 3. Some tests use view calls to inspect the Engine state and make assertions. These calls are not present in the standalone because it only cares about transactions that mutate the state. To make view calls in `AuroraRunner` it is now required to call `.one_shot()` before the calls. This essentially tells the testing framework that you are making a view call so no state modifications will be made and therefore we can ignore the standalone.
mrLSD
approved these changes
Nov 18, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-testing
Area: If something has added tests, or changed them.
C-enhancement
Category: New feature or request
rust
Pull requests that update Rust code
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 is the first in a series of PRs that is meant to split up #705 . The idea is to merge the changes which are made in that PR in logical chunks until eventually the whole hashchain implementation is in. Doing the work in smaller pieces will both make it easier to review and prevent us from needing to maintain large, long-lived feature branches.
This first PR pulls in the transaction transaction parsing logic from borealis-engine-lib into this repo (in a future PR we will remove the duplicated code from borealis-engine-lib). The logic is used here to simplify how transactions are handled in tests because all transactions can automatically be passed to both the Near runtime (processed by the Engine as Wasm) and the standalone engine. In particular we remove the large
if
statement that was starting to get unwieldy.This work is important both because it makes future tests easier to write and because it synchronizes the standalone and wasm engine instances in our tests (this latter point is a prerequisite for properly testing the hashchain).
Some notes about the PR:
ORIGIN
toDEFAULT_AURORA_ACCOUNT_ID
because I felt the latter is a more descriptive name for what the constant represents.AuroraRunner
by default to make out testing more robust (for example tests will now automatically fail if a new state-mutating method is added to the Engine'slib.rs
without also being added to the standalone implementation). This means there are a few places were I need to explicitly remove the standalone instance whereAuroraRunner
is used as something other than an Engine instance (modexp and xcc tests).AuroraRunner
it is now required to call.one_shot()
before the calls. This essentially tells the testing framework that you are making a view call so no state modifications will be made and therefore we can ignore the standalone.