Skip to content

Commit

Permalink
Add some comment
Browse files Browse the repository at this point in the history
  • Loading branch information
dajuguan committed Jul 19, 2024
1 parent 32a338e commit 74242dc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/contracts-bedrock/src/dispute/FaultDisputeGameN.sol
Original file line number Diff line number Diff line change
Expand Up @@ -518,8 +518,9 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, ISemver {
} else if (_ident == LocalPreimageKey.DISPUTED_OUTPUT_ROOT) {
// Load the disputed proposal's output root
Claim disputed;
// If the pos is 1, then the rootclaim itself is the output hash.
if (disputedPos.raw() == 1) {
disputed = rootClaim();
disputed = disputedRoot;
} else {
disputed = getClaim(disputedRoot.raw(), disputedPos, _daItem);
}
Expand Down Expand Up @@ -1154,14 +1155,15 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, ISemver {
: _firstValidRightIndex(_pos.traceAncestorBounded(SPLIT_DEPTH), N_BITS);

uint256 offset = ancestorPos_.raw() % (1 << N_BITS);
if (MAX_ATTACK_BRANCH == offset) {
// If ancestorPos_.raw() == 1 (rootclaim), we don't offset it
if (MAX_ATTACK_BRANCH == offset || ancestorPos_.raw() == 1) {
offset = 0;
}
uint256 traceAncestorPosValue = ancestorPos_.raw() - offset;
// Walk up the DAG to find a claim that commits to the same trace index as `_pos`. It is
// guaranteed that such a claim exists.
ClaimData storage ancestor_ = claimData[_start];
if (traceAncestorPosValue == 0) {
if (traceAncestorPosValue == 1) {
ancestorClaimRoot_ = rootClaim();
} else {
while (ancestor_.position.raw() != traceAncestorPosValue) {
Expand Down

0 comments on commit 74242dc

Please sign in to comment.