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

fix code coverage - stack too deep issues #12843

Closed
wants to merge 21 commits into from

Conversation

AmadiMichael
Copy link
Member

@AmadiMichael AmadiMichael commented Nov 6, 2024

No description provided.

@AmadiMichael
Copy link
Member Author

Note: forge coverage works if lib-keccak merges this ethereum-optimism/lib-keccak#6 and we update the dependency

Copy link

codecov bot commented Nov 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 44.30%. Comparing base (16a5d61) to head (7a2eb56).
Report is 10 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #12843      +/-   ##
===========================================
- Coverage    44.44%   44.30%   -0.14%     
===========================================
  Files          801      801              
  Lines        72001    72001              
===========================================
- Hits         31999    31900      -99     
- Misses       37393    37494     +101     
+ Partials      2609     2607       -2     
Flag Coverage Δ
cannon-go-tests-32 61.85% <ø> (-2.02%) ⬇️
cannon-go-tests-64 56.72% <ø> (-1.66%) ⬇️

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

see 18 files with indirect coverage changes

@AmadiMichael
Copy link
Member Author

Also, for forge coverage to work, we'll need to make test_callWithMinGas_noLeakageHigh_succeeds and test_callWithMinGas_noLeakageLow_succeeds to work for 2 gas values each.

@smartcontracts
Copy link
Contributor

It will take some time to get this PR merged as it changes prod contracts but it's a valuable reference because it allows us to generate coverage reports either way.

@AmadiMichael
Copy link
Member Author

Also, for forge coverage to work, we'll need to make test_callWithMinGas_noLeakageHigh_succeeds and test_callWithMinGas_noLeakageLow_succeeds to work for 2 gas values each.

this is now implemented.

@AmadiMichael
Copy link
Member Author

AmadiMichael commented Nov 7, 2024

Note: forge coverage works if lib-keccak merges this ethereum-optimism/lib-keccak#6 and we update the dependency.

This is now updated

Comment on lines +54 to +55
/// @custom:semver 1.1.3-beta.7
string public constant version = "1.1.3-beta.7";
Copy link
Contributor

Choose a reason for hiding this comment

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

accidental semver bump?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nope, lib-keccak was updated

Copy link
Contributor

Choose a reason for hiding this comment

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

That makes sense, but do we normally bump semvers when a dependency bump happens? I'm supportive of it because it changes the bytecode, but I suspect historically we've been bad at this and need a way to better automate semver bumps (cc @smartcontracts)

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 it's actually on the to-do @smartcontracts

Copy link
Contributor

Choose a reason for hiding this comment

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

CI will at least force you to semver bump when dependencies are changed

Copy link
Contributor

Choose a reason for hiding this comment

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

We are planning to simplify things and remove contract-specific semvers as part of the OPCM Upgrades work in ethereum-optimism/design-docs#159. That design review is today (at 1030am PT)

/// @custom:field _l2ChainId Chain ID of the L2 network this contract argues about.
/// @custom:field _proposer Address that is allowed to create instances of this contract.
/// @custom:field _challenger Address that is allowed to challenge instances of this contract.
struct PDGConstructorParams {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it still solve stack too deep if we remove proposer and challenger from this struct and have those as individual inputs? The rationale being we can then keep the interface between the PDG and regular FDG more similar, and have them both take the same FDGConstructorParams arg, then PDF just takes two extra args

Copy link
Contributor

Choose a reason for hiding this comment

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

@mds1 yeah I was thinking the same, would be nicer that way imo.

Copy link
Member Author

Choose a reason for hiding this comment

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

It compiles with forge coverage this way but would need to be excluded from interfaces check. Couldn't find a way to use this struct for both contracts without breaking the interfaces check for IPermissionedDisputeGame.sol. The only option is verbose and probably unneccesarily more costly gas-wise.

constructor (DGConstructorParams memory _params) FaultDisputeGame(FaultDisputeGame.DGConstructorParams({
        _gameType: _params._gameType,
        _absolutePrestate: _params._absolutePrestate,
        ...
})) {
        ...
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, ok, I'll take a look at this and see if I can get it to pass the checks

@mds1
Copy link
Contributor

mds1 commented Nov 7, 2024

Overall pretty small diff to fix stack too deep. This is awesome, nice work!

@AmadiMichael
Copy link
Member Author

This PR was broken down into multiple PRs and merged into develop.

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