From 06cd45d4f562ff1e817c6cac0a803f6b74b460ae Mon Sep 17 00:00:00 2001 From: Morgan Bazalgette Date: Tue, 30 Jan 2024 13:05:49 +0100 Subject: [PATCH 01/14] refactor(tm2): split pkg/db into sub-packages --- gno.land/pkg/gnoland/app.go | 6 +- gno.land/pkg/gnoland/node_inmemory.go | 5 +- gnovm/tests/imports.go | 4 +- tm2/pkg/bft/abci/example/kvstore/kvstore.go | 3 +- .../example/kvstore/persistent_kvstore.go | 1 + tm2/pkg/bft/consensus/wal_generator.go | 4 +- tm2/pkg/bft/state/state_test.go | 1 + tm2/pkg/bft/state/store_test.go | 3 +- tm2/pkg/crypto/keys/keybase.go | 3 +- tm2/pkg/crypto/keys/lazy_keybase.go | 2 + tm2/pkg/db/_all/all.go | 13 + tm2/pkg/db/_all/all_cgo.go | 10 + tm2/pkg/db/_tags/boltdb.go | 5 + tm2/pkg/db/_tags/cleveldb.go | 5 + tm2/pkg/db/_tags/fsdb.go | 5 + tm2/pkg/db/_tags/goleveldb.go | 5 + tm2/pkg/db/_tags/memdb.go | 5 + tm2/pkg/db/_tags/rocksdb.go | 5 + tm2/pkg/db/_tags/tags.go | 5 + tm2/pkg/db/backend_test.go | 256 +++++++++++-- tm2/pkg/db/badger_db.go | 298 --------------- tm2/pkg/db/{ => boltdb}/boltdb.go | 42 +-- tm2/pkg/db/{ => boltdb}/boltdb_test.go | 11 +- tm2/pkg/db/{ => cleveldb}/c_level_db.go | 34 +- tm2/pkg/db/{ => cleveldb}/c_level_db_test.go | 29 +- tm2/pkg/db/cleveldb/no_cgo_test.go | 9 + tm2/pkg/db/common_test.go | 137 ++----- tm2/pkg/db/db.go | 49 ++- tm2/pkg/db/db_test.go | 213 ----------- tm2/pkg/db/{ => fsdb}/fsdb.go | 29 +- tm2/pkg/db/{ => goleveldb}/go_level_db.go | 36 +- .../db/{ => goleveldb}/go_level_db_test.go | 22 +- tm2/pkg/db/gorocks_db.go | 340 ------------------ tm2/pkg/db/gorocks_db_test.go | 29 -- tm2/pkg/db/grocks_db_test.go | 29 -- tm2/pkg/db/internal/internal.go | 13 + tm2/pkg/db/internal/mem_batch.go | 74 ++++ tm2/pkg/db/internal/mem_iterator.go | 67 ++++ tm2/pkg/db/internal/test_common.go | 130 +++++++ tm2/pkg/db/mem_batch.go | 74 ---- tm2/pkg/db/{ => memdb}/mem_db.go | 110 ++---- tm2/pkg/db/prefix_db_test.go | 37 +- tm2/pkg/db/{ => rocksdb}/grocks_db.go | 34 +- tm2/pkg/db/rocksdb/grocks_db_test.go | 34 ++ tm2/pkg/db/rocksdb/no_cgo_test.go | 9 + tm2/pkg/db/test_helpers.go | 32 -- tm2/pkg/db/types.go | 14 - tm2/pkg/db/util.go | 6 - tm2/pkg/db/util_test.go | 54 +-- tm2/pkg/iavl/basic_test.go | 1 + tm2/pkg/iavl/benchmarks/bench_test.go | 1 + tm2/pkg/iavl/cmd/iaviewer/main.go | 3 +- tm2/pkg/iavl/testutils_test.go | 1 + tm2/pkg/iavl/with_gcc_test.go | 1 + tm2/pkg/sdk/auth/test_common.go | 4 +- 55 files changed, 924 insertions(+), 1428 deletions(-) create mode 100644 tm2/pkg/db/_all/all.go create mode 100644 tm2/pkg/db/_all/all_cgo.go create mode 100644 tm2/pkg/db/_tags/boltdb.go create mode 100644 tm2/pkg/db/_tags/cleveldb.go create mode 100644 tm2/pkg/db/_tags/fsdb.go create mode 100644 tm2/pkg/db/_tags/goleveldb.go create mode 100644 tm2/pkg/db/_tags/memdb.go create mode 100644 tm2/pkg/db/_tags/rocksdb.go create mode 100644 tm2/pkg/db/_tags/tags.go delete mode 100644 tm2/pkg/db/badger_db.go rename tm2/pkg/db/{ => boltdb}/boltdb.go (87%) rename tm2/pkg/db/{ => boltdb}/boltdb_test.go (66%) rename tm2/pkg/db/{ => cleveldb}/c_level_db.go (88%) rename tm2/pkg/db/{ => cleveldb}/c_level_db_test.go (77%) create mode 100644 tm2/pkg/db/cleveldb/no_cgo_test.go delete mode 100644 tm2/pkg/db/db_test.go rename tm2/pkg/db/{ => fsdb}/fsdb.go (88%) rename tm2/pkg/db/{ => goleveldb}/go_level_db.go (88%) rename tm2/pkg/db/{ => goleveldb}/go_level_db_test.go (61%) delete mode 100644 tm2/pkg/db/gorocks_db.go delete mode 100644 tm2/pkg/db/gorocks_db_test.go delete mode 100644 tm2/pkg/db/grocks_db_test.go create mode 100644 tm2/pkg/db/internal/internal.go create mode 100644 tm2/pkg/db/internal/mem_batch.go create mode 100644 tm2/pkg/db/internal/mem_iterator.go create mode 100644 tm2/pkg/db/internal/test_common.go delete mode 100644 tm2/pkg/db/mem_batch.go rename tm2/pkg/db/{ => memdb}/mem_db.go (59%) rename tm2/pkg/db/{ => rocksdb}/grocks_db.go (90%) create mode 100644 tm2/pkg/db/rocksdb/grocks_db_test.go create mode 100644 tm2/pkg/db/rocksdb/no_cgo_test.go delete mode 100644 tm2/pkg/db/test_helpers.go diff --git a/gno.land/pkg/gnoland/app.go b/gno.land/pkg/gnoland/app.go index 0b0488fc98e..88f46655359 100644 --- a/gno.land/pkg/gnoland/app.go +++ b/gno.land/pkg/gnoland/app.go @@ -19,6 +19,10 @@ import ( "github.com/gnolang/gno/tm2/pkg/store" "github.com/gnolang/gno/tm2/pkg/store/dbadapter" "github.com/gnolang/gno/tm2/pkg/store/iavl" + + // Only goleveldb is supported for now. + _ "github.com/gnolang/gno/tm2/pkg/db/goleveldb" + "github.com/gnolang/gno/tm2/pkg/db/memdb" ) type AppOptions struct { @@ -34,7 +38,7 @@ type AppOptions struct { func NewAppOptions() *AppOptions { return &AppOptions{ Logger: log.NewNoopLogger(), - DB: dbm.NewMemDB(), + DB: memdb.NewMemDB(), GnoRootDir: gnoenv.RootDir(), } } diff --git a/gno.land/pkg/gnoland/node_inmemory.go b/gno.land/pkg/gnoland/node_inmemory.go index 2db8544a909..f97f71164d6 100644 --- a/gno.land/pkg/gnoland/node_inmemory.go +++ b/gno.land/pkg/gnoland/node_inmemory.go @@ -15,6 +15,7 @@ import ( "github.com/gnolang/gno/tm2/pkg/crypto" "github.com/gnolang/gno/tm2/pkg/crypto/ed25519" "github.com/gnolang/gno/tm2/pkg/db" + "github.com/gnolang/gno/tm2/pkg/db/memdb" "github.com/gnolang/gno/tm2/pkg/events" "github.com/gnolang/gno/tm2/pkg/p2p" "github.com/gnolang/gno/tm2/pkg/std" @@ -116,7 +117,7 @@ func NewInMemoryNode(logger *slog.Logger, cfg *InMemoryNodeConfig) (*node.Node, GnoRootDir: cfg.TMConfig.RootDir, SkipFailingGenesisTxs: cfg.SkipFailingGenesisTxs, MaxCycles: cfg.GenesisMaxVMCycles, - DB: db.NewMemDB(), + DB: memdb.NewMemDB(), }) if err != nil { return nil, fmt.Errorf("error initializing new app: %w", err) @@ -135,7 +136,7 @@ func NewInMemoryNode(logger *slog.Logger, cfg *InMemoryNodeConfig) (*node.Node, // Create genesis factory genProvider := func() (*bft.GenesisDoc, error) { return cfg.Genesis, nil } - dbProvider := func(*node.DBContext) (db.DB, error) { return db.NewMemDB(), nil } + dbProvider := func(*node.DBContext) (db.DB, error) { return memdb.NewMemDB(), nil } // generate p2p node identity // XXX: do we need to configur diff --git a/gnovm/tests/imports.go b/gnovm/tests/imports.go index 0db5651fbcc..a540aaa9677 100644 --- a/gnovm/tests/imports.go +++ b/gnovm/tests/imports.go @@ -41,7 +41,7 @@ import ( gno "github.com/gnolang/gno/gnovm/pkg/gnolang" "github.com/gnolang/gno/gnovm/stdlibs" teststdlibs "github.com/gnolang/gno/gnovm/tests/stdlibs" - dbm "github.com/gnolang/gno/tm2/pkg/db" + "github.com/gnolang/gno/tm2/pkg/db/memdb" osm "github.com/gnolang/gno/tm2/pkg/os" "github.com/gnolang/gno/tm2/pkg/store/dbadapter" "github.com/gnolang/gno/tm2/pkg/store/iavl" @@ -392,7 +392,7 @@ func TestStore(rootDir, filesPath string, stdin io.Reader, stdout, stderr io.Wri return nil, nil } // NOTE: store is also used in closure above. - db := dbm.NewMemDB() + db := memdb.NewMemDB() baseStore := dbadapter.StoreConstructor(db, stypes.StoreOptions{}) iavlStore := iavl.StoreConstructor(db, stypes.StoreOptions{}) store = gno.NewStore(nil, baseStore, iavlStore) diff --git a/tm2/pkg/bft/abci/example/kvstore/kvstore.go b/tm2/pkg/bft/abci/example/kvstore/kvstore.go index 8e2a930e698..f4ae68b9a3b 100644 --- a/tm2/pkg/bft/abci/example/kvstore/kvstore.go +++ b/tm2/pkg/bft/abci/example/kvstore/kvstore.go @@ -9,6 +9,7 @@ import ( abci "github.com/gnolang/gno/tm2/pkg/bft/abci/types" abciver "github.com/gnolang/gno/tm2/pkg/bft/abci/version" dbm "github.com/gnolang/gno/tm2/pkg/db" + "github.com/gnolang/gno/tm2/pkg/db/memdb" ) var ( @@ -60,7 +61,7 @@ type KVStoreApplication struct { } func NewKVStoreApplication() *KVStoreApplication { - state := loadState(dbm.NewMemDB()) + state := loadState(memdb.NewMemDB()) return &KVStoreApplication{state: state} } diff --git a/tm2/pkg/bft/abci/example/kvstore/persistent_kvstore.go b/tm2/pkg/bft/abci/example/kvstore/persistent_kvstore.go index 5042fcf9313..7258e73c2e4 100644 --- a/tm2/pkg/bft/abci/example/kvstore/persistent_kvstore.go +++ b/tm2/pkg/bft/abci/example/kvstore/persistent_kvstore.go @@ -13,6 +13,7 @@ import ( abci "github.com/gnolang/gno/tm2/pkg/bft/abci/types" "github.com/gnolang/gno/tm2/pkg/crypto" "github.com/gnolang/gno/tm2/pkg/db" + _ "github.com/gnolang/gno/tm2/pkg/db/goleveldb" "github.com/gnolang/gno/tm2/pkg/log" ) diff --git a/tm2/pkg/bft/consensus/wal_generator.go b/tm2/pkg/bft/consensus/wal_generator.go index 8a737452425..7958aaa35b0 100644 --- a/tm2/pkg/bft/consensus/wal_generator.go +++ b/tm2/pkg/bft/consensus/wal_generator.go @@ -20,7 +20,7 @@ import ( "github.com/gnolang/gno/tm2/pkg/bft/store" "github.com/gnolang/gno/tm2/pkg/bft/types" walm "github.com/gnolang/gno/tm2/pkg/bft/wal" - db "github.com/gnolang/gno/tm2/pkg/db" + "github.com/gnolang/gno/tm2/pkg/db/memdb" "github.com/gnolang/gno/tm2/pkg/errors" "github.com/gnolang/gno/tm2/pkg/events" "github.com/gnolang/gno/tm2/pkg/log" @@ -53,7 +53,7 @@ func WALGenerateNBlocks(t *testing.T, wr io.Writer, numBlocks int) (err error) { if err != nil { return errors.Wrap(err, "failed to read genesis file") } - blockStoreDB := db.NewMemDB() + blockStoreDB := memdb.NewMemDB() stateDB := blockStoreDB state, err := sm.MakeGenesisState(genDoc) if err != nil { diff --git a/tm2/pkg/bft/state/state_test.go b/tm2/pkg/bft/state/state_test.go index d19b8526d98..3b34093fa34 100644 --- a/tm2/pkg/bft/state/state_test.go +++ b/tm2/pkg/bft/state/state_test.go @@ -16,6 +16,7 @@ import ( "github.com/gnolang/gno/tm2/pkg/bft/types" "github.com/gnolang/gno/tm2/pkg/crypto/ed25519" dbm "github.com/gnolang/gno/tm2/pkg/db" + _ "github.com/gnolang/gno/tm2/pkg/db/_all" "github.com/gnolang/gno/tm2/pkg/random" ) diff --git a/tm2/pkg/bft/state/store_test.go b/tm2/pkg/bft/state/store_test.go index ed3b8e63311..cd11934fead 100644 --- a/tm2/pkg/bft/state/store_test.go +++ b/tm2/pkg/bft/state/store_test.go @@ -12,12 +12,13 @@ import ( sm "github.com/gnolang/gno/tm2/pkg/bft/state" "github.com/gnolang/gno/tm2/pkg/bft/types" dbm "github.com/gnolang/gno/tm2/pkg/db" + "github.com/gnolang/gno/tm2/pkg/db/memdb" ) func TestStoreLoadValidators(t *testing.T) { t.Parallel() - stateDB := dbm.NewMemDB() + stateDB := memdb.NewMemDB() val, _ := types.RandValidator(true, 10) vals := types.NewValidatorSet([]*types.Validator{val}) diff --git a/tm2/pkg/crypto/keys/keybase.go b/tm2/pkg/crypto/keys/keybase.go index 5b69f36a22d..2dc7d41be0b 100644 --- a/tm2/pkg/crypto/keys/keybase.go +++ b/tm2/pkg/crypto/keys/keybase.go @@ -13,6 +13,7 @@ import ( "github.com/gnolang/gno/tm2/pkg/crypto/ledger" "github.com/gnolang/gno/tm2/pkg/crypto/secp256k1" dbm "github.com/gnolang/gno/tm2/pkg/db" + "github.com/gnolang/gno/tm2/pkg/db/memdb" "github.com/gnolang/gno/tm2/pkg/errors" ) @@ -74,7 +75,7 @@ func NewDBKeybase(db dbm.DB) Keybase { // NewInMemory creates a transient keybase on top of in-memory storage // instance useful for testing purposes and on-the-fly key generation. -func NewInMemory() Keybase { return dbKeybase{dbm.NewMemDB()} } +func NewInMemory() Keybase { return dbKeybase{memdb.NewMemDB()} } // CreateAccount converts a mnemonic to a private key and persists it, encrypted with the given password. // XXX Info could include the separately derived ed25519 key, diff --git a/tm2/pkg/crypto/keys/lazy_keybase.go b/tm2/pkg/crypto/keys/lazy_keybase.go index 62e88d9a8e2..eb9c0f3b551 100644 --- a/tm2/pkg/crypto/keys/lazy_keybase.go +++ b/tm2/pkg/crypto/keys/lazy_keybase.go @@ -7,6 +7,8 @@ import ( "github.com/gnolang/gno/tm2/pkg/crypto/hd" "github.com/gnolang/gno/tm2/pkg/db" "github.com/gnolang/gno/tm2/pkg/os" + + _ "github.com/gnolang/gno/tm2/pkg/db/goleveldb" ) const dbBackend = db.GoLevelDBBackend diff --git a/tm2/pkg/db/_all/all.go b/tm2/pkg/db/_all/all.go new file mode 100644 index 00000000000..f654efd53c7 --- /dev/null +++ b/tm2/pkg/db/_all/all.go @@ -0,0 +1,13 @@ +// Package all imports all available databases. It is useful mostly in tests. +// +// cgo databases (rocksdb, cleveldb) will be excluded if CGO_ENABLED=0. +package all + +import ( + // Keep in sync with list of non-cgo backends. + // Add cgo backends in all_cgo.go. + _ "github.com/gnolang/gno/tm2/pkg/db/boltdb" + _ "github.com/gnolang/gno/tm2/pkg/db/fsdb" + _ "github.com/gnolang/gno/tm2/pkg/db/goleveldb" + _ "github.com/gnolang/gno/tm2/pkg/db/memdb" +) diff --git a/tm2/pkg/db/_all/all_cgo.go b/tm2/pkg/db/_all/all_cgo.go new file mode 100644 index 00000000000..293361de713 --- /dev/null +++ b/tm2/pkg/db/_all/all_cgo.go @@ -0,0 +1,10 @@ +//go:build cgo + +package all + +import ( + // Keep in sync with list of cgo backends. + // Add non-cgo backends in all.go. + _ "github.com/gnolang/gno/tm2/pkg/db/cleveldb" + _ "github.com/gnolang/gno/tm2/pkg/db/rocksdb" +) diff --git a/tm2/pkg/db/_tags/boltdb.go b/tm2/pkg/db/_tags/boltdb.go new file mode 100644 index 00000000000..c9a74ee700c --- /dev/null +++ b/tm2/pkg/db/_tags/boltdb.go @@ -0,0 +1,5 @@ +//go:build boltdb + +package tags + +import _ "github.com/gnolang/gno/tm2/pkg/db/boltdb" diff --git a/tm2/pkg/db/_tags/cleveldb.go b/tm2/pkg/db/_tags/cleveldb.go new file mode 100644 index 00000000000..cd4f4fc2521 --- /dev/null +++ b/tm2/pkg/db/_tags/cleveldb.go @@ -0,0 +1,5 @@ +//go:build cleveldb + +package tags + +import _ "github.com/gnolang/gno/tm2/pkg/db/cleveldb" diff --git a/tm2/pkg/db/_tags/fsdb.go b/tm2/pkg/db/_tags/fsdb.go new file mode 100644 index 00000000000..134a831010b --- /dev/null +++ b/tm2/pkg/db/_tags/fsdb.go @@ -0,0 +1,5 @@ +//go:build fsdb + +package tags + +import _ "github.com/gnolang/gno/tm2/pkg/db/fsdb" diff --git a/tm2/pkg/db/_tags/goleveldb.go b/tm2/pkg/db/_tags/goleveldb.go new file mode 100644 index 00000000000..1fe96ddfd85 --- /dev/null +++ b/tm2/pkg/db/_tags/goleveldb.go @@ -0,0 +1,5 @@ +//go:build goleveldb + +package tags + +import _ "github.com/gnolang/gno/tm2/pkg/db/goleveldb" diff --git a/tm2/pkg/db/_tags/memdb.go b/tm2/pkg/db/_tags/memdb.go new file mode 100644 index 00000000000..0d205a7f2b7 --- /dev/null +++ b/tm2/pkg/db/_tags/memdb.go @@ -0,0 +1,5 @@ +//go:build memdb + +package tags + +import _ "github.com/gnolang/gno/tm2/pkg/db/memdb" diff --git a/tm2/pkg/db/_tags/rocksdb.go b/tm2/pkg/db/_tags/rocksdb.go new file mode 100644 index 00000000000..f1e19ef31c9 --- /dev/null +++ b/tm2/pkg/db/_tags/rocksdb.go @@ -0,0 +1,5 @@ +//go:build rocksdb + +package tags + +import _ "github.com/gnolang/gno/tm2/pkg/db/rocksdb" diff --git a/tm2/pkg/db/_tags/tags.go b/tm2/pkg/db/_tags/tags.go new file mode 100644 index 00000000000..f03b50ca6a9 --- /dev/null +++ b/tm2/pkg/db/_tags/tags.go @@ -0,0 +1,5 @@ +// Package tags is a helper package to allow customized importing of databases +// through build tags. +// +// See the available databases on [github.com/gnolang/gno/tm2/pkg/db.BackendType]. +package tags diff --git a/tm2/pkg/db/backend_test.go b/tm2/pkg/db/backend_test.go index fd03629fd58..3f5609dc279 100644 --- a/tm2/pkg/db/backend_test.go +++ b/tm2/pkg/db/backend_test.go @@ -1,18 +1,21 @@ -package db +package db_test import ( "fmt" "testing" + "github.com/gnolang/gno/tm2/pkg/db" + _ "github.com/gnolang/gno/tm2/pkg/db/_all" + "github.com/gnolang/gno/tm2/pkg/db/internal" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) -func testBackendGetSetDelete(t *testing.T, backend BackendType) { +func testBackendGetSetDelete(t *testing.T, backend db.BackendType) { t.Helper() // Default - db, err := NewDB("testdb", backend, t.TempDir()) + db, err := db.NewDB("testdb", backend, t.TempDir()) require.NoError(t, err) // A nonexistent key should return nil, even if the key is empty @@ -43,7 +46,7 @@ func testBackendGetSetDelete(t *testing.T, backend BackendType) { func TestBackendsGetSetDelete(t *testing.T) { t.Parallel() - for dbType := range backends { + for _, dbType := range db.BackendList() { t.Run(string(dbType), func(t *testing.T) { t.Parallel() @@ -52,11 +55,11 @@ func TestBackendsGetSetDelete(t *testing.T) { } } -func withDB(t *testing.T, creator dbCreator, fn func(DB)) { +func withDB(t *testing.T, dbType db.BackendType, fn func(db.DB)) { t.Helper() - name := fmt.Sprintf("test_%x", randStr(12)) - db, err := creator(name, t.TempDir()) + name := fmt.Sprintf("test_%x", internal.RandStr(12)) + db, err := db.NewDB(name, dbType, t.TempDir()) require.Nil(t, err) fn(db) db.Close() @@ -66,8 +69,8 @@ func TestBackendsNilKeys(t *testing.T) { t.Parallel() // Test all backends. - for dbType, creator := range backends { - withDB(t, creator, func(db DB) { + for _, dbType := range db.BackendList() { + withDB(t, dbType, func(db db.DB) { t.Run(fmt.Sprintf("Testing %s", dbType), func(t *testing.T) { // Nil keys are treated as the empty key for most operations. expect := func(key, value []byte) { @@ -142,21 +145,10 @@ func TestBackendsNilKeys(t *testing.T) { } } -func TestGoLevelDBBackend(t *testing.T) { - t.Parallel() - - name := fmt.Sprintf("test_%x", randStr(12)) - db, err := NewDB(name, GoLevelDBBackend, t.TempDir()) - require.NoError(t, err) - - _, ok := db.(*GoLevelDB) - assert.True(t, ok) -} - func TestDBIterator(t *testing.T) { t.Parallel() - for dbType := range backends { + for _, dbType := range db.BackendList() { t.Run(fmt.Sprintf("%v", dbType), func(t *testing.T) { t.Parallel() @@ -165,11 +157,11 @@ func TestDBIterator(t *testing.T) { } } -func testDBIterator(t *testing.T, backend BackendType) { +func testDBIterator(t *testing.T, backend db.BackendType) { t.Helper() - name := fmt.Sprintf("test_%x", randStr(12)) - db, err := NewDB(name, backend, t.TempDir()) + name := fmt.Sprintf("test_%x", internal.RandStr(12)) + db, err := db.NewDB(name, backend, t.TempDir()) require.NoError(t, err) for i := 0; i < 10; i++ { @@ -221,7 +213,7 @@ func testDBIterator(t *testing.T, backend BackendType) { []int64(nil), "reverse iterator from 2 (ex) to 4") } -func verifyIterator(t *testing.T, itr Iterator, expected []int64, msg string) { +func verifyIterator(t *testing.T, itr db.Iterator, expected []int64, msg string) { t.Helper() var list []int64 @@ -231,3 +223,217 @@ func verifyIterator(t *testing.T, itr Iterator, expected []int64, msg string) { } assert.Equal(t, expected, list, msg) } + +func TestDBIteratorSingleKey(t *testing.T) { + t.Parallel() + + for _, backend := range db.BackendList() { + t.Run(fmt.Sprintf("Backend %s", backend), func(t *testing.T) { + t.Parallel() + + db := newTempDB(t, backend) + + db.SetSync(bz("1"), bz("value_1")) + itr := db.Iterator(nil, nil) + + checkValid(t, itr, true) + checkNext(t, itr, false) + checkValid(t, itr, false) + checkNextPanics(t, itr) + + // Once invalid... + checkInvalid(t, itr) + }) + } +} + +func TestDBIteratorTwoKeys(t *testing.T) { + t.Parallel() + + for _, backend := range db.BackendList() { + t.Run(fmt.Sprintf("Backend %s", backend), func(t *testing.T) { + t.Parallel() + + db := newTempDB(t, backend) + + db.SetSync(bz("1"), bz("value_1")) + db.SetSync(bz("2"), bz("value_1")) + + { // Fail by calling Next too much + itr := db.Iterator(nil, nil) + checkValid(t, itr, true) + + checkNext(t, itr, true) + checkValid(t, itr, true) + + checkNext(t, itr, false) + checkValid(t, itr, false) + + checkNextPanics(t, itr) + + // Once invalid... + checkInvalid(t, itr) + } + }) + } +} + +func TestDBIteratorMany(t *testing.T) { + t.Parallel() + + for _, backend := range db.BackendList() { + t.Run(fmt.Sprintf("Backend %s", backend), func(t *testing.T) { + t.Parallel() + + db := newTempDB(t, backend) + + keys := make([][]byte, 100) + for i := 0; i < 100; i++ { + keys[i] = []byte{byte(i)} + } + + value := []byte{5} + for _, k := range keys { + db.Set(k, value) + } + + itr := db.Iterator(nil, nil) + defer itr.Close() + for ; itr.Valid(); itr.Next() { + assert.Equal(t, db.Get(itr.Key()), itr.Value()) + } + }) + } +} + +func TestDBIteratorEmpty(t *testing.T) { + t.Parallel() + + for _, backend := range db.BackendList() { + t.Run(fmt.Sprintf("Backend %s", backend), func(t *testing.T) { + t.Parallel() + + db := newTempDB(t, backend) + + itr := db.Iterator(nil, nil) + + checkInvalid(t, itr) + }) + } +} + +func TestDBIteratorEmptyBeginAfter(t *testing.T) { + t.Parallel() + + for _, backend := range db.BackendList() { + t.Run(fmt.Sprintf("Backend %s", backend), func(t *testing.T) { + t.Parallel() + + db := newTempDB(t, backend) + + itr := db.Iterator(bz("1"), nil) + + checkInvalid(t, itr) + }) + } +} + +func TestDBIteratorNonemptyBeginAfter(t *testing.T) { + t.Parallel() + + for _, backend := range db.BackendList() { + t.Run(fmt.Sprintf("Backend %s", backend), func(t *testing.T) { + t.Parallel() + + db := newTempDB(t, backend) + + db.SetSync(bz("1"), bz("value_1")) + itr := db.Iterator(bz("2"), nil) + + checkInvalid(t, itr) + }) + } +} + +func TestDBBatchWrite(t *testing.T) { + t.Parallel() + + testCases := []struct { + modify func(batch db.Batch) + calls map[string]int + }{ + 0: { + func(batch db.Batch) { + batch.Set(bz("1"), bz("1")) + batch.Set(bz("2"), bz("2")) + batch.Delete(bz("3")) + batch.Set(bz("4"), bz("4")) + batch.Write() + }, + map[string]int{ + "Set": 0, "SetSync": 0, "SetNoLock": 3, "SetNoLockSync": 0, + "Delete": 0, "DeleteSync": 0, "DeleteNoLock": 1, "DeleteNoLockSync": 0, + }, + }, + 1: { + func(batch db.Batch) { + batch.Set(bz("1"), bz("1")) + batch.Set(bz("2"), bz("2")) + batch.Set(bz("4"), bz("4")) + batch.Delete(bz("3")) + batch.Write() + }, + map[string]int{ + "Set": 0, "SetSync": 0, "SetNoLock": 3, "SetNoLockSync": 0, + "Delete": 0, "DeleteSync": 0, "DeleteNoLock": 1, "DeleteNoLockSync": 0, + }, + }, + 2: { + func(batch db.Batch) { + batch.Set(bz("1"), bz("1")) + batch.Set(bz("2"), bz("2")) + batch.Delete(bz("3")) + batch.Set(bz("4"), bz("4")) + batch.WriteSync() + }, + map[string]int{ + "Set": 0, "SetSync": 0, "SetNoLock": 2, "SetNoLockSync": 1, + "Delete": 0, "DeleteSync": 0, "DeleteNoLock": 1, "DeleteNoLockSync": 0, + }, + }, + 3: { + func(batch db.Batch) { + batch.Set(bz("1"), bz("1")) + batch.Set(bz("2"), bz("2")) + batch.Set(bz("4"), bz("4")) + batch.Delete(bz("3")) + batch.WriteSync() + }, + map[string]int{ + "Set": 0, "SetSync": 0, "SetNoLock": 3, "SetNoLockSync": 0, + "Delete": 0, "DeleteSync": 0, "DeleteNoLock": 0, "DeleteNoLockSync": 1, + }, + }, + } + + for i, tc := range testCases { + mdb := newMockDB() + batch := mdb.NewBatch() + + tc.modify(batch) + + for call, exp := range tc.calls { + got := mdb.calls[call] + assert.Equal(t, exp, got, "#%v - key: %s", i, call) + } + } +} + +func newTempDB(t *testing.T, backend db.BackendType) db.DB { + t.Helper() + + tmpdb, err := db.NewDB("testdb", backend, t.TempDir()) + require.NoError(t, err) + + return tmpdb +} diff --git a/tm2/pkg/db/badger_db.go b/tm2/pkg/db/badger_db.go deleted file mode 100644 index 7264a855bc4..00000000000 --- a/tm2/pkg/db/badger_db.go +++ /dev/null @@ -1,298 +0,0 @@ -//go:build badgerdb - -package db - -import ( - "bytes" - "fmt" - "os" - "path/filepath" - - "github.com/dgraph-io/badger/v3" -) - -func init() { registerDBCreator(BadgerDBBackend, badgerDBCreator, true) } - -func badgerDBCreator(dbName, dir string) (DB, error) { - return NewBadgerDB(dbName, dir) -} - -// NewBadgerDB creates a Badger key-value store backed to the -// directory dir supplied. If dir does not exist, it will be created. -func NewBadgerDB(dbName, dir string) (*BadgerDB, error) { - // Since Badger doesn't support database names, we join both to obtain - // the final directory to use for the database. - path := filepath.Join(dir, dbName) - - if err := os.MkdirAll(path, 0o755); err != nil { - return nil, err - } - - opts := badger.DefaultOptions(path) - opts.IndexCacheSize = 256 << 20 // 100 mb or some other size based on the amount of data - opts.DetectConflicts = false - opts.NumGoroutines = 32 - opts.SyncWrites = false // note that we have Sync methods - opts.Logger = nil // badger is too chatty by default - return NewBadgerDBWithOptions(opts) -} - -// NewBadgerDBWithOptions creates a BadgerDB key value store -// gives the flexibility of initializing a database with the -// respective options. -func NewBadgerDBWithOptions(opts badger.Options) (*BadgerDB, error) { - db, err := badger.Open(opts) - if err != nil { - return nil, err - } - return &BadgerDB{db: db}, nil -} - -type BadgerDB struct { - db *badger.DB -} - -var _ DB = (*BadgerDB)(nil) - -func (b *BadgerDB) Get(key []byte) ([]byte, error) { - if len(key) == 0 { - return nil, errKeyEmpty - } - var val []byte - err := b.db.View(func(txn *badger.Txn) error { - item, err := txn.Get(key) - if err == badger.ErrKeyNotFound { - return nil - } else if err != nil { - return err - } - val, err = item.ValueCopy(nil) - if err == nil && val == nil { - val = []byte{} - } - return err - }) - return val, err -} - -func (b *BadgerDB) Has(key []byte) (bool, error) { - if len(key) == 0 { - return false, errKeyEmpty - } - var found bool - err := b.db.View(func(txn *badger.Txn) error { - _, err := txn.Get(key) - if err != nil && err != badger.ErrKeyNotFound { - return err - } - found = (err != badger.ErrKeyNotFound) - return nil - }) - return found, err -} - -func (b *BadgerDB) Set(key, value []byte) error { - if len(key) == 0 { - return errKeyEmpty - } - if value == nil { - return errValueNil - } - return b.db.Update(func(txn *badger.Txn) error { - return txn.Set(key, value) - }) -} - -func withSync(db *badger.DB, err error) error { - if err != nil { - return err - } - return db.Sync() -} - -func (b *BadgerDB) SetSync(key, value []byte) error { - return withSync(b.db, b.Set(key, value)) -} - -func (b *BadgerDB) Delete(key []byte) error { - if len(key) == 0 { - return errKeyEmpty - } - return b.db.Update(func(txn *badger.Txn) error { - return txn.Delete(key) - }) -} - -func (b *BadgerDB) DeleteSync(key []byte) error { - return withSync(b.db, b.Delete(key)) -} - -func (b *BadgerDB) Close() error { - return b.db.Close() -} - -func (b *BadgerDB) Print() error { - return nil -} - -func (b *BadgerDB) iteratorOpts(start, end []byte, opts badger.IteratorOptions) (*badgerDBIterator, error) { - if (start != nil && len(start) == 0) || (end != nil && len(end) == 0) { - return nil, errKeyEmpty - } - txn := b.db.NewTransaction(false) - iter := txn.NewIterator(opts) - iter.Rewind() - iter.Seek(start) - if opts.Reverse && iter.Valid() && bytes.Equal(iter.Item().Key(), start) { - // If we're going in reverse, our starting point was "end", - // which is exclusive. - iter.Next() - } - return &badgerDBIterator{ - reverse: opts.Reverse, - start: start, - end: end, - - txn: txn, - iter: iter, - }, nil -} - -func (b *BadgerDB) Iterator(start, end []byte) (Iterator, error) { - opts := badger.DefaultIteratorOptions - return b.iteratorOpts(start, end, opts) -} - -func (b *BadgerDB) ReverseIterator(start, end []byte) (Iterator, error) { - opts := badger.DefaultIteratorOptions - opts.Reverse = true - return b.iteratorOpts(end, start, opts) -} - -func (b *BadgerDB) Stats() map[string]string { - return nil -} - -func (b *BadgerDB) NewBatch() Batch { - wb := &badgerDBBatch{ - db: b.db, - wb: b.db.NewWriteBatch(), - firstFlush: make(chan struct{}, 1), - } - wb.firstFlush <- struct{}{} - return wb -} - -var _ Batch = (*badgerDBBatch)(nil) - -type badgerDBBatch struct { - db *badger.DB - wb *badger.WriteBatch - - // Calling db.Flush twice panics, so we must keep track of whether we've - // flushed already on our own. If Write can receive from the firstFlush - // channel, then it's the first and only Flush call we should do. - // - // Upstream bug report: - // https://github.com/dgraph-io/badger/issues/1394 - firstFlush chan struct{} -} - -func (b *badgerDBBatch) Set(key, value []byte) error { - if len(key) == 0 { - return errKeyEmpty - } - if value == nil { - return errValueNil - } - return b.wb.Set(key, value) -} - -func (b *badgerDBBatch) Delete(key []byte) error { - if len(key) == 0 { - return errKeyEmpty - } - return b.wb.Delete(key) -} - -func (b *badgerDBBatch) Write() error { - select { - case <-b.firstFlush: - return b.wb.Flush() - default: - return fmt.Errorf("batch already flushed") - } -} - -func (b *badgerDBBatch) WriteSync() error { - return withSync(b.db, b.Write()) -} - -func (b *badgerDBBatch) Close() error { - select { - case <-b.firstFlush: // a Flush after Cancel panics too - default: - } - b.wb.Cancel() - return nil -} - -type badgerDBIterator struct { - reverse bool - start, end []byte - - txn *badger.Txn - iter *badger.Iterator - - lastErr error -} - -func (i *badgerDBIterator) Close() error { - i.iter.Close() - i.txn.Discard() - return nil -} - -func (i *badgerDBIterator) Domain() (start, end []byte) { return i.start, i.end } -func (i *badgerDBIterator) Error() error { return i.lastErr } - -func (i *badgerDBIterator) Next() { - if !i.Valid() { - panic("iterator is invalid") - } - i.iter.Next() -} - -func (i *badgerDBIterator) Valid() bool { - if !i.iter.Valid() { - return false - } - if len(i.end) > 0 { - key := i.iter.Item().Key() - if c := bytes.Compare(key, i.end); (!i.reverse && c >= 0) || (i.reverse && c < 0) { - // We're at the end key, or past the end. - return false - } - } - return true -} - -func (i *badgerDBIterator) Key() []byte { - if !i.Valid() { - panic("iterator is invalid") - } - // Note that we don't use KeyCopy, so this is only valid until the next - // call to Next. - return i.iter.Item().KeyCopy(nil) -} - -func (i *badgerDBIterator) Value() []byte { - if !i.Valid() { - panic("iterator is invalid") - } - val, err := i.iter.Item().ValueCopy(nil) - if err != nil { - i.lastErr = err - } - return val -} diff --git a/tm2/pkg/db/boltdb.go b/tm2/pkg/db/boltdb/boltdb.go similarity index 87% rename from tm2/pkg/db/boltdb.go rename to tm2/pkg/db/boltdb/boltdb.go index f42ddda6574..415f0d1e82c 100644 --- a/tm2/pkg/db/boltdb.go +++ b/tm2/pkg/db/boltdb/boltdb.go @@ -1,6 +1,4 @@ -//go:build boltdb - -package db +package boltdb import ( "bytes" @@ -9,13 +7,15 @@ import ( "os" "path/filepath" + "github.com/gnolang/gno/tm2/pkg/db" + "github.com/gnolang/gno/tm2/pkg/db/internal" "go.etcd.io/bbolt" ) var bucket = []byte("tm") func init() { - registerDBCreator(BoltDBBackend, func(name, dir string) (DB, error) { + db.InternalRegisterDBCreator(db.BoltDBBackend, func(name, dir string) (db.DB, error) { return NewBoltDB(name, dir) }, false) } @@ -33,13 +33,13 @@ type BoltDB struct { } // NewBoltDB returns a BoltDB with default options. -func NewBoltDB(name, dir string) (DB, error) { +func NewBoltDB(name, dir string) (db.DB, error) { return NewBoltDBWithOpts(name, dir, bbolt.DefaultOptions) } // NewBoltDBWithOpts allows you to supply *bbolt.Options. ReadOnly: true is not // supported because NewBoltDBWithOpts creates a global bucket. -func NewBoltDBWithOpts(name string, dir string, opts *bbolt.Options) (DB, error) { +func NewBoltDBWithOpts(name string, dir string, opts *bbolt.Options) (db.DB, error) { if opts.ReadOnly { return nil, errors.New("ReadOnly: true is not supported") } @@ -63,7 +63,7 @@ func NewBoltDBWithOpts(name string, dir string, opts *bbolt.Options) (DB, error) } func (bdb *BoltDB) Get(key []byte) (value []byte) { - key = nonEmptyKey(nonNilBytes(key)) + key = nonEmptyKey(internal.NonNilBytes(key)) err := bdb.db.View(func(tx *bbolt.Tx) error { b := tx.Bucket(bucket) if v := b.Get(key); v != nil { @@ -82,8 +82,8 @@ func (bdb *BoltDB) Has(key []byte) bool { } func (bdb *BoltDB) Set(key, value []byte) { - key = nonEmptyKey(nonNilBytes(key)) - value = nonNilBytes(value) + key = nonEmptyKey(internal.NonNilBytes(key)) + value = internal.NonNilBytes(value) err := bdb.db.Update(func(tx *bbolt.Tx) error { b := tx.Bucket(bucket) return b.Put(key, value) @@ -98,7 +98,7 @@ func (bdb *BoltDB) SetSync(key, value []byte) { } func (bdb *BoltDB) Delete(key []byte) { - key = nonEmptyKey(nonNilBytes(key)) + key = nonEmptyKey(internal.NonNilBytes(key)) err := bdb.db.Update(func(tx *bbolt.Tx) error { return tx.Bucket(bucket).Delete(key) }) @@ -152,11 +152,11 @@ func (bdb *BoltDB) Stats() map[string]string { // DB upon Write call. type boltDBBatch struct { db *BoltDB - ops []operation + ops []internal.Operation } // NewBatch returns a new batch. -func (bdb *BoltDB) NewBatch() Batch { +func (bdb *BoltDB) NewBatch() db.Batch { return &boltDBBatch{ ops: nil, db: bdb, @@ -166,13 +166,13 @@ func (bdb *BoltDB) NewBatch() Batch { // It is safe to modify the contents of the argument after Set returns but not // before. func (bdb *boltDBBatch) Set(key, value []byte) { - bdb.ops = append(bdb.ops, operation{opTypeSet, key, value}) + bdb.ops = append(bdb.ops, internal.Operation{internal.OpTypeSet, key, value}) } // It is safe to modify the contents of the argument after Delete returns but // not before. func (bdb *boltDBBatch) Delete(key []byte) { - bdb.ops = append(bdb.ops, operation{opTypeDelete, key, nil}) + bdb.ops = append(bdb.ops, internal.Operation{internal.OpTypeDelete, key, nil}) } // NOTE: the operation is synchronous (see BoltDB for reasons) @@ -180,13 +180,13 @@ func (bdb *boltDBBatch) Write() { err := bdb.db.db.Batch(func(tx *bbolt.Tx) error { b := tx.Bucket(bucket) for _, op := range bdb.ops { - key := nonEmptyKey(nonNilBytes(op.key)) - switch op.opType { - case opTypeSet: - if putErr := b.Put(key, op.value); putErr != nil { + key := nonEmptyKey(internal.NonNilBytes(op.Key)) + switch op.OpType { + case internal.OpTypeSet: + if putErr := b.Put(key, op.Value); putErr != nil { return putErr } - case opTypeDelete: + case internal.OpTypeDelete: if delErr := b.Delete(key); delErr != nil { return delErr } @@ -207,7 +207,7 @@ func (bdb *boltDBBatch) Close() {} // WARNING: Any concurrent writes or reads will block until the iterator is // closed. -func (bdb *BoltDB) Iterator(start, end []byte) Iterator { +func (bdb *BoltDB) Iterator(start, end []byte) db.Iterator { tx, err := bdb.db.Begin(false) if err != nil { panic(err) @@ -217,7 +217,7 @@ func (bdb *BoltDB) Iterator(start, end []byte) Iterator { // WARNING: Any concurrent writes or reads will block until the iterator is // closed. -func (bdb *BoltDB) ReverseIterator(start, end []byte) Iterator { +func (bdb *BoltDB) ReverseIterator(start, end []byte) db.Iterator { tx, err := bdb.db.Begin(false) if err != nil { panic(err) diff --git a/tm2/pkg/db/boltdb_test.go b/tm2/pkg/db/boltdb/boltdb_test.go similarity index 66% rename from tm2/pkg/db/boltdb_test.go rename to tm2/pkg/db/boltdb/boltdb_test.go index 57091fb53a2..955b8ce27d2 100644 --- a/tm2/pkg/db/boltdb_test.go +++ b/tm2/pkg/db/boltdb/boltdb_test.go @@ -1,18 +1,17 @@ -//go:build boltdb - -package db +package boltdb import ( "fmt" "testing" + "github.com/gnolang/gno/tm2/pkg/db/internal" "github.com/stretchr/testify/require" ) func TestBoltDBNewBoltDB(t *testing.T) { t.Parallel() - name := fmt.Sprintf("test_%x", randStr(12)) + name := fmt.Sprintf("test_%x", internal.RandStr(12)) db, err := NewBoltDB(name, t.TempDir()) require.NoError(t, err) @@ -24,12 +23,12 @@ func BenchmarkBoltDBRandomReadsWrites(b *testing.B) { b.Skip("skipping testing in short mode") } - name := fmt.Sprintf("test_%x", randStr(12)) + name := fmt.Sprintf("test_%x", internal.RandStr(12)) db, err := NewBoltDB(name, b.TempDir()) if err != nil { b.Fatal(err) } defer db.Close() - benchmarkRandomReadsWrites(b, db) + internal.BenchmarkRandomReadsWrites(b, db) } diff --git a/tm2/pkg/db/c_level_db.go b/tm2/pkg/db/cleveldb/c_level_db.go similarity index 88% rename from tm2/pkg/db/c_level_db.go rename to tm2/pkg/db/cleveldb/c_level_db.go index 003c8c66b20..51d567b2628 100644 --- a/tm2/pkg/db/c_level_db.go +++ b/tm2/pkg/db/cleveldb/c_level_db.go @@ -1,23 +1,25 @@ -//go:build cleveldb +//go:build cgo -package db +package cleveldb import ( "bytes" "fmt" "path/filepath" + "github.com/gnolang/gno/tm2/pkg/db" + "github.com/gnolang/gno/tm2/pkg/db/internal" "github.com/jmhodges/levigo" ) func init() { - dbCreator := func(name string, dir string) (DB, error) { + dbCreator := func(name string, dir string) (db.DB, error) { return NewCLevelDB(name, dir) } - registerDBCreator(CLevelDBBackend, dbCreator, false) + db.InternalRegisterDBCreator(db.CLevelDBBackend, dbCreator, false) } -var _ DB = (*CLevelDB)(nil) +var _ db.DB = (*CLevelDB)(nil) type CLevelDB struct { db *levigo.DB @@ -51,7 +53,7 @@ func NewCLevelDB(name string, dir string) (*CLevelDB, error) { // Implements DB. func (db *CLevelDB) Get(key []byte) []byte { - key = nonNilBytes(key) + key = internal.NonNilBytes(key) res, err := db.db.Get(db.ro, key) if err != nil { panic(err) @@ -66,8 +68,8 @@ func (db *CLevelDB) Has(key []byte) bool { // Implements DB. func (db *CLevelDB) Set(key []byte, value []byte) { - key = nonNilBytes(key) - value = nonNilBytes(value) + key = internal.NonNilBytes(key) + value = internal.NonNilBytes(value) err := db.db.Put(db.wo, key, value) if err != nil { panic(err) @@ -76,8 +78,8 @@ func (db *CLevelDB) Set(key []byte, value []byte) { // Implements DB. func (db *CLevelDB) SetSync(key []byte, value []byte) { - key = nonNilBytes(key) - value = nonNilBytes(value) + key = internal.NonNilBytes(key) + value = internal.NonNilBytes(value) err := db.db.Put(db.woSync, key, value) if err != nil { panic(err) @@ -86,7 +88,7 @@ func (db *CLevelDB) SetSync(key []byte, value []byte) { // Implements DB. func (db *CLevelDB) Delete(key []byte) { - key = nonNilBytes(key) + key = internal.NonNilBytes(key) err := db.db.Delete(db.wo, key) if err != nil { panic(err) @@ -95,7 +97,7 @@ func (db *CLevelDB) Delete(key []byte) { // Implements DB. func (db *CLevelDB) DeleteSync(key []byte) { - key = nonNilBytes(key) + key = internal.NonNilBytes(key) err := db.db.Delete(db.woSync, key) if err != nil { panic(err) @@ -150,7 +152,7 @@ func (db *CLevelDB) Stats() map[string]string { // Batch // Implements DB. -func (db *CLevelDB) NewBatch() Batch { +func (db *CLevelDB) NewBatch() db.Batch { batch := levigo.NewWriteBatch() return &cLevelDBBatch{db, batch} } @@ -196,17 +198,17 @@ func (mBatch *cLevelDBBatch) Close() { // NOTE This is almost identical to db/go_level_db.Iterator // Before creating a third version, refactor. -func (db *CLevelDB) Iterator(start, end []byte) Iterator { +func (db *CLevelDB) Iterator(start, end []byte) db.Iterator { itr := db.db.NewIterator(db.ro) return newCLevelDBIterator(itr, start, end, false) } -func (db *CLevelDB) ReverseIterator(start, end []byte) Iterator { +func (db *CLevelDB) ReverseIterator(start, end []byte) db.Iterator { itr := db.db.NewIterator(db.ro) return newCLevelDBIterator(itr, start, end, true) } -var _ Iterator = (*cLevelDBIterator)(nil) +var _ db.Iterator = (*cLevelDBIterator)(nil) type cLevelDBIterator struct { source *levigo.Iterator diff --git a/tm2/pkg/db/c_level_db_test.go b/tm2/pkg/db/cleveldb/c_level_db_test.go similarity index 77% rename from tm2/pkg/db/c_level_db_test.go rename to tm2/pkg/db/cleveldb/c_level_db_test.go index 7044ea0f4de..d72e5397325 100644 --- a/tm2/pkg/db/c_level_db_test.go +++ b/tm2/pkg/db/cleveldb/c_level_db_test.go @@ -1,13 +1,16 @@ -//go:build cleveldb +//go:build cgo -package db +package cleveldb import ( "bytes" + "encoding/binary" "fmt" "math/rand" "testing" + "github.com/gnolang/gno/tm2/pkg/db" + "github.com/gnolang/gno/tm2/pkg/db/internal" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -16,11 +19,11 @@ func BenchmarkRandomReadsWrites2(b *testing.B) { b.StopTimer() numItems := int64(1000000) - internal := map[int64]int64{} + mrand := map[int64]int64{} for i := 0; i < int(numItems); i++ { - internal[int64(i)] = int64(0) + mrand[int64(i)] = int64(0) } - db, err := NewCLevelDB(fmt.Sprintf("test_%x", randStr(12)), "") + db, err := NewCLevelDB(fmt.Sprintf("test_%x", internal.RandStr(12)), "") if err != nil { b.Fatal(err.Error()) return @@ -33,8 +36,8 @@ func BenchmarkRandomReadsWrites2(b *testing.B) { // Write something { idx := (int64(rand.Int()) % numItems) - internal[idx]++ - val := internal[idx] + mrand[idx]++ + val := mrand[idx] idxBytes := int642Bytes(int64(idx)) valBytes := int642Bytes(int64(val)) // fmt.Printf("Set %X -> %X\n", idxBytes, valBytes) @@ -46,7 +49,7 @@ func BenchmarkRandomReadsWrites2(b *testing.B) { // Read something { idx := (int64(rand.Int()) % numItems) - val := internal[idx] + val := mrand[idx] idxBytes := int642Bytes(int64(idx)) valBytes := db.Get(idxBytes) // fmt.Printf("Get %X -> %X\n", idxBytes, valBytes) @@ -75,7 +78,6 @@ func BenchmarkRandomReadsWrites2(b *testing.B) { db.Close() } -/* func int642Bytes(i int64) []byte { buf := make([]byte, 8) binary.BigEndian.PutUint64(buf, uint64(i)) @@ -85,15 +87,14 @@ func int642Bytes(i int64) []byte { func bytes2Int64(buf []byte) int64 { return int64(binary.BigEndian.Uint64(buf)) } -*/ func TestCLevelDBBackend(t *testing.T) { t.Parallel() - name := fmt.Sprintf("test_%x", randStr(12)) + name := fmt.Sprintf("test_%x", internal.RandStr(12)) // Can't use "" (current directory) or "./" here because levigo.Open returns: // "Error initializing DB: IO error: test_XXX.db: Invalid argument" - db, err := NewDB(name, CLevelDBBackend, t.TempDir()) + db, err := db.NewDB(name, db.CLevelDBBackend, t.TempDir()) require.NoError(t, err) _, ok := db.(*CLevelDB) @@ -103,8 +104,8 @@ func TestCLevelDBBackend(t *testing.T) { func TestCLevelDBStats(t *testing.T) { t.Parallel() - name := fmt.Sprintf("test_%x", randStr(12)) - db, err := NewDB(name, CLevelDBBackend, t.TempDir()) + name := fmt.Sprintf("test_%x", internal.RandStr(12)) + db, err := db.NewDB(name, db.CLevelDBBackend, t.TempDir()) require.NoError(t, err) assert.NotEmpty(t, db.Stats()) diff --git a/tm2/pkg/db/cleveldb/no_cgo_test.go b/tm2/pkg/db/cleveldb/no_cgo_test.go new file mode 100644 index 00000000000..71c1b83bf18 --- /dev/null +++ b/tm2/pkg/db/cleveldb/no_cgo_test.go @@ -0,0 +1,9 @@ +//go:build !cgo + +package rocksdb + +import "testing" + +func TestSkip(t *testing.T) { + t.Skip("This package requires cgo to compile and test") +} diff --git a/tm2/pkg/db/common_test.go b/tm2/pkg/db/common_test.go index ae318231294..ddd8e843005 100644 --- a/tm2/pkg/db/common_test.go +++ b/tm2/pkg/db/common_test.go @@ -1,35 +1,35 @@ -package db +package db_test import ( - "bytes" "encoding/binary" "fmt" - "math/rand" "sync" "testing" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" + "github.com/gnolang/gno/tm2/pkg/db" + "github.com/gnolang/gno/tm2/pkg/db/internal" + "github.com/jaekwon/testify/assert" + "github.com/jaekwon/testify/require" ) // ---------------------------------------- -// Helper functions. +// Test Helper functions. -func checkValue(t *testing.T, db DB, key []byte, valueWanted []byte) { +func checkValue(t *testing.T, db db.DB, key []byte, valueWanted []byte) { t.Helper() valueGot := db.Get(key) assert.Equal(t, valueWanted, valueGot) } -func checkValid(t *testing.T, itr Iterator, expected bool) { +func checkValid(t *testing.T, itr db.Iterator, expected bool) { t.Helper() valid := itr.Valid() require.Equal(t, expected, valid) } -func checkNext(t *testing.T, itr Iterator, expected bool) { +func checkNext(t *testing.T, itr db.Iterator, expected bool) { t.Helper() itr.Next() @@ -37,13 +37,13 @@ func checkNext(t *testing.T, itr Iterator, expected bool) { require.Equal(t, expected, valid) } -func checkNextPanics(t *testing.T, itr Iterator) { +func checkNextPanics(t *testing.T, itr db.Iterator) { t.Helper() assert.Panics(t, func() { itr.Next() }, "checkNextPanics expected panic but didn't") } -func checkDomain(t *testing.T, itr Iterator, start, end []byte) { +func checkDomain(t *testing.T, itr db.Iterator, start, end []byte) { t.Helper() ds, de := itr.Domain() @@ -51,7 +51,7 @@ func checkDomain(t *testing.T, itr Iterator, start, end []byte) { assert.Equal(t, end, de, "checkDomain domain end incorrect") } -func checkItem(t *testing.T, itr Iterator, key []byte, value []byte) { +func checkItem(t *testing.T, itr db.Iterator, key []byte, value []byte) { t.Helper() k, v := itr.Key(), itr.Value() @@ -59,7 +59,7 @@ func checkItem(t *testing.T, itr Iterator, key []byte, value []byte) { assert.Exactly(t, value, v) } -func checkInvalid(t *testing.T, itr Iterator) { +func checkInvalid(t *testing.T, itr db.Iterator) { t.Helper() checkValid(t, itr, false) @@ -68,27 +68,18 @@ func checkInvalid(t *testing.T, itr Iterator) { checkNextPanics(t, itr) } -func checkKeyPanics(t *testing.T, itr Iterator) { +func checkKeyPanics(t *testing.T, itr db.Iterator) { t.Helper() assert.Panics(t, func() { itr.Key() }, "checkKeyPanics expected panic but didn't") } -func checkValuePanics(t *testing.T, itr Iterator) { +func checkValuePanics(t *testing.T, itr db.Iterator) { t.Helper() assert.Panics(t, func() { itr.Value() }, "checkValuePanics expected panic but didn't") } -func newTempDB(t *testing.T, backend BackendType) (db DB) { - t.Helper() - - db, err := NewDB("testdb", backend, t.TempDir()) - require.NoError(t, err) - - return db -} - // ---------------------------------------- // mockDB @@ -151,23 +142,23 @@ func (mdb *mockDB) DeleteNoLockSync([]byte) { mdb.calls["DeleteNoLockSync"]++ } -func (mdb *mockDB) Iterator(start, end []byte) Iterator { +func (mdb *mockDB) Iterator(start, end []byte) db.Iterator { mdb.calls["Iterator"]++ - return &mockIterator{} + return &internal.MockIterator{} } -func (mdb *mockDB) ReverseIterator(start, end []byte) Iterator { +func (mdb *mockDB) ReverseIterator(start, end []byte) db.Iterator { mdb.calls["ReverseIterator"]++ - return &mockIterator{} + return &internal.MockIterator{} } func (mdb *mockDB) Close() { mdb.calls["Close"]++ } -func (mdb *mockDB) NewBatch() Batch { +func (mdb *mockDB) NewBatch() db.Batch { mdb.calls["NewBatch"]++ - return &memBatch{db: mdb} + return &internal.MemBatch{DB: mdb} } func (mdb *mockDB) Print() { @@ -185,87 +176,6 @@ func (mdb *mockDB) Stats() map[string]string { return res } -// ---------------------------------------- -// mockIterator - -type mockIterator struct{} - -func (mockIterator) Domain() (start []byte, end []byte) { - return nil, nil -} - -func (mockIterator) Valid() bool { - return false -} - -func (mockIterator) Next() { -} - -func (mockIterator) Key() []byte { - return nil -} - -func (mockIterator) Value() []byte { - return nil -} - -func (mockIterator) Close() { -} - -func benchmarkRandomReadsWrites(b *testing.B, db DB) { - b.Helper() - - b.StopTimer() - - // create dummy data - const numItems = int64(1000000) - internal := map[int64]int64{} - for i := 0; i < int(numItems); i++ { - internal[int64(i)] = int64(0) - } - - // fmt.Println("ok, starting") - b.StartTimer() - - for i := 0; i < b.N; i++ { - // Write something - { - idx := int64(rand.Int()) % numItems - internal[idx]++ - val := internal[idx] - idxBytes := int642Bytes(idx) - valBytes := int642Bytes(val) - // fmt.Printf("Set %X -> %X\n", idxBytes, valBytes) - db.Set(idxBytes, valBytes) - } - - // Read something - { - idx := int64(rand.Int()) % numItems - valExp := internal[idx] - idxBytes := int642Bytes(idx) - valBytes := db.Get(idxBytes) - // fmt.Printf("Get %X -> %X\n", idxBytes, valBytes) - if valExp == 0 { - if !bytes.Equal(valBytes, nil) { - b.Errorf("Expected %v for %v, got %X", nil, idx, valBytes) - break - } - } else { - if len(valBytes) != 8 { - b.Errorf("Expected length 8 for %v, got %X", idx, valBytes) - break - } - valGot := bytes2Int64(valBytes) - if valExp != valGot { - b.Errorf("Expected %v for %v, got %v", valExp, idx, valGot) - break - } - } - } - } -} - func int642Bytes(i int64) []byte { buf := make([]byte, 8) binary.BigEndian.PutUint64(buf, uint64(i)) @@ -275,3 +185,8 @@ func int642Bytes(i int64) []byte { func bytes2Int64(buf []byte) int64 { return int64(binary.BigEndian.Uint64(buf)) } + +// For testing convenience. +func bz(s string) []byte { + return []byte(s) +} diff --git a/tm2/pkg/db/db.go b/tm2/pkg/db/db.go index 6ffa7bf2eb1..2c55eaf0aa6 100644 --- a/tm2/pkg/db/db.go +++ b/tm2/pkg/db/db.go @@ -2,12 +2,34 @@ package db import ( "fmt" - "strings" + "slices" + + "golang.org/x/exp/maps" ) type BackendType string // These are valid backend types. +// +// The backends themselves must be imported to be used (ie. using the blank +// import, `import _ "github.com/gnolang/gno/tm2/pkg/db/goleveldb"`). To allow +// for end-user customization at build time, the package +// "github.com/gnolang/gno/tm2/pkg/db/_tags" can be imported -- this package +// will import each database depending on whether its build tag is provided. +// +// This can be used in conjunction with specific to provide defaults, for instance: +// +// package main +// +// import ( +// "github.com/gnolang/gno/tm2/pkg/db" +// _ "github.com/gnolang/gno/tm2/pkg/db/_tags" // allow user to customize with build tags +// _ "github.com/gnolang/gno/tm2/pkg/db/memdb" // always support memdb +// ) +// +// func main() { +// db.NewDB("mydb", db.BackendType(userProvidedBackend), "./data") +// } const ( // GoLevelDBBackend represents goleveldb (github.com/gnolang/goleveldb - most // popular implementation) @@ -16,7 +38,6 @@ const ( // CLevelDBBackend represents cleveldb (uses levigo wrapper) // - fast // - requires gcc - // - use cleveldb build tag (go build -tags cleveldb) CLevelDBBackend BackendType = "cleveldb" // MemDBBackend represents in-memory key value store, which is mostly used // for testing. @@ -29,12 +50,10 @@ const ( // go.etcd.io/bbolt) // - EXPERIMENTAL // - may be faster is some use-cases (random reads - indexer) - // - use boltdb build tag (go build -tags boltdb) BoltDBBackend BackendType = "boltdb" - // RocksDBBackend represents rocksdb (uses github.com/tecbot/gorocksdb) + // RocksDBBackend represents rocksdb (uses github.com/linuxGnu/grocksdb) // - EXPERIMENTAL // - requires gcc - // - use rocksdb build tag (go build -tags rocksdb) RocksDBBackend BackendType = "rocksdb" ) @@ -42,7 +61,11 @@ type dbCreator func(name string, dir string) (DB, error) var backends = map[BackendType]dbCreator{} -func registerDBCreator(backend BackendType, creator dbCreator, force bool) { +// InternalRegisterDBCreator is used by the init functions of imported databases +// to register their own dbCreators. +// +// This function is not meant for usage outside of db/. +func InternalRegisterDBCreator(backend BackendType, creator dbCreator, force bool) { _, ok := backends[backend] if !force && ok { return @@ -50,6 +73,13 @@ func registerDBCreator(backend BackendType, creator dbCreator, force bool) { backends[backend] = creator } +// BackendList returns a list of available db backends. The list is sorted. +func BackendList() []BackendType { + keys := maps.Keys(backends) + slices.Sort(keys) + return keys +} + // NewDB creates a new database of type backend with the given name. // NOTE: function panics if: // - backend is unknown (not registered) @@ -57,11 +87,8 @@ func registerDBCreator(backend BackendType, creator dbCreator, force bool) { func NewDB(name string, backend BackendType, dir string) (DB, error) { dbCreator, ok := backends[backend] if !ok { - var keys []string - for k := range backends { - keys = append(keys, string(k)) - } - return nil, fmt.Errorf("unknown db_backend %s. Expected either %s", backend, strings.Join(keys, " or ")) + keys := BackendList() + return nil, fmt.Errorf("unknown db_backend %s. Expected one of %v", backend, keys) } db, err := dbCreator(name, dir) diff --git a/tm2/pkg/db/db_test.go b/tm2/pkg/db/db_test.go deleted file mode 100644 index 62231645613..00000000000 --- a/tm2/pkg/db/db_test.go +++ /dev/null @@ -1,213 +0,0 @@ -package db - -import ( - "fmt" - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestDBIteratorSingleKey(t *testing.T) { - t.Parallel() - - for backend := range backends { - t.Run(fmt.Sprintf("Backend %s", backend), func(t *testing.T) { - t.Parallel() - - db := newTempDB(t, backend) - - db.SetSync(bz("1"), bz("value_1")) - itr := db.Iterator(nil, nil) - - checkValid(t, itr, true) - checkNext(t, itr, false) - checkValid(t, itr, false) - checkNextPanics(t, itr) - - // Once invalid... - checkInvalid(t, itr) - }) - } -} - -func TestDBIteratorTwoKeys(t *testing.T) { - t.Parallel() - - for backend := range backends { - t.Run(fmt.Sprintf("Backend %s", backend), func(t *testing.T) { - t.Parallel() - - db := newTempDB(t, backend) - - db.SetSync(bz("1"), bz("value_1")) - db.SetSync(bz("2"), bz("value_1")) - - { // Fail by calling Next too much - itr := db.Iterator(nil, nil) - checkValid(t, itr, true) - - checkNext(t, itr, true) - checkValid(t, itr, true) - - checkNext(t, itr, false) - checkValid(t, itr, false) - - checkNextPanics(t, itr) - - // Once invalid... - checkInvalid(t, itr) - } - }) - } -} - -func TestDBIteratorMany(t *testing.T) { - t.Parallel() - - for backend := range backends { - t.Run(fmt.Sprintf("Backend %s", backend), func(t *testing.T) { - t.Parallel() - - db := newTempDB(t, backend) - - keys := make([][]byte, 100) - for i := 0; i < 100; i++ { - keys[i] = []byte{byte(i)} - } - - value := []byte{5} - for _, k := range keys { - db.Set(k, value) - } - - itr := db.Iterator(nil, nil) - defer itr.Close() - for ; itr.Valid(); itr.Next() { - assert.Equal(t, db.Get(itr.Key()), itr.Value()) - } - }) - } -} - -func TestDBIteratorEmpty(t *testing.T) { - t.Parallel() - - for backend := range backends { - t.Run(fmt.Sprintf("Backend %s", backend), func(t *testing.T) { - t.Parallel() - - db := newTempDB(t, backend) - - itr := db.Iterator(nil, nil) - - checkInvalid(t, itr) - }) - } -} - -func TestDBIteratorEmptyBeginAfter(t *testing.T) { - t.Parallel() - - for backend := range backends { - t.Run(fmt.Sprintf("Backend %s", backend), func(t *testing.T) { - t.Parallel() - - db := newTempDB(t, backend) - - itr := db.Iterator(bz("1"), nil) - - checkInvalid(t, itr) - }) - } -} - -func TestDBIteratorNonemptyBeginAfter(t *testing.T) { - t.Parallel() - - for backend := range backends { - t.Run(fmt.Sprintf("Backend %s", backend), func(t *testing.T) { - t.Parallel() - - db := newTempDB(t, backend) - - db.SetSync(bz("1"), bz("value_1")) - itr := db.Iterator(bz("2"), nil) - - checkInvalid(t, itr) - }) - } -} - -func TestDBBatchWrite(t *testing.T) { - t.Parallel() - - testCases := []struct { - modify func(batch Batch) - calls map[string]int - }{ - 0: { - func(batch Batch) { - batch.Set(bz("1"), bz("1")) - batch.Set(bz("2"), bz("2")) - batch.Delete(bz("3")) - batch.Set(bz("4"), bz("4")) - batch.Write() - }, - map[string]int{ - "Set": 0, "SetSync": 0, "SetNoLock": 3, "SetNoLockSync": 0, - "Delete": 0, "DeleteSync": 0, "DeleteNoLock": 1, "DeleteNoLockSync": 0, - }, - }, - 1: { - func(batch Batch) { - batch.Set(bz("1"), bz("1")) - batch.Set(bz("2"), bz("2")) - batch.Set(bz("4"), bz("4")) - batch.Delete(bz("3")) - batch.Write() - }, - map[string]int{ - "Set": 0, "SetSync": 0, "SetNoLock": 3, "SetNoLockSync": 0, - "Delete": 0, "DeleteSync": 0, "DeleteNoLock": 1, "DeleteNoLockSync": 0, - }, - }, - 2: { - func(batch Batch) { - batch.Set(bz("1"), bz("1")) - batch.Set(bz("2"), bz("2")) - batch.Delete(bz("3")) - batch.Set(bz("4"), bz("4")) - batch.WriteSync() - }, - map[string]int{ - "Set": 0, "SetSync": 0, "SetNoLock": 2, "SetNoLockSync": 1, - "Delete": 0, "DeleteSync": 0, "DeleteNoLock": 1, "DeleteNoLockSync": 0, - }, - }, - 3: { - func(batch Batch) { - batch.Set(bz("1"), bz("1")) - batch.Set(bz("2"), bz("2")) - batch.Set(bz("4"), bz("4")) - batch.Delete(bz("3")) - batch.WriteSync() - }, - map[string]int{ - "Set": 0, "SetSync": 0, "SetNoLock": 3, "SetNoLockSync": 0, - "Delete": 0, "DeleteSync": 0, "DeleteNoLock": 0, "DeleteNoLockSync": 1, - }, - }, - } - - for i, tc := range testCases { - mdb := newMockDB() - batch := mdb.NewBatch() - - tc.modify(batch) - - for call, exp := range tc.calls { - got := mdb.calls[call] - assert.Equal(t, exp, got, "#%v - key: %s", i, call) - } - } -} diff --git a/tm2/pkg/db/fsdb.go b/tm2/pkg/db/fsdb/fsdb.go similarity index 88% rename from tm2/pkg/db/fsdb.go rename to tm2/pkg/db/fsdb/fsdb.go index e11cd6d4ce5..ddb2439b0f6 100644 --- a/tm2/pkg/db/fsdb.go +++ b/tm2/pkg/db/fsdb/fsdb.go @@ -1,4 +1,4 @@ -package db +package fsdb import ( "fmt" @@ -9,6 +9,8 @@ import ( "sort" "sync" + "github.com/gnolang/gno/tm2/pkg/db" + "github.com/gnolang/gno/tm2/pkg/db/internal" "github.com/gnolang/gno/tm2/pkg/errors" ) @@ -18,13 +20,13 @@ const ( ) func init() { - registerDBCreator(FSDBBackend, func(name, dir string) (DB, error) { + db.InternalRegisterDBCreator(db.FSDBBackend, func(name, dir string) (db.DB, error) { dbPath := filepath.Join(dir, name+".db") return NewFSDB(dbPath), nil }, false) } -var _ DB = (*FSDB)(nil) +var _ db.DB = (*FSDB)(nil) // It's slow. type FSDB struct { @@ -64,7 +66,12 @@ func (db *FSDB) Has(key []byte) bool { key = escapeKey(key) path := db.nameToPath(key) - return FileExists(path) + return fileExists(path) +} + +func fileExists(filePath string) bool { + _, err := os.Stat(filePath) + return !os.IsNotExist(err) } func (db *FSDB) Set(key []byte, value []byte) { @@ -84,7 +91,7 @@ func (db *FSDB) SetSync(key []byte, value []byte) { // NOTE: Implements atomicSetDeleter. func (db *FSDB) SetNoLock(key []byte, value []byte) { key = escapeKey(key) - value = nonNilBytes(value) + value = internal.NonNilBytes(value) path := db.nameToPath(key) err := write(path, value) if err != nil { @@ -136,7 +143,7 @@ func (db *FSDB) Stats() map[string]string { panic("FSDB.Stats not yet implemented") } -func (db *FSDB) NewBatch() Batch { +func (db *FSDB) NewBatch() db.Batch { db.mtx.Lock() defer db.mtx.Unlock() @@ -149,11 +156,11 @@ func (db *FSDB) Mutex() *sync.Mutex { return &(db.mtx) } -func (db *FSDB) Iterator(start, end []byte) Iterator { +func (db *FSDB) Iterator(start, end []byte) db.Iterator { return db.MakeIterator(start, end, false) } -func (db *FSDB) MakeIterator(start, end []byte, isReversed bool) Iterator { +func (db *FSDB) MakeIterator(start, end []byte, isReversed bool) db.Iterator { db.mtx.Lock() defer db.mtx.Unlock() @@ -168,10 +175,10 @@ func (db *FSDB) MakeIterator(start, end []byte, isReversed bool) Iterator { } else { sort.Strings(keys) } - return newMemDBIterator(db, keys, start, end) + return internal.NewMemIterator(db, keys, start, end) } -func (db *FSDB) ReverseIterator(start, end []byte) Iterator { +func (db *FSDB) ReverseIterator(start, end []byte) db.Iterator { return db.MakeIterator(start, end, true) } @@ -245,7 +252,7 @@ func list(dirPath string, start, end []byte) ([]string, error) { return nil, fmt.Errorf("failed to unescape %s while listing", name) } key := unescapeKey([]byte(n)) - if IsKeyInDomain(key, start, end) { + if db.IsKeyInDomain(key, start, end) { keys = append(keys, string(key)) } } diff --git a/tm2/pkg/db/go_level_db.go b/tm2/pkg/db/goleveldb/go_level_db.go similarity index 88% rename from tm2/pkg/db/go_level_db.go rename to tm2/pkg/db/goleveldb/go_level_db.go index e269e5a9f8c..b4528d3fafa 100644 --- a/tm2/pkg/db/go_level_db.go +++ b/tm2/pkg/db/goleveldb/go_level_db.go @@ -1,4 +1,4 @@ -package db +package goleveldb import ( "bytes" @@ -6,6 +6,8 @@ import ( "fmt" "path/filepath" + "github.com/gnolang/gno/tm2/pkg/db" + "github.com/gnolang/gno/tm2/pkg/db/internal" "github.com/gnolang/goleveldb/leveldb" "github.com/gnolang/goleveldb/leveldb/errors" "github.com/gnolang/goleveldb/leveldb/iterator" @@ -13,13 +15,13 @@ import ( ) func init() { - dbCreator := func(name string, dir string) (DB, error) { + dbCreator := func(name string, dir string) (db.DB, error) { return NewGoLevelDB(name, dir) } - registerDBCreator(GoLevelDBBackend, dbCreator, false) + db.InternalRegisterDBCreator(db.GoLevelDBBackend, dbCreator, false) } -var _ DB = (*GoLevelDB)(nil) +var _ db.DB = (*GoLevelDB)(nil) type GoLevelDB struct { db *leveldb.DB @@ -43,7 +45,7 @@ func NewGoLevelDBWithOpts(name string, dir string, o *opt.Options) (*GoLevelDB, // Implements DB. func (db *GoLevelDB) Get(key []byte) []byte { - key = nonNilBytes(key) + key = internal.NonNilBytes(key) res, err := db.db.Get(key, nil) if err != nil { if goerrors.Is(err, errors.ErrNotFound) { @@ -61,8 +63,8 @@ func (db *GoLevelDB) Has(key []byte) bool { // Implements DB. func (db *GoLevelDB) Set(key []byte, value []byte) { - key = nonNilBytes(key) - value = nonNilBytes(value) + key = internal.NonNilBytes(key) + value = internal.NonNilBytes(value) err := db.db.Put(key, value, nil) if err != nil { panic(err) @@ -71,8 +73,8 @@ func (db *GoLevelDB) Set(key []byte, value []byte) { // Implements DB. func (db *GoLevelDB) SetSync(key []byte, value []byte) { - key = nonNilBytes(key) - value = nonNilBytes(value) + key = internal.NonNilBytes(key) + value = internal.NonNilBytes(value) err := db.db.Put(key, value, &opt.WriteOptions{Sync: true}) if err != nil { panic(err) @@ -81,7 +83,7 @@ func (db *GoLevelDB) SetSync(key []byte, value []byte) { // Implements DB. func (db *GoLevelDB) Delete(key []byte) { - key = nonNilBytes(key) + key = internal.NonNilBytes(key) err := db.db.Delete(key, nil) if err != nil { panic(err) @@ -90,7 +92,7 @@ func (db *GoLevelDB) Delete(key []byte) { // Implements DB. func (db *GoLevelDB) DeleteSync(key []byte) { - key = nonNilBytes(key) + key = internal.NonNilBytes(key) err := db.db.Delete(key, &opt.WriteOptions{Sync: true}) if err != nil { panic(err) @@ -146,7 +148,7 @@ func (db *GoLevelDB) Stats() map[string]string { // Batch // Implements DB. -func (db *GoLevelDB) NewBatch() Batch { +func (db *GoLevelDB) NewBatch() db.Batch { batch := new(leveldb.Batch) return &goLevelDBBatch{db, batch} } @@ -192,13 +194,13 @@ func (mBatch *goLevelDBBatch) Close() {} // Before creating a third version, refactor. // Implements DB. -func (db *GoLevelDB) Iterator(start, end []byte) Iterator { +func (db *GoLevelDB) Iterator(start, end []byte) db.Iterator { itr := db.db.NewIterator(nil, nil) return newGoLevelDBIterator(itr, start, end, false) } // Implements DB. -func (db *GoLevelDB) ReverseIterator(start, end []byte) Iterator { +func (db *GoLevelDB) ReverseIterator(start, end []byte) db.Iterator { itr := db.db.NewIterator(nil, nil) return newGoLevelDBIterator(itr, start, end, true) } @@ -211,7 +213,7 @@ type goLevelDBIterator struct { isInvalid bool } -var _ Iterator = (*goLevelDBIterator)(nil) +var _ db.Iterator = (*goLevelDBIterator)(nil) func newGoLevelDBIterator(source iterator.Iterator, start, end []byte, isReverse bool) *goLevelDBIterator { if isReverse { @@ -292,7 +294,7 @@ func (itr *goLevelDBIterator) Key() []byte { // See https://github.com/gnolang/goleveldb/blob/52c212e6c196a1404ea59592d3f1c227c9f034b2/leveldb/iterator/iter.go#L88 itr.assertNoError() itr.assertIsValid() - return cp(itr.source.Key()) + return append([]byte{}, itr.source.Key()...) } // Implements Iterator. @@ -301,7 +303,7 @@ func (itr *goLevelDBIterator) Value() []byte { // See https://github.com/gnolang/goleveldb/blob/52c212e6c196a1404ea59592d3f1c227c9f034b2/leveldb/iterator/iter.go#L88 itr.assertNoError() itr.assertIsValid() - return cp(itr.source.Value()) + return append([]byte{}, itr.source.Value()...) } // Implements Iterator. diff --git a/tm2/pkg/db/go_level_db_test.go b/tm2/pkg/db/goleveldb/go_level_db_test.go similarity index 61% rename from tm2/pkg/db/go_level_db_test.go rename to tm2/pkg/db/goleveldb/go_level_db_test.go index 677b8d86c08..a83c5dd2280 100644 --- a/tm2/pkg/db/go_level_db_test.go +++ b/tm2/pkg/db/goleveldb/go_level_db_test.go @@ -1,10 +1,13 @@ -package db +package goleveldb import ( "fmt" "testing" + "github.com/gnolang/gno/tm2/pkg/db" + "github.com/gnolang/gno/tm2/pkg/db/internal" "github.com/gnolang/goleveldb/leveldb/opt" + "github.com/jaekwon/testify/assert" "github.com/stretchr/testify/require" ) @@ -12,7 +15,7 @@ func TestGoLevelDBNewGoLevelDB(t *testing.T) { t.Parallel() dir := t.TempDir() - name := fmt.Sprintf("test_%x", randStr(12)) + name := fmt.Sprintf("test_%x", internal.RandStr(12)) // Test we can't open the db twice for writing wr1, err := NewGoLevelDB(name, dir) @@ -30,13 +33,24 @@ func TestGoLevelDBNewGoLevelDB(t *testing.T) { defer ro2.Close() } +func TestGoLevelDBBackend(t *testing.T) { + t.Parallel() + + name := fmt.Sprintf("test_%x", internal.RandStr(12)) + db, err := db.NewDB(name, db.GoLevelDBBackend, t.TempDir()) + require.NoError(t, err) + + _, ok := db.(*GoLevelDB) + assert.True(t, ok) +} + func BenchmarkGoLevelDBRandomReadsWrites(b *testing.B) { - name := fmt.Sprintf("test_%x", randStr(12)) + name := fmt.Sprintf("test_%x", internal.RandStr(12)) db, err := NewGoLevelDB(name, b.TempDir()) if err != nil { b.Fatal(err) } defer db.Close() - benchmarkRandomReadsWrites(b, db) + internal.BenchmarkRandomReadsWrites(b, db) } diff --git a/tm2/pkg/db/gorocks_db.go b/tm2/pkg/db/gorocks_db.go deleted file mode 100644 index 46b2ec69ab9..00000000000 --- a/tm2/pkg/db/gorocks_db.go +++ /dev/null @@ -1,340 +0,0 @@ -//go:build gorocksdb - -package db - -import ( - "bytes" - "fmt" - "path/filepath" - "runtime" - - "github.com/tecbot/gorocksdb" -) - -func init() { - dbCreator := func(name string, dir string) (DB, error) { - return NewRocksDB(name, dir) - } - registerDBCreator(RocksDBBackend, dbCreator, false) -} - -var _ DB = (*RocksDB)(nil) - -type RocksDB struct { - db *gorocksdb.DB - ro *gorocksdb.ReadOptions - wo *gorocksdb.WriteOptions - woSync *gorocksdb.WriteOptions -} - -func NewRocksDB(name string, dir string) (*RocksDB, error) { - // default rocksdb option, good enough for most cases, including heavy workloads. - // 1GB table cache, 512MB write buffer(may use 50% more on heavy workloads). - // compression: snappy as default, need to -lsnappy to enable. - bbto := gorocksdb.NewDefaultBlockBasedTableOptions() - bbto.SetBlockCache(gorocksdb.NewLRUCache(1 << 30)) - bbto.SetFilterPolicy(gorocksdb.NewBloomFilter(10)) - - opts := gorocksdb.NewDefaultOptions() - opts.SetBlockBasedTableFactory(bbto) - opts.SetCreateIfMissing(true) - opts.IncreaseParallelism(runtime.NumCPU()) - // 1.5GB maximum memory use for writebuffer. - opts.OptimizeLevelStyleCompaction(512 * 1024 * 1024) - return NewRocksDBWithOptions(name, dir, opts) -} - -func NewRocksDBWithOptions(name string, dir string, opts *gorocksdb.Options) (*RocksDB, error) { - dbPath := filepath.Join(dir, name+".db") - db, err := gorocksdb.OpenDb(opts, dbPath) - if err != nil { - return nil, err - } - ro := gorocksdb.NewDefaultReadOptions() - wo := gorocksdb.NewDefaultWriteOptions() - woSync := gorocksdb.NewDefaultWriteOptions() - woSync.SetSync(true) - database := &RocksDB{ - db: db, - ro: ro, - wo: wo, - woSync: woSync, - } - return database, nil -} - -// Implements DB. -func (db *RocksDB) Get(key []byte) []byte { - key = nonNilBytes(key) - res, err := db.db.Get(db.ro, key) - if err != nil { - panic(err) - } - return moveSliceToBytes(res) -} - -// Implements DB. -func (db *RocksDB) Has(key []byte) bool { - return db.Get(key) != nil -} - -// Implements DB. -func (db *RocksDB) Set(key []byte, value []byte) { - key = nonNilBytes(key) - value = nonNilBytes(value) - err := db.db.Put(db.wo, key, value) - if err != nil { - panic(err) - } -} - -// Implements DB. -func (db *RocksDB) SetSync(key []byte, value []byte) { - key = nonNilBytes(key) - value = nonNilBytes(value) - err := db.db.Put(db.woSync, key, value) - if err != nil { - panic(err) - } -} - -// Implements DB. -func (db *RocksDB) Delete(key []byte) { - key = nonNilBytes(key) - err := db.db.Delete(db.wo, key) - if err != nil { - panic(err) - } -} - -// Implements DB. -func (db *RocksDB) DeleteSync(key []byte) { - key = nonNilBytes(key) - err := db.db.Delete(db.woSync, key) - if err != nil { - panic(err) - } -} - -func (db *RocksDB) DB() *gorocksdb.DB { - return db.db -} - -// Implements DB. -func (db *RocksDB) Close() { - db.ro.Destroy() - db.wo.Destroy() - db.woSync.Destroy() - db.db.Close() -} - -// Implements DB. -func (db *RocksDB) Print() { - itr := db.Iterator(nil, nil) - defer itr.Close() - for ; itr.Valid(); itr.Next() { - key := itr.Key() - value := itr.Value() - fmt.Printf("[%X]:\t[%X]\n", key, value) - } -} - -// Implements DB. -func (db *RocksDB) Stats() map[string]string { - keys := []string{"rocksdb.stats"} - stats := make(map[string]string, len(keys)) - for _, key := range keys { - stats[key] = db.db.GetProperty(key) - } - return stats -} - -//---------------------------------------- -// Batch - -// Implements DB. -func (db *RocksDB) NewBatch() Batch { - batch := gorocksdb.NewWriteBatch() - return &rocksDBBatch{db, batch} -} - -type rocksDBBatch struct { - db *RocksDB - batch *gorocksdb.WriteBatch -} - -// Implements Batch. -func (mBatch *rocksDBBatch) Set(key, value []byte) { - mBatch.batch.Put(key, value) -} - -// Implements Batch. -func (mBatch *rocksDBBatch) Delete(key []byte) { - mBatch.batch.Delete(key) -} - -// Implements Batch. -func (mBatch *rocksDBBatch) Write() { - err := mBatch.db.db.Write(mBatch.db.wo, mBatch.batch) - if err != nil { - panic(err) - } -} - -// Implements Batch. -func (mBatch *rocksDBBatch) WriteSync() { - err := mBatch.db.db.Write(mBatch.db.woSync, mBatch.batch) - if err != nil { - panic(err) - } -} - -// Implements Batch. -func (mBatch *rocksDBBatch) Close() { - mBatch.batch.Destroy() -} - -//---------------------------------------- -// Iterator -// NOTE This is almost identical to db/go_level_db.Iterator -// Before creating a third version, refactor. - -func (db *RocksDB) Iterator(start, end []byte) Iterator { - itr := db.db.NewIterator(db.ro) - return newRocksDBIterator(itr, start, end, false) -} - -func (db *RocksDB) ReverseIterator(start, end []byte) Iterator { - itr := db.db.NewIterator(db.ro) - return newRocksDBIterator(itr, start, end, true) -} - -var _ Iterator = (*rocksDBIterator)(nil) - -type rocksDBIterator struct { - source *gorocksdb.Iterator - start, end []byte - isReverse bool - isInvalid bool -} - -func newRocksDBIterator(source *gorocksdb.Iterator, start, end []byte, isReverse bool) *rocksDBIterator { - if isReverse { - if end == nil { - source.SeekToLast() - } else { - source.Seek(end) - if source.Valid() { - eoakey := moveSliceToBytes(source.Key()) // end or after key - if bytes.Compare(end, eoakey) <= 0 { - source.Prev() - } - } else { - source.SeekToLast() - } - } - } else { - if start == nil { - source.SeekToFirst() - } else { - source.Seek(start) - } - } - return &rocksDBIterator{ - source: source, - start: start, - end: end, - isReverse: isReverse, - isInvalid: false, - } -} - -func (itr rocksDBIterator) Domain() ([]byte, []byte) { - return itr.start, itr.end -} - -func (itr rocksDBIterator) Valid() bool { - // Once invalid, forever invalid. - if itr.isInvalid { - return false - } - - // Panic on DB error. No way to recover. - itr.assertNoError() - - // If source is invalid, invalid. - if !itr.source.Valid() { - itr.isInvalid = true - return false - } - - // If key is end or past it, invalid. - start := itr.start - end := itr.end - key := moveSliceToBytes(itr.source.Key()) - if itr.isReverse { - if start != nil && bytes.Compare(key, start) < 0 { - itr.isInvalid = true - return false - } - } else { - if end != nil && bytes.Compare(end, key) <= 0 { - itr.isInvalid = true - return false - } - } - - // It's valid. - return true -} - -func (itr rocksDBIterator) Key() []byte { - itr.assertNoError() - itr.assertIsValid() - return moveSliceToBytes(itr.source.Key()) -} - -func (itr rocksDBIterator) Value() []byte { - itr.assertNoError() - itr.assertIsValid() - return moveSliceToBytes(itr.source.Value()) -} - -func (itr rocksDBIterator) Next() { - itr.assertNoError() - itr.assertIsValid() - if itr.isReverse { - itr.source.Prev() - } else { - itr.source.Next() - } -} - -func (itr rocksDBIterator) Close() { - itr.source.Close() -} - -func (itr rocksDBIterator) assertNoError() { - if err := itr.source.Err(); err != nil { - panic(err) - } -} - -func (itr rocksDBIterator) assertIsValid() { - if !itr.Valid() { - panic("rocksDBIterator is invalid") - } -} - -// moveSliceToBytes will free the slice and copy out a go []byte -// This function can be applied on *Slice returned from Key() and Value() -// of an Iterator, because they are marked as freed. -func moveSliceToBytes(s *gorocksdb.Slice) []byte { - defer s.Free() - if !s.Exists() { - return nil - } - v := make([]byte, len(s.Data())) - copy(v, s.Data()) - return v -} diff --git a/tm2/pkg/db/gorocks_db_test.go b/tm2/pkg/db/gorocks_db_test.go deleted file mode 100644 index d4792424f39..00000000000 --- a/tm2/pkg/db/gorocks_db_test.go +++ /dev/null @@ -1,29 +0,0 @@ -//go:build gorocksdb - -package db - -import ( - "fmt" - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestGoRocksDBBackend(t *testing.T) { - t.Parallel() - - name := fmt.Sprintf("test_%x", randStr(12)) - db := NewDB(name, GoRocksDBBackend, t.TempDir()) - - _, ok := db.(*RocksDB) - assert.True(t, ok) -} - -func TestGoRocksDBStats(t *testing.T) { - t.Parallel() - - name := fmt.Sprintf("test_%x", randStr(12)) - db := NewDB(name, GoRocksDBBackend, t.TempDir()) - - assert.NotEmpty(t, db.Stats()) -} diff --git a/tm2/pkg/db/grocks_db_test.go b/tm2/pkg/db/grocks_db_test.go deleted file mode 100644 index 10b33026128..00000000000 --- a/tm2/pkg/db/grocks_db_test.go +++ /dev/null @@ -1,29 +0,0 @@ -//go:build grocksdb - -package db - -import ( - "fmt" - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestGRocksDBBackend(t *testing.T) { - t.Parallel() - - name := fmt.Sprintf("test_%x", randStr(12)) - db := NewDB(name, GRocksDBBackend, t.TempDir()) - - _, ok := db.(*RocksDB) - assert.True(t, ok) -} - -func TestGRocksDBStats(t *testing.T) { - t.Parallel() - - name := fmt.Sprintf("test_%x", randStr(12)) - db := NewDB(name, GRocksDBBackend, t.TempDir()) - - assert.NotEmpty(t, db.Stats()) -} diff --git a/tm2/pkg/db/internal/internal.go b/tm2/pkg/db/internal/internal.go new file mode 100644 index 00000000000..9c43ee93f22 --- /dev/null +++ b/tm2/pkg/db/internal/internal.go @@ -0,0 +1,13 @@ +// Package internal exposes internal functions used within db packages. +package internal + +// NonNilBytes ensures that bz is a non-nil byte slice (ie. []byte{}). +// +// We defensively turn nil keys or values into []byte{} for +// most operations. +func NonNilBytes(bz []byte) []byte { + if bz == nil { + return []byte{} + } + return bz +} diff --git a/tm2/pkg/db/internal/mem_batch.go b/tm2/pkg/db/internal/mem_batch.go new file mode 100644 index 00000000000..7dfd757fb3f --- /dev/null +++ b/tm2/pkg/db/internal/mem_batch.go @@ -0,0 +1,74 @@ +package internal + +import "sync" + +type AtomicSetDeleter interface { + Mutex() *sync.Mutex + SetNoLock(key, value []byte) + SetNoLockSync(key, value []byte) + DeleteNoLock(key []byte) + DeleteNoLockSync(key []byte) +} + +type MemBatch struct { + DB AtomicSetDeleter + Ops []Operation +} + +type OpType int + +const ( + OpTypeSet OpType = 1 + OpTypeDelete OpType = 2 +) + +type Operation struct { + OpType + Key []byte + Value []byte +} + +func (mBatch *MemBatch) Set(key, value []byte) { + mBatch.Ops = append(mBatch.Ops, Operation{OpTypeSet, key, value}) +} + +func (mBatch *MemBatch) Delete(key []byte) { + mBatch.Ops = append(mBatch.Ops, Operation{OpTypeDelete, key, nil}) +} + +func (mBatch *MemBatch) Write() { + mBatch.write(false) +} + +func (mBatch *MemBatch) WriteSync() { + mBatch.write(true) +} + +func (mBatch *MemBatch) Close() { + mBatch.Ops = nil +} + +func (mBatch *MemBatch) write(doSync bool) { + if mtx := mBatch.DB.Mutex(); mtx != nil { + mtx.Lock() + defer mtx.Unlock() + } + + for i, op := range mBatch.Ops { + if doSync && i == (len(mBatch.Ops)-1) { + switch op.OpType { + case OpTypeSet: + mBatch.DB.SetNoLockSync(op.Key, op.Value) + case OpTypeDelete: + mBatch.DB.DeleteNoLockSync(op.Key) + } + break // we're done. + } + switch op.OpType { + case OpTypeSet: + mBatch.DB.SetNoLock(op.Key, op.Value) + case OpTypeDelete: + mBatch.DB.DeleteNoLock(op.Key) + } + } +} diff --git a/tm2/pkg/db/internal/mem_iterator.go b/tm2/pkg/db/internal/mem_iterator.go new file mode 100644 index 00000000000..9e861db9df6 --- /dev/null +++ b/tm2/pkg/db/internal/mem_iterator.go @@ -0,0 +1,67 @@ +package internal + +import "github.com/gnolang/gno/tm2/pkg/db" + +// We need a copy of all of the keys. +// Not the best, but probably not a bottleneck depending. +type MemIterator struct { + db db.DB + cur int + keys []string + start []byte + end []byte +} + +var _ db.Iterator = (*MemIterator)(nil) + +// Keys is expected to be in reverse order for reverse iterators. +func NewMemIterator(db db.DB, keys []string, start, end []byte) *MemIterator { + return &MemIterator{ + db: db, + cur: 0, + keys: keys, + start: start, + end: end, + } +} + +// Implements Iterator. +func (itr *MemIterator) Domain() ([]byte, []byte) { + return itr.start, itr.end +} + +// Implements Iterator. +func (itr *MemIterator) Valid() bool { + return 0 <= itr.cur && itr.cur < len(itr.keys) +} + +// Implements Iterator. +func (itr *MemIterator) Next() { + itr.assertIsValid() + itr.cur++ +} + +// Implements Iterator. +func (itr *MemIterator) Key() []byte { + itr.assertIsValid() + return []byte(itr.keys[itr.cur]) +} + +// Implements Iterator. +func (itr *MemIterator) Value() []byte { + itr.assertIsValid() + key := []byte(itr.keys[itr.cur]) + return itr.db.Get(key) +} + +// Implements Iterator. +func (itr *MemIterator) Close() { + itr.keys = nil + itr.db = nil +} + +func (itr *MemIterator) assertIsValid() { + if !itr.Valid() { + panic("MemIterator is invalid") + } +} diff --git a/tm2/pkg/db/internal/test_common.go b/tm2/pkg/db/internal/test_common.go new file mode 100644 index 00000000000..417ced25ae4 --- /dev/null +++ b/tm2/pkg/db/internal/test_common.go @@ -0,0 +1,130 @@ +package internal + +import ( + "bytes" + "encoding/binary" + "math/rand" + "testing" + + "github.com/gnolang/gno/tm2/pkg/db" +) + +const ( + strChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" // 62 characters +) + +// RandStr constructs a random alphanumeric string of given length. +func RandStr(length int) string { + chars := []byte{} +MAIN_LOOP: + for { + //nolint:gosec + val := rand.Int63() + for i := 0; i < 10; i++ { + v := int(val & 0x3f) // rightmost 6 bits + if v >= 62 { // only 62 characters in strChars + val >>= 6 + continue + } else { + chars = append(chars, strChars[v]) + if len(chars) == length { + break MAIN_LOOP + } + val >>= 6 + } + } + } + + return string(chars) +} + +// ---------------------------------------- +// MockIterator + +type MockIterator struct{} + +func (MockIterator) Domain() (start []byte, end []byte) { + return nil, nil +} + +func (MockIterator) Valid() bool { + return false +} + +func (MockIterator) Next() { +} + +func (MockIterator) Key() []byte { + return nil +} + +func (MockIterator) Value() []byte { + return nil +} + +func (MockIterator) Close() { +} + +func BenchmarkRandomReadsWrites(b *testing.B, db db.DB) { + b.Helper() + + b.StopTimer() + + // create dummy data + const numItems = int64(1000000) + internal := map[int64]int64{} + for i := 0; i < int(numItems); i++ { + internal[int64(i)] = int64(0) + } + + // fmt.Println("ok, starting") + b.StartTimer() + + for i := 0; i < b.N; i++ { + // Write something + { + idx := int64(rand.Int()) % numItems + internal[idx]++ + val := internal[idx] + idxBytes := int642Bytes(idx) + valBytes := int642Bytes(val) + // fmt.Printf("Set %X -> %X\n", idxBytes, valBytes) + db.Set(idxBytes, valBytes) + } + + // Read something + { + idx := int64(rand.Int()) % numItems + valExp := internal[idx] + idxBytes := int642Bytes(idx) + valBytes := db.Get(idxBytes) + // fmt.Printf("Get %X -> %X\n", idxBytes, valBytes) + if valExp == 0 { + if !bytes.Equal(valBytes, nil) { + b.Errorf("Expected %v for %v, got %X", nil, idx, valBytes) + break + } + } else { + if len(valBytes) != 8 { + b.Errorf("Expected length 8 for %v, got %X", idx, valBytes) + break + } + valGot := bytes2Int64(valBytes) + if valExp != valGot { + b.Errorf("Expected %v for %v, got %v", valExp, idx, valGot) + break + } + } + } + } +} + +func int642Bytes(i int64) []byte { + buf := make([]byte, 8) + binary.BigEndian.PutUint64(buf, uint64(i)) + return buf +} + +func bytes2Int64(buf []byte) int64 { + return int64(binary.BigEndian.Uint64(buf)) +} diff --git a/tm2/pkg/db/mem_batch.go b/tm2/pkg/db/mem_batch.go deleted file mode 100644 index 2ce765786a4..00000000000 --- a/tm2/pkg/db/mem_batch.go +++ /dev/null @@ -1,74 +0,0 @@ -package db - -import "sync" - -type atomicSetDeleter interface { - Mutex() *sync.Mutex - SetNoLock(key, value []byte) - SetNoLockSync(key, value []byte) - DeleteNoLock(key []byte) - DeleteNoLockSync(key []byte) -} - -type memBatch struct { - db atomicSetDeleter - ops []operation -} - -type opType int - -const ( - opTypeSet opType = 1 - opTypeDelete opType = 2 -) - -type operation struct { - opType - key []byte - value []byte -} - -func (mBatch *memBatch) Set(key, value []byte) { - mBatch.ops = append(mBatch.ops, operation{opTypeSet, key, value}) -} - -func (mBatch *memBatch) Delete(key []byte) { - mBatch.ops = append(mBatch.ops, operation{opTypeDelete, key, nil}) -} - -func (mBatch *memBatch) Write() { - mBatch.write(false) -} - -func (mBatch *memBatch) WriteSync() { - mBatch.write(true) -} - -func (mBatch *memBatch) Close() { - mBatch.ops = nil -} - -func (mBatch *memBatch) write(doSync bool) { - if mtx := mBatch.db.Mutex(); mtx != nil { - mtx.Lock() - defer mtx.Unlock() - } - - for i, op := range mBatch.ops { - if doSync && i == (len(mBatch.ops)-1) { - switch op.opType { - case opTypeSet: - mBatch.db.SetNoLockSync(op.key, op.value) - case opTypeDelete: - mBatch.db.DeleteNoLockSync(op.key) - } - break // we're done. - } - switch op.opType { - case opTypeSet: - mBatch.db.SetNoLock(op.key, op.value) - case opTypeDelete: - mBatch.db.DeleteNoLock(op.key) - } - } -} diff --git a/tm2/pkg/db/mem_db.go b/tm2/pkg/db/memdb/mem_db.go similarity index 59% rename from tm2/pkg/db/mem_db.go rename to tm2/pkg/db/memdb/mem_db.go index 3d5aad71ea2..f739a228325 100644 --- a/tm2/pkg/db/mem_db.go +++ b/tm2/pkg/db/memdb/mem_db.go @@ -1,20 +1,22 @@ -package db +package memdb import ( "fmt" "sort" "sync" + "github.com/gnolang/gno/tm2/pkg/db" + "github.com/gnolang/gno/tm2/pkg/db/internal" "github.com/gnolang/gno/tm2/pkg/strings" ) func init() { - registerDBCreator(MemDBBackend, func(name, dir string) (DB, error) { + db.InternalRegisterDBCreator(db.MemDBBackend, func(name, dir string) (db.DB, error) { return NewMemDB(), nil }, false) } -var _ DB = (*MemDB)(nil) +var _ db.DB = (*MemDB)(nil) type MemDB struct { mtx sync.Mutex @@ -28,7 +30,7 @@ func NewMemDB() *MemDB { return database } -// Implements atomicSetDeleter. +// Implements internal.AtomicSetDeleter. func (db *MemDB) Mutex() *sync.Mutex { return &(db.mtx) } @@ -37,7 +39,7 @@ func (db *MemDB) Mutex() *sync.Mutex { func (db *MemDB) Get(key []byte) []byte { db.mtx.Lock() defer db.mtx.Unlock() - key = nonNilBytes(key) + key = internal.NonNilBytes(key) value := db.db[string(key)] return value @@ -47,7 +49,7 @@ func (db *MemDB) Get(key []byte) []byte { func (db *MemDB) Has(key []byte) bool { db.mtx.Lock() defer db.mtx.Unlock() - key = nonNilBytes(key) + key = internal.NonNilBytes(key) _, ok := db.db[string(key)] return ok @@ -69,15 +71,15 @@ func (db *MemDB) SetSync(key []byte, value []byte) { db.SetNoLock(key, value) } -// Implements atomicSetDeleter. +// Implements internal.AtomicSetDeleter. func (db *MemDB) SetNoLock(key []byte, value []byte) { db.SetNoLockSync(key, value) } -// Implements atomicSetDeleter. +// Implements internal.AtomicSetDeleter. func (db *MemDB) SetNoLockSync(key []byte, value []byte) { - key = nonNilBytes(key) - value = nonNilBytes(value) + key = internal.NonNilBytes(key) + value = internal.NonNilBytes(value) db.db[string(key)] = value } @@ -98,14 +100,14 @@ func (db *MemDB) DeleteSync(key []byte) { db.DeleteNoLock(key) } -// Implements atomicSetDeleter. +// Implements internal.AtomicSetDeleter. func (db *MemDB) DeleteNoLock(key []byte) { db.DeleteNoLockSync(key) } -// Implements atomicSetDeleter. +// Implements internal.AtomicSetDeleter. func (db *MemDB) DeleteNoLockSync(key []byte) { - key = nonNilBytes(key) + key = internal.NonNilBytes(key) delete(db.db, string(key)) } @@ -152,105 +154,41 @@ func (db *MemDB) Stats() map[string]string { } // Implements DB. -func (db *MemDB) NewBatch() Batch { +func (db *MemDB) NewBatch() db.Batch { db.mtx.Lock() defer db.mtx.Unlock() - return &memBatch{db, nil} + return &internal.MemBatch{db, nil} } // ---------------------------------------- // Iterator // Implements DB. -func (db *MemDB) Iterator(start, end []byte) Iterator { +func (db *MemDB) Iterator(start, end []byte) db.Iterator { db.mtx.Lock() defer db.mtx.Unlock() keys := db.getSortedKeys(start, end, false) - return newMemDBIterator(db, keys, start, end) + return internal.NewMemIterator(db, keys, start, end) } // Implements DB. -func (db *MemDB) ReverseIterator(start, end []byte) Iterator { +func (db *MemDB) ReverseIterator(start, end []byte) db.Iterator { db.mtx.Lock() defer db.mtx.Unlock() keys := db.getSortedKeys(start, end, true) - return newMemDBIterator(db, keys, start, end) -} - -// We need a copy of all of the keys. -// Not the best, but probably not a bottleneck depending. -type memDBIterator struct { - db DB - cur int - keys []string - start []byte - end []byte -} - -var _ Iterator = (*memDBIterator)(nil) - -// Keys is expected to be in reverse order for reverse iterators. -func newMemDBIterator(db DB, keys []string, start, end []byte) *memDBIterator { - return &memDBIterator{ - db: db, - cur: 0, - keys: keys, - start: start, - end: end, - } -} - -// Implements Iterator. -func (itr *memDBIterator) Domain() ([]byte, []byte) { - return itr.start, itr.end -} - -// Implements Iterator. -func (itr *memDBIterator) Valid() bool { - return 0 <= itr.cur && itr.cur < len(itr.keys) -} - -// Implements Iterator. -func (itr *memDBIterator) Next() { - itr.assertIsValid() - itr.cur++ -} - -// Implements Iterator. -func (itr *memDBIterator) Key() []byte { - itr.assertIsValid() - return []byte(itr.keys[itr.cur]) -} - -// Implements Iterator. -func (itr *memDBIterator) Value() []byte { - itr.assertIsValid() - key := []byte(itr.keys[itr.cur]) - return itr.db.Get(key) -} - -// Implements Iterator. -func (itr *memDBIterator) Close() { - itr.keys = nil - itr.db = nil -} - -func (itr *memDBIterator) assertIsValid() { - if !itr.Valid() { - panic("memDBIterator is invalid") - } + return internal.NewMemIterator(db, keys, start, end) } // ---------------------------------------- // Misc. -func (db *MemDB) getSortedKeys(start, end []byte, reverse bool) []string { +func (memdb *MemDB) getSortedKeys(start, end []byte, reverse bool) []string { keys := []string{} - for key := range db.db { - inDomain := IsKeyInDomain([]byte(key), start, end) + for key := range memdb.db { + inDomain := db.IsKeyInDomain([]byte(key), start, end) if inDomain { keys = append(keys, key) } diff --git a/tm2/pkg/db/prefix_db_test.go b/tm2/pkg/db/prefix_db_test.go index 0948cce98a5..83c50f56470 100644 --- a/tm2/pkg/db/prefix_db_test.go +++ b/tm2/pkg/db/prefix_db_test.go @@ -1,9 +1,14 @@ -package db +package db_test -import "testing" +import ( + "testing" -func mockDBWithStuff() DB { - db := NewMemDB() + dbm "github.com/gnolang/gno/tm2/pkg/db" + "github.com/gnolang/gno/tm2/pkg/db/memdb" +) + +func mockDBWithStuff() dbm.DB { + db := memdb.NewMemDB() // Under "key" prefix db.Set(bz("key"), bz("value")) db.Set(bz("key1"), bz("value1")) @@ -21,7 +26,7 @@ func TestPrefixDBSimple(t *testing.T) { t.Parallel() db := mockDBWithStuff() - pdb := NewPrefixDB(db, bz("key")) + pdb := dbm.NewPrefixDB(db, bz("key")) checkValue(t, pdb, bz("key"), nil) checkValue(t, pdb, bz(""), bz("value")) @@ -41,7 +46,7 @@ func TestPrefixDBIterator1(t *testing.T) { t.Parallel() db := mockDBWithStuff() - pdb := NewPrefixDB(db, bz("key")) + pdb := dbm.NewPrefixDB(db, bz("key")) itr := pdb.Iterator(nil, nil) checkDomain(t, itr, nil, nil) @@ -61,7 +66,7 @@ func TestPrefixDBIterator2(t *testing.T) { t.Parallel() db := mockDBWithStuff() - pdb := NewPrefixDB(db, bz("key")) + pdb := dbm.NewPrefixDB(db, bz("key")) itr := pdb.Iterator(nil, bz("")) checkDomain(t, itr, nil, bz("")) @@ -73,7 +78,7 @@ func TestPrefixDBIterator3(t *testing.T) { t.Parallel() db := mockDBWithStuff() - pdb := NewPrefixDB(db, bz("key")) + pdb := dbm.NewPrefixDB(db, bz("key")) itr := pdb.Iterator(bz(""), nil) checkDomain(t, itr, bz(""), nil) @@ -93,7 +98,7 @@ func TestPrefixDBIterator4(t *testing.T) { t.Parallel() db := mockDBWithStuff() - pdb := NewPrefixDB(db, bz("key")) + pdb := dbm.NewPrefixDB(db, bz("key")) itr := pdb.Iterator(bz(""), bz("")) checkDomain(t, itr, bz(""), bz("")) @@ -105,7 +110,7 @@ func TestPrefixDBReverseIterator1(t *testing.T) { t.Parallel() db := mockDBWithStuff() - pdb := NewPrefixDB(db, bz("key")) + pdb := dbm.NewPrefixDB(db, bz("key")) itr := pdb.ReverseIterator(nil, nil) checkDomain(t, itr, nil, nil) @@ -125,7 +130,7 @@ func TestPrefixDBReverseIterator2(t *testing.T) { t.Parallel() db := mockDBWithStuff() - pdb := NewPrefixDB(db, bz("key")) + pdb := dbm.NewPrefixDB(db, bz("key")) itr := pdb.ReverseIterator(bz(""), nil) checkDomain(t, itr, bz(""), nil) @@ -145,7 +150,7 @@ func TestPrefixDBReverseIterator3(t *testing.T) { t.Parallel() db := mockDBWithStuff() - pdb := NewPrefixDB(db, bz("key")) + pdb := dbm.NewPrefixDB(db, bz("key")) itr := pdb.ReverseIterator(nil, bz("")) checkDomain(t, itr, nil, bz("")) @@ -157,7 +162,7 @@ func TestPrefixDBReverseIterator4(t *testing.T) { t.Parallel() db := mockDBWithStuff() - pdb := NewPrefixDB(db, bz("key")) + pdb := dbm.NewPrefixDB(db, bz("key")) itr := pdb.ReverseIterator(bz(""), bz("")) checkDomain(t, itr, bz(""), bz("")) @@ -169,7 +174,7 @@ func TestPrefixDBReverseIterator5(t *testing.T) { t.Parallel() db := mockDBWithStuff() - pdb := NewPrefixDB(db, bz("key")) + pdb := dbm.NewPrefixDB(db, bz("key")) itr := pdb.ReverseIterator(bz("1"), nil) checkDomain(t, itr, bz("1"), nil) @@ -187,7 +192,7 @@ func TestPrefixDBReverseIterator6(t *testing.T) { t.Parallel() db := mockDBWithStuff() - pdb := NewPrefixDB(db, bz("key")) + pdb := dbm.NewPrefixDB(db, bz("key")) itr := pdb.ReverseIterator(bz("2"), nil) checkDomain(t, itr, bz("2"), nil) @@ -203,7 +208,7 @@ func TestPrefixDBReverseIterator7(t *testing.T) { t.Parallel() db := mockDBWithStuff() - pdb := NewPrefixDB(db, bz("key")) + pdb := dbm.NewPrefixDB(db, bz("key")) itr := pdb.ReverseIterator(nil, bz("2")) checkDomain(t, itr, nil, bz("2")) diff --git a/tm2/pkg/db/grocks_db.go b/tm2/pkg/db/rocksdb/grocks_db.go similarity index 90% rename from tm2/pkg/db/grocks_db.go rename to tm2/pkg/db/rocksdb/grocks_db.go index 30e695e9812..4733c0ba8d9 100644 --- a/tm2/pkg/db/grocks_db.go +++ b/tm2/pkg/db/rocksdb/grocks_db.go @@ -1,6 +1,6 @@ -//go:build grocksdb +//go:build cgo -package db +package rocksdb import ( "bytes" @@ -8,17 +8,19 @@ import ( "path/filepath" "runtime" + "github.com/gnolang/gno/tm2/pkg/db" + "github.com/gnolang/gno/tm2/pkg/db/internal" "github.com/linxGnu/grocksdb" ) func init() { - dbCreator := func(name string, dir string) (DB, error) { + dbCreator := func(name string, dir string) (db.DB, error) { return NewRocksDB(name, dir) } - registerDBCreator(RocksDBBackend, dbCreator, false) + db.InternalRegisterDBCreator(db.RocksDBBackend, dbCreator, false) } -var _ DB = (*RocksDB)(nil) +var _ db.DB = (*RocksDB)(nil) type RocksDB struct { db *grocksdb.DB @@ -65,7 +67,7 @@ func NewRocksDBWithOptions(name string, dir string, opts *grocksdb.Options) (*Ro // Implements DB. func (db *RocksDB) Get(key []byte) []byte { - key = nonNilBytes(key) + key = internal.NonNilBytes(key) res, err := db.db.Get(db.ro, key) if err != nil { panic(err) @@ -80,8 +82,8 @@ func (db *RocksDB) Has(key []byte) bool { // Implements DB. func (db *RocksDB) Set(key []byte, value []byte) { - key = nonNilBytes(key) - value = nonNilBytes(value) + key = internal.NonNilBytes(key) + value = internal.NonNilBytes(value) err := db.db.Put(db.wo, key, value) if err != nil { panic(err) @@ -90,8 +92,8 @@ func (db *RocksDB) Set(key []byte, value []byte) { // Implements DB. func (db *RocksDB) SetSync(key []byte, value []byte) { - key = nonNilBytes(key) - value = nonNilBytes(value) + key = internal.NonNilBytes(key) + value = internal.NonNilBytes(value) err := db.db.Put(db.woSync, key, value) if err != nil { panic(err) @@ -100,7 +102,7 @@ func (db *RocksDB) SetSync(key []byte, value []byte) { // Implements DB. func (db *RocksDB) Delete(key []byte) { - key = nonNilBytes(key) + key = internal.NonNilBytes(key) err := db.db.Delete(db.wo, key) if err != nil { panic(err) @@ -109,7 +111,7 @@ func (db *RocksDB) Delete(key []byte) { // Implements DB. func (db *RocksDB) DeleteSync(key []byte) { - key = nonNilBytes(key) + key = internal.NonNilBytes(key) err := db.db.Delete(db.woSync, key) if err != nil { panic(err) @@ -153,7 +155,7 @@ func (db *RocksDB) Stats() map[string]string { // Batch // Implements DB. -func (db *RocksDB) NewBatch() Batch { +func (db *RocksDB) NewBatch() db.Batch { batch := grocksdb.NewWriteBatch() return &rocksDBBatch{db, batch} } @@ -199,17 +201,17 @@ func (mBatch *rocksDBBatch) Close() { // NOTE This is almost identical to db/go_level_db.Iterator // Before creating a third version, refactor. -func (db *RocksDB) Iterator(start, end []byte) Iterator { +func (db *RocksDB) Iterator(start, end []byte) db.Iterator { itr := db.db.NewIterator(db.ro) return newRocksDBIterator(itr, start, end, false) } -func (db *RocksDB) ReverseIterator(start, end []byte) Iterator { +func (db *RocksDB) ReverseIterator(start, end []byte) db.Iterator { itr := db.db.NewIterator(db.ro) return newRocksDBIterator(itr, start, end, true) } -var _ Iterator = (*rocksDBIterator)(nil) +var _ db.Iterator = (*rocksDBIterator)(nil) type rocksDBIterator struct { source *grocksdb.Iterator diff --git a/tm2/pkg/db/rocksdb/grocks_db_test.go b/tm2/pkg/db/rocksdb/grocks_db_test.go new file mode 100644 index 00000000000..8dfb7e4b528 --- /dev/null +++ b/tm2/pkg/db/rocksdb/grocks_db_test.go @@ -0,0 +1,34 @@ +//go:build cgo + +package rocksdb + +import ( + "fmt" + "testing" + + "github.com/gnolang/gno/tm2/pkg/db" + "github.com/gnolang/gno/tm2/pkg/db/internal" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestGRocksDBBackend(t *testing.T) { + t.Parallel() + + name := fmt.Sprintf("test_%x", internal.RandStr(12)) + db, err := db.NewDB(name, db.RocksDBBackend, t.TempDir()) + require.NoError(t, err) + + _, ok := db.(*RocksDB) + assert.True(t, ok) +} + +func TestGRocksDBStats(t *testing.T) { + t.Parallel() + + name := fmt.Sprintf("test_%x", internal.RandStr(12)) + db, err := db.NewDB(name, db.RocksDBBackend, t.TempDir()) + require.NoError(t, err) + + assert.NotEmpty(t, db.Stats()) +} diff --git a/tm2/pkg/db/rocksdb/no_cgo_test.go b/tm2/pkg/db/rocksdb/no_cgo_test.go new file mode 100644 index 00000000000..71c1b83bf18 --- /dev/null +++ b/tm2/pkg/db/rocksdb/no_cgo_test.go @@ -0,0 +1,9 @@ +//go:build !cgo + +package rocksdb + +import "testing" + +func TestSkip(t *testing.T) { + t.Skip("This package requires cgo to compile and test") +} diff --git a/tm2/pkg/db/test_helpers.go b/tm2/pkg/db/test_helpers.go deleted file mode 100644 index ad76a33e79d..00000000000 --- a/tm2/pkg/db/test_helpers.go +++ /dev/null @@ -1,32 +0,0 @@ -package db - -import "math/rand" - -const ( - strChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" // 62 characters -) - -// Str constructs a random alphanumeric string of given length. -func randStr(length int) string { - chars := []byte{} -MAIN_LOOP: - for { - //nolint:gosec - val := rand.Int63() - for i := 0; i < 10; i++ { - v := int(val & 0x3f) // rightmost 6 bits - if v >= 62 { // only 62 characters in strChars - val >>= 6 - continue - } else { - chars = append(chars, strChars[v]) - if len(chars) == length { - break MAIN_LOOP - } - val >>= 6 - } - } - } - - return string(chars) -} diff --git a/tm2/pkg/db/types.go b/tm2/pkg/db/types.go index d34a550c075..dd87f39e88c 100644 --- a/tm2/pkg/db/types.go +++ b/tm2/pkg/db/types.go @@ -118,17 +118,3 @@ type Iterator interface { // Close releases the Iterator. Close() } - -// For testing convenience. -func bz(s string) []byte { - return []byte(s) -} - -// We defensively turn nil keys or values into []byte{} for -// most operations. -func nonNilBytes(bz []byte) []byte { - if bz == nil { - return []byte{} - } - return bz -} diff --git a/tm2/pkg/db/util.go b/tm2/pkg/db/util.go index da0b635c132..e927c354894 100644 --- a/tm2/pkg/db/util.go +++ b/tm2/pkg/db/util.go @@ -2,7 +2,6 @@ package db import ( "bytes" - "os" ) func cp(bz []byte) (ret []byte) { @@ -44,8 +43,3 @@ func IsKeyInDomain(key, start, end []byte) bool { } return true } - -func FileExists(filePath string) bool { - _, err := os.Stat(filePath) - return !os.IsNotExist(err) -} diff --git a/tm2/pkg/db/util_test.go b/tm2/pkg/db/util_test.go index f66fddde64e..0248eda63b9 100644 --- a/tm2/pkg/db/util_test.go +++ b/tm2/pkg/db/util_test.go @@ -1,20 +1,22 @@ -package db +package db_test import ( "fmt" "testing" + + "github.com/gnolang/gno/tm2/pkg/db" ) // Empty iterator for empty db. func TestPrefixIteratorNoMatchNil(t *testing.T) { t.Parallel() - for backend := range backends { + for _, backend := range db.BackendList() { t.Run(fmt.Sprintf("Prefix w/ backend %s", backend), func(t *testing.T) { t.Parallel() - db := newTempDB(t, backend) - itr := IteratePrefix(db, []byte("2")) + tmpdb := newTempDB(t, backend) + itr := db.IteratePrefix(tmpdb, []byte("2")) checkInvalid(t, itr) }) @@ -25,8 +27,8 @@ func TestPrefixIteratorNoMatchNil(t *testing.T) { func TestPrefixIteratorNoMatch1(t *testing.T) { t.Parallel() - for backend := range backends { - if backend == BoltDBBackend { + for _, backend := range db.BackendList() { + if backend == db.BoltDBBackend { t.Log("bolt does not support concurrent writes while iterating") continue } @@ -34,9 +36,9 @@ func TestPrefixIteratorNoMatch1(t *testing.T) { t.Run(fmt.Sprintf("Prefix w/ backend %s", backend), func(t *testing.T) { t.Parallel() - db := newTempDB(t, backend) - itr := IteratePrefix(db, []byte("2")) - db.SetSync(bz("1"), bz("value_1")) + tmpdb := newTempDB(t, backend) + itr := db.IteratePrefix(tmpdb, []byte("2")) + tmpdb.SetSync(bz("1"), bz("value_1")) checkInvalid(t, itr) }) @@ -47,13 +49,13 @@ func TestPrefixIteratorNoMatch1(t *testing.T) { func TestPrefixIteratorNoMatch2(t *testing.T) { t.Parallel() - for backend := range backends { + for _, backend := range db.BackendList() { t.Run(fmt.Sprintf("Prefix w/ backend %s", backend), func(t *testing.T) { t.Parallel() - db := newTempDB(t, backend) - db.SetSync(bz("3"), bz("value_3")) - itr := IteratePrefix(db, []byte("4")) + tmpdb := newTempDB(t, backend) + tmpdb.SetSync(bz("3"), bz("value_3")) + itr := db.IteratePrefix(tmpdb, []byte("4")) checkInvalid(t, itr) }) @@ -64,13 +66,13 @@ func TestPrefixIteratorNoMatch2(t *testing.T) { func TestPrefixIteratorMatch1(t *testing.T) { t.Parallel() - for backend := range backends { + for _, backend := range db.BackendList() { t.Run(fmt.Sprintf("Prefix w/ backend %s", backend), func(t *testing.T) { t.Parallel() - db := newTempDB(t, backend) - db.SetSync(bz("2"), bz("value_2")) - itr := IteratePrefix(db, bz("2")) + tmpdb := newTempDB(t, backend) + tmpdb.SetSync(bz("2"), bz("value_2")) + itr := db.IteratePrefix(tmpdb, bz("2")) checkValid(t, itr, true) checkItem(t, itr, bz("2"), bz("value_2")) @@ -86,22 +88,22 @@ func TestPrefixIteratorMatch1(t *testing.T) { func TestPrefixIteratorMatches1N(t *testing.T) { t.Parallel() - for backend := range backends { + for _, backend := range db.BackendList() { t.Run(fmt.Sprintf("Prefix w/ backend %s", backend), func(t *testing.T) { t.Parallel() - db := newTempDB(t, backend) + tmpdb := newTempDB(t, backend) // prefixed - db.SetSync(bz("a/1"), bz("value_1")) - db.SetSync(bz("a/3"), bz("value_3")) + tmpdb.SetSync(bz("a/1"), bz("value_1")) + tmpdb.SetSync(bz("a/3"), bz("value_3")) // not - db.SetSync(bz("b/3"), bz("value_3")) - db.SetSync(bz("a-3"), bz("value_3")) - db.SetSync(bz("a.3"), bz("value_3")) - db.SetSync(bz("abcdefg"), bz("value_3")) - itr := IteratePrefix(db, bz("a/")) + tmpdb.SetSync(bz("b/3"), bz("value_3")) + tmpdb.SetSync(bz("a-3"), bz("value_3")) + tmpdb.SetSync(bz("a.3"), bz("value_3")) + tmpdb.SetSync(bz("abcdefg"), bz("value_3")) + itr := db.IteratePrefix(tmpdb, bz("a/")) checkValid(t, itr, true) checkItem(t, itr, bz("a/1"), bz("value_1")) diff --git a/tm2/pkg/iavl/basic_test.go b/tm2/pkg/iavl/basic_test.go index f684209a682..93df41696e1 100644 --- a/tm2/pkg/iavl/basic_test.go +++ b/tm2/pkg/iavl/basic_test.go @@ -10,6 +10,7 @@ import ( "github.com/stretchr/testify/require" "github.com/gnolang/gno/tm2/pkg/db" + _ "github.com/gnolang/gno/tm2/pkg/db/memdb" ) func TestBasic(t *testing.T) { diff --git a/tm2/pkg/iavl/benchmarks/bench_test.go b/tm2/pkg/iavl/benchmarks/bench_test.go index 77ad77eed28..6227270957f 100644 --- a/tm2/pkg/iavl/benchmarks/bench_test.go +++ b/tm2/pkg/iavl/benchmarks/bench_test.go @@ -10,6 +10,7 @@ import ( "github.com/jaekwon/testify/require" "github.com/gnolang/gno/tm2/pkg/db" + _ "github.com/gnolang/gno/tm2/pkg/db/_all" "github.com/gnolang/gno/tm2/pkg/iavl" ) diff --git a/tm2/pkg/iavl/cmd/iaviewer/main.go b/tm2/pkg/iavl/cmd/iaviewer/main.go index 37dca9f74a1..d1742b853c5 100644 --- a/tm2/pkg/iavl/cmd/iaviewer/main.go +++ b/tm2/pkg/iavl/cmd/iaviewer/main.go @@ -10,6 +10,7 @@ import ( "strings" dbm "github.com/gnolang/gno/tm2/pkg/db" + "github.com/gnolang/gno/tm2/pkg/db/goleveldb" "github.com/gnolang/gno/tm2/pkg/iavl" ) @@ -66,7 +67,7 @@ func OpenDB(dir string) (dbm.DB, error) { return nil, fmt.Errorf("cannot cut paths on %s", dir) } name := dir[cut+1:] - db, err := dbm.NewGoLevelDB(name, dir[:cut]) + db, err := goleveldb.NewGoLevelDB(name, dir[:cut]) if err != nil { return nil, err } diff --git a/tm2/pkg/iavl/testutils_test.go b/tm2/pkg/iavl/testutils_test.go index 76c5560cbea..7ae6ba83cbb 100644 --- a/tm2/pkg/iavl/testutils_test.go +++ b/tm2/pkg/iavl/testutils_test.go @@ -11,6 +11,7 @@ import ( "github.com/gnolang/gno/tm2/pkg/amino" "github.com/gnolang/gno/tm2/pkg/db" + _ "github.com/gnolang/gno/tm2/pkg/db/memdb" "github.com/gnolang/gno/tm2/pkg/random" ) diff --git a/tm2/pkg/iavl/with_gcc_test.go b/tm2/pkg/iavl/with_gcc_test.go index 11c8c49d900..83ffea740ba 100644 --- a/tm2/pkg/iavl/with_gcc_test.go +++ b/tm2/pkg/iavl/with_gcc_test.go @@ -10,6 +10,7 @@ import ( "testing" "github.com/gnolang/gno/tm2/pkg/db" + _ "github.com/gnolang/gno/tm2/pkg/db/cleveldb" ) func BenchmarkImmutableAvlTreeCLevelDB(b *testing.B) { diff --git a/tm2/pkg/sdk/auth/test_common.go b/tm2/pkg/sdk/auth/test_common.go index 13b2ee5c55a..f833a0b0564 100644 --- a/tm2/pkg/sdk/auth/test_common.go +++ b/tm2/pkg/sdk/auth/test_common.go @@ -4,7 +4,7 @@ import ( abci "github.com/gnolang/gno/tm2/pkg/bft/abci/types" bft "github.com/gnolang/gno/tm2/pkg/bft/types" "github.com/gnolang/gno/tm2/pkg/crypto" - dbm "github.com/gnolang/gno/tm2/pkg/db" + "github.com/gnolang/gno/tm2/pkg/db/memdb" "github.com/gnolang/gno/tm2/pkg/log" "github.com/gnolang/gno/tm2/pkg/sdk" @@ -20,7 +20,7 @@ type testEnv struct { } func setupTestEnv() testEnv { - db := dbm.NewMemDB() + db := memdb.NewMemDB() authCapKey := store.NewStoreKey("authCapKey") From cec92f6671faa7ce75e4d22fbdd20d6f752d02ce Mon Sep 17 00:00:00 2001 From: Morgan Bazalgette Date: Tue, 30 Jan 2024 14:48:40 +0100 Subject: [PATCH 02/14] refactor(tm2): do not have goleveldb as a transitive dependency --- contribs/gnodev/pkg/dev/node.go | 6 +- tm2/pkg/bft/{proxy => appconn}/app_conn.go | 65 +++++----- .../bft/{proxy => appconn}/multi_app_conn.go | 50 ++++---- tm2/pkg/bft/consensus/reactor.go | 40 +++--- tm2/pkg/bft/consensus/replay.go | 13 +- tm2/pkg/bft/consensus/replay_file.go | 3 +- .../bft/consensus/types/peer_round_state.go | 26 ++++ tm2/pkg/bft/consensus/wal_generator.go | 112 ----------------- tm2/pkg/bft/consensus/wal_test.go | 116 ++++++++++++++++++ tm2/pkg/bft/mempool/clist_mempool.go | 6 +- tm2/pkg/bft/node/node.go | 19 +-- tm2/pkg/bft/rpc/client/localclient.go | 7 +- tm2/pkg/bft/rpc/client/rpc_test.go | 3 +- tm2/pkg/bft/rpc/core/consensus.go | 8 +- tm2/pkg/bft/rpc/core/pipe.go | 23 ++-- tm2/pkg/bft/rpc/core/status.go | 4 +- tm2/pkg/bft/state/execution.go | 10 +- tm2/pkg/bft/types/keys.go | 5 +- 18 files changed, 276 insertions(+), 240 deletions(-) rename tm2/pkg/bft/{proxy => appconn}/app_conn.go (52%) rename tm2/pkg/bft/{proxy => appconn}/multi_app_conn.go (68%) diff --git a/contribs/gnodev/pkg/dev/node.go b/contribs/gnodev/pkg/dev/node.go index c1eddc7c91d..8dcd36cb6bd 100644 --- a/contribs/gnodev/pkg/dev/node.go +++ b/contribs/gnodev/pkg/dev/node.go @@ -66,7 +66,8 @@ func NewDevNode(ctx context.Context, logger *slog.Logger, pkgslist []string) (*N if err != nil { return nil, fmt.Errorf("unable to create the node: %w", err) } - client := client.NewLocal(node) + node.ConfigureRPC() + client := client.NewLocal() if err := node.Start(); err != nil { return nil, fmt.Errorf("unable to start node: %w", err) @@ -239,7 +240,8 @@ func (d *Node) reset(ctx context.Context, genesis gnoland.GnoGenesisState) error } d.Node = node - d.client = client.NewLocal(d.Node) + node.ConfigureRPC() + d.client = client.NewLocal() } // Execute node creation and handle any errors. diff --git a/tm2/pkg/bft/proxy/app_conn.go b/tm2/pkg/bft/appconn/app_conn.go similarity index 52% rename from tm2/pkg/bft/proxy/app_conn.go rename to tm2/pkg/bft/appconn/app_conn.go index 0bb3c76f331..078a7ba1180 100644 --- a/tm2/pkg/bft/proxy/app_conn.go +++ b/tm2/pkg/bft/appconn/app_conn.go @@ -1,4 +1,5 @@ -package proxy +// Package appconn manages the connection of Tendermint to the application layer. +package appconn import ( abcicli "github.com/gnolang/gno/tm2/pkg/bft/abci/client" @@ -8,7 +9,7 @@ import ( //---------------------------------------------------------------------------------------- // Enforce which abci msgs can be sent on a connection at the type level -type AppConnConsensus interface { +type Consensus interface { SetResponseCallback(abcicli.Callback) Error() error @@ -20,7 +21,7 @@ type AppConnConsensus interface { CommitSync() (abci.ResponseCommit, error) } -type AppConnMempool interface { +type Mempool interface { SetResponseCallback(abcicli.Callback) Error() error @@ -30,7 +31,7 @@ type AppConnMempool interface { FlushSync() error } -type AppConnQuery interface { +type Query interface { Error() error EchoSync(string) (abci.ResponseEcho, error) @@ -41,104 +42,104 @@ type AppConnQuery interface { } //----------------------------------------------------------------------------------------- -// Implements AppConnConsensus (subset of abcicli.Client) +// Implements Consensus (subset of abcicli.Client) -type appConnConsensus struct { +type consensus struct { appConn abcicli.Client } -func NewAppConnConsensus(appConn abcicli.Client) *appConnConsensus { - return &appConnConsensus{ +func NewConsensus(appConn abcicli.Client) *consensus { + return &consensus{ appConn: appConn, } } -func (app *appConnConsensus) SetResponseCallback(cb abcicli.Callback) { +func (app *consensus) SetResponseCallback(cb abcicli.Callback) { app.appConn.SetResponseCallback(cb) } -func (app *appConnConsensus) Error() error { +func (app *consensus) Error() error { return app.appConn.Error() } -func (app *appConnConsensus) InitChainSync(req abci.RequestInitChain) (abci.ResponseInitChain, error) { +func (app *consensus) InitChainSync(req abci.RequestInitChain) (abci.ResponseInitChain, error) { return app.appConn.InitChainSync(req) } -func (app *appConnConsensus) BeginBlockSync(req abci.RequestBeginBlock) (abci.ResponseBeginBlock, error) { +func (app *consensus) BeginBlockSync(req abci.RequestBeginBlock) (abci.ResponseBeginBlock, error) { return app.appConn.BeginBlockSync(req) } -func (app *appConnConsensus) DeliverTxAsync(req abci.RequestDeliverTx) *abcicli.ReqRes { +func (app *consensus) DeliverTxAsync(req abci.RequestDeliverTx) *abcicli.ReqRes { return app.appConn.DeliverTxAsync(req) } -func (app *appConnConsensus) EndBlockSync(req abci.RequestEndBlock) (abci.ResponseEndBlock, error) { +func (app *consensus) EndBlockSync(req abci.RequestEndBlock) (abci.ResponseEndBlock, error) { return app.appConn.EndBlockSync(req) } -func (app *appConnConsensus) CommitSync() (abci.ResponseCommit, error) { +func (app *consensus) CommitSync() (abci.ResponseCommit, error) { return app.appConn.CommitSync() } //------------------------------------------------ -// Implements AppConnMempool (subset of abcicli.Client) +// Implements Mempool (subset of abcicli.Client) -type appConnMempool struct { +type mempool struct { appConn abcicli.Client } -func NewAppConnMempool(appConn abcicli.Client) *appConnMempool { - return &appConnMempool{ +func NewMempool(appConn abcicli.Client) *mempool { + return &mempool{ appConn: appConn, } } -func (app *appConnMempool) SetResponseCallback(cb abcicli.Callback) { +func (app *mempool) SetResponseCallback(cb abcicli.Callback) { app.appConn.SetResponseCallback(cb) } -func (app *appConnMempool) Error() error { +func (app *mempool) Error() error { return app.appConn.Error() } -func (app *appConnMempool) FlushAsync() *abcicli.ReqRes { +func (app *mempool) FlushAsync() *abcicli.ReqRes { return app.appConn.FlushAsync() } -func (app *appConnMempool) FlushSync() error { +func (app *mempool) FlushSync() error { return app.appConn.FlushSync() } -func (app *appConnMempool) CheckTxAsync(req abci.RequestCheckTx) *abcicli.ReqRes { +func (app *mempool) CheckTxAsync(req abci.RequestCheckTx) *abcicli.ReqRes { return app.appConn.CheckTxAsync(req) } //------------------------------------------------ -// Implements AppConnQuery (subset of abcicli.Client) +// Implements Query (subset of abcicli.Client) -type appConnQuery struct { +type query struct { appConn abcicli.Client } -func NewAppConnQuery(appConn abcicli.Client) *appConnQuery { - return &appConnQuery{ +func NewQuery(appConn abcicli.Client) *query { + return &query{ appConn: appConn, } } -func (app *appConnQuery) Error() error { +func (app *query) Error() error { return app.appConn.Error() } -func (app *appConnQuery) EchoSync(msg string) (abci.ResponseEcho, error) { +func (app *query) EchoSync(msg string) (abci.ResponseEcho, error) { return app.appConn.EchoSync(msg) } -func (app *appConnQuery) InfoSync(req abci.RequestInfo) (abci.ResponseInfo, error) { +func (app *query) InfoSync(req abci.RequestInfo) (abci.ResponseInfo, error) { return app.appConn.InfoSync(req) } -func (app *appConnQuery) QuerySync(reqQuery abci.RequestQuery) (abci.ResponseQuery, error) { +func (app *query) QuerySync(reqQuery abci.RequestQuery) (abci.ResponseQuery, error) { return app.appConn.QuerySync(reqQuery) } diff --git a/tm2/pkg/bft/proxy/multi_app_conn.go b/tm2/pkg/bft/appconn/multi_app_conn.go similarity index 68% rename from tm2/pkg/bft/proxy/multi_app_conn.go rename to tm2/pkg/bft/appconn/multi_app_conn.go index b820dbcb286..ba241d262a7 100644 --- a/tm2/pkg/bft/proxy/multi_app_conn.go +++ b/tm2/pkg/bft/appconn/multi_app_conn.go @@ -1,6 +1,7 @@ -package proxy +package appconn import ( + abcicli "github.com/gnolang/gno/tm2/pkg/bft/abci/client" "github.com/gnolang/gno/tm2/pkg/errors" "github.com/gnolang/gno/tm2/pkg/service" ) @@ -11,56 +12,61 @@ import ( type AppConns interface { service.Service - Mempool() AppConnMempool - Consensus() AppConnConsensus - Query() AppConnQuery + Mempool() Mempool + Consensus() Consensus + Query() Query +} + +// NewABCIClient returns newly connected client +type ClientCreator interface { + NewABCIClient() (abcicli.Client, error) } func NewAppConns(clientCreator ClientCreator) AppConns { - return NewMultiAppConn(clientCreator) + return NewMulti(clientCreator) } //----------------------------- -// multiAppConn implements AppConns +// multi implements AppConns -// a multiAppConn is made of a few appConns (mempool, consensus, query) +// a multi is made of a few appConns (mempool, consensus, query) // and manages their underlying abci clients // TODO: on app restart, clients must reboot together -type multiAppConn struct { +type multi struct { service.BaseService - mempoolConn *appConnMempool - consensusConn *appConnConsensus - queryConn *appConnQuery + mempoolConn *mempool + consensusConn *consensus + queryConn *query clientCreator ClientCreator } // Make all necessary abci connections to the application -func NewMultiAppConn(clientCreator ClientCreator) *multiAppConn { - multiAppConn := &multiAppConn{ +func NewMulti(clientCreator ClientCreator) *multi { + multi := &multi{ clientCreator: clientCreator, } - multiAppConn.BaseService = *service.NewBaseService(nil, "multiAppConn", multiAppConn) - return multiAppConn + multi.BaseService = *service.NewBaseService(nil, "multi", multi) + return multi } // Returns the mempool connection -func (app *multiAppConn) Mempool() AppConnMempool { +func (app *multi) Mempool() Mempool { return app.mempoolConn } // Returns the consensus Connection -func (app *multiAppConn) Consensus() AppConnConsensus { +func (app *multi) Consensus() Consensus { return app.consensusConn } // Returns the query Connection -func (app *multiAppConn) Query() AppConnQuery { +func (app *multi) Query() Query { return app.queryConn } -func (app *multiAppConn) OnStart() error { +func (app *multi) OnStart() error { // query connection querycli, err := app.clientCreator.NewABCIClient() if err != nil { @@ -70,7 +76,7 @@ func (app *multiAppConn) OnStart() error { if err := querycli.Start(); err != nil { return errors.Wrap(err, "Error starting ABCI client (query connection)") } - app.queryConn = NewAppConnQuery(querycli) + app.queryConn = NewQuery(querycli) // mempool connection memcli, err := app.clientCreator.NewABCIClient() @@ -81,7 +87,7 @@ func (app *multiAppConn) OnStart() error { if err := memcli.Start(); err != nil { return errors.Wrap(err, "Error starting ABCI client (mempool connection)") } - app.mempoolConn = NewAppConnMempool(memcli) + app.mempoolConn = NewMempool(memcli) // consensus connection concli, err := app.clientCreator.NewABCIClient() @@ -92,7 +98,7 @@ func (app *multiAppConn) OnStart() error { if err := concli.Start(); err != nil { return errors.Wrap(err, "Error starting ABCI client (consensus connection)") } - app.consensusConn = NewAppConnConsensus(concli) + app.consensusConn = NewConsensus(concli) return nil } diff --git a/tm2/pkg/bft/consensus/reactor.go b/tm2/pkg/bft/consensus/reactor.go index 27ead3f08f0..07ab5d074c0 100644 --- a/tm2/pkg/bft/consensus/reactor.go +++ b/tm2/pkg/bft/consensus/reactor.go @@ -876,26 +876,14 @@ var ( // PeerState contains the known state of a peer, including its connection and // threadsafe access to its PeerRoundState. -// NOTE: THIS GETS DUMPED WITH rpc/core/consensus.go. +// NOTE: PeerStateExposed gets dumped with rpc/core/consensus.go. // Be mindful of what you Expose. type PeerState struct { peer p2p.Peer logger *slog.Logger - mtx sync.Mutex // NOTE: Modify below using setters, never directly. - PRS cstypes.PeerRoundState `json:"round_state"` // Exposed. - Stats *peerStateStats `json:"stats"` // Exposed. -} - -// peerStateStats holds internal statistics for a peer. -type peerStateStats struct { - Votes int `json:"votes"` - BlockParts int `json:"block_parts"` -} - -func (pss peerStateStats) String() string { - return fmt.Sprintf("peerStateStats{votes: %d, blockParts: %d}", - pss.Votes, pss.BlockParts) + mtx sync.Mutex // NOTE: Modify below using setters, never directly. + cstypes.PeerStateExposed } // NewPeerState returns a new PeerState for the given Peer @@ -903,13 +891,15 @@ func NewPeerState(peer p2p.Peer) *PeerState { return &PeerState{ peer: peer, logger: log.NewNoopLogger(), - PRS: cstypes.PeerRoundState{ - Round: -1, - ProposalPOLRound: -1, - LastCommitRound: -1, - CatchupCommitRound: -1, + PeerStateExposed: cstypes.PeerStateExposed{ + PRS: cstypes.PeerRoundState{ + Round: -1, + ProposalPOLRound: -1, + LastCommitRound: -1, + CatchupCommitRound: -1, + }, + Stats: &cstypes.PeerStateStats{}, }, - Stats: &peerStateStats{}, } } @@ -930,12 +920,14 @@ func (ps *PeerState) GetRoundState() *cstypes.PeerRoundState { return &prs } -// ToJSON returns a json of PeerState, marshalled using go-amino. -func (ps *PeerState) ToJSON() ([]byte, error) { +// GetExposed returns the PeerStateExposed. This method is type-asserted for +// working with rpc/core.go without an import. +// The returned value is read-only. +func (ps *PeerState) GetExposed() cstypes.PeerStateExposed { ps.mtx.Lock() defer ps.mtx.Unlock() - return amino.MarshalJSON(ps) + return ps.PeerStateExposed } // GetHeight returns an atomic snapshot of the PeerRoundState's height diff --git a/tm2/pkg/bft/consensus/replay.go b/tm2/pkg/bft/consensus/replay.go index 103cf67f512..85c6a873095 100644 --- a/tm2/pkg/bft/consensus/replay.go +++ b/tm2/pkg/bft/consensus/replay.go @@ -11,6 +11,7 @@ import ( "golang.org/x/exp/slog" abci "github.com/gnolang/gno/tm2/pkg/bft/abci/types" + "github.com/gnolang/gno/tm2/pkg/bft/appconn" cstypes "github.com/gnolang/gno/tm2/pkg/bft/consensus/types" "github.com/gnolang/gno/tm2/pkg/bft/mempool/mock" "github.com/gnolang/gno/tm2/pkg/bft/proxy" @@ -233,7 +234,7 @@ func (h *Handshaker) NBlocks() int { } // TODO: retry the handshake/replay if it fails ? -func (h *Handshaker) Handshake(proxyApp proxy.AppConns) error { +func (h *Handshaker) Handshake(proxyApp appconn.AppConns) error { // Handshake is done via ABCI Info on the query conn. res, err := proxyApp.Query().InfoSync(abci.RequestInfo{}) if err != nil { @@ -280,7 +281,7 @@ func (h *Handshaker) ReplayBlocks( state sm.State, appHash []byte, appBlockHeight int64, - proxyApp proxy.AppConns, + proxyApp appconn.AppConns, ) ([]byte, error) { storeBlockHeight := h.store.Height() stateBlockHeight := state.LastBlockHeight @@ -393,7 +394,7 @@ func (h *Handshaker) ReplayBlocks( appBlockHeight, storeBlockHeight, stateBlockHeight)) } -func (h *Handshaker) replayBlocks(state sm.State, proxyApp proxy.AppConns, appBlockHeight, storeBlockHeight int64, mutateState bool) ([]byte, error) { +func (h *Handshaker) replayBlocks(state sm.State, proxyApp appconn.AppConns, appBlockHeight, storeBlockHeight int64, mutateState bool) ([]byte, error) { // App is further behind than it should be, so we need to replay blocks. // We replay all blocks from appBlockHeight+1. // @@ -440,7 +441,7 @@ func (h *Handshaker) replayBlocks(state sm.State, proxyApp proxy.AppConns, appBl } // ApplyBlock on the proxyApp with the last block. -func (h *Handshaker) replayBlock(state sm.State, height int64, proxyApp proxy.AppConnConsensus) (sm.State, error) { +func (h *Handshaker) replayBlock(state sm.State, height int64, proxyApp appconn.Consensus) (sm.State, error) { block := h.store.LoadBlock(height) meta := h.store.LoadBlockMeta(height) @@ -484,7 +485,7 @@ Did you reset Tendermint without resetting your application's data?`, // mockProxyApp uses ABCIResponses to give the right results // Useful because we don't want to call Commit() twice for the same block on the real app. -func newMockProxyApp(appHash []byte, abciResponses *sm.ABCIResponses) proxy.AppConnConsensus { +func newMockProxyApp(appHash []byte, abciResponses *sm.ABCIResponses) appconn.Consensus { clientCreator := proxy.NewLocalClientCreator(&mockProxyApp{ appHash: appHash, abciResponses: abciResponses, @@ -494,7 +495,7 @@ func newMockProxyApp(appHash []byte, abciResponses *sm.ABCIResponses) proxy.AppC if err != nil { panic(err) } - return proxy.NewAppConnConsensus(cli) + return appconn.Consensus(cli) } type mockProxyApp struct { diff --git a/tm2/pkg/bft/consensus/replay_file.go b/tm2/pkg/bft/consensus/replay_file.go index 7bfa3de9231..bddc6b429be 100644 --- a/tm2/pkg/bft/consensus/replay_file.go +++ b/tm2/pkg/bft/consensus/replay_file.go @@ -9,6 +9,7 @@ import ( "strconv" "strings" + "github.com/gnolang/gno/tm2/pkg/bft/appconn" cfg "github.com/gnolang/gno/tm2/pkg/bft/config" cnscfg "github.com/gnolang/gno/tm2/pkg/bft/consensus/config" cstypes "github.com/gnolang/gno/tm2/pkg/bft/consensus/types" @@ -301,7 +302,7 @@ func newConsensusStateForReplay(config cfg.BaseConfig, csConfig *cnscfg.Consensu config.ABCI, config.DBDir(), ) - proxyApp := proxy.NewAppConns(clientCreator) + proxyApp := appconn.NewAppConns(clientCreator) err = proxyApp.Start() if err != nil { osm.Exit(fmt.Sprintf("Error starting proxy app conns: %v", err)) diff --git a/tm2/pkg/bft/consensus/types/peer_round_state.go b/tm2/pkg/bft/consensus/types/peer_round_state.go index f92528657ba..3a569c43d7e 100644 --- a/tm2/pkg/bft/consensus/types/peer_round_state.go +++ b/tm2/pkg/bft/consensus/types/peer_round_state.go @@ -4,6 +4,7 @@ import ( "fmt" "time" + "github.com/gnolang/gno/tm2/pkg/amino" "github.com/gnolang/gno/tm2/pkg/bft/types" "github.com/gnolang/gno/tm2/pkg/bitarray" ) @@ -55,3 +56,28 @@ func (prs PeerRoundState) StringIndented(indent string) string { indent, prs.CatchupCommit, prs.CatchupCommitRound, indent) } + +//----------------------------------------------------------------------------- + +// PeerStateExposed represents the exposed information about a peer. +// NOTE: This gets dumped with rpc/core/consensus.go. Be mindful of what you expose. +type PeerStateExposed struct { + PRS PeerRoundState `json:"round_state"` // Exposed. + Stats *PeerStateStats `json:"stats"` // Exposed. +} + +// ToJSON returns a json of PeerState, marshalled using go-amino. +func (ps PeerStateExposed) ToJSON() ([]byte, error) { + return amino.MarshalJSON(ps) +} + +// PeerStateStats holds internal statistics for a peer. +type PeerStateStats struct { + Votes int `json:"votes"` + BlockParts int `json:"block_parts"` +} + +func (pss PeerStateStats) String() string { + return fmt.Sprintf("PeerStateStats{votes: %d, blockParts: %d}", + pss.Votes, pss.BlockParts) +} diff --git a/tm2/pkg/bft/consensus/wal_generator.go b/tm2/pkg/bft/consensus/wal_generator.go index 7958aaa35b0..b919559d841 100644 --- a/tm2/pkg/bft/consensus/wal_generator.go +++ b/tm2/pkg/bft/consensus/wal_generator.go @@ -1,130 +1,18 @@ package consensus import ( - "bufio" - "bytes" "fmt" "io" - "path/filepath" "testing" "time" "golang.org/x/exp/slog" - "github.com/gnolang/gno/tm2/pkg/bft/abci/example/kvstore" cfg "github.com/gnolang/gno/tm2/pkg/bft/config" - "github.com/gnolang/gno/tm2/pkg/bft/mempool/mock" - "github.com/gnolang/gno/tm2/pkg/bft/privval" - "github.com/gnolang/gno/tm2/pkg/bft/proxy" - sm "github.com/gnolang/gno/tm2/pkg/bft/state" - "github.com/gnolang/gno/tm2/pkg/bft/store" - "github.com/gnolang/gno/tm2/pkg/bft/types" walm "github.com/gnolang/gno/tm2/pkg/bft/wal" - "github.com/gnolang/gno/tm2/pkg/db/memdb" - "github.com/gnolang/gno/tm2/pkg/errors" - "github.com/gnolang/gno/tm2/pkg/events" - "github.com/gnolang/gno/tm2/pkg/log" "github.com/gnolang/gno/tm2/pkg/random" ) -// WALGenerateNBlocks generates a consensus WAL. It does this by spinning up a -// stripped down version of node (proxy app, event bus, consensus state) with a -// persistent kvstore application and special consensus wal instance -// (heightStopWAL) and waits until numBlocks are created. If the node fails to produce given numBlocks, it returns an error. -func WALGenerateNBlocks(t *testing.T, wr io.Writer, numBlocks int) (err error) { - t.Helper() - - config := getConfig(t) - - app := kvstore.NewPersistentKVStoreApplication(filepath.Join(config.DBDir(), "wal_generator")) - defer app.Close() - - logger := log.NewNoopLogger().With("wal_generator", "wal_generator") - logger.Info("generating WAL (last height msg excluded)", "numBlocks", numBlocks) - - // ----------- - // COPY PASTE FROM node.go WITH A FEW MODIFICATIONS - // NOTE: we can't import node package because of circular dependency. - // NOTE: we don't do handshake so need to set state.Version.Consensus.App directly. - privValidatorKeyFile := config.PrivValidatorKeyFile() - privValidatorStateFile := config.PrivValidatorStateFile() - privValidator := privval.LoadOrGenFilePV(privValidatorKeyFile, privValidatorStateFile) - genDoc, err := types.GenesisDocFromFile(config.GenesisFile()) - if err != nil { - return errors.Wrap(err, "failed to read genesis file") - } - blockStoreDB := memdb.NewMemDB() - stateDB := blockStoreDB - state, err := sm.MakeGenesisState(genDoc) - if err != nil { - return errors.Wrap(err, "failed to make genesis state") - } - state.AppVersion = kvstore.AppVersion - sm.SaveState(stateDB, state) - blockStore := store.NewBlockStore(blockStoreDB) - - proxyApp := proxy.NewAppConns(proxy.NewLocalClientCreator(app)) - proxyApp.SetLogger(logger.With("module", "proxy")) - if err := proxyApp.Start(); err != nil { - return errors.Wrap(err, "failed to start proxy app connections") - } - defer proxyApp.Stop() - - evsw := events.NewEventSwitch() - evsw.SetLogger(logger.With("module", "events")) - if err := evsw.Start(); err != nil { - return errors.Wrap(err, "failed to start event bus") - } - defer evsw.Stop() - mempool := mock.Mempool{} - blockExec := sm.NewBlockExecutor(stateDB, log.NewNoopLogger(), proxyApp.Consensus(), mempool) - consensusState := NewConsensusState(config.Consensus, state.Copy(), blockExec, blockStore, mempool) - consensusState.SetLogger(logger) - consensusState.SetEventSwitch(evsw) - if privValidator != nil { - consensusState.SetPrivValidator(privValidator) - } - // END OF COPY PASTE - // ----------- - - // set consensus wal to buffered WAL, which will write all incoming msgs to buffer - numBlocksWritten := make(chan struct{}) - wal := newHeightStopWAL(logger, walm.NewWALWriter(wr, maxMsgSize), int64(numBlocks)+1, numBlocksWritten) - // See wal.go OnStart(). - // Since we separate the WALWriter from the WAL, we need to - // initialize ourself. - wal.WriteMetaSync(walm.MetaMessage{Height: 1}) - consensusState.wal = wal - - if err := consensusState.Start(); err != nil { - return errors.Wrap(err, "failed to start consensus state") - } - - select { - case <-numBlocksWritten: - consensusState.Stop() - return nil - case <-time.After(2 * time.Minute): - consensusState.Stop() - return fmt.Errorf("waited too long for tendermint to produce %d blocks (grep logs for `wal_generator`)", numBlocks) - } -} - -// WALWithNBlocks returns a WAL content with numBlocks. -func WALWithNBlocks(t *testing.T, numBlocks int) (data []byte, err error) { - t.Helper() - - var b bytes.Buffer - wr := bufio.NewWriter(&b) - - if err := WALGenerateNBlocks(t, wr, numBlocks); err != nil { - return []byte{}, err - } - - wr.Flush() - return b.Bytes(), nil -} - func randPort() int { // returns between base and base + spread base, spread := 20000, 20000 diff --git a/tm2/pkg/bft/consensus/wal_test.go b/tm2/pkg/bft/consensus/wal_test.go index b5d49dd6354..15c17f79c22 100644 --- a/tm2/pkg/bft/consensus/wal_test.go +++ b/tm2/pkg/bft/consensus/wal_test.go @@ -1,6 +1,10 @@ package consensus import ( + "bufio" + "bytes" + "fmt" + "io" "path/filepath" "testing" "time" @@ -9,7 +13,17 @@ import ( "github.com/stretchr/testify/require" auto "github.com/gnolang/gno/tm2/pkg/autofile" + "github.com/gnolang/gno/tm2/pkg/bft/abci/example/kvstore" + "github.com/gnolang/gno/tm2/pkg/bft/mempool/mock" + "github.com/gnolang/gno/tm2/pkg/bft/privval" + "github.com/gnolang/gno/tm2/pkg/bft/proxy" + sm "github.com/gnolang/gno/tm2/pkg/bft/state" + "github.com/gnolang/gno/tm2/pkg/bft/store" + "github.com/gnolang/gno/tm2/pkg/bft/types" walm "github.com/gnolang/gno/tm2/pkg/bft/wal" + "github.com/gnolang/gno/tm2/pkg/db/memdb" + "github.com/gnolang/gno/tm2/pkg/errors" + "github.com/gnolang/gno/tm2/pkg/events" "github.com/gnolang/gno/tm2/pkg/log" ) @@ -84,3 +98,105 @@ func TestWALTruncate(t *testing.T) { assert.True(t, ok, "expected message of type EventRoundState") assert.Equal(t, rs.Height, h+1, "wrong height") } + +// XXX: WALGenerateNBlocks and WALWithNBlocks were removed from wal_generator.go +// as they are unused. +// If you intend to use them, please move them to a separate package. + +// WALGenerateNBlocks generates a consensus WAL. It does this by spinning up a +// stripped down version of node (proxy app, event bus, consensus state) with a +// persistent kvstore application and special consensus wal instance +// (heightStopWAL) and waits until numBlocks are created. If the node fails to produce given numBlocks, it returns an error. +func WALGenerateNBlocks(t *testing.T, wr io.Writer, numBlocks int) (err error) { + t.Helper() + + config := getConfig(t) + + app := kvstore.NewPersistentKVStoreApplication(filepath.Join(config.DBDir(), "wal_generator")) + defer app.Close() + + logger := log.NewNoopLogger().With("wal_generator", "wal_generator") + logger.Info("generating WAL (last height msg excluded)", "numBlocks", numBlocks) + + // ----------- + // COPY PASTE FROM node.go WITH A FEW MODIFICATIONS + // NOTE: we can't import node package because of circular dependency. + // NOTE: we don't do handshake so need to set state.Version.Consensus.App directly. + privValidatorKeyFile := config.PrivValidatorKeyFile() + privValidatorStateFile := config.PrivValidatorStateFile() + privValidator := privval.LoadOrGenFilePV(privValidatorKeyFile, privValidatorStateFile) + genDoc, err := types.GenesisDocFromFile(config.GenesisFile()) + if err != nil { + return errors.Wrap(err, "failed to read genesis file") + } + blockStoreDB := memdb.NewMemDB() + stateDB := blockStoreDB + state, err := sm.MakeGenesisState(genDoc) + if err != nil { + return errors.Wrap(err, "failed to make genesis state") + } + state.AppVersion = kvstore.AppVersion + sm.SaveState(stateDB, state) + blockStore := store.NewBlockStore(blockStoreDB) + + proxyApp := proxy.NewAppConns(proxy.NewLocalClientCreator(app)) + proxyApp.SetLogger(logger.With("module", "proxy")) + if err := proxyApp.Start(); err != nil { + return errors.Wrap(err, "failed to start proxy app connections") + } + defer proxyApp.Stop() + + evsw := events.NewEventSwitch() + evsw.SetLogger(logger.With("module", "events")) + if err := evsw.Start(); err != nil { + return errors.Wrap(err, "failed to start event bus") + } + defer evsw.Stop() + mempool := mock.Mempool{} + blockExec := sm.NewBlockExecutor(stateDB, log.NewNoopLogger(), proxyApp.Consensus(), mempool) + consensusState := NewConsensusState(config.Consensus, state.Copy(), blockExec, blockStore, mempool) + consensusState.SetLogger(logger) + consensusState.SetEventSwitch(evsw) + if privValidator != nil { + consensusState.SetPrivValidator(privValidator) + } + // END OF COPY PASTE + // ----------- + + // set consensus wal to buffered WAL, which will write all incoming msgs to buffer + numBlocksWritten := make(chan struct{}) + wal := newHeightStopWAL(logger, walm.NewWALWriter(wr, maxMsgSize), int64(numBlocks)+1, numBlocksWritten) + // See wal.go OnStart(). + // Since we separate the WALWriter from the WAL, we need to + // initialize ourself. + wal.WriteMetaSync(walm.MetaMessage{Height: 1}) + consensusState.wal = wal + + if err := consensusState.Start(); err != nil { + return errors.Wrap(err, "failed to start consensus state") + } + + select { + case <-numBlocksWritten: + consensusState.Stop() + return nil + case <-time.After(2 * time.Minute): + consensusState.Stop() + return fmt.Errorf("waited too long for tendermint to produce %d blocks (grep logs for `wal_generator`)", numBlocks) + } +} + +// WALWithNBlocks returns a WAL content with numBlocks. +func WALWithNBlocks(t *testing.T, numBlocks int) (data []byte, err error) { + t.Helper() + + var b bytes.Buffer + wr := bufio.NewWriter(&b) + + if err := WALGenerateNBlocks(t, wr, numBlocks); err != nil { + return []byte{}, err + } + + wr.Flush() + return b.Bytes(), nil +} diff --git a/tm2/pkg/bft/mempool/clist_mempool.go b/tm2/pkg/bft/mempool/clist_mempool.go index da0a2c22c11..ef6f77339b0 100644 --- a/tm2/pkg/bft/mempool/clist_mempool.go +++ b/tm2/pkg/bft/mempool/clist_mempool.go @@ -13,8 +13,8 @@ import ( auto "github.com/gnolang/gno/tm2/pkg/autofile" abci "github.com/gnolang/gno/tm2/pkg/bft/abci/types" + "github.com/gnolang/gno/tm2/pkg/bft/appconn" cfg "github.com/gnolang/gno/tm2/pkg/bft/mempool/config" - "github.com/gnolang/gno/tm2/pkg/bft/proxy" "github.com/gnolang/gno/tm2/pkg/bft/types" "github.com/gnolang/gno/tm2/pkg/clist" "github.com/gnolang/gno/tm2/pkg/errors" @@ -34,7 +34,7 @@ type CListMempool struct { config *cfg.MempoolConfig mtx sync.Mutex - proxyAppConn proxy.AppConnMempool + proxyAppConn appconn.Mempool txs *clist.CList // concurrent linked-list of good txs preCheck PreCheckFunc height int64 // the last block Update()'d to @@ -76,7 +76,7 @@ type CListMempoolOption func(*CListMempool) // NewCListMempool returns a new mempool with the given configuration and connection to an application. func NewCListMempool( config *cfg.MempoolConfig, - proxyAppConn proxy.AppConnMempool, + proxyAppConn appconn.Mempool, height int64, maxTxBytes int64, options ...CListMempoolOption, diff --git a/tm2/pkg/bft/node/node.go b/tm2/pkg/bft/node/node.go index a6c67fa2485..665e2b8bf7d 100644 --- a/tm2/pkg/bft/node/node.go +++ b/tm2/pkg/bft/node/node.go @@ -13,6 +13,7 @@ import ( "golang.org/x/exp/slog" + "github.com/gnolang/gno/tm2/pkg/bft/appconn" "github.com/gnolang/gno/tm2/pkg/bft/state/eventstore/file" "github.com/rs/cors" @@ -164,7 +165,7 @@ type Node struct { mempool mempl.Mempool consensusState *cs.ConsensusState // latest consensus state consensusReactor *cs.ConsensusReactor // for participating in the consensus - proxyApp proxy.AppConns // connection to the application + proxyApp appconn.AppConns // connection to the application rpcListeners []net.Listener // rpc servers txEventStore eventstore.TxEventStore eventStoreService *eventstore.Service @@ -186,8 +187,8 @@ func initDBs(config *cfg.Config, dbProvider DBProvider) (blockStore *store.Block return } -func createAndStartProxyAppConns(clientCreator proxy.ClientCreator, logger *slog.Logger) (proxy.AppConns, error) { - proxyApp := proxy.NewAppConns(clientCreator) +func createAndStartProxyAppConns(clientCreator proxy.ClientCreator, logger *slog.Logger) (appconn.AppConns, error) { + proxyApp := appconn.NewAppConns(clientCreator) proxyApp.SetLogger(logger.With("module", "proxy")) if err := proxyApp.Start(); err != nil { return nil, fmt.Errorf("error starting proxy app connections: %w", err) @@ -228,7 +229,7 @@ func createAndStartEventStoreService( } func doHandshake(stateDB dbm.DB, state sm.State, blockStore sm.BlockStore, - genDoc *types.GenesisDoc, evsw events.EventSwitch, proxyApp proxy.AppConns, consensusLogger *slog.Logger, + genDoc *types.GenesisDoc, evsw events.EventSwitch, proxyApp appconn.AppConns, consensusLogger *slog.Logger, ) error { handshaker := cs.NewHandshaker(stateDB, state, blockStore, genDoc) handshaker.SetLogger(consensusLogger) @@ -262,7 +263,7 @@ func onlyValidatorIsUs(state sm.State, privVal types.PrivValidator) bool { return privVal.GetPubKey().Address() == addr } -func createMempoolAndMempoolReactor(config *cfg.Config, proxyApp proxy.AppConns, +func createMempoolAndMempoolReactor(config *cfg.Config, proxyApp appconn.AppConns, state sm.State, logger *slog.Logger, ) (*mempl.Reactor, *mempl.CListMempool) { mempool := mempl.NewCListMempool( @@ -324,7 +325,7 @@ func createConsensusReactor(config *cfg.Config, return consensusReactor, consensusState } -func createTransport(config *cfg.Config, nodeInfo p2p.NodeInfo, nodeKey *p2p.NodeKey, proxyApp proxy.AppConns) (*p2p.MultiplexTransport, []p2p.PeerFilterFunc) { +func createTransport(config *cfg.Config, nodeInfo p2p.NodeInfo, nodeKey *p2p.NodeKey, proxyApp appconn.AppConns) (*p2p.MultiplexTransport, []p2p.PeerFilterFunc) { var ( mConnConfig = p2p.MConnConfig(config.P2P) transport = p2p.NewMultiplexTransport(nodeInfo, *nodeKey, mConnConfig) @@ -411,7 +412,7 @@ func createSwitch(config *cfg.Config, func NewNode(config *cfg.Config, privValidator types.PrivValidator, nodeKey *p2p.NodeKey, - clientCreator proxy.ClientCreator, + clientCreator appconn.ClientCreator, genesisDocProvider GenesisDocProvider, dbProvider DBProvider, logger *slog.Logger, @@ -666,7 +667,7 @@ func (n *Node) ConfigureRPC() { rpccore.SetPubKey(pubKey) rpccore.SetGenesisDoc(n.genesisDoc) rpccore.SetProxyAppQuery(n.proxyApp.Query()) - rpccore.SetConsensusReactor(n.consensusReactor) + rpccore.SetGetFastSync(n.consensusReactor.FastSync) rpccore.SetLogger(n.Logger.With("module", "rpc")) rpccore.SetEventSwitch(n.evsw) rpccore.SetConfig(*n.config.RPC) @@ -811,7 +812,7 @@ func (n *Node) GenesisDoc() *types.GenesisDoc { } // ProxyApp returns the Node's AppConns, representing its connections to the ABCI application. -func (n *Node) ProxyApp() proxy.AppConns { +func (n *Node) ProxyApp() appconn.AppConns { return n.proxyApp } diff --git a/tm2/pkg/bft/rpc/client/localclient.go b/tm2/pkg/bft/rpc/client/localclient.go index 15e2b916c71..47979543db3 100644 --- a/tm2/pkg/bft/rpc/client/localclient.go +++ b/tm2/pkg/bft/rpc/client/localclient.go @@ -3,7 +3,6 @@ package client import ( "golang.org/x/exp/slog" - nm "github.com/gnolang/gno/tm2/pkg/bft/node" "github.com/gnolang/gno/tm2/pkg/bft/rpc/core" ctypes "github.com/gnolang/gno/tm2/pkg/bft/rpc/core/types" rpctypes "github.com/gnolang/gno/tm2/pkg/bft/rpc/lib/types" @@ -36,8 +35,10 @@ type Local struct { // you can only have one node per process. So make sure test cases // don't run in parallel, or try to simulate an entire network in // one process... -func NewLocal(node *nm.Node) *Local { - node.ConfigureRPC() +// +// Before using a Local client, callers are responsible for calling +// Node.ConfigureRPC(). +func NewLocal() *Local { return &Local{ Logger: log.NewNoopLogger(), ctx: &rpctypes.Context{}, diff --git a/tm2/pkg/bft/rpc/client/rpc_test.go b/tm2/pkg/bft/rpc/client/rpc_test.go index e09ae8d4466..514062b5120 100644 --- a/tm2/pkg/bft/rpc/client/rpc_test.go +++ b/tm2/pkg/bft/rpc/client/rpc_test.go @@ -23,7 +23,8 @@ func getHTTPClient() *client.HTTP { } func getLocalClient() *client.Local { - return client.NewLocal(node) + node.ConfigureRPC() + return client.NewLocal() } // GetClients returns a slice of clients for table-driven tests diff --git a/tm2/pkg/bft/rpc/core/consensus.go b/tm2/pkg/bft/rpc/core/consensus.go index a552252f8c0..e87e6b526d3 100644 --- a/tm2/pkg/bft/rpc/core/consensus.go +++ b/tm2/pkg/bft/rpc/core/consensus.go @@ -1,7 +1,7 @@ package core import ( - cm "github.com/gnolang/gno/tm2/pkg/bft/consensus" + cstypes "github.com/gnolang/gno/tm2/pkg/bft/consensus/types" ctypes "github.com/gnolang/gno/tm2/pkg/bft/rpc/core/types" rpctypes "github.com/gnolang/gno/tm2/pkg/bft/rpc/lib/types" sm "github.com/gnolang/gno/tm2/pkg/bft/state" @@ -217,11 +217,13 @@ func DumpConsensusState(ctx *rpctypes.Context) (*ctypes.ResultDumpConsensusState peers := p2pPeers.Peers().List() peerStates := make([]ctypes.PeerStateInfo, len(peers)) for i, peer := range peers { - peerState, ok := peer.Get(types.PeerStateKey).(*cm.PeerState) + peerState, ok := peer.Get(types.PeerStateKey).(interface { + GetExposed() cstypes.PeerStateExposed + }) if !ok { // peer does not have a state yet continue } - peerStateJSON, err := peerState.ToJSON() + peerStateJSON, err := peerState.GetExposed().ToJSON() if err != nil { return nil, err } diff --git a/tm2/pkg/bft/rpc/core/pipe.go b/tm2/pkg/bft/rpc/core/pipe.go index 977dfd54e1f..3a9b57b082e 100644 --- a/tm2/pkg/bft/rpc/core/pipe.go +++ b/tm2/pkg/bft/rpc/core/pipe.go @@ -5,11 +5,10 @@ import ( "golang.org/x/exp/slog" - "github.com/gnolang/gno/tm2/pkg/bft/consensus" + "github.com/gnolang/gno/tm2/pkg/bft/appconn" cnscfg "github.com/gnolang/gno/tm2/pkg/bft/consensus/config" cstypes "github.com/gnolang/gno/tm2/pkg/bft/consensus/types" mempl "github.com/gnolang/gno/tm2/pkg/bft/mempool" - "github.com/gnolang/gno/tm2/pkg/bft/proxy" cfg "github.com/gnolang/gno/tm2/pkg/bft/rpc/config" sm "github.com/gnolang/gno/tm2/pkg/bft/state" "github.com/gnolang/gno/tm2/pkg/bft/types" @@ -56,7 +55,7 @@ type peers interface { var ( // external, thread safe interfaces - proxyAppQuery proxy.AppConnQuery + proxyAppQuery appconn.Query // interfaces defined in types and above stateDB dbm.DB @@ -66,12 +65,12 @@ var ( p2pTransport transport // objects - pubKey crypto.PubKey - genDoc *types.GenesisDoc // cache the genesis structure - consensusReactor *consensus.ConsensusReactor - evsw events.EventSwitch - gTxDispatcher *txDispatcher - mempool mempl.Mempool + pubKey crypto.PubKey + genDoc *types.GenesisDoc // cache the genesis structure + evsw events.EventSwitch + gTxDispatcher *txDispatcher + mempool mempl.Mempool + getFastSync func() bool // avoids dependency on consensus pkg logger *slog.Logger @@ -110,12 +109,12 @@ func SetGenesisDoc(doc *types.GenesisDoc) { genDoc = doc } -func SetProxyAppQuery(appConn proxy.AppConnQuery) { +func SetProxyAppQuery(appConn appconn.Query) { proxyAppQuery = appConn } -func SetConsensusReactor(conR *consensus.ConsensusReactor) { - consensusReactor = conR +func SetGetFastSync(v func() bool) { + getFastSync = v } func SetLogger(l *slog.Logger) { diff --git a/tm2/pkg/bft/rpc/core/status.go b/tm2/pkg/bft/rpc/core/status.go index 5aaf0761ea1..9bc5f3ea6fc 100644 --- a/tm2/pkg/bft/rpc/core/status.go +++ b/tm2/pkg/bft/rpc/core/status.go @@ -74,7 +74,7 @@ import ( // ``` func Status(ctx *rpctypes.Context) (*ctypes.ResultStatus, error) { var latestHeight int64 - if consensusReactor.FastSync() { + if getFastSync() { latestHeight = blockStore.Height() } else { latestHeight = consensusState.GetLastHeight() @@ -106,7 +106,7 @@ func Status(ctx *rpctypes.Context) (*ctypes.ResultStatus, error) { LatestAppHash: latestAppHash, LatestBlockHeight: latestHeight, LatestBlockTime: latestBlockTime, - CatchingUp: consensusReactor.FastSync(), + CatchingUp: getFastSync(), }, ValidatorInfo: ctypes.ValidatorInfo{ Address: pubKey.Address(), diff --git a/tm2/pkg/bft/state/execution.go b/tm2/pkg/bft/state/execution.go index d831fc3678e..496a1c74935 100644 --- a/tm2/pkg/bft/state/execution.go +++ b/tm2/pkg/bft/state/execution.go @@ -7,9 +7,9 @@ import ( "github.com/gnolang/gno/tm2/pkg/amino" abci "github.com/gnolang/gno/tm2/pkg/bft/abci/types" + "github.com/gnolang/gno/tm2/pkg/bft/appconn" "github.com/gnolang/gno/tm2/pkg/bft/fail" mempl "github.com/gnolang/gno/tm2/pkg/bft/mempool" - "github.com/gnolang/gno/tm2/pkg/bft/proxy" "github.com/gnolang/gno/tm2/pkg/bft/types" typesver "github.com/gnolang/gno/tm2/pkg/bft/types/version" tmver "github.com/gnolang/gno/tm2/pkg/bft/version" @@ -29,7 +29,7 @@ type BlockExecutor struct { db dbm.DB // execute the app against this - proxyApp proxy.AppConnConsensus + proxyApp appconn.Consensus // events evsw events.EventSwitch @@ -45,7 +45,7 @@ type BlockExecutorOption func(executor *BlockExecutor) // NewBlockExecutor returns a new BlockExecutor with a NopEventBus. // Call SetEventBus to provide one. -func NewBlockExecutor(db dbm.DB, logger *slog.Logger, proxyApp proxy.AppConnConsensus, mempool mempl.Mempool, options ...BlockExecutorOption) *BlockExecutor { +func NewBlockExecutor(db dbm.DB, logger *slog.Logger, proxyApp appconn.Consensus, mempool mempl.Mempool, options ...BlockExecutorOption) *BlockExecutor { res := &BlockExecutor{ db: db, proxyApp: proxyApp, @@ -208,7 +208,7 @@ func (blockExec *BlockExecutor) Commit( // Returns a list of transaction results and updates to the validator set func execBlockOnProxyApp( logger *slog.Logger, - proxyAppConn proxy.AppConnConsensus, + proxyAppConn appconn.Consensus, block *types.Block, stateDB dbm.DB, ) (*ABCIResponses, error) { @@ -432,7 +432,7 @@ func fireEvents(evsw events.EventSwitch, block *types.Block, abciResponses *ABCI // ExecCommitBlock executes and commits a block on the proxyApp without validating or mutating the state. // It returns the application root hash (result of abci.Commit). func ExecCommitBlock( - appConnConsensus proxy.AppConnConsensus, + appConnConsensus appconn.Consensus, block *types.Block, logger *slog.Logger, stateDB dbm.DB, diff --git a/tm2/pkg/bft/types/keys.go b/tm2/pkg/bft/types/keys.go index 941e82b65b0..dfd49ef9b42 100644 --- a/tm2/pkg/bft/types/keys.go +++ b/tm2/pkg/bft/types/keys.go @@ -1,6 +1,5 @@ package types // UNSTABLE -var ( - PeerStateKey = "ConsensusReactor.peerState" -) +// PeerStateKey allows to get the *consensus.PeerState from a [github.com/gnolang/gno/tm2/pkg/p2p.Peer]. +const PeerStateKey = "ConsensusReactor.peerState" From 3bf09e5fa17d005fa0e17abdd8d4c62a4e7c8aa0 Mon Sep 17 00:00:00 2001 From: Morgan Bazalgette Date: Tue, 30 Jan 2024 14:56:54 +0100 Subject: [PATCH 03/14] mod tidy --- contribs/gnodev/go.mod | 15 ----- contribs/gnodev/go.sum | 116 ------------------------------------ contribs/gnokeykc/go.mod | 16 +---- contribs/gnokeykc/go.sum | 115 ------------------------------------ go.mod | 15 ----- go.sum | 112 ----------------------------------- misc/loop/go.mod | 17 ------ misc/loop/go.sum | 124 --------------------------------------- 8 files changed, 1 insertion(+), 529 deletions(-) diff --git a/contribs/gnodev/go.mod b/contribs/gnodev/go.mod index 71838979ec4..55e6db62265 100644 --- a/contribs/gnodev/go.mod +++ b/contribs/gnodev/go.mod @@ -16,34 +16,22 @@ require ( dario.cat/mergo v1.0.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect github.com/btcsuite/btcd/btcutil v1.1.3 // indirect - github.com/cespare/xxhash v1.1.0 // indirect - github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/cockroachdb/apd/v3 v3.2.1 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect - github.com/dgraph-io/badger/v3 v3.2103.5 // indirect - github.com/dgraph-io/ristretto v0.1.1 // indirect - github.com/dustin/go-humanize v1.0.0 // indirect github.com/gnolang/goleveldb v0.0.9 // indirect github.com/gnolang/overflow v0.0.0-20170615021017-4d914c927216 // indirect - github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/glog v1.1.0 // indirect - github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.4 // indirect - github.com/google/flatbuffers v1.12.1 // indirect github.com/gorilla/mux v1.8.1 // indirect github.com/gorilla/securecookie v1.1.1 // indirect github.com/gorilla/sessions v1.2.1 // indirect github.com/gorilla/websocket v1.5.1 // indirect github.com/gotuna/gotuna v0.6.0 // indirect github.com/jaekwon/testify v1.6.1 // indirect - github.com/jmhodges/levigo v1.0.0 // indirect - github.com/klauspost/compress v1.12.3 // indirect github.com/kr/pretty v0.2.1 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect - github.com/linxGnu/grocksdb v1.8.11 // indirect github.com/pelletier/go-toml v1.9.5 // indirect github.com/peterbourgon/ff/v3 v3.4.0 // indirect github.com/pkg/errors v0.9.1 // indirect @@ -51,11 +39,8 @@ require ( github.com/rogpeppe/go-internal v1.11.0 // indirect github.com/rs/cors v1.10.1 // indirect github.com/stretchr/testify v1.8.4 // indirect - github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect github.com/zondax/hid v0.9.2 // indirect github.com/zondax/ledger-go v0.14.3 // indirect - go.etcd.io/bbolt v1.3.8 // indirect - go.opencensus.io v0.22.5 // indirect go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.10.0 // indirect go.uber.org/zap/exp v0.1.0 // indirect diff --git a/contribs/gnodev/go.sum b/contribs/gnodev/go.sum index ca5774fa7ad..4a583333ffc 100644 --- a/contribs/gnodev/go.sum +++ b/contribs/gnodev/go.sum @@ -1,11 +1,6 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M= @@ -31,20 +26,10 @@ github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= -github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cockroachdb/apd/v3 v3.2.1 h1:U+8j7t0axsIgvQUqthuNm82HIrYXodOV2iWLWtEaIwg= github.com/cockroachdb/apd/v3 v3.2.1/go.mod h1:klXJcjp+FffLTHlhIG69tezTDvdP065naDsHzKhYSqc= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= -github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -55,17 +40,6 @@ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeC github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= -github.com/dgraph-io/badger/v3 v3.2103.5 h1:ylPa6qzbjYRQMU6jokoj4wzcaweHylt//CH0AKt0akg= -github.com/dgraph-io/badger/v3 v3.2103.5/go.mod h1:4MPiseMeDQ3FNCYwRbbcBOGJLf5jsE0PPFzRiKjtcdw= -github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8= -github.com/dgraph-io/ristretto v0.1.1/go.mod h1:S1GPSBCYCIhmVNfcth17y2zZtQT6wzkzgwUve0VDWWA= -github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA= -github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0= -github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= -github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= @@ -75,16 +49,7 @@ github.com/gnolang/goleveldb v0.0.9 h1:Q7rGko9oXMKtQA+Apeeed5a3sjba/mcDhzJGoTVLC github.com/gnolang/goleveldb v0.0.9/go.mod h1:Dz6p9bmpy/FBESTgduiThZt5mToVDipcHGzj/zUOo8E= github.com/gnolang/overflow v0.0.0-20170615021017-4d914c927216 h1:GKvsK3oLWG9B1GL7WP/VqwM6C92j5tIvB844oggL9Lk= github.com/gnolang/overflow v0.0.0-20170615021017-4d914c927216/go.mod h1:xJhtEL7ahjM1WJipt89gel8tHzfIl/LyMY+lCYh38d8= -github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= -github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= -github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 h1:ZgQEtGgCBiWRM39fZuwSd1LwSqqSW0hOdXCYYDX0R3I= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= @@ -94,15 +59,11 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/flatbuffers v1.12.1 h1:MVlul7pQNoDzWRLTw5imwYsl+usrS1TXG2H4jg6ImGw= -github.com/google/flatbuffers v1.12.1/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= @@ -118,22 +79,14 @@ github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/ github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= github.com/gotuna/gotuna v0.6.0 h1:N1lQKXEi/lwRp8u3sccTYLhzOffA4QasExz/1M5Riws= github.com/gotuna/gotuna v0.6.0/go.mod h1:F/ecRt29ChB6Ycy1AFIBpBiMNK0j7Heq+gFbLWquhjc= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jaekwon/testify v1.6.1 h1:4AtAJcR9GzXN5W4DdY7ie74iCPiJV1JJUJL90t2ZUyw= github.com/jaekwon/testify v1.6.1/go.mod h1:Oun0RXIHI7osufabQ60i4Lqkj0GXLbqI1I7kgzBNm1U= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= -github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/klauspost/compress v1.12.3 h1:G5AfA94pHPysR56qqrkO2pxEexdDzrpFJ6yt/VqWxVU= -github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -143,10 +96,6 @@ github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= github.com/linxGnu/grocksdb v1.8.11 h1:BGol9e5gB1BrsTvOxloC88pe70TCqgrfLNwkyWW0kD8= -github.com/linxGnu/grocksdb v1.8.11/go.mod h1:xZCIb5Muw+nhbDK4Y5UJuOrin5MceOuiXkVUR7vp4WY= -github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= @@ -159,7 +108,6 @@ github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1Cpa github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/peterbourgon/ff/v3 v3.4.0 h1:QBvM/rizZM1cB0p0lGMdmR7HxZeI/ZrBWB4DqLkMUBc= @@ -172,38 +120,17 @@ github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDN github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/rs/cors v1.10.1 h1:L0uuZVXIKlI1SShY2nhFfo44TYvDPQ1w4oFkUJNfhyo= github.com/rs/cors v1.10.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= -github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= -github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= -github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= -github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= github.com/zondax/ledger-go v0.14.3/go.mod h1:IKKaoxupuB43g4NxeQmbLXv7T9AlQyie1UpHb342ycI= go.etcd.io/bbolt v1.3.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA= -go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= -go.opencensus.io v0.22.5 h1:dntmOdLpSpHlVqbW5Eay97DelsZHe+55D+xC6i0dDS0= -go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI= @@ -214,57 +141,31 @@ go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= go.uber.org/zap/exp v0.1.0 h1:Ol9zQNvAEAgFHSBiR5LlwS9Xq8u5QF+7HBwNHUB8rcI= go.uber.org/zap/exp v0.1.0/go.mod h1:z/0T3As39ttolxZGOsvk1OEvQfwwfTZpmV9YTp+VAkc= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3 h1:hNQpMuAJe5CtcUqCXaWga3FHu+kQvCqcsoVaQgSV60o= golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -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= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE= @@ -275,27 +176,13 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto/googleapis/rpc v0.0.0-20231009173412-8bfb1ae86b6c h1:jHkCUWkseRf+W+edG5hMzr/Uh1xkDREY4caybAq4dpY= google.golang.org/genproto/googleapis/rpc v0.0.0-20231009173412-8bfb1ae86b6c/go.mod h1:4cYg8o5yUbm77w8ZX00LhMVNl/YVBFJRYWDc0uYWMs0= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= @@ -309,17 +196,14 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/contribs/gnokeykc/go.mod b/contribs/gnokeykc/go.mod index 732bececda4..5dc00cee273 100644 --- a/contribs/gnokeykc/go.mod +++ b/contribs/gnokeykc/go.mod @@ -14,41 +14,27 @@ require ( github.com/alessio/shellescape v1.4.1 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect github.com/btcsuite/btcd/btcutil v1.1.3 // indirect - github.com/cespare/xxhash v1.1.0 // indirect - github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect - github.com/dgraph-io/badger/v3 v3.2103.5 // indirect - github.com/dgraph-io/ristretto v0.1.1 // indirect - github.com/dustin/go-humanize v1.0.0 // indirect github.com/gnolang/goleveldb v0.0.9 // indirect github.com/gnolang/overflow v0.0.0-20170615021017-4d914c927216 // indirect github.com/godbus/dbus/v5 v5.1.0 // indirect - github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/glog v1.1.0 // indirect - github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.4 // indirect - github.com/google/flatbuffers v1.12.1 // indirect github.com/gorilla/websocket v1.5.1 // indirect github.com/jaekwon/testify v1.6.1 // indirect - github.com/jmhodges/levigo v1.0.0 // indirect - github.com/klauspost/compress v1.12.3 // indirect + github.com/kr/pretty v0.1.0 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect - github.com/linxGnu/grocksdb v1.8.11 // indirect github.com/pelletier/go-toml v1.9.5 // indirect github.com/peterbourgon/ff/v3 v3.4.0 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rs/cors v1.10.1 // indirect github.com/stretchr/testify v1.8.4 // indirect - github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect github.com/zondax/hid v0.9.2 // indirect github.com/zondax/ledger-go v0.14.3 // indirect - go.etcd.io/bbolt v1.3.8 // indirect - go.opencensus.io v0.22.5 // indirect golang.org/x/crypto v0.18.0 // indirect golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3 // indirect golang.org/x/mod v0.14.0 // indirect diff --git a/contribs/gnokeykc/go.sum b/contribs/gnokeykc/go.sum index 4a2778e7919..0c45d4985fd 100644 --- a/contribs/gnokeykc/go.sum +++ b/contribs/gnokeykc/go.sum @@ -1,13 +1,8 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/alessio/shellescape v1.4.1 h1:V7yhSDDn8LP4lc4jS8pFkt0zCnzVJlG5JXy9BVKJUX0= github.com/alessio/shellescape v1.4.1/go.mod h1:PZAiSCk0LJaZkiCSkPv8qIobYglO3FPpyFjDCtHLS30= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M= github.com/btcsuite/btcd v0.23.0 h1:V2/ZgjfDFIygAX3ZapeigkVBoVUtOJKSwrhZdlpSvaA= @@ -32,18 +27,8 @@ github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= -github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= -github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/danieljoos/wincred v1.2.0 h1:ozqKHaLK0W/ii4KVbbvluM91W2H3Sh0BncbUNPS7jLE= github.com/danieljoos/wincred v1.2.0/go.mod h1:FzQLLMKBFdvu+osBrnFODiv32YGwCfx0SkRa/eYHgec= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -56,17 +41,6 @@ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeC github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= -github.com/dgraph-io/badger/v3 v3.2103.5 h1:ylPa6qzbjYRQMU6jokoj4wzcaweHylt//CH0AKt0akg= -github.com/dgraph-io/badger/v3 v3.2103.5/go.mod h1:4MPiseMeDQ3FNCYwRbbcBOGJLf5jsE0PPFzRiKjtcdw= -github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8= -github.com/dgraph-io/ristretto v0.1.1/go.mod h1:S1GPSBCYCIhmVNfcth17y2zZtQT6wzkzgwUve0VDWWA= -github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA= -github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0= -github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= -github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= @@ -77,16 +51,7 @@ github.com/gnolang/overflow v0.0.0-20170615021017-4d914c927216 h1:GKvsK3oLWG9B1G github.com/gnolang/overflow v0.0.0-20170615021017-4d914c927216/go.mod h1:xJhtEL7ahjM1WJipt89gel8tHzfIl/LyMY+lCYh38d8= github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= -github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= -github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 h1:ZgQEtGgCBiWRM39fZuwSd1LwSqqSW0hOdXCYYDX0R3I= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= @@ -96,35 +61,24 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/flatbuffers v1.12.1 h1:MVlul7pQNoDzWRLTw5imwYsl+usrS1TXG2H4jg6ImGw= -github.com/google/flatbuffers v1.12.1/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jaekwon/testify v1.6.1 h1:4AtAJcR9GzXN5W4DdY7ie74iCPiJV1JJUJL90t2ZUyw= github.com/jaekwon/testify v1.6.1/go.mod h1:Oun0RXIHI7osufabQ60i4Lqkj0GXLbqI1I7kgzBNm1U= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= -github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/klauspost/compress v1.12.3 h1:G5AfA94pHPysR56qqrkO2pxEexdDzrpFJ6yt/VqWxVU= -github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -133,10 +87,6 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= github.com/linxGnu/grocksdb v1.8.11 h1:BGol9e5gB1BrsTvOxloC88pe70TCqgrfLNwkyWW0kD8= -github.com/linxGnu/grocksdb v1.8.11/go.mod h1:xZCIb5Muw+nhbDK4Y5UJuOrin5MceOuiXkVUR7vp4WY= -github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= @@ -149,7 +99,6 @@ github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1Cpa github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/peterbourgon/ff/v3 v3.4.0 h1:QBvM/rizZM1cB0p0lGMdmR7HxZeI/ZrBWB4DqLkMUBc= @@ -160,31 +109,13 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rs/cors v1.10.1 h1:L0uuZVXIKlI1SShY2nhFfo44TYvDPQ1w4oFkUJNfhyo= github.com/rs/cors v1.10.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= -github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= -github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= -github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= -github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/zalando/go-keyring v0.2.3 h1:v9CUu9phlABObO4LPWycf+zwMG7nlbb3t/B5wa97yms= github.com/zalando/go-keyring v0.2.3/go.mod h1:HL4k+OXQfJUWaMnqyuSOc0drfGPX2b51Du6K+MRgZMk= github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= @@ -192,61 +123,32 @@ github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWp github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= github.com/zondax/ledger-go v0.14.3/go.mod h1:IKKaoxupuB43g4NxeQmbLXv7T9AlQyie1UpHb342ycI= go.etcd.io/bbolt v1.3.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA= -go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= -go.opencensus.io v0.22.5 h1:dntmOdLpSpHlVqbW5Eay97DelsZHe+55D+xC6i0dDS0= -go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3 h1:hNQpMuAJe5CtcUqCXaWga3FHu+kQvCqcsoVaQgSV60o= golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -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= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE= @@ -257,25 +159,11 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto/googleapis/rpc v0.0.0-20231009173412-8bfb1ae86b6c h1:jHkCUWkseRf+W+edG5hMzr/Uh1xkDREY4caybAq4dpY= google.golang.org/genproto/googleapis/rpc v0.0.0-20231009173412-8bfb1ae86b6c/go.mod h1:4cYg8o5yUbm77w8ZX00LhMVNl/YVBFJRYWDc0uYWMs0= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= @@ -289,17 +177,14 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/go.mod b/go.mod index ac56660dad1..1352d7155fe 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,6 @@ require ( github.com/cosmos/ledger-cosmos-go v0.13.3 github.com/davecgh/go-spew v1.1.1 github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 - github.com/dgraph-io/badger/v3 v3.2103.5 github.com/fortytw2/leaktest v1.3.0 github.com/gdamore/tcell/v2 v2.6.0 github.com/gnolang/goleveldb v0.0.9 @@ -29,7 +28,6 @@ require ( github.com/rogpeppe/go-internal v1.11.0 github.com/rs/cors v1.10.1 github.com/stretchr/testify v1.8.4 - github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c go.etcd.io/bbolt v1.3.8 go.uber.org/multierr v1.10.0 go.uber.org/zap v1.24.0 @@ -56,28 +54,15 @@ require ( require ( github.com/btcsuite/btcd/btcec/v2 v2.3.2 github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2 // indirect - github.com/cespare/xxhash v1.1.0 // indirect - github.com/cespare/xxhash/v2 v2.2.0 // indirect - github.com/dgraph-io/ristretto v0.1.1 // indirect - github.com/dustin/go-humanize v1.0.0 // indirect - github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c // indirect - github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 // indirect - github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 // indirect github.com/gdamore/encoding v1.0.0 // indirect - github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/glog v1.1.0 // indirect - github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 // indirect github.com/golang/snappy v0.0.4 // indirect - github.com/google/flatbuffers v1.12.1 // indirect github.com/gorilla/securecookie v1.1.1 // indirect github.com/gorilla/sessions v1.2.1 // indirect - github.com/klauspost/compress v1.12.3 // indirect github.com/kr/text v0.2.0 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 // indirect github.com/nxadm/tail v1.4.11 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/rivo/uniseg v0.4.3 // indirect - go.opencensus.io v0.22.5 // indirect go.uber.org/atomic v1.10.0 // indirect golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.14.0 // indirect diff --git a/go.sum b/go.sum index cdde46147e8..3cd4b3aede1 100644 --- a/go.sum +++ b/go.sum @@ -1,11 +1,6 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M= @@ -31,20 +26,10 @@ github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= -github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cockroachdb/apd/v3 v3.2.1 h1:U+8j7t0axsIgvQUqthuNm82HIrYXodOV2iWLWtEaIwg= github.com/cockroachdb/apd/v3 v3.2.1/go.mod h1:klXJcjp+FffLTHlhIG69tezTDvdP065naDsHzKhYSqc= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= -github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -56,20 +41,6 @@ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeC github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= -github.com/dgraph-io/badger/v3 v3.2103.5 h1:ylPa6qzbjYRQMU6jokoj4wzcaweHylt//CH0AKt0akg= -github.com/dgraph-io/badger/v3 v3.2103.5/go.mod h1:4MPiseMeDQ3FNCYwRbbcBOGJLf5jsE0PPFzRiKjtcdw= -github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8= -github.com/dgraph-io/ristretto v0.1.1/go.mod h1:S1GPSBCYCIhmVNfcth17y2zZtQT6wzkzgwUve0VDWWA= -github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA= -github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0= -github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= -github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= -github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= -github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk= -github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= @@ -84,16 +55,7 @@ github.com/gnolang/goleveldb v0.0.9 h1:Q7rGko9oXMKtQA+Apeeed5a3sjba/mcDhzJGoTVLC github.com/gnolang/goleveldb v0.0.9/go.mod h1:Dz6p9bmpy/FBESTgduiThZt5mToVDipcHGzj/zUOo8E= github.com/gnolang/overflow v0.0.0-20170615021017-4d914c927216 h1:GKvsK3oLWG9B1GL7WP/VqwM6C92j5tIvB844oggL9Lk= github.com/gnolang/overflow v0.0.0-20170615021017-4d914c927216/go.mod h1:xJhtEL7ahjM1WJipt89gel8tHzfIl/LyMY+lCYh38d8= -github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= -github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= -github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 h1:ZgQEtGgCBiWRM39fZuwSd1LwSqqSW0hOdXCYYDX0R3I= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= @@ -103,15 +65,11 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/flatbuffers v1.12.1 h1:MVlul7pQNoDzWRLTw5imwYsl+usrS1TXG2H4jg6ImGw= -github.com/google/flatbuffers v1.12.1/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= @@ -128,9 +86,7 @@ github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/ github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= github.com/gotuna/gotuna v0.6.0 h1:N1lQKXEi/lwRp8u3sccTYLhzOffA4QasExz/1M5Riws= github.com/gotuna/gotuna v0.6.0/go.mod h1:F/ecRt29ChB6Ycy1AFIBpBiMNK0j7Heq+gFbLWquhjc= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jaekwon/testify v1.6.1 h1:4AtAJcR9GzXN5W4DdY7ie74iCPiJV1JJUJL90t2ZUyw= github.com/jaekwon/testify v1.6.1/go.mod h1:Oun0RXIHI7osufabQ60i4Lqkj0GXLbqI1I7kgzBNm1U= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= @@ -138,12 +94,7 @@ github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJS github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/klauspost/compress v1.12.3 h1:G5AfA94pHPysR56qqrkO2pxEexdDzrpFJ6yt/VqWxVU= -github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -157,12 +108,9 @@ github.com/linxGnu/grocksdb v1.8.11 h1:BGol9e5gB1BrsTvOxloC88pe70TCqgrfLNwkyWW0k github.com/linxGnu/grocksdb v1.8.11/go.mod h1:xZCIb5Muw+nhbDK4Y5UJuOrin5MceOuiXkVUR7vp4WY= github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= -github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY= github.com/nxadm/tail v1.4.11/go.mod h1:OTaG3NK980DZzxbRq6lEuzgU+mug70nY11sMd4JXXHc= @@ -176,7 +124,6 @@ github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1Cpa github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/peterbourgon/ff/v3 v3.4.0 h1:QBvM/rizZM1cB0p0lGMdmR7HxZeI/ZrBWB4DqLkMUBc= @@ -192,30 +139,12 @@ github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDN github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/rs/cors v1.10.1 h1:L0uuZVXIKlI1SShY2nhFfo44TYvDPQ1w4oFkUJNfhyo= github.com/rs/cors v1.10.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= -github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= -github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= -github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= -github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= @@ -223,8 +152,6 @@ github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfU github.com/zondax/ledger-go v0.14.3/go.mod h1:IKKaoxupuB43g4NxeQmbLXv7T9AlQyie1UpHb342ycI= go.etcd.io/bbolt v1.3.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA= go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= -go.opencensus.io v0.22.5 h1:dntmOdLpSpHlVqbW5Eay97DelsZHe+55D+xC6i0dDS0= -go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI= @@ -235,67 +162,43 @@ go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= go.uber.org/zap/exp v0.1.0 h1:Ol9zQNvAEAgFHSBiR5LlwS9Xq8u5QF+7HBwNHUB8rcI= go.uber.org/zap/exp v0.1.0/go.mod h1:z/0T3As39ttolxZGOsvk1OEvQfwwfTZpmV9YTp+VAkc= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3 h1:hNQpMuAJe5CtcUqCXaWga3FHu+kQvCqcsoVaQgSV60o= golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -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= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= @@ -312,28 +215,16 @@ golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto/googleapis/rpc v0.0.0-20231009173412-8bfb1ae86b6c h1:jHkCUWkseRf+W+edG5hMzr/Uh1xkDREY4caybAq4dpY= google.golang.org/genproto/googleapis/rpc v0.0.0-20231009173412-8bfb1ae86b6c/go.mod h1:4cYg8o5yUbm77w8ZX00LhMVNl/YVBFJRYWDc0uYWMs0= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= @@ -347,18 +238,15 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/misc/loop/go.mod b/misc/loop/go.mod index 6e81efe3df8..bf527d50bab 100644 --- a/misc/loop/go.mod +++ b/misc/loop/go.mod @@ -11,38 +11,21 @@ require ( dario.cat/mergo v1.0.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect github.com/btcsuite/btcd/btcutil v1.1.3 // indirect - github.com/cespare/xxhash v1.1.0 // indirect - github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/cockroachdb/apd/v3 v3.2.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect - github.com/dgraph-io/badger/v3 v3.2103.5 // indirect - github.com/dgraph-io/ristretto v0.1.1 // indirect - github.com/dustin/go-humanize v1.0.0 // indirect github.com/gnolang/goleveldb v0.0.9 // indirect github.com/gnolang/overflow v0.0.0-20170615021017-4d914c927216 // indirect - github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/glog v1.1.2 // indirect - github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 // indirect - github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.4 // indirect - github.com/google/flatbuffers v1.12.1 // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/gorilla/websocket v1.5.1 // indirect github.com/jaekwon/testify v1.6.1 // indirect - github.com/jmhodges/levigo v1.0.0 // indirect - github.com/klauspost/compress v1.12.3 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect - github.com/linxGnu/grocksdb v1.8.11 // indirect github.com/pelletier/go-toml v1.9.5 // indirect github.com/peterbourgon/ff/v3 v3.4.0 // indirect - github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rs/cors v1.10.1 // indirect github.com/stretchr/testify v1.8.4 // indirect - github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect - go.etcd.io/bbolt v1.3.8 // indirect - go.opencensus.io v0.22.5 // indirect go.uber.org/multierr v1.10.0 // indirect go.uber.org/zap v1.26.0 // indirect go.uber.org/zap/exp v0.2.0 // indirect diff --git a/misc/loop/go.sum b/misc/loop/go.sum index ed31b7ca9f7..b077ff375a3 100644 --- a/misc/loop/go.sum +++ b/misc/loop/go.sum @@ -1,11 +1,6 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M= github.com/btcsuite/btcd v0.23.0 h1:V2/ZgjfDFIygAX3ZapeigkVBoVUtOJKSwrhZdlpSvaA= @@ -30,19 +25,9 @@ github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= -github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cockroachdb/apd/v3 v3.2.1 h1:U+8j7t0axsIgvQUqthuNm82HIrYXodOV2iWLWtEaIwg= github.com/cockroachdb/apd/v3 v3.2.1/go.mod h1:klXJcjp+FffLTHlhIG69tezTDvdP065naDsHzKhYSqc= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= -github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -53,17 +38,6 @@ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeC github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= -github.com/dgraph-io/badger/v3 v3.2103.5 h1:ylPa6qzbjYRQMU6jokoj4wzcaweHylt//CH0AKt0akg= -github.com/dgraph-io/badger/v3 v3.2103.5/go.mod h1:4MPiseMeDQ3FNCYwRbbcBOGJLf5jsE0PPFzRiKjtcdw= -github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8= -github.com/dgraph-io/ristretto v0.1.1/go.mod h1:S1GPSBCYCIhmVNfcth17y2zZtQT6wzkzgwUve0VDWWA= -github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA= -github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0= -github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= -github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= @@ -74,68 +48,38 @@ github.com/gnolang/overflow v0.0.0-20170615021017-4d914c927216 h1:GKvsK3oLWG9B1G github.com/gnolang/overflow v0.0.0-20170615021017-4d914c927216/go.mod h1:xJhtEL7ahjM1WJipt89gel8tHzfIl/LyMY+lCYh38d8= github.com/gnolang/tx-archive v0.1.1 h1:maVdRFsc1ptVhwVw1p5scvu2Rus8Yk3o9qlss5+SRCw= github.com/gnolang/tx-archive v0.1.1/go.mod h1:MrUmRaU6GB9tOPy+5pCe/x1z1fGYtAypVJzKOExeUHY= -github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= -github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= -github.com/golang/glog v1.1.2/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 h1:ZgQEtGgCBiWRM39fZuwSd1LwSqqSW0hOdXCYYDX0R3I= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/flatbuffers v1.12.1 h1:MVlul7pQNoDzWRLTw5imwYsl+usrS1TXG2H4jg6ImGw= -github.com/google/flatbuffers v1.12.1/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jaekwon/testify v1.6.1 h1:4AtAJcR9GzXN5W4DdY7ie74iCPiJV1JJUJL90t2ZUyw= github.com/jaekwon/testify v1.6.1/go.mod h1:Oun0RXIHI7osufabQ60i4Lqkj0GXLbqI1I7kgzBNm1U= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= -github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/klauspost/compress v1.12.3 h1:G5AfA94pHPysR56qqrkO2pxEexdDzrpFJ6yt/VqWxVU= -github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= github.com/linxGnu/grocksdb v1.8.11 h1:BGol9e5gB1BrsTvOxloC88pe70TCqgrfLNwkyWW0kD8= -github.com/linxGnu/grocksdb v1.8.11/go.mod h1:xZCIb5Muw+nhbDK4Y5UJuOrin5MceOuiXkVUR7vp4WY= -github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= @@ -148,48 +92,25 @@ github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1Cpa github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/peterbourgon/ff/v3 v3.4.0 h1:QBvM/rizZM1cB0p0lGMdmR7HxZeI/ZrBWB4DqLkMUBc= github.com/peterbourgon/ff/v3 v3.4.0/go.mod h1:zjJVUhx+twciwfDl0zBcFzl4dW8axCRyXE/eKY9RztQ= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/rs/cors v1.10.1 h1:L0uuZVXIKlI1SShY2nhFfo44TYvDPQ1w4oFkUJNfhyo= github.com/rs/cors v1.10.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= -github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= -github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= -github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= -github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= go.etcd.io/bbolt v1.3.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA= -go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= -go.opencensus.io v0.22.5 h1:dntmOdLpSpHlVqbW5Eay97DelsZHe+55D+xC6i0dDS0= -go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ= go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= @@ -198,57 +119,31 @@ go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= go.uber.org/zap/exp v0.2.0 h1:FtGenNNeCATRB3CmB/yEUnjEFeJWpB/pMcy7e2bKPYs= go.uber.org/zap/exp v0.2.0/go.mod h1:t0gqAIdh1MfKv9EwN/dLwfZnJxe9ITAZN78HEWPFWDQ= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3 h1:hNQpMuAJe5CtcUqCXaWga3FHu+kQvCqcsoVaQgSV60o= golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -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= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE= @@ -258,27 +153,13 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac h1:nUQEQmH/csSvFECKYRv6HWEyypysidKl2I6Qpsglq/0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac/go.mod h1:daQN87bsDqDoe316QbbvX60nMoJQa4r6Ds0ZuoAe5yA= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU= google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= @@ -287,22 +168,17 @@ google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQ google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= From a63e6b069798abb4331b5dc4a49475cf6e2cba5f Mon Sep 17 00:00:00 2001 From: Morgan Bazalgette Date: Tue, 30 Jan 2024 15:08:11 +0100 Subject: [PATCH 04/14] port to 1.20 --- tm2/pkg/db/db.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tm2/pkg/db/db.go b/tm2/pkg/db/db.go index 2c55eaf0aa6..211d9357a50 100644 --- a/tm2/pkg/db/db.go +++ b/tm2/pkg/db/db.go @@ -2,9 +2,9 @@ package db import ( "fmt" - "slices" "golang.org/x/exp/maps" + "golang.org/x/exp/slices" ) type BackendType string From ea391135b032638682584eb53fa0f78d970e39e7 Mon Sep 17 00:00:00 2001 From: Morgan Bazalgette Date: Tue, 30 Jan 2024 15:22:53 +0100 Subject: [PATCH 05/14] linter fixes --- gno.land/pkg/sdk/vm/common_test.go | 4 +- gnovm/pkg/gnolang/machine_test.go | 4 +- tm2/pkg/bft/blockchain/reactor_test.go | 8 ++-- tm2/pkg/bft/consensus/common_test.go | 7 +-- tm2/pkg/bft/consensus/mempool_test.go | 6 +-- tm2/pkg/bft/consensus/replay_test.go | 11 +++-- tm2/pkg/bft/node/node_test.go | 3 +- tm2/pkg/bft/state/helpers_test.go | 3 +- tm2/pkg/bft/store/store_test.go | 15 +++--- tm2/pkg/db/internal/test_common.go | 2 + tm2/pkg/db/memdb/mem_db.go | 18 +++---- tm2/pkg/iavl/basic_test.go | 14 +++--- tm2/pkg/iavl/doc.go | 2 +- tm2/pkg/iavl/proof_forgery_test.go | 4 +- tm2/pkg/iavl/proof_test.go | 8 ++-- tm2/pkg/iavl/tree_dotgraph_test.go | 4 +- tm2/pkg/iavl/tree_fuzz_test.go | 4 +- tm2/pkg/iavl/tree_test.go | 64 +++++++++++++------------ tm2/pkg/sdk/bank/common_test.go | 4 +- tm2/pkg/sdk/baseapp_test.go | 17 +++---- tm2/pkg/store/README.md | 8 ++-- tm2/pkg/store/cache/store_bench_test.go | 5 +- tm2/pkg/store/cache/store_test.go | 17 +++---- tm2/pkg/store/gas/store_test.go | 11 ++--- tm2/pkg/store/iavl/store_test.go | 27 ++++++----- tm2/pkg/store/prefix/store_test.go | 16 +++---- tm2/pkg/store/rootmulti/proof_test.go | 10 ++-- tm2/pkg/store/rootmulti/store_test.go | 13 ++--- 28 files changed, 160 insertions(+), 149 deletions(-) diff --git a/gno.land/pkg/sdk/vm/common_test.go b/gno.land/pkg/sdk/vm/common_test.go index 8a75697115f..b65757da403 100644 --- a/gno.land/pkg/sdk/vm/common_test.go +++ b/gno.land/pkg/sdk/vm/common_test.go @@ -6,7 +6,7 @@ import ( "path/filepath" bft "github.com/gnolang/gno/tm2/pkg/bft/types" - dbm "github.com/gnolang/gno/tm2/pkg/db" + "github.com/gnolang/gno/tm2/pkg/db/memdb" "github.com/gnolang/gno/tm2/pkg/log" "github.com/gnolang/gno/tm2/pkg/sdk" authm "github.com/gnolang/gno/tm2/pkg/sdk/auth" @@ -25,7 +25,7 @@ type testEnv struct { } func setupTestEnv() testEnv { - db := dbm.NewMemDB() + db := memdb.NewMemDB() baseCapKey := store.NewStoreKey("baseCapKey") iavlCapKey := store.NewStoreKey("iavlCapKey") diff --git a/gnovm/pkg/gnolang/machine_test.go b/gnovm/pkg/gnolang/machine_test.go index 4268e3f3332..c9f1f9ba10d 100644 --- a/gnovm/pkg/gnolang/machine_test.go +++ b/gnovm/pkg/gnolang/machine_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - dbm "github.com/gnolang/gno/tm2/pkg/db" + "github.com/gnolang/gno/tm2/pkg/db/memdb" "github.com/gnolang/gno/tm2/pkg/std" "github.com/gnolang/gno/tm2/pkg/store/dbadapter" "github.com/gnolang/gno/tm2/pkg/store/iavl" @@ -22,7 +22,7 @@ func BenchmarkCreateNewMachine(b *testing.B) { func TestRunMemPackageWithOverrides_revertToOld(t *testing.T) { // A test to check revertToOld is correctly putting back an old value, // after preprocessing fails. - db := dbm.NewMemDB() + db := memdb.NewMemDB() baseStore := dbadapter.StoreConstructor(db, stypes.StoreOptions{}) iavlStore := iavl.StoreConstructor(db, stypes.StoreOptions{}) store := NewStore(nil, baseStore, iavlStore) diff --git a/tm2/pkg/bft/blockchain/reactor_test.go b/tm2/pkg/bft/blockchain/reactor_test.go index 982c29033fa..e9de000f2d6 100644 --- a/tm2/pkg/bft/blockchain/reactor_test.go +++ b/tm2/pkg/bft/blockchain/reactor_test.go @@ -18,7 +18,7 @@ import ( "github.com/gnolang/gno/tm2/pkg/bft/store" "github.com/gnolang/gno/tm2/pkg/bft/types" tmtime "github.com/gnolang/gno/tm2/pkg/bft/types/time" - dbm "github.com/gnolang/gno/tm2/pkg/db" + "github.com/gnolang/gno/tm2/pkg/db/memdb" "github.com/gnolang/gno/tm2/pkg/errors" "github.com/gnolang/gno/tm2/pkg/log" "github.com/gnolang/gno/tm2/pkg/p2p" @@ -65,8 +65,8 @@ func newBlockchainReactor(logger *slog.Logger, genDoc *types.GenesisDoc, privVal panic(errors.Wrap(err, "error start app")) } - blockDB := dbm.NewMemDB() - stateDB := dbm.NewMemDB() + blockDB := memdb.NewMemDB() + stateDB := memdb.NewMemDB() blockStore := store.NewBlockStore(blockDB) state, err := sm.LoadStateFromDBOrGenesisDoc(stateDB, genDoc) @@ -78,7 +78,7 @@ func newBlockchainReactor(logger *slog.Logger, genDoc *types.GenesisDoc, privVal // NOTE we have to create and commit the blocks first because // pool.height is determined from the store. fastSync := true - db := dbm.NewMemDB() + db := memdb.NewMemDB() blockExec := sm.NewBlockExecutor(db, logger, proxyApp.Consensus(), mock.Mempool{}) sm.SaveState(db, state) diff --git a/tm2/pkg/bft/consensus/common_test.go b/tm2/pkg/bft/consensus/common_test.go index 4a0a4eebf03..9f617cd75cb 100644 --- a/tm2/pkg/bft/consensus/common_test.go +++ b/tm2/pkg/bft/consensus/common_test.go @@ -27,6 +27,7 @@ import ( tmtime "github.com/gnolang/gno/tm2/pkg/bft/types/time" "github.com/gnolang/gno/tm2/pkg/crypto" dbm "github.com/gnolang/gno/tm2/pkg/db" + "github.com/gnolang/gno/tm2/pkg/db/memdb" "github.com/gnolang/gno/tm2/pkg/events" "github.com/gnolang/gno/tm2/pkg/log" osm "github.com/gnolang/gno/tm2/pkg/os" @@ -266,7 +267,7 @@ func newConsensusState(state sm.State, pv types.PrivValidator, app abci.Applicat } func newConsensusStateWithConfig(thisConfig *cfg.Config, state sm.State, pv types.PrivValidator, app abci.Application) *ConsensusState { - blockDB := dbm.NewMemDB() + blockDB := memdb.NewMemDB() return newConsensusStateWithConfigAndBlockStore(thisConfig, state, pv, app, blockDB) } @@ -576,7 +577,7 @@ func randConsensusNet(nValidators int, testName string, tickerFunc func() Timeou logger := log.NewNoopLogger() configRootDirs := make([]string, 0, nValidators) for i := 0; i < nValidators; i++ { - stateDB := dbm.NewMemDB() // each state needs its own db + stateDB := memdb.NewMemDB() // each state needs its own db state, _ := sm.LoadStateFromDBOrGenesisDoc(stateDB, genDoc) thisConfig := ResetConfig(fmt.Sprintf("%s_%d", testName, i)) configRootDirs = append(configRootDirs, thisConfig.RootDir) @@ -616,7 +617,7 @@ func randConsensusNetWithPeers(nValidators, nPeers int, testName string, tickerF var peer0Config *cfg.Config configRootDirs := make([]string, 0, nPeers) for i := 0; i < nPeers; i++ { - stateDB := dbm.NewMemDB() // each state needs its own db + stateDB := memdb.NewMemDB() // each state needs its own db state, _ := sm.LoadStateFromDBOrGenesisDoc(stateDB, genDoc) thisConfig := ResetConfig(fmt.Sprintf("%s_%d", testName, i)) configRootDirs = append(configRootDirs, thisConfig.RootDir) diff --git a/tm2/pkg/bft/consensus/mempool_test.go b/tm2/pkg/bft/consensus/mempool_test.go index 85914262903..f425a161e90 100644 --- a/tm2/pkg/bft/consensus/mempool_test.go +++ b/tm2/pkg/bft/consensus/mempool_test.go @@ -15,7 +15,7 @@ import ( mempl "github.com/gnolang/gno/tm2/pkg/bft/mempool" sm "github.com/gnolang/gno/tm2/pkg/bft/state" "github.com/gnolang/gno/tm2/pkg/bft/types" - dbm "github.com/gnolang/gno/tm2/pkg/db" + "github.com/gnolang/gno/tm2/pkg/db/memdb" ) // for testing @@ -145,7 +145,7 @@ func TestMempoolTxConcurrentWithCommit(t *testing.T) { t.Parallel() state, privVals := randGenesisState(1, false, 10) - blockDB := dbm.NewMemDB() + blockDB := memdb.NewMemDB() app := NewCounterApplication() cs := newConsensusStateWithConfigAndBlockStore(config, state, privVals[0], app, blockDB) sm.SaveState(blockDB, state) @@ -179,7 +179,7 @@ func TestMempoolRmBadTx(t *testing.T) { state, privVals := randGenesisState(1, false, 10) app := NewCounterApplication() - blockDB := dbm.NewMemDB() + blockDB := memdb.NewMemDB() cs := newConsensusStateWithConfigAndBlockStore(config, state, privVals[0], app, blockDB) sm.SaveState(blockDB, state) diff --git a/tm2/pkg/bft/consensus/replay_test.go b/tm2/pkg/bft/consensus/replay_test.go index 981e72d6ca3..8d5b8c87b89 100644 --- a/tm2/pkg/bft/consensus/replay_test.go +++ b/tm2/pkg/bft/consensus/replay_test.go @@ -31,6 +31,7 @@ import ( walm "github.com/gnolang/gno/tm2/pkg/bft/wal" "github.com/gnolang/gno/tm2/pkg/crypto" dbm "github.com/gnolang/gno/tm2/pkg/db" + "github.com/gnolang/gno/tm2/pkg/db/memdb" "github.com/gnolang/gno/tm2/pkg/events" "github.com/gnolang/gno/tm2/pkg/log" "github.com/gnolang/gno/tm2/pkg/random" @@ -172,7 +173,7 @@ LOOP: // create consensus state from a clean slate logger := log.NewTestingLogger(t) - blockDB := dbm.NewMemDB() + blockDB := memdb.NewMemDB() stateDB := blockDB state, _ := sm.MakeGenesisStateFromFile(consensusReplayConfig.GenesisFile()) privValidator := loadPrivValidator(consensusReplayConfig) @@ -645,7 +646,7 @@ func testHandshakeReplay(t *testing.T, config *cfg.Config, nBlocks int, mode uin if sim != nil { testConfig := ResetConfig(fmt.Sprintf("%s_%v_m", t.Name(), mode)) defer os.RemoveAll(testConfig.RootDir) - stateDB = dbm.NewMemDB() + stateDB = memdb.NewMemDB() defer stateDB.Close() genesisState = sim.GenesisState config = sim.Config @@ -691,7 +692,7 @@ func testHandshakeReplay(t *testing.T, config *cfg.Config, nBlocks int, mode uin // run nBlocks against a new client to build up the app state. // use a throwaway tendermint state proxyApp := proxy.NewAppConns(clientCreator2) - stateDB1 := dbm.NewMemDB() + stateDB1 := memdb.NewMemDB() sm.SaveState(stateDB1, genesisState) buildAppStateFromChain(proxyApp, stateDB1, genesisState, chain, nBlocks, mode) } @@ -1059,7 +1060,7 @@ func readPieceFromWAL(msg *walm.TimedWALMessage) interface{} { // fresh state and mock store func makeStateAndStore(config *cfg.Config, pubKey crypto.PubKey, appVersion string) (dbm.DB, sm.State, *mockBlockStore) { - stateDB := dbm.NewMemDB() + stateDB := memdb.NewMemDB() state, _ := sm.MakeGenesisStateFromFile(config.GenesisFile()) state.AppVersion = appVersion store := newMockBlockStore(config, state.ConsensusParams) @@ -1077,7 +1078,7 @@ type mockBlockStore struct { commits []*types.Commit } -// TODO: NewBlockStore(db.NewMemDB) ... +// TODO: NewBlockStore(memdb.NewMemDB) ... func newMockBlockStore(config *cfg.Config, params abci.ConsensusParams) *mockBlockStore { return &mockBlockStore{config, params, nil, nil} } diff --git a/tm2/pkg/bft/node/node_test.go b/tm2/pkg/bft/node/node_test.go index d182b7fb0d5..4c38695a2fa 100644 --- a/tm2/pkg/bft/node/node_test.go +++ b/tm2/pkg/bft/node/node_test.go @@ -21,6 +21,7 @@ import ( tmtime "github.com/gnolang/gno/tm2/pkg/bft/types/time" "github.com/gnolang/gno/tm2/pkg/crypto/ed25519" dbm "github.com/gnolang/gno/tm2/pkg/db" + "github.com/gnolang/gno/tm2/pkg/db/memdb" "github.com/gnolang/gno/tm2/pkg/events" "github.com/gnolang/gno/tm2/pkg/log" "github.com/gnolang/gno/tm2/pkg/p2p" @@ -324,7 +325,7 @@ func state(nVals int, height int64) (sm.State, dbm.DB) { }) // save validators to db for 2 heights - stateDB := dbm.NewMemDB() + stateDB := memdb.NewMemDB() sm.SaveState(stateDB, s) for i := 1; i < int(height); i++ { diff --git a/tm2/pkg/bft/state/helpers_test.go b/tm2/pkg/bft/state/helpers_test.go index ca4175185a9..b8b041635c6 100644 --- a/tm2/pkg/bft/state/helpers_test.go +++ b/tm2/pkg/bft/state/helpers_test.go @@ -11,6 +11,7 @@ import ( "github.com/gnolang/gno/tm2/pkg/crypto" "github.com/gnolang/gno/tm2/pkg/crypto/ed25519" dbm "github.com/gnolang/gno/tm2/pkg/db" + "github.com/gnolang/gno/tm2/pkg/db/memdb" ) type paramsChangeTestCase struct { @@ -103,7 +104,7 @@ func makeState(nVals, height int) (sm.State, dbm.DB, map[string]types.PrivValida AppHash: nil, }) - stateDB := dbm.NewMemDB() + stateDB := memdb.NewMemDB() sm.SaveState(stateDB, s) for i := 1; i < height; i++ { diff --git a/tm2/pkg/bft/store/store_test.go b/tm2/pkg/bft/store/store_test.go index 6b5dd8a96bb..c238f8d7a4d 100644 --- a/tm2/pkg/bft/store/store_test.go +++ b/tm2/pkg/bft/store/store_test.go @@ -19,6 +19,7 @@ import ( "github.com/gnolang/gno/tm2/pkg/bft/types" tmtime "github.com/gnolang/gno/tm2/pkg/bft/types/time" dbm "github.com/gnolang/gno/tm2/pkg/db" + "github.com/gnolang/gno/tm2/pkg/db/memdb" "github.com/gnolang/gno/tm2/pkg/errors" "github.com/gnolang/gno/tm2/pkg/log" ) @@ -47,10 +48,10 @@ func makeBlock(height int64, state sm.State, lastCommit *types.Commit) *types.Bl func makeStateAndBlockStore(logger *slog.Logger) (sm.State, *BlockStore, cleanupFunc) { config := cfg.ResetTestRoot("blockchain_reactor_test") - // blockDB := dbm.NewDebugDB("blockDB", dbm.NewMemDB()) - // stateDB := dbm.NewDebugDB("stateDB", dbm.NewMemDB()) - blockDB := dbm.NewMemDB() - stateDB := dbm.NewMemDB() + // blockDB := dbm.NewDebugDB("blockDB", memdb.NewMemDB()) + // stateDB := dbm.NewDebugDB("stateDB", memdb.NewMemDB()) + blockDB := memdb.NewMemDB() + stateDB := memdb.NewMemDB() state, err := sm.LoadStateFromDBOrGenesisFile(stateDB, config.GenesisFile()) if err != nil { panic(errors.Wrap(err, "error constructing state from genesis file")) @@ -61,7 +62,7 @@ func makeStateAndBlockStore(logger *slog.Logger) (sm.State, *BlockStore, cleanup func TestLoadBlockStoreStateJSON(t *testing.T) { t.Parallel() - db := dbm.NewMemDB() + db := memdb.NewMemDB() bsj := &BlockStoreStateJSON{Height: 1000} bsj.Save(db) @@ -74,7 +75,7 @@ func TestLoadBlockStoreStateJSON(t *testing.T) { func TestNewBlockStore(t *testing.T) { t.Parallel() - db := dbm.NewMemDB() + db := memdb.NewMemDB() db.Set(blockStoreKey, []byte(`{"height": "10000"}`)) bs := NewBlockStore(db) require.Equal(t, int64(10000), bs.Height(), "failed to properly parse blockstore") @@ -105,7 +106,7 @@ func TestNewBlockStore(t *testing.T) { } func freshBlockStore() (*BlockStore, dbm.DB) { - db := dbm.NewMemDB() + db := memdb.NewMemDB() return NewBlockStore(db), db } diff --git a/tm2/pkg/db/internal/test_common.go b/tm2/pkg/db/internal/test_common.go index 417ced25ae4..e048cc4605f 100644 --- a/tm2/pkg/db/internal/test_common.go +++ b/tm2/pkg/db/internal/test_common.go @@ -83,6 +83,7 @@ func BenchmarkRandomReadsWrites(b *testing.B, db db.DB) { for i := 0; i < b.N; i++ { // Write something { + //nolint:gosec idx := int64(rand.Int()) % numItems internal[idx]++ val := internal[idx] @@ -94,6 +95,7 @@ func BenchmarkRandomReadsWrites(b *testing.B, db db.DB) { // Read something { + //nolint:gosec idx := int64(rand.Int()) % numItems valExp := internal[idx] idxBytes := int642Bytes(idx) diff --git a/tm2/pkg/db/memdb/mem_db.go b/tm2/pkg/db/memdb/mem_db.go index f739a228325..6d1d6a35af9 100644 --- a/tm2/pkg/db/memdb/mem_db.go +++ b/tm2/pkg/db/memdb/mem_db.go @@ -5,18 +5,18 @@ import ( "sort" "sync" - "github.com/gnolang/gno/tm2/pkg/db" + dbm "github.com/gnolang/gno/tm2/pkg/db" "github.com/gnolang/gno/tm2/pkg/db/internal" "github.com/gnolang/gno/tm2/pkg/strings" ) func init() { - db.InternalRegisterDBCreator(db.MemDBBackend, func(name, dir string) (db.DB, error) { + dbm.InternalRegisterDBCreator(dbm.MemDBBackend, func(name, dir string) (dbm.DB, error) { return NewMemDB(), nil }, false) } -var _ db.DB = (*MemDB)(nil) +var _ dbm.DB = (*MemDB)(nil) type MemDB struct { mtx sync.Mutex @@ -154,7 +154,7 @@ func (db *MemDB) Stats() map[string]string { } // Implements DB. -func (db *MemDB) NewBatch() db.Batch { +func (db *MemDB) NewBatch() dbm.Batch { db.mtx.Lock() defer db.mtx.Unlock() @@ -165,7 +165,7 @@ func (db *MemDB) NewBatch() db.Batch { // Iterator // Implements DB. -func (db *MemDB) Iterator(start, end []byte) db.Iterator { +func (db *MemDB) Iterator(start, end []byte) dbm.Iterator { db.mtx.Lock() defer db.mtx.Unlock() @@ -174,7 +174,7 @@ func (db *MemDB) Iterator(start, end []byte) db.Iterator { } // Implements DB. -func (db *MemDB) ReverseIterator(start, end []byte) db.Iterator { +func (db *MemDB) ReverseIterator(start, end []byte) dbm.Iterator { db.mtx.Lock() defer db.mtx.Unlock() @@ -185,10 +185,10 @@ func (db *MemDB) ReverseIterator(start, end []byte) db.Iterator { // ---------------------------------------- // Misc. -func (memdb *MemDB) getSortedKeys(start, end []byte, reverse bool) []string { +func (db *MemDB) getSortedKeys(start, end []byte, reverse bool) []string { keys := []string{} - for key := range memdb.db { - inDomain := db.IsKeyInDomain([]byte(key), start, end) + for key := range db.db { + inDomain := dbm.IsKeyInDomain([]byte(key), start, end) if inDomain { keys = append(keys, key) } diff --git a/tm2/pkg/iavl/basic_test.go b/tm2/pkg/iavl/basic_test.go index 93df41696e1..0e1be129de5 100644 --- a/tm2/pkg/iavl/basic_test.go +++ b/tm2/pkg/iavl/basic_test.go @@ -10,13 +10,13 @@ import ( "github.com/stretchr/testify/require" "github.com/gnolang/gno/tm2/pkg/db" - _ "github.com/gnolang/gno/tm2/pkg/db/memdb" + "github.com/gnolang/gno/tm2/pkg/db/memdb" ) func TestBasic(t *testing.T) { t.Parallel() - tree := NewMutableTree(db.NewMemDB(), 0) + tree := NewMutableTree(memdb.NewMemDB(), 0) up := tree.Set([]byte("1"), []byte("one")) if up { t.Error("Did not expect an update (should have been create)") @@ -229,7 +229,7 @@ func TestIntegration(t *testing.T) { } records := make([]*record, 400) - tree := NewMutableTree(db.NewMemDB(), 0) + tree := NewMutableTree(memdb.NewMemDB(), 0) randomRecord := func() *record { return &record{randstr(20), randstr(20)} @@ -313,7 +313,7 @@ func TestIterateRange(t *testing.T) { } sort.Strings(keys) - tree := NewMutableTree(db.NewMemDB(), 0) + tree := NewMutableTree(memdb.NewMemDB(), 0) // insert all the data for _, r := range records { @@ -376,7 +376,7 @@ func TestIterateRange(t *testing.T) { func TestPersistence(t *testing.T) { t.Parallel() - db := db.NewMemDB() + db := memdb.NewMemDB() // Create some random key value pairs records := make(map[string]string) @@ -406,7 +406,7 @@ func TestProof(t *testing.T) { t.Parallel() // Construct some random tree - db := db.NewMemDB() + db := memdb.NewMemDB() tree := NewMutableTree(db, 100) for i := 0; i < 10; i++ { key, value := randstr(20), randstr(20) @@ -437,7 +437,7 @@ func TestProof(t *testing.T) { func TestTreeProof(t *testing.T) { t.Parallel() - db := db.NewMemDB() + db := memdb.NewMemDB() tree := NewMutableTree(db, 100) assert.Equal(t, tree.Hash(), []byte(nil)) diff --git a/tm2/pkg/iavl/doc.go b/tm2/pkg/iavl/doc.go index f58473a5dd5..6787989ff4c 100644 --- a/tm2/pkg/iavl/doc.go +++ b/tm2/pkg/iavl/doc.go @@ -7,7 +7,7 @@ // import "github.com/tendermint/classic/db" // ... // -// tree := iavl.NewMutableTree(db.NewMemDB(), 128) +// tree := iavl.NewMutableTree(memdb.NewMemDB(), 128) // // tree.IsEmpty() // true // diff --git a/tm2/pkg/iavl/proof_forgery_test.go b/tm2/pkg/iavl/proof_forgery_test.go index 028675f7c48..a34f13a247d 100644 --- a/tm2/pkg/iavl/proof_forgery_test.go +++ b/tm2/pkg/iavl/proof_forgery_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/require" "github.com/gnolang/gno/tm2/pkg/crypto/tmhash" - "github.com/gnolang/gno/tm2/pkg/db" + "github.com/gnolang/gno/tm2/pkg/db/memdb" "github.com/gnolang/gno/tm2/pkg/iavl" ) @@ -19,7 +19,7 @@ func TestProofForgery(t *testing.T) { source := rand.NewSource(0) r := rand.New(source) cacheSize := 0 - tree := iavl.NewMutableTree(db.NewMemDB(), cacheSize) + tree := iavl.NewMutableTree(memdb.NewMemDB(), cacheSize) // two keys only keys := []byte{0x11, 0x32} diff --git a/tm2/pkg/iavl/proof_test.go b/tm2/pkg/iavl/proof_test.go index ad4d85d1cd5..2fa9c4bf1cd 100644 --- a/tm2/pkg/iavl/proof_test.go +++ b/tm2/pkg/iavl/proof_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/require" "github.com/gnolang/gno/tm2/pkg/amino" - "github.com/gnolang/gno/tm2/pkg/db" + "github.com/gnolang/gno/tm2/pkg/db/memdb" "github.com/gnolang/gno/tm2/pkg/random" "github.com/gnolang/gno/tm2/pkg/testutils" ) @@ -17,7 +17,7 @@ import ( func TestTreeGetWithProof(t *testing.T) { t.Parallel() - tree := NewMutableTree(db.NewMemDB(), 0) + tree := NewMutableTree(memdb.NewMemDB(), 0) require := require.New(t) for _, ikey := range []byte{0x11, 0x32, 0x50, 0x72, 0x99} { key := []byte{ikey} @@ -53,7 +53,7 @@ func TestTreeGetWithProof(t *testing.T) { func TestTreeKeyExistsProof(t *testing.T) { t.Parallel() - tree := NewMutableTree(db.NewMemDB(), 0) + tree := NewMutableTree(memdb.NewMemDB(), 0) root := tree.WorkingHash() // should get false for proof with nil root @@ -121,7 +121,7 @@ func TestTreeKeyExistsProof(t *testing.T) { func TestTreeKeyInRangeProofs(t *testing.T) { t.Parallel() - tree := NewMutableTree(db.NewMemDB(), 0) + tree := NewMutableTree(memdb.NewMemDB(), 0) require := require.New(t) keys := []byte{0x0a, 0x11, 0x2e, 0x32, 0x50, 0x72, 0x99, 0xa1, 0xe4, 0xf7} // 10 total. for _, ikey := range keys { diff --git a/tm2/pkg/iavl/tree_dotgraph_test.go b/tm2/pkg/iavl/tree_dotgraph_test.go index 3c0233f51fa..3485cc1dd95 100644 --- a/tm2/pkg/iavl/tree_dotgraph_test.go +++ b/tm2/pkg/iavl/tree_dotgraph_test.go @@ -4,13 +4,13 @@ import ( "io" "testing" - db "github.com/gnolang/gno/tm2/pkg/db" + "github.com/gnolang/gno/tm2/pkg/db/memdb" ) func TestWriteDOTGraph(t *testing.T) { t.Parallel() - tree := NewMutableTree(db.NewMemDB(), 0) + tree := NewMutableTree(memdb.NewMemDB(), 0) for _, ikey := range []byte{ 0x0a, 0x11, 0x2e, 0x32, 0x50, 0x72, 0x99, 0xa1, 0xe4, 0xf7, } { diff --git a/tm2/pkg/iavl/tree_fuzz_test.go b/tm2/pkg/iavl/tree_fuzz_test.go index 64e20d944a2..08645414fbf 100644 --- a/tm2/pkg/iavl/tree_fuzz_test.go +++ b/tm2/pkg/iavl/tree_fuzz_test.go @@ -5,7 +5,7 @@ import ( "math/rand" "testing" - "github.com/gnolang/gno/tm2/pkg/db" + "github.com/gnolang/gno/tm2/pkg/db/memdb" "github.com/gnolang/gno/tm2/pkg/random" ) @@ -113,7 +113,7 @@ func TestMutableTreeFuzz(t *testing.T) { for size := 5; iterations < maxIterations; size++ { for i := 0; i < progsPerIteration/size; i++ { - tree := NewMutableTree(db.NewMemDB(), 0) + tree := NewMutableTree(memdb.NewMemDB(), 0) program := genRandomProgram(size) err := program.Execute(tree) if err != nil { diff --git a/tm2/pkg/iavl/tree_test.go b/tm2/pkg/iavl/tree_test.go index ba5bbe3e5ef..43c2d6ac36c 100644 --- a/tm2/pkg/iavl/tree_test.go +++ b/tm2/pkg/iavl/tree_test.go @@ -13,6 +13,8 @@ import ( "github.com/stretchr/testify/require" "github.com/gnolang/gno/tm2/pkg/db" + "github.com/gnolang/gno/tm2/pkg/db/goleveldb" + "github.com/gnolang/gno/tm2/pkg/db/memdb" "github.com/gnolang/gno/tm2/pkg/random" ) @@ -38,7 +40,7 @@ func init() { func getTestDB() (db.DB, func()) { if testLevelDB { - d, err := db.NewGoLevelDB("test", ".") + d, err := goleveldb.NewGoLevelDB("test", ".") if err != nil { panic(err) } @@ -47,7 +49,7 @@ func getTestDB() (db.DB, func()) { os.RemoveAll("./test.db") } } - return db.NewMemDB(), func() {} + return memdb.NewMemDB(), func() {} } func TestVersionedRandomTree(t *testing.T) { @@ -114,7 +116,7 @@ func TestVersionedRandomTreeSmallKeys(t *testing.T) { defer closeDB() tree := NewMutableTree(d, 100) - singleVersionTree := NewMutableTree(db.NewMemDB(), 0) + singleVersionTree := NewMutableTree(memdb.NewMemDB(), 0) versions := 20 keysPerVersion := 50 @@ -157,7 +159,7 @@ func TestVersionedRandomTreeSmallKeysRandomDeletes(t *testing.T) { defer closeDB() tree := NewMutableTree(d, 100) - singleVersionTree := NewMutableTree(db.NewMemDB(), 0) + singleVersionTree := NewMutableTree(memdb.NewMemDB(), 0) versions := 30 keysPerVersion := 50 @@ -195,7 +197,7 @@ func TestVersionedRandomTreeSmallKeysRandomDeletes(t *testing.T) { func TestVersionedTreeSpecial1(t *testing.T) { t.Parallel() - tree := NewMutableTree(db.NewMemDB(), 100) + tree := NewMutableTree(memdb.NewMemDB(), 100) tree.Set([]byte("C"), []byte("so43QQFN")) tree.SaveVersion() @@ -220,7 +222,7 @@ func TestVersionedRandomTreeSpecial2(t *testing.T) { t.Parallel() require := require.New(t) - tree := NewMutableTree(db.NewMemDB(), 100) + tree := NewMutableTree(memdb.NewMemDB(), 100) tree.Set([]byte("OFMe2Yvm"), []byte("ez2OtQtE")) tree.Set([]byte("WEN4iN7Y"), []byte("kQNyUalI")) @@ -518,7 +520,7 @@ func TestVersionedTreeVersionDeletingEfficiency(t *testing.T) { require.Len(t, tree.ndb.leafNodes(), 3) - tree2 := NewMutableTree(db.NewMemDB(), 0) + tree2 := NewMutableTree(memdb.NewMemDB(), 0) tree2.Set([]byte("key0"), []byte("val2")) tree2.Set([]byte("key2"), []byte("val2")) tree2.Set([]byte("key3"), []byte("val1")) @@ -530,7 +532,7 @@ func TestVersionedTreeVersionDeletingEfficiency(t *testing.T) { func TestVersionedTreeOrphanDeleting(t *testing.T) { t.Parallel() - mdb := db.NewMemDB() + mdb := memdb.NewMemDB() tree := NewMutableTree(mdb, 0) tree.Set([]byte("key0"), []byte("val0")) @@ -571,7 +573,7 @@ func TestVersionedTreeSpecialCase(t *testing.T) { t.Parallel() require := require.New(t) - tree := NewMutableTree(db.NewMemDB(), 100) + tree := NewMutableTree(memdb.NewMemDB(), 100) tree.Set([]byte("key1"), []byte("val0")) tree.Set([]byte("key2"), []byte("val0")) @@ -594,7 +596,7 @@ func TestVersionedTreeSpecialCase2(t *testing.T) { t.Parallel() require := require.New(t) - d := db.NewMemDB() + d := memdb.NewMemDB() tree := NewMutableTree(d, 100) @@ -623,7 +625,7 @@ func TestVersionedTreeSpecialCase3(t *testing.T) { t.Parallel() require := require.New(t) - tree := NewMutableTree(db.NewMemDB(), 0) + tree := NewMutableTree(memdb.NewMemDB(), 0) tree.Set([]byte("m"), []byte("liWT0U6G")) tree.Set([]byte("G"), []byte("7PxRXwUA")) @@ -653,7 +655,7 @@ func TestVersionedTreeSaveAndLoad(t *testing.T) { t.Parallel() require := require.New(t) - d := db.NewMemDB() + d := memdb.NewMemDB() tree := NewMutableTree(d, 0) // Loading with an empty root is a no-op. @@ -706,7 +708,7 @@ func TestVersionedTreeErrors(t *testing.T) { t.Parallel() require := require.New(t) - tree := NewMutableTree(db.NewMemDB(), 100) + tree := NewMutableTree(memdb.NewMemDB(), 100) // Can't delete non-existent versions. require.Error(tree.DeleteVersion(1)) @@ -795,7 +797,7 @@ func TestVersionedCheckpointsSpecialCase(t *testing.T) { t.Parallel() require := require.New(t) - tree := NewMutableTree(db.NewMemDB(), 0) + tree := NewMutableTree(memdb.NewMemDB(), 0) key := []byte("k") tree.Set(key, []byte("val1")) @@ -822,7 +824,7 @@ func TestVersionedCheckpointsSpecialCase(t *testing.T) { func TestVersionedCheckpointsSpecialCase2(t *testing.T) { t.Parallel() - tree := NewMutableTree(db.NewMemDB(), 0) + tree := NewMutableTree(memdb.NewMemDB(), 0) tree.Set([]byte("U"), []byte("XamDUtiJ")) tree.Set([]byte("A"), []byte("UkZBuYIU")) @@ -844,7 +846,7 @@ func TestVersionedCheckpointsSpecialCase2(t *testing.T) { func TestVersionedCheckpointsSpecialCase3(t *testing.T) { t.Parallel() - tree := NewMutableTree(db.NewMemDB(), 0) + tree := NewMutableTree(memdb.NewMemDB(), 0) tree.Set([]byte("n"), []byte("2wUCUs8q")) tree.Set([]byte("l"), []byte("WQ7mvMbc")) @@ -866,7 +868,7 @@ func TestVersionedCheckpointsSpecialCase3(t *testing.T) { func TestVersionedCheckpointsSpecialCase4(t *testing.T) { t.Parallel() - tree := NewMutableTree(db.NewMemDB(), 0) + tree := NewMutableTree(memdb.NewMemDB(), 0) tree.Set([]byte("U"), []byte("XamDUtiJ")) tree.Set([]byte("A"), []byte("UkZBuYIU")) @@ -900,7 +902,7 @@ func TestVersionedCheckpointsSpecialCase4(t *testing.T) { func TestVersionedCheckpointsSpecialCase5(t *testing.T) { t.Parallel() - tree := NewMutableTree(db.NewMemDB(), 0) + tree := NewMutableTree(memdb.NewMemDB(), 0) tree.Set([]byte("R"), []byte("ygZlIzeW")) tree.SaveVersion() @@ -919,7 +921,7 @@ func TestVersionedCheckpointsSpecialCase5(t *testing.T) { func TestVersionedCheckpointsSpecialCase6(t *testing.T) { t.Parallel() - tree := NewMutableTree(db.NewMemDB(), 0) + tree := NewMutableTree(memdb.NewMemDB(), 0) tree.Set([]byte("Y"), []byte("MW79JQeV")) tree.Set([]byte("7"), []byte("Kp0ToUJB")) @@ -953,7 +955,7 @@ func TestVersionedCheckpointsSpecialCase6(t *testing.T) { func TestVersionedCheckpointsSpecialCase7(t *testing.T) { t.Parallel() - tree := NewMutableTree(db.NewMemDB(), 100) + tree := NewMutableTree(memdb.NewMemDB(), 100) tree.Set([]byte("n"), []byte("OtqD3nyn")) tree.Set([]byte("W"), []byte("kMdhJjF5")) @@ -989,7 +991,7 @@ func TestVersionedTreeEfficiency(t *testing.T) { t.Parallel() require := require.New(t) - tree := NewMutableTree(db.NewMemDB(), 0) + tree := NewMutableTree(memdb.NewMemDB(), 0) versions := 20 keysPerVersion := 100 keysAddedPerVersion := map[int]int{} @@ -1026,7 +1028,7 @@ func TestVersionedTreeProofs(t *testing.T) { t.Parallel() require := require.New(t) - tree := NewMutableTree(db.NewMemDB(), 0) + tree := NewMutableTree(memdb.NewMemDB(), 0) tree.Set([]byte("k1"), []byte("v1")) tree.Set([]byte("k2"), []byte("v1")) @@ -1101,7 +1103,7 @@ func TestOrphans(t *testing.T) { // Then randomly delete versions other than the first and last until only those two remain // Any remaining orphan nodes should be constrained to just the first version require := require.New(t) - tree := NewMutableTree(db.NewMemDB(), 100) + tree := NewMutableTree(memdb.NewMemDB(), 100) NUMVERSIONS := 100 NUMUPDATES := 100 @@ -1132,7 +1134,7 @@ func TestVersionedTreeHash(t *testing.T) { t.Parallel() require := require.New(t) - tree := NewMutableTree(db.NewMemDB(), 0) + tree := NewMutableTree(memdb.NewMemDB(), 0) require.Nil(tree.Hash()) tree.Set([]byte("I"), []byte("D")) @@ -1156,7 +1158,7 @@ func TestNilValueSemantics(t *testing.T) { t.Parallel() require := require.New(t) - tree := NewMutableTree(db.NewMemDB(), 0) + tree := NewMutableTree(memdb.NewMemDB(), 0) require.Panics(func() { tree.Set([]byte("k"), nil) @@ -1168,7 +1170,7 @@ func TestCopyValueSemantics(t *testing.T) { require := require.New(t) - tree := NewMutableTree(db.NewMemDB(), 0) + tree := NewMutableTree(memdb.NewMemDB(), 0) val := []byte("v1") @@ -1187,7 +1189,7 @@ func TestRollback(t *testing.T) { require := require.New(t) - tree := NewMutableTree(db.NewMemDB(), 0) + tree := NewMutableTree(memdb.NewMemDB(), 0) tree.Set([]byte("k"), []byte("v")) tree.SaveVersion() @@ -1216,7 +1218,7 @@ func TestRollback(t *testing.T) { func TestLazyLoadVersion(t *testing.T) { t.Parallel() - mdb := db.NewMemDB() + mdb := memdb.NewMemDB() tree := NewMutableTree(mdb, 0) maxVersions := 10 @@ -1258,7 +1260,7 @@ func TestOverwrite(t *testing.T) { require := require.New(t) - mdb := db.NewMemDB() + mdb := memdb.NewMemDB() tree := NewMutableTree(mdb, 0) // Set one kv pair and save version 1 @@ -1292,7 +1294,7 @@ func TestLoadVersionForOverwriting(t *testing.T) { require := require.New(t) - mdb := db.NewMemDB() + mdb := memdb.NewMemDB() tree := NewMutableTree(mdb, 0) maxLength := 100 @@ -1364,7 +1366,7 @@ func BenchmarkTreeLoadAndDelete(b *testing.B) { numVersions := 5000 numKeysPerVersion := 10 - d, err := db.NewGoLevelDB("bench", ".") + d, err := goleveldb.NewGoLevelDB("bench", ".") if err != nil { panic(err) } diff --git a/tm2/pkg/sdk/bank/common_test.go b/tm2/pkg/sdk/bank/common_test.go index fcbd5d2cb94..95b93157165 100644 --- a/tm2/pkg/sdk/bank/common_test.go +++ b/tm2/pkg/sdk/bank/common_test.go @@ -4,7 +4,7 @@ package bank import ( bft "github.com/gnolang/gno/tm2/pkg/bft/types" - dbm "github.com/gnolang/gno/tm2/pkg/db" + "github.com/gnolang/gno/tm2/pkg/db/memdb" "github.com/gnolang/gno/tm2/pkg/log" "github.com/gnolang/gno/tm2/pkg/sdk" @@ -21,7 +21,7 @@ type testEnv struct { } func setupTestEnv() testEnv { - db := dbm.NewMemDB() + db := memdb.NewMemDB() authCapKey := store.NewStoreKey("authCapKey") diff --git a/tm2/pkg/sdk/baseapp_test.go b/tm2/pkg/sdk/baseapp_test.go index 1d8e73acc8d..e2b5687d1a4 100644 --- a/tm2/pkg/sdk/baseapp_test.go +++ b/tm2/pkg/sdk/baseapp_test.go @@ -17,6 +17,7 @@ import ( abci "github.com/gnolang/gno/tm2/pkg/bft/abci/types" bft "github.com/gnolang/gno/tm2/pkg/bft/types" dbm "github.com/gnolang/gno/tm2/pkg/db" + "github.com/gnolang/gno/tm2/pkg/db/memdb" "github.com/gnolang/gno/tm2/pkg/sdk/testutils" "github.com/gnolang/gno/tm2/pkg/std" "github.com/gnolang/gno/tm2/pkg/store/dbadapter" @@ -74,7 +75,7 @@ func newBaseApp(name string, db dbm.DB, options ...func(*BaseApp)) *BaseApp { func setupBaseApp(t *testing.T, options ...func(*BaseApp)) *BaseApp { t.Helper() - db := dbm.NewMemDB() + db := memdb.NewMemDB() app := newBaseApp(t.Name(), db, options...) require.Equal(t, t.Name(), app.Name()) err := app.LoadLatestVersion() @@ -101,7 +102,7 @@ func TestLoadVersion(t *testing.T) { pruningOpt := SetPruningOptions(store.PruneSyncable) name := t.Name() - db := dbm.NewMemDB() + db := memdb.NewMemDB() app := newBaseApp(name, db, pruningOpt) // make a cap key and mount the store @@ -150,7 +151,7 @@ func TestAppVersionSetterGetter(t *testing.T) { pruningOpt := SetPruningOptions(store.PruneSyncable) name := t.Name() - db := dbm.NewMemDB() + db := memdb.NewMemDB() app := newBaseApp(name, db, pruningOpt) require.Equal(t, "", app.AppVersion()) @@ -171,7 +172,7 @@ func TestLoadVersionInvalid(t *testing.T) { pruningOpt := SetPruningOptions(store.PruneSyncable) name := t.Name() - db := dbm.NewMemDB() + db := memdb.NewMemDB() app := newBaseApp(name, db, pruningOpt) err := app.LoadLatestVersion() @@ -211,7 +212,7 @@ func testLoadVersionHelper(t *testing.T, app *BaseApp, expectedHeight int64, exp func TestOptionFunction(t *testing.T) { t.Parallel() - db := dbm.NewMemDB() + db := memdb.NewMemDB() bap := newBaseApp("starting name", db, testChangeNameHelper("new name")) require.Equal(t, bap.name, "new name", "BaseApp should have had name changed via option function") } @@ -226,7 +227,7 @@ func testChangeNameHelper(name string) func(*BaseApp) { func TestInfo(t *testing.T) { t.Parallel() - db := dbm.NewMemDB() + db := memdb.NewMemDB() app := newBaseApp(t.Name(), db) // ----- test an empty response ------- @@ -279,7 +280,7 @@ func TestSetMinGasPrices(t *testing.T) { minGasPrices, err := ParseGasPrices("5000stake/10gas") require.Nil(t, err) - db := dbm.NewMemDB() + db := memdb.NewMemDB() app := newBaseApp(t.Name(), db, SetMinGasPrices("5000stake/10gas")) require.Equal(t, minGasPrices, app.minGasPrices) } @@ -290,7 +291,7 @@ func TestInitChainer(t *testing.T) { name := t.Name() // keep the db and logger ourselves so // we can reload the same app later - db := dbm.NewMemDB() + db := memdb.NewMemDB() app := newBaseApp(name, db) // set a value in the store on init chain diff --git a/tm2/pkg/store/README.md b/tm2/pkg/store/README.md index eac90830cfa..abf5c26bc07 100644 --- a/tm2/pkg/store/README.md +++ b/tm2/pkg/store/README.md @@ -2,7 +2,7 @@ ## CacheKV -`cachekv.Store` is a wrapper `KVStore` which provides buffered writing / cached reading functionalities over the underlying `KVStore`. +`cachekv.Store` is a wrapper `KVStore` which provides buffered writing / cached reading functionalities over the underlying `KVStore`. ```go type Store struct { @@ -50,7 +50,7 @@ type Store struct { ## IAVL -`iavl.Store` is a base-layer self-balancing merkle tree. It is guaranteed that +`iavl.Store` is a base-layer self-balancing merkle tree. It is guaranteed that 1. Get & set operations are `O(log n)`, where `n` is the number of elements in the tree 2. Iteration efficiently returns the sorted elements within the range @@ -112,7 +112,7 @@ type traceOperation struct { Key string Value string Metadata map[string]interface{} -} +} ``` `traceOperation.Metadata` is filled with `Store.context` when it is not nil. `TraceContext` is a `map[string]interface{}`. @@ -127,4 +127,4 @@ type Store struct { } ``` -`Store.Store` is a `dbadapter.Store` with a `dbm.NewMemDB()`. All `KVStore` methods are reused. When `Store.Commit()` is called, new `dbadapter.Store` is assigned, discarding previous reference and making it garbage collected. +`Store.Store` is a `dbadapter.Store` with a `memdb.NewMemDB()`. All `KVStore` methods are reused. When `Store.Commit()` is called, new `dbadapter.Store` is assigned, discarding previous reference and making it garbage collected. diff --git a/tm2/pkg/store/cache/store_bench_test.go b/tm2/pkg/store/cache/store_bench_test.go index 63e6f2ebbdc..6413db9f706 100644 --- a/tm2/pkg/store/cache/store_bench_test.go +++ b/tm2/pkg/store/cache/store_bench_test.go @@ -5,8 +5,7 @@ import ( "sort" "testing" - dbm "github.com/gnolang/gno/tm2/pkg/db" - + "github.com/gnolang/gno/tm2/pkg/db/memdb" "github.com/gnolang/gno/tm2/pkg/store/cache" "github.com/gnolang/gno/tm2/pkg/store/dbadapter" ) @@ -14,7 +13,7 @@ import ( func benchmarkCacheStoreIterator(b *testing.B, numKVs int) { b.Helper() - mem := dbadapter.Store{DB: dbm.NewMemDB()} + mem := dbadapter.Store{DB: memdb.NewMemDB()} cstore := cache.New(mem) keys := make([]string, numKVs, numKVs) diff --git a/tm2/pkg/store/cache/store_test.go b/tm2/pkg/store/cache/store_test.go index adf122fc637..4ac8cc64de9 100644 --- a/tm2/pkg/store/cache/store_test.go +++ b/tm2/pkg/store/cache/store_test.go @@ -7,6 +7,7 @@ import ( "github.com/stretchr/testify/require" dbm "github.com/gnolang/gno/tm2/pkg/db" + "github.com/gnolang/gno/tm2/pkg/db/memdb" "github.com/gnolang/gno/tm2/pkg/random" "github.com/gnolang/gno/tm2/pkg/store/cache" "github.com/gnolang/gno/tm2/pkg/store/dbadapter" @@ -14,7 +15,7 @@ import ( ) func newCacheStore() types.Store { - mem := dbadapter.Store{dbm.NewMemDB()} + mem := dbadapter.Store{memdb.NewMemDB()} return cache.New(mem) } @@ -24,7 +25,7 @@ func valFmt(i int) []byte { return bz(fmt.Sprintf("value%0.8d", i)) } func TestCacheStore(t *testing.T) { t.Parallel() - mem := dbadapter.Store{dbm.NewMemDB()} + mem := dbadapter.Store{memdb.NewMemDB()} st := cache.New(mem) require.Empty(t, st.Get(keyFmt(1)), "Expected `key1` to be empty") @@ -69,7 +70,7 @@ func TestCacheStore(t *testing.T) { func TestCacheStoreNoNilSet(t *testing.T) { t.Parallel() - mem := dbadapter.Store{dbm.NewMemDB()} + mem := dbadapter.Store{memdb.NewMemDB()} st := cache.New(mem) require.Panics(t, func() { st.Set([]byte("key"), nil) }, "setting a nil value should panic") } @@ -77,7 +78,7 @@ func TestCacheStoreNoNilSet(t *testing.T) { func TestCacheStoreNested(t *testing.T) { t.Parallel() - mem := dbadapter.Store{dbm.NewMemDB()} + mem := dbadapter.Store{memdb.NewMemDB()} st := cache.New(mem) // set. check its there on st and not on mem. @@ -286,7 +287,7 @@ func TestCacheKVMergeIteratorDeletes(t *testing.T) { t.Parallel() st := newCacheStore() - truth := dbm.NewMemDB() + truth := memdb.NewMemDB() // set some items and write them nItems := 10 @@ -303,7 +304,7 @@ func TestCacheKVMergeIteratorDeletes(t *testing.T) { // reset st = newCacheStore() - truth = dbm.NewMemDB() + truth = memdb.NewMemDB() // set some items and write them for i := 0; i < nItems; i++ { @@ -324,7 +325,7 @@ func TestCacheKVMergeIteratorChunks(t *testing.T) { st := newCacheStore() // Use the truth to check values on the merge iterator - truth := dbm.NewMemDB() + truth := memdb.NewMemDB() // sets to the parent setRange(st, truth, 0, 20) @@ -355,7 +356,7 @@ func TestCacheKVMergeIteratorRandom(t *testing.T) { t.Parallel() st := newCacheStore() - truth := dbm.NewMemDB() + truth := memdb.NewMemDB() start, end := 25, 975 max := 1000 diff --git a/tm2/pkg/store/gas/store_test.go b/tm2/pkg/store/gas/store_test.go index 54729abf2ed..5b8cc7c656c 100644 --- a/tm2/pkg/store/gas/store_test.go +++ b/tm2/pkg/store/gas/store_test.go @@ -4,8 +4,7 @@ import ( "fmt" "testing" - dbm "github.com/gnolang/gno/tm2/pkg/db" - + "github.com/gnolang/gno/tm2/pkg/db/memdb" "github.com/gnolang/gno/tm2/pkg/store/dbadapter" "github.com/gnolang/gno/tm2/pkg/store/gas" "github.com/gnolang/gno/tm2/pkg/store/types" @@ -21,7 +20,7 @@ func valFmt(i int) []byte { return bz(fmt.Sprintf("value%0.8d", i)) } func TestGasKVStoreBasic(t *testing.T) { t.Parallel() - mem := dbadapter.Store{dbm.NewMemDB()} + mem := dbadapter.Store{memdb.NewMemDB()} meter := types.NewGasMeter(10000) st := gas.New(mem, meter, types.DefaultGasConfig()) require.Empty(t, st.Get(keyFmt(1)), "Expected `key1` to be empty") @@ -35,7 +34,7 @@ func TestGasKVStoreBasic(t *testing.T) { func TestGasKVStoreIterator(t *testing.T) { t.Parallel() - mem := dbadapter.Store{dbm.NewMemDB()} + mem := dbadapter.Store{memdb.NewMemDB()} meter := types.NewGasMeter(10000) st := gas.New(mem, meter, types.DefaultGasConfig()) require.Empty(t, st.Get(keyFmt(1)), "Expected `key1` to be empty") @@ -61,7 +60,7 @@ func TestGasKVStoreIterator(t *testing.T) { func TestGasKVStoreOutOfGasSet(t *testing.T) { t.Parallel() - mem := dbadapter.Store{dbm.NewMemDB()} + mem := dbadapter.Store{memdb.NewMemDB()} meter := types.NewGasMeter(0) st := gas.New(mem, meter, types.DefaultGasConfig()) require.Panics(t, func() { st.Set(keyFmt(1), valFmt(1)) }, "Expected out-of-gas") @@ -70,7 +69,7 @@ func TestGasKVStoreOutOfGasSet(t *testing.T) { func TestGasKVStoreOutOfGasIterator(t *testing.T) { t.Parallel() - mem := dbadapter.Store{dbm.NewMemDB()} + mem := dbadapter.Store{memdb.NewMemDB()} meter := types.NewGasMeter(20000) st := gas.New(mem, meter, types.DefaultGasConfig()) st.Set(keyFmt(1), valFmt(1)) diff --git a/tm2/pkg/store/iavl/store_test.go b/tm2/pkg/store/iavl/store_test.go index a29dbab096a..6959e9172dc 100644 --- a/tm2/pkg/store/iavl/store_test.go +++ b/tm2/pkg/store/iavl/store_test.go @@ -9,6 +9,7 @@ import ( "github.com/gnolang/gno/tm2/pkg/amino" abci "github.com/gnolang/gno/tm2/pkg/bft/abci/types" dbm "github.com/gnolang/gno/tm2/pkg/db" + "github.com/gnolang/gno/tm2/pkg/db/memdb" "github.com/gnolang/gno/tm2/pkg/iavl" "github.com/gnolang/gno/tm2/pkg/random" @@ -51,7 +52,7 @@ func newAlohaTree(t *testing.T, db dbm.DB) (*iavl.MutableTree, types.CommitID) { func TestGetImmutable(t *testing.T) { t.Parallel() - db := dbm.NewMemDB() + db := memdb.NewMemDB() tree, cID := newAlohaTree(t, db) store := UnsafeNewStore(tree, storeOptions(10, 10)) @@ -83,7 +84,7 @@ func TestGetImmutable(t *testing.T) { func TestTestGetImmutableIterator(t *testing.T) { t.Parallel() - db := dbm.NewMemDB() + db := memdb.NewMemDB() tree, cID := newAlohaTree(t, db) store := UnsafeNewStore(tree, storeOptions(10, 10)) @@ -108,7 +109,7 @@ func TestTestGetImmutableIterator(t *testing.T) { func TestIAVLStoreGetSetHasDelete(t *testing.T) { t.Parallel() - db := dbm.NewMemDB() + db := memdb.NewMemDB() tree, _ := newAlohaTree(t, db) iavlStore := UnsafeNewStore(tree, storeOptions(numRecent, storeEvery)) @@ -135,7 +136,7 @@ func TestIAVLStoreGetSetHasDelete(t *testing.T) { func TestIAVLStoreNoNilSet(t *testing.T) { t.Parallel() - db := dbm.NewMemDB() + db := memdb.NewMemDB() tree, _ := newAlohaTree(t, db) iavlStore := UnsafeNewStore(tree, storeOptions(numRecent, storeEvery)) require.Panics(t, func() { iavlStore.Set([]byte("key"), nil) }, "setting a nil value should panic") @@ -144,7 +145,7 @@ func TestIAVLStoreNoNilSet(t *testing.T) { func TestIAVLIterator(t *testing.T) { t.Parallel() - db := dbm.NewMemDB() + db := memdb.NewMemDB() tree, _ := newAlohaTree(t, db) iavlStore := UnsafeNewStore(tree, storeOptions(numRecent, storeEvery)) iter := iavlStore.Iterator([]byte("aloha"), []byte("hellz")) @@ -219,7 +220,7 @@ func TestIAVLIterator(t *testing.T) { func TestIAVLReverseIterator(t *testing.T) { t.Parallel() - db := dbm.NewMemDB() + db := memdb.NewMemDB() tree := iavl.NewMutableTree(db, cacheSize) iavlStore := UnsafeNewStore(tree, storeOptions(numRecent, storeEvery)) @@ -254,7 +255,7 @@ func TestIAVLReverseIterator(t *testing.T) { func TestIAVLPrefixIterator(t *testing.T) { t.Parallel() - db := dbm.NewMemDB() + db := memdb.NewMemDB() tree := iavl.NewMutableTree(db, cacheSize) iavlStore := UnsafeNewStore(tree, storeOptions(numRecent, storeEvery)) @@ -318,7 +319,7 @@ func TestIAVLPrefixIterator(t *testing.T) { func TestIAVLReversePrefixIterator(t *testing.T) { t.Parallel() - db := dbm.NewMemDB() + db := memdb.NewMemDB() tree := iavl.NewMutableTree(db, cacheSize) iavlStore := UnsafeNewStore(tree, storeOptions(numRecent, storeEvery)) @@ -443,7 +444,7 @@ type pruneState struct { func testPruning(t *testing.T, numRecent int64, storeEvery int64, states []pruneState) { t.Helper() - db := dbm.NewMemDB() + db := memdb.NewMemDB() tree := iavl.NewMutableTree(db, cacheSize) iavlStore := UnsafeNewStore(tree, storeOptions(numRecent, storeEvery)) for step, state := range states { @@ -464,7 +465,7 @@ func testPruning(t *testing.T, numRecent int64, storeEvery int64, states []prune func TestIAVLNoPrune(t *testing.T) { t.Parallel() - db := dbm.NewMemDB() + db := memdb.NewMemDB() tree := iavl.NewMutableTree(db, cacheSize) iavlStore := UnsafeNewStore(tree, storeOptions(numRecent, int64(1))) nextVersion(iavlStore) @@ -481,7 +482,7 @@ func TestIAVLNoPrune(t *testing.T) { func TestIAVLPruneEverything(t *testing.T) { t.Parallel() - db := dbm.NewMemDB() + db := memdb.NewMemDB() tree := iavl.NewMutableTree(db, cacheSize) iavlStore := UnsafeNewStore(tree, storeOptions(int64(0), int64(0))) nextVersion(iavlStore) @@ -501,7 +502,7 @@ func TestIAVLPruneEverything(t *testing.T) { func TestIAVLStoreQuery(t *testing.T) { t.Parallel() - db := dbm.NewMemDB() + db := memdb.NewMemDB() tree := iavl.NewMutableTree(db, cacheSize) iavlStore := UnsafeNewStore(tree, storeOptions(numRecent, storeEvery)) @@ -591,7 +592,7 @@ func TestIAVLStoreQuery(t *testing.T) { } func BenchmarkIAVLIteratorNext(b *testing.B) { - db := dbm.NewMemDB() + db := memdb.NewMemDB() treeSize := 1000 tree := iavl.NewMutableTree(db, cacheSize) for i := 0; i < treeSize; i++ { diff --git a/tm2/pkg/store/prefix/store_test.go b/tm2/pkg/store/prefix/store_test.go index 6f70c5bd16f..701ceda17d5 100644 --- a/tm2/pkg/store/prefix/store_test.go +++ b/tm2/pkg/store/prefix/store_test.go @@ -6,7 +6,7 @@ import ( "github.com/stretchr/testify/require" - dbm "github.com/gnolang/gno/tm2/pkg/db" + "github.com/gnolang/gno/tm2/pkg/db/memdb" tiavl "github.com/gnolang/gno/tm2/pkg/iavl" "github.com/gnolang/gno/tm2/pkg/store/dbadapter" @@ -90,7 +90,7 @@ func testPrefixStore(t *testing.T, baseStore types.Store, prefix []byte) { func TestIAVLStorePrefix(t *testing.T) { t.Parallel() - db := dbm.NewMemDB() + db := memdb.NewMemDB() tree := tiavl.NewMutableTree(db, cacheSize) iavlStore := iavl.UnsafeNewStore(tree, types.StoreOptions{ PruningOptions: types.PruningOptions{ @@ -106,7 +106,7 @@ func TestPrefixStoreNoNilSet(t *testing.T) { t.Parallel() meter := types.NewGasMeter(100000000) - mem := dbadapter.Store{dbm.NewMemDB()} + mem := dbadapter.Store{memdb.NewMemDB()} gasStore := gas.New(mem, meter, types.DefaultGasConfig()) require.Panics(t, func() { gasStore.Set([]byte("key"), nil) }, "setting a nil value should panic") } @@ -114,7 +114,7 @@ func TestPrefixStoreNoNilSet(t *testing.T) { func TestPrefixStoreIterate(t *testing.T) { t.Parallel() - db := dbm.NewMemDB() + db := memdb.NewMemDB() baseStore := dbadapter.Store{db} prefix := []byte("test") prefixStore := New(baseStore, prefix) @@ -164,7 +164,7 @@ func TestCloneAppend(t *testing.T) { func TestPrefixStoreIteratorEdgeCase(t *testing.T) { t.Parallel() - db := dbm.NewMemDB() + db := memdb.NewMemDB() baseStore := dbadapter.Store{db} // overflow in cpIncr @@ -196,7 +196,7 @@ func TestPrefixStoreIteratorEdgeCase(t *testing.T) { func TestPrefixStoreReverseIteratorEdgeCase(t *testing.T) { t.Parallel() - db := dbm.NewMemDB() + db := memdb.NewMemDB() baseStore := dbadapter.Store{db} // overflow in cpIncr @@ -224,7 +224,7 @@ func TestPrefixStoreReverseIteratorEdgeCase(t *testing.T) { iter.Close() - db = dbm.NewMemDB() + db = memdb.NewMemDB() baseStore = dbadapter.Store{db} // underflow in cpDecr @@ -255,7 +255,7 @@ func TestPrefixStoreReverseIteratorEdgeCase(t *testing.T) { // Tests below are ported from https://github.com/tendermint/classic/blob/master/libs/db/prefix_db_test.go func mockStoreWithStuff() types.Store { - db := dbm.NewMemDB() + db := memdb.NewMemDB() store := dbadapter.Store{db} // Under "key" prefix store.Set(bz("key"), bz("value")) diff --git a/tm2/pkg/store/rootmulti/proof_test.go b/tm2/pkg/store/rootmulti/proof_test.go index c79cbb07bd5..fa904563c79 100644 --- a/tm2/pkg/store/rootmulti/proof_test.go +++ b/tm2/pkg/store/rootmulti/proof_test.go @@ -6,7 +6,7 @@ import ( "github.com/stretchr/testify/require" abci "github.com/gnolang/gno/tm2/pkg/bft/abci/types" - dbm "github.com/gnolang/gno/tm2/pkg/db" + "github.com/gnolang/gno/tm2/pkg/db/memdb" "github.com/gnolang/gno/tm2/pkg/store/iavl" "github.com/gnolang/gno/tm2/pkg/store/types" @@ -16,7 +16,7 @@ func TestVerifyIAVLStoreQueryProof(t *testing.T) { t.Parallel() // Create main tree for testing. - db := dbm.NewMemDB() + db := memdb.NewMemDB() opts := types.StoreOptions{ PruningOptions: types.PruneNothing, } @@ -63,7 +63,7 @@ func TestVerifyMultiStoreQueryProof(t *testing.T) { t.Parallel() // Create main tree for testing. - db := dbm.NewMemDB() + db := memdb.NewMemDB() store := NewMultiStore(db) iavlStoreKey := types.NewStoreKey("iavlStoreKey") @@ -120,7 +120,7 @@ func TestVerifyMultiStoreQueryProofEmptyStore(t *testing.T) { t.Parallel() // Create main tree for testing. - db := dbm.NewMemDB() + db := memdb.NewMemDB() store := NewMultiStore(db) iavlStoreKey := types.NewStoreKey("iavlStoreKey") @@ -151,7 +151,7 @@ func TestVerifyMultiStoreQueryProofAbsence(t *testing.T) { t.Parallel() // Create main tree for testing. - db := dbm.NewMemDB() + db := memdb.NewMemDB() store := NewMultiStore(db) iavlStoreKey := types.NewStoreKey("iavlStoreKey") diff --git a/tm2/pkg/store/rootmulti/store_test.go b/tm2/pkg/store/rootmulti/store_test.go index e6a04ee5ded..731daa8171b 100644 --- a/tm2/pkg/store/rootmulti/store_test.go +++ b/tm2/pkg/store/rootmulti/store_test.go @@ -9,6 +9,7 @@ import ( abci "github.com/gnolang/gno/tm2/pkg/bft/abci/types" "github.com/gnolang/gno/tm2/pkg/crypto/merkle" dbm "github.com/gnolang/gno/tm2/pkg/db" + "github.com/gnolang/gno/tm2/pkg/db/memdb" "github.com/gnolang/gno/tm2/pkg/store/iavl" "github.com/gnolang/gno/tm2/pkg/store/types" @@ -17,7 +18,7 @@ import ( func TestStoreType(t *testing.T) { t.Parallel() - db := dbm.NewMemDB() + db := memdb.NewMemDB() store := NewMultiStore(db) store.MountStoreWithDB( types.NewStoreKey("store1"), iavl.StoreConstructor, db) @@ -26,7 +27,7 @@ func TestStoreType(t *testing.T) { func TestStoreMount(t *testing.T) { t.Parallel() - db := dbm.NewMemDB() + db := memdb.NewMemDB() store := NewMultiStore(db) key1 := types.NewStoreKey("store1") @@ -43,7 +44,7 @@ func TestStoreMount(t *testing.T) { func TestCacheMultiStoreWithVersion(t *testing.T) { t.Parallel() - var db dbm.DB = dbm.NewMemDB() + var db dbm.DB = memdb.NewMemDB() ms := newMultiStoreWithMounts(db) err := ms.LoadLatestVersion() require.Nil(t, err) @@ -82,7 +83,7 @@ func TestCacheMultiStoreWithVersion(t *testing.T) { func TestHashStableWithEmptyCommit(t *testing.T) { t.Parallel() - var db dbm.DB = dbm.NewMemDB() + var db dbm.DB = memdb.NewMemDB() ms := newMultiStoreWithMounts(db) err := ms.LoadLatestVersion() require.Nil(t, err) @@ -108,7 +109,7 @@ func TestHashStableWithEmptyCommit(t *testing.T) { func TestMultistoreCommitLoad(t *testing.T) { t.Parallel() - var db dbm.DB = dbm.NewMemDB() + var db dbm.DB = memdb.NewMemDB() store := newMultiStoreWithMounts(db) err := store.LoadLatestVersion() require.Nil(t, err) @@ -192,7 +193,7 @@ func TestParsePath(t *testing.T) { func TestMultiStoreQuery(t *testing.T) { t.Parallel() - db := dbm.NewMemDB() + db := memdb.NewMemDB() multi := newMultiStoreWithMounts(db) err := multi.LoadLatestVersion() require.Nil(t, err) From 0f3e12c650302b235e7b2159143da4f9c8a12a9e Mon Sep 17 00:00:00 2001 From: Morgan Bazalgette Date: Tue, 30 Jan 2024 15:26:49 +0100 Subject: [PATCH 06/14] fix old references --- tm2/pkg/bft/blockchain/reactor_test.go | 5 +++-- tm2/pkg/bft/consensus/replay_test.go | 17 +++++++++-------- tm2/pkg/bft/consensus/wal_test.go | 3 ++- tm2/pkg/bft/node/node_test.go | 3 ++- tm2/pkg/bft/state/execution_test.go | 9 +++++---- tm2/pkg/bft/state/helpers_test.go | 5 +++-- 6 files changed, 24 insertions(+), 18 deletions(-) diff --git a/tm2/pkg/bft/blockchain/reactor_test.go b/tm2/pkg/bft/blockchain/reactor_test.go index e9de000f2d6..dc681fbb31a 100644 --- a/tm2/pkg/bft/blockchain/reactor_test.go +++ b/tm2/pkg/bft/blockchain/reactor_test.go @@ -11,6 +11,7 @@ import ( "github.com/stretchr/testify/assert" abci "github.com/gnolang/gno/tm2/pkg/bft/abci/types" + "github.com/gnolang/gno/tm2/pkg/bft/appconn" cfg "github.com/gnolang/gno/tm2/pkg/bft/config" "github.com/gnolang/gno/tm2/pkg/bft/mempool/mock" "github.com/gnolang/gno/tm2/pkg/bft/proxy" @@ -49,7 +50,7 @@ func randGenesisDoc(numValidators int, randPower bool, minPower int64) (*types.G type BlockchainReactorPair struct { reactor *BlockchainReactor - app proxy.AppConns + app appconn.AppConns } func newBlockchainReactor(logger *slog.Logger, genDoc *types.GenesisDoc, privVals []types.PrivValidator, maxBlockHeight int64) BlockchainReactorPair { @@ -59,7 +60,7 @@ func newBlockchainReactor(logger *slog.Logger, genDoc *types.GenesisDoc, privVal app := &testApp{} cc := proxy.NewLocalClientCreator(app) - proxyApp := proxy.NewAppConns(cc) + proxyApp := appconn.NewAppConns(cc) err := proxyApp.Start() if err != nil { panic(errors.Wrap(err, "error start app")) diff --git a/tm2/pkg/bft/consensus/replay_test.go b/tm2/pkg/bft/consensus/replay_test.go index 8d5b8c87b89..3c04e230c29 100644 --- a/tm2/pkg/bft/consensus/replay_test.go +++ b/tm2/pkg/bft/consensus/replay_test.go @@ -21,6 +21,7 @@ import ( "github.com/gnolang/gno/tm2/pkg/amino" "github.com/gnolang/gno/tm2/pkg/bft/abci/example/kvstore" abci "github.com/gnolang/gno/tm2/pkg/bft/abci/types" + "github.com/gnolang/gno/tm2/pkg/bft/appconn" cfg "github.com/gnolang/gno/tm2/pkg/bft/config" cstypes "github.com/gnolang/gno/tm2/pkg/bft/consensus/types" "github.com/gnolang/gno/tm2/pkg/bft/mempool/mock" @@ -691,7 +692,7 @@ func testHandshakeReplay(t *testing.T, config *cfg.Config, nBlocks int, mode uin if nBlocks > 0 { // run nBlocks against a new client to build up the app state. // use a throwaway tendermint state - proxyApp := proxy.NewAppConns(clientCreator2) + proxyApp := appconn.NewAppConns(clientCreator2) stateDB1 := memdb.NewMemDB() sm.SaveState(stateDB1, genesisState) buildAppStateFromChain(proxyApp, stateDB1, genesisState, chain, nBlocks, mode) @@ -702,7 +703,7 @@ func testHandshakeReplay(t *testing.T, config *cfg.Config, nBlocks int, mode uin genDoc, _ := sm.MakeGenesisDocFromFile(config.GenesisFile()) handshaker := NewHandshaker(stateDB, state, store, genDoc) handshaker.SetEventSwitch(evsw) - proxyApp := proxy.NewAppConns(clientCreator2) + proxyApp := appconn.NewAppConns(clientCreator2) if err := proxyApp.Start(); err != nil { t.Fatalf("Error starting proxy app connections: %v", err) } @@ -734,7 +735,7 @@ func testHandshakeReplay(t *testing.T, config *cfg.Config, nBlocks int, mode uin } } -func applyBlock(stateDB dbm.DB, st sm.State, blk *types.Block, proxyApp proxy.AppConns) sm.State { +func applyBlock(stateDB dbm.DB, st sm.State, blk *types.Block, proxyApp appconn.AppConns) sm.State { testPartSize := types.BlockPartSizeBytes blockExec := sm.NewBlockExecutor(stateDB, log.NewNoopLogger(), proxyApp.Consensus(), mempool) @@ -746,7 +747,7 @@ func applyBlock(stateDB dbm.DB, st sm.State, blk *types.Block, proxyApp proxy.Ap return newState } -func buildAppStateFromChain(proxyApp proxy.AppConns, stateDB dbm.DB, +func buildAppStateFromChain(proxyApp appconn.AppConns, stateDB dbm.DB, state sm.State, chain []*types.Block, nBlocks int, mode uint, ) { // start a new app without handshake, play nBlocks blocks @@ -789,7 +790,7 @@ func buildTMStateFromChain(config *cfg.Config, stateDB dbm.DB, state sm.State, c app := kvstore.NewPersistentKVStoreApplication(filepath.Join(config.DBDir(), fmt.Sprintf("replay_test_%d_%d_t", nBlocks, mode))) defer app.Close() clientCreator := proxy.NewLocalClientCreator(app) - proxyApp := proxy.NewAppConns(clientCreator) + proxyApp := appconn.NewAppConns(clientCreator) if err := proxyApp.Start(); err != nil { panic(err) } @@ -851,7 +852,7 @@ func TestHandshakePanicsIfAppReturnsWrongAppHash(t *testing.T) { { app := &badApp{numBlocks: 3, allHashesAreWrong: true} clientCreator := proxy.NewLocalClientCreator(app) - proxyApp := proxy.NewAppConns(clientCreator) + proxyApp := appconn.NewAppConns(clientCreator) err := proxyApp.Start() require.NoError(t, err) defer proxyApp.Stop() @@ -869,7 +870,7 @@ func TestHandshakePanicsIfAppReturnsWrongAppHash(t *testing.T) { { app := &badApp{numBlocks: 3, onlyLastHashIsWrong: true} clientCreator := proxy.NewLocalClientCreator(app) - proxyApp := proxy.NewAppConns(clientCreator) + proxyApp := appconn.NewAppConns(clientCreator) err := proxyApp.Start() require.NoError(t, err) defer proxyApp.Stop() @@ -1125,7 +1126,7 @@ func TestHandshakeUpdatesValidators(t *testing.T) { // now start the app using the handshake - it should sync genDoc, _ := sm.MakeGenesisDocFromFile(config.GenesisFile()) handshaker := NewHandshaker(stateDB, state, store, genDoc) - proxyApp := proxy.NewAppConns(clientCreator) + proxyApp := appconn.NewAppConns(clientCreator) if err := proxyApp.Start(); err != nil { t.Fatalf("Error starting proxy app connections: %v", err) } diff --git a/tm2/pkg/bft/consensus/wal_test.go b/tm2/pkg/bft/consensus/wal_test.go index 15c17f79c22..42651c0727d 100644 --- a/tm2/pkg/bft/consensus/wal_test.go +++ b/tm2/pkg/bft/consensus/wal_test.go @@ -14,6 +14,7 @@ import ( auto "github.com/gnolang/gno/tm2/pkg/autofile" "github.com/gnolang/gno/tm2/pkg/bft/abci/example/kvstore" + "github.com/gnolang/gno/tm2/pkg/bft/appconn" "github.com/gnolang/gno/tm2/pkg/bft/mempool/mock" "github.com/gnolang/gno/tm2/pkg/bft/privval" "github.com/gnolang/gno/tm2/pkg/bft/proxy" @@ -139,7 +140,7 @@ func WALGenerateNBlocks(t *testing.T, wr io.Writer, numBlocks int) (err error) { sm.SaveState(stateDB, state) blockStore := store.NewBlockStore(blockStoreDB) - proxyApp := proxy.NewAppConns(proxy.NewLocalClientCreator(app)) + proxyApp := appconn.NewAppConns(proxy.NewLocalClientCreator(app)) proxyApp.SetLogger(logger.With("module", "proxy")) if err := proxyApp.Start(); err != nil { return errors.Wrap(err, "failed to start proxy app connections") diff --git a/tm2/pkg/bft/node/node_test.go b/tm2/pkg/bft/node/node_test.go index 4c38695a2fa..e5f0c2b9c31 100644 --- a/tm2/pkg/bft/node/node_test.go +++ b/tm2/pkg/bft/node/node_test.go @@ -12,6 +12,7 @@ import ( "github.com/stretchr/testify/require" "github.com/gnolang/gno/tm2/pkg/bft/abci/example/kvstore" + "github.com/gnolang/gno/tm2/pkg/bft/appconn" cfg "github.com/gnolang/gno/tm2/pkg/bft/config" mempl "github.com/gnolang/gno/tm2/pkg/bft/mempool" "github.com/gnolang/gno/tm2/pkg/bft/privval" @@ -224,7 +225,7 @@ func TestCreateProposalBlock(t *testing.T) { config := cfg.ResetTestRoot("node_create_proposal") defer os.RemoveAll(config.RootDir) cc := proxy.NewLocalClientCreator(kvstore.NewKVStoreApplication()) - proxyApp := proxy.NewAppConns(cc) + proxyApp := appconn.NewAppConns(cc) err := proxyApp.Start() require.Nil(t, err) defer proxyApp.Stop() diff --git a/tm2/pkg/bft/state/execution_test.go b/tm2/pkg/bft/state/execution_test.go index 18dd8746840..008ec19be03 100644 --- a/tm2/pkg/bft/state/execution_test.go +++ b/tm2/pkg/bft/state/execution_test.go @@ -11,6 +11,7 @@ import ( "github.com/gnolang/gno/tm2/pkg/async" "github.com/gnolang/gno/tm2/pkg/bft/abci/example/kvstore" abci "github.com/gnolang/gno/tm2/pkg/bft/abci/types" + "github.com/gnolang/gno/tm2/pkg/bft/appconn" "github.com/gnolang/gno/tm2/pkg/bft/mempool/mock" "github.com/gnolang/gno/tm2/pkg/bft/proxy" sm "github.com/gnolang/gno/tm2/pkg/bft/state" @@ -32,7 +33,7 @@ func TestApplyBlock(t *testing.T) { t.Parallel() cc := proxy.NewLocalClientCreator(kvstore.NewKVStoreApplication()) - proxyApp := proxy.NewAppConns(cc) + proxyApp := appconn.NewAppConns(cc) err := proxyApp.Start() require.Nil(t, err) defer proxyApp.Stop() @@ -59,7 +60,7 @@ func TestBeginBlockValidators(t *testing.T) { app := &testApp{} cc := proxy.NewLocalClientCreator(app) - proxyApp := proxy.NewAppConns(cc) + proxyApp := appconn.NewAppConns(cc) err := proxyApp.Start() require.Nil(t, err) defer proxyApp.Stop() @@ -266,7 +267,7 @@ func TestEndBlockValidatorUpdates(t *testing.T) { app := &testApp{} cc := proxy.NewLocalClientCreator(app) - proxyApp := proxy.NewAppConns(cc) + proxyApp := appconn.NewAppConns(cc) err := proxyApp.Start() require.Nil(t, err) defer proxyApp.Stop() @@ -334,7 +335,7 @@ func TestEndBlockValidatorUpdatesResultingInEmptySet(t *testing.T) { app := &testApp{} cc := proxy.NewLocalClientCreator(app) - proxyApp := proxy.NewAppConns(cc) + proxyApp := appconn.NewAppConns(cc) err := proxyApp.Start() require.Nil(t, err) defer proxyApp.Stop() diff --git a/tm2/pkg/bft/state/helpers_test.go b/tm2/pkg/bft/state/helpers_test.go index b8b041635c6..0b8dba98221 100644 --- a/tm2/pkg/bft/state/helpers_test.go +++ b/tm2/pkg/bft/state/helpers_test.go @@ -5,6 +5,7 @@ import ( "fmt" abci "github.com/gnolang/gno/tm2/pkg/bft/abci/types" + "github.com/gnolang/gno/tm2/pkg/bft/appconn" "github.com/gnolang/gno/tm2/pkg/bft/proxy" sm "github.com/gnolang/gno/tm2/pkg/bft/state" "github.com/gnolang/gno/tm2/pkg/bft/types" @@ -19,10 +20,10 @@ type paramsChangeTestCase struct { params abci.ConsensusParams } -func newTestApp() proxy.AppConns { +func newTestApp() appconn.AppConns { app := &testApp{} cc := proxy.NewLocalClientCreator(app) - return proxy.NewAppConns(cc) + return appconn.NewAppConns(cc) } func makeAndCommitGoodBlock( From 8d7fe9f86c53818bcb631f39c3a5224fb74b9e41 Mon Sep 17 00:00:00 2001 From: Morgan Bazalgette Date: Tue, 30 Jan 2024 15:35:02 +0100 Subject: [PATCH 07/14] attempt to fix GH actions --- .github/workflows/db-tests.yml | 19 ++++--------------- .github/workflows/lint.yml | 5 ++++- go.mod | 2 +- go.sum | 4 ++-- 4 files changed, 11 insertions(+), 19 deletions(-) diff --git a/.github/workflows/db-tests.yml b/.github/workflows/db-tests.yml index b259a0bcf74..64801c4ca1b 100644 --- a/.github/workflows/db-tests.yml +++ b/.github/workflows/db-tests.yml @@ -23,11 +23,6 @@ jobs: goversion: - "1.20.x" - "1.21.x" - tags: - - cleveldb - - memdb - - fsdb - - boltdb steps: - uses: actions/checkout@v4 @@ -37,15 +32,9 @@ jobs: go-version: ${{ matrix.goversion }} # leveldb - - name: install leveldb + - name: install database dependencies if: ${{ matrix.tags=='cleveldb' }} - run: | - sudo apt-get install libsnappy1v5 - mkdir -p /tmp/leveldb - cd /tmp/leveldb - wget http://ftp.us.debian.org/debian/pool/main/l/leveldb/libleveldb1d_1.22-3_amd64.deb - wget http://ftp.us.debian.org/debian/pool/main/l/leveldb/libleveldb-dev_1.22-3_amd64.deb - sudo dpkg -i *.deb + run: sudo apt-get install -y librocksdb8.3 libleveldb-dev - name: Set environment variables for debug mode if: env.ACTIONS_STEP_DEBUG == 'true' @@ -55,7 +44,7 @@ jobs: echo "LOG_LEVEL=debug" >> $GITHUB_ENV echo "LOG_PATH_DIR=$LOG_PATH_DIR" >> $GITHUB_ENV - + # test ./pkgs/db - name: test ./tm2/pkg/db - run: go test -tags ${{ matrix.tags }} ./tm2/pkg/db/... + run: go test -v ./tm2/pkg/db/... diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b417e904e7c..96753419b08 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -21,6 +21,9 @@ jobs: with: go-version: 1.21.x + - name: Get database dependencies + run: sudo apt-get install -y librocksdb8.3 libleveldb-dev + - name: Lint uses: golangci/golangci-lint-action@v3 with: @@ -79,6 +82,6 @@ jobs: run: | # Ensure Make is installed make --version - + # Run the tidy target make tidy diff --git a/go.mod b/go.mod index 1352d7155fe..c495f3fa02b 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,7 @@ require ( github.com/jaekwon/testify v1.6.1 github.com/jmhodges/levigo v1.0.0 github.com/libp2p/go-buffer-pool v0.1.0 - github.com/linxGnu/grocksdb v1.8.11 + github.com/linxGnu/grocksdb v1.8.2 github.com/mattn/go-runewidth v0.0.15 github.com/pelletier/go-toml v1.9.5 github.com/peterbourgon/ff/v3 v3.4.0 diff --git a/go.sum b/go.sum index 3cd4b3aede1..6020f96db5e 100644 --- a/go.sum +++ b/go.sum @@ -104,8 +104,8 @@ github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= -github.com/linxGnu/grocksdb v1.8.11 h1:BGol9e5gB1BrsTvOxloC88pe70TCqgrfLNwkyWW0kD8= -github.com/linxGnu/grocksdb v1.8.11/go.mod h1:xZCIb5Muw+nhbDK4Y5UJuOrin5MceOuiXkVUR7vp4WY= +github.com/linxGnu/grocksdb v1.8.2 h1:rghpz/b3wMF+61OR11obvPHYEWY31LzsGf71EGeAfeY= +github.com/linxGnu/grocksdb v1.8.2/go.mod h1:xZCIb5Muw+nhbDK4Y5UJuOrin5MceOuiXkVUR7vp4WY= github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= From 1bc8081050a01de617a4977669f17649e66c04ca Mon Sep 17 00:00:00 2001 From: Morgan Bazalgette Date: Tue, 30 Jan 2024 16:30:27 +0100 Subject: [PATCH 08/14] attempt to fix ci --- .github/workflows/db-tests.yml | 12 ++++++++---- .github/workflows/lint.yml | 6 +++--- go.mod | 2 +- go.sum | 12 ++++++++++-- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/.github/workflows/db-tests.yml b/.github/workflows/db-tests.yml index 64801c4ca1b..133c3bcb982 100644 --- a/.github/workflows/db-tests.yml +++ b/.github/workflows/db-tests.yml @@ -15,7 +15,13 @@ concurrency: jobs: test: - runs-on: ubuntu-latest + # NOTE: this job uses a specific version of ubuntu as the version of grocksb + # we use is related to the version of RocksDB in ubuntu's repositories. + # If updating this to a later ubuntu release, update the grocksdb version + # accordingly: + # https://github.com/linxGnu/grocksdb/releases + # https://pkgs.org/search/?q=rocksdb-dev + runs-on: ubuntu-22.04 timeout-minutes: 5 strategy: fail-fast: false @@ -31,10 +37,8 @@ jobs: with: go-version: ${{ matrix.goversion }} - # leveldb - name: install database dependencies - if: ${{ matrix.tags=='cleveldb' }} - run: sudo apt-get install -y librocksdb8.3 libleveldb-dev + run: sudo apt-get install -y libleveldb-dev librocksdb-dev - name: Set environment variables for debug mode if: env.ACTIONS_STEP_DEBUG == 'true' diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 96753419b08..d93ea6ad656 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -21,11 +21,11 @@ jobs: with: go-version: 1.21.x - - name: Get database dependencies - run: sudo apt-get install -y librocksdb8.3 libleveldb-dev - - name: Lint uses: golangci/golangci-lint-action@v3 + env: + # Don't attempt to compile/resolve C packages (grocksdb, cleveldb). + CGO_ENABLED: 0 with: # sync with misc/devdeps/go.mod version: v1.54 diff --git a/go.mod b/go.mod index c495f3fa02b..d704a24cbd2 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,7 @@ require ( github.com/jaekwon/testify v1.6.1 github.com/jmhodges/levigo v1.0.0 github.com/libp2p/go-buffer-pool v0.1.0 - github.com/linxGnu/grocksdb v1.8.2 + github.com/linxGnu/grocksdb v1.6.20 github.com/mattn/go-runewidth v0.0.15 github.com/pelletier/go-toml v1.9.5 github.com/peterbourgon/ff/v3 v3.4.0 diff --git a/go.sum b/go.sum index 6020f96db5e..4d7fac2f2ce 100644 --- a/go.sum +++ b/go.sum @@ -41,6 +41,12 @@ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeC github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= +github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0= +github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= +github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= +github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= +github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk= +github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= @@ -104,8 +110,8 @@ github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= -github.com/linxGnu/grocksdb v1.8.2 h1:rghpz/b3wMF+61OR11obvPHYEWY31LzsGf71EGeAfeY= -github.com/linxGnu/grocksdb v1.8.2/go.mod h1:xZCIb5Muw+nhbDK4Y5UJuOrin5MceOuiXkVUR7vp4WY= +github.com/linxGnu/grocksdb v1.6.20 h1:C0SNv12/OBr/zOdGw6reXS+mKpIdQGb/AkZWjHYnO64= +github.com/linxGnu/grocksdb v1.6.20/go.mod h1:IbTMGpmWg/1pg2hcG9LlxkqyqiJymdCweaUrzsLRFmg= github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= @@ -140,6 +146,7 @@ github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUz github.com/rs/cors v1.10.1 h1:L0uuZVXIKlI1SShY2nhFfo44TYvDPQ1w4oFkUJNfhyo= github.com/rs/cors v1.10.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= @@ -244,6 +251,7 @@ gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMy gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= From 56c1d6b10a8402a20d646e178bd80e049f140414 Mon Sep 17 00:00:00 2001 From: Morgan Bazalgette Date: Tue, 30 Jan 2024 17:06:14 +0100 Subject: [PATCH 09/14] dont test db in others --- .github/workflows/tm2.yml | 1 + tm2/Makefile | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tm2.yml b/.github/workflows/tm2.yml index bbe379bb069..539029b540e 100644 --- a/.github/workflows/tm2.yml +++ b/.github/workflows/tm2.yml @@ -55,6 +55,7 @@ jobs: - _test.pkg.amino - _test.pkg.bft - _test.pkg.others + # _test.pkg.db needs special dependencies -- see db-tests. runs-on: ubuntu-latest timeout-minutes: 21 steps: diff --git a/tm2/Makefile b/tm2/Makefile index 0fa231415b2..87bb0302d7e 100644 --- a/tm2/Makefile +++ b/tm2/Makefile @@ -48,6 +48,7 @@ _test.flappy: ./pkg/bft/consensus ./pkg/bft/blockchain ./pkg/bft/mempool ./pkg/p2p ./pkg/bft/privval GOTEST_FLAGS ?= -v -p 1 -timeout=30m -_test.pkg.others:; go test $(GOTEST_FLAGS) `go list ./pkg/... | grep -v pkg/amino/ | grep -v pkg/bft/` +_test.pkg.others:; go test $(GOTEST_FLAGS) `go list ./pkg/... | grep -Ev 'pkg/(amino|bft|db)(/|$$)'` _test.pkg.amino:; go test $(GOTEST_FLAGS) ./pkg/amino/... _test.pkg.bft:; go test $(GOTEST_FLAGS) ./pkg/bft/... +_test.pkg.db:; go test $(GOTEST_FLAGS) ./pkg/db/... From bb4a3b28e4ca015b5f862fc7e2c76c0fdf2ea871 Mon Sep 17 00:00:00 2001 From: Morgan Bazalgette Date: Tue, 30 Jan 2024 17:33:15 +0100 Subject: [PATCH 10/14] add db to makefile --- tm2/Makefile | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tm2/Makefile b/tm2/Makefile index 87bb0302d7e..b08101a15a6 100644 --- a/tm2/Makefile +++ b/tm2/Makefile @@ -1,4 +1,3 @@ - .PHONY: help help: @echo "Available make commands:" @@ -39,7 +38,7 @@ lint: ######################################## # Test suite .PHONY: test -test: _test.pkg.amino _test.pkg.bft _test.pkg.others _test.flappy +test: _test.pkg.amino _test.pkg.bft _test.pkg.db _test.pkg.others _test.flappy _test.flappy: # flappy tests should work "sometimes" (at least once). @@ -48,7 +47,11 @@ _test.flappy: ./pkg/bft/consensus ./pkg/bft/blockchain ./pkg/bft/mempool ./pkg/p2p ./pkg/bft/privval GOTEST_FLAGS ?= -v -p 1 -timeout=30m -_test.pkg.others:; go test $(GOTEST_FLAGS) `go list ./pkg/... | grep -Ev 'pkg/(amino|bft|db)(/|$$)'` +_test.pkg.others:; go test $(GOTEST_FLAGS) `go list ./pkg/... | grep -Ev 'pkg/(amino|bft|db|iavl/benchmarks)(/|$$)'` _test.pkg.amino:; go test $(GOTEST_FLAGS) ./pkg/amino/... -_test.pkg.bft:; go test $(GOTEST_FLAGS) ./pkg/bft/... -_test.pkg.db:; go test $(GOTEST_FLAGS) ./pkg/db/... +_test.pkg.bft:; go test $(GOTEST_FLAGS) ./pkg/bft/... + +CGO_ENABLED ?= 0 +_test.pkg.db: + @[ -z "$$CGO_ENABLED" ] && echo 'Disabling cgo for database tests. Use CGO_ENABLED=1 to enable it if you have the correct libs' || true + CGO_ENABLED=$(CGO_ENABLED) go test $(GOTEST_FLAGS) ./pkg/db/... ./pkg/iavl/benchmarks/... From be58dd6e6cd4920b33a07c8a0718866859f942f6 Mon Sep 17 00:00:00 2001 From: Morgan Bazalgette Date: Tue, 30 Jan 2024 17:35:32 +0100 Subject: [PATCH 11/14] modtidy --- contribs/gnodev/go.sum | 2 +- contribs/gnokeykc/go.mod | 2 -- contribs/gnokeykc/go.sum | 4 +--- misc/loop/go.sum | 2 +- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/contribs/gnodev/go.sum b/contribs/gnodev/go.sum index 4a583333ffc..7c4c812d541 100644 --- a/contribs/gnodev/go.sum +++ b/contribs/gnodev/go.sum @@ -95,7 +95,7 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= -github.com/linxGnu/grocksdb v1.8.11 h1:BGol9e5gB1BrsTvOxloC88pe70TCqgrfLNwkyWW0kD8= +github.com/linxGnu/grocksdb v1.6.20 h1:C0SNv12/OBr/zOdGw6reXS+mKpIdQGb/AkZWjHYnO64= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= diff --git a/contribs/gnokeykc/go.mod b/contribs/gnokeykc/go.mod index 5dc00cee273..ce28b853be5 100644 --- a/contribs/gnokeykc/go.mod +++ b/contribs/gnokeykc/go.mod @@ -10,7 +10,6 @@ require ( ) require ( - dario.cat/mergo v1.0.0 // indirect github.com/alessio/shellescape v1.4.1 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect github.com/btcsuite/btcd/btcutil v1.1.3 // indirect @@ -31,7 +30,6 @@ require ( github.com/peterbourgon/ff/v3 v3.4.0 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/rs/cors v1.10.1 // indirect github.com/stretchr/testify v1.8.4 // indirect github.com/zondax/hid v0.9.2 // indirect github.com/zondax/ledger-go v0.14.3 // indirect diff --git a/contribs/gnokeykc/go.sum b/contribs/gnokeykc/go.sum index 0c45d4985fd..94ae1980a66 100644 --- a/contribs/gnokeykc/go.sum +++ b/contribs/gnokeykc/go.sum @@ -1,5 +1,4 @@ dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= -dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/alessio/shellescape v1.4.1 h1:V7yhSDDn8LP4lc4jS8pFkt0zCnzVJlG5JXy9BVKJUX0= github.com/alessio/shellescape v1.4.1/go.mod h1:PZAiSCk0LJaZkiCSkPv8qIobYglO3FPpyFjDCtHLS30= @@ -86,7 +85,7 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= -github.com/linxGnu/grocksdb v1.8.11 h1:BGol9e5gB1BrsTvOxloC88pe70TCqgrfLNwkyWW0kD8= +github.com/linxGnu/grocksdb v1.6.20 h1:C0SNv12/OBr/zOdGw6reXS+mKpIdQGb/AkZWjHYnO64= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= @@ -108,7 +107,6 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rs/cors v1.10.1 h1:L0uuZVXIKlI1SShY2nhFfo44TYvDPQ1w4oFkUJNfhyo= -github.com/rs/cors v1.10.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= diff --git a/misc/loop/go.sum b/misc/loop/go.sum index b077ff375a3..392700c001d 100644 --- a/misc/loop/go.sum +++ b/misc/loop/go.sum @@ -79,7 +79,7 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= -github.com/linxGnu/grocksdb v1.8.11 h1:BGol9e5gB1BrsTvOxloC88pe70TCqgrfLNwkyWW0kD8= +github.com/linxGnu/grocksdb v1.8.4 h1:ZMsBpPpJNtRLHiKKp0mI7gW+NT4s7UgfD5xHxx1jVRo= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= From ff80b78e348c5cb6199583856ffc0f62a76fb296 Mon Sep 17 00:00:00 2001 From: Morgan Bazalgette Date: Thu, 15 Feb 2024 17:15:29 +0100 Subject: [PATCH 12/14] unexport ConfigureRPC --- contribs/gnodev/pkg/dev/node.go | 5 +-- tm2/pkg/bft/node/node.go | 20 +++++++----- tm2/pkg/bft/rpc/client/localclient.go | 44 +++++++++++++-------------- tm2/pkg/bft/rpc/client/rpc_test.go | 1 - 4 files changed, 34 insertions(+), 36 deletions(-) diff --git a/contribs/gnodev/pkg/dev/node.go b/contribs/gnodev/pkg/dev/node.go index 8dcd36cb6bd..7b8ab6dc793 100644 --- a/contribs/gnodev/pkg/dev/node.go +++ b/contribs/gnodev/pkg/dev/node.go @@ -66,8 +66,6 @@ func NewDevNode(ctx context.Context, logger *slog.Logger, pkgslist []string) (*N if err != nil { return nil, fmt.Errorf("unable to create the node: %w", err) } - node.ConfigureRPC() - client := client.NewLocal() if err := node.Start(); err != nil { return nil, fmt.Errorf("unable to start node: %w", err) @@ -83,7 +81,7 @@ func NewDevNode(ctx context.Context, logger *slog.Logger, pkgslist []string) (*N return &Node{ Node: node, - client: client, + client: client.NewLocal(), pkgs: mpkgs, logger: logger, loadedPackages: len(pkgsTxs), @@ -240,7 +238,6 @@ func (d *Node) reset(ctx context.Context, genesis gnoland.GnoGenesisState) error } d.Node = node - node.ConfigureRPC() d.client = client.NewLocal() } diff --git a/tm2/pkg/bft/node/node.go b/tm2/pkg/bft/node/node.go index 665e2b8bf7d..4a667ee076a 100644 --- a/tm2/pkg/bft/node/node.go +++ b/tm2/pkg/bft/node/node.go @@ -574,6 +574,16 @@ func (n *Node) OnStart() error { time.Sleep(genTime.Sub(now)) } + // Set up the GLOBAL variables in rpc/core which refer to this node. + // This is done separately from startRPC(), as the values in rpc/core are used, + // for instance, to set up Local clients (rpc/client) which work without + // a network connection. + n.configureRPC() + if n.config.RPC.Unsafe { + rpccore.AddUnsafeRoutes() + } + rpccore.Start() + // Start the RPC server before the P2P server // so we can eg. receive txs for the first block if n.config.RPC.ListenAddress != "" { @@ -654,9 +664,9 @@ func (n *Node) OnStop() { } } -// ConfigureRPC sets all variables in rpccore so they will serve +// configureRPC sets all variables in rpccore so they will serve // rpc calls from this node -func (n *Node) ConfigureRPC() { +func (n *Node) configureRPC() { rpccore.SetStateDB(n.stateDB) rpccore.SetBlockStore(n.blockStore) rpccore.SetConsensusState(n.consensusState) @@ -674,12 +684,6 @@ func (n *Node) ConfigureRPC() { } func (n *Node) startRPC() ([]net.Listener, error) { - n.ConfigureRPC() - if n.config.RPC.Unsafe { - rpccore.AddUnsafeRoutes() - } - rpccore.Start() - listenAddrs := splitAndTrimEmpty(n.config.RPC.ListenAddress, ",", " ") config := rpcserver.DefaultConfig() diff --git a/tm2/pkg/bft/rpc/client/localclient.go b/tm2/pkg/bft/rpc/client/localclient.go index 47979543db3..f2b61c756d6 100644 --- a/tm2/pkg/bft/rpc/client/localclient.go +++ b/tm2/pkg/bft/rpc/client/localclient.go @@ -10,34 +10,32 @@ import ( "github.com/gnolang/gno/tm2/pkg/log" ) -/* -Local is a Client implementation that directly executes the rpc -functions on a given node, without going through HTTP or GRPC. - -This implementation is useful for: - -* Running tests against a node in-process without the overhead -of going through an http server -* Communication between an ABCI app and Tendermint core when they -are compiled in process. - -For real clients, you probably want to use client.HTTP. For more -powerful control during testing, you probably want the "client/mock" package. -*/ +// Local is a Client implementation that directly executes the rpc +// functions on a given node, without going through any network connection. +// +// As this connects directly to a Node instance, a Local client only works +// after the Node has been started. Note that the way this works is (alas) +// through the use of singletons in rpc/core. As a consequence, you may only +// have one active node at a time, and Local can only connect to that specific +// node. Keep this in mind for parallel tests, or attempting to simulate a +// network. +// +// This implementation is useful for: +// +// - Running tests against a node in-process without the overhead +// of going through an http server +// - Communication between an ABCI app and Tendermint core when they +// are compiled in process. +// +// For real clients, you probably want to use the [HTTP] client. For more +// powerful control during testing, you probably want the "client/mock" package. type Local struct { Logger *slog.Logger ctx *rpctypes.Context } -// NewLocal configures a client that calls the Node directly. -// -// Note that given how rpc/core works with package singletons, that -// you can only have one node per process. So make sure test cases -// don't run in parallel, or try to simulate an entire network in -// one process... -// -// Before using a Local client, callers are responsible for calling -// Node.ConfigureRPC(). +// NewLocal configures a client that calls the Node directly through rpc/core, +// without requiring a network connection. See [Local]. func NewLocal() *Local { return &Local{ Logger: log.NewNoopLogger(), diff --git a/tm2/pkg/bft/rpc/client/rpc_test.go b/tm2/pkg/bft/rpc/client/rpc_test.go index 514062b5120..78cfdc7e4ee 100644 --- a/tm2/pkg/bft/rpc/client/rpc_test.go +++ b/tm2/pkg/bft/rpc/client/rpc_test.go @@ -23,7 +23,6 @@ func getHTTPClient() *client.HTTP { } func getLocalClient() *client.Local { - node.ConfigureRPC() return client.NewLocal() } From b630e57f3e6e3ef07bcdfdbc6b5728377ac532c1 Mon Sep 17 00:00:00 2001 From: Morgan Bazalgette Date: Fri, 1 Mar 2024 13:25:05 +0100 Subject: [PATCH 13/14] remove node.reset in gnodev --- contribs/gnodev/pkg/dev/node.go | 49 --------------------------------- 1 file changed, 49 deletions(-) diff --git a/contribs/gnodev/pkg/dev/node.go b/contribs/gnodev/pkg/dev/node.go index d08fb46037c..4decc806638 100644 --- a/contribs/gnodev/pkg/dev/node.go +++ b/contribs/gnodev/pkg/dev/node.go @@ -214,55 +214,6 @@ func (d *Node) Reload(ctx context.Context) error { return nil } -func (d *Node) reset(ctx context.Context, genesis gnoland.GnoGenesisState) error { - var err error - - // recoverError handles panics and converts them to errors. - recoverError := func() { - if r := recover(); r != nil { - panicErr, ok := r.(error) - if !ok { - panic(r) // Re-panic if not an error. - } - - err = panicErr - } - } - - createNode := func() { - defer recoverError() - - node, nodeErr := newNode(d.logger, genesis) - if nodeErr != nil { - err = fmt.Errorf("unable to create node: %w", nodeErr) - return - } - - if startErr := node.Start(); startErr != nil { - err = fmt.Errorf("unable to start the node: %w", startErr) - return - } - - d.Node = node - d.client = client.NewLocal() - } - - // Execute node creation and handle any errors. - createNode() - if err != nil { - return err - } - - // Wait for the node to be ready - select { - case <-d.GetNodeReadiness(): // Ok - case <-ctx.Done(): - return ctx.Err() - } - - return err -} - // GetBlockTransactions returns the transactions contained // within the specified block, if any func (d *Node) GetBlockTransactions(blockNum uint64) ([]std.Tx, error) { From 4561ba3414088335933aa5b3068e83a5b99027c2 Mon Sep 17 00:00:00 2001 From: Morgan Bazalgette Date: Fri, 1 Mar 2024 13:27:18 +0100 Subject: [PATCH 14/14] xx --- tm2/pkg/bft/consensus/wal_generator.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tm2/pkg/bft/consensus/wal_generator.go b/tm2/pkg/bft/consensus/wal_generator.go index b919559d841..175771f50ed 100644 --- a/tm2/pkg/bft/consensus/wal_generator.go +++ b/tm2/pkg/bft/consensus/wal_generator.go @@ -3,11 +3,10 @@ package consensus import ( "fmt" "io" + "log/slog" "testing" "time" - "golang.org/x/exp/slog" - cfg "github.com/gnolang/gno/tm2/pkg/bft/config" walm "github.com/gnolang/gno/tm2/pkg/bft/wal" "github.com/gnolang/gno/tm2/pkg/random"