forked from OffchainLabs/nitro-testnode
-
Notifications
You must be signed in to change notification settings - Fork 6
Feat: Add support for Bold upgrade tests for v3.2.0 contracts #147
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| import { JsonRpcProvider } from '@ethersproject/providers' | ||
|
|
||
| export type CreatorTemplates = { | ||
| eth: { | ||
| bridge: string | ||
| sequencerInbox: string | ||
| delayBufferableSequencerInbox: string | ||
| inbox: string | ||
| rollupEventInbox: string | ||
| outbox: string | ||
| } | ||
| erc20: { | ||
| bridge: string | ||
| sequencerInbox: string | ||
| delayBufferableSequencerInbox: string | ||
| inbox: string | ||
| rollupEventInbox: string | ||
| outbox: string | ||
| } | ||
| rollupUserLogic: string | ||
| rollupAdminLogic: string | ||
| challengeManagerTemplate: string | ||
| osp: string | ||
| rollupCreator: string | ||
| } | ||
|
|
||
| export const templates: { | ||
| [key: number]: CreatorTemplates | ||
| } = { | ||
| 1337: { | ||
| eth: { | ||
| bridge: '0xC678f7B95A7D1F77c6024c0086301D21402854b1', | ||
| sequencerInbox: '0xda51f4f63B6c1541D049A0F3d641493463559A92', | ||
| delayBufferableSequencerInbox: | ||
| '0x595841B05587dc6EFB52da4ce6A04B5DfFdB82C5', | ||
| inbox: '0x8D3b93dfFFf4842E7B61FB553b383db2C6BC91c6', | ||
| rollupEventInbox: '0x796FeE4adceD1cb47a3e3d1B6925472F8fC8f1f9', | ||
| outbox: '0x396765AEbE540575ef927F769b0d7b89594f931c', | ||
| }, | ||
| erc20: { | ||
| bridge: '0x0124687D1F2869b0C2335B98ddc7FCf59DA2CEa1', | ||
| sequencerInbox: '0x1E664bf1d6E5b5943a03827ed553D2A71f4bF3D0', | ||
| delayBufferableSequencerInbox: | ||
| '0x0aa9AA5Ebd323c1e37Ba081B512Ae1e2fA8Cf783', | ||
| inbox: '0xBfd8916b9DCB60B3b437D2B3a6FF56F78DcD9Ff2', | ||
| rollupEventInbox: '0x2706682dD3bD709b055E0266D98BA380FE22B807', | ||
| outbox: '0x5128805C5331A3D445B72545d2461B2C3B05218c', | ||
| }, | ||
| rollupUserLogic: '0xedC23dFC7D1e57EC07eA5ff7419634DbAe08Ed2C', | ||
| rollupAdminLogic: '0xAb7A44CE7e66963d2116dCe74AB63eeF88266C82', | ||
| challengeManagerTemplate: '0xCAaa9332F940362aEAAADD1B0A59c229C4fD8f79', | ||
| osp: '0x5087a6fD526eFD5c6770d94D0c325de0e2A2c44D', | ||
| rollupCreator: '0x611b4875141798A61d56Ae19Af8A9531aD237D88', | ||
| }, | ||
| } | ||
|
|
||
| export async function verifyCreatorTemplates( | ||
| l1Rpc: JsonRpcProvider, | ||
| templates: CreatorTemplates | ||
| ) { | ||
| const checkAddress = async (name: string, address: string) => { | ||
| if ((await l1Rpc.getCode(address)).length <= 2) { | ||
| throw new Error(`No code found for template ${name} at ${address}`) | ||
| } | ||
| } | ||
|
|
||
| for (const [key, value] of Object.entries(templates)) { | ||
| if (value == null) { | ||
| throw new Error(`Template property ${key} is null or undefined`) | ||
| } | ||
| if (typeof value === 'string') { | ||
| await checkAddress(key, value) | ||
| } else { | ||
| for (const [subkey, subvalue] of Object.entries(value)) { | ||
| await checkAddress(`${key}.${subkey}`, subvalue as string) | ||
| } | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,4 +23,4 @@ while true; do | |
| sleep 5 | ||
| done | ||
|
|
||
| docker compose down | ||
| docker compose down --remove-orphans | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current implementation of
verifyCreatorTemplatesassumes that all properties oftemplatesare either strings or nested objects. However, if any property isundefinedornullat runtime (for example, if the input object is incomplete),typeof valuewill not be'string'. It will fall into theelseblock, where callingObject.entries(value)onundefinedornullwill throw aTypeError: Cannot convert undefined or null to object.To prevent runtime crashes, we should add defensive checks to ensure
valueis a valid object before callingObject.entrieson it.