-
Notifications
You must be signed in to change notification settings - Fork 184
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
[EVM] Dry-run function #5749
[EVM] Dry-run function #5749
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5749 +/- ##
==========================================
+ Coverage 55.67% 55.69% +0.01%
==========================================
Files 1094 1094
Lines 85576 85645 +69
==========================================
+ Hits 47648 47696 +48
- Misses 33321 33334 +13
- Partials 4607 4615 +8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
This commit includes the addition of a new method named DryRunTransaction in the emulator. This method performs a dry run of an unsigned transaction without persisting any state changes. The functionality also considers the 'from' address as the signer given that the transaction is not signed.
The dry run methods in the ContractHandler have been significantly refactored to simplify their parameters and improve their clarity. Specifically, the transaction is now passed as an RLP-encoded byte array instead of separate parameters for each part of the transaction. This streamlines the function definition and the calls to it and relies more on standard transaction representation and less on custom data structures.
The `dryRun` function in the EVM contracts has been simplified for easier usage. This new implementation takes a transaction and a from-address as arguments, instead of separate entities like `from`, `to`, `gasLimit`, `value`, and `data`. The changes provide a neater interface and potentially reduce errors stemming from incorrect or ambiguous inputs.
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 to me just some minor comments
# Conflicts: # fvm/evm/handler/handler_test.go # fvm/evm/stdlib/contract.cdc # fvm/evm/stdlib/contract.go # fvm/evm/stdlib/contract_test.go # fvm/evm/testutils/emulator.go # fvm/evm/types/emulator.go # fvm/evm/types/handler.go
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!
Closes: #5603
🍄 API Added Function
A new function for dry-running was added to the EVM Core contract:
The function takes the unsigned RLP encoded transaction and from address and dry-run a transaction to calculate used gas and result which is reported back to the caller.
This will be used for gas estimation and calling contract values by EVM gateway.