Skip to content

MTCannon: Fix AssertEVMReverts to correctly construct data#12200

Merged
Inphi merged 11 commits intoethereum-optimism:developfrom
joohhnnn:12198-1
Oct 8, 2024
Merged

MTCannon: Fix AssertEVMReverts to correctly construct data#12200
Inphi merged 11 commits intoethereum-optimism:developfrom
joohhnnn:12198-1

Conversation

@joohhnnn
Copy link
Copy Markdown
Contributor

@joohhnnn joohhnnn commented Sep 29, 2024

First part of #12198

  1. Added WithRegisters for initializing state's Registers.
  2. Added ThreadProofEncoder helper function to generate ThreadProof.
  3. Updated AssertEVMReverts to include statePCs for multiple memory requirements, added ProofData parameter for passing ThreadProof, and introduced expectedReason parameter for more precise testing.
  4. Revised TestEVMFault and TestEVM_UnsupportedSyscall test functions to be compatible with AssertEVMReverts.
  5. used hardcoding for the illegal instruction that needs SecondMemoryProof

@joohhnnn joohhnnn requested review from a team and mbaxter September 29, 2024 22:07
Copy link
Copy Markdown
Contributor

@mbaxter mbaxter left a comment

Choose a reason for hiding this comment

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

Thanks for raising this issue - great find!

Comment thread cannon/mipsevm/iface.go Outdated
Comment thread cannon/mipsevm/testutil/mips.go Outdated
Comment thread cannon/mipsevm/singlethreaded/state.go Outdated
2. Added `ThreadProofEncoder` helper function to generate `ThreadProof`.
3. Updated `AssertEVMReverts` to include `statePCs` for multiple memory requirements, added `ProofData` parameter for passing `ThreadProof`, and introduced `expectedReason` parameter for more precise testing.
4. Revised `TestEVMFault` and `TestEVM_UnsupportedSyscall` test functions to be compatible with `AssertEVMReverts`.
@codecov
Copy link
Copy Markdown

codecov bot commented Oct 4, 2024

Codecov Report

Attention: Patch coverage is 93.75000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 64.11%. Comparing base (6d874d5) to head (6d97ae6).
Report is 14 commits behind head on develop.

Files with missing lines Patch % Lines
cannon/mipsevm/tests/helpers.go 91.89% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #12200      +/-   ##
===========================================
+ Coverage    64.10%   64.11%   +0.01%     
===========================================
  Files           52       52              
  Lines         4312     4345      +33     
===========================================
+ Hits          2764     2786      +22     
- Misses        1374     1385      +11     
  Partials       174      174              
Flag Coverage Δ
cannon-go-tests 64.11% <93.75%> (+0.01%) ⬆️

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

Files with missing lines Coverage Δ
cannon/mipsevm/multithreaded/state.go 53.50% <ø> (-0.18%) ⬇️
cannon/mipsevm/testutil/mips.go 88.07% <100.00%> (+0.57%) ⬆️
cannon/mipsevm/tests/helpers.go 95.83% <91.89%> (-4.17%) ⬇️

... and 1 file with indirect coverage changes

Comment thread cannon/mipsevm/multithreaded/testutil/mutators.go Outdated
Comment thread cannon/mipsevm/tests/helpers.go Outdated
Comment thread cannon/mipsevm/tests/evm_common_test.go Outdated
Comment thread cannon/mipsevm/testutil/mips.go Outdated
Comment thread cannon/mipsevm/testutil/mips.go Outdated
@joohhnnn joohhnnn requested a review from mbaxter October 4, 2024 20:42
Copy link
Copy Markdown
Contributor

@Inphi Inphi left a comment

Choose a reason for hiding this comment

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

This PR overlaps with #12082. See please refer to my comments on the other PR as they apply here.

@joohhnnn joohhnnn requested a review from Inphi October 4, 2024 21:35
Copy link
Copy Markdown
Contributor

@mbaxter mbaxter 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!! Just a few last comments to tidy things up a bit and looks like there's a merge conflict that needs to be resolved.

Comment thread cannon/mipsevm/tests/evm_multithreaded_test.go Outdated
Comment thread cannon/mipsevm/tests/helpers.go Outdated
Comment thread cannon/mipsevm/tests/evm_common_test.go Outdated
Comment thread cannon/mipsevm/tests/evm_common_test.go Outdated
@joohhnnn joohhnnn requested a review from mbaxter October 7, 2024 21:39
Comment thread cannon/mipsevm/testutil/mips.go Outdated
@joohhnnn joohhnnn requested a review from Inphi October 8, 2024 19:35
Copy link
Copy Markdown
Contributor

@Inphi Inphi left a comment

Choose a reason for hiding this comment

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

Excellent! Thanks

@Inphi Inphi enabled auto-merge October 8, 2024 19:50
@Inphi Inphi added this pull request to the merge queue Oct 8, 2024
Merged via the queue into ethereum-optimism:develop with commit 03b526d Oct 8, 2024
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.

3 participants