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

feat(ctb): Refactor L1 initializer tests #8198

Merged
merged 6 commits into from
Nov 21, 2023
Merged

Conversation

clabby
Copy link
Member

@clabby clabby commented Nov 19, 2023

Overview

Refactors the test_cannotReinitializeL1_succeeds test to account for all L1 contracts which are Initializable.

The new test covers:

  1. All Initializable contracts in src/L1 are accounted for in the contracts array, giving us assurance that we have full coverage of L1 contracts' reinitializers.
  2. The _initialized flag of each contract is properly set to 3 at the start of the test, signifying that the contracts are initialized by the deploy script.
  3. The initialize() function of each contract cannot be called more than once - each attempt should result in a revert message of the format Error(string), with the message "Initializable: contract is already initialized".

Note: This test caught an uncovered Initializable contract in the src/L1 directory, ProtocolVersions. It has been added to the array of tested Initializable contracts.

Metadata
Closes https://github.com/ethereum-optimism/client-pod/issues/214

@clabby clabby requested a review from a team as a code owner November 19, 2023 20:25
@clabby clabby requested a review from refcell November 19, 2023 20:25
@clabby
Copy link
Member Author

clabby commented Nov 19, 2023

Current dependencies on/for this PR:

This stack of pull requests is managed by Graphite.

@clabby clabby requested a review from mds1 November 19, 2023 20:27
Copy link

codecov bot commented Nov 19, 2023

Codecov Report

Merging #8198 (74aa6d1) into develop (5797bca) will decrease coverage by 0.10%.
The diff coverage is n/a.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #8198      +/-   ##
===========================================
- Coverage    53.44%   53.35%   -0.10%     
===========================================
  Files          162      114      -48     
  Lines         6040     3758    -2282     
  Branches       964      813     -151     
===========================================
- Hits          3228     2005    -1223     
+ Misses        2690     1677    -1013     
+ Partials       122       76      -46     
Flag Coverage Δ
cannon-go-tests ?
chain-mon-tests 26.95% <ø> (ø)
common-ts-tests ?
contracts-bedrock-tests 61.26% <ø> (ø)
contracts-ts-tests 100.00% <ø> (ø)
core-utils-tests ?
sdk-next-tests 41.95% <ø> (ø)
sdk-tests 41.95% <ø> (ø)

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

see 48 files with indirect coverage changes

@clabby
Copy link
Member Author

clabby commented Nov 20, 2023

Oddly enough, the gas snapshot for this test differs depending on the host architecture, tested on darwin aarch64 + linux x86_64. Omitting this from the gas snapshot.

@clabby clabby self-assigned this Nov 20, 2023
Copy link
Contributor

@refcell refcell left a comment

Choose a reason for hiding this comment

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

The physiognomy of this regex checks out

Copy link
Contributor

@mds1 mds1 left a comment

Choose a reason for hiding this comment

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

This looks great! Just some minor comments/questions

@tynes
Copy link
Contributor

tynes commented Nov 21, 2023

What do you think about also testing the L2 predeploys using this method?

@clabby clabby force-pushed the cl/ctb/reinit-tests branch from 7e00716 to 2eb4a03 Compare November 21, 2023 17:28
@clabby clabby enabled auto-merge November 21, 2023 18:50
@clabby clabby added this pull request to the merge queue Nov 21, 2023
Merged via the queue into develop with commit 8cd36c2 Nov 21, 2023
60 checks passed
@clabby clabby deleted the cl/ctb/reinit-tests branch November 21, 2023 19:18
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.

4 participants