@@ -6,8 +6,11 @@ contract StateTransition {
66 event ProgramIdUpdated (bytes32 );
77
88 error OnlyOwner (address );
9+ error AlignedVerifyProofInclusionCallFailed ();
10+ error ProofVerificationFailed ();
11+ error PrevStateRootDidNotMatch ();
912
10- bytes32 public PROGRAM_ID = 0x00 ;
13+ bytes32 public PROGRAM_ID;
1114 bytes32 public stateRoot;
1215 address public alignedProofAggregator;
1316 address public owner;
@@ -24,16 +27,21 @@ contract StateTransition {
2427 "verifyProofInclusion(bytes32[],bytes32,bytes) " , merkleProof, PROGRAM_ID, publicInputs
2528 );
2629 (bool callResult , bytes memory response ) = alignedProofAggregator.staticcall (callData);
27- require (callResult, "static_call failed " );
30+ if (! callResult) {
31+ revert AlignedVerifyProofInclusionCallFailed ();
32+ }
2833
2934 bool proofVerified = abi.decode (response, (bool ));
30- require (proofVerified, "proof not verified in aligned " );
35+ if (! proofVerified) {
36+ revert ProofVerificationFailed ();
37+ }
3138
3239 (bytes32 prevStateRoot , bytes32 newStateRoot ) = abi.decode (publicInputs, (bytes32 , bytes32 ));
33- require (prevStateRoot == stateRoot);
40+ if (prevStateRoot != stateRoot) {
41+ revert PrevStateRootDidNotMatch ();
42+ }
3443
3544 stateRoot = newStateRoot;
36-
3745 emit StateUpdated (stateRoot);
3846 }
3947
0 commit comments