Skip to content

Commit

Permalink
feat(protocol): allow setting L2 coinbase (#15743)
Browse files Browse the repository at this point in the history
  • Loading branch information
dantaik authored Feb 12, 2024
1 parent ac1ca31 commit e3fde54
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/protocol/contracts/L1/TaikoData.sol
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ library TaikoData {

struct BlockParams {
address assignedProver;
address coinbase;
bytes32 extraData;
bytes32 blobHash;
uint24 txListByteOffset;
Expand Down
8 changes: 6 additions & 2 deletions packages/protocol/contracts/L1/libs/LibProposing.sol
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ library LibProposing {
revert L1_INVALID_PROVER();
}

if (params.coinbase == address(0)) {
params.coinbase = msg.sender;
}

// 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
Expand All @@ -101,7 +105,7 @@ library LibProposing {

// Each transaction must handle a specific quantity of L1-to-L2
// Ether deposits.
depositsProcessed = LibDepositing.processDeposits(state, config, msg.sender);
depositsProcessed = LibDepositing.processDeposits(state, config, params.coinbase);

// Initialize metadata to compute a metaHash, which forms a part of
// the block data to be stored on-chain for future integrity checks.
Expand All @@ -114,7 +118,7 @@ library LibProposing {
blobHash: 0, // to be initialized below
extraData: params.extraData,
depositsHash: keccak256(abi.encode(depositsProcessed)),
coinbase: msg.sender,
coinbase: params.coinbase,
id: b.numBlocks,
gasLimit: config.blockMaxGasLimit,
timestamp: uint64(block.timestamp),
Expand Down
2 changes: 1 addition & 1 deletion packages/protocol/test/L1/TaikoL1TestBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ abstract contract TaikoL1TestBase is TaikoTest {

vm.prank(proposer, proposer);
(meta, depositsProcessed) = L1.proposeBlock{ value: msgValue }(
abi.encode(TaikoData.BlockParams(prover, 0, 0, 0, 0, false, 0, hookcalls)),
abi.encode(TaikoData.BlockParams(prover, address(0), 0, 0, 0, 0, false, 0, hookcalls)),
new bytes(txListSize)
);
}
Expand Down

0 comments on commit e3fde54

Please sign in to comment.