Skip to content

Commit

Permalink
fix(protocol): revert changes related to proposedIn and `proposedAt…
Browse files Browse the repository at this point in the history
…` to fix a bug (#18333)
  • Loading branch information
dantaik authored Oct 29, 2024
1 parent 9d18d59 commit 5cb43ab
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions packages/protocol/contracts/layer1/based/LibProposing.sol
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,13 @@ library LibProposing {
local.params.coinbase = local.params.proposer;
}

if (!local.postFork || local.params.anchorBlockId == 0) {
local.params.anchorBlockId = uint64(block.number - 1);
if (local.params.anchorBlockId == 0) {
unchecked {
local.params.anchorBlockId = uint64(block.number - 1);
}
}

if (!local.postFork || local.params.timestamp == 0) {
if (local.params.timestamp == 0) {
local.params.timestamp = uint64(block.timestamp);
}

Expand Down Expand Up @@ -292,8 +294,8 @@ library LibProposing {
assignedProver: address(0),
livenessBond: local.postFork ? 0 : meta_.livenessBond,
blockId: local.b.numBlocks,
proposedAt: local.params.timestamp,
proposedIn: local.params.anchorBlockId,
proposedAt: local.postFork ? local.params.timestamp : uint64(block.timestamp),
proposedIn: local.postFork ? local.params.anchorBlockId : uint64(block.number),
// For a new block, the next transition ID is always 1, not 0.
nextTransitionId: 1,
livenessBondReturned: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ contract TaikoL1TestGroupA1 is TaikoL1TestGroupBase {
assertTrue(blk.livenessBond > 0);
assertEq(blk.assignedProver, address(0));
assertEq(blk.proposedAt, block.timestamp);
assertEq(blk.proposedIn, block.number - 1);
assertEq(blk.proposedIn, block.number);

// Prove the block
bytes32 blockHash = bytes32(uint256(10_000 + i));
Expand Down

0 comments on commit 5cb43ab

Please sign in to comment.