Skip to content

Commit

Permalink
Revert "feat(protocol): add lastProposedIn to slotB (#18379)"
Browse files Browse the repository at this point in the history
This reverts commit 96b380a.
  • Loading branch information
YoGhurt111 committed Nov 4, 2024
1 parent dd09f27 commit 36a5da5
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 29 deletions.
4 changes: 0 additions & 4 deletions packages/protocol/contracts/layer1/based/ITaikoL1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,6 @@ interface ITaikoL1 {
view
returns (TaikoData.TransitionState memory);

/// @notice Retrieves the ID of the L1 block where the most recent L2 block was proposed.
/// @return The ID of the Li block where the most recent block was proposed.
function lastProposedIn() external view returns (uint56);

/// @notice Gets the configuration of the TaikoL1 contract.
/// @return Config struct containing configuration parameters.
function getConfig() external pure returns (TaikoData.Config memory);
Expand Down
1 change: 0 additions & 1 deletion packages/protocol/contracts/layer1/based/LibProposing.sol
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ library LibProposing {
unchecked {
++_state.slotB.numBlocks;
}
_state.slotB.lastProposedIn = uint56(block.number);

LibBonds.debitBond(_state, _resolver, local.params.proposer, meta_.id, _config.livenessBond);

Expand Down
4 changes: 3 additions & 1 deletion packages/protocol/contracts/layer1/based/TaikoData.sol
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,9 @@ library TaikoData {
uint64 numBlocks;
uint64 lastVerifiedBlockId;
bool provingPaused;
uint56 lastProposedIn;
uint8 __reservedB1;
uint16 __reservedB2;
uint32 __reservedB3;
uint64 lastUnpausedAt;
}

Expand Down
10 changes: 4 additions & 6 deletions packages/protocol/contracts/layer1/based/TaikoL1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ contract TaikoL1 is EssentialContract, ITaikoL1, TaikoEvents {

/// @notice This function shall be called by previously deployed contracts.
function init2() external onlyOwner reinitializer(2) {
// reset some previously used slots for future reuse
state.slotB.__reservedB1 = 0;
state.slotB.__reservedB2 = 0;
state.slotB.__reservedB3 = 0;
state.__reserve1 = 0;
}

Expand Down Expand Up @@ -283,12 +287,6 @@ contract TaikoL1 is EssentialContract, ITaikoL1, TaikoEvents {
return state.slotB.lastUnpausedAt;
}

/// @notice Retrieves the ID of the L1 block where the most recent L2 block was proposed.
/// @return The ID of the Li block where the most recent block was proposed.
function lastProposedIn() external view returns (uint56) {
return state.slotB.lastProposedIn;
}

/// @inheritdoc ITaikoL1
function getConfig() public pure virtual returns (TaikoData.Config memory) {
return TaikoData.Config({
Expand Down
15 changes: 0 additions & 15 deletions packages/protocol/contracts/layer1/provers/ProverSet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ contract ProverSet is EssentialContract, IERC1271 {
error INVALID_STATUS();
error INVALID_BOND_TOKEN();
error PERMISSION_DENIED();
error NOT_FIRST_PROPOSAL();

modifier onlyAuthorized() {
require(
Expand Down Expand Up @@ -94,20 +93,6 @@ 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
)
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);
}

/// @notice Propose a Taiko block.
function proposeBlockV2(bytes calldata _params, bytes calldata _txList) external onlyProver {
ITaikoL1(taikoL1()).proposeBlockV2(_params, _txList);
Expand Down
2 changes: 0 additions & 2 deletions packages/protocol/test/layer1/based/MockTaikoL1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,5 @@ contract MockTaikoL1 is ITaikoL1 {
returns (TaikoData.TransitionState memory)
{ }

function lastProposedIn() external view returns (uint56) { }

function getConfig() external pure virtual returns (TaikoData.Config memory) { }
}

0 comments on commit 36a5da5

Please sign in to comment.