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

fix(protocol): fix an issue in same transition check #18254

Merged
merged 5 commits into from
Oct 16, 2024
Merged
Changes from 2 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
9 changes: 6 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,8 @@ 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 +369,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