Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
RogerLamTd committed Jul 31, 2023
1 parent 8cf6a4d commit a8c1d33
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
8 changes: 7 additions & 1 deletion driver/chain_syncer/calldata/syncer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,13 @@ func (s *CalldataSyncerTestSuite) SetupTest() {
func (s *CalldataSyncerTestSuite) TestNewSyncer() {
ctx, cancel := context.WithCancel(context.Background())
cancel()
syncer, err := NewSyncer(ctx, s.RpcClient, s.s.state, s.s.progressTracker, common.HexToAddress(os.Getenv("L1_SIGNAL_SERVICE_CONTRACT_ADDRESS")))
syncer, err := NewSyncer(
ctx,
s.RpcClient,
s.s.state,
s.s.progressTracker,
common.HexToAddress(os.Getenv("L1_SIGNAL_SERVICE_CONTRACT_ADDRESS")),
)
s.Nil(syncer)
s.NotNil(err)
}
Expand Down
5 changes: 5 additions & 0 deletions driver/chain_syncer/chain_syncer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ func (s *ChainSyncerTestSuite) TestSync() {
s.Nil(s.s.Sync(head))
}

// func (s *ChainSyncerTestSuite) TestSyncTriggerBeaconSync() {
// s.s.p2pSyncVerifiedBlocks = true
// s.s.state.setLatestVerifiedBlockHash(common.Hash{})
// }

func TestChainSyncerTestSuite(t *testing.T) {
suite.Run(t, new(ChainSyncerTestSuite))
}
Expand Down
10 changes: 10 additions & 0 deletions driver/driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/ethereum/go-ethereum/crypto"
"github.com/stretchr/testify/suite"
"github.com/taikoxyz/taiko-client/bindings/encoding"
"github.com/taikoxyz/taiko-client/driver/state"
"github.com/taikoxyz/taiko-client/pkg/jwt"
"github.com/taikoxyz/taiko-client/proposer"
"github.com/taikoxyz/taiko-client/testutils"
Expand Down Expand Up @@ -294,6 +295,15 @@ func (s *DriverTestSuite) TestStartClose() {
s.d.Close()
}

func (s *DriverTestSuite) TestL1Current() {
// propose and insert a block
testutils.ProposeAndInsertEmptyBlocks(&s.ClientTestSuite, s.p, s.d.ChainSyncer().CalldataSyncer())
// reset L1 current with increased height
_, id, err := s.d.state.ResetL1Current(s.d.ctx, &state.HeightOrID{ID: common.Big1})
s.Equal(common.Big1, id)
s.Nil(err)
}

func TestDriverTestSuite(t *testing.T) {
suite.Run(t, new(DriverTestSuite))
}
5 changes: 0 additions & 5 deletions driver/state/l1_current_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,3 @@ func (s *DriverStateTestSuite) TestResetL1CurrentCtxErr() {
_, _, err := s.s.ResetL1Current(ctx, &HeightOrID{Height: common.Big1})
s.NotNil(err)
}

// func (s *DriverStateTestSuite) TestResetL1CurrentNonEmptyHeightEmptyID() {
// _, _, err := s.s.ResetL1Current(context.Background(), &HeightOrID{Height: common.Big3})
// s.Nil(err)
// }

0 comments on commit a8c1d33

Please sign in to comment.