Skip to content

Commit

Permalink
feat(protocol): add parentGasUsed to blockproven (#13704)
Browse files Browse the repository at this point in the history
Co-authored-by: David <david@taiko.xyz>
  • Loading branch information
cyberhorsey and davidtaikocha committed May 5, 2023
1 parent 82f1677 commit 2ce8787
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion packages/protocol/contracts/L1/TaikoEvents.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ abstract contract TaikoEvents {
bytes32 parentHash,
bytes32 blockHash,
bytes32 signalRoot,
address prover
address prover,
uint32 parentGasUsed
);

event BlockVerified(uint256 indexed id, bytes32 blockHash);
Expand Down
14 changes: 7 additions & 7 deletions packages/protocol/contracts/L1/libs/LibProving.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ library LibProving {
bytes32 parentHash,
bytes32 blockHash,
bytes32 signalRoot,
address prover
address prover,
uint32 parentGasUsed
);

error L1_ALREADY_PROVEN();
Expand Down Expand Up @@ -59,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();

Expand Down Expand Up @@ -129,7 +128,7 @@ library LibProving {
evidence.parentGasUsed
] = fcId;
}
} else if (isOracleProof) {
} else if (evidence.prover == address(0)) {
fc = blk.forkChoices[fcId];

if (
Expand All @@ -147,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
Expand Down Expand Up @@ -199,7 +198,8 @@ library LibProving {
parentHash: evidence.parentHash,
blockHash: evidence.blockHash,
signalRoot: evidence.signalRoot,
prover: evidence.prover
prover: evidence.prover,
parentGasUsed: evidence.parentGasUsed
});
}

Expand Down

0 comments on commit 2ce8787

Please sign in to comment.