-
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.
feat(protocol): apply multiple improvements for "ontake" fork (#17734)
Co-authored-by: David <david@taiko.xyz> Co-authored-by: maskpp <maskpp266@gmail.com>
- Loading branch information
1 parent
d538d99
commit 17d67d7
Showing
33 changed files
with
1,199 additions
and
311 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
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.24; | ||
|
||
/// @title IProposerAccess | ||
/// @dev An interface to check if a proposer is eligible to propose blocks in a specific Ethereum | ||
/// block. | ||
/// @custom:security-contact security@taiko.xyz | ||
interface IProposerAccess { | ||
/// @notice Checks if a proposer can propose block in the current Ethereum block. | ||
/// @param _proposer The proposer. | ||
/// @return true if the proposer can propose blocks, false otherwise. | ||
function isProposerEligible(address _proposer) external view returns (bool); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,100 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.24; | ||
|
||
import "../TaikoData.sol"; | ||
|
||
/// @title LibData | ||
/// @notice A library that offers helper functions. | ||
/// @custom:security-contact security@taiko.xyz | ||
library LibData { | ||
// = keccak256(abi.encode(new TaikoData.EthDeposit[](0))) | ||
bytes32 internal constant EMPTY_ETH_DEPOSIT_HASH = | ||
0x569e75fc77c1a856f6daaf9e69d8a9566ca34aa47f9133711ce065a571af0cfd; | ||
|
||
function blockParamsV1ToV2(TaikoData.BlockParams memory _v1) | ||
internal | ||
pure | ||
returns (TaikoData.BlockParamsV2 memory) | ||
{ | ||
return TaikoData.BlockParamsV2({ | ||
coinbase: _v1.coinbase, | ||
extraData: _v1.extraData, | ||
parentMetaHash: _v1.parentMetaHash, | ||
anchorBlockId: 0, | ||
timestamp: 0, | ||
blobTxListOffset: 0, | ||
blobTxListLength: 0, | ||
blobIndex: 0 | ||
}); | ||
} | ||
|
||
function blockMetadataV2toV1(TaikoData.BlockMetadataV2 memory _v2) | ||
internal | ||
pure | ||
returns (TaikoData.BlockMetadata memory) | ||
{ | ||
return TaikoData.BlockMetadata({ | ||
l1Hash: _v2.anchorBlockHash, | ||
difficulty: _v2.difficulty, | ||
blobHash: _v2.blobHash, | ||
extraData: _v2.extraData, | ||
depositsHash: EMPTY_ETH_DEPOSIT_HASH, | ||
coinbase: _v2.coinbase, | ||
id: _v2.id, | ||
gasLimit: _v2.gasLimit, | ||
timestamp: _v2.timestamp, | ||
l1Height: _v2.anchorBlockId, | ||
minTier: _v2.minTier, | ||
blobUsed: _v2.blobUsed, | ||
parentMetaHash: _v2.parentMetaHash, | ||
sender: _v2.proposer | ||
}); | ||
} | ||
|
||
function metadataV1toV2( | ||
TaikoData.BlockMetadata memory _v1, | ||
uint96 _livenessBond | ||
) | ||
internal | ||
pure | ||
returns (TaikoData.BlockMetadataV2 memory) | ||
{ | ||
return TaikoData.BlockMetadataV2({ | ||
anchorBlockHash: _v1.l1Hash, | ||
difficulty: _v1.difficulty, | ||
blobHash: _v1.blobHash, | ||
extraData: _v1.extraData, | ||
coinbase: _v1.coinbase, | ||
id: _v1.id, | ||
gasLimit: _v1.gasLimit, | ||
timestamp: _v1.timestamp, | ||
anchorBlockId: _v1.l1Height, | ||
minTier: _v1.minTier, | ||
blobUsed: _v1.blobUsed, | ||
parentMetaHash: _v1.parentMetaHash, | ||
proposer: _v1.sender, | ||
livenessBond: _livenessBond, | ||
proposedAt: 0, | ||
proposedIn: 0, | ||
blobTxListOffset: 0, | ||
blobTxListLength: 0, | ||
blobIndex: 0, | ||
basefeeAdjustmentQuotient: 0, | ||
basefeeSharingPctg: 0, | ||
blockGasIssuance: 0 | ||
}); | ||
} | ||
|
||
function hashMetadata( | ||
bool postFork, | ||
TaikoData.BlockMetadataV2 memory _meta | ||
) | ||
internal | ||
pure | ||
returns (bytes32) | ||
{ | ||
return postFork | ||
? keccak256(abi.encode(_meta)) // | ||
: keccak256(abi.encode(blockMetadataV2toV1(_meta))); | ||
} | ||
} |
Oops, something went wrong.