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
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
40b771b
fix code coverage - stack too deep issues
AmadiMichael Nov 6, 2024
d496004
fix ci
AmadiMichael Nov 6, 2024
88a12fb
fix
AmadiMichael Nov 6, 2024
9102a55
fix safe call tests for forge coverage
AmadiMichael Nov 6, 2024
5ba910d
fix safe call tests for forge coverage
AmadiMichael Nov 6, 2024
204f9fc
fix failing cannon fuzz tests
AmadiMichael Nov 7, 2024
84db6cd
fix
AmadiMichael Nov 7, 2024
2910308
update lib-keccak dep
AmadiMichael Nov 7, 2024
48f4228
semver lock
AmadiMichael Nov 7, 2024
0e1476e
Merge branch 'develop' of https://github.com/ethereum-optimism/optimi…
AmadiMichael Nov 8, 2024
6409a48
add safe call test comment
AmadiMichael Nov 8, 2024
e7ae34f
fix failing coverage test
AmadiMichael Nov 8, 2024
dafad3c
pull develop in
AmadiMichael Nov 13, 2024
60f18c7
fixes
AmadiMichael Nov 13, 2024
316c93e
Merge branch 'develop' of https://github.com/ethereum-optimism/optimi…
AmadiMichael Nov 19, 2024
573cdef
pull develop and fix compilation fail
AmadiMichael Nov 19, 2024
4954115
Merge branch 'develop' of https://github.com/ethereum-optimism/optimi…
AmadiMichael Nov 20, 2024
adb5b4d
Merge branch 'develop' of https://github.com/ethereum-optimism/optimi…
AmadiMichael Nov 20, 2024
a1c23c6
Merge branch 'develop' of https://github.com/ethereum-optimism/optimi…
AmadiMichael Nov 24, 2024
d00ac35
Merge branch 'develop' of https://github.com/ethereum-optimism/optimi…
AmadiMichael Nov 25, 2024
7a2eb56
pull
AmadiMichael Nov 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions packages/contracts-bedrock/scripts/deploy/DeployDisputeGame.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -321,18 +321,20 @@ contract DeployDisputeGame is Script {
abi.encodeCall(
IPermissionedDisputeGame.__constructor__,
(
args.gameType,
args.absolutePrestate,
args.maxGameDepth,
args.splitDepth,
args.clockExtension,
args.maxClockDuration,
args.gameVm,
args.delayedWethProxy,
args.anchorStateRegistryProxy,
args.l2ChainId,
args.proposer,
args.challenger
IPermissionedDisputeGame.PDGConstructorParams({
_gameType: args.gameType,
_absolutePrestate: args.absolutePrestate,
_maxGameDepth: args.maxGameDepth,
_splitDepth: args.splitDepth,
_clockExtension: args.clockExtension,
_maxClockDuration: args.maxClockDuration,
_vm: args.gameVm,
_weth: args.delayedWethProxy,
_anchorStateRegistry: args.anchorStateRegistryProxy,
_l2ChainId: args.l2ChainId,
_proposer: args.proposer,
_challenger: args.challenger
})
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,18 +197,20 @@ contract DeployUpgrade is Deployer {
bytes memory constructorInput = abi.encodeCall(
IPermissionedDisputeGame.__constructor__,
(
GameTypes.PERMISSIONED_CANNON,
Claim.wrap(bytes32(cfg.faultGameAbsolutePrestate())),
cfg.faultGameMaxDepth(),
cfg.faultGameSplitDepth(),
Duration.wrap(uint64(cfg.faultGameClockExtension())),
Duration.wrap(uint64(cfg.faultGameMaxClockDuration())),
IBigStepper(mustGetAddress("MIPS")),
IDelayedWETH(payable(mustGetAddress("DelayedWETHProxyPDG"))),
IAnchorStateRegistry(mustGetAddress("AnchorStateRegistry")),
cfg.l2ChainID(),
cfg.l2OutputOracleProposer(),
cfg.l2OutputOracleChallenger()
IPermissionedDisputeGame.PDGConstructorParams({
_gameType: GameTypes.PERMISSIONED_CANNON,
_absolutePrestate: Claim.wrap(bytes32(cfg.faultGameAbsolutePrestate())),
_maxGameDepth: cfg.faultGameMaxDepth(),
_splitDepth: cfg.faultGameSplitDepth(),
_clockExtension: Duration.wrap(uint64(cfg.faultGameClockExtension())),
_maxClockDuration: Duration.wrap(uint64(cfg.faultGameMaxClockDuration())),
_vm: IBigStepper(mustGetAddress("MIPS")),
_weth: IDelayedWETH(payable(mustGetAddress("DelayedWETHProxyPDG"))),
_anchorStateRegistry: IAnchorStateRegistry(mustGetAddress("AnchorStateRegistry")),
_l2ChainId: cfg.l2ChainID(),
_proposer: cfg.l2OutputOracleProposer(),
_challenger: cfg.l2OutputOracleChallenger()
})
)
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,64 +2,71 @@
{
"inputs": [
{
"internalType": "GameType",
"name": "_gameType",
"type": "uint32"
},
{
"internalType": "Claim",
"name": "_absolutePrestate",
"type": "bytes32"
},
{
"internalType": "uint256",
"name": "_maxGameDepth",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_splitDepth",
"type": "uint256"
},
{
"internalType": "Duration",
"name": "_clockExtension",
"type": "uint64"
},
{
"internalType": "Duration",
"name": "_maxClockDuration",
"type": "uint64"
},
{
"internalType": "contract IBigStepper",
"name": "_vm",
"type": "address"
},
{
"internalType": "contract IDelayedWETH",
"name": "_weth",
"type": "address"
},
{
"internalType": "contract IAnchorStateRegistry",
"name": "_anchorStateRegistry",
"type": "address"
},
{
"internalType": "uint256",
"name": "_l2ChainId",
"type": "uint256"
},
{
"internalType": "address",
"name": "_proposer",
"type": "address"
},
{
"internalType": "address",
"name": "_challenger",
"type": "address"
"components": [
{
"internalType": "GameType",
"name": "_gameType",
"type": "uint32"
},
{
"internalType": "Claim",
"name": "_absolutePrestate",
"type": "bytes32"
},
{
"internalType": "uint256",
"name": "_maxGameDepth",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_splitDepth",
"type": "uint256"
},
{
"internalType": "Duration",
"name": "_clockExtension",
"type": "uint64"
},
{
"internalType": "Duration",
"name": "_maxClockDuration",
"type": "uint64"
},
{
"internalType": "contract IBigStepper",
"name": "_vm",
"type": "address"
},
{
"internalType": "contract IDelayedWETH",
"name": "_weth",
"type": "address"
},
{
"internalType": "contract IAnchorStateRegistry",
"name": "_anchorStateRegistry",
"type": "address"
},
{
"internalType": "uint256",
"name": "_l2ChainId",
"type": "uint256"
},
{
"internalType": "address",
"name": "_proposer",
"type": "address"
},
{
"internalType": "address",
"name": "_challenger",
"type": "address"
}
],
"internalType": "struct PermissionedDisputeGame.PDGConstructorParams",
"name": "_params",
"type": "tuple"
}
],
"stateMutability": "nonpayable",
Expand Down
16 changes: 8 additions & 8 deletions packages/contracts-bedrock/snapshots/semver-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,20 +136,20 @@
"sourceCodeHash": "0x0fa0633a769e73f5937514c0003ba7947a1c275bbe5b85d78879c42f0ed8895b"
},
"src/cannon/MIPS.sol": {
"initCodeHash": "0xb4aec227019dacd6194d6aeb9ca68c23c60b95618d18a4ebc09243514aeb1f05",
"sourceCodeHash": "0x4d43b3f2918486aa76d2d59ac42e4f6aa2f58538c7e95a5cb99b63c9588b5f1c"
"initCodeHash": "0xe1b9de604c61e7daad99a2eb90dfce89d605bc303df56b0a1c7ccb493fa8600d",
"sourceCodeHash": "0xf68b4fa0f7b3dbf2a0b4a4133b15eae519330471e4798e17a949d7710b68af1e"
},
"src/cannon/MIPS2.sol": {
"initCodeHash": "0xe3879b5772820d837bc1c77c32a1200eb26cf901d9302dff9f0e9759331e380e",
"sourceCodeHash": "0x1c45a8f4c8c9ded7043d63965cb114d17f801c6cd4d8233cb16838c5f9a02675"
"initCodeHash": "0x22fa70f37fec4f3d3165a721abe8e2538a5fc6402fbad6ae473e9dbc55e62739",
"sourceCodeHash": "0xe7de6a02613c99ac2924bb55c34f831d0dd61fafecc8cdc0de826adf2144c709"
},
"src/cannon/MIPS64.sol": {
"initCodeHash": "0xa4a761f480a26ec1926c5a8b4831440211c0441bd41d503b0aad189e030d35dc",
"sourceCodeHash": "0x7ddcf8584f9bd92abd1eb45bc198f5b0ec54acaf292f60e919d674cc56fb8abc"
"initCodeHash": "0xf5cb029be679d292f8c10ec925912c03a26e4c47b336f47aa3f36486d701b05c",
"sourceCodeHash": "0xe611d13b2a18ef011bff8c533f4e8ce7abde34cfee6817f02a0fb74193745796"
},
"src/cannon/PreimageOracle.sol": {
"initCodeHash": "0x5d7e8ae64f802bd9d760e3d52c0a620bd02405dc2c8795818db9183792ffe81c",
"sourceCodeHash": "0x979d8595d925c70a123e72c062fa58c9ef94777c2e93b6bc3231d6679e2e9055"
"initCodeHash": "0x2bef439027c37c65dd8e7d9a987ff14e1dba94ee5fe5f316a77ecf46a8db4b3f",
"sourceCodeHash": "0x70965927d1cfcafa8975f3fdc98a138efe413c4a1585c0f60e0d21cfd396cc7c"
},
"src/dispute/AnchorStateRegistry.sol": {
"initCodeHash": "0x7bdbf9dc5125c953ea1833ccf0ad0e07d25b6f6c47e23da5374413324a38c5f9",
Expand Down
24 changes: 13 additions & 11 deletions packages/contracts-bedrock/src/cannon/MIPS.sol
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ contract MIPS is ISemver {
}

/// @notice The semantic version of the MIPS contract.
/// @custom:semver 1.2.1-beta.8
string public constant version = "1.2.1-beta.8";
/// @custom:semver 1.2.1-beta.9
string public constant version = "1.2.1-beta.9";

/// @notice The preimage oracle contract.
IPreimageOracle internal immutable ORACLE;
Expand Down Expand Up @@ -183,15 +183,17 @@ contract MIPS is ISemver {
});
(v0, v1, state.preimageOffset, state.memRoot,,) = sys.handleSysRead(args);
} else if (syscall_no == sys.SYS_WRITE) {
(v0, v1, state.preimageKey, state.preimageOffset) = sys.handleSysWrite({
_a0: a0,
_a1: a1,
_a2: a2,
_preimageKey: state.preimageKey,
_preimageOffset: state.preimageOffset,
_proofOffset: MIPSMemory.memoryProofOffset(STEP_PROOF_OFFSET, 1),
_memRoot: state.memRoot
});
(v0, v1, state.preimageKey, state.preimageOffset) = sys.handleSysWrite(
sys.SysWriteParams({
_a0: a0,
_a1: a1,
_a2: a2,
_preimageKey: state.preimageKey,
_preimageOffset: state.preimageOffset,
_proofOffset: MIPSMemory.memoryProofOffset(STEP_PROOF_OFFSET, 1),
_memRoot: state.memRoot
})
);
} else if (syscall_no == sys.SYS_FCNTL) {
(v0, v1) = sys.handleSysFcntl(a0, a1);
}
Expand Down
24 changes: 13 additions & 11 deletions packages/contracts-bedrock/src/cannon/MIPS2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ contract MIPS2 is ISemver {
}

/// @notice The semantic version of the MIPS2 contract.
/// @custom:semver 1.0.0-beta.23
string public constant version = "1.0.0-beta.23";
/// @custom:semver 1.0.0-beta.24
string public constant version = "1.0.0-beta.24";

/// @notice The preimage oracle contract.
IPreimageOracle internal immutable ORACLE;
Expand Down Expand Up @@ -462,15 +462,17 @@ contract MIPS2 is ISemver {
// Encapsulate execution to avoid stack-too-deep error
(v0, v1) = execSysRead(state, args);
} else if (syscall_no == sys.SYS_WRITE) {
(v0, v1, state.preimageKey, state.preimageOffset) = sys.handleSysWrite({
_a0: a0,
_a1: a1,
_a2: a2,
_preimageKey: state.preimageKey,
_preimageOffset: state.preimageOffset,
_proofOffset: MIPSMemory.memoryProofOffset(MEM_PROOF_OFFSET, 1),
_memRoot: state.memRoot
});
(v0, v1, state.preimageKey, state.preimageOffset) = sys.handleSysWrite(
sys.SysWriteParams({
_a0: a0,
_a1: a1,
_a2: a2,
_preimageKey: state.preimageKey,
_preimageOffset: state.preimageOffset,
_proofOffset: MIPSMemory.memoryProofOffset(MEM_PROOF_OFFSET, 1),
_memRoot: state.memRoot
})
);
} else if (syscall_no == sys.SYS_FCNTL) {
(v0, v1) = sys.handleSysFcntl(a0, a1);
} else if (syscall_no == sys.SYS_GETTID) {
Expand Down
24 changes: 13 additions & 11 deletions packages/contracts-bedrock/src/cannon/MIPS64.sol
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ contract MIPS64 is ISemver {
}

/// @notice The semantic version of the MIPS64 contract.
/// @custom:semver 1.0.0-beta.5
string public constant version = "1.0.0-beta.5";
/// @custom:semver 1.0.0-beta.6
string public constant version = "1.0.0-beta.6";

/// @notice The preimage oracle contract.
IPreimageOracle internal immutable ORACLE;
Expand Down Expand Up @@ -504,15 +504,17 @@ contract MIPS64 is ISemver {
// Encapsulate execution to avoid stack-too-deep error
(v0, v1) = execSysRead(state, args);
} else if (syscall_no == sys.SYS_WRITE) {
(v0, v1, state.preimageKey, state.preimageOffset) = sys.handleSysWrite({
_a0: a0,
_a1: a1,
_a2: a2,
_preimageKey: state.preimageKey,
_preimageOffset: state.preimageOffset,
_proofOffset: MIPS64Memory.memoryProofOffset(MEM_PROOF_OFFSET, 1),
_memRoot: state.memRoot
});
(v0, v1, state.preimageKey, state.preimageOffset) = sys.handleSysWrite(
sys.SysWriteParams({
_a0: a0,
_a1: a1,
_a2: a2,
_preimageKey: state.preimageKey,
_preimageOffset: state.preimageOffset,
_proofOffset: MIPS64Memory.memoryProofOffset(MEM_PROOF_OFFSET, 1),
_memRoot: state.memRoot
})
);
} else if (syscall_no == sys.SYS_FCNTL) {
(v0, v1) = sys.handleSysFcntl(a0, a1);
} else if (syscall_no == sys.SYS_GETTID) {
Expand Down
4 changes: 2 additions & 2 deletions packages/contracts-bedrock/src/cannon/PreimageOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ contract PreimageOracle is ISemver {
uint256 public constant PRECOMPILE_CALL_RESERVED_GAS = 100_000;

/// @notice The semantic version of the Preimage Oracle contract.
/// @custom:semver 1.1.3-beta.6
string public constant version = "1.1.3-beta.6";
/// @custom:semver 1.1.3-beta.7
string public constant version = "1.1.3-beta.7";
Comment on lines +54 to +55
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)


////////////////////////////////////////////////////////////////
// Authorized Preimage Parts //
Expand Down
Loading