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): propose a batch blocks conditionally #18570

Merged
merged 12 commits into from
Dec 16, 2024
Merged
15 changes: 8 additions & 7 deletions packages/protocol/contracts/layer1/provers/ProverSet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ interface IHasRecipient {
}

/// @title ProverSet
/// @notice A contract that holds TKO token and acts as a Taiko prover. This contract will simply
/// relay `proveBlock` calls to TaikoL1 so msg.sender doesn't need to hold any TKO.
/// @notice A contract that holds TAIKO token and acts as a Taiko prover. This contract will simply
/// relay `proveBlock` calls to TaikoL1 so msg.sender doesn't need to hold any TAIKO.
/// @custom:security-contact [email protected]
contract ProverSet is EssentialContract, IERC1271 {
bytes4 private constant _EIP1271_MAGICVALUE = 0x1626ba7e;
Expand Down Expand Up @@ -94,18 +94,19 @@ contract ProverSet is EssentialContract, IERC1271 {
LibAddress.sendEtherAndVerify(admin, _amount);
}

/// @notice Proposes a block only when it is the first block proposal in the current L1 block.
function proposeBlockV2Conditionally(
bytes calldata _params,
bytes calldata _txList
/// @notice Proposes a batch blocks only when it is the first batch blocks proposal in the
/// current L1 block.
function proposeBlocksV2Conditionally(
bytes[] calldata _params,
bytes[] calldata _txList
)
external
onlyProver
{
ITaikoL1 taiko = ITaikoL1(taikoL1());
// Ensure this block is the first block proposed in the current L1 block.
require(taiko.lastProposedIn() != block.number, NOT_FIRST_PROPOSAL());
taiko.proposeBlockV2(_params, _txList);
taiko.proposeBlocksV2(_params, _txList);
}

/// @notice Propose a Taiko block.
Expand Down