Skip to content

Commit

Permalink
fix: Fixing L1 info tree sync tests (#130)
Browse files Browse the repository at this point in the history
* fix: Fix l1infotreesync tests
  • Loading branch information
rbpol authored Oct 17, 2024
1 parent 00bc136 commit 04f3f3a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions db/meddler.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
"github.com/russross/meddler"
)

// initMeddler registers tags to be used to read/write from SQL DBs using meddler
func initMeddler() {
// init registers tags to be used to read/write from SQL DBs using meddler
func init() {
meddler.Default = meddler.SQLite
meddler.Register("bigint", BigIntMeddler{})
meddler.Register("merkleproof", MerkleProofMeddler{})
Expand Down
1 change: 0 additions & 1 deletion db/sqlite.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ var (

// NewSQLiteDB creates a new SQLite DB
func NewSQLiteDB(dbPath string) (*sql.DB, error) {
initMeddler()
db, err := sql.Open("sqlite3", dbPath)
if err != nil {
return nil, err
Expand Down
2 changes: 2 additions & 0 deletions l1infotreesync/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,12 @@ func TestE2E(t *testing.T) {
rdm := l1infotreesync.NewReorgDetectorMock(t)
rdm.On("Subscribe", mock.Anything).Return(&reorgdetector.Subscription{}, nil)
rdm.On("AddBlockToTrack", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil)

client, auth, gerAddr, verifyAddr, gerSc, verifySC := newSimulatedClient(t)
syncer, err := l1infotreesync.New(ctx, dbPath, gerAddr, verifyAddr, 10, etherman.LatestBlock, rdm, client.Client(), time.Millisecond, 0, 100*time.Millisecond, 3,
l1infotreesync.FlagAllowWrongContractsAddrs)
require.NoError(t, err)

go syncer.Start(ctx)

// Update GER 3 times
Expand Down
1 change: 1 addition & 0 deletions sync/evmdriver.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ reset:
select {
case <-ctx.Done():
d.log.Info("sync stopped due to context done")
cancel()
return
case b := <-downloadCh:
d.log.Debug("handleNewBlock", " blockNum: ", b.Num, " blockHash: ", b.Hash)
Expand Down

0 comments on commit 04f3f3a

Please sign in to comment.