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

MTCannon: add EmptyThreadStack test #12082

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

joohhnnn
Copy link
Contributor

I've added tests for the EmptyThreadStack scenario based on Issue 11977. I'm using defer and strings for checking because I didn't see panic handling in AssertEVMReverts, and I'm unsure if modifying AssertEVMReverts directly is appropriate.

@joohhnnn joohhnnn requested review from a team as code owners September 24, 2024 14:56
Copy link

codecov bot commented Sep 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.87%. Comparing base (718b9b0) to head (9ce742e).
Report is 4 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #12082      +/-   ##
===========================================
- Coverage    79.10%   78.87%   -0.24%     
===========================================
  Files           41       41              
  Lines         3437     3437              
===========================================
- Hits          2719     2711       -8     
- Misses         548      557       +9     
+ Partials       170      169       -1     
Flag Coverage Δ
cannon-go-tests 78.87% <ø> (-0.24%) ⬇️

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

see 1 file with indirect coverage changes

Copy link
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.

@joohhnnn Thanks for working on this.

We also want to assert that the EVM (MIPS2.sol) reverts when the stack is empty. You can use AssertEVMReverts to do this as it checks for EVM reverts in MIPS2.sol.

cannon/mipsevm/tests/evm_multithreaded_test.go Outdated Show resolved Hide resolved
@joohhnnn joohhnnn requested a review from Inphi September 24, 2024 17:16
} else {
require.NotPanics(t, func() {
goVm.Step(true)
testutil.AssertEVMReverts(t, state, contracts, tracer)
Copy link
Contributor

Choose a reason for hiding this comment

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

For the case where shouldPanic == false, you should use testutil.ValidateEVM as is done here. AssertEVMReverts doesn't actually panic. But rather runs a require assertion against the EVM execution status.

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.

2 participants