Skip to content
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): encode proposer address in L2 block header #18770

Draft
wants to merge 1 commit into
base: pacaya_fork
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion packages/protocol/contracts/layer1/based/TaikoInbox.sol
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ abstract contract TaikoInbox is EssentialContract, ITaikoInbox, ITaiko, IFork {
txListHash: calldataUsed
? keccak256(_txList)
: _calcTxListHash(params.firstBlobIndex, params.numBlobs),
extraData: bytes32(uint256(config.baseFeeConfig.sharingPctg)),
// Ensure L2 block header has the proposer adddress so that blocks in p2p network can be
// verified based on the proposer address.
extraData: _encodeExtraData(config.baseFeeConfig.sharingPctg, params.proposer),
coinbase: params.coinbase,
batchId: stats2.numBatches,
gasLimit: config.blockMaxGasLimit,
Expand Down Expand Up @@ -670,6 +672,17 @@ abstract contract TaikoInbox is EssentialContract, ITaikoInbox, ITaiko, IFork {
require(_params.blocks.length <= _maxBlocksPerBatch, TooManyBlocks());
}

function _encodeExtraData(
uint8 _baseFeeSharingPctg,
address _proposer
)
private
pure
returns (bytes32)
{
return bytes32(uint256(_baseFeeSharingPctg) << 160 | uint160(_proposer));
}

// Memory-only structs ----------------------------------------------------------------------

struct SyncBlock {
Expand Down