Skip to content

Commit

Permalink
feat(protocol): enable permissionless block-proposing (#17303)
Browse files Browse the repository at this point in the history
Signed-off-by: snoppy <[email protected]>
Co-authored-by: Snoppy <[email protected]>
  • Loading branch information
dantaik and xiaoxianBoy authored Jun 4, 2024
1 parent 3ae25fd commit 62dd749
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 42 deletions.
1 change: 0 additions & 1 deletion packages/protocol/contracts/L1/TaikoErrors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ abstract contract TaikoErrors {
error L1_TOO_MANY_BLOCKS();
error L1_TRANSITION_ID_ZERO();
error L1_TRANSITION_NOT_FOUND();
error L1_UNAUTHORIZED();
error L1_UNEXPECTED_PARENT();
error L1_UNEXPECTED_TRANSITION_ID();
}
27 changes: 1 addition & 26 deletions packages/protocol/contracts/L1/libs/LibProposing.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ library LibProposing {
error L1_INVALID_SIG();
error L1_LIVENESS_BOND_NOT_RECEIVED();
error L1_TOO_MANY_BLOCKS();
error L1_UNAUTHORIZED();
error L1_UNEXPECTED_PARENT();

/// @dev Proposes a Taiko L2 block.
Expand Down Expand Up @@ -74,11 +73,7 @@ library LibProposing {
}

// Taiko, as a Based Rollup, enables permissionless block proposals.
// However, if the "proposer" address is set to a non-zero value, we
// ensure that only that specific address has the authority to propose
// blocks.
TaikoData.SlotB memory b = _state.slotB;
if (!_isProposerPermitted(b, _resolver)) revert L1_UNAUTHORIZED();

// It's essential to ensure that the ring buffer for proposed blocks
// still has space for at least one more block.
Expand Down Expand Up @@ -137,7 +132,7 @@ library LibProposing {
// We cannot rely on `msg.sender != tx.origin` for EOA check, as it will break after EIP
// 7645: Alias ORIGIN to SENDER
if (
_checkEOAForCalldataDA && meta_.id != 1
_checkEOAForCalldataDA
&& ECDSA.recover(meta_.blobHash, params.signature) != msg.sender
) {
revert L1_INVALID_SIG();
Expand Down Expand Up @@ -226,24 +221,4 @@ library LibProposing {
depositsProcessed: deposits_
});
}

function _isProposerPermitted(
TaikoData.SlotB memory _slotB,
IAddressResolver _resolver
)
private
view
returns (bool)
{
if (_slotB.numBlocks == 1) {
// Only proposer_one can propose the first block after genesis
address proposerOne = _resolver.resolve(LibStrings.B_PROPOSER_ONE, true);
if (proposerOne != address(0)) {
return msg.sender == proposerOne;
}
}

address proposer = _resolver.resolve(LibStrings.B_PROPOSER, true);
return proposer == address(0) || msg.sender == proposer;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ contract PEMCertChainLib is IPEMCertChainLib {
pure
returns (bool success, uint256 pcesvn, uint256[] memory cpusvns)
{
// sibiling of tcbOid
// sibling of tcbOid
uint256 tcbPtr = der.nextSiblingOf(oidPtr);
// get the first svn object in the sequence
uint256 svnParentPtr = der.firstChildOf(tcbPtr);
Expand Down
2 changes: 1 addition & 1 deletion packages/protocol/contracts/bridge/Bridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ contract Bridge is EssentialContract, IBridge {
/// @dev Considering that the watchdog is a hot wallet, in case its private key is leaked, we
/// only allow watchdog to pause the bridge, but does not allow it to unpause the bridge.
function _authorizePause(address addr, bool toPause) internal view override {
// Owenr and chain_pauser can pause/unpause the bridge.
// Owner and chain_pauser can pause/unpause the bridge.
if (addr == owner() || addr == resolve(LibStrings.B_CHAIN_WATCHDOG, true)) return;

// bridge_watchdog can pause the bridge, but cannot unpause it.
Expand Down
2 changes: 0 additions & 2 deletions packages/protocol/contracts/common/LibStrings.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ library LibStrings {
bytes32 internal constant B_ERC1155_VAULT = bytes32("erc1155_vault");
bytes32 internal constant B_ERC20_VAULT = bytes32("erc20_vault");
bytes32 internal constant B_ERC721_VAULT = bytes32("erc721_vault");
bytes32 internal constant B_PROPOSER = bytes32("proposer");
bytes32 internal constant B_PROPOSER_ONE = bytes32("proposer_one");
bytes32 internal constant B_PROVER_ASSIGNMENT = bytes32("PROVER_ASSIGNMENT");
bytes32 internal constant B_PROVER_SET = bytes32("prover_set");
bytes32 internal constant B_QUOTA_MANAGER = bytes32("quota_manager");
Expand Down
7 changes: 7 additions & 0 deletions packages/protocol/deployments/mainnet-contract-logs-L1.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@
- unpaused on 27 May, 2024 @tx`0x71ce1e61f1e42e34c9a51f5671ac260f2ac398e016ae645f2661f074e7f230ce`
- upgraded from `0x02F21B4C3d4dbfF70cE851741175a727c8D782Be` to `0x71c2f41AEDe913AAEf2c62596E03702E348D6Cd0.` @commit`` in @tx`0x8a380a25d03a740d9535dfc3e2fc4f6960e22d49ad88b8d85f59af4013aedf87`
- upgrade impl to `0x951B7Ae1bB26d12dB37f01748e8fB62FEf45A8B5` @commit`1bd3285` @tx`0xf21f6bf720767db3bc9b63ef69cacb20340bdedfb6589e6a4d11fe082dfa7bd6`
- todo:
- upgrade bridge for improvements based on OZ's feedback.

#### quota_manager

Expand Down Expand Up @@ -173,6 +175,8 @@
- register `prover_set` to `0x34f2B21107AfE3584949c184A1E6236FFDAC4f6F` @tx`0x252cd7fcb6e02a71c0770d00f2f2476d5dd469a4fb5df622fe7bf6280d8a4100`
- register `prover_set` to `0x500735343372Dd6c9B84dBc7a75babf4479742B9` @commit`fa481c1` @tx`0x02ed558762eae5f0a930ba4a1047a02d4a793ea48890268c32df04e882f138ff`
- Upgraded from `0xF1cA1F1A068468E1dcF90dA6add185467de80943` to `0x8Af4669E3068Bae96b92cD73603f5D86beD07a9a` @commit`e79a367ad` @tx`0xe1ef58455de0b0331228e487d54720290ed8a73f709d2146bd43330d4a360bd3`
- todo:
- register "tier_router" and remove "tier_provider"

#### taikoL1

Expand All @@ -188,6 +192,9 @@
- `resetGenesisHash()` called to reset genesis block hash to `0x90bc60466882de9637e269e87abab53c9108cf9113188bc4f80bcfcb10e489b9` on May 22 @tx`0x5a60c5815947a199cc84e1bc75539e01a202597b20c1f87bd9d02f8be6453abd`
- Upgraded from `0xe0A5D394878723CEAEC8B993e04756DF1f4B44eF` to `0xa200c2268d77737a8Fd2CA1698dA6eeab2a85CEb` on May 27 @commit`06f97d6` @tx`0x187cc99e9bcf2a94f723cf52d85b74b79bdb3872681e2a3808cadbbc3ba301e2`
- Upgraded from `0xa200c2268d77737a8Fd2CA1698dA6eeab2a85CEb` to `0x3505a0700DB72dEc7AbFF1aF231BB5D87aBF2944` on May 28 @commit`b335b70` @tx`0xa603b6d55457e64e18ddae684bfd14948452cdd7b927dd22bf0b83045e8fd028`
- todo:
- upgrade to enable permissionless block-proposing
- upgrade to use "tier_router"

#### assignment_hook

Expand Down
2 changes: 2 additions & 0 deletions packages/protocol/deployments/mainnet-contract-logs-L2.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
- upgraded from `0xf961854D68368cFFc86d90AEe8a19E9781dACA3e` to `0x98C5De7670aA7d47C6c0551fAD27Bfe464A6751a..` @commit`` in @tx`0x0b5d6acc9c5b8ef193920246081ec5ce7268111acfc1dce1f058bea06f3953c7`
- changed owner to `0xCa5b76Cc7A38b86Db11E5aE5B1fc9740c3bA3DE8` @tx`0xf68861171c602e3e75ca69e950957fcb908c7949c6df9a9ea3026c238ebb1e9c`
- upgrade impl to `0x0893c8821Fa358D5f3630695Ce062204814359A1` @commit`1bd3285` @tx`0x4605c4ce594e996bdbdb532a9aefe4fab1ea36f7e2ef63eef56a7e8033810df3`
- todo:
- upgrade bridge for improvements based on OZ's feedback.

#### erc20_vault

Expand Down
10 changes: 0 additions & 10 deletions packages/protocol/script/DeployOnL1.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,6 @@ contract DeployOnL1 is DeployCapability {
console2.log("- chainId : ", block.chainid);
}

address proposer = vm.envAddress("PROPOSER");
if (proposer != address(0)) {
register(rollupAddressManager, "proposer", proposer);
}

address proposerOne = vm.envAddress("PROPOSER_ONE");
if (proposerOne != address(0)) {
register(rollupAddressManager, "proposer_one", proposerOne);
}

// ---------------------------------------------------------------
// Register L2 addresses
register(rollupAddressManager, "taiko", vm.envAddress("TAIKO_L2_ADDRESS"), l2ChainId);
Expand Down
1 change: 0 additions & 1 deletion packages/protocol/test/bridge/Bridge2_processMessage.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,6 @@ contract BridgeTest2_processMessage is BridgeTest2 {
message.destOwner = Alice;
message.to = address(bridge);
message.data = abi.encodeWithSignature("sendSignal(bytes32)", hashOfMaliciousMessage);
uint256 davidBalance = David.balance;

vm.prank(Alice);
vm.expectRevert(Bridge.B_OUT_OF_ETH_QUOTA.selector);
Expand Down

0 comments on commit 62dd749

Please sign in to comment.