diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c5721d736..3b824e4f7 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -21,7 +21,7 @@ jobs: go-version: '1.19' - run: git config --global url.https://$GH_ACCESS_TOKEN@github.com/.insteadOf https://github.com/ - name: golangci-lint - uses: golangci/golangci-lint-action@v3.5.0 + uses: golangci/golangci-lint-action@v3.7.0 with: # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version version: v1.49 @@ -48,7 +48,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: markdownlint-cli - uses: nosborn/github-action-markdown-cli@v3.2.0 + uses: nosborn/github-action-markdown-cli@v3.3.0 with: files: . config-file: .markdownlint.yaml \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4e65c8982..e2d0b25b5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,7 +17,7 @@ jobs: - uses: actions/checkout@v3 - name: Set up Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v4 with: go-version: 1.19 - run: git config --global url.https://$GH_ACCESS_TOKEN@github.com/.insteadOf https://github.com/ diff --git a/block/manager.go b/block/manager.go index 3c3c5a1ea..018705c5d 100644 --- a/block/manager.go +++ b/block/manager.go @@ -180,6 +180,7 @@ func (m *Manager) Start(ctx context.Context, isAggregator bool) error { m.logger.Info("Starting in aggregator mode") // TODO(omritoptix): change to private methods go m.ProduceBlockLoop(ctx) + go m.SubmitLoop(ctx) } // TODO(omritoptix): change to private methods go m.RetriveLoop(ctx) @@ -282,6 +283,36 @@ func (m *Manager) waitForSync(ctx context.Context) error { return nil } +func (m *Manager) SubmitLoop(ctx context.Context) { + ticker := time.NewTicker(m.conf.BatchSubmitMaxTime) + defer ticker.Stop() + + for { + select { + //Context canceled + case <-ctx.Done(): + return + case <-ticker.C: + // SyncTarget is the height of the last block in the last batch as seen by this node. + syncTarget := atomic.LoadUint64(&m.syncTarget) + height := m.store.Height() + //no new blocks produced yet + if (height - syncTarget) == 0 { + continue + } + + // Submit batch if we've reached the batch size and there isn't another batch currently in submission process. + if m.batchInProcess.Load() == false { + m.batchInProcess.Store(true) + go m.submitNextBatch(ctx) + } + + //TODO: add the case of batch size (should be signaled from the the block production) + // case <- requiredByNumOfBlocks + } + } +} + // ProduceBlockLoop is calling publishBlock in a loop as long as wer'e synced. func (m *Manager) ProduceBlockLoop(ctx context.Context) { atomic.StoreInt64(&m.lastSubmissionTime, time.Now().Unix()) @@ -708,21 +739,6 @@ func (m *Manager) produceBlock(ctx context.Context, allowEmpty bool) error { m.logger.Info("block created", "height", newHeight, "num_tx", len(block.Data.Txs)) rollappHeightGauge.Set(float64(newHeight)) - - //TODO: move to separate function - lastSubmissionTime := atomic.LoadInt64(&m.lastSubmissionTime) - requiredByTime := time.Since(time.Unix(0, lastSubmissionTime)) > m.conf.BatchSubmitMaxTime - - // SyncTarget is the height of the last block in the last batch as seen by this node. - syncTarget := atomic.LoadUint64(&m.syncTarget) - requiredByNumOfBlocks := (block.Header.Height - syncTarget) > m.conf.BlockBatchSize - - // Submit batch if we've reached the batch size and there isn't another batch currently in submission process. - if m.batchInProcess.Load() == false && (requiredByTime || requiredByNumOfBlocks) { - m.batchInProcess.Store(true) - go m.submitNextBatch(ctx) - } - return nil } diff --git a/block/production_test.go b/block/production_test.go index 1f11d474b..732729136 100644 --- a/block/production_test.go +++ b/block/production_test.go @@ -195,6 +195,7 @@ func TestBatchSubmissionAfterTimeout(t *testing.T) { mCtx, cancel := context.WithTimeout(context.Background(), runTime) defer cancel() go manager.ProduceBlockLoop(mCtx) + go manager.SubmitLoop(mCtx) <-mCtx.Done() require.True(manager.batchInProcess.Load() == true) diff --git a/config/config.go b/config/config.go index a03ce15ca..efed1f6b7 100644 --- a/config/config.go +++ b/config/config.go @@ -94,16 +94,16 @@ func (c BlockManagerConfig) Validate() error { return fmt.Errorf("empty_blocks_max_time must be positive or zero to disable") } - if c.EmptyBlocksMaxTime <= c.BlockTime { - return fmt.Errorf("empty_blocks_max_time must be greater than block_time") - } - if c.BatchSubmitMaxTime <= 0 { return fmt.Errorf("batch_submit_max_time must be positive") } - if c.BatchSubmitMaxTime <= c.EmptyBlocksMaxTime { - return fmt.Errorf("batch_submit_max_time must be greater than empty_blocks_max_time") + if c.EmptyBlocksMaxTime != 0 && c.EmptyBlocksMaxTime <= c.BlockTime { + return fmt.Errorf("empty_blocks_max_time must be greater than block_time") + } + + if c.BatchSubmitMaxTime < c.BlockTime { + return fmt.Errorf("batch_submit_max_time must be greater than block_time") } if c.BlockBatchSize <= 0 { diff --git a/config/toml.go b/config/toml.go index a0a2c997f..83ab63152 100644 --- a/config/toml.go +++ b/config/toml.go @@ -69,7 +69,7 @@ aggregator = "{{ .Aggregator }}" # block production interval block_time = "{{ .BlockManagerConfig.BlockTime }}" -# block time for empty blocks (block time in case of no transactions) +# block production interval in case of no transactions ("0s" produces empty blocks) empty_blocks_max_time = "{{ .BlockManagerConfig.EmptyBlocksMaxTime }}" # triggers to submit batch to DA and settlement (both required) diff --git a/da/celestia/celestia_test.go b/da/celestia/celestia_test.go index 293602901..52c9746cf 100644 --- a/da/celestia/celestia_test.go +++ b/da/celestia/celestia_test.go @@ -10,13 +10,14 @@ import ( "github.com/celestiaorg/go-cnc" "github.com/dymensionxyz/dymint/da" "github.com/dymensionxyz/dymint/da/celestia" - "github.com/dymensionxyz/dymint/log/test" mocks "github.com/dymensionxyz/dymint/mocks/da/celestia" "github.com/dymensionxyz/dymint/testutil" "github.com/dymensionxyz/dymint/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" + "github.com/tendermint/tendermint/libs/log" + "github.com/tendermint/tendermint/libs/bytes" "github.com/tendermint/tendermint/libs/pubsub" rpcmock "github.com/tendermint/tendermint/rpc/client/mocks" @@ -114,7 +115,7 @@ func TestSubmitBatch(t *testing.T) { assert.NoError(err) // Start the DALC dalc := celestia.DataAvailabilityLayerClient{} - err = dalc.Init(configBytes, pubsubServer, nil, test.NewLogger(t), options...) + err = dalc.Init(configBytes, pubsubServer, nil, log.TestingLogger(), options...) require.NoError(err) err = dalc.Start() require.NoError(err) diff --git a/da/celestia/mock/server.go b/da/celestia/mock/server.go index 986f470f7..b8fcb4cf1 100644 --- a/da/celestia/mock/server.go +++ b/da/celestia/mock/server.go @@ -48,9 +48,9 @@ func (s *Server) Start(listener net.Listener) error { if err != nil { return err } + s.server = new(http.Server) + s.server.Handler = s.getHandler() go func() { - s.server = new(http.Server) - s.server.Handler = s.getHandler() err := s.server.Serve(listener) s.logger.Debug("http server exited with", "error", err) }() diff --git a/da/da_test.go b/da/da_test.go index c1210cfcd..d5f21661f 100644 --- a/da/da_test.go +++ b/da/da_test.go @@ -14,6 +14,8 @@ import ( "github.com/tendermint/tendermint/libs/pubsub" "google.golang.org/grpc" + "github.com/tendermint/tendermint/libs/log" + "github.com/dymensionxyz/dymint/da" "github.com/dymensionxyz/dymint/da/celestia" cmock "github.com/dymensionxyz/dymint/da/celestia/mock" @@ -21,7 +23,6 @@ import ( "github.com/dymensionxyz/dymint/da/grpc/mockserv" "github.com/dymensionxyz/dymint/da/mock" "github.com/dymensionxyz/dymint/da/registry" - "github.com/dymensionxyz/dymint/log/test" "github.com/dymensionxyz/dymint/store" "github.com/dymensionxyz/dymint/types" ) @@ -35,7 +36,7 @@ func TestLifecycle(t *testing.T) { for _, dalc := range registry.RegisteredClients() { //TODO(omritoptix): Possibly add support for avail here. if dalc == "avail" { - t.Skip("TODO") + continue } t.Run(dalc, func(t *testing.T) { doTestLifecycle(t, dalc) @@ -57,7 +58,7 @@ func doTestLifecycle(t *testing.T, daType string) { require.NoError(err) } - err = dalc.Init(dacfg, pubsubServer, nil, test.NewLogger(t)) + err = dalc.Init(dacfg, pubsubServer, nil, log.TestingLogger()) require.NoError(err) err = dalc.Start() @@ -77,7 +78,7 @@ func TestDALC(t *testing.T) { for _, dalc := range registry.RegisteredClients() { //TODO(omritoptix): Possibly add support for avail here. if dalc == "avail" { - t.Skip("TODO") + continue } t.Run(dalc, func(t *testing.T) { doTestDALC(t, registry.GetClient(dalc)) @@ -106,7 +107,7 @@ func doTestDALC(t *testing.T, dalc da.DataAvailabilityLayerClient) { } pubsubServer := pubsub.NewServer() pubsubServer.Start() - err := dalc.Init(conf, pubsubServer, store.NewDefaultInMemoryKVStore(), test.NewLogger(t)) + err := dalc.Init(conf, pubsubServer, store.NewDefaultInMemoryKVStore(), log.TestingLogger()) require.NoError(err) err = dalc.Start() @@ -164,11 +165,11 @@ func TestRetrieve(t *testing.T) { defer httpServer.Stop() for _, client := range registry.RegisteredClients() { + //TODO(omritoptix): Possibly add support for avail here. + if client == "avail" { + continue + } t.Run(client, func(t *testing.T) { - //TODO(omritoptix): Possibly add support for avail here. - if client == "avail" { - t.Skip("TODO") - } dalc := registry.GetClient(client) _, ok := dalc.(da.BatchRetriever) if ok { @@ -194,7 +195,7 @@ func startMockGRPCServ(t *testing.T) *grpc.Server { func startMockCelestiaNodeServer(t *testing.T) *cmock.Server { t.Helper() - httpSrv := cmock.NewServer(mockDaBlockTime, test.NewLogger(t)) + httpSrv := cmock.NewServer(mockDaBlockTime, log.TestingLogger()) l, err := net.Listen("tcp4", ":26658") if err != nil { t.Fatal("failed to create listener for mock celestia-node RPC server", "error", err) @@ -227,7 +228,7 @@ func doTestRetrieve(t *testing.T, dalc da.DataAvailabilityLayerClient) { } pubsubServer := pubsub.NewServer() pubsubServer.Start() - err := dalc.Init(conf, pubsubServer, store.NewDefaultInMemoryKVStore(), test.NewLogger(t)) + err := dalc.Init(conf, pubsubServer, store.NewDefaultInMemoryKVStore(), log.TestingLogger()) require.NoError(err) err = dalc.Start() diff --git a/go.mod b/go.mod index e7ad08881..75c7ef27a 100644 --- a/go.mod +++ b/go.mod @@ -19,12 +19,11 @@ require ( github.com/gorilla/rpc v1.2.0 github.com/gorilla/websocket v1.5.0 github.com/informalsystems/tm-load-test v1.3.0 - github.com/ipfs/go-log v1.0.5 github.com/libp2p/go-libp2p v0.26.0 github.com/libp2p/go-libp2p-core v0.20.1 github.com/libp2p/go-libp2p-kad-dht v0.21.0 github.com/libp2p/go-libp2p-pubsub v0.9.0 - github.com/multiformats/go-multiaddr v0.8.0 + github.com/multiformats/go-multiaddr v0.11.0 github.com/prometheus/client_golang v1.14.0 github.com/rs/cors v1.8.3 github.com/spf13/cobra v1.6.1 @@ -33,7 +32,7 @@ require ( github.com/tendermint/tendermint v0.34.28 go.uber.org/multierr v1.8.0 golang.org/x/net v0.9.0 - gonum.org/v1/gonum v0.12.0 + gonum.org/v1/gonum v0.14.0 google.golang.org/grpc v1.57.0 google.golang.org/protobuf v1.31.0 ) @@ -64,6 +63,7 @@ require ( github.com/hashicorp/go-uuid v1.0.1 // indirect github.com/hashicorp/golang-lru/v2 v2.0.1 // indirect github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c // indirect + github.com/ipfs/go-log v1.0.5 // indirect github.com/lib/pq v1.10.7 // indirect github.com/libp2p/go-yamux/v4 v4.0.0 // indirect github.com/minio/highwayhash v1.0.2 // indirect @@ -84,7 +84,7 @@ require ( github.com/zondax/ledger-go v0.14.1 // indirect go.uber.org/dig v1.15.0 // indirect go.uber.org/fx v1.18.2 // indirect - golang.org/x/exp v0.0.0-20230310171629-522b1b587ee0 // indirect + golang.org/x/exp v0.0.0-20230725012225-302865e7556b // indirect google.golang.org/api v0.114.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230525234035-dd9d682886f9 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect @@ -160,7 +160,7 @@ require ( github.com/jbenet/goprocess v0.1.4 // indirect github.com/jmhodges/levigo v1.0.0 // indirect github.com/klauspost/compress v1.16.0 // indirect - github.com/klauspost/cpuid/v2 v2.2.1 // indirect + github.com/klauspost/cpuid/v2 v2.2.3 // indirect github.com/koron/go-ssdp v0.0.3 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect github.com/libp2p/go-cidranger v1.1.0 // indirect @@ -180,7 +180,7 @@ require ( github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc // indirect github.com/mimoo/StrobeGo v0.0.0-20220103164710-9a04d6ca976b // indirect - github.com/minio/sha256-simd v1.0.0 // indirect + github.com/minio/sha256-simd v1.0.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mr-tron/base58 v1.2.0 // indirect github.com/mtibben/percent v0.2.1 // indirect @@ -223,7 +223,7 @@ require ( go.uber.org/atomic v1.10.0 // indirect go.uber.org/zap v1.24.0 // indirect golang.org/x/crypto v0.7.0 // indirect - golang.org/x/mod v0.9.0 // indirect + golang.org/x/mod v0.11.0 // indirect golang.org/x/sync v0.1.0 // indirect golang.org/x/sys v0.7.0 // indirect golang.org/x/term v0.7.0 // indirect @@ -242,7 +242,7 @@ require ( github.com/golang/glog v1.1.0 // indirect github.com/gopherjs/gopherjs v0.0.0-20190812055157-5d271430af9f // indirect github.com/ignite/cli v0.25.2 - github.com/pkg/errors v0.9.1 // indirect + github.com/pkg/errors v0.9.1 github.com/prometheus/common v0.42.0 // indirect github.com/smartystreets/assertions v1.0.1 // indirect golang.org/x/tools v0.7.0 // indirect diff --git a/go.sum b/go.sum index ee242f69e..64c12792c 100644 --- a/go.sum +++ b/go.sum @@ -510,8 +510,8 @@ github.com/klauspost/compress v1.16.0 h1:iULayQNOReoYUe+1qtKOqw9CwJv3aNQu8ivo7lw github.com/klauspost/compress v1.16.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/klauspost/cpuid/v2 v2.2.1 h1:U33DW0aiEj633gHYw3LoDNfkDiYnE5Q8M/TKJn2f2jI= -github.com/klauspost/cpuid/v2 v2.2.1/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= +github.com/klauspost/cpuid/v2 v2.2.3 h1:sxCkb+qR91z4vsqw4vGGZlDgPz3G7gjaLyK3V8y70BU= +github.com/klauspost/cpuid/v2 v2.2.3/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/koron/go-ssdp v0.0.0-20191105050749-2e1c40ed0b5d/go.mod h1:5Ky9EC2xfoUKUor0Hjgi2BJhCSXJfMOFlmyYrVKGQMk= github.com/koron/go-ssdp v0.0.3 h1:JivLMY45N76b4p/vsWGOKewBQu6uf39y8l+AQ7sDKx8= @@ -597,8 +597,9 @@ github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8Rv github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA/g= github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= -github.com/minio/sha256-simd v1.0.0 h1:v1ta+49hkWZyvaKwrQB8elexRqm6Y0aMLjCNsrYxo6g= github.com/minio/sha256-simd v1.0.0/go.mod h1:OuYzVNI5vcoYIAmbIvHPl3N3jUzVedXbKy5RFepssQM= +github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM= +github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= @@ -625,8 +626,8 @@ github.com/multiformats/go-base36 v0.2.0 h1:lFsAbNOGeKtuKozrtBsAkSVhv1p9D0/qedU9 github.com/multiformats/go-base36 v0.2.0/go.mod h1:qvnKE++v+2MWCfePClUEjE78Z7P2a1UV0xHgWc0hkp4= github.com/multiformats/go-multiaddr v0.1.1/go.mod h1:aMKBKNEYmzmDmxfX88/vz+J5IU55txyt0p4aiWVohjo= github.com/multiformats/go-multiaddr v0.2.0/go.mod h1:0nO36NvPpyV4QzvTLi/lafl2y95ncPj0vFwVF6k6wJ4= -github.com/multiformats/go-multiaddr v0.8.0 h1:aqjksEcqK+iD/Foe1RRFsGZh8+XFiGo7FgUCZlpv3LU= -github.com/multiformats/go-multiaddr v0.8.0/go.mod h1:Fs50eBDWvZu+l3/9S6xAE7ZYj6yhxlvaVZjakWN7xRs= +github.com/multiformats/go-multiaddr v0.11.0 h1:XqGyJ8ufbCE0HmTDwx2kPdsrQ36AGPZNZX6s6xfJH10= +github.com/multiformats/go-multiaddr v0.11.0/go.mod h1:gWUm0QLR4thQ6+ZF6SXUw8YjtwQSPapICM+NmCkxHSM= github.com/multiformats/go-multiaddr-dns v0.3.1 h1:QgQgR+LQVt3NPTjbrLLpsaT2ufAA2y0Mkk+QRVJbW3A= github.com/multiformats/go-multiaddr-dns v0.3.1/go.mod h1:G/245BRQ6FJGmryJCrOuTdB37AMA5AMOVuO6NY3JwTk= github.com/multiformats/go-multiaddr-fmt v0.1.0 h1:WLEFClPycPkp4fnIzoFoV9FVd49/eQsuaL3/CWe167E= @@ -946,8 +947,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20230310171629-522b1b587ee0 h1:LGJsf5LRplCck6jUCH3dBL2dmycNruWNF5xugkSlfXw= -golang.org/x/exp v0.0.0-20230310171629-522b1b587ee0/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= +golang.org/x/exp v0.0.0-20230725012225-302865e7556b h1:tK7yjGqVRzYdXsBcfD2MLhFAhHfDgGLm2rY1ub7FA9k= +golang.org/x/exp v0.0.0-20230725012225-302865e7556b/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -973,8 +974,8 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.9.0 h1:KENHtAZL2y3NLMYZeHY9DW8HW8V+kQyJsY/V9JlKvCs= -golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.11.0 h1:bUO06HqtnRcc/7l71XBe4WcqTZ+3AH1J59zWDDwLKgU= +golang.org/x/mod v0.11.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1210,8 +1211,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= -gonum.org/v1/gonum v0.12.0 h1:xKuo6hzt+gMav00meVPUlXwSdoEJP46BR+wdxQEFK2o= -gonum.org/v1/gonum v0.12.0/go.mod h1:73TDxJfAAHeA8Mk9mf8NlIppyhQNo5GLTcYeqgo2lvY= +gonum.org/v1/gonum v0.14.0 h1:2NiG67LD1tEH0D7kM+ps2V+fXmsAnpUeec7n8tcr4S0= +gonum.org/v1/gonum v0.14.0/go.mod h1:AoWeoz0becf9QMWtE8iWXNXc27fK4fNeHNf/oMejGfU= google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= google.golang.org/api v0.0.0-20181030000543-1d582fd0359e/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= google.golang.org/api v0.1.0/go.mod h1:UGEZY7KEX120AnNLIHFMKIo4obdJhkp2tPbaPlQx13Y= diff --git a/p2p/client_test.go b/p2p/client_test.go index f145fcc53..95ee23f03 100644 --- a/p2p/client_test.go +++ b/p2p/client_test.go @@ -7,20 +7,21 @@ import ( "testing" "time" - "github.com/ipfs/go-log" "github.com/libp2p/go-libp2p/core/crypto" "github.com/libp2p/go-libp2p/core/peer" "github.com/multiformats/go-multiaddr" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/tendermint/tendermint/libs/log" + "github.com/dymensionxyz/dymint/config" "github.com/dymensionxyz/dymint/log/test" ) func TestClientStartup(t *testing.T) { privKey, _, _ := crypto.GenerateEd25519Key(rand.Reader) - client, err := NewClient(config.P2PConfig{}, privKey, "TestChain", test.NewLogger(t)) + client, err := NewClient(config.P2PConfig{}, privKey, "TestChain", log.TestingLogger()) assert := assert.New(t) assert.NoError(err) assert.NotNil(client) @@ -33,11 +34,8 @@ func TestClientStartup(t *testing.T) { } func TestBootstrapping(t *testing.T) { - _ = log.SetLogLevel("dht", "INFO") - //log.SetDebugLogging() - assert := assert.New(t) - logger := test.NewLogger(t) + logger := log.TestingLogger() ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -57,7 +55,7 @@ func TestBootstrapping(t *testing.T) { func TestDiscovery(t *testing.T) { assert := assert.New(t) - logger := test.NewLogger(t) + logger := log.TestingLogger() ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -77,7 +75,7 @@ func TestDiscovery(t *testing.T) { func TestGossiping(t *testing.T) { assert := assert.New(t) - logger := test.NewLogger(t) + logger := log.TestingLogger() ctx := context.Background() diff --git a/settlement/dymension/dymension_test.go b/settlement/dymension/dymension_test.go index 022369eec..c79f52fc0 100644 --- a/settlement/dymension/dymension_test.go +++ b/settlement/dymension/dymension_test.go @@ -9,6 +9,8 @@ import ( "testing" "time" + "github.com/tendermint/tendermint/libs/log" + "github.com/cosmos/cosmos-sdk/crypto/keyring" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" @@ -25,7 +27,6 @@ import ( rollapptypes "github.com/dymensionxyz/dymension/x/rollapp/types" sequencertypes "github.com/dymensionxyz/dymension/x/sequencer/types" "github.com/dymensionxyz/dymint/da" - "github.com/dymensionxyz/dymint/log/test" mocks "github.com/dymensionxyz/dymint/mocks" settlementmocks "github.com/dymensionxyz/dymint/mocks/settlement" "github.com/dymensionxyz/dymint/settlement" @@ -53,7 +54,7 @@ func TestGetSequencers(t *testing.T) { pubsubServer := pubsub.NewServer() pubsubServer.Start() - hubClient, err := newDymensionHubClient(settlement.Config{}, pubsubServer, test.NewLogger(t), options...) + hubClient, err := newDymensionHubClient(settlement.Config{}, pubsubServer, log.TestingLogger(), options...) require.NoError(err) sequencers, err := hubClient.GetSequencers("mock-rollapp") @@ -196,7 +197,7 @@ func TestPostBatch(t *testing.T) { rollappQueryClientMock.On("LatestStateIndex", mock.Anything, mock.Anything).Return(nil, nil) } } - hubClient, err := newDymensionHubClient(settlement.Config{}, pubsubServer, test.NewLogger(t), options...) + hubClient, err := newDymensionHubClient(settlement.Config{}, pubsubServer, log.TestingLogger(), options...) require.NoError(err) hubClient.Start() // Handle the various events that are emitted and timeout if we don't get them diff --git a/settlement/settlement_test.go b/settlement/settlement_test.go index 542515165..573d9a093 100644 --- a/settlement/settlement_test.go +++ b/settlement/settlement_test.go @@ -4,6 +4,8 @@ import ( "testing" "time" + "github.com/tendermint/tendermint/libs/log" + "github.com/libp2p/go-libp2p/core/crypto" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -12,7 +14,6 @@ import ( "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" "github.com/dymensionxyz/dymint/da" - "github.com/dymensionxyz/dymint/log/test" mocks "github.com/dymensionxyz/dymint/mocks/settlement" "github.com/dymensionxyz/dymint/settlement" "github.com/dymensionxyz/dymint/settlement/registry" @@ -31,7 +32,7 @@ func TestLifecycle(t *testing.T) { pubsubServer := pubsub.NewServer() pubsubServer.Start() - err := client.Init(settlement.Config{}, pubsubServer, test.NewLogger(t)) + err := client.Init(settlement.Config{}, pubsubServer, log.TestingLogger()) require.NoError(err) err = client.Start() @@ -144,7 +145,7 @@ func TestGetSequencersEmptyList(t *testing.T) { pubsubServer := pubsub.NewServer() pubsubServer.Start() - err := settlementClient.Init(settlement.Config{}, pubsubServer, test.NewLogger(t), options...) + err := settlementClient.Init(settlement.Config{}, pubsubServer, log.TestingLogger(), options...) assert.Error(t, err, "empty sequencer list should return an error") } @@ -194,7 +195,7 @@ func initClient(t *testing.T, settlementlc settlement.LayerI, options ...settlem pubsubServer := pubsub.NewServer() pubsubServer.Start() - err := settlementlc.Init(settlement.Config{}, pubsubServer, test.NewLogger(t), options...) + err := settlementlc.Init(settlement.Config{}, pubsubServer, log.TestingLogger(), options...) require.NoError(err) err = settlementlc.Start()