Skip to content

Conversation

@JustXxx
Copy link

@JustXxx JustXxx commented Jun 30, 2024

forge test --mc FaultDisputeGameN_Test --mt test_move_incorrectStatusExecRoot_reverts
forge test --mc FaultDisputeGameN_Test --mt test_move_correctStatusExecRoot_succeeds

uint8 vmStatus = uint8(_rootClaim.raw()[0]);

if ((0 != _attackBranch) || (disputedPos.depth() / N_BITS) % 2 == (SPLIT_DEPTH / N_BITS) % 2) {
if ((MAX_ATTACK_BRANCH != _attackBranch) || (disputedPos.depth() / N_BITS) % 2 == (SPLIT_DEPTH / N_BITS) % 2) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if disputed output and creator of the execution trace subgame disagrees, it might be ((disputedPos.depth() / N_BITS) % N_BITS == (SPLIT_DEPTH / N_BITS) % N_BITS) instead?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

% 2 is because we have only two parties - challenger and defender that play the game. The condition here is basically to check the submitter of the disputedLeafPos is not the same as the submitter of the output of the block transition (at SPLIT_DEPTH + 1).


/// @dev Tests that making a claim at the execution trace bisection root level with a valid status
/// byte succeeds.
function test_move_correctStatusExecRoot_succeeds() public {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As suggested in last week's meeting, better to do regression test. e.g, write tests that can reproduce the failing cases before the fix and pass after the fix

Copy link

@qizhou qizhou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we confirm the new tests fail the previous code?

uint8 vmStatus = uint8(_rootClaim.raw()[0]);

if ((0 != _attackBranch) || (disputedPos.depth() / N_BITS) % 2 == (SPLIT_DEPTH / N_BITS) % 2) {
if ((MAX_ATTACK_BRANCH != _attackBranch) || (disputedPos.depth() / N_BITS) % 2 == (SPLIT_DEPTH / N_BITS) % 2) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

% 2 is because we have only two parties - challenger and defender that play the game. The condition here is basically to check the submitter of the disputedLeafPos is not the same as the submitter of the output of the block transition (at SPLIT_DEPTH + 1).

@JustXxx
Copy link
Author

JustXxx commented Jul 20, 2024

fix by #35

@JustXxx JustXxx closed this Jul 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants