Commit 272a352b authored by clabby's avatar clabby

Read absolute prestate from cannon dump

parent b2b620fb
...@@ -760,7 +760,7 @@ jobs: ...@@ -760,7 +760,7 @@ jobs:
description: Go Module Name description: Go Module Name
type: string type: string
docker: docker:
- image: cimg/go:1.19 - image: cimg/go:1.20
steps: steps:
- checkout - checkout
- run: - run:
...@@ -818,6 +818,12 @@ jobs: ...@@ -818,6 +818,12 @@ jobs:
- run: - run:
name: git submodules name: git submodules
command: git submodule update --init --recursive command: git submodule update --init --recursive
- run:
name: print go's available MIPS targets
command: go tool dist list | grep mips
- run:
name: generate cannon prestate
command: make cannon-prestate
- run: - run:
name: generate L1 state name: generate L1 state
command: make devnet-allocs command: make devnet-allocs
...@@ -895,6 +901,9 @@ jobs: ...@@ -895,6 +901,9 @@ jobs:
- run: - run:
name: git submodules name: git submodules
command: git submodule update --init --recursive command: git submodule update --init --recursive
- run:
name: generate cannon prestate
command: make cannon-prestate
- run: - run:
name: generate L1 state name: generate L1 state
command: make devnet-allocs command: make devnet-allocs
...@@ -1118,14 +1127,14 @@ jobs: ...@@ -1118,14 +1127,14 @@ jobs:
bedrock-go-tests: bedrock-go-tests:
docker: docker:
- image: cimg/go:1.19 - image: cimg/go:1.20
resource_class: medium resource_class: medium
steps: steps:
- run: echo Done - run: echo Done
fpp-verify: fpp-verify:
docker: docker:
- image: cimg/go:1.19 - image: cimg/go:1.20
steps: steps:
- checkout - checkout
- run: - run:
......
...@@ -738,11 +738,25 @@ contract Deploy is Deployer { ...@@ -738,11 +738,25 @@ contract Deploy is Deployer {
/// @notice Sets the implementation for the `FAULT` game type in the `DisputeGameFactory` /// @notice Sets the implementation for the `FAULT` game type in the `DisputeGameFactory`
function setFaultGameImplementation() onlyDevnet broadcast() public { function setFaultGameImplementation() onlyDevnet broadcast() public {
// Create the absolute prestate dump
string memory filePath = string.concat(vm.projectRoot(), "/../../op-program/bin/prestate-proof.json");
bytes32 mipsAbsolutePrestate;
string[] memory commands = new string[](3);
commands[0] = "bash";
commands[1] = "-c";
commands[2] = "[[ -f ../../op-program/bin/prestate-proof.json ]] && echo \"present\"";
if (vm.ffi(commands).length == 0) {
revert("Cannon prestate dump not found, generate it with `make cannon-prestate` in the monorepo root.");
}
commands[2] = string.concat("cat ", filePath, " | jq -r .pre");
mipsAbsolutePrestate = abi.decode(vm.ffi(commands), (bytes32));
console.log("Absolute prestate: %s", vm.toString(mipsAbsolutePrestate));
string[2] memory contractNames = ["DisputeGameFactoryProxy", "MIPSDisputeGameFactoryProxy"]; string[2] memory contractNames = ["DisputeGameFactoryProxy", "MIPSDisputeGameFactoryProxy"];
for (uint256 i; i < contractNames.length; i++) { for (uint256 i; i < contractNames.length; i++) {
DisputeGameFactory factory = DisputeGameFactory(mustGetAddress(contractNames[i])); DisputeGameFactory factory = DisputeGameFactory(mustGetAddress(contractNames[i]));
Claim absolutePrestate = Claim.wrap(bytes32(cfg.faultGameAbsolutePrestate())); Claim absolutePrestate = Claim.wrap(i == 0 ? bytes32(cfg.faultGameAbsolutePrestate()) : mipsAbsolutePrestate);
IBigStepper faultVm = IBigStepper(i == 0 ? address(new AlphabetVM(absolutePrestate)) : mustGetAddress("Mips")); IBigStepper faultVm = IBigStepper(i == 0 ? address(new AlphabetVM(absolutePrestate)) : mustGetAddress("Mips"));
if (address(factory.gameImpls(GameTypes.FAULT)) == address(0)) { if (address(factory.gameImpls(GameTypes.FAULT)) == address(0)) {
factory.setImplementation(GameTypes.FAULT, new FaultDisputeGame({ factory.setImplementation(GameTypes.FAULT, new FaultDisputeGame({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment