-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore(ci): disable checking coverage against the base of the PR * chore: update configs * chore: add flag_management * chore: try * chore: try2 * feat(protocol): enable whitelisting provers (disabled for now) (#287) * Finalize -> Verify Co-authored-by: David <[email protected]>
- Loading branch information
1 parent
151415e
commit 5c4d370
Showing
14 changed files
with
70 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ import "../LibData.sol"; | |
/// @author david <[email protected]> | ||
abstract contract V1Events { | ||
// The following events must match the definitions in other V1 libraries. | ||
event BlockFinalized(uint256 indexed id, bytes32 blockHash); | ||
event BlockVerified(uint256 indexed id, bytes32 blockHash); | ||
|
||
event BlockCommitted(bytes32 hash, uint256 validSince); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ import "../LibData.sol"; | |
|
||
/// @author dantaik <[email protected]> | ||
library V1Finalizing { | ||
event BlockFinalized(uint256 indexed id, bytes32 blockHash); | ||
event BlockVerified(uint256 indexed id, bytes32 blockHash); | ||
|
||
event HeaderSynced( | ||
uint256 indexed height, | ||
|
@@ -27,39 +27,39 @@ library V1Finalizing { | |
s.nextBlockId = 1; | ||
s.genesisHeight = uint64(block.number); | ||
|
||
emit BlockFinalized(0, _genesisBlockHash); | ||
emit BlockVerified(0, _genesisBlockHash); | ||
emit HeaderSynced(block.number, 0, _genesisBlockHash); | ||
} | ||
|
||
function finalizeBlocks(LibData.State storage s, uint256 maxBlocks) public { | ||
uint64 latestL2Height = s.latestFinalizedHeight; | ||
function verifyBlocks(LibData.State storage s, uint256 maxBlocks) public { | ||
uint64 latestL2Height = s.latestVerifiedHeight; | ||
bytes32 latestL2Hash = s.l2Hashes[latestL2Height]; | ||
uint64 processed = 0; | ||
|
||
for ( | ||
uint256 i = s.latestFinalizedId + 1; | ||
uint256 i = s.latestVerifiedId + 1; | ||
i < s.nextBlockId && processed <= maxBlocks; | ||
i++ | ||
) { | ||
LibData.ForkChoice storage fc = s.forkChoices[i][latestL2Hash]; | ||
|
||
if (fc.blockHash == LibConstants.TAIKO_BLOCK_DEADEND_HASH) { | ||
emit BlockFinalized(i, 0); | ||
emit BlockVerified(i, 0); | ||
} else if (fc.blockHash != 0) { | ||
latestL2Height += 1; | ||
latestL2Hash = fc.blockHash; | ||
emit BlockFinalized(i, latestL2Hash); | ||
emit BlockVerified(i, latestL2Hash); | ||
} else { | ||
break; | ||
} | ||
processed += 1; | ||
} | ||
|
||
if (processed > 0) { | ||
s.latestFinalizedId += processed; | ||
s.latestVerifiedId += processed; | ||
|
||
if (latestL2Height > s.latestFinalizedHeight) { | ||
s.latestFinalizedHeight = latestL2Height; | ||
if (latestL2Height > s.latestVerifiedHeight) { | ||
s.latestVerifiedHeight = latestL2Height; | ||
s.l2Hashes[latestL2Height] = latestL2Hash; | ||
emit HeaderSynced(block.number, latestL2Height, latestL2Hash); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.