Feat: Add support for Bold upgrade tests for v3.2.0 contracts#147
Feat: Add support for Bold upgrade tests for v3.2.0 contracts#147Sneh1999 wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a test suite for CAS migration and BoLD upgrade to version 3.2.0, including a new TypeScript template verification script and a comprehensive multi-phase bash test script. Feedback on these changes focuses on improving robustness and maintainability: adding defensive checks in the template verification script to prevent runtime crashes, refactoring hardcoded addresses (such as the light client and sequencer) into variables or dynamic queries, cleaning up temporary files and directories to prevent resource leaks, and simplifying redundant conditional blocks that check the debug flag.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| for (const [key, value] of Object.entries(templates)) { | ||
| if (typeof value === 'string') { | ||
| await checkAddress(key, value) | ||
| } else { | ||
| for (const [subkey, subvalue] of Object.entries(value)) { | ||
| await checkAddress(`${key}.${subkey}`, subvalue) | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
The current implementation of verifyCreatorTemplates assumes that all properties of templates are either strings or nested objects. However, if any property is undefined or null at runtime (for example, if the input object is incomplete), typeof value will not be 'string'. It will fall into the else block, where calling Object.entries(value) on undefined or null will throw a TypeError: Cannot convert undefined or null to object.
To prevent runtime crashes, we should add defensive checks to ensure value is a valid object before calling Object.entries on it.
for (const [key, value] of Object.entries(templates)) {
if (typeof value === 'string') {
await checkAddress(key, value)
} else if (value && typeof value === 'object') {
for (const [subkey, subvalue] of Object.entries(value)) {
if (typeof subvalue === 'string') {
await checkAddress(key + '.' + subkey, subvalue)
}
}
}
}
Description
In this PR we add support for Bold migration of contracts