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 test: plasma_test.go #4

Merged
merged 19 commits into from
Aug 14, 2024
Merged

fix test: plasma_test.go #4

merged 19 commits into from
Aug 14, 2024

Conversation

lesterli
Copy link
Collaborator

Summary

This PR uncomments the plasma_test.go and fix the failed test. #1

From the test case, we can see:

  • L2 block is started from refA1, its block number is 1
  • at the L1 block(i==10), the finality signal trigger the tryFinalize()
    if i == 10 { // finalize a L1 commitment
      fi.OnEvent(FinalizeL1Event{FinalizedL1: l1parent})
  • one L1 block derives two L2 blocks
    for j := uint64(0); j < 2; j++ {
       l2parent = eth.L2BlockRef{
     	Hash:           testutils.RandomHash(rng),
     	Number:         l2parent.Number + 1,
     	ParentHash:     l2parent.Hash,
     	Time:           l2parent.Time + cfg.BlockTime,
     	L1Origin:       previous.ID(), // reference previous origin, not the block the batch was included in
     	SequenceNumber: j,
       }
       fi.OnEvent(engine.SafeDerivedEvent{Safe: l2parent, DerivedFrom: l1parent})
    }
  • so the finalized L2 block number should be 21(1 + 10*2), we should mock L2 block 1-21
    if i < 10 {
      mockL2Refs = append(mockL2Refs, l2parent)
      l2F.ExpectL2BlockRefByNumber(l2parent.Number, l2parent, nil)
    }
    
    if i < 10 {
      mockQueryBlockRangeBabylonFinalized(sdkClient, mockL2Refs)
    }

Test Plan

make lint-go
cd op-node && make test

@bap2pecs
Copy link
Collaborator

i just merged develop to the rfc branch. you will need to fix conflicts

Copy link
Collaborator

@bap2pecs bap2pecs left a comment

Choose a reason for hiding this comment

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

nice fix!

Way To Go Thumbs Up - yyZRSvISN1vvW

op-node/rollup/finality/plasma_test.go Outdated Show resolved Hide resolved
op-node/rollup/finality/plasma_test.go Outdated Show resolved Hide resolved
@lesterli lesterli merged commit 48cc6f2 into feat/babylon-rfc Aug 14, 2024
2 checks passed
@lesterli lesterli deleted the fix/plasma-test branch August 14, 2024 00:37
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