From 4873c44ffdc19aa1ac82276366918ddeb0b28af2 Mon Sep 17 00:00:00 2001 From: Jeffery Walsh Date: Wed, 3 May 2023 14:00:04 -0700 Subject: [PATCH 1/5] get oracle prover --- packages/protocol/contracts/L1/TaikoL1.sol | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/protocol/contracts/L1/TaikoL1.sol b/packages/protocol/contracts/L1/TaikoL1.sol index bc03dc84282..ff91bd9c4e9 100644 --- a/packages/protocol/contracts/L1/TaikoL1.sol +++ b/packages/protocol/contracts/L1/TaikoL1.sol @@ -246,4 +246,8 @@ contract TaikoL1 is function getVerifierName(uint16 id) public pure returns (bytes32) { return LibUtils.getVerifierName(id); } + + function getOracleProver() public view returns (address) { + return AddressResolver(this).resolve("oracle_prover", true); + } } From ffa9e526d075c7120cbac5866dbe46d5577a1eda Mon Sep 17 00:00:00 2001 From: Jeffery Walsh Date: Wed, 3 May 2023 14:29:14 -0700 Subject: [PATCH 2/5] add parentgasused/gasused --- packages/protocol/contracts/L1/TaikoEvents.sol | 4 +++- packages/protocol/contracts/L1/libs/LibProving.sol | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/protocol/contracts/L1/TaikoEvents.sol b/packages/protocol/contracts/L1/TaikoEvents.sol index 63a0ef1fad1..5b4f392e5b0 100644 --- a/packages/protocol/contracts/L1/TaikoEvents.sol +++ b/packages/protocol/contracts/L1/TaikoEvents.sol @@ -17,7 +17,9 @@ abstract contract TaikoEvents { bytes32 parentHash, bytes32 blockHash, bytes32 signalRoot, - address prover + address prover, + uint32 parentGasUsed, + uint32 gasUsed ); event BlockVerified(uint256 indexed id, bytes32 blockHash); diff --git a/packages/protocol/contracts/L1/libs/LibProving.sol b/packages/protocol/contracts/L1/libs/LibProving.sol index 59cd86ea299..8547319bc16 100644 --- a/packages/protocol/contracts/L1/libs/LibProving.sol +++ b/packages/protocol/contracts/L1/libs/LibProving.sol @@ -19,7 +19,9 @@ library LibProving { bytes32 parentHash, bytes32 blockHash, bytes32 signalRoot, - address prover + address prover, + uint32 parentGasUsed, + uint32 gasUsed ); error L1_ALREADY_PROVEN(); @@ -199,7 +201,9 @@ library LibProving { parentHash: evidence.parentHash, blockHash: evidence.blockHash, signalRoot: evidence.signalRoot, - prover: evidence.prover + prover: evidence.prover, + parentGasUsed: evidence.parentGasUsed, + gasUsed: evidence.gasUsed }); } From 18890a6771923c8db185f4beaa0321d004836224 Mon Sep 17 00:00:00 2001 From: Jeffery Walsh Date: Wed, 3 May 2023 15:32:46 -0700 Subject: [PATCH 3/5] rm gasUsed as its too deep in the stack... --- packages/protocol/contracts/L1/TaikoEvents.sol | 3 +-- packages/protocol/contracts/L1/libs/LibProving.sol | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/protocol/contracts/L1/TaikoEvents.sol b/packages/protocol/contracts/L1/TaikoEvents.sol index 5b4f392e5b0..f9ff8d82b8e 100644 --- a/packages/protocol/contracts/L1/TaikoEvents.sol +++ b/packages/protocol/contracts/L1/TaikoEvents.sol @@ -18,8 +18,7 @@ abstract contract TaikoEvents { bytes32 blockHash, bytes32 signalRoot, address prover, - uint32 parentGasUsed, - uint32 gasUsed + uint32 parentGasUsed ); event BlockVerified(uint256 indexed id, bytes32 blockHash); diff --git a/packages/protocol/contracts/L1/libs/LibProving.sol b/packages/protocol/contracts/L1/libs/LibProving.sol index 8547319bc16..e40b7af7238 100644 --- a/packages/protocol/contracts/L1/libs/LibProving.sol +++ b/packages/protocol/contracts/L1/libs/LibProving.sol @@ -20,8 +20,7 @@ library LibProving { bytes32 blockHash, bytes32 signalRoot, address prover, - uint32 parentGasUsed, - uint32 gasUsed + uint32 parentGasUsed ); error L1_ALREADY_PROVEN(); @@ -202,8 +201,7 @@ library LibProving { blockHash: evidence.blockHash, signalRoot: evidence.signalRoot, prover: evidence.prover, - parentGasUsed: evidence.parentGasUsed, - gasUsed: evidence.gasUsed + parentGasUsed: evidence.parentGasUsed }); } From 4e9791cd73c5b006d830e31c79725ca828f3d13f Mon Sep 17 00:00:00 2001 From: Jeffery Walsh Date: Wed, 3 May 2023 15:52:11 -0700 Subject: [PATCH 4/5] try this to resolve stack... --- packages/protocol/contracts/L1/libs/LibProving.sol | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/protocol/contracts/L1/libs/LibProving.sol b/packages/protocol/contracts/L1/libs/LibProving.sol index e40b7af7238..e4235e25611 100644 --- a/packages/protocol/contracts/L1/libs/LibProving.sol +++ b/packages/protocol/contracts/L1/libs/LibProving.sol @@ -60,9 +60,7 @@ library LibProving { if (blk.metaHash != evidence.metaHash) revert L1_EVIDENCE_MISMATCH(blk.metaHash, evidence.metaHash); - bool isOracleProof = evidence.prover == address(0); - - if (isOracleProof) { + if (evidence.prover == address(0)) { address oracleProver = resolver.resolve("oracle_prover", true); if (oracleProver == address(0)) revert L1_ORACLE_DISABLED(); @@ -130,7 +128,7 @@ library LibProving { evidence.parentGasUsed ] = fcId; } - } else if (isOracleProof) { + } else if (evidence.prover == address(0)) { fc = blk.forkChoices[fcId]; if ( @@ -148,7 +146,7 @@ library LibProving { fc.provenAt = uint64(block.timestamp); fc.prover = evidence.prover; - if (!isOracleProof) { + if (evidence.prover != address(0)) { bytes32 instance; // Set state.staticRefs From cfcae643da67216670db589515d092ea6e04c439 Mon Sep 17 00:00:00 2001 From: Jeffery Walsh Date: Thu, 4 May 2023 11:21:00 -0700 Subject: [PATCH 5/5] rm get oracle prover, just use resolve --- packages/protocol/contracts/L1/TaikoL1.sol | 4 ---- 1 file changed, 4 deletions(-) diff --git a/packages/protocol/contracts/L1/TaikoL1.sol b/packages/protocol/contracts/L1/TaikoL1.sol index ff91bd9c4e9..bc03dc84282 100644 --- a/packages/protocol/contracts/L1/TaikoL1.sol +++ b/packages/protocol/contracts/L1/TaikoL1.sol @@ -246,8 +246,4 @@ contract TaikoL1 is function getVerifierName(uint16 id) public pure returns (bytes32) { return LibUtils.getVerifierName(id); } - - function getOracleProver() public view returns (address) { - return AddressResolver(this).resolve("oracle_prover", true); - } }