Closed 0xHansLee closed 6 months ago
The recent update introduces a new version to the Colosseum.sol
contract, enhancing its functionality with a conditional logic for blockHash
determination based on _publicInput.parentBeaconRoot
. In the testing domain, CommonTest.t.sol
sees its FFIInterface
contract's methods refined for clarity, maintaining their core functionality. This update reflects a balance between functional enhancement and code readability, showcasing a thoughtful evolution in the project's development cycle.
File Path | Changes |
---|---|
.../contracts/L1/Colosseum.sol |
Updated semantic version to 1.1.0 ; added conditional logic for blockHash determination. |
.../contracts/test/CommonTest.t.sol |
Reformatted getProveWithdrawalTransactionInputs , encodeDepositTransaction , and getMerkleTrieFuzzCase in FFIInterface for improved readability. |
packages/contracts/.gas-snapshot (2)
`10-11`: Increased gas costs for `test_cancelChallenge_senderNotChallenger_reverts()` and `test_cancelChallenge_succeeds()` may indicate more complex logic or additional operations. Verify that these changes are expected and optimize if possible. --- `377-377`: The significant increase in gas for `test_nextValidator_succeeds()` in `ValidatorPoolTest` warrants a closer examination. Ensure that the added complexity is necessary and consider optimization strategies.kroma-bindings/bindings/colosseum_more.go (4)
`16-16`: Ensure the `ColosseumDeployedBin` variable is correctly updated. It's important to verify that the `ColosseumDeployedBin` variable contains the correct deployed binary for the Colosseum contract. This is crucial for the integrity and functionality of the contract bindings. --- `17-17`: Validate JSON structure and content for `ColosseumStorageLayoutJSON`. It's essential to ensure that the `ColosseumStorageLayoutJSON` string is a valid JSON and accurately represents the storage layout of the Colosseum contract. This validation helps prevent runtime errors and inconsistencies in accessing contract storage.Verification successful
--- The script was executed to validate the JSON content of `ColosseumStorageLayoutJSON` using `jq`. The absence of output from the `jq` command, in this context, indicates that the JSON content is valid, as `jq empty` would produce an error message if the JSON were malformed. Therefore, the JSON structure and content for `ColosseumStorageLayoutJSON` have been successfully verified as valid.--- `17-17`: Initialization logic in `init` function should handle errors gracefully. Consider handling the error from `json.Unmarshal` more gracefully instead of using `panic`. For instance, logging the error or initializing with default values could be more user-friendly approaches, especially for a library that might be used in various environments. --- `17-17`: Use of global variables for contract layouts and bytecodes. Global variables (`layouts`, `deployedBytecodes`, `immutableReferences`) are used to store contract information. While this is a common pattern in generated bindings, be mindful of potential concurrency issues and consider encapsulating these in a struct or using sync primitives if modifications are expected at runtime.Scripts Executed
The following scripts were executed for the analysis: --- Script: ```shell #!/bin/bash # Verify the JSON structure of ColosseumStorageLayoutJSON echo $'ColosseumStorageLayoutJSON' | jq empty ``` Length of output: 101 --- --- Script: ```shell #!/bin/bash # Search for the definition of ColosseumStorageLayoutJSON in the codebase and display its content rg "ColosseumStorageLayoutJSON\s*=" --multiline-dotall ``` Length of output: 2690 --- --- Script: ```shell #!/bin/bash # Validate the JSON content of ColosseumStorageLayoutJSON json_content='{"storage":[{"astId":1000,"contract":"contracts/L1/Colosseum.sol:Colosseum","label":"_initialized","offset":0,"slot":"0","type":"t_uint8"},{"astId":1001,"contract":"contracts/L1/Colosseum.sol:Colosseum","label":"_initializing","offset":1,"slot":"0","type":"t_bool"},{"astId":1002,"contract":"contracts/L1/Colosseum.sol:Colosseum","label":"segmentsLengths","offset":0,"slot":"1","type":"t_mapping(t_uint256,t_uint256)"},{"astId":1003,"contract":"contracts/L1/Colosseum.sol:Colosseum","label":"challenges","offset":0,"slot":"2","type":"t_mapping(t_uint256,t_mapping(t_address,t_struct(Challenge)1005_storage))"},{"astId":1004,"contract":"contracts/L1/Colosseum.sol:Colosseum","label":"verifiedPublicInputs","offset":0,"slot":"3","type":"t_mapping(t_bytes32,t_bool)"}],"types":{"t_address":{"encoding":"inplace","label":"address","numberOfBytes":"20"},"t_array(t_bytes32)dyn_storage":{"encoding":"dynamic_array","label":"bytes32[]","numberOfBytes":"32","base":"t_bytes32"},"t_bool":{"encoding":"inplace","label":"bool","numberOfBytes":"1"},"t_bytes32":{"encoding":"inplace","label":"bytes32","numberOfBytes":"32"},"t_mapping(t_address,t_struct(Challenge)1005_storage)":{"encoding":"mapping","label":"mapping(address => struct Types.Challenge)","numberOfBytes":"32","key":"t_address","value":"t_struct(Challenge)1005_storage"},"t_mapping(t_bytes32,t_bool)":{"encoding":"mapping","label":"mapping(bytes32 => bool)","numberOfBytes":"32","key":"t_bytes32","value":"t_bool"},"t_mapping(t_uint256,t_mapping(t_address,t_struct(Challenge)1005_storage))":{"encoding":"mapping","label":"mapping(uint256 => mapping(address => struct Types.Challenge))","numberOfBytes":"32","key":"t_uint256","value":"t_mapping(t_address,t_struct(Challenge)1005_storage)"},"t_mapping(t_uint256,t_uint256)":{"encoding":"mapping","label":"mapping(uint256 => uint256)","numberOfBytes":"32","key":"t_uint256","value":"t_uint256"},"t_struct(Challenge)1005_storage":{"encoding":"inplace","label":"struct Types.Challenge","numberOfBytes":"160"},"t_uint256":{"encoding":"inplace","label":"uint256","numberOfBytes":"32"},"t_uint64":{"encoding":"inplace","label":"uint64","numberOfBytes":"8"},"t_uint8":{"encoding":"inplace","label":"uint8","numberOfBytes":"1"}}}' echo $json_content | jq empty ``` Length of output: 4502
Support both Cancun and Shanghai block for Colosseum.