Skip to content
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] Batch run transactions #5614

Merged
merged 43 commits into from
Apr 26, 2024
Merged

[EVM] Batch run transactions #5614

merged 43 commits into from
Apr 26, 2024

Conversation

sideninja
Copy link
Member

@sideninja sideninja commented Apr 2, 2024

Closes: #5501

Implements ability to batch run transactions and expose it on the EVM contract as batchRun(txs: [[UInt8]], coinbase: EVMAddress): [Result].

The transactions will be run sequentially and each transaction will produce a result which will be accumulated and returned as an array of results.

Corresponding FLIP update: onflow/flips#257

@sideninja sideninja self-assigned this Apr 2, 2024
@codecov-commenter
Copy link

codecov-commenter commented Apr 2, 2024

Codecov Report

Attention: Patch coverage is 70.31250% with 57 lines in your changes are missing coverage. Please review.

Project coverage is 55.69%. Comparing base (9cc82c7) to head (4fd401d).

Files Patch % Lines
fvm/evm/handler/handler.go 64.55% 14 Missing and 14 partials ⚠️
fvm/evm/emulator/emulator.go 62.85% 7 Missing and 6 partials ⚠️
fvm/evm/stdlib/contract.go 87.69% 4 Missing and 4 partials ⚠️
fvm/evm/types/result.go 0.00% 6 Missing ⚠️
fvm/evm/types/block.go 71.42% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5614      +/-   ##
==========================================
+ Coverage   55.63%   55.69%   +0.05%     
==========================================
  Files        1094     1094              
  Lines       85411    85571     +160     
==========================================
+ Hits        47520    47655     +135     
+ Misses      33317    33307      -10     
- Partials     4574     4609      +35     
Flag Coverage Δ
unittests 55.69% <70.31%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sideninja sideninja marked this pull request as ready for review April 11, 2024 10:27
@@ -311,7 +372,7 @@ func TestContractInteraction(t *testing.T) {
require.NoError(t, err)
})
})
account.SetNonce(account.Nonce() + 1)
account.SetNonce(account.Nonce() + 4)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this test fail if it is not run after "test batch running transactions"? Can we do this differently? Ideally we would be able to run any test individually.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, this sucks I agree, the tests right now assume this managing nonce like that. I think it touches couple of tests, so probably a separate issue. Will open it. #5744

@sideninja sideninja requested a review from ramtinms April 19, 2024 17:22
Copy link
Member

@ramtinms ramtinms left a 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,

maybe if you have time just add an extra test in emulator or evm with a sequence of transactions (each emit an event and update a value) like this:
Successful, Invalid, Successful, Failed, Successful
Then we can check no side effect across transactions.

@sideninja
Copy link
Member Author

Looks good to me,

maybe if you have time just add an extra test in emulator or evm with a sequence of transactions (each emit an event and update a value) like this: Successful, Invalid, Successful, Failed, Successful Then we can check no side effect across transactions.

Added this to the issue: #5748 (comment)

@sideninja sideninja added this pull request to the merge queue Apr 24, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 24, 2024
@sideninja sideninja added this pull request to the merge queue Apr 25, 2024
@sideninja sideninja removed this pull request from the merge queue due to a manual request Apr 25, 2024
@sideninja sideninja added this pull request to the merge queue Apr 25, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Apr 25, 2024
Gregor G added 3 commits April 25, 2024 18:03
# Conflicts:
#	fvm/evm/emulator/emulator.go
#	fvm/evm/stdlib/contract.go
#	fvm/evm/testutils/contracts/test_bytes.hex
@sideninja sideninja added this pull request to the merge queue Apr 25, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 25, 2024
@sideninja sideninja added this pull request to the merge queue Apr 26, 2024
Merged via the queue into master with commit 55bb6fe Apr 26, 2024
55 checks passed
@sideninja sideninja deleted the gregor/evm/batch-run branch April 26, 2024 12:35
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Flow EVM] supporting evm.batchRun
4 participants