Skip to content

Commit 051fa3a

Browse files
committed
fix: contract
1 parent dff0728 commit 051fa3a

5 files changed

Lines changed: 12 additions & 6 deletions

File tree

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,6 @@
3737
[submodule "contracts/lib/risc0-ethereum"]
3838
path = contracts/lib/risc0-ethereum
3939
url = https://github.com/risc0/risc0-ethereum
40+
[submodule "examples/L2/contracts/lib/forge-std"]
41+
path = examples/L2/contracts/lib/forge-std
42+
url = https://github.com/foundry-rs/forge-std
Submodule forge-std added at 77041d2
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
forge-std/=lib/forge-std/src/

examples/L2/contracts/script/StateTransitionDeployer.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: UNLICENSED
22
pragma solidity ^0.8.13;
33

4-
import {Script, console} from "forge-std/Script.sol";
4+
import "forge-std/Script.sol";
55
import {StateTransition} from "../src/StateTransition.sol";
66

77
contract StateTransitionDeployer is Script {

examples/L2/contracts/src/StateTransition.sol

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
pragma solidity ^0.8.13;
33

44
contract StateTransition {
5-
event StateUpdated(bytes32)
5+
event StateUpdated(bytes32);
66

77
bytes32 public PROGRAM_ID = 0x00;
88
bytes32 public stateRoot;
@@ -12,18 +12,19 @@ contract StateTransition {
1212
alignedProofAggregator = _alignedProofAggregator;
1313
}
1414

15-
function updateState(bytes publicInputs, bytes32[] merkleProof) public {
15+
function updateState(bytes calldata publicInputs, bytes32[] calldata merkleProof) public {
1616
bytes memory callData = abi.encodeWithSignature(
17-
"verifyProofInclusion(bytes32[],bytes32,bytes)", merkleProof, programId, publicInputs
17+
"verifyProofInclusion(bytes32[],bytes32,bytes)", merkleProof, PROGRAM_ID, publicInputs
1818
);
1919
(bool callResult, bytes memory response) = alignedProofAggregator.staticcall(callData);
20-
require(callWasSuccessful, "static_call failed");
20+
require(callResult, "static_call failed");
2121

2222
bool proofVerified = abi.decode(response, (bool));
2323
require(proofVerified, "proof not verified in aligned");
2424

25-
(prevStateRoot, newStateRoot) = abi.decode(publicInputs, (bytes32, UserStateUpdate[]));
25+
(bytes32 prevStateRoot, bytes32 newStateRoot) = abi.decode(publicInputs, (bytes32, bytes32));
2626
require(prevStateRoot == stateRoot);
27+
2728
stateRoot = newStateRoot;
2829

2930
emit StateUpdated(stateRoot);

0 commit comments

Comments
 (0)