-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(protocol): prepare ontake
fork to support new params & metadata
#17679
Merged
Merged
Changes from 71 commits
Commits
Show all changes
92 commits
Select commit
Hold shift + click to select a range
d8d670b
allow contract propoers to use calldata as well.
dantaik 0b0c50f
Merge branch 'main' into support_calldata_for_contract_proposer
dantaik 42897f5
rename
dantaik 10d81d8
emit CalldataTxList
dantaik 0206ff6
Merge branch 'emit_CalldataTxList' into support_calldata_for_contract…
dantaik 27ada28
Update LibProposing.sol
dantaik 0594f0e
more
dantaik 429d39e
refactor TaikoL1 code
dantaik 220cc29
Update LibProposing.sol
dantaik f0256d4
Merge branch 'refactor_taikoL1' into plan_for_a_hard_fork
dantaik 46bf716
Update TaikoEvents.sol
dantaik 644457f
more
dantaik f6ed532
Update TaikoL1.sol
dantaik b0a1205
more
dantaik f6e6011
more
dantaik 31ada4a
more
dantaik ba1d6bb
forge fmt & update contract layout table
dantaik 711c733
more
dantaik 8409a8f
more
dantaik 2a82410
Update LibProposing.sol
dantaik 194ac8e
Update LibProving.sol
dantaik 1719bb9
Update LibVerifying.sol
dantaik 3f5b385
more
dantaik b33fe9d
Update LibProposing.sol
dantaik b94839e
Update LibProposing.sol
dantaik ef4be90
Update LibProposing.sol
dantaik e67aee0
more
dantaik f37aab8
more
dantaik fd2456f
more
dantaik 5abd944
Update TaikoL1TestGroupBase.sol
dantaik 280cd14
more
dantaik 27faf96
more
dantaik 7828f9e
more
dantaik a713fe8
Update LibProposing.sol
dantaik 548f497
Update LibProposing.sol
dantaik 3d987aa
Update LibProposing.sol
dantaik 2da7fda
Update LibProposing.sol
dantaik bc8f67e
Update TaikoL2.sol
dantaik 8a52cbe
Update TaikoL2.sol
dantaik 309fd92
Update TaikoData.sol
dantaik 3668636
Merge branch 'main' into plan_for_a_hard_fork
dantaik d1a755b
Update LibProposing.sol
dantaik 950daf5
comment
dantaik b2e0b86
rename
dantaik 11353ef
Merge branch 'main' into plan_for_a_hard_fork
dantaik d9b3851
rename
dantaik bd41b24
one more test
dantaik 0225104
improve test
dantaik a4e98c9
test
dantaik 448d443
one more test
dantaik 2437559
one more test
dantaik 985e6d7
feat(protocol): enable AddressManager to cache address(0) without rea…
dantaik 714691e
fix
dantaik 6b198f4
Merge branch 'main' into plan_for_a_hard_fork
dantaik b359ae2
Update TaikoL1.sol
dantaik 0519245
fix lint
dantaik 22b8cbd
feat(protocol): add IProposerAccess (#17696)
dantaik 38b1794
TierProviderV3
dantaik cba1735
Update TierRouter.sol
dantaik b718d7a
do not write proposedAt in Block
dantaik d959d95
Update TaikoL1testGroupA2.t.sol
dantaik 4f92f94
do not write proposedIn in Block
dantaik bca4cf8
Update TaikoData.sol
dantaik 57fbd0d
more
dantaik b134442
Update LibProposing.sol
dantaik cc60ace
fix tests
dantaik d79e9cb
Merge branch 'main' into plan_for_a_hard_fork
dantaik ed2a817
Update LibProving.sol
dantaik fe197da
Update LibProposing.sol
dantaik 5c5bb37
fuji
dantaik 5297c24
Merge branch 'ontake_fork' into plan_for_a_hard_fork
dantaik e543f6d
rename
dantaik 10d633e
Allow bonds deposits and withdrawal
dantaik 9febe80
Merge branch 'main' into bond_alt
dantaik 9fdd6b9
Update LibBonds.sol
dantaik 7bec257
pnpm test
dantaik 307f8a0
Update TaikoEvents.sol
dantaik 5fe7f36
Merge branch 'main' into bond_alt
dantaik 509e8a8
Update LibBonds.sol
dantaik 47e9fdc
Update TaikoToken.sol
dantaik 92c7041
Update TaikoL1.sol
dantaik 55b5f2b
Update TaikoL1.sol
dantaik 9f84826
Update TaikoL1.sol
dantaik 94747e8
Update LibBonds.sol
dantaik 266c5dc
more
dantaik 7cfb159
Update TaikoL1TestGroupBase.sol
dantaik 37f7267
Merge branch 'main' into bond_alt
dantaik 6d132c1
Merge branch 'bond_alt' into plan_for_a_hard_fork
dantaik 3012e94
Update LibProving.sol
dantaik 7a47857
fix tests
dantaik c70d6dd
Merge branch 'ontake_fork' into plan_for_a_hard_fork
dantaik 548d811
resolve conflicts
dantaik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 [email protected] | ||
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); | ||
} | ||
52 changes: 52 additions & 0 deletions
52
packages/protocol/contracts/L1/access/ProposerRegistry.sol
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,52 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.24; | ||
|
||
import "../../common/EssentialContract.sol"; | ||
import "./IProposerAccess.sol"; | ||
|
||
/// @title ProposerRegistry | ||
/// A dummy implementation that only whitelist some trusted addresses. A real | ||
/// implementation would only allow a single proposer address to propose a block | ||
/// using some selection mechanism. | ||
/// @custom:security-contact [email protected] | ||
contract ProposerRegistry is EssentialContract, IProposerAccess { | ||
/// @dev Emitted when the status of a proposer is updated. | ||
/// @param proposer The address of the proposer whose state has updated. | ||
/// @param enabled If the proposer is now enabled or not. | ||
event ProposerUpdated(address indexed proposer, bool enabled); | ||
|
||
error PR_INVALID_PARAM(); | ||
|
||
/// @notice Whitelisted proposers | ||
mapping(address proposer => bool enabled) public proposers; | ||
|
||
uint256[49] private __gap; | ||
|
||
/// @notice Initializes the contract with the provided address manager. | ||
/// @param _owner The address of the owner. | ||
function init(address _owner) external initializer { | ||
__Essential_init(_owner); | ||
} | ||
|
||
/// @notice Register or unregister proposers. | ||
/// @param _proposers The list of proposers | ||
/// @param _enabled The corresponding list of the new status of the proposers | ||
function registerProposers( | ||
address[] memory _proposers, | ||
bool[] memory _enabled | ||
) | ||
external | ||
onlyOwner | ||
{ | ||
if (_proposers.length != _enabled.length) revert PR_INVALID_PARAM(); | ||
for (uint256 i = 0; i < _proposers.length; ++i) { | ||
proposers[_proposers[i]] = _enabled[i]; | ||
emit ProposerUpdated(_proposers[i], _enabled[i]); | ||
} | ||
} | ||
|
||
/// @inheritdoc IProposerAccess | ||
function isProposerEligible(address _proposer) external view returns (bool) { | ||
return proposers[_proposer]; | ||
} | ||
} |
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,91 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.24; | ||
|
||
import "../TaikoData.sol"; | ||
|
||
/// @title LibData | ||
/// @notice A library that offers helper functions. | ||
/// @custom:security-contact [email protected] | ||
library LibData { | ||
// = keccak256(abi.encode(new TaikoData.EthDeposit[](0))) | ||
bytes32 internal constant EMPTY_ETH_DEPOSIT_HASH = | ||
0x569e75fc77c1a856f6daaf9e69d8a9566ca34aa47f9133711ce065a571af0cfd; | ||
|
||
function paramV1toV2(TaikoData.BlockParams memory _v1) | ||
internal | ||
pure | ||
returns (TaikoData.BlockParams2 memory) | ||
{ | ||
return TaikoData.BlockParams2({ | ||
coinbase: _v1.coinbase, | ||
extraData: _v1.extraData, | ||
parentMetaHash: _v1.parentMetaHash, | ||
anchorBlockId: 0, | ||
timestamp: 0 | ||
}); | ||
} | ||
|
||
function metadataV2toV1(TaikoData.BlockMetadata2 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.BlockMetadata2 memory) | ||
{ | ||
return TaikoData.BlockMetadata2({ | ||
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 | ||
}); | ||
} | ||
|
||
function hashMetadata( | ||
bool postFork, | ||
TaikoData.BlockMetadata2 memory _meta | ||
) | ||
internal | ||
pure | ||
returns (bytes32) | ||
{ | ||
return postFork | ||
? keccak256(abi.encode(_meta)) // | ||
: keccak256(abi.encode(metadataV2toV1(_meta))); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for client interface point of view, would be good to use the exact same namings like here, in this PR, if we wanna reuse the backend OR use this naming (
IProposerAccess
) there, to avoid duplicated, unnecessary work later.cc @Brechtpd @dantaik
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like the word
sequencer
. And I also believe going forward, ISequencerRegistry will also change due to the dependency on restaking platforms/protocols.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ISequencerRegistry
very likely stable because how the implementation selects the current proposer does not matter to taiko.Sequencer vs proposer is subjective, I'm fine with both but people do tend to use the word sequencer here to stress that they are sequencing the blocks and there's only one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can change it later. I think we just care about the permission checking function rather than the registration logics.