Chore(standalone): reuse contract_methods logic #830
Merged
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 a follow-up PR from #827 . In this PR we make the standalone engine reuse the logic that was isolated from the contract in that PR. One key thing to notice about this change is the raw bytes that would be passed to the on-chain contract as input are now also passed to the standalone engine. This will help enable the hashchain to work identically both on-chain and off-chain. Additionally, the output from all methods is captured in the IO instance. We do not yet make use of this, but in a follow-up PR this will also be a necessary feature to ensure the hashchain works properly.
Performance / NEAR gas cost considerations
N/A standalone engine changes only
Testing
Existing tests.
Additional information
Note: the
TransactionKind::raw_bytes
method is only used in tests and for backwards compatibility. After a full re-index of the Borealis state (which will be needed to compute the hashchain history anyway) this method will not be used in production (i.e. we are not de-serializing + re-serializing the input on every transaction, that would be very inefficient).