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

test(taiko-client): introduce TestProposeTxListOntake #18167

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion packages/taiko-client/bindings/.githead
Original file line number Diff line number Diff line change
@@ -1 +1 @@
db7b7a03af3797d37cce04cc2b05614c8dfeece4
ea0ca9040cc3d1d9fec50777d40b3cf69803c115
2 changes: 1 addition & 1 deletion packages/taiko-client/bindings/gen_lib_utils.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

64 changes: 63 additions & 1 deletion packages/taiko-client/bindings/gen_taiko_l1.go

Large diffs are not rendered by default.

36 changes: 36 additions & 0 deletions packages/taiko-client/proposer/proposer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package proposer

import (
"context"
"math/big"
"os"
"testing"
"time"
Expand Down Expand Up @@ -283,6 +284,41 @@ func (s *ProposerTestSuite) TestProposeEmptyBlockOp() {
s.Nil(s.p.ProposeOp(context.Background()))
}

func (s *ProposerTestSuite) TestProposeTxListOntake() {
for i := 0; i < int(s.p.protocolConfigs.OntakeForkHeight); i++ {
s.ProposeAndInsertValidBlock(s.p, s.s)
}

l2Head, err := s.p.rpc.L2.HeaderByNumber(context.Background(), nil)
s.Nil(err)
s.GreaterOrEqual(l2Head.Number.Uint64(), s.p.protocolConfigs.OntakeForkHeight)

sink := make(chan *bindings.TaikoL1ClientBlockProposedV2)
sub, err := s.p.rpc.TaikoL1.WatchBlockProposedV2(nil, sink, nil)
s.Nil(err)
defer func() {
sub.Unsubscribe()
close(sink)
}()
s.Nil(s.p.ProposeTxListOntake(context.Background(), []types.Transactions{{}, {}}))
s.Nil(s.s.ProcessL1Blocks(context.Background()))

var l1Height *big.Int
for i := 0; i < 2; i++ {
event := <-sink
if l1Height == nil {
l1Height = new(big.Int).SetUint64(event.Raw.BlockNumber)
continue
}
s.Equal(l1Height.Uint64(), event.Raw.BlockNumber)
}

newL2head, err := s.p.rpc.L2.HeaderByNumber(context.Background(), nil)
s.Nil(err)

s.Equal(l2Head.Number.Uint64()+2, newL2head.Number.Uint64())
}

func (s *ProposerTestSuite) TestUpdateProposingTicker() {
s.p.ProposeInterval = 1 * time.Hour
s.NotPanics(s.p.updateProposingTicker)
Expand Down
Loading