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 finalizer_test.go #25

Merged
merged 11 commits into from
Jul 30, 2024
Merged

fix finalizer_test.go #25

merged 11 commits into from
Jul 30, 2024

Conversation

lesterli
Copy link

@lesterli lesterli commented Jul 28, 2024

Summary

This PR completed the first task in #24 to fix the failed tests in the finalizer_test.go.

We updated finalizer.go to check the finality on each L2 block in this PR #23 (comment), which

  • added a l2Fetcher to fetch each L2 block

     type FinalizerL2Interface interface {
     	L2BlockRefByNumber(context.Context, uint64) (eth.L2BlockRef, error)
     }
  • updated the SDK query function to check a range of L2 blocks

     type BabylonFinalityClient interface {
     	QueryBlockRangeBabylonFinalized(queryBlocks []*cwclient.L2Block) (*uint64, error)
     }

So we added two helper functions in the finalizer_test.go.

func mockL2BlockRefByNumberWithTimes(l2F *testutils.MockL2Client, times int, refs ...eth.L2BlockRef)
func mockQueryBlockRangeBabylonFinalizedWithTimes(sdkClient *mocks.MockISdkClient, times int, refs ...eth.L2BlockRef)

Also, we added a function in the mock_l2.go to support the mock times.

func (m *MockL2Client) ExpectL2BlockRefByNumberWithTimes(num uint64, ref eth.L2BlockRef, times int, err error)

Test Plan

make lint-go

cd op-node
make test

Also, connect with FP e2e tests locally and make sure all test cases are passed.

@lesterli lesterli requested a review from bap2pecs July 28, 2024 13:36
@lesterli lesterli requested a review from bap2pecs July 29, 2024 09:05
Copy link

@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.

Elon Musk Travel - ZOilRom6v644PCsqVR

@lesterli lesterli merged commit 0d2a0da into feat/babylon-rfc Jul 30, 2024
1 check failed
@lesterli lesterli deleted the fix/finalizer-test branch July 30, 2024 02:20
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.

2 participants