diff --git a/packages/protocol/contracts/L1/TaikoData.sol b/packages/protocol/contracts/L1/TaikoData.sol index bb54cbb8e2e..66c01c1c79b 100644 --- a/packages/protocol/contracts/L1/TaikoData.sol +++ b/packages/protocol/contracts/L1/TaikoData.sol @@ -105,13 +105,4 @@ library TaikoData { // Reserved uint256[42] __gap; } - - struct TentativeState { - mapping(address => bool) proposers; // Whitelisted proposers - mapping(address => bool) provers; // Whitelisted provers - bool whitelistProposers; - bool whitelistProvers; - // // Reserved - uint256[46] __gap; - } } diff --git a/packages/protocol/contracts/L1/TaikoEvents.sol b/packages/protocol/contracts/L1/TaikoEvents.sol index ebd97dd9211..ff39318598e 100644 --- a/packages/protocol/contracts/L1/TaikoEvents.sol +++ b/packages/protocol/contracts/L1/TaikoEvents.sol @@ -32,11 +32,5 @@ abstract contract TaikoEvents { address prover ); - event WhitelistingEnabled(bool whitelistProposers, bool whitelistProvers); - - event ProposerWhitelisted(address indexed prover, bool whitelisted); - - event ProverWhitelisted(address indexed prover, bool whitelisted); - event Halted(bool halted); } diff --git a/packages/protocol/contracts/L1/TaikoL1.sol b/packages/protocol/contracts/L1/TaikoL1.sol index 1232dcda875..2305a40abc1 100644 --- a/packages/protocol/contracts/L1/TaikoL1.sol +++ b/packages/protocol/contracts/L1/TaikoL1.sol @@ -26,8 +26,7 @@ contract TaikoL1 is EssentialContract, IHeaderSync, TaikoEvents { using LibUtils for TaikoData.State; TaikoData.State public state; - TaikoData.TentativeState public tentative; - uint256[50] private __gap; + uint256[100] private __gap; function init( address _addressManager, @@ -40,9 +39,6 @@ contract TaikoL1 is EssentialContract, IHeaderSync, TaikoEvents { genesisBlockHash: _genesisBlockHash, feeBase: _feeBase }); - - tentative.whitelistProposers = false; - tentative.whitelistProvers = true; } /** @@ -88,7 +84,6 @@ contract TaikoL1 is EssentialContract, IHeaderSync, TaikoEvents { LibProposing.proposeBlock({ state: state, config: config, - tentative: tentative, resolver: AddressResolver(this), inputs: inputs }); @@ -123,7 +118,6 @@ contract TaikoL1 is EssentialContract, IHeaderSync, TaikoEvents { TaikoData.Config memory config = getConfig(); LibProving.proveBlock({ state: state, - tentative: tentative, config: config, resolver: AddressResolver(this), blockId: blockId, @@ -160,7 +154,6 @@ contract TaikoL1 is EssentialContract, IHeaderSync, TaikoEvents { LibProving.proveBlockInvalid({ state: state, - tentative: tentative, config: config, resolver: AddressResolver(this), blockId: blockId, @@ -190,56 +183,6 @@ contract TaikoL1 is EssentialContract, IHeaderSync, TaikoEvents { }); } - /** - * Enable or disable proposer and prover whitelisting - * @param whitelistProposers True to enable proposer whitelisting. - * @param whitelistProvers True to enable prover whitelisting. - */ - function enableWhitelisting( - bool whitelistProposers, - bool whitelistProvers - ) public onlyOwner { - LibUtils.enableWhitelisting({ - tentative: tentative, - whitelistProposers: whitelistProposers, - whitelistProvers: whitelistProvers - }); - } - - /** - * Add or remove a proposer from the whitelist. - * - * @param proposer The proposer to be added or removed. - * @param whitelisted True to add; remove otherwise. - */ - function whitelistProposer( - address proposer, - bool whitelisted - ) public onlyOwner { - LibUtils.whitelistProposer({ - tentative: tentative, - proposer: proposer, - whitelisted: whitelisted - }); - } - - /** - * Add or remove a prover from the whitelist. - * - * @param prover The prover to be added or removed. - * @param whitelisted True to add; remove otherwise. - */ - function whitelistProver( - address prover, - bool whitelisted - ) public onlyOwner { - LibUtils.whitelistProver({ - tentative: tentative, - prover: prover, - whitelisted: whitelisted - }); - } - /** * Halt or resume the chain. * @param toHalt True to halt, false to resume. @@ -248,28 +191,6 @@ contract TaikoL1 is EssentialContract, IHeaderSync, TaikoEvents { LibUtils.halt(state, toHalt); } - /** - * Check whether a proposer is whitelisted. - * - * @param proposer The proposer. - * @return True if the proposer is whitelisted, false otherwise. - */ - function isProposerWhitelisted( - address proposer - ) public view returns (bool) { - return LibUtils.isProposerWhitelisted(tentative, proposer); - } - - /** - * Check whether a prover is whitelisted. - * - * @param prover The prover. - * @return True if the prover is whitelisted, false otherwise. - */ - function isProverWhitelisted(address prover) public view returns (bool) { - return LibUtils.isProverWhitelisted(tentative, prover); - } - function getBlockFee() public view returns (uint256) { (, uint fee, uint deposit) = LibProposing.getBlockFee( state, diff --git a/packages/protocol/contracts/L1/libs/LibProposing.sol b/packages/protocol/contracts/L1/libs/LibProposing.sol index 00e2b4c5469..8525da78284 100644 --- a/packages/protocol/contracts/L1/libs/LibProposing.sol +++ b/packages/protocol/contracts/L1/libs/LibProposing.sol @@ -27,15 +27,6 @@ library LibProposing { ); event BlockProposed(uint256 indexed id, TaikoData.BlockMetadata meta); - modifier onlyWhitelistedProposer( - TaikoData.TentativeState storage tentative - ) { - if (tentative.whitelistProposers) { - require(tentative.proposers[msg.sender], "L1:whitelist"); - } - _; - } - function commitBlock( TaikoData.State storage state, TaikoData.Config memory config, @@ -63,10 +54,9 @@ library LibProposing { function proposeBlock( TaikoData.State storage state, TaikoData.Config memory config, - TaikoData.TentativeState storage tentative, AddressResolver resolver, bytes[] calldata inputs - ) public onlyWhitelistedProposer(tentative) { + ) public { assert(!LibUtils.isHalted(state)); require(inputs.length == 2, "L1:inputs:size"); diff --git a/packages/protocol/contracts/L1/libs/LibProving.sol b/packages/protocol/contracts/L1/libs/LibProving.sol index e1ccc47704b..87d601e4b60 100644 --- a/packages/protocol/contracts/L1/libs/LibProving.sol +++ b/packages/protocol/contracts/L1/libs/LibProving.sol @@ -50,21 +50,13 @@ library LibProving { address prover ); - modifier onlyWhitelistedProver(TaikoData.TentativeState storage tentative) { - if (tentative.whitelistProvers) { - require(tentative.provers[msg.sender], "L1:whitelist"); - } - _; - } - function proveBlock( TaikoData.State storage state, - TaikoData.TentativeState storage tentative, TaikoData.Config memory config, AddressResolver resolver, uint256 blockId, bytes[] calldata inputs - ) public onlyWhitelistedProver(tentative) { + ) public { assert(!LibUtils.isHalted(state)); // Check and decode inputs @@ -157,12 +149,11 @@ library LibProving { function proveBlockInvalid( TaikoData.State storage state, - TaikoData.TentativeState storage tentative, TaikoData.Config memory config, AddressResolver resolver, uint256 blockId, bytes[] calldata inputs - ) public onlyWhitelistedProver(tentative) { + ) public { assert(!LibUtils.isHalted(state)); // Check and decode inputs diff --git a/packages/protocol/contracts/L1/libs/LibUtils.sol b/packages/protocol/contracts/L1/libs/LibUtils.sol index 1b50ce7667d..84adbc26a63 100644 --- a/packages/protocol/contracts/L1/libs/LibUtils.sol +++ b/packages/protocol/contracts/L1/libs/LibUtils.sol @@ -21,52 +21,8 @@ library LibUtils { bytes32 public constant BLOCK_DEADEND_HASH = bytes32(uint256(1)); - event WhitelistingEnabled(bool whitelistProposers, bool whitelistProvers); - event ProposerWhitelisted(address indexed proposer, bool whitelisted); - event ProverWhitelisted(address indexed prover, bool whitelisted); event Halted(bool halted); - function enableWhitelisting( - TaikoData.TentativeState storage tentative, - bool whitelistProposers, - bool whitelistProvers - ) internal { - tentative.whitelistProposers = whitelistProvers; - tentative.whitelistProvers = whitelistProvers; - emit WhitelistingEnabled(whitelistProposers, whitelistProvers); - } - - function whitelistProposer( - TaikoData.TentativeState storage tentative, - address proposer, - bool whitelisted - ) internal { - assert(tentative.whitelistProposers); - require( - proposer != address(0) && - tentative.proposers[proposer] != whitelisted, - "L1:precondition" - ); - - tentative.proposers[proposer] = whitelisted; - emit ProposerWhitelisted(proposer, whitelisted); - } - - function whitelistProver( - TaikoData.TentativeState storage tentative, - address prover, - bool whitelisted - ) internal { - assert(tentative.whitelistProvers); - require( - prover != address(0) && tentative.provers[prover] != whitelisted, - "L1:precondition" - ); - - tentative.provers[prover] = whitelisted; - emit ProverWhitelisted(prover, whitelisted); - } - function halt(TaikoData.State storage state, bool toHalt) internal { require(isHalted(state) != toHalt, "L1:precondition"); setBit(state, MASK_HALT, toHalt); @@ -127,22 +83,6 @@ library LibUtils { return isBitOne(state, MASK_HALT); } - function isProposerWhitelisted( - TaikoData.TentativeState storage tentative, - address proposer - ) internal view returns (bool) { - assert(tentative.whitelistProposers); - return tentative.proposers[proposer]; - } - - function isProverWhitelisted( - TaikoData.TentativeState storage tentative, - address prover - ) internal view returns (bool) { - assert(tentative.whitelistProvers); - return tentative.provers[prover]; - } - // Implement "Incentive Multipliers", see the whitepaper. function getTimeAdjustedFee( TaikoData.State storage state,