Skip to content

Commit

Permalink
fix(protocol): fix an issue in same transition check (#18254)
Browse files Browse the repository at this point in the history
Co-authored-by: dantaik <[email protected]>
  • Loading branch information
dantaik and dantaik authored Oct 16, 2024
1 parent bf3caf7 commit 233806e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/protocol/contracts/layer1/based/LibProving.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ library LibProving {
bool sameTransition;
bool postFork;
uint64 proposedAt;
bool isSyncBlock;
}

/// @notice Emitted when a transition is proved.
Expand Down Expand Up @@ -261,7 +262,9 @@ library LibProving {

local.proposedAt = local.postFork ? local.meta.proposedAt : blk.proposedAt;

if (LibUtils.shouldSyncStateRoot(_config.stateRootSyncInternal, local.blockId)) {
local.isSyncBlock =
LibUtils.shouldSyncStateRoot(_config.stateRootSyncInternal, local.blockId);
if (local.isSyncBlock) {
local.stateRoot = ctx_.tran.stateRoot;
}

Expand Down Expand Up @@ -367,8 +370,9 @@ library LibProving {

local.isTopTier = local.tier.contestBond == 0;

local.sameTransition =
ctx_.tran.blockHash == ts.blockHash && local.stateRoot == ts.stateRoot;
local.sameTransition = local.isSyncBlock
? ctx_.tran.blockHash == ts.blockHash && local.stateRoot == ts.stateRoot
: ctx_.tran.blockHash == ts.blockHash;

if (local.proof.tier > ts.tier) {
// Handles the case when an incoming tier is higher than the current transition's tier.
Expand Down

0 comments on commit 233806e

Please sign in to comment.