Skip to content

Commit

Permalink
test(taiko-client): introduce TestProposeTxListOntake (#18167)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha authored Sep 24, 2024
1 parent ea0ca90 commit 5023226
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 3 deletions.
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

0 comments on commit 5023226

Please sign in to comment.