From 897f4f8484c108c24cdf4ea08c77befb1da97e9a Mon Sep 17 00:00:00 2001 From: Alexander Peters Date: Thu, 25 Jul 2024 14:55:49 +0200 Subject: [PATCH 01/15] ci: Use large box for 052 branch sims on CI (#21067) --- .github/workflows/sims-052.yml | 67 +++++++++++++++------------------- 1 file changed, 29 insertions(+), 38 deletions(-) diff --git a/.github/workflows/sims-052.yml b/.github/workflows/sims-052.yml index e79a0478609..b64d6332b76 100644 --- a/.github/workflows/sims-052.yml +++ b/.github/workflows/sims-052.yml @@ -13,7 +13,9 @@ concurrency: jobs: build: - runs-on: ubuntu-latest + permissions: + contents: read # for actions/checkout to fetch code + runs-on: large-sdk-runner if: "!contains(github.event.head_commit.message, 'skip-sims')" steps: - uses: actions/checkout@v4 @@ -25,26 +27,9 @@ jobs: check-latest: true - run: make build - install-runsim: - permissions: - contents: none - runs-on: ubuntu-latest - needs: build - steps: - - uses: actions/setup-go@v5 - with: - go-version: "1.22" - check-latest: true - - name: Install runsim - run: go install github.com/cosmos/tools/cmd/runsim@v1.0.0 - - uses: actions/cache@v4 - with: - path: ~/go/bin - key: ${{ runner.os }}-go-runsim-binary - test-sim-import-export: - runs-on: ubuntu-latest - needs: [build, install-runsim] + runs-on: large-sdk-runner + needs: [build] timeout-minutes: 60 steps: - uses: actions/checkout@v4 @@ -54,17 +39,14 @@ jobs: with: go-version: "1.22" check-latest: true - - uses: actions/cache@v4 - with: - path: ~/go/bin - key: ${{ runner.os }}-go-runsim-binary - name: test-sim-import-export run: | make test-sim-import-export test-sim-after-import: - runs-on: ubuntu-latest - needs: [build, install-runsim] + runs-on: large-sdk-runner + needs: [build] + timeout-minutes: 60 steps: - uses: actions/checkout@v4 with: @@ -73,17 +55,14 @@ jobs: with: go-version: "1.22" check-latest: true - - uses: actions/cache@v4 - with: - path: ~/go/bin - key: ${{ runner.os }}-go-runsim-binary - name: test-sim-after-import run: | make test-sim-after-import - test-sim-multi-seed-short: - runs-on: ubuntu-latest - needs: [build, install-runsim] + test-sim-deterministic: + runs-on: large-sdk-runner + needs: [build] + timeout-minutes: 60 steps: - uses: actions/checkout@v4 with: @@ -92,10 +71,22 @@ jobs: with: go-version: "1.22" check-latest: true - - uses: actions/cache@v4 + - name: test-sim-nondeterminism-streaming + run: | + make test-sim-nondeterminism-streaming + + test-sim-multi-seed-short: + runs-on: large-sdk-runner + needs: [build] + timeout-minutes: 60 + steps: + - uses: actions/checkout@v4 + with: + ref: "release/v0.52.x" + - uses: actions/setup-go@v5 with: - path: ~/go/bin - key: ${{ runner.os }}-go-runsim-binary + go-version: "1.22" + check-latest: true - name: test-sim-multi-seed-short run: | make test-sim-multi-seed-short @@ -103,7 +94,7 @@ jobs: sims-notify-success: needs: [test-sim-multi-seed-short, test-sim-after-import, test-sim-import-export] - runs-on: ubuntu-latest + runs-on: large-sdk-runner if: ${{ success() }} steps: - uses: actions/checkout@v4 @@ -130,7 +121,7 @@ jobs: contents: none needs: [test-sim-multi-seed-short, test-sim-after-import, test-sim-import-export] - runs-on: ubuntu-latest + runs-on: large-sdk-runner if: ${{ failure() }} steps: - name: Notify Slack on failure From 683371f7791792c7b4e74d18321e8d08039780d4 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Thu, 25 Jul 2024 15:53:26 +0200 Subject: [PATCH 02/15] feat(schema/appdata): async listener mux'ing (#20879) Co-authored-by: cool-developer <51834436+cool-develope@users.noreply.github.com> --- schema/appdata/async.go | 162 +++++++++++++++++++++++++++++++++++ schema/appdata/async_test.go | 148 ++++++++++++++++++++++++++++++++ schema/appdata/mux.go | 128 +++++++++++++++++++++++++++ schema/appdata/mux_test.go | 131 ++++++++++++++++++++++++++++ 4 files changed, 569 insertions(+) create mode 100644 schema/appdata/async.go create mode 100644 schema/appdata/async_test.go create mode 100644 schema/appdata/mux.go create mode 100644 schema/appdata/mux_test.go diff --git a/schema/appdata/async.go b/schema/appdata/async.go new file mode 100644 index 00000000000..0d4126ed2a0 --- /dev/null +++ b/schema/appdata/async.go @@ -0,0 +1,162 @@ +package appdata + +import ( + "context" + "sync" +) + +// AsyncListenerOptions are options for async listeners and listener mux's. +type AsyncListenerOptions struct { + // Context is the context whose Done() channel listeners use will use to listen for completion to close their + // goroutine. If it is nil, then context.Background() will be used and goroutines may be leaked. + Context context.Context + + // BufferSize is the buffer size of the channels to use. It defaults to 0. + BufferSize int + + // DoneWaitGroup is an optional wait-group that listener goroutines will notify via Add(1) when they are started + // and Done() after they are cancelled and completed. + DoneWaitGroup *sync.WaitGroup +} + +// AsyncListenerMux returns a listener that forwards received events to all the provided listeners asynchronously +// with each listener processing in a separate go routine. All callbacks in the returned listener will return nil +// except for Commit which will return an error or nil once all listeners have processed the commit. The context +// is used to signal that the listeners should stop listening and return. bufferSize is the size of the buffer for the +// channels used to send events to the listeners. +func AsyncListenerMux(opts AsyncListenerOptions, listeners ...Listener) Listener { + asyncListeners := make([]Listener, len(listeners)) + commitChans := make([]chan error, len(listeners)) + for i, l := range listeners { + commitChan := make(chan error) + commitChans[i] = commitChan + asyncListeners[i] = AsyncListener(opts, commitChan, l) + } + mux := ListenerMux(asyncListeners...) + muxCommit := mux.Commit + mux.Commit = func(data CommitData) error { + if muxCommit != nil { + err := muxCommit(data) + if err != nil { + return err + } + } + + for _, commitChan := range commitChans { + err := <-commitChan + if err != nil { + return err + } + } + return nil + } + + return mux +} + +// AsyncListener returns a listener that forwards received events to the provided listener listening in asynchronously +// in a separate go routine. The listener that is returned will return nil for all methods including Commit and +// an error or nil will only be returned in commitChan once the sender has sent commit and the receiving listener has +// processed it. Thus commitChan can be used as a synchronization and error checking mechanism. The go routine +// that is being used for listening will exit when context.Done() returns and no more events will be received by the listener. +// bufferSize is the size of the buffer for the channel that is used to send events to the listener. +// Instead of using AsyncListener directly, it is recommended to use AsyncListenerMux which does coordination directly +// via its Commit callback. +func AsyncListener(opts AsyncListenerOptions, commitChan chan<- error, listener Listener) Listener { + packetChan := make(chan Packet, opts.BufferSize) + res := Listener{} + ctx := opts.Context + if ctx == nil { + ctx = context.Background() + } + done := ctx.Done() + + go func() { + if opts.DoneWaitGroup != nil { + opts.DoneWaitGroup.Add(1) + } + + var err error + for { + select { + case packet := <-packetChan: + if err != nil { + // if we have an error, don't process any more packets + // and return the error and finish when it's time to commit + if _, ok := packet.(CommitData); ok { + commitChan <- err + return + } + } else { + // process the packet + err = listener.SendPacket(packet) + // if it's a commit + if _, ok := packet.(CommitData); ok { + commitChan <- err + if err != nil { + return + } + } + } + + case <-done: + close(packetChan) + if opts.DoneWaitGroup != nil { + opts.DoneWaitGroup.Done() + } + return + } + } + }() + + if listener.InitializeModuleData != nil { + res.InitializeModuleData = func(data ModuleInitializationData) error { + packetChan <- data + return nil + } + } + + if listener.StartBlock != nil { + res.StartBlock = func(data StartBlockData) error { + packetChan <- data + return nil + } + } + + if listener.OnTx != nil { + res.OnTx = func(data TxData) error { + packetChan <- data + return nil + } + } + + if listener.OnEvent != nil { + res.OnEvent = func(data EventData) error { + packetChan <- data + return nil + } + } + + if listener.OnKVPair != nil { + res.OnKVPair = func(data KVPairData) error { + packetChan <- data + return nil + } + } + + if listener.OnObjectUpdate != nil { + res.OnObjectUpdate = func(data ObjectUpdateData) error { + packetChan <- data + return nil + } + } + + if listener.Commit != nil { + res.Commit = func(data CommitData) error { + packetChan <- data + return nil + } + } + + return res +} diff --git a/schema/appdata/async_test.go b/schema/appdata/async_test.go new file mode 100644 index 00000000000..c1df2d4ca6c --- /dev/null +++ b/schema/appdata/async_test.go @@ -0,0 +1,148 @@ +package appdata + +import ( + "context" + "fmt" + "sync" + "testing" +) + +func TestAsyncListenerMux(t *testing.T) { + t.Run("empty", func(t *testing.T) { + listener := AsyncListenerMux(AsyncListenerOptions{}, Listener{}, Listener{}) + + if listener.InitializeModuleData != nil { + t.Error("expected nil") + } + if listener.StartBlock != nil { + t.Error("expected nil") + } + if listener.OnTx != nil { + t.Error("expected nil") + } + if listener.OnEvent != nil { + t.Error("expected nil") + } + if listener.OnKVPair != nil { + t.Error("expected nil") + } + if listener.OnObjectUpdate != nil { + t.Error("expected nil") + } + + // commit is not expected to be nil + }) + + t.Run("call cancel", func(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + wg := &sync.WaitGroup{} + var calls1, calls2 []string + listener1 := callCollector(1, func(name string, _ int, _ Packet) { + calls1 = append(calls1, name) + }) + listener2 := callCollector(2, func(name string, _ int, _ Packet) { + calls2 = append(calls2, name) + }) + res := AsyncListenerMux(AsyncListenerOptions{ + BufferSize: 16, Context: ctx, DoneWaitGroup: wg, + }, listener1, listener2) + + callAllCallbacksOnces(t, res) + + expectedCalls := []string{ + "InitializeModuleData", + "StartBlock", + "OnTx", + "OnEvent", + "OnKVPair", + "OnObjectUpdate", + "Commit", + } + + checkExpectedCallOrder(t, calls1, expectedCalls) + checkExpectedCallOrder(t, calls2, expectedCalls) + + // cancel and expect the test to finish - if all goroutines aren't canceled the test will hang + cancel() + wg.Wait() + }) + + t.Run("error on commit", func(t *testing.T) { + var calls1, calls2 []string + listener1 := callCollector(1, func(name string, _ int, _ Packet) { + calls1 = append(calls1, name) + }) + listener1.Commit = func(data CommitData) error { + return fmt.Errorf("error") + } + listener2 := callCollector(2, func(name string, _ int, _ Packet) { + calls2 = append(calls2, name) + }) + res := AsyncListenerMux(AsyncListenerOptions{}, listener1, listener2) + + err := res.Commit(CommitData{}) + if err == nil || err.Error() != "error" { + t.Fatalf("expected error, got %v", err) + } + }) +} + +func TestAsyncListener(t *testing.T) { + t.Run("call cancel", func(t *testing.T) { + commitChan := make(chan error) + ctx, cancel := context.WithCancel(context.Background()) + wg := &sync.WaitGroup{} + var calls []string + listener := callCollector(1, func(name string, _ int, _ Packet) { + calls = append(calls, name) + }) + res := AsyncListener(AsyncListenerOptions{BufferSize: 16, Context: ctx, DoneWaitGroup: wg}, + commitChan, listener) + + callAllCallbacksOnces(t, res) + + err := <-commitChan + if err != nil { + t.Fatalf("expected nil, got %v", err) + } + + checkExpectedCallOrder(t, calls, []string{ + "InitializeModuleData", + "StartBlock", + "OnTx", + "OnEvent", + "OnKVPair", + "OnObjectUpdate", + "Commit", + }) + + calls = nil + + // expect wait group to return after cancel is called + cancel() + wg.Wait() + }) + + t.Run("error", func(t *testing.T) { + commitChan := make(chan error) + var calls []string + listener := callCollector(1, func(name string, _ int, _ Packet) { + calls = append(calls, name) + }) + + listener.OnKVPair = func(updates KVPairData) error { + return fmt.Errorf("error") + } + + res := AsyncListener(AsyncListenerOptions{BufferSize: 16}, commitChan, listener) + + callAllCallbacksOnces(t, res) + + err := <-commitChan + if err == nil || err.Error() != "error" { + t.Fatalf("expected error, got %v", err) + } + + checkExpectedCallOrder(t, calls, []string{"InitializeModuleData", "StartBlock", "OnTx", "OnEvent"}) + }) +} diff --git a/schema/appdata/mux.go b/schema/appdata/mux.go new file mode 100644 index 00000000000..8e6b886577d --- /dev/null +++ b/schema/appdata/mux.go @@ -0,0 +1,128 @@ +package appdata + +// ListenerMux returns a listener that forwards received events to all the provided listeners in order. +// A callback is only registered if a non-nil callback is present in at least one of the listeners. +func ListenerMux(listeners ...Listener) Listener { + mux := Listener{} + + initModDataCbs := make([]func(ModuleInitializationData) error, 0, len(listeners)) + for _, l := range listeners { + if l.InitializeModuleData != nil { + initModDataCbs = append(initModDataCbs, l.InitializeModuleData) + } + } + if len(initModDataCbs) > 0 { + mux.InitializeModuleData = func(data ModuleInitializationData) error { + for _, cb := range initModDataCbs { + if err := cb(data); err != nil { + return err + } + } + return nil + } + } + + startBlockCbs := make([]func(StartBlockData) error, 0, len(listeners)) + for _, l := range listeners { + if l.StartBlock != nil { + startBlockCbs = append(startBlockCbs, l.StartBlock) + } + } + if len(startBlockCbs) > 0 { + mux.StartBlock = func(data StartBlockData) error { + for _, cb := range startBlockCbs { + if err := cb(data); err != nil { + return err + } + } + return nil + } + } + + onTxCbs := make([]func(TxData) error, 0, len(listeners)) + for _, l := range listeners { + if l.OnTx != nil { + onTxCbs = append(onTxCbs, l.OnTx) + } + } + if len(onTxCbs) > 0 { + mux.OnTx = func(data TxData) error { + for _, cb := range onTxCbs { + if err := cb(data); err != nil { + return err + } + } + return nil + } + } + + onEventCbs := make([]func(EventData) error, 0, len(listeners)) + for _, l := range listeners { + if l.OnEvent != nil { + onEventCbs = append(onEventCbs, l.OnEvent) + } + } + if len(onEventCbs) > 0 { + mux.OnEvent = func(data EventData) error { + for _, cb := range onEventCbs { + if err := cb(data); err != nil { + return err + } + } + return nil + } + } + + onKvPairCbs := make([]func(KVPairData) error, 0, len(listeners)) + for _, l := range listeners { + if l.OnKVPair != nil { + onKvPairCbs = append(onKvPairCbs, l.OnKVPair) + } + } + if len(onKvPairCbs) > 0 { + mux.OnKVPair = func(data KVPairData) error { + for _, cb := range onKvPairCbs { + if err := cb(data); err != nil { + return err + } + } + return nil + } + } + + onObjectUpdateCbs := make([]func(ObjectUpdateData) error, 0, len(listeners)) + for _, l := range listeners { + if l.OnObjectUpdate != nil { + onObjectUpdateCbs = append(onObjectUpdateCbs, l.OnObjectUpdate) + } + } + if len(onObjectUpdateCbs) > 0 { + mux.OnObjectUpdate = func(data ObjectUpdateData) error { + for _, cb := range onObjectUpdateCbs { + if err := cb(data); err != nil { + return err + } + } + return nil + } + } + + commitCbs := make([]func(CommitData) error, 0, len(listeners)) + for _, l := range listeners { + if l.Commit != nil { + commitCbs = append(commitCbs, l.Commit) + } + } + if len(commitCbs) > 0 { + mux.Commit = func(data CommitData) error { + for _, cb := range commitCbs { + if err := cb(data); err != nil { + return err + } + } + return nil + } + } + + return mux +} diff --git a/schema/appdata/mux_test.go b/schema/appdata/mux_test.go new file mode 100644 index 00000000000..b5e3a95dd56 --- /dev/null +++ b/schema/appdata/mux_test.go @@ -0,0 +1,131 @@ +package appdata + +import ( + "fmt" + "testing" +) + +func TestListenerMux(t *testing.T) { + t.Run("empty", func(t *testing.T) { + listener := ListenerMux(Listener{}, Listener{}) + + if listener.InitializeModuleData != nil { + t.Error("expected nil") + } + if listener.StartBlock != nil { + t.Error("expected nil") + } + if listener.OnTx != nil { + t.Error("expected nil") + } + if listener.OnEvent != nil { + t.Error("expected nil") + } + if listener.OnKVPair != nil { + t.Error("expected nil") + } + if listener.OnObjectUpdate != nil { + t.Error("expected nil") + } + if listener.Commit != nil { + t.Error("expected nil") + } + }) + + t.Run("all called once", func(t *testing.T) { + var calls []string + onCall := func(name string, i int, _ Packet) { + calls = append(calls, fmt.Sprintf("%s %d", name, i)) + } + + res := ListenerMux(callCollector(1, onCall), callCollector(2, onCall)) + + callAllCallbacksOnces(t, res) + + checkExpectedCallOrder(t, calls, []string{ + "InitializeModuleData 1", + "InitializeModuleData 2", + "StartBlock 1", + "StartBlock 2", + "OnTx 1", + "OnTx 2", + "OnEvent 1", + "OnEvent 2", + "OnKVPair 1", + "OnKVPair 2", + "OnObjectUpdate 1", + "OnObjectUpdate 2", + "Commit 1", + "Commit 2", + }) + }) +} + +func callAllCallbacksOnces(t *testing.T, listener Listener) { + if err := listener.InitializeModuleData(ModuleInitializationData{}); err != nil { + t.Error(err) + } + if err := listener.StartBlock(StartBlockData{}); err != nil { + t.Error(err) + } + if err := listener.OnTx(TxData{}); err != nil { + t.Error(err) + } + if err := listener.OnEvent(EventData{}); err != nil { + t.Error(err) + } + if err := listener.OnKVPair(KVPairData{}); err != nil { + t.Error(err) + } + if err := listener.OnObjectUpdate(ObjectUpdateData{}); err != nil { + t.Error(err) + } + if err := listener.Commit(CommitData{}); err != nil { + t.Error(err) + } +} + +func callCollector(i int, onCall func(string, int, Packet)) Listener { + return Listener{ + InitializeModuleData: func(ModuleInitializationData) error { + onCall("InitializeModuleData", i, nil) + return nil + }, + StartBlock: func(StartBlockData) error { + onCall("StartBlock", i, nil) + return nil + }, + OnTx: func(TxData) error { + onCall("OnTx", i, nil) + return nil + }, + OnEvent: func(EventData) error { + onCall("OnEvent", i, nil) + return nil + }, + OnKVPair: func(KVPairData) error { + onCall("OnKVPair", i, nil) + return nil + }, + OnObjectUpdate: func(ObjectUpdateData) error { + onCall("OnObjectUpdate", i, nil) + return nil + }, + Commit: func(CommitData) error { + onCall("Commit", i, nil) + return nil + }, + } +} + +func checkExpectedCallOrder(t *testing.T, actual, expected []string) { + if len(actual) != len(expected) { + t.Fatalf("expected %d calls, got %d", len(expected), len(actual)) + } + + for i := range actual { + if actual[i] != expected[i] { + t.Errorf("expected %q, got %q", expected[i], actual[i]) + } + } +} From a0207294c5a93f4dbef5cc067ff6c55ee9899597 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Thu, 25 Jul 2024 18:36:17 +0200 Subject: [PATCH 03/15] chore(indexer/postgres): update to changes on main (#21077) --- indexer/postgres/column.go | 4 +-- indexer/postgres/enum.go | 30 ++-------------- indexer/postgres/go.mod | 2 ++ indexer/postgres/go.sum | 2 -- .../internal/testdata/example_schema.go | 34 +++++++++++-------- indexer/postgres/module.go | 32 ++++++++--------- indexer/postgres/tests/go.mod | 2 ++ indexer/postgres/tests/go.sum | 2 -- 8 files changed, 43 insertions(+), 65 deletions(-) diff --git a/indexer/postgres/column.go b/indexer/postgres/column.go index f9692af1371..188e9d8da65 100644 --- a/indexer/postgres/column.go +++ b/indexer/postgres/column.go @@ -25,7 +25,7 @@ func (tm *ObjectIndexer) createColumnDefinition(writer io.Writer, field schema.F } else { switch field.Kind { case schema.EnumKind: - _, err = fmt.Fprintf(writer, "%q", enumTypeName(tm.moduleName, field.EnumDefinition)) + _, err = fmt.Fprintf(writer, "%q", enumTypeName(tm.moduleName, field.EnumType)) if err != nil { return err } @@ -100,7 +100,7 @@ func simpleColumnType(kind schema.Kind) string { return "JSONB" case schema.DurationKind: return "BIGINT" - case schema.Bech32AddressKind: + case schema.AddressKind: return "TEXT" default: return "" diff --git a/indexer/postgres/enum.go b/indexer/postgres/enum.go index c438257d202..709fc903956 100644 --- a/indexer/postgres/enum.go +++ b/indexer/postgres/enum.go @@ -11,7 +11,7 @@ import ( ) // CreateEnumType creates an enum type in the database. -func (m *ModuleIndexer) CreateEnumType(ctx context.Context, conn DBConn, enum schema.EnumDefinition) error { +func (m *ModuleIndexer) CreateEnumType(ctx context.Context, conn DBConn, enum schema.EnumType) error { typeName := enumTypeName(m.moduleName, enum) row := conn.QueryRowContext(ctx, "SELECT 1 FROM pg_type WHERE typname = $1", typeName) var res interface{} @@ -39,7 +39,7 @@ func (m *ModuleIndexer) CreateEnumType(ctx context.Context, conn DBConn, enum sc } // CreateEnumTypeSql generates a CREATE TYPE statement for the enum definition. -func CreateEnumTypeSql(writer io.Writer, moduleName string, enum schema.EnumDefinition) error { +func CreateEnumTypeSql(writer io.Writer, moduleName string, enum schema.EnumType) error { _, err := fmt.Fprintf(writer, "CREATE TYPE %q AS ENUM (", enumTypeName(moduleName, enum)) if err != nil { return err @@ -63,30 +63,6 @@ func CreateEnumTypeSql(writer io.Writer, moduleName string, enum schema.EnumDefi } // enumTypeName returns the name of the enum type scoped to the module. -func enumTypeName(moduleName string, enum schema.EnumDefinition) string { +func enumTypeName(moduleName string, enum schema.EnumType) string { return fmt.Sprintf("%s_%s", moduleName, enum.Name) } - -// createEnumTypesForFields creates enum types for all the fields that have enum kind in the module schema. -func (m *ModuleIndexer) createEnumTypesForFields(ctx context.Context, conn DBConn, fields []schema.Field) error { - for _, field := range fields { - if field.Kind != schema.EnumKind { - continue - } - - if _, ok := m.definedEnums[field.EnumDefinition.Name]; ok { - // if the enum type is already defined, skip - // we assume validation already happened - continue - } - - err := m.CreateEnumType(ctx, conn, field.EnumDefinition) - if err != nil { - return err - } - - m.definedEnums[field.EnumDefinition.Name] = field.EnumDefinition - } - - return nil -} diff --git a/indexer/postgres/go.mod b/indexer/postgres/go.mod index d85dbc46718..b0423dde074 100644 --- a/indexer/postgres/go.mod +++ b/indexer/postgres/go.mod @@ -9,3 +9,5 @@ go 1.12 // This module should only use the golang standard library (database/sql) // and cosmossdk.io/indexer/base. require cosmossdk.io/schema v0.1.1 + +replace cosmossdk.io/schema => ../../schema diff --git a/indexer/postgres/go.sum b/indexer/postgres/go.sum index 6a92c3d3ec6..e69de29bb2d 100644 --- a/indexer/postgres/go.sum +++ b/indexer/postgres/go.sum @@ -1,2 +0,0 @@ -cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= -cosmossdk.io/schema v0.1.1/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= diff --git a/indexer/postgres/internal/testdata/example_schema.go b/indexer/postgres/internal/testdata/example_schema.go index ccdd39d96c3..ff2d4f2ed1b 100644 --- a/indexer/postgres/internal/testdata/example_schema.go +++ b/indexer/postgres/internal/testdata/example_schema.go @@ -29,22 +29,26 @@ func init() { switch i { case schema.EnumKind: - field.EnumDefinition = MyEnum - case schema.Bech32AddressKind: - field.AddressPrefix = "foo" + field.EnumType = MyEnum default: } AllKindsObject.ValueFields = append(AllKindsObject.ValueFields, field) } - ExampleSchema = schema.ModuleSchema{ - ObjectTypes: []schema.ObjectType{ - AllKindsObject, - SingletonObject, - VoteObject, - }, + ExampleSchema = mustModuleSchema([]schema.ObjectType{ + AllKindsObject, + SingletonObject, + VoteObject, + }) +} + +func mustModuleSchema(objectTypes []schema.ObjectType) schema.ModuleSchema { + s, err := schema.NewModuleSchema(objectTypes) + if err != nil { + panic(err) } + return s } var SingletonObject = schema.ObjectType{ @@ -60,9 +64,9 @@ var SingletonObject = schema.ObjectType{ Nullable: true, }, { - Name: "an_enum", - Kind: schema.EnumKind, - EnumDefinition: MyEnum, + Name: "an_enum", + Kind: schema.EnumKind, + EnumType: MyEnum, }, }, } @@ -76,14 +80,14 @@ var VoteObject = schema.ObjectType{ }, { Name: "address", - Kind: schema.Bech32AddressKind, + Kind: schema.AddressKind, }, }, ValueFields: []schema.Field{ { Name: "vote", Kind: schema.EnumKind, - EnumDefinition: schema.EnumDefinition{ + EnumType: schema.EnumType{ Name: "vote_type", Values: []string{"yes", "no", "abstain"}, }, @@ -92,7 +96,7 @@ var VoteObject = schema.ObjectType{ RetainDeletions: true, } -var MyEnum = schema.EnumDefinition{ +var MyEnum = schema.EnumType{ Name: "my_enum", Values: []string{"a", "b", "c"}, } diff --git a/indexer/postgres/module.go b/indexer/postgres/module.go index 57564700b78..0d6a28e2ef7 100644 --- a/indexer/postgres/module.go +++ b/indexer/postgres/module.go @@ -12,7 +12,7 @@ type ModuleIndexer struct { moduleName string schema schema.ModuleSchema tables map[string]*ObjectIndexer - definedEnums map[string]schema.EnumDefinition + definedEnums map[string]schema.EnumType options Options } @@ -22,7 +22,7 @@ func NewModuleIndexer(moduleName string, modSchema schema.ModuleSchema, options moduleName: moduleName, schema: modSchema, tables: map[string]*ObjectIndexer{}, - definedEnums: map[string]schema.EnumDefinition{}, + definedEnums: map[string]schema.EnumType{}, options: options, } } @@ -30,29 +30,27 @@ func NewModuleIndexer(moduleName string, modSchema schema.ModuleSchema, options // InitializeSchema creates tables for all object types in the module schema and creates enum types. func (m *ModuleIndexer) InitializeSchema(ctx context.Context, conn DBConn) error { // create enum types - for _, typ := range m.schema.ObjectTypes { - err := m.createEnumTypesForFields(ctx, conn, typ.KeyFields) - if err != nil { - return err - } - - err = m.createEnumTypesForFields(ctx, conn, typ.ValueFields) - if err != nil { - return err - } + var err error + m.schema.EnumTypes(func(enumType schema.EnumType) bool { + err = m.CreateEnumType(ctx, conn, enumType) + return err == nil + }) + if err != nil { + return err } // create tables for all object types - for _, typ := range m.schema.ObjectTypes { + m.schema.ObjectTypes(func(typ schema.ObjectType) bool { tm := NewObjectIndexer(m.moduleName, typ, m.options) m.tables[typ.Name] = tm - err := tm.CreateTable(ctx, conn) + err = tm.CreateTable(ctx, conn) if err != nil { - return fmt.Errorf("failed to create table for %s in module %s: %v", typ.Name, m.moduleName, err) //nolint:errorlint // using %v for go 1.12 compat + err = fmt.Errorf("failed to create table for %s in module %s: %v", typ.Name, m.moduleName, err) //nolint:errorlint // using %v for go 1.12 compat } - } + return err == nil + }) - return nil + return err } // ObjectIndexers returns the object indexers for the module. diff --git a/indexer/postgres/tests/go.mod b/indexer/postgres/tests/go.mod index d5a29304251..0353ba6091b 100644 --- a/indexer/postgres/tests/go.mod +++ b/indexer/postgres/tests/go.mod @@ -30,4 +30,6 @@ require ( replace cosmossdk.io/indexer/postgres => ../. +replace cosmossdk.io/schema => ../../../schema + go 1.22 diff --git a/indexer/postgres/tests/go.sum b/indexer/postgres/tests/go.sum index a4ba87b486c..de3d49d7470 100644 --- a/indexer/postgres/tests/go.sum +++ b/indexer/postgres/tests/go.sum @@ -1,5 +1,3 @@ -cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= -cosmossdk.io/schema v0.1.1/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= From b6eaf70b6af08e8b6904f853defe5ecd65332264 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Fri, 26 Jul 2024 03:50:57 +0700 Subject: [PATCH 04/15] feat(simapp/v2): Add store server to testnet init cmd (#21076) --- scripts/local-testnet.sh | 2 +- simapp/v2/simdv2/cmd/testnet.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/local-testnet.sh b/scripts/local-testnet.sh index c73710dbab1..c3e1162a6aa 100644 --- a/scripts/local-testnet.sh +++ b/scripts/local-testnet.sh @@ -10,7 +10,7 @@ SIMD="$ROOT/build/simdv2" COSMOS_BUILD_OPTIONS=v2 make build -$SIMD testnet init-files --chain-id=testing --output-dir="$HOME/.testnet" --validator-count=3 --keyring-backend=test --minimum-gas-prices=0.000001stake --commit-timeout=900ms --single-host +$SIMD testnet init-files --chain-id=testing --output-dir="$HOME/.testnet" --validator-count=3 --keyring-backend=test --min-gas-prices=0.000001stake --commit-timeout=900ms --single-host $SIMD start --log_level=info --home "$HOME/.testnet/node0/simdv2" & $SIMD start --log_level=info --home "$HOME/.testnet/node1/simdv2" & diff --git a/simapp/v2/simdv2/cmd/testnet.go b/simapp/v2/simdv2/cmd/testnet.go index b0a755a9719..e07ce258245 100644 --- a/simapp/v2/simdv2/cmd/testnet.go +++ b/simapp/v2/simdv2/cmd/testnet.go @@ -22,6 +22,7 @@ import ( serverv2 "cosmossdk.io/server/v2" "cosmossdk.io/server/v2/api/grpc" "cosmossdk.io/server/v2/cometbft" + "cosmossdk.io/server/v2/store" authtypes "cosmossdk.io/x/auth/types" banktypes "cosmossdk.io/x/bank/types" stakingtypes "cosmossdk.io/x/staking/types" @@ -343,7 +344,8 @@ func initTestnetFiles[T transaction.Tx]( cometbft.OverwriteDefaultConfigTomlConfig(nodeConfig), ) grpcServer := grpc.New[T](grpc.OverwriteDefaultConfig(grpcConfig)) - server := serverv2.NewServer(coretesting.NewNopLogger(), cometServer, grpcServer) + storeServer := store.New[T]() + server := serverv2.NewServer(coretesting.NewNopLogger(), cometServer, grpcServer, storeServer) err = server.WriteConfig(filepath.Join(nodeDir, "config")) if err != nil { return err From 502450cd1ef0b6bd77807922091893611c370c5d Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Thu, 25 Jul 2024 23:43:19 +0200 Subject: [PATCH 05/15] fix(runtime): remove `appv1alpha1.Config` from runtime (#21042) --- runtime/app.go | 2 -- runtime/module.go | 3 --- runtime/v2/app.go | 6 ++---- runtime/v2/module.go | 2 -- 4 files changed, 2 insertions(+), 11 deletions(-) diff --git a/runtime/app.go b/runtime/app.go index 80bc2834089..aeef32a28db 100644 --- a/runtime/app.go +++ b/runtime/app.go @@ -8,7 +8,6 @@ import ( abci "github.com/cometbft/cometbft/api/cometbft/abci/v1" runtimev1alpha1 "cosmossdk.io/api/cosmos/app/runtime/v1alpha1" - appv1alpha1 "cosmossdk.io/api/cosmos/app/v1alpha1" "cosmossdk.io/core/appmodule" "cosmossdk.io/core/legacy" "cosmossdk.io/core/log" @@ -51,7 +50,6 @@ type App struct { baseAppOptions []BaseAppOption msgServiceRouter *baseapp.MsgServiceRouter grpcQueryRouter *baseapp.GRPCQueryRouter - appConfig *appv1alpha1.Config logger log.Logger // initChainer is the init chainer function defined by the app config. // this is only required if the chain wants to add special InitChainer logic. diff --git a/runtime/module.go b/runtime/module.go index 501b9c1ff04..1060a9857b8 100644 --- a/runtime/module.go +++ b/runtime/module.go @@ -10,7 +10,6 @@ import ( "google.golang.org/protobuf/reflect/protoregistry" runtimev1alpha1 "cosmossdk.io/api/cosmos/app/runtime/v1alpha1" - appv1alpha1 "cosmossdk.io/api/cosmos/app/v1alpha1" autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1" "cosmossdk.io/core/app" @@ -155,7 +154,6 @@ type AppInputs struct { depinject.In Logger log.Logger - AppConfig *appv1alpha1.Config Config *runtimev1alpha1.Module AppBuilder *AppBuilder ModuleManager *module.Manager @@ -168,7 +166,6 @@ func SetupAppBuilder(inputs AppInputs) { app := inputs.AppBuilder.app app.baseAppOptions = inputs.BaseAppOptions app.config = inputs.Config - app.appConfig = inputs.AppConfig app.logger = inputs.Logger app.ModuleManager = inputs.ModuleManager app.ModuleManager.RegisterInterfaces(inputs.InterfaceRegistry) diff --git a/runtime/v2/app.go b/runtime/v2/app.go index 89d6d0be24b..56632590b4f 100644 --- a/runtime/v2/app.go +++ b/runtime/v2/app.go @@ -8,7 +8,6 @@ import ( "golang.org/x/exp/slices" runtimev2 "cosmossdk.io/api/cosmos/app/runtime/v2" - appv1alpha1 "cosmossdk.io/api/cosmos/app/v1alpha1" "cosmossdk.io/core/legacy" "cosmossdk.io/core/log" "cosmossdk.io/core/registry" @@ -36,9 +35,8 @@ type App[T transaction.Tx] struct { db Store // app configuration - logger log.Logger - config *runtimev2.Module - appConfig *appv1alpha1.Config + logger log.Logger + config *runtimev2.Module // modules configuration storeKeys []string diff --git a/runtime/v2/module.go b/runtime/v2/module.go index cb0ec169d31..588584d0650 100644 --- a/runtime/v2/module.go +++ b/runtime/v2/module.go @@ -144,7 +144,6 @@ func ProvideAppBuilder[T transaction.Tx]( type AppInputs struct { depinject.In - AppConfig *appv1alpha1.Config Config *runtimev2.Module AppBuilder *AppBuilder[transaction.Tx] ModuleManager *MM[transaction.Tx] @@ -157,7 +156,6 @@ type AppInputs struct { func SetupAppBuilder(inputs AppInputs) { app := inputs.AppBuilder.app app.config = inputs.Config - app.appConfig = inputs.AppConfig app.logger = inputs.Logger app.moduleManager = inputs.ModuleManager app.moduleManager.RegisterInterfaces(inputs.InterfaceRegistrar) From cc5c4d0699c4fb4b200fbd8290bfa39bb8c0a0d8 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Fri, 26 Jul 2024 10:16:12 +0200 Subject: [PATCH 06/15] chore(network): remove `DefaultConfigWithAppConfigWithQueryGasLimit` (#21055) --- tests/integration/server/grpc/out_of_gas_test.go | 5 +++-- testutil/network/network.go | 15 ++++++--------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/tests/integration/server/grpc/out_of_gas_test.go b/tests/integration/server/grpc/out_of_gas_test.go index f662d2a25ff..4a91d3e0520 100644 --- a/tests/integration/server/grpc/out_of_gas_test.go +++ b/tests/integration/server/grpc/out_of_gas_test.go @@ -17,6 +17,7 @@ import ( _ "cosmossdk.io/x/consensus" _ "cosmossdk.io/x/staking" + "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/testutil/configurator" "github.com/cosmos/cosmos-sdk/testutil/network" @@ -36,7 +37,7 @@ func (s *IntegrationTestOutOfGasSuite) SetupSuite() { var err error s.T().Log("setting up integration test suite") - s.cfg, err = network.DefaultConfigWithAppConfigWithQueryGasLimit(configurator.NewAppConfig( + s.cfg, err = network.DefaultConfigWithAppConfig(configurator.NewAppConfig( configurator.AccountsModule(), configurator.AuthModule(), configurator.BankModule(), @@ -44,7 +45,7 @@ func (s *IntegrationTestOutOfGasSuite) SetupSuite() { configurator.StakingModule(), configurator.ConsensusModule(), configurator.TxModule(), - ), 10) + ), baseapp.SetQueryGasLimit(10)) s.NoError(err) s.cfg.NumValidators = 1 diff --git a/testutil/network/network.go b/testutil/network/network.go index 7929846bac9..cd59d0b0850 100644 --- a/testutil/network/network.go +++ b/testutil/network/network.go @@ -163,11 +163,7 @@ func DefaultConfig(factory TestFixtureFactory) Config { } } -func DefaultConfigWithAppConfig(appConfig depinject.Config) (Config, error) { - return DefaultConfigWithAppConfigWithQueryGasLimit(appConfig, 0) -} - -func DefaultConfigWithAppConfigWithQueryGasLimit(appConfig depinject.Config, queryGasLimit uint64) (Config, error) { +func DefaultConfigWithAppConfig(appConfig depinject.Config, baseappOpts ...func(*baseapp.BaseApp)) (Config, error) { var ( appBuilder *runtime.AppBuilder txConfig client.TxConfig @@ -222,10 +218,11 @@ func DefaultConfigWithAppConfigWithQueryGasLimit(appConfig depinject.Config, que app := appBuilder.Build( dbm.NewMemDB(), nil, - baseapp.SetPruning(pruningtypes.NewPruningOptionsFromString(val.GetAppConfig().Pruning)), - baseapp.SetMinGasPrices(val.GetAppConfig().MinGasPrices), - baseapp.SetChainID(cfg.ChainID), - baseapp.SetQueryGasLimit(queryGasLimit), + append(baseappOpts, + baseapp.SetPruning(pruningtypes.NewPruningOptionsFromString(val.GetAppConfig().Pruning)), + baseapp.SetMinGasPrices(val.GetAppConfig().MinGasPrices), + baseapp.SetChainID(cfg.ChainID), + )..., ) testdata.RegisterQueryServer(app.GRPCQueryRouter(), testdata.QueryImpl{}) From fe8474e9b419b411cd2f0cf0f33fe4bfc46dc0d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juli=C3=A1n=20Toledano?= Date: Fri, 26 Jul 2024 12:53:32 +0200 Subject: [PATCH 07/15] feat: simulate nested messages (#20291) --- CHANGELOG.md | 1 + UPGRADING.md | 33 ++ baseapp/abci_test.go | 236 ++++++++ baseapp/baseapp.go | 63 +- baseapp/options.go | 13 + baseapp/testutil/messages.go | 24 + baseapp/testutil/messages.pb.go | 997 ++++++++++++++++++++++++++++++-- baseapp/testutil/messages.proto | 29 +- baseapp/utils_test.go | 70 +++ simapp/app.go | 4 +- simapp/app_di.go | 1 - 11 files changed, 1416 insertions(+), 55 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b727862bd96..7473c1561eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i ### Features +* (baseapp) [#20291](https://github.com/cosmos/cosmos-sdk/pull/20291) Simulate nested messages. * (tests) [#20013](https://github.com/cosmos/cosmos-sdk/pull/20013) Introduce system tests to run multi node local testnet in CI * (runtime) [#19953](https://github.com/cosmos/cosmos-sdk/pull/19953) Implement `core/transaction.Service` in runtime. * (client) [#19905](https://github.com/cosmos/cosmos-sdk/pull/19905) Add grpc client config to `client.toml`. diff --git a/UPGRADING.md b/UPGRADING.md index 5f96b53ed53..9e57f3a6f9b 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -5,6 +5,39 @@ Note, always read the **SimApp** section for more information on application wir ## [Unreleased] +### BaseApp + +#### Nested Messages Simulation + +Now it is possible to simulate the nested messages of a message, providing developers with a powerful tool for +testing and predicting the behavior of complex transactions. This feature allows for a more comprehensive +evaluation of gas consumption, state changes, and potential errors that may occur when executing nested +messages. However, it's important to note that while the simulation can provide valuable insights, it does not +guarantee the correct execution of the nested messages in the future. Factors such as changes in the +blockchain state or updates to the protocol could potentially affect the actual execution of these nested +messages when the transaction is finally processed on the network. + +For example, consider a governance proposal that includes nested messages to update multiple protocol +parameters. At the time of simulation, the blockchain state may be suitable for executing all these nested +messages successfully. However, by the time the actual governance proposal is executed (which could be days or +weeks later), the blockchain state might have changed significantly. As a result, while the simulation showed +a successful execution, the actual governance proposal might fail when it's finally processed. + +By default, when simulating transactions, the gas cost of nested messages is not calculated. This means that +only the gas cost of the top-level message is considered. However, this behavior can be customized using the +`SetIncludeNestedMsgsGas` option when building the BaseApp. By providing a list of message types to this option, +you can specify which messages should have their nested message gas costs included in the simulation. This +allows for more accurate gas estimation for transactions involving specific message types that contain nested +messages, while maintaining the default behavior for other message types. + +Here is an example on how `SetIncludeNestedMsgsGas` option could be set to calculate the gas of a gov proposal +nested messages: +```go +baseAppOptions = append(baseAppOptions, baseapp.SetIncludeNestedMsgsGas([]sdk.Message{&gov.MsgSubmitProposal{}})) +// ... +app.App = appBuilder.Build(db, traceStore, baseAppOptions...) +``` + ### SimApp In this section we describe the changes made in Cosmos SDK' SimApp. diff --git a/baseapp/abci_test.go b/baseapp/abci_test.go index 7e08aabfba0..4fea776a8bf 100644 --- a/baseapp/abci_test.go +++ b/baseapp/abci_test.go @@ -24,6 +24,7 @@ import ( "github.com/cosmos/gogoproto/jsonpb" "github.com/cosmos/gogoproto/proto" gogotypes "github.com/cosmos/gogoproto/types" + any "github.com/cosmos/gogoproto/types/any" "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" @@ -38,6 +39,7 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" baseapptestutil "github.com/cosmos/cosmos-sdk/baseapp/testutil" "github.com/cosmos/cosmos-sdk/baseapp/testutil/mock" + "github.com/cosmos/cosmos-sdk/codec" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" "github.com/cosmos/cosmos-sdk/testutil" "github.com/cosmos/cosmos-sdk/testutil/testdata" @@ -760,6 +762,240 @@ func TestABCI_FinalizeBlock_MultiMsg(t *testing.T) { require.Equal(t, int64(2), msgCounter2) } +func anyMessage(t *testing.T, cdc codec.Codec, msg *baseapptestutil.MsgSend) *any.Any { + t.Helper() + b, err := cdc.Marshal(msg) + require.NoError(t, err) + return &any.Any{ + TypeUrl: sdk.MsgTypeURL(msg), + Value: b, + } +} + +func TestABCI_Query_SimulateNestedMessagesTx(t *testing.T) { + anteOpt := func(bapp *baseapp.BaseApp) { + bapp.SetAnteHandler(func(ctx sdk.Context, tx sdk.Tx, simulate bool) (newCtx sdk.Context, err error) { + newCtx = ctx.WithGasMeter(storetypes.NewGasMeter(uint64(15))) + return + }) + } + suite := NewBaseAppSuite(t, anteOpt) + + _, err := suite.baseApp.InitChain(&abci.InitChainRequest{ + ConsensusParams: &cmtproto.ConsensusParams{}, + }) + require.NoError(t, err) + + baseapptestutil.RegisterNestedMessagesServer(suite.baseApp.MsgServiceRouter(), NestedMessgesServerImpl{}) + baseapptestutil.RegisterSendServer(suite.baseApp.MsgServiceRouter(), SendServerImpl{}) + + _, _, addr := testdata.KeyTestPubAddr() + _, _, toAddr := testdata.KeyTestPubAddr() + tests := []struct { + name string + message sdk.Msg + wantErr bool + }{ + { + name: "ok nested message", + message: &baseapptestutil.MsgSend{ + From: addr.String(), + To: toAddr.String(), + Amount: "10000stake", + }, + }, + { + name: "different signers", + message: &baseapptestutil.MsgSend{ + From: toAddr.String(), + To: addr.String(), + Amount: "10000stake", + }, + wantErr: true, + }, + { + name: "empty from", + message: &baseapptestutil.MsgSend{ + From: "", + To: toAddr.String(), + Amount: "10000stake", + }, + wantErr: true, + }, + { + name: "empty to", + message: &baseapptestutil.MsgSend{ + From: addr.String(), + To: "", + Amount: "10000stake", + }, + wantErr: true, + }, + { + name: "negative amount", + message: &baseapptestutil.MsgSend{ + From: addr.String(), + To: toAddr.String(), + Amount: "-10000stake", + }, + wantErr: true, + }, + { + name: "with nested messages", + message: &baseapptestutil.MsgNestedMessages{ + Signer: addr.String(), + Messages: []*any.Any{ + anyMessage(t, suite.cdc, &baseapptestutil.MsgSend{ + From: addr.String(), + To: toAddr.String(), + Amount: "10000stake", + }), + }, + }, + }, + { + name: "with invalid nested messages", + message: &baseapptestutil.MsgNestedMessages{ + Signer: addr.String(), + Messages: []*any.Any{ + anyMessage(t, suite.cdc, &baseapptestutil.MsgSend{ + From: "", + To: toAddr.String(), + Amount: "10000stake", + }), + }, + }, + wantErr: true, + }, + { + name: "with different signer ", + message: &baseapptestutil.MsgNestedMessages{ + Signer: addr.String(), + Messages: []*any.Any{ + anyMessage(t, suite.cdc, &baseapptestutil.MsgSend{ + From: toAddr.String(), + To: addr.String(), + Amount: "10000stake", + }), + }, + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + nestedMessages := make([]*any.Any, 1) + b, err := suite.cdc.Marshal(tt.message) + require.NoError(t, err) + nestedMessages[0] = &any.Any{ + TypeUrl: sdk.MsgTypeURL(tt.message), + Value: b, + } + + msg := &baseapptestutil.MsgNestedMessages{ + Messages: nestedMessages, + Signer: addr.String(), + } + + builder := suite.txConfig.NewTxBuilder() + err = builder.SetMsgs(msg) + require.NoError(t, err) + setTxSignature(t, builder, 0) + tx := builder.GetTx() + + txBytes, err := suite.txConfig.TxEncoder()(tx) + require.Nil(t, err) + + _, result, err := suite.baseApp.Simulate(txBytes) + if tt.wantErr { + require.Error(t, err) + require.Nil(t, result) + } else { + require.NoError(t, err) + require.NotNil(t, result) + } + }) + } +} + +func TestABCI_Query_SimulateNestedMessagesGas(t *testing.T) { + anteOpt := func(bapp *baseapp.BaseApp) { + bapp.SetAnteHandler(func(ctx sdk.Context, tx sdk.Tx, simulate bool) (newCtx sdk.Context, err error) { + newCtx = ctx.WithGasMeter(storetypes.NewGasMeter(uint64(10))) + return + }) + } + + _, _, addr := testdata.KeyTestPubAddr() + _, _, toAddr := testdata.KeyTestPubAddr() + + tests := []struct { + name string + suite *BaseAppSuite + message sdk.Msg + consumedGas uint64 + }{ + { + name: "don't add gas", + suite: NewBaseAppSuite(t, anteOpt), + message: &baseapptestutil.MsgSend{ + From: addr.String(), + To: toAddr.String(), + Amount: "10000stake", + }, + consumedGas: 5, + }, + { + name: "add gas", + suite: NewBaseAppSuite(t, anteOpt, baseapp.SetIncludeNestedMsgsGas([]sdk.Msg{&baseapptestutil.MsgNestedMessages{}})), + message: &baseapptestutil.MsgSend{ + From: addr.String(), + To: toAddr.String(), + Amount: "10000stake", + }, + consumedGas: 10, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + _, err := tt.suite.baseApp.InitChain(&abci.InitChainRequest{ + ConsensusParams: &cmtproto.ConsensusParams{}, + }) + require.NoError(t, err) + + baseapptestutil.RegisterNestedMessagesServer(tt.suite.baseApp.MsgServiceRouter(), NestedMessgesServerImpl{}) + baseapptestutil.RegisterSendServer(tt.suite.baseApp.MsgServiceRouter(), SendServerImpl{}) + + nestedMessages := make([]*any.Any, 1) + b, err := tt.suite.cdc.Marshal(tt.message) + require.NoError(t, err) + nestedMessages[0] = &any.Any{ + TypeUrl: sdk.MsgTypeURL(tt.message), + Value: b, + } + + msg := &baseapptestutil.MsgNestedMessages{ + Messages: nestedMessages, + Signer: addr.String(), + } + + builder := tt.suite.txConfig.NewTxBuilder() + err = builder.SetMsgs(msg) + require.NoError(t, err) + setTxSignature(t, builder, 0) + tx := builder.GetTx() + + txBytes, err := tt.suite.txConfig.TxEncoder()(tx) + require.Nil(t, err) + + gas, result, err := tt.suite.baseApp.Simulate(txBytes) + require.NoError(t, err) + require.NotNil(t, result) + require.True(t, gas.GasUsed == tt.consumedGas) + }) + } +} + func TestABCI_Query_SimulateTx(t *testing.T) { gasConsumed := uint64(5) anteOpt := func(bapp *baseapp.BaseApp) { diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index d23207c667c..3599a35517e 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -186,6 +186,9 @@ type BaseApp struct { // including the goroutine handling.This is experimental and must be enabled // by developers. optimisticExec *oe.OptimisticExecution + + // includeNestedMsgsGas holds a set of message types for which gas costs for its nested messages are calculated. + includeNestedMsgsGas map[string]struct{} } // NewBaseApp returns a reference to an initialized BaseApp. It accepts a @@ -233,7 +236,9 @@ func NewBaseApp( if app.interBlockCache != nil { app.cms.SetInterBlockCache(app.interBlockCache) } - + if app.includeNestedMsgsGas == nil { + app.includeNestedMsgsGas = make(map[string]struct{}) + } app.runTxRecoveryMiddleware = newDefaultRecoveryMiddleware() // Initialize with an empty interface registry to avoid nil pointer dereference. @@ -811,6 +816,10 @@ func (app *BaseApp) endBlock(_ context.Context) (sdk.EndBlock, error) { return endblock, nil } +type HasNestedMsgs interface { + GetMsgs() ([]sdk.Msg, error) +} + // runTx processes a transaction within a given execution mode, encoded transaction // bytes, and the decoded transaction itself. All state transitions occur through // a cached Context depending on the mode provided. State only gets persisted @@ -955,6 +964,15 @@ func (app *BaseApp) runTx(mode execMode, txBytes []byte) (gInfo sdk.GasInfo, res result, err = app.runMsgs(runMsgCtx, msgs, reflectMsgs, mode) } + if mode == execModeSimulate { + for _, msg := range msgs { + nestedErr := app.simulateNestedMessages(ctx, msg) + if nestedErr != nil { + return gInfo, nil, anteEvents, nestedErr + } + } + } + // Run optional postHandlers (should run regardless of the execution result). // // Note: If the postHandler fails, we also revert the runMsgs state. @@ -1061,6 +1079,49 @@ func (app *BaseApp) runMsgs(ctx sdk.Context, msgs []sdk.Msg, reflectMsgs []proto }, nil } +// simulateNestedMessages simulates a message nested messages. +func (app *BaseApp) simulateNestedMessages(ctx sdk.Context, msg sdk.Msg) error { + nestedMsgs, ok := msg.(HasNestedMsgs) + if !ok { + return nil + } + + msgs, err := nestedMsgs.GetMsgs() + if err != nil { + return err + } + + if err := validateBasicTxMsgs(app.msgServiceRouter, msgs); err != nil { + return err + } + + for _, msg := range msgs { + err = app.simulateNestedMessages(ctx, msg) + if err != nil { + return err + } + } + + protoMessages := make([]protoreflect.Message, len(msgs)) + for i, msg := range msgs { + _, protoMsg, err := app.cdc.GetMsgSigners(msg) + if err != nil { + return err + } + protoMessages[i] = protoMsg + } + + initialGas := ctx.GasMeter().GasConsumed() + _, err = app.runMsgs(ctx, msgs, protoMessages, execModeSimulate) + if err == nil { + if _, includeGas := app.includeNestedMsgsGas[sdk.MsgTypeURL(msg)]; !includeGas { + consumedGas := ctx.GasMeter().GasConsumed() - initialGas + ctx.GasMeter().RefundGas(consumedGas, "simulation of nested messages") + } + } + return err +} + // makeABCIData generates the Data field to be sent to ABCI Check/DeliverTx. func makeABCIData(msgResponses []*codectypes.Any) ([]byte, error) { return proto.Marshal(&sdk.TxMsgData{MsgResponses: msgResponses}) diff --git a/baseapp/options.go b/baseapp/options.go index 372c2411cf8..bcff418fb8b 100644 --- a/baseapp/options.go +++ b/baseapp/options.go @@ -119,6 +119,19 @@ func SetOptimisticExecution(opts ...func(*oe.OptimisticExecution)) func(*BaseApp } } +// SetIncludeNestedMsgsGas sets the message types for which gas costs for its nested messages are calculated when simulating. +func SetIncludeNestedMsgsGas(msgs []sdk.Msg) func(*BaseApp) { + return func(app *BaseApp) { + app.includeNestedMsgsGas = make(map[string]struct{}) + for _, msg := range msgs { + if _, ok := msg.(HasNestedMsgs); !ok { + continue + } + app.includeNestedMsgsGas[sdk.MsgTypeURL(msg)] = struct{}{} + } + } +} + func (app *BaseApp) SetName(name string) { if app.sealed { panic("SetName() on sealed BaseApp") diff --git a/baseapp/testutil/messages.go b/baseapp/testutil/messages.go index a4b1cd9abbc..1bc8a8bd920 100644 --- a/baseapp/testutil/messages.go +++ b/baseapp/testutil/messages.go @@ -3,6 +3,7 @@ package testutil import ( errorsmod "cosmossdk.io/errors" + codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" @@ -16,10 +17,15 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { &MsgCounter{}, &MsgCounter2{}, &MsgKeyValue{}, + &MsgNestedMessages{}, + &MsgSend{}, ) + msgservice.RegisterMsgServiceDesc(registry, &_Counter_serviceDesc) msgservice.RegisterMsgServiceDesc(registry, &_Counter2_serviceDesc) msgservice.RegisterMsgServiceDesc(registry, &_KeyValue_serviceDesc) + msgservice.RegisterMsgServiceDesc(registry, &_NestedMessages_serviceDesc) + msgservice.RegisterMsgServiceDesc(registry, &_Send_serviceDesc) codec.RegisterInterfaces(registry) } @@ -63,3 +69,21 @@ func (msg *MsgKeyValue) ValidateBasic() error { } return nil } + +func (msg *MsgNestedMessages) GetMsgs() ([]sdk.Msg, error) { + cdc := codectestutil.CodecOptions{}.NewCodec() + RegisterInterfaces(cdc.InterfaceRegistry()) + msgs := make([]sdk.Msg, len(msg.GetMessages())) + for i, m := range msg.GetMessages() { + mm, err := cdc.InterfaceRegistry().Resolve(m.TypeUrl) + if err != nil { + return nil, err + } + err = cdc.UnpackAny(m, &mm) + if err != nil { + return nil, err + } + msgs[i] = mm + } + return msgs, nil +} diff --git a/baseapp/testutil/messages.pb.go b/baseapp/testutil/messages.pb.go index 2884ff0f649..da3421a020f 100644 --- a/baseapp/testutil/messages.pb.go +++ b/baseapp/testutil/messages.pb.go @@ -6,11 +6,11 @@ package testutil import ( context "context" fmt "fmt" - _ "github.com/cosmos/cosmos-sdk/codec/types" _ "github.com/cosmos/cosmos-sdk/types/msgservice" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" + any "github.com/cosmos/gogoproto/types/any" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -282,43 +282,240 @@ func (m *MsgCreateKeyValueResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgCreateKeyValueResponse proto.InternalMessageInfo +type MsgSend struct { + From string `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"` + To string `protobuf:"bytes,2,opt,name=to,proto3" json:"to,omitempty"` + Amount string `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount,omitempty"` +} + +func (m *MsgSend) Reset() { *m = MsgSend{} } +func (m *MsgSend) String() string { return proto.CompactTextString(m) } +func (*MsgSend) ProtoMessage() {} +func (*MsgSend) Descriptor() ([]byte, []int) { + return fileDescriptor_4dc296cbfe5ffcd5, []int{5} +} +func (m *MsgSend) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSend) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSend.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgSend) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSend.Merge(m, src) +} +func (m *MsgSend) XXX_Size() int { + return m.Size() +} +func (m *MsgSend) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSend.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSend proto.InternalMessageInfo + +func (m *MsgSend) GetFrom() string { + if m != nil { + return m.From + } + return "" +} + +func (m *MsgSend) GetTo() string { + if m != nil { + return m.To + } + return "" +} + +func (m *MsgSend) GetAmount() string { + if m != nil { + return m.Amount + } + return "" +} + +type MsgSendResponse struct { +} + +func (m *MsgSendResponse) Reset() { *m = MsgSendResponse{} } +func (m *MsgSendResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSendResponse) ProtoMessage() {} +func (*MsgSendResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4dc296cbfe5ffcd5, []int{6} +} +func (m *MsgSendResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSendResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSendResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgSendResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSendResponse.Merge(m, src) +} +func (m *MsgSendResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSendResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSendResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSendResponse proto.InternalMessageInfo + +type MsgNestedMessages struct { + Messages []*any.Any `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"` + Signer string `protobuf:"bytes,2,opt,name=signer,proto3" json:"signer,omitempty"` +} + +func (m *MsgNestedMessages) Reset() { *m = MsgNestedMessages{} } +func (m *MsgNestedMessages) String() string { return proto.CompactTextString(m) } +func (*MsgNestedMessages) ProtoMessage() {} +func (*MsgNestedMessages) Descriptor() ([]byte, []int) { + return fileDescriptor_4dc296cbfe5ffcd5, []int{7} +} +func (m *MsgNestedMessages) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgNestedMessages) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgNestedMessages.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgNestedMessages) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgNestedMessages.Merge(m, src) +} +func (m *MsgNestedMessages) XXX_Size() int { + return m.Size() +} +func (m *MsgNestedMessages) XXX_DiscardUnknown() { + xxx_messageInfo_MsgNestedMessages.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgNestedMessages proto.InternalMessageInfo + +func (m *MsgNestedMessages) GetMessages() []*any.Any { + if m != nil { + return m.Messages + } + return nil +} + +func (m *MsgNestedMessages) GetSigner() string { + if m != nil { + return m.Signer + } + return "" +} + +type MsgCreateNestedMessagesResponse struct { +} + +func (m *MsgCreateNestedMessagesResponse) Reset() { *m = MsgCreateNestedMessagesResponse{} } +func (m *MsgCreateNestedMessagesResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCreateNestedMessagesResponse) ProtoMessage() {} +func (*MsgCreateNestedMessagesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4dc296cbfe5ffcd5, []int{8} +} +func (m *MsgCreateNestedMessagesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateNestedMessagesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateNestedMessagesResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgCreateNestedMessagesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateNestedMessagesResponse.Merge(m, src) +} +func (m *MsgCreateNestedMessagesResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateNestedMessagesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateNestedMessagesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateNestedMessagesResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgCounter)(nil), "MsgCounter") proto.RegisterType((*MsgCounter2)(nil), "MsgCounter2") proto.RegisterType((*MsgCreateCounterResponse)(nil), "MsgCreateCounterResponse") proto.RegisterType((*MsgKeyValue)(nil), "MsgKeyValue") proto.RegisterType((*MsgCreateKeyValueResponse)(nil), "MsgCreateKeyValueResponse") + proto.RegisterType((*MsgSend)(nil), "MsgSend") + proto.RegisterType((*MsgSendResponse)(nil), "MsgSendResponse") + proto.RegisterType((*MsgNestedMessages)(nil), "MsgNestedMessages") + proto.RegisterType((*MsgCreateNestedMessagesResponse)(nil), "MsgCreateNestedMessagesResponse") } func init() { proto.RegisterFile("messages.proto", fileDescriptor_4dc296cbfe5ffcd5) } var fileDescriptor_4dc296cbfe5ffcd5 = []byte{ - // 390 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x92, 0xcf, 0xaa, 0xd3, 0x40, - 0x14, 0xc6, 0x1b, 0x83, 0x6d, 0x3d, 0xad, 0x5a, 0x42, 0xd1, 0x34, 0x42, 0x28, 0x5d, 0x48, 0x11, - 0x9a, 0xc1, 0xb8, 0x6b, 0x77, 0x8a, 0x54, 0x11, 0x11, 0x22, 0xb8, 0xe8, 0xa6, 0x4c, 0xd2, 0xd3, - 0x69, 0x68, 0x32, 0x13, 0x32, 0x93, 0x42, 0xb7, 0x3e, 0x81, 0x8f, 0xe2, 0x63, 0xb8, 0xec, 0xd2, - 0xa5, 0xb4, 0x0b, 0x5f, 0x43, 0xf2, 0xaf, 0x75, 0x71, 0x7b, 0xb9, 0xab, 0xbb, 0x9a, 0xf3, 0x7d, - 0x87, 0x9c, 0xdf, 0xc9, 0xc7, 0x81, 0x27, 0x31, 0x4a, 0x49, 0x19, 0x4a, 0x27, 0x49, 0x85, 0x12, - 0x56, 0x9f, 0x09, 0x26, 0x8a, 0x92, 0xe4, 0x55, 0xe5, 0x0e, 0x98, 0x10, 0x2c, 0x42, 0x52, 0x28, - 0x3f, 0x5b, 0x13, 0xca, 0xf7, 0x55, 0xeb, 0x79, 0x20, 0x64, 0x2c, 0x24, 0x89, 0x25, 0x23, 0xbb, - 0xd7, 0xf9, 0x53, 0x36, 0x46, 0x12, 0xe0, 0xb3, 0x64, 0xef, 0x44, 0xc6, 0x15, 0xa6, 0x86, 0x09, - 0xad, 0xa0, 0x2c, 0x4d, 0x6d, 0xa8, 0x8d, 0x75, 0xaf, 0x96, 0xc6, 0x4b, 0x78, 0xba, 0xa6, 0x61, - 0xb4, 0x14, 0x7c, 0xb9, 0xa1, 0x7c, 0x15, 0x61, 0x6a, 0x3e, 0x18, 0x6a, 0xe3, 0xb6, 0xf7, 0x38, - 0xb7, 0xbf, 0xf0, 0x0f, 0xa5, 0x69, 0x3c, 0x83, 0xa6, 0x0c, 0x19, 0xc7, 0xd4, 0xd4, 0x87, 0xda, - 0xf8, 0x91, 0x57, 0xa9, 0x69, 0xe7, 0xfb, 0xdf, 0x9f, 0xaf, 0x2a, 0x31, 0x52, 0xd0, 0xb9, 0x40, - 0xdd, 0xfb, 0xa2, 0x5a, 0x60, 0xe6, 0xd4, 0x14, 0xa9, 0xc2, 0x8a, 0xed, 0xa1, 0x4c, 0x04, 0x97, - 0x38, 0x5a, 0x14, 0x1b, 0x7d, 0xc2, 0xfd, 0x37, 0x1a, 0x65, 0x68, 0xf4, 0x40, 0xdf, 0xe2, 0xbe, - 0xd8, 0xa6, 0xeb, 0xe5, 0xa5, 0xd1, 0x87, 0x87, 0xbb, 0xbc, 0x55, 0xf0, 0xbb, 0x5e, 0x29, 0xee, - 0xc6, 0x7d, 0x01, 0x83, 0x33, 0xb7, 0x26, 0xd4, 0x60, 0xf7, 0x3d, 0xb4, 0xea, 0xf0, 0xa7, 0xd0, - 0xfb, 0xc8, 0x83, 0x14, 0x63, 0xe4, 0xaa, 0xf6, 0x3a, 0xce, 0x25, 0x28, 0x6b, 0xe0, 0x5c, 0xdb, - 0xdf, 0x9d, 0x43, 0xfb, 0x1c, 0xe7, 0xec, 0x86, 0x39, 0xdd, 0xff, 0xe6, 0xb8, 0xb7, 0x0d, 0x9a, - 0x41, 0xfb, 0x9c, 0x02, 0x01, 0xfd, 0x2b, 0xaa, 0xf2, 0xdb, 0xda, 0xb4, 0x2c, 0xe7, 0xea, 0xcf, - 0xbc, 0x9d, 0xff, 0x3a, 0xda, 0xda, 0xe1, 0x68, 0x6b, 0x7f, 0x8e, 0xb6, 0xf6, 0xe3, 0x64, 0x37, - 0x0e, 0x27, 0xbb, 0xf1, 0xfb, 0x64, 0x37, 0x16, 0x13, 0x16, 0xaa, 0x4d, 0xe6, 0x3b, 0x81, 0x88, - 0x49, 0x75, 0x8a, 0xe5, 0x33, 0x91, 0xab, 0x2d, 0xf1, 0xa9, 0x44, 0x9a, 0x24, 0x44, 0xa1, 0x54, - 0x99, 0x0a, 0x23, 0xbf, 0x59, 0x1c, 0xe7, 0x9b, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x44, 0x91, - 0x2d, 0xb3, 0xf8, 0x02, 0x00, 0x00, + // 535 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x93, 0xcf, 0x6e, 0xd3, 0x40, + 0x10, 0xc6, 0xeb, 0xa4, 0x6d, 0x92, 0x49, 0x48, 0xd3, 0x55, 0x04, 0x8e, 0x91, 0x4c, 0xc8, 0x01, + 0x45, 0x95, 0xba, 0x06, 0x73, 0x4b, 0xc5, 0x01, 0x2a, 0x54, 0x10, 0x0a, 0x45, 0xae, 0xc4, 0xa1, + 0x97, 0xca, 0x49, 0x26, 0x9b, 0x90, 0x78, 0x37, 0xf2, 0xae, 0x2b, 0xe5, 0xca, 0x13, 0xf0, 0x28, + 0x3c, 0x06, 0xc7, 0x1e, 0x39, 0xa2, 0xe4, 0xc0, 0x6b, 0x20, 0xaf, 0xff, 0xb4, 0x14, 0x02, 0x9c, + 0x38, 0xed, 0xcc, 0xac, 0x77, 0x7e, 0xb3, 0xfb, 0x7d, 0x86, 0x7a, 0x80, 0x52, 0xfa, 0x0c, 0x25, + 0x5d, 0x84, 0x42, 0x09, 0xab, 0xc9, 0x04, 0x13, 0x3a, 0x74, 0xe2, 0x28, 0xad, 0xb6, 0x98, 0x10, + 0x6c, 0x8e, 0x8e, 0xce, 0x06, 0xd1, 0xd8, 0xf1, 0xf9, 0x32, 0xdd, 0xba, 0x37, 0x14, 0x32, 0x10, + 0xd2, 0x09, 0x24, 0x73, 0x2e, 0x9f, 0xc4, 0x4b, 0xb2, 0xd1, 0x91, 0x00, 0x7d, 0xc9, 0x8e, 0x45, + 0xc4, 0x15, 0x86, 0xc4, 0x84, 0xd2, 0x30, 0x09, 0x4d, 0xa3, 0x6d, 0x74, 0x8b, 0x5e, 0x96, 0x92, + 0x47, 0xb0, 0x37, 0xf6, 0xa7, 0xf3, 0x0b, 0xc1, 0x2f, 0x26, 0x3e, 0x1f, 0xcd, 0x31, 0x34, 0x0b, + 0x6d, 0xa3, 0x5b, 0xf6, 0xee, 0xc4, 0xe5, 0x53, 0xfe, 0x2a, 0x29, 0x92, 0xbb, 0xb0, 0x2b, 0xa7, + 0x8c, 0x63, 0x68, 0x16, 0xdb, 0x46, 0xb7, 0xe2, 0xa5, 0x59, 0xaf, 0xfa, 0xf1, 0xfb, 0xe7, 0x83, + 0x34, 0xe9, 0x28, 0xa8, 0x5e, 0x43, 0xdd, 0xff, 0x45, 0xb5, 0xc0, 0x8c, 0xa9, 0x21, 0xfa, 0x0a, + 0x53, 0xb6, 0x87, 0x72, 0x21, 0xb8, 0xc4, 0xce, 0xb9, 0x9e, 0xe8, 0x0d, 0x2e, 0xdf, 0xfb, 0xf3, + 0x08, 0x49, 0x03, 0x8a, 0x33, 0x5c, 0xea, 0x69, 0x6a, 0x5e, 0x1c, 0x92, 0x26, 0xec, 0x5c, 0xc6, + 0x5b, 0x9a, 0x5f, 0xf3, 0x92, 0xe4, 0xdf, 0xb8, 0xf7, 0xa1, 0x95, 0x73, 0x33, 0x42, 0x0e, 0x7e, + 0x07, 0xa5, 0xbe, 0x64, 0x67, 0xc8, 0x47, 0x84, 0xc0, 0xf6, 0x38, 0x14, 0x81, 0xa6, 0x56, 0x3c, + 0x1d, 0x93, 0x3a, 0x14, 0x94, 0xd0, 0xcc, 0x8a, 0x57, 0x50, 0x22, 0x06, 0xfa, 0x41, 0x3c, 0x7b, + 0x06, 0x4c, 0xb2, 0x5e, 0x25, 0x06, 0xea, 0x23, 0x9d, 0x7d, 0xd8, 0x4b, 0x3b, 0xe6, 0x90, 0x0f, + 0xb0, 0xdf, 0x97, 0xec, 0x2d, 0x4a, 0x85, 0xa3, 0x7e, 0xea, 0x24, 0xf2, 0x18, 0xca, 0x99, 0xab, + 0x4c, 0xa3, 0x5d, 0xec, 0x56, 0xdd, 0x26, 0x4d, 0x0c, 0x44, 0x33, 0x03, 0xd1, 0xe7, 0x7c, 0xe9, + 0xe5, 0x5f, 0xdd, 0xb8, 0x6d, 0x61, 0xf3, 0x6d, 0x1f, 0xc2, 0x83, 0xfc, 0xb6, 0x3f, 0x13, 0xb3, + 0x71, 0xdc, 0x97, 0x50, 0xca, 0x0c, 0xd7, 0x83, 0xc6, 0x6b, 0x3e, 0x0c, 0x31, 0x40, 0xae, 0xb2, + 0x5a, 0x95, 0x5e, 0x9b, 0xc3, 0x6a, 0xd1, 0x4d, 0x9a, 0xb9, 0x27, 0x50, 0xce, 0x2d, 0x74, 0xf4, + 0x9b, 0x3e, 0xb5, 0x1b, 0x7d, 0xdc, 0x3f, 0x35, 0x3a, 0x82, 0x72, 0xae, 0xbc, 0x03, 0xc5, 0x33, + 0x54, 0xc9, 0xd9, 0xac, 0x68, 0x59, 0x74, 0xa3, 0x80, 0xee, 0x01, 0x6c, 0x6b, 0xf5, 0x3a, 0xe9, + 0x5a, 0xa6, 0xe9, 0xeb, 0x5b, 0x0d, 0x7a, 0x4b, 0x07, 0xf7, 0x14, 0xea, 0xb7, 0x44, 0x78, 0x06, + 0x3b, 0xc7, 0x13, 0x1c, 0xce, 0x08, 0xa1, 0xbf, 0x28, 0x64, 0xb5, 0xe9, 0x5f, 0x5e, 0xf2, 0xc5, + 0xc9, 0x97, 0x95, 0x6d, 0x5c, 0xad, 0x6c, 0xe3, 0xdb, 0xca, 0x36, 0x3e, 0xad, 0xed, 0xad, 0xab, + 0xb5, 0xbd, 0xf5, 0x75, 0x6d, 0x6f, 0x9d, 0x1f, 0xb2, 0xa9, 0x9a, 0x44, 0x03, 0x3a, 0x14, 0x81, + 0x93, 0xfe, 0xfb, 0xc9, 0x72, 0x28, 0x47, 0x33, 0x67, 0xe0, 0x4b, 0xf4, 0x17, 0x0b, 0x47, 0xa1, + 0x54, 0x91, 0x9a, 0xce, 0x07, 0xbb, 0x5a, 0xf2, 0xa7, 0x3f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x12, + 0x9a, 0xa4, 0x74, 0x69, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -545,6 +742,150 @@ var _KeyValue_serviceDesc = grpc.ServiceDesc{ Metadata: "messages.proto", } +// SendClient is the client API for Send service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type SendClient interface { + Send(ctx context.Context, in *MsgSend, opts ...grpc.CallOption) (*MsgSendResponse, error) +} + +type sendClient struct { + cc grpc1.ClientConn +} + +func NewSendClient(cc grpc1.ClientConn) SendClient { + return &sendClient{cc} +} + +func (c *sendClient) Send(ctx context.Context, in *MsgSend, opts ...grpc.CallOption) (*MsgSendResponse, error) { + out := new(MsgSendResponse) + err := c.cc.Invoke(ctx, "/Send/Send", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// SendServer is the server API for Send service. +type SendServer interface { + Send(context.Context, *MsgSend) (*MsgSendResponse, error) +} + +// UnimplementedSendServer can be embedded to have forward compatible implementations. +type UnimplementedSendServer struct { +} + +func (*UnimplementedSendServer) Send(ctx context.Context, req *MsgSend) (*MsgSendResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Send not implemented") +} + +func RegisterSendServer(s grpc1.Server, srv SendServer) { + s.RegisterService(&_Send_serviceDesc, srv) +} + +func _Send_Send_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSend) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SendServer).Send(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/Send/Send", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SendServer).Send(ctx, req.(*MsgSend)) + } + return interceptor(ctx, in, info, handler) +} + +var _Send_serviceDesc = grpc.ServiceDesc{ + ServiceName: "Send", + HandlerType: (*SendServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Send", + Handler: _Send_Send_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "messages.proto", +} + +// NestedMessagesClient is the client API for NestedMessages service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type NestedMessagesClient interface { + Check(ctx context.Context, in *MsgNestedMessages, opts ...grpc.CallOption) (*MsgCreateNestedMessagesResponse, error) +} + +type nestedMessagesClient struct { + cc grpc1.ClientConn +} + +func NewNestedMessagesClient(cc grpc1.ClientConn) NestedMessagesClient { + return &nestedMessagesClient{cc} +} + +func (c *nestedMessagesClient) Check(ctx context.Context, in *MsgNestedMessages, opts ...grpc.CallOption) (*MsgCreateNestedMessagesResponse, error) { + out := new(MsgCreateNestedMessagesResponse) + err := c.cc.Invoke(ctx, "/NestedMessages/Check", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// NestedMessagesServer is the server API for NestedMessages service. +type NestedMessagesServer interface { + Check(context.Context, *MsgNestedMessages) (*MsgCreateNestedMessagesResponse, error) +} + +// UnimplementedNestedMessagesServer can be embedded to have forward compatible implementations. +type UnimplementedNestedMessagesServer struct { +} + +func (*UnimplementedNestedMessagesServer) Check(ctx context.Context, req *MsgNestedMessages) (*MsgCreateNestedMessagesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Check not implemented") +} + +func RegisterNestedMessagesServer(s grpc1.Server, srv NestedMessagesServer) { + s.RegisterService(&_NestedMessages_serviceDesc, srv) +} + +func _NestedMessages_Check_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgNestedMessages) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NestedMessagesServer).Check(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/NestedMessages/Check", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NestedMessagesServer).Check(ctx, req.(*MsgNestedMessages)) + } + return interceptor(ctx, in, info, handler) +} + +var _NestedMessages_serviceDesc = grpc.ServiceDesc{ + ServiceName: "NestedMessages", + HandlerType: (*NestedMessagesServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Check", + Handler: _NestedMessages_Check_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "messages.proto", +} + func (m *MsgCounter) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -725,39 +1066,173 @@ func (m *MsgCreateKeyValueResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } -func encodeVarintMessages(dAtA []byte, offset int, v uint64) int { - offset -= sovMessages(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *MsgSend) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *MsgCounter) Size() (n int) { - if m == nil { - return 0 - } + +func (m *MsgSend) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSend) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if m.Counter != 0 { - n += 1 + sovMessages(uint64(m.Counter)) + if len(m.Amount) > 0 { + i -= len(m.Amount) + copy(dAtA[i:], m.Amount) + i = encodeVarintMessages(dAtA, i, uint64(len(m.Amount))) + i-- + dAtA[i] = 0x1a } - if m.FailOnHandler { - n += 2 + if len(m.To) > 0 { + i -= len(m.To) + copy(dAtA[i:], m.To) + i = encodeVarintMessages(dAtA, i, uint64(len(m.To))) + i-- + dAtA[i] = 0x12 } - l = len(m.Signer) - if l > 0 { - n += 1 + l + sovMessages(uint64(l)) + if len(m.From) > 0 { + i -= len(m.From) + copy(dAtA[i:], m.From) + i = encodeVarintMessages(dAtA, i, uint64(len(m.From))) + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *MsgCounter2) Size() (n int) { - if m == nil { - return 0 +func (m *MsgSendResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgSendResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSendResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgNestedMessages) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgNestedMessages) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgNestedMessages) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintMessages(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0x12 + } + if len(m.Messages) > 0 { + for iNdEx := len(m.Messages) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Messages[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMessages(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *MsgCreateNestedMessagesResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgCreateNestedMessagesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateNestedMessagesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintMessages(dAtA []byte, offset int, v uint64) int { + offset -= sovMessages(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgCounter) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Counter != 0 { + n += 1 + sovMessages(uint64(m.Counter)) + } + if m.FailOnHandler { + n += 2 + } + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovMessages(uint64(l)) + } + return n +} + +func (m *MsgCounter2) Size() (n int) { + if m == nil { + return 0 } var l int _ = l @@ -813,6 +1288,64 @@ func (m *MsgCreateKeyValueResponse) Size() (n int) { return n } +func (m *MsgSend) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.From) + if l > 0 { + n += 1 + l + sovMessages(uint64(l)) + } + l = len(m.To) + if l > 0 { + n += 1 + l + sovMessages(uint64(l)) + } + l = len(m.Amount) + if l > 0 { + n += 1 + l + sovMessages(uint64(l)) + } + return n +} + +func (m *MsgSendResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgNestedMessages) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Messages) > 0 { + for _, e := range m.Messages { + l = e.Size() + n += 1 + l + sovMessages(uint64(l)) + } + } + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovMessages(uint64(l)) + } + return n +} + +func (m *MsgCreateNestedMessagesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovMessages(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1311,6 +1844,368 @@ func (m *MsgCreateKeyValueResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgSend) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMessages + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgSend: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSend: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field From", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMessages + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMessages + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMessages + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.From = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field To", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMessages + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMessages + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMessages + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.To = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMessages + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMessages + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMessages + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Amount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipMessages(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthMessages + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgSendResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMessages + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgSendResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSendResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipMessages(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthMessages + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgNestedMessages) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMessages + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgNestedMessages: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgNestedMessages: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Messages", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMessages + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthMessages + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMessages + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Messages = append(m.Messages, &any.Any{}) + if err := m.Messages[len(m.Messages)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMessages + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMessages + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMessages + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipMessages(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthMessages + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgCreateNestedMessagesResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMessages + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgCreateNestedMessagesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateNestedMessagesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipMessages(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthMessages + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipMessages(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/baseapp/testutil/messages.proto b/baseapp/testutil/messages.proto index d2b25d24c11..2e0cfd15195 100644 --- a/baseapp/testutil/messages.proto +++ b/baseapp/testutil/messages.proto @@ -34,6 +34,25 @@ message MsgKeyValue { message MsgCreateKeyValueResponse {} +message MsgSend { + option (cosmos.msg.v1.signer) = "from"; + + string from = 1; + string to = 2; + string amount = 3; +} + +message MsgSendResponse {} + +message MsgNestedMessages { + option (cosmos.msg.v1.signer) = "signer"; + + repeated google.protobuf.Any messages = 1; + string signer = 2; +} + +message MsgCreateNestedMessagesResponse {} + service Counter { rpc IncrementCounter(MsgCounter) returns (MsgCreateCounterResponse); } @@ -44,4 +63,12 @@ service Counter2 { service KeyValue { rpc Set(MsgKeyValue) returns (MsgCreateKeyValueResponse); -} \ No newline at end of file +} + +service Send { + rpc Send(MsgSend) returns (MsgSendResponse); +} + +service NestedMessages { + rpc Check(MsgNestedMessages) returns (MsgCreateNestedMessagesResponse); +} diff --git a/baseapp/utils_test.go b/baseapp/utils_test.go index f95ac16c9f7..27668ce590c 100644 --- a/baseapp/utils_test.go +++ b/baseapp/utils_test.go @@ -32,6 +32,7 @@ import ( baseapptestutil "github.com/cosmos/cosmos-sdk/baseapp/testutil" "github.com/cosmos/cosmos-sdk/client" addresscodec "github.com/cosmos/cosmos-sdk/codec/address" + codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" @@ -375,3 +376,72 @@ func wonkyMsg(t *testing.T, cfg client.TxConfig, tx signing.Tx) signing.Tx { require.NoError(t, err) return builder.GetTx() } + +type SendServerImpl struct { + gas uint64 +} + +func (s SendServerImpl) Send(ctx context.Context, send *baseapptestutil.MsgSend) (*baseapptestutil.MsgSendResponse, error) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + if send.From == "" { + return nil, errors.New("from address cannot be empty") + } + if send.To == "" { + return nil, errors.New("to address cannot be empty") + } + + _, err := sdk.ParseCoinNormalized(send.Amount) + if err != nil { + return nil, err + } + gas := s.gas + if gas == 0 { + gas = 5 + } + sdkCtx.GasMeter().ConsumeGas(gas, "send test") + return &baseapptestutil.MsgSendResponse{}, nil +} + +type NestedMessgesServerImpl struct { + gas uint64 +} + +func (n NestedMessgesServerImpl) Check(ctx context.Context, message *baseapptestutil.MsgNestedMessages) (*baseapptestutil.MsgCreateNestedMessagesResponse, error) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + cdc := codectestutil.CodecOptions{}.NewCodec() + baseapptestutil.RegisterInterfaces(cdc.InterfaceRegistry()) + + signer, _, err := cdc.GetMsgSigners(message) + if err != nil { + return nil, err + } + if len(signer) != 1 { + return nil, fmt.Errorf("expected 1 signer, got %d", len(signer)) + } + + msgs, err := message.GetMsgs() + if err != nil { + return nil, err + } + + for _, msg := range msgs { + s, _, err := cdc.GetMsgSigners(msg) + if err != nil { + return nil, err + } + if len(s) != 1 { + return nil, fmt.Errorf("expected 1 signer, got %d", len(s)) + } + if !bytes.Equal(signer[0], s[0]) { + return nil, errors.New("signer does not match") + } + + } + + gas := n.gas + if gas == 0 { + gas = 5 + } + sdkCtx.GasMeter().ConsumeGas(gas, "nested messages test") + return nil, nil +} diff --git a/simapp/app.go b/simapp/app.go index df3e524922d..443a4705491 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -66,6 +66,7 @@ import ( "cosmossdk.io/x/gov" govkeeper "cosmossdk.io/x/gov/keeper" govtypes "cosmossdk.io/x/gov/types" + govv1 "cosmossdk.io/x/gov/types/v1" govv1beta1 "cosmossdk.io/x/gov/types/v1beta1" "cosmossdk.io/x/group" groupkeeper "cosmossdk.io/x/group/keeper" @@ -247,7 +248,8 @@ func NewSimApp( voteExtHandler := NewVoteExtensionHandler() voteExtHandler.SetHandlers(bApp) } - baseAppOptions = append(baseAppOptions, voteExtOp, baseapp.SetOptimisticExecution()) + baseAppOptions = append(baseAppOptions, voteExtOp, baseapp.SetOptimisticExecution(), + baseapp.SetIncludeNestedMsgsGas([]sdk.Msg{&govv1.MsgSubmitProposal{}})) bApp := baseapp.NewBaseApp(appName, logger, db, txConfig.TxDecoder(), baseAppOptions...) bApp.SetCommitMultiStoreTracer(traceStore) diff --git a/simapp/app_di.go b/simapp/app_di.go index 52c9917fd18..63beee09ab7 100644 --- a/simapp/app_di.go +++ b/simapp/app_di.go @@ -137,7 +137,6 @@ func NewSimApp( appOpts, // supply the logger logger, - // ADVANCED CONFIGURATION // From 9f5ee3a083908f1a608ea58dd947709d41000387 Mon Sep 17 00:00:00 2001 From: riyueguang Date: Fri, 26 Jul 2024 20:00:15 +0900 Subject: [PATCH 08/15] chore: fix some comments (#21085) Signed-off-by: riyueguang --- UPGRADING.md | 2 +- math/dec.go | 2 +- server/util.go | 2 +- server/v2/logger.go | 2 +- x/accounts/testing/account_abstraction/minimal.go | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/UPGRADING.md b/UPGRADING.md index 9e57f3a6f9b..8ca41865571 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -1295,4 +1295,4 @@ message MsgSetWithdrawAddress { } ``` -When clients interact with a node they are required to set a codec in in the grpc.Dial. More information can be found in this [doc](https://docs.cosmos.network/v0.46/run-node/interact-node.html#programmatically-via-go). +When clients interact with a node they are required to set a codec in the grpc.Dial. More information can be found in this [doc](https://docs.cosmos.network/v0.46/run-node/interact-node.html#programmatically-via-go). diff --git a/math/dec.go b/math/dec.go index 49daf378ea7..3ed930d5c48 100644 --- a/math/dec.go +++ b/math/dec.go @@ -499,7 +499,7 @@ func (d LegacyDec) ApproxRoot(root uint64) (guess LegacyDec, err error) { return guess, nil } -// Power returns a the result of raising to a positive integer power +// Power returns the result of raising to a positive integer power func (d LegacyDec) Power(power uint64) LegacyDec { res := LegacyDec{new(big.Int).Set(d.i)} return res.PowerMut(power) diff --git a/server/util.go b/server/util.go index d84847ef275..330bda60a74 100644 --- a/server/util.go +++ b/server/util.go @@ -169,7 +169,7 @@ func InterceptConfigsAndCreateContext(cmd *cobra.Command, customAppConfigTemplat return serverCtx, nil } -// CreateSDKLogger creates a the default SDK logger. +// CreateSDKLogger creates the default SDK logger. // It reads the log level and format from the server context. func CreateSDKLogger(ctx *Context, out io.Writer) (log.Logger, error) { var opts []log.Option diff --git a/server/v2/logger.go b/server/v2/logger.go index 5b89486c277..13540637fa8 100644 --- a/server/v2/logger.go +++ b/server/v2/logger.go @@ -10,7 +10,7 @@ import ( "cosmossdk.io/log" ) -// NewLogger creates a the default SDK logger. +// NewLogger creates the default SDK logger. // It reads the log level and format from the server context. func NewLogger(v *viper.Viper, out io.Writer) (corelog.Logger, error) { var opts []log.Option diff --git a/x/accounts/testing/account_abstraction/minimal.go b/x/accounts/testing/account_abstraction/minimal.go index 30775e98426..b450f0016cc 100644 --- a/x/accounts/testing/account_abstraction/minimal.go +++ b/x/accounts/testing/account_abstraction/minimal.go @@ -46,7 +46,7 @@ func (a MinimalAbstractedAccount) RotatePubKey(ctx context.Context, msg *rotatio return nil, errors.New("not implemented") } -// Authenticate authenticates the account, auth always passess. +// Authenticate authenticates the account, auth always passes. func (a MinimalAbstractedAccount) Authenticate(ctx context.Context, msg *account_abstractionv1.MsgAuthenticate) (*account_abstractionv1.MsgAuthenticateResponse, error) { _, err := a.Sequence.Next(ctx) if err != nil { From 5c90246b3f9f28a56c87ffa643c3f1b7d921fa8e Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Fri, 26 Jul 2024 13:00:27 +0200 Subject: [PATCH 09/15] feat(log): remove core dependency and update core interface to be dependency free (#21045) Co-authored-by: marbar3778 Co-authored-by: Julien Robert --- .github/workflows/test.yml | 8 -- baseapp/baseapp.go | 5 +- baseapp/oe/optimistic_execution.go | 2 +- baseapp/oe/optimistic_execution_test.go | 4 +- client/v2/go.mod | 4 +- client/v2/go.sum | 6 +- core/log/logger.go | 10 +- core/testing/noop.go | 2 +- go.mod | 3 +- go.sum | 6 +- log/CHANGELOG.md | 2 + log/go.mod | 10 -- log/go.sum | 9 -- log/logger.go | 94 ++++++++++--------- runtime/app.go | 2 +- runtime/module.go | 2 +- runtime/v2/app.go | 2 +- runtime/v2/go.mod | 5 +- runtime/v2/go.sum | 6 +- runtime/v2/manager.go | 2 +- runtime/v2/module.go | 2 +- schema/module_schema_test.go | 21 +++-- server/util.go | 3 +- server/v2/cometbft/abci.go | 2 +- .../client/grpc/cmtservice/service.go | 3 +- server/v2/cometbft/go.mod | 6 +- server/v2/cometbft/go.sum | 6 +- server/v2/cometbft/log/logger.go | 2 +- server/v2/cometbft/server.go | 2 +- server/v2/go.mod | 3 +- server/v2/go.sum | 6 +- server/v2/logger.go | 3 +- server/v2/store/server.go | 2 +- server/v2/util.go | 5 +- simapp/app.go | 2 +- simapp/go.mod | 5 +- simapp/go.sum | 6 +- simapp/sim_bench_test.go | 4 +- simapp/test_helpers.go | 7 +- simapp/v2/app_di.go | 2 +- simapp/v2/go.mod | 5 +- simapp/v2/go.sum | 6 +- simapp/v2/simdv2/cmd/commands.go | 2 +- simapp/v2/simdv2/cmd/testnet.go | 4 +- store/go.mod | 10 +- store/go.sum | 6 +- store/iavl/store.go | 7 +- store/pruning/manager.go | 6 +- store/pruning/manager_test.go | 16 ++-- store/rootmulti/proof_test.go | 8 +- store/rootmulti/snapshot_test.go | 10 +- store/rootmulti/store.go | 5 +- store/rootmulti/store_test.go | 14 +-- store/snapshots/helpers_test.go | 4 +- store/snapshots/manager.go | 5 +- store/snapshots/manager_test.go | 14 +-- store/store.go | 3 +- store/streaming/streaming_test.go | 5 +- store/types/context.go | 4 +- store/types/iterator_test.go | 4 +- store/types/logger.go | 21 +++++ store/v2/commitment/iavl/tree_test.go | 4 +- store/v2/commitment/store.go | 6 +- store/v2/commitment/store_test_suite.go | 4 +- store/v2/go.mod | 4 +- store/v2/go.sum | 6 +- store/v2/pruning/manager_test.go | 4 +- store/v2/root/store.go | 8 +- store/v2/snapshots/manager.go | 8 +- store/v2/snapshots/manager_test.go | 3 +- tests/go.mod | 3 +- tests/go.sum | 6 +- .../store/rootmulti/rollback_test.go | 4 +- testutil/context.go | 14 +-- testutil/mock/logger.go | 2 +- testutils/sims/runner.go | 11 +-- types/context.go | 2 +- types/mempool/mempool_test.go | 6 +- types/mempool/priority_nonce_test.go | 20 ++-- types/mempool/sender_nonce_property_test.go | 4 +- types/mempool/sender_nonce_test.go | 8 +- types/module/module_test.go | 10 +- x/accounts/defaults/lockup/go.mod | 3 +- x/accounts/defaults/lockup/go.sum | 6 +- x/accounts/defaults/multisig/go.mod | 3 +- x/accounts/defaults/multisig/go.sum | 6 +- x/accounts/go.mod | 3 +- x/accounts/go.sum | 6 +- x/auth/go.mod | 3 +- x/auth/go.sum | 6 +- x/authz/go.mod | 7 +- x/authz/go.sum | 6 +- x/authz/keeper/genesis_test.go | 3 +- x/authz/keeper/keeper_test.go | 3 +- x/authz/module/abci_test.go | 3 +- x/bank/go.mod | 3 +- x/bank/go.sum | 6 +- x/bank/keeper/keeper.go | 4 - x/circuit/go.mod | 3 +- x/circuit/go.sum | 6 +- x/consensus/go.mod | 3 +- x/consensus/go.sum | 6 +- x/distribution/go.mod | 3 +- x/distribution/go.sum | 6 +- x/epochs/go.mod | 3 +- x/epochs/go.sum | 6 +- x/evidence/go.mod | 3 +- x/evidence/go.sum | 6 +- x/evidence/keeper/keeper_test.go | 4 - x/feegrant/go.mod | 3 +- x/feegrant/go.sum | 6 +- x/feegrant/keeper/keeper.go | 7 -- x/gov/go.mod | 5 +- x/gov/go.sum | 6 +- x/gov/keeper/common_test.go | 5 +- x/group/go.mod | 3 +- x/group/go.sum | 6 +- x/mint/go.mod | 5 +- x/mint/go.sum | 6 +- x/mint/keeper/keeper.go | 5 +- x/mint/keeper/keeper_test.go | 4 +- x/nft/go.mod | 4 +- x/nft/go.sum | 6 +- x/params/go.mod | 4 +- x/params/go.sum | 6 +- x/protocolpool/go.mod | 7 +- x/protocolpool/go.sum | 6 +- x/protocolpool/keeper/keeper_test.go | 4 +- x/simulation/simulate.go | 6 +- x/slashing/go.mod | 3 +- x/slashing/go.sum | 6 +- x/staking/go.mod | 5 +- x/staking/go.sum | 6 +- x/staking/keeper/keeper_test.go | 3 +- x/upgrade/go.mod | 4 +- x/upgrade/go.sum | 8 +- x/upgrade/keeper/abci_test.go | 3 +- x/upgrade/keeper/keeper_test.go | 3 +- x/upgrade/types/storeloader_test.go | 8 +- 139 files changed, 421 insertions(+), 424 deletions(-) create mode 100644 store/types/logger.go diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6eea986e27b..8adcb9dc72e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -357,14 +357,6 @@ jobs: run: | cd core/testing go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock' ./... - - name: sonarcloud - if: ${{ env.GIT_DIFF && !github.event.pull_request.draft && env.SONAR_TOKEN != null }} - uses: SonarSource/sonarcloud-github-action@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - with: - projectBaseDir: core/testing/ test-depinject: runs-on: ubuntu-latest diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index 3599a35517e..e193bd86d31 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -18,9 +18,8 @@ import ( "google.golang.org/protobuf/reflect/protoreflect" "cosmossdk.io/core/header" - "cosmossdk.io/core/log" errorsmod "cosmossdk.io/errors" - sdklog "cosmossdk.io/log" + "cosmossdk.io/log" "cosmossdk.io/store" storemetrics "cosmossdk.io/store/metrics" "cosmossdk.io/store/snapshots" @@ -201,7 +200,7 @@ func NewBaseApp( logger: logger.With(log.ModuleKey, "baseapp"), name: name, db: db, - cms: store.NewCommitMultiStore(db, sdklog.LogWrapper{Logger: logger}, storemetrics.NewNoOpMetrics()), // by default we use a no-op metric gather in store + cms: store.NewCommitMultiStore(db, logger, storemetrics.NewNoOpMetrics()), // by default we use a no-op metric gather in store storeLoader: DefaultStoreLoader, grpcQueryRouter: NewGRPCQueryRouter(), msgServiceRouter: NewMsgServiceRouter(), diff --git a/baseapp/oe/optimistic_execution.go b/baseapp/oe/optimistic_execution.go index e5820aa0022..1c4a83825f3 100644 --- a/baseapp/oe/optimistic_execution.go +++ b/baseapp/oe/optimistic_execution.go @@ -10,7 +10,7 @@ import ( abci "github.com/cometbft/cometbft/api/cometbft/abci/v1" - "cosmossdk.io/core/log" + "cosmossdk.io/log" ) // FinalizeBlockFunc is the function that is called by the OE to finalize the diff --git a/baseapp/oe/optimistic_execution_test.go b/baseapp/oe/optimistic_execution_test.go index 4afb16aaa79..29643f4ee10 100644 --- a/baseapp/oe/optimistic_execution_test.go +++ b/baseapp/oe/optimistic_execution_test.go @@ -8,7 +8,7 @@ import ( abci "github.com/cometbft/cometbft/api/cometbft/abci/v1" "github.com/stretchr/testify/assert" - coretesting "cosmossdk.io/core/testing" + "cosmossdk.io/log" ) func testFinalizeBlock(_ context.Context, _ *abci.FinalizeBlockRequest) (*abci.FinalizeBlockResponse, error) { @@ -16,7 +16,7 @@ func testFinalizeBlock(_ context.Context, _ *abci.FinalizeBlockRequest) (*abci.F } func TestOptimisticExecution(t *testing.T) { - oe := NewOptimisticExecution(coretesting.NewNopLogger(), testFinalizeBlock) + oe := NewOptimisticExecution(log.NewNopLogger(), testFinalizeBlock) assert.True(t, oe.Enabled()) oe.Execute(&abci.ProcessProposalRequest{ Hash: []byte("test"), diff --git a/client/v2/go.mod b/client/v2/go.mod index 7cf66843c08..f68895543ab 100644 --- a/client/v2/go.mod +++ b/client/v2/go.mod @@ -55,7 +55,7 @@ require ( github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/gogoproto v1.5.0 - github.com/cosmos/iavl v1.2.0 // indirect + github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.1 // indirect @@ -171,7 +171,6 @@ require ( ) require ( - cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/schema v0.1.1 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect ) @@ -183,7 +182,6 @@ replace ( cosmossdk.io/api => ./../../api cosmossdk.io/core => ./../../core cosmossdk.io/core/testing => ../../core/testing - cosmossdk.io/log => ./../../log cosmossdk.io/store => ./../../store cosmossdk.io/x/accounts => ./../../x/accounts cosmossdk.io/x/auth => ./../../x/auth diff --git a/client/v2/go.sum b/client/v2/go.sum index cd9dd4c5e9c..dc867c18028 100644 --- a/client/v2/go.sum +++ b/client/v2/go.sum @@ -10,6 +10,8 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= +cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= @@ -117,8 +119,8 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= -github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= -github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= diff --git a/core/log/logger.go b/core/log/logger.go index e56c462b22b..6065e81732a 100644 --- a/core/log/logger.go +++ b/core/log/logger.go @@ -2,10 +2,9 @@ package log const ModuleKey = "module" -// Logger is the Cosmos SDK logger interface. -// It maintains as much backward compatibility with the CometBFT logger as possible. -// cosmossdk.io/log is the implementation provided by the Cosmos SDK -// All functionalities of the logger are available through the Impl() method. +// Logger defines basic logger functionality that all previous versions of the Logger interface should +// support. Library users should prefer to use this interface when possible, then type case to Logger +// to see if WithContext is supported. type Logger interface { // Info takes a message and a set of key/value pairs and logs with level INFO. // The key of the tuple must be a string. @@ -23,9 +22,6 @@ type Logger interface { // The key of the tuple must be a string. Debug(msg string, keyVals ...any) - // With returns a new wrapped logger with additional context provided by a set. - With(keyVals ...any) Logger - // Impl returns the underlying logger implementation. // It is used to access the full functionalities of the underlying logger. // Advanced users can type cast the returned value to the actual logger. diff --git a/core/testing/noop.go b/core/testing/noop.go index 94ea011b431..e723280b832 100644 --- a/core/testing/noop.go +++ b/core/testing/noop.go @@ -17,5 +17,5 @@ func (nopLogger) Info(string, ...any) {} func (nopLogger) Warn(string, ...any) {} func (nopLogger) Error(string, ...any) {} func (nopLogger) Debug(string, ...any) {} -func (nopLogger) With(...any) log.Logger { return nopLogger{} } +func (nopLogger) WithContext(...any) any { return nopLogger{} } func (nopLogger) Impl() any { return nopLogger{} } diff --git a/go.mod b/go.mod index 00df79575de..217ad6e2ee9 100644 --- a/go.mod +++ b/go.mod @@ -85,7 +85,7 @@ require ( github.com/cockroachdb/redact v1.1.5 // indirect github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect github.com/cometbft/cometbft-db v0.12.0 // indirect - github.com/cosmos/iavl v1.2.0 // indirect + github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/danieljoos/wincred v1.2.1 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect @@ -188,7 +188,6 @@ replace ( cosmossdk.io/collections => ./collections cosmossdk.io/core => ./core cosmossdk.io/core/testing => ./core/testing - cosmossdk.io/log => ./log cosmossdk.io/store => ./store cosmossdk.io/x/accounts => ./x/accounts cosmossdk.io/x/auth => ./x/auth diff --git a/go.sum b/go.sum index d990868be5f..c63d7cbaf79 100644 --- a/go.sum +++ b/go.sum @@ -8,6 +8,8 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= +cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= @@ -106,8 +108,8 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= -github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= -github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo= diff --git a/log/CHANGELOG.md b/log/CHANGELOG.md index ae04009a991..ca750f3ff9f 100644 --- a/log/CHANGELOG.md +++ b/log/CHANGELOG.md @@ -22,6 +22,8 @@ Each entry must include the Github issue reference in the following format: ## [Unreleased] +* [#21045](https://github.com/cosmos/cosmos-sdk/pull/21045) Add `WithContext` method implementations to make all returned loggers compatible with `cosmossdk.io/core/log.Logger` without a direct dependency. + ## [v1.3.1](https://github.com/cosmos/cosmos-sdk/releases/tag/log/v1.3.0) - 2024-02-05 * [#19346](https://github.com/cosmos/cosmos-sdk/pull/19346) Upgrade zerolog to v1.32.0. diff --git a/log/go.mod b/log/go.mod index da7c3d4d64a..8ad68695218 100644 --- a/log/go.mod +++ b/log/go.mod @@ -3,24 +3,14 @@ module cosmossdk.io/log go 1.20 require ( - cosmossdk.io/core v0.12.0 - cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000 github.com/pkg/errors v0.9.1 github.com/rs/zerolog v1.33.0 gotest.tools/v3 v3.5.1 ) require ( - github.com/cosmos/gogoproto v1.5.0 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/tidwall/btree v1.7.0 // indirect - golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect golang.org/x/sys v0.22.0 // indirect - google.golang.org/protobuf v1.34.2 // indirect ) - -replace cosmossdk.io/core => ../core - -replace cosmossdk.io/core/testing => ../core/testing diff --git a/log/go.sum b/log/go.sum index c8715b25f59..12553f8dc11 100644 --- a/log/go.sum +++ b/log/go.sum @@ -1,8 +1,5 @@ github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= -github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= @@ -16,16 +13,10 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= -github.com/tidwall/btree v1.7.0 h1:L1fkJH/AuEh5zBnnBbmTwQ5Lt+bRJ5A8EWecslvo9iI= -github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= -golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI= -golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= diff --git a/log/logger.go b/log/logger.go index f57c7690b41..38802ed88e7 100644 --- a/log/logger.go +++ b/log/logger.go @@ -9,9 +9,6 @@ import ( "github.com/pkg/errors" "github.com/rs/zerolog" "github.com/rs/zerolog/pkgerrors" - - corelog "cosmossdk.io/core/log" - coretesting "cosmossdk.io/core/testing" ) func init() { @@ -30,15 +27,39 @@ func init() { } // ModuleKey defines a module logging key. -const ModuleKey = corelog.ModuleKey +const ModuleKey = "module" // ContextKey is used to store the logger in the context. var ContextKey struct{} // Logger is the Cosmos SDK logger interface. -// It maintains as much backward compatibility with the CometBFT logger as possible. -// All functionalities of the logger are available through the Impl() method. -type Logger = corelog.Logger +// It extends cosmossdk.io/core/log.Logger to return a child logger. +// Use cosmossdk.io/core/log.Logger instead in modules. +type Logger interface { + // Info takes a message and a set of key/value pairs and logs with level INFO. + // The key of the tuple must be a string. + Info(msg string, keyVals ...any) + + // Warn takes a message and a set of key/value pairs and logs with level WARN. + // The key of the tuple must be a string. + Warn(msg string, keyVals ...any) + + // Error takes a message and a set of key/value pairs and logs with level ERR. + // The key of the tuple must be a string. + Error(msg string, keyVals ...any) + + // Debug takes a message and a set of key/value pairs and logs with level DEBUG. + // The key of the tuple must be a string. + Debug(msg string, keyVals ...any) + + // With returns a new wrapped logger with additional context provided by a set. + With(keyVals ...any) Logger + + // Impl returns the underlying logger implementation. + // It is used to access the full functionalities of the underlying logger. + // Advanced users can type cast the returned value to the actual logger. + Impl() any +} // WithJSONMarshal configures zerolog global json encoding. func WithJSONMarshal(marshaler func(v any) ([]byte, error)) { @@ -68,6 +89,7 @@ type zeroLogWrapper struct { // // Stderr is the typical destination for logs, // so that any output from your application can still be piped to other processes. +// The returned value can be safely cast to cosmossdk.io/core/log.Logger. func NewLogger(dst io.Writer, options ...Option) Logger { logCfg := defaultConfig for _, opt := range options { @@ -144,6 +166,12 @@ func (l zeroLogWrapper) With(keyVals ...interface{}) Logger { return zeroLogWrapper{&logger} } +// WithContext returns a new wrapped logger with additional context provided by a set. +func (l zeroLogWrapper) WithContext(keyVals ...interface{}) any { + logger := l.Logger.With().Fields(keyVals).Logger() + return zeroLogWrapper{&logger} +} + // Impl returns the underlying zerolog logger. // It can be used to used zerolog structured API directly instead of the wrapper. func (l zeroLogWrapper) Impl() interface{} { @@ -151,38 +179,20 @@ func (l zeroLogWrapper) Impl() interface{} { } // NewNopLogger returns a new logger that does nothing. -var NewNopLogger = coretesting.NewNopLogger - -// LogWrapper wraps a Logger and implements the Logger interface. -// it is only meant to avoid breakage of legacy versions of the Logger interface. -type LogWrapper struct { - corelog.Logger -} - -func NewLogWrapper(logger corelog.Logger) Logger { - return LogWrapper{logger} -} - -func (l LogWrapper) Impl() interface{} { - return l.Logger -} - -func (l LogWrapper) With(keyVals ...interface{}) Logger { - return NewLogWrapper(l.Logger.With(keyVals...)) -} - -func (l LogWrapper) Info(msg string, keyVals ...interface{}) { - l.Logger.Info(msg, keyVals...) -} - -func (l LogWrapper) Warn(msg string, keyVals ...interface{}) { - l.Logger.Warn(msg, keyVals...) -} - -func (l LogWrapper) Error(msg string, keyVals ...interface{}) { - l.Logger.Error(msg, keyVals...) -} - -func (l LogWrapper) Debug(msg string, keyVals ...interface{}) { - l.Logger.Debug(msg, keyVals...) -} +func NewNopLogger() Logger { + // The custom nopLogger is about 3x faster than a zeroLogWrapper with zerolog.Nop(). + return nopLogger{} +} + +// nopLogger is a Logger that does nothing when called. +// See the "specialized nop logger" benchmark and compare with the "zerolog nop logger" benchmark. +// The custom implementation is about 3x faster. +type nopLogger struct{} + +func (nopLogger) Info(string, ...any) {} +func (nopLogger) Warn(string, ...any) {} +func (nopLogger) Error(string, ...any) {} +func (nopLogger) Debug(string, ...any) {} +func (nopLogger) With(...any) Logger { return nopLogger{} } +func (nopLogger) WithContext(...any) any { return nopLogger{} } +func (nopLogger) Impl() any { return nopLogger{} } diff --git a/runtime/app.go b/runtime/app.go index aeef32a28db..185278511e0 100644 --- a/runtime/app.go +++ b/runtime/app.go @@ -10,7 +10,7 @@ import ( runtimev1alpha1 "cosmossdk.io/api/cosmos/app/runtime/v1alpha1" "cosmossdk.io/core/appmodule" "cosmossdk.io/core/legacy" - "cosmossdk.io/core/log" + "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" authtx "cosmossdk.io/x/auth/tx" diff --git a/runtime/module.go b/runtime/module.go index 1060a9857b8..e806e215676 100644 --- a/runtime/module.go +++ b/runtime/module.go @@ -17,10 +17,10 @@ import ( "cosmossdk.io/core/comet" "cosmossdk.io/core/genesis" "cosmossdk.io/core/legacy" - "cosmossdk.io/core/log" "cosmossdk.io/core/store" "cosmossdk.io/depinject" "cosmossdk.io/depinject/appconfig" + "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/baseapp" diff --git a/runtime/v2/app.go b/runtime/v2/app.go index 56632590b4f..06bff4a8d86 100644 --- a/runtime/v2/app.go +++ b/runtime/v2/app.go @@ -9,9 +9,9 @@ import ( runtimev2 "cosmossdk.io/api/cosmos/app/runtime/v2" "cosmossdk.io/core/legacy" - "cosmossdk.io/core/log" "cosmossdk.io/core/registry" "cosmossdk.io/core/transaction" + "cosmossdk.io/log" "cosmossdk.io/server/v2/appmanager" "cosmossdk.io/server/v2/stf" ) diff --git a/runtime/v2/go.mod b/runtime/v2/go.mod index deca135c16f..205e0e19748 100644 --- a/runtime/v2/go.mod +++ b/runtime/v2/go.mod @@ -7,7 +7,6 @@ replace ( cosmossdk.io/api => ../../api cosmossdk.io/core => ../../core cosmossdk.io/core/testing => ../../core/testing - cosmossdk.io/log => ../../log cosmossdk.io/server/v2 => ../../server/v2 cosmossdk.io/server/v2/appmanager => ../../server/v2/appmanager cosmossdk.io/server/v2/stf => ../../server/v2/stf @@ -26,6 +25,7 @@ require ( cosmossdk.io/api v0.7.5 cosmossdk.io/core v0.12.1-0.20231114100755-569e3ff6a0d7 cosmossdk.io/depinject v1.0.0 + cosmossdk.io/log v1.3.1 cosmossdk.io/server/v2/appmanager v0.0.0-00010101000000-000000000000 cosmossdk.io/server/v2/stf v0.0.0-00010101000000-000000000000 cosmossdk.io/store/v2 v2.0.0-00010101000000-000000000000 @@ -42,7 +42,6 @@ require ( buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/errors v1.0.1 // indirect - cosmossdk.io/log v1.3.1 // indirect github.com/DataDog/zstd v1.5.5 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect @@ -53,7 +52,7 @@ require ( github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect github.com/cosmos/cosmos-db v1.0.2 // indirect github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect - github.com/cosmos/iavl v1.2.0 // indirect + github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/emicklei/dot v1.6.2 // indirect diff --git a/runtime/v2/go.sum b/runtime/v2/go.sum index a37bf08a394..4a496ee484f 100644 --- a/runtime/v2/go.sum +++ b/runtime/v2/go.sum @@ -6,6 +6,8 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= +cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= @@ -44,8 +46,8 @@ github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+R github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= -github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= -github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= diff --git a/runtime/v2/manager.go b/runtime/v2/manager.go index c64423ee9e2..f52cb1aeb48 100644 --- a/runtime/v2/manager.go +++ b/runtime/v2/manager.go @@ -20,9 +20,9 @@ import ( "cosmossdk.io/core/appmodule" appmodulev2 "cosmossdk.io/core/appmodule/v2" "cosmossdk.io/core/legacy" - "cosmossdk.io/core/log" "cosmossdk.io/core/registry" "cosmossdk.io/core/transaction" + "cosmossdk.io/log" "cosmossdk.io/server/v2/stf" ) diff --git a/runtime/v2/module.go b/runtime/v2/module.go index 588584d0650..2d428fd238c 100644 --- a/runtime/v2/module.go +++ b/runtime/v2/module.go @@ -21,12 +21,12 @@ import ( "cosmossdk.io/core/comet" "cosmossdk.io/core/genesis" "cosmossdk.io/core/legacy" - "cosmossdk.io/core/log" "cosmossdk.io/core/registry" "cosmossdk.io/core/store" "cosmossdk.io/core/transaction" "cosmossdk.io/depinject" "cosmossdk.io/depinject/appconfig" + "cosmossdk.io/log" "cosmossdk.io/runtime/v2/services" "cosmossdk.io/server/v2/stf" ) diff --git a/schema/module_schema_test.go b/schema/module_schema_test.go index ebd44e65363..454ae743064 100644 --- a/schema/module_schema_test.go +++ b/schema/module_schema_test.go @@ -105,19 +105,20 @@ func TestModuleSchema_Validate(t *testing.T) { }, { name: "same enum", - objectTypes: []ObjectType{{ - Name: "object1", - KeyFields: []Field{ - { - Name: "k", - Kind: EnumKind, - EnumType: EnumType{ - Name: "enum1", - Values: []string{"a", "b"}, + objectTypes: []ObjectType{ + { + Name: "object1", + KeyFields: []Field{ + { + Name: "k", + Kind: EnumKind, + EnumType: EnumType{ + Name: "enum1", + Values: []string{"a", "b"}, + }, }, }, }, - }, { Name: "object2", KeyFields: []Field{ diff --git a/server/util.go b/server/util.go index 330bda60a74..c23668341d4 100644 --- a/server/util.go +++ b/server/util.go @@ -25,7 +25,6 @@ import ( "golang.org/x/sync/errgroup" corectx "cosmossdk.io/core/context" - corelog "cosmossdk.io/core/log" "cosmossdk.io/log" "cosmossdk.io/store" "cosmossdk.io/store/snapshots" @@ -51,7 +50,7 @@ const ServerContextKey = sdk.ContextKey("server.context") type Context struct { Viper *viper.Viper Config *cmtcfg.Config - Logger corelog.Logger + Logger log.Logger } func NewDefaultContext() *Context { diff --git a/server/v2/cometbft/abci.go b/server/v2/cometbft/abci.go index c83360ed75d..9a901e85b7a 100644 --- a/server/v2/cometbft/abci.go +++ b/server/v2/cometbft/abci.go @@ -14,10 +14,10 @@ import ( coreappmgr "cosmossdk.io/core/app" "cosmossdk.io/core/comet" "cosmossdk.io/core/event" - "cosmossdk.io/core/log" "cosmossdk.io/core/store" "cosmossdk.io/core/transaction" errorsmod "cosmossdk.io/errors" + "cosmossdk.io/log" "cosmossdk.io/server/v2/appmanager" "cosmossdk.io/server/v2/cometbft/client/grpc/cmtservice" "cosmossdk.io/server/v2/cometbft/handlers" diff --git a/server/v2/cometbft/client/grpc/cmtservice/service.go b/server/v2/cometbft/client/grpc/cmtservice/service.go index 3e0188c2a7e..2e1638eaa7a 100644 --- a/server/v2/cometbft/client/grpc/cmtservice/service.go +++ b/server/v2/cometbft/client/grpc/cmtservice/service.go @@ -4,7 +4,6 @@ import ( "context" "strings" - "cosmossdk.io/server/v2/cometbft/client/rpc" abci "github.com/cometbft/cometbft/api/cometbft/abci/v1" coretypes "github.com/cometbft/cometbft/rpc/core/types" gogogrpc "github.com/cosmos/gogoproto/grpc" @@ -13,6 +12,8 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + "cosmossdk.io/server/v2/cometbft/client/rpc" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" diff --git a/server/v2/cometbft/go.mod b/server/v2/cometbft/go.mod index d76a77456e9..d79be3f5476 100644 --- a/server/v2/cometbft/go.mod +++ b/server/v2/cometbft/go.mod @@ -6,7 +6,6 @@ replace ( cosmossdk.io/api => ../../../api cosmossdk.io/core => ../../../core cosmossdk.io/core/testing => ../../../core/testing - cosmossdk.io/log => ../../../log cosmossdk.io/server/v2 => ../ cosmossdk.io/server/v2/appmanager => ../appmanager cosmossdk.io/store => ../../../store @@ -25,6 +24,7 @@ require ( cosmossdk.io/api v0.7.5 cosmossdk.io/core v0.12.1-0.20231114100755-569e3ff6a0d7 cosmossdk.io/errors v1.0.1 + cosmossdk.io/log v1.3.1 cosmossdk.io/server/v2 v2.0.0-00010101000000-000000000000 cosmossdk.io/server/v2/appmanager v0.0.0-00010101000000-000000000000 cosmossdk.io/store/v2 v2.0.0-00010101000000-000000000000 @@ -48,9 +48,7 @@ require ( require ( buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect cosmossdk.io/collections v0.4.0 // indirect - cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/depinject v1.0.0 // indirect - cosmossdk.io/log v1.3.1 // indirect cosmossdk.io/math v1.3.0 // indirect cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc // indirect cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 // indirect @@ -75,7 +73,7 @@ require ( github.com/cosmos/cosmos-db v1.0.2 // indirect github.com/cosmos/crypto v0.1.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect - github.com/cosmos/iavl v1.2.0 // indirect + github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.1 // indirect diff --git a/server/v2/cometbft/go.sum b/server/v2/cometbft/go.sum index 8b5334c6af4..954a349c217 100644 --- a/server/v2/cometbft/go.sum +++ b/server/v2/cometbft/go.sum @@ -10,6 +10,8 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= +cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= @@ -103,8 +105,8 @@ github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiK github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ4GUkT+tbFI= github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= -github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= -github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= diff --git a/server/v2/cometbft/log/logger.go b/server/v2/cometbft/log/logger.go index 94f5d944e3a..6ad7fdd8883 100644 --- a/server/v2/cometbft/log/logger.go +++ b/server/v2/cometbft/log/logger.go @@ -3,7 +3,7 @@ package log import ( cmtlog "github.com/cometbft/cometbft/libs/log" - "cosmossdk.io/core/log" + "cosmossdk.io/log" ) var _ cmtlog.Logger = (*CometLoggerWrapper)(nil) diff --git a/server/v2/cometbft/server.go b/server/v2/cometbft/server.go index 88b5aa50a4e..1bb50e5b676 100644 --- a/server/v2/cometbft/server.go +++ b/server/v2/cometbft/server.go @@ -18,8 +18,8 @@ import ( "github.com/spf13/pflag" "github.com/spf13/viper" - "cosmossdk.io/core/log" "cosmossdk.io/core/transaction" + "cosmossdk.io/log" serverv2 "cosmossdk.io/server/v2" cometlog "cosmossdk.io/server/v2/cometbft/log" "cosmossdk.io/server/v2/cometbft/types" diff --git a/server/v2/go.mod b/server/v2/go.mod index 95e4c2f9d18..aaf1411f94c 100644 --- a/server/v2/go.mod +++ b/server/v2/go.mod @@ -6,7 +6,6 @@ replace ( cosmossdk.io/api => ../../api cosmossdk.io/core => ../../core cosmossdk.io/core/testing => ../../core/testing - cosmossdk.io/log => ../../log cosmossdk.io/server/v2/appmanager => ./appmanager cosmossdk.io/server/v2/stf => ./stf cosmossdk.io/store/v2 => ../../store/v2 @@ -56,7 +55,7 @@ require ( github.com/cockroachdb/redact v1.1.5 // indirect github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect github.com/cosmos/cosmos-db v1.0.2 // indirect - github.com/cosmos/iavl v1.2.0 // indirect + github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/emicklei/dot v1.6.1 // indirect diff --git a/server/v2/go.sum b/server/v2/go.sum index f82cb4e3b46..b34faf8211d 100644 --- a/server/v2/go.sum +++ b/server/v2/go.sum @@ -2,6 +2,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= +cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/DataDog/datadog-go v3.2.0+incompatible h1:qSG2N4FghB1He/r2mFrWKCaL7dXCilEuNEeAn20fdD4= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= @@ -57,8 +59,8 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= -github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= -github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= diff --git a/server/v2/logger.go b/server/v2/logger.go index 13540637fa8..8ca80e4cce4 100644 --- a/server/v2/logger.go +++ b/server/v2/logger.go @@ -6,13 +6,12 @@ import ( "github.com/rs/zerolog" "github.com/spf13/viper" - corelog "cosmossdk.io/core/log" "cosmossdk.io/log" ) // NewLogger creates the default SDK logger. // It reads the log level and format from the server context. -func NewLogger(v *viper.Viper, out io.Writer) (corelog.Logger, error) { +func NewLogger(v *viper.Viper, out io.Writer) (log.Logger, error) { var opts []log.Option if v.GetString(FlagLogFormat) == OutputFormatJSON { opts = append(opts, log.OutputJSONOption()) diff --git a/server/v2/store/server.go b/server/v2/store/server.go index 2adaa8b7ef8..c7a1f9035d1 100644 --- a/server/v2/store/server.go +++ b/server/v2/store/server.go @@ -7,8 +7,8 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" - "cosmossdk.io/core/log" "cosmossdk.io/core/transaction" + "cosmossdk.io/log" serverv2 "cosmossdk.io/server/v2" ) diff --git a/server/v2/util.go b/server/v2/util.go index dfec4cd5f18..72335621b44 100644 --- a/server/v2/util.go +++ b/server/v2/util.go @@ -10,7 +10,6 @@ import ( "github.com/spf13/viper" corectx "cosmossdk.io/core/context" - corelog "cosmossdk.io/core/log" "cosmossdk.io/log" ) @@ -40,9 +39,9 @@ func GetViperFromCmd(cmd *cobra.Command) *viper.Viper { return v } -func GetLoggerFromCmd(cmd *cobra.Command) corelog.Logger { +func GetLoggerFromCmd(cmd *cobra.Command) log.Logger { v := cmd.Context().Value(corectx.LoggerContextKey) - logger, ok := v.(corelog.Logger) + logger, ok := v.(log.Logger) if !ok { panic(fmt.Sprintf("incorrect logger type %T: expected log.Logger. Have you forgot to set the logger in the command context?", v)) } diff --git a/simapp/app.go b/simapp/app.go index 443a4705491..092435e4781 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -19,7 +19,7 @@ import ( reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1" "cosmossdk.io/client/v2/autocli" clienthelpers "cosmossdk.io/client/v2/helpers" - "cosmossdk.io/core/log" + "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" "cosmossdk.io/x/accounts" "cosmossdk.io/x/accounts/accountstd" diff --git a/simapp/go.mod b/simapp/go.mod index b6eb81a294d..1545f860cec 100644 --- a/simapp/go.mod +++ b/simapp/go.mod @@ -7,7 +7,7 @@ require ( cosmossdk.io/client/v2 v2.0.0-20230630094428-02b760776860 cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.12.1-0.20231114100755-569e3ff6a0d7 - cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000 + cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/depinject v1.0.0 cosmossdk.io/log v1.3.1 cosmossdk.io/math v1.3.0 @@ -87,7 +87,7 @@ require ( github.com/cosmos/crypto v0.1.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/iavl v1.2.0 // indirect + github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/creachadair/atomicfile v0.3.4 // indirect @@ -244,7 +244,6 @@ replace ( cosmossdk.io/collections => ../collections cosmossdk.io/core => ../core cosmossdk.io/core/testing => ../core/testing - cosmossdk.io/log => ../log cosmossdk.io/store => ../store cosmossdk.io/tools/confix => ../tools/confix cosmossdk.io/x/accounts => ../x/accounts diff --git a/simapp/go.sum b/simapp/go.sum index 33e6ee51d3b..53269104f8f 100644 --- a/simapp/go.sum +++ b/simapp/go.sum @@ -196,6 +196,8 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= +cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= @@ -319,8 +321,8 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= -github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= -github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo= diff --git a/simapp/sim_bench_test.go b/simapp/sim_bench_test.go index 914e7a40c5c..4a7832c8ec1 100644 --- a/simapp/sim_bench_test.go +++ b/simapp/sim_bench_test.go @@ -6,7 +6,7 @@ import ( "os" "testing" - coretesting "cosmossdk.io/core/testing" + "cosmossdk.io/log" "github.com/cosmos/cosmos-sdk/testutils/sims" flag "github.com/spf13/pflag" @@ -60,7 +60,7 @@ func BenchmarkFullAppSimulation(b *testing.B) { // run randomized simulation simParams, simErr := simulation.SimulateFromSeedX( b, - coretesting.NewNopLogger(), + log.NewNopLogger(), os.Stdout, app.BaseApp, simtestutil.AppStateFn(app.AppCodec(), app.AuthKeeper.AddressCodec(), app.StakingKeeper.ValidatorAddressCodec(), app.SimulationManager(), app.DefaultGenesis()), diff --git a/simapp/test_helpers.go b/simapp/test_helpers.go index bce25b28324..dc74a4e47e1 100644 --- a/simapp/test_helpers.go +++ b/simapp/test_helpers.go @@ -12,8 +12,7 @@ import ( dbm "github.com/cosmos/cosmos-db" "github.com/stretchr/testify/require" - "cosmossdk.io/core/log" - coretesting "cosmossdk.io/core/testing" + "cosmossdk.io/log" sdkmath "cosmossdk.io/math" pruningtypes "cosmossdk.io/store/pruning/types" authtypes "cosmossdk.io/x/auth/types" @@ -47,7 +46,7 @@ func setup(withGenesis bool, invCheckPeriod uint) (*SimApp, GenesisState) { appOptions[flags.FlagHome] = DefaultNodeHome appOptions[server.FlagInvCheckPeriod] = invCheckPeriod - app := NewSimApp(coretesting.NewNopLogger(), db, nil, true, appOptions) + app := NewSimApp(log.NewNopLogger(), db, nil, true, appOptions) if withGenesis { return app, app.DefaultGenesis() } @@ -226,7 +225,7 @@ func NewTestNetworkFixture() network.TestFixture { } defer os.RemoveAll(dir) - app := NewSimApp(coretesting.NewNopLogger(), dbm.NewMemDB(), nil, true, simtestutil.NewAppOptionsWithFlagHome(dir)) + app := NewSimApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, simtestutil.NewAppOptionsWithFlagHome(dir)) appCtr := func(val network.ValidatorI) servertypes.Application { return NewSimApp( diff --git a/simapp/v2/app_di.go b/simapp/v2/app_di.go index 7219193935f..0099f8f0f9d 100644 --- a/simapp/v2/app_di.go +++ b/simapp/v2/app_di.go @@ -8,9 +8,9 @@ import ( clienthelpers "cosmossdk.io/client/v2/helpers" coreapp "cosmossdk.io/core/app" "cosmossdk.io/core/legacy" - "cosmossdk.io/core/log" "cosmossdk.io/core/transaction" "cosmossdk.io/depinject" + "cosmossdk.io/log" "cosmossdk.io/runtime/v2" serverv2 "cosmossdk.io/server/v2" "cosmossdk.io/x/accounts" diff --git a/simapp/v2/go.mod b/simapp/v2/go.mod index 8b595badf80..ef565d570c6 100644 --- a/simapp/v2/go.mod +++ b/simapp/v2/go.mod @@ -42,7 +42,7 @@ require ( google.golang.org/protobuf v1.34.2 ) -require cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000 +require cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000 // indirect require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect @@ -92,7 +92,7 @@ require ( github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/gogoproto v1.5.0 // indirect - github.com/cosmos/iavl v1.2.0 // indirect + github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/creachadair/atomicfile v0.3.4 // indirect @@ -291,7 +291,6 @@ replace ( replace ( cosmossdk.io/api => ../../api cosmossdk.io/core/testing => ../../core/testing - cosmossdk.io/log => ../../log cosmossdk.io/runtime/v2 => ../../runtime/v2 cosmossdk.io/server/v2 => ../../server/v2 cosmossdk.io/server/v2/appmanager => ../../server/v2/appmanager diff --git a/simapp/v2/go.sum b/simapp/v2/go.sum index b95c10d44d3..c993deeb8a3 100644 --- a/simapp/v2/go.sum +++ b/simapp/v2/go.sum @@ -196,6 +196,8 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= +cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= @@ -321,8 +323,8 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= -github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= -github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo= diff --git a/simapp/v2/simdv2/cmd/commands.go b/simapp/v2/simdv2/cmd/commands.go index d1462e58768..8d1e8bd40a6 100644 --- a/simapp/v2/simdv2/cmd/commands.go +++ b/simapp/v2/simdv2/cmd/commands.go @@ -10,8 +10,8 @@ import ( "github.com/spf13/viper" "cosmossdk.io/client/v2/offchain" - "cosmossdk.io/core/log" "cosmossdk.io/core/transaction" + "cosmossdk.io/log" runtimev2 "cosmossdk.io/runtime/v2" serverv2 "cosmossdk.io/server/v2" "cosmossdk.io/server/v2/api/grpc" diff --git a/simapp/v2/simdv2/cmd/testnet.go b/simapp/v2/simdv2/cmd/testnet.go index e07ce258245..be770f9d74e 100644 --- a/simapp/v2/simdv2/cmd/testnet.go +++ b/simapp/v2/simdv2/cmd/testnet.go @@ -14,8 +14,8 @@ import ( "github.com/spf13/cobra" "github.com/spf13/pflag" - coretesting "cosmossdk.io/core/testing" "cosmossdk.io/core/transaction" + "cosmossdk.io/log" "cosmossdk.io/math" "cosmossdk.io/math/unsafe" runtimev2 "cosmossdk.io/runtime/v2" @@ -345,7 +345,7 @@ func initTestnetFiles[T transaction.Tx]( ) grpcServer := grpc.New[T](grpc.OverwriteDefaultConfig(grpcConfig)) storeServer := store.New[T]() - server := serverv2.NewServer(coretesting.NewNopLogger(), cometServer, grpcServer, storeServer) + server := serverv2.NewServer(log.NewNopLogger(), cometServer, grpcServer, storeServer) err = server.WriteConfig(filepath.Join(nodeDir, "config")) if err != nil { return err diff --git a/store/go.mod b/store/go.mod index 4b18cd027a0..a5c21ccbc97 100644 --- a/store/go.mod +++ b/store/go.mod @@ -3,8 +3,6 @@ module cosmossdk.io/store go 1.22.2 require ( - cosmossdk.io/core v0.12.0 - cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000 cosmossdk.io/errors v1.0.1 cosmossdk.io/log v1.3.1 cosmossdk.io/math v1.3.0 @@ -13,7 +11,7 @@ require ( github.com/cosmos/cosmos-db v1.0.2 github.com/cosmos/cosmos-proto v1.0.0-beta.5 github.com/cosmos/gogoproto v1.5.0 - github.com/cosmos/iavl v1.2.0 + github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 github.com/cosmos/ics23/go v0.10.0 github.com/golang/mock v1.6.0 github.com/hashicorp/go-hclog v1.6.3 @@ -28,12 +26,6 @@ require ( gotest.tools/v3 v3.5.1 ) -replace cosmossdk.io/core => ../core - -replace cosmossdk.io/core/testing => ../core/testing - -replace cosmossdk.io/log => ../log - require ( github.com/DataDog/zstd v1.5.5 // indirect github.com/beorn7/perks v1.0.1 // indirect diff --git a/store/go.sum b/store/go.sum index 6809e46163d..8f0c16d05b7 100644 --- a/store/go.sum +++ b/store/go.sum @@ -1,5 +1,7 @@ cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= +cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= @@ -43,8 +45,8 @@ github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+R github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= -github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= -github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= diff --git a/store/iavl/store.go b/store/iavl/store.go index 8e1905b7a38..198948b3009 100644 --- a/store/iavl/store.go +++ b/store/iavl/store.go @@ -10,7 +10,6 @@ import ( "github.com/cosmos/iavl" ics23 "github.com/cosmos/ics23/go" - "cosmossdk.io/core/log" errorsmod "cosmossdk.io/errors" "cosmossdk.io/store/cachekv" "cosmossdk.io/store/internal/kv" @@ -37,14 +36,14 @@ var ( // Store Implements types.KVStore and CommitKVStore. type Store struct { tree Tree - logger log.Logger + logger types.Logger metrics metrics.StoreMetrics } // LoadStore returns an IAVL Store as a CommitKVStore. Internally, it will load the // store's version (id) from the provided DB. An error is returned if the version // fails to load, or if called with a positive version on an empty tree. -func LoadStore(db dbm.DB, logger log.Logger, key types.StoreKey, id types.CommitID, cacheSize int, disableFastNode bool, metrics metrics.StoreMetrics) (types.CommitKVStore, error) { +func LoadStore(db dbm.DB, logger types.Logger, key types.StoreKey, id types.CommitID, cacheSize int, disableFastNode bool, metrics metrics.StoreMetrics) (types.CommitKVStore, error) { return LoadStoreWithInitialVersion(db, logger, key, id, 0, cacheSize, disableFastNode, metrics) } @@ -52,7 +51,7 @@ func LoadStore(db dbm.DB, logger log.Logger, key types.StoreKey, id types.Commit // to the one given. Internally, it will load the store's version (id) from the // provided DB. An error is returned if the version fails to load, or if called with a positive // version on an empty tree. -func LoadStoreWithInitialVersion(db dbm.DB, logger log.Logger, key types.StoreKey, id types.CommitID, initialVersion uint64, cacheSize int, disableFastNode bool, metrics metrics.StoreMetrics) (types.CommitKVStore, error) { +func LoadStoreWithInitialVersion(db dbm.DB, logger types.Logger, key types.StoreKey, id types.CommitID, initialVersion uint64, cacheSize int, disableFastNode bool, metrics metrics.StoreMetrics) (types.CommitKVStore, error) { tree := iavl.NewMutableTree(wrapper.NewDBWrapper(db), cacheSize, disableFastNode, logger, iavl.InitialVersionOption(initialVersion), iavl.AsyncPruningOption(true)) isUpgradeable, err := tree.IsUpgradeable() diff --git a/store/pruning/manager.go b/store/pruning/manager.go index 3656d07ed36..ddc9569ffe6 100644 --- a/store/pruning/manager.go +++ b/store/pruning/manager.go @@ -8,8 +8,8 @@ import ( dbm "github.com/cosmos/cosmos-db" - "cosmossdk.io/core/log" "cosmossdk.io/store/pruning/types" + storetypes "cosmossdk.io/store/types" ) // Manager is an abstraction to handle the logic needed for @@ -17,7 +17,7 @@ import ( // based on the strategy described by the pruning options. type Manager struct { db dbm.DB - logger log.Logger + logger storetypes.Logger opts types.PruningOptions snapshotInterval uint64 // Snapshots are taken in a separate goroutine from the regular execution @@ -46,7 +46,7 @@ var pruneSnapshotHeightsKey = []byte("s/prunesnapshotheights") // The returned manager uses a pruning strategy of "nothing" which // keeps all heights. Users of the Manager may change the strategy // by calling SetOptions. -func NewManager(db dbm.DB, logger log.Logger) *Manager { +func NewManager(db dbm.DB, logger storetypes.Logger) *Manager { return &Manager{ db: db, logger: logger, diff --git a/store/pruning/manager_test.go b/store/pruning/manager_test.go index fe4aae74cc4..006891de857 100644 --- a/store/pruning/manager_test.go +++ b/store/pruning/manager_test.go @@ -9,7 +9,7 @@ import ( "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" - coretesting "cosmossdk.io/core/testing" + "cosmossdk.io/log" "cosmossdk.io/store/mock" "cosmossdk.io/store/pruning" "cosmossdk.io/store/pruning/types" @@ -18,7 +18,7 @@ import ( const dbErr = "db error" func TestNewManager(t *testing.T) { - manager := pruning.NewManager(db.NewMemDB(), coretesting.NewNopLogger()) + manager := pruning.NewManager(db.NewMemDB(), log.NewNopLogger()) require.NotNil(t, manager) require.Equal(t, types.PruningNothing, manager.GetOptions().GetPruningStrategy()) } @@ -79,7 +79,7 @@ func TestStrategies(t *testing.T) { t.Run(name, func(t *testing.T) { t.Parallel() - manager := pruning.NewManager(db.NewMemDB(), coretesting.NewNopLogger()) + manager := pruning.NewManager(db.NewMemDB(), log.NewNopLogger()) require.NotNil(t, manager) curStrategy := tc.strategy @@ -186,7 +186,7 @@ func TestPruningHeight_Inputs(t *testing.T) { for name, tc := range testcases { t.Run(name, func(t *testing.T) { - manager := pruning.NewManager(db.NewMemDB(), coretesting.NewNopLogger()) + manager := pruning.NewManager(db.NewMemDB(), log.NewNopLogger()) require.NotNil(t, manager) manager.SetOptions(types.NewPruningOptions(tc.strategy)) @@ -204,7 +204,7 @@ func TestHandleSnapshotHeight_DbErr_Panic(t *testing.T) { dbMock.EXPECT().SetSync(gomock.Any(), gomock.Any()).Return(errors.New(dbErr)).Times(1) - manager := pruning.NewManager(dbMock, coretesting.NewNopLogger()) + manager := pruning.NewManager(dbMock, log.NewNopLogger()) manager.SetOptions(types.NewPruningOptions(types.PruningEverything)) require.NotNil(t, manager) @@ -222,7 +222,7 @@ func TestHandleSnapshotHeight_LoadFromDisk(t *testing.T) { // Setup db := db.NewMemDB() - manager := pruning.NewManager(db, coretesting.NewNopLogger()) + manager := pruning.NewManager(db, log.NewNopLogger()) require.NotNil(t, manager) manager.SetOptions(types.NewPruningOptions(types.PruningEverything)) @@ -253,7 +253,7 @@ func TestHandleSnapshotHeight_LoadFromDisk(t *testing.T) { func TestLoadPruningSnapshotHeights(t *testing.T) { var ( - manager = pruning.NewManager(db.NewMemDB(), coretesting.NewNopLogger()) + manager = pruning.NewManager(db.NewMemDB(), log.NewNopLogger()) err error ) require.NotNil(t, manager) @@ -294,7 +294,7 @@ func TestLoadPruningSnapshotHeights(t *testing.T) { } func TestLoadSnapshotHeights_PruneNothing(t *testing.T) { - manager := pruning.NewManager(db.NewMemDB(), coretesting.NewNopLogger()) + manager := pruning.NewManager(db.NewMemDB(), log.NewNopLogger()) require.NotNil(t, manager) manager.SetOptions(types.NewPruningOptions(types.PruningNothing)) diff --git a/store/rootmulti/proof_test.go b/store/rootmulti/proof_test.go index 2019f3eb467..d573937c3d0 100644 --- a/store/rootmulti/proof_test.go +++ b/store/rootmulti/proof_test.go @@ -6,7 +6,7 @@ import ( dbm "github.com/cosmos/cosmos-db" "github.com/stretchr/testify/require" - coretesting "cosmossdk.io/core/testing" + "cosmossdk.io/log" "cosmossdk.io/store/iavl" "cosmossdk.io/store/metrics" "cosmossdk.io/store/types" @@ -15,7 +15,7 @@ import ( func TestVerifyIAVLStoreQueryProof(t *testing.T) { // Create main tree for testing. db := dbm.NewMemDB() - iStore, err := iavl.LoadStore(db, coretesting.NewNopLogger(), types.NewKVStoreKey("test"), types.CommitID{}, iavl.DefaultIAVLCacheSize, false, metrics.NewNoOpMetrics()) + iStore, err := iavl.LoadStore(db, log.NewNopLogger(), types.NewKVStoreKey("test"), types.CommitID{}, iavl.DefaultIAVLCacheSize, false, metrics.NewNoOpMetrics()) store := iStore.(*iavl.Store) require.Nil(t, err) store.Set([]byte("MYKEY"), []byte("MYVALUE")) @@ -59,7 +59,7 @@ func TestVerifyIAVLStoreQueryProof(t *testing.T) { func TestVerifyMultiStoreQueryProof(t *testing.T) { // Create main tree for testing. db := dbm.NewMemDB() - store := NewStore(db, coretesting.NewNopLogger(), metrics.NewNoOpMetrics()) + store := NewStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics()) iavlStoreKey := types.NewKVStoreKey("iavlStoreKey") store.MountStoreWithDB(iavlStoreKey, types.StoreTypeIAVL, nil) @@ -115,7 +115,7 @@ func TestVerifyMultiStoreQueryProof(t *testing.T) { func TestVerifyMultiStoreQueryProofAbsence(t *testing.T) { // Create main tree for testing. db := dbm.NewMemDB() - store := NewStore(db, coretesting.NewNopLogger(), metrics.NewNoOpMetrics()) + store := NewStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics()) iavlStoreKey := types.NewKVStoreKey("iavlStoreKey") store.MountStoreWithDB(iavlStoreKey, types.StoreTypeIAVL, nil) diff --git a/store/rootmulti/snapshot_test.go b/store/rootmulti/snapshot_test.go index 9fded8482a6..635be92970a 100644 --- a/store/rootmulti/snapshot_test.go +++ b/store/rootmulti/snapshot_test.go @@ -14,7 +14,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - coretesting "cosmossdk.io/core/testing" + "cosmossdk.io/log" "cosmossdk.io/store/iavl" "cosmossdk.io/store/metrics" "cosmossdk.io/store/rootmulti" @@ -24,7 +24,7 @@ import ( ) func newMultiStoreWithGeneratedData(db dbm.DB, stores uint8, storeKeys uint64) *rootmulti.Store { - multiStore := rootmulti.NewStore(db, coretesting.NewNopLogger(), metrics.NewNoOpMetrics()) + multiStore := rootmulti.NewStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics()) r := rand.New(rand.NewSource(49872768940)) // Fixed seed for deterministic tests keys := []*types.KVStoreKey{} @@ -62,7 +62,7 @@ func newMultiStoreWithGeneratedData(db dbm.DB, stores uint8, storeKeys uint64) * } func newMultiStoreWithMixedMounts(db dbm.DB) *rootmulti.Store { - store := rootmulti.NewStore(db, coretesting.NewNopLogger(), metrics.NewNoOpMetrics()) + store := rootmulti.NewStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics()) store.MountStoreWithDB(types.NewKVStoreKey("iavl1"), types.StoreTypeIAVL, nil) store.MountStoreWithDB(types.NewKVStoreKey("iavl2"), types.StoreTypeIAVL, nil) store.MountStoreWithDB(types.NewKVStoreKey("iavl3"), types.StoreTypeIAVL, nil) @@ -245,7 +245,7 @@ func benchmarkMultistoreSnapshot(b *testing.B, stores uint8, storeKeys uint64) { b.StartTimer() for i := 0; i < b.N; i++ { - target := rootmulti.NewStore(dbm.NewMemDB(), coretesting.NewNopLogger(), metrics.NewNoOpMetrics()) + target := rootmulti.NewStore(dbm.NewMemDB(), log.NewNopLogger(), metrics.NewNoOpMetrics()) for _, key := range source.StoreKeysByName() { target.MountStoreWithDB(key, types.StoreTypeIAVL, nil) } @@ -281,7 +281,7 @@ func benchmarkMultistoreSnapshotRestore(b *testing.B, stores uint8, storeKeys ui b.StartTimer() for i := 0; i < b.N; i++ { - target := rootmulti.NewStore(dbm.NewMemDB(), coretesting.NewNopLogger(), metrics.NewNoOpMetrics()) + target := rootmulti.NewStore(dbm.NewMemDB(), log.NewNopLogger(), metrics.NewNoOpMetrics()) for _, key := range source.StoreKeysByName() { target.MountStoreWithDB(key, types.StoreTypeIAVL, nil) } diff --git a/store/rootmulti/store.go b/store/rootmulti/store.go index ab6402447f7..1226f63d1ac 100644 --- a/store/rootmulti/store.go +++ b/store/rootmulti/store.go @@ -16,7 +16,6 @@ import ( gogotypes "github.com/cosmos/gogoproto/types" iavltree "github.com/cosmos/iavl" - "cosmossdk.io/core/log" errorsmod "cosmossdk.io/errors" "cosmossdk.io/store/cachemulti" "cosmossdk.io/store/dbadapter" @@ -57,7 +56,7 @@ func keysFromStoreKeyMap[V any](m map[types.StoreKey]V) []types.StoreKey { // the CommitMultiStore interface. type Store struct { db dbm.DB - logger log.Logger + logger iavltree.Logger lastCommitInfo *types.CommitInfo pruningManager *pruning.Manager iavlCacheSize int @@ -85,7 +84,7 @@ var ( // store will be created with a PruneNothing pruning strategy by default. After // a store is created, KVStores must be mounted and finally LoadLatestVersion or // LoadVersion must be called. -func NewStore(db dbm.DB, logger log.Logger, metricGatherer metrics.StoreMetrics) *Store { +func NewStore(db dbm.DB, logger iavltree.Logger, metricGatherer metrics.StoreMetrics) *Store { return &Store{ db: db, logger: logger, diff --git a/store/rootmulti/store_test.go b/store/rootmulti/store_test.go index 39cbfaf801d..be23d3deda9 100644 --- a/store/rootmulti/store_test.go +++ b/store/rootmulti/store_test.go @@ -10,8 +10,8 @@ import ( dbm "github.com/cosmos/cosmos-db" "github.com/stretchr/testify/require" - coretesting "cosmossdk.io/core/testing" "cosmossdk.io/errors" + "cosmossdk.io/log" "cosmossdk.io/store/cachemulti" "cosmossdk.io/store/iavl" sdkmaps "cosmossdk.io/store/internal/maps" @@ -22,7 +22,7 @@ import ( func TestStoreType(t *testing.T) { db := dbm.NewMemDB() - store := NewStore(db, coretesting.NewNopLogger(), metrics.NewNoOpMetrics()) + store := NewStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics()) store.MountStoreWithDB(types.NewKVStoreKey("store1"), types.StoreTypeIAVL, db) } @@ -45,7 +45,7 @@ func TestGetCommitKVStore(t *testing.T) { func TestStoreMount(t *testing.T) { db := dbm.NewMemDB() - store := NewStore(db, coretesting.NewNopLogger(), metrics.NewNoOpMetrics()) + store := NewStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics()) key1 := types.NewKVStoreKey("store1") key2 := types.NewKVStoreKey("store2") @@ -652,7 +652,7 @@ func (p *pauseableCommitKVStoreStub) PausePruning(b bool) { } func TestPausePruningOnCommit(t *testing.T) { - store := NewStore(dbm.NewMemDB(), coretesting.NewNopLogger(), metrics.NewNoOpMetrics()) + store := NewStore(dbm.NewMemDB(), log.NewNopLogger(), metrics.NewNoOpMetrics()) store.SetPruning(pruningtypes.NewCustomPruningOptions(2, 11)) store.MountStoreWithDB(testStoreKey1, types.StoreTypeIAVL, nil) require.NoError(t, store.LoadLatestVersion()) @@ -833,7 +833,7 @@ var ( ) func newMultiStoreWithMounts(db dbm.DB, pruningOpts pruningtypes.PruningOptions) *Store { - store := NewStore(db, coretesting.NewNopLogger(), metrics.NewNoOpMetrics()) + store := NewStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics()) store.SetPruning(pruningOpts) store.MountStoreWithDB(testStoreKey1, types.StoreTypeIAVL, nil) @@ -844,7 +844,7 @@ func newMultiStoreWithMounts(db dbm.DB, pruningOpts pruningtypes.PruningOptions) } func newMultiStoreWithModifiedMounts(db dbm.DB, pruningOpts pruningtypes.PruningOptions) (*Store, *types.StoreUpgrades) { - store := NewStore(db, coretesting.NewNopLogger(), metrics.NewNoOpMetrics()) + store := NewStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics()) store.SetPruning(pruningOpts) store.MountStoreWithDB(types.NewKVStoreKey("store1"), types.StoreTypeIAVL, nil) @@ -970,7 +970,7 @@ func (stub *commitKVStoreStub) Commit() types.CommitID { func prepareStoreMap() (map[types.StoreKey]types.CommitKVStore, error) { var db dbm.DB = dbm.NewMemDB() - store := NewStore(db, coretesting.NewNopLogger(), metrics.NewNoOpMetrics()) + store := NewStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics()) store.MountStoreWithDB(types.NewKVStoreKey("iavl1"), types.StoreTypeIAVL, nil) store.MountStoreWithDB(types.NewKVStoreKey("iavl2"), types.StoreTypeIAVL, nil) store.MountStoreWithDB(types.NewTransientStoreKey("trans1"), types.StoreTypeTransient, nil) diff --git a/store/snapshots/helpers_test.go b/store/snapshots/helpers_test.go index d45d068f5c7..af623b0256a 100644 --- a/store/snapshots/helpers_test.go +++ b/store/snapshots/helpers_test.go @@ -15,8 +15,8 @@ import ( protoio "github.com/cosmos/gogoproto/io" "github.com/stretchr/testify/require" - coretesting "cosmossdk.io/core/testing" errorsmod "cosmossdk.io/errors" + "cosmossdk.io/log" "cosmossdk.io/store/snapshots" snapshottypes "cosmossdk.io/store/snapshots/types" "cosmossdk.io/store/types" @@ -211,7 +211,7 @@ func setupBusyManager(t *testing.T) *snapshots.Manager { require.NoError(t, err) hung := newHungSnapshotter() hung.SetSnapshotInterval(opts.Interval) - mgr := snapshots.NewManager(store, opts, hung, nil, coretesting.NewNopLogger()) + mgr := snapshots.NewManager(store, opts, hung, nil, log.NewNopLogger()) require.Equal(t, opts.Interval, hung.snapshotInterval) // Channel to ensure the test doesn't finish until the goroutine is done. diff --git a/store/snapshots/manager.go b/store/snapshots/manager.go index 6c7816705b8..4d75690c396 100644 --- a/store/snapshots/manager.go +++ b/store/snapshots/manager.go @@ -11,7 +11,6 @@ import ( "sort" "sync" - "cosmossdk.io/core/log" errorsmod "cosmossdk.io/errors" "cosmossdk.io/store/snapshots/types" storetypes "cosmossdk.io/store/types" @@ -37,7 +36,7 @@ type Manager struct { opts types.SnapshotOptions // multistore is the store from which snapshots are taken. multistore types.Snapshotter - logger log.Logger + logger storetypes.Logger mtx sync.Mutex operation operation @@ -71,7 +70,7 @@ const ( var ErrOptsZeroSnapshotInterval = errors.New("snaphot-interval must not be 0") // NewManager creates a new manager. -func NewManager(store *Store, opts types.SnapshotOptions, multistore types.Snapshotter, extensions map[string]types.ExtensionSnapshotter, logger log.Logger) *Manager { +func NewManager(store *Store, opts types.SnapshotOptions, multistore types.Snapshotter, extensions map[string]types.ExtensionSnapshotter, logger storetypes.Logger) *Manager { if extensions == nil { extensions = map[string]types.ExtensionSnapshotter{} } diff --git a/store/snapshots/manager_test.go b/store/snapshots/manager_test.go index b6ecdc26117..49f31e86272 100644 --- a/store/snapshots/manager_test.go +++ b/store/snapshots/manager_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - coretesting "cosmossdk.io/core/testing" + "cosmossdk.io/log" "cosmossdk.io/store/snapshots" "cosmossdk.io/store/snapshots/types" ) @@ -19,7 +19,7 @@ func TestManager_List(t *testing.T) { store := setupStore(t) snapshotter := &mockSnapshotter{} snapshotter.SetSnapshotInterval(opts.Interval) - manager := snapshots.NewManager(store, opts, snapshotter, nil, coretesting.NewNopLogger()) + manager := snapshots.NewManager(store, opts, snapshotter, nil, log.NewNopLogger()) require.Equal(t, opts.Interval, snapshotter.GetSnapshotInterval()) mgrList, err := manager.List() @@ -41,7 +41,7 @@ func TestManager_List(t *testing.T) { func TestManager_LoadChunk(t *testing.T) { store := setupStore(t) - manager := snapshots.NewManager(store, opts, &mockSnapshotter{}, nil, coretesting.NewNopLogger()) + manager := snapshots.NewManager(store, opts, &mockSnapshotter{}, nil, log.NewNopLogger()) // Existing chunk should return body chunk, err := manager.LoadChunk(2, 1, 1) @@ -74,7 +74,7 @@ func TestManager_Take(t *testing.T) { extSnapshotter := newExtSnapshotter(10) expectChunks := snapshotItems(items, extSnapshotter) - manager := snapshots.NewManager(store, opts, snapshotter, nil, coretesting.NewNopLogger()) + manager := snapshots.NewManager(store, opts, snapshotter, nil, log.NewNopLogger()) err := manager.RegisterExtensions(extSnapshotter) require.NoError(t, err) @@ -119,7 +119,7 @@ func TestManager_Prune(t *testing.T) { store := setupStore(t) snapshotter := &mockSnapshotter{} snapshotter.SetSnapshotInterval(opts.Interval) - manager := snapshots.NewManager(store, opts, snapshotter, nil, coretesting.NewNopLogger()) + manager := snapshots.NewManager(store, opts, snapshotter, nil, log.NewNopLogger()) pruned, err := manager.Prune(2) require.NoError(t, err) @@ -141,7 +141,7 @@ func TestManager_Restore(t *testing.T) { prunedHeights: make(map[int64]struct{}), } extSnapshotter := newExtSnapshotter(0) - manager := snapshots.NewManager(store, opts, target, nil, coretesting.NewNopLogger()) + manager := snapshots.NewManager(store, opts, target, nil, log.NewNopLogger()) err := manager.RegisterExtensions(extSnapshotter) require.NoError(t, err) @@ -251,7 +251,7 @@ func TestManager_TakeError(t *testing.T) { snapshotter := &mockErrorSnapshotter{} store, err := snapshots.NewStore(db.NewMemDB(), GetTempDir(t)) require.NoError(t, err) - manager := snapshots.NewManager(store, opts, snapshotter, nil, coretesting.NewNopLogger()) + manager := snapshots.NewManager(store, opts, snapshotter, nil, log.NewNopLogger()) _, err = manager.Create(1) require.Error(t, err) diff --git a/store/store.go b/store/store.go index 12297b8bfe8..e02ea24a66e 100644 --- a/store/store.go +++ b/store/store.go @@ -3,14 +3,13 @@ package store import ( dbm "github.com/cosmos/cosmos-db" - "cosmossdk.io/core/log" "cosmossdk.io/store/cache" "cosmossdk.io/store/metrics" "cosmossdk.io/store/rootmulti" "cosmossdk.io/store/types" ) -func NewCommitMultiStore(db dbm.DB, logger log.Logger, metricGatherer metrics.StoreMetrics) types.CommitMultiStore { +func NewCommitMultiStore(db dbm.DB, logger types.Logger, metricGatherer metrics.StoreMetrics) types.CommitMultiStore { return rootmulti.NewStore(db, logger, metricGatherer) } diff --git a/store/streaming/streaming_test.go b/store/streaming/streaming_test.go index 3cc55c28d05..75fcec937b5 100644 --- a/store/streaming/streaming_test.go +++ b/store/streaming/streaming_test.go @@ -15,8 +15,7 @@ import ( "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" - "cosmossdk.io/core/log" - coretesting "cosmossdk.io/core/testing" + "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" ) @@ -59,7 +58,7 @@ func (s *PluginTestSuite) SetupTest() { require.True(s.T(), ok, "should pass type check") header := cmtproto.Header{Height: 1, Time: time.Now()} - logger := coretesting.NewNopLogger() + logger := log.NewNopLogger() streamingService := storetypes.StreamingManager{ ABCIListeners: []storetypes.ABCIListener{abciListener}, StopNodeOnErr: true, diff --git a/store/types/context.go b/store/types/context.go index 26c49126765..999539e16cb 100644 --- a/store/types/context.go +++ b/store/types/context.go @@ -1,8 +1,6 @@ package types -import ( - "cosmossdk.io/core/log" -) +import "cosmossdk.io/log" // Context is an interface used by an App to pass context information // needed to process store streaming requests. diff --git a/store/types/iterator_test.go b/store/types/iterator_test.go index 46d5484e481..a804b092c8e 100644 --- a/store/types/iterator_test.go +++ b/store/types/iterator_test.go @@ -6,7 +6,7 @@ import ( dbm "github.com/cosmos/cosmos-db" "github.com/stretchr/testify/require" - coretesting "cosmossdk.io/core/testing" + "cosmossdk.io/log" "cosmossdk.io/store/iavl" "cosmossdk.io/store/metrics" "cosmossdk.io/store/types" @@ -15,7 +15,7 @@ import ( func newMemTestKVStore(t *testing.T) types.KVStore { t.Helper() db := dbm.NewMemDB() - store, err := iavl.LoadStore(db, coretesting.NewNopLogger(), types.NewKVStoreKey("test"), types.CommitID{}, iavl.DefaultIAVLCacheSize, false, metrics.NewNoOpMetrics()) + store, err := iavl.LoadStore(db, log.NewNopLogger(), types.NewKVStoreKey("test"), types.CommitID{}, iavl.DefaultIAVLCacheSize, false, metrics.NewNoOpMetrics()) require.NoError(t, err) return store } diff --git a/store/types/logger.go b/store/types/logger.go new file mode 100644 index 00000000000..abce36c86ad --- /dev/null +++ b/store/types/logger.go @@ -0,0 +1,21 @@ +package types + +// Logger defines basic logger that store expects. +// It is a subset of the cosmossdk.io/log.Logger interface. +type Logger interface { + // Info takes a message and a set of key/value pairs and logs with level INFO. + // The key of the tuple must be a string. + Info(msg string, keyVals ...any) + + // Warn takes a message and a set of key/value pairs and logs with level WARN. + // The key of the tuple must be a string. + Warn(msg string, keyVals ...any) + + // Error takes a message and a set of key/value pairs and logs with level ERR. + // The key of the tuple must be a string. + Error(msg string, keyVals ...any) + + // Debug takes a message and a set of key/value pairs and logs with level DEBUG. + // The key of the tuple must be a string. + Debug(msg string, keyVals ...any) +} diff --git a/store/v2/commitment/iavl/tree_test.go b/store/v2/commitment/iavl/tree_test.go index 279a185d11d..7435b4e58dd 100644 --- a/store/v2/commitment/iavl/tree_test.go +++ b/store/v2/commitment/iavl/tree_test.go @@ -7,7 +7,7 @@ import ( "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" - "cosmossdk.io/core/log" + corelog "cosmossdk.io/core/log" corestore "cosmossdk.io/core/store" coretesting "cosmossdk.io/core/testing" "cosmossdk.io/store/v2/commitment" @@ -16,7 +16,7 @@ import ( func TestCommitterSuite(t *testing.T) { s := &commitment.CommitStoreTestSuite{ - NewStore: func(db corestore.KVStoreWithBatch, storeKeys []string, logger log.Logger) (*commitment.CommitStore, error) { + NewStore: func(db corestore.KVStoreWithBatch, storeKeys []string, logger corelog.Logger) (*commitment.CommitStore, error) { multiTrees := make(map[string]commitment.Tree) cfg := DefaultConfig() for _, storeKey := range storeKeys { diff --git a/store/v2/commitment/store.go b/store/v2/commitment/store.go index 9d7be8a0062..c814dec70be 100644 --- a/store/v2/commitment/store.go +++ b/store/v2/commitment/store.go @@ -8,7 +8,7 @@ import ( protoio "github.com/cosmos/gogoproto/io" - "cosmossdk.io/core/log" + corelog "cosmossdk.io/core/log" corestore "cosmossdk.io/core/store" "cosmossdk.io/store/v2" "cosmossdk.io/store/v2/internal" @@ -30,13 +30,13 @@ var ( // RootStore use a CommitStore as an abstraction to handle multiple store keys // and trees. type CommitStore struct { - logger log.Logger + logger corelog.Logger metadata *MetadataStore multiTrees map[string]Tree } // NewCommitStore creates a new CommitStore instance. -func NewCommitStore(trees map[string]Tree, db corestore.KVStoreWithBatch, logger log.Logger) (*CommitStore, error) { +func NewCommitStore(trees map[string]Tree, db corestore.KVStoreWithBatch, logger corelog.Logger) (*CommitStore, error) { return &CommitStore{ logger: logger, multiTrees: trees, diff --git a/store/v2/commitment/store_test_suite.go b/store/v2/commitment/store_test_suite.go index 5c5c2d378a8..7e8c3587d34 100644 --- a/store/v2/commitment/store_test_suite.go +++ b/store/v2/commitment/store_test_suite.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/suite" - "cosmossdk.io/core/log" + corelog "cosmossdk.io/core/log" corestore "cosmossdk.io/core/store" coretesting "cosmossdk.io/core/testing" "cosmossdk.io/store/v2" @@ -26,7 +26,7 @@ const ( type CommitStoreTestSuite struct { suite.Suite - NewStore func(db corestore.KVStoreWithBatch, storeKeys []string, logger log.Logger) (*CommitStore, error) + NewStore func(db corestore.KVStoreWithBatch, storeKeys []string, logger corelog.Logger) (*CommitStore, error) } func (s *CommitStoreTestSuite) TestStore_Snapshotter() { diff --git a/store/v2/go.mod b/store/v2/go.mod index 6bfc165ca32..d74cfc5f94e 100644 --- a/store/v2/go.mod +++ b/store/v2/go.mod @@ -9,7 +9,7 @@ require ( cosmossdk.io/log v1.3.1 github.com/cockroachdb/pebble v1.1.0 github.com/cosmos/gogoproto v1.5.0 - github.com/cosmos/iavl v1.2.0 + github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 github.com/cosmos/ics23/go v0.10.0 github.com/google/btree v1.1.2 github.com/hashicorp/go-metrics v0.5.3 @@ -68,5 +68,3 @@ require ( replace cosmossdk.io/core => ../../core replace cosmossdk.io/core/testing => ../../core/testing - -replace cosmossdk.io/log => ../../log diff --git a/store/v2/go.sum b/store/v2/go.sum index ac521df7227..cdb23f864b9 100644 --- a/store/v2/go.sum +++ b/store/v2/go.sum @@ -1,5 +1,7 @@ cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= +cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= @@ -36,8 +38,8 @@ github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAK github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= -github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= -github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= diff --git a/store/v2/pruning/manager_test.go b/store/v2/pruning/manager_test.go index d75aea8e515..607af22bc72 100644 --- a/store/v2/pruning/manager_test.go +++ b/store/v2/pruning/manager_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/suite" corestore "cosmossdk.io/core/store" - "cosmossdk.io/log" + coretesting "cosmossdk.io/core/testing" "cosmossdk.io/store/v2" "cosmossdk.io/store/v2/commitment" "cosmossdk.io/store/v2/commitment/iavl" @@ -33,7 +33,7 @@ func TestPruningManagerTestSuite(t *testing.T) { } func (s *PruningManagerTestSuite) SetupTest() { - nopLog := log.NewNopLogger() + nopLog := coretesting.NewNopLogger() var err error mdb := dbm.NewMemDB() diff --git a/store/v2/root/store.go b/store/v2/root/store.go index c9c480557f4..56f722282f4 100644 --- a/store/v2/root/store.go +++ b/store/v2/root/store.go @@ -11,7 +11,7 @@ import ( "golang.org/x/sync/errgroup" coreheader "cosmossdk.io/core/header" - "cosmossdk.io/core/log" + corelog "cosmossdk.io/core/log" corestore "cosmossdk.io/core/store" "cosmossdk.io/store/v2" "cosmossdk.io/store/v2/metrics" @@ -27,7 +27,7 @@ var _ store.RootStore = (*Store)(nil) // backend may or may not support multiple store keys and is implementation // dependent. type Store struct { - logger log.Logger + logger corelog.Logger initialVersion uint64 // stateStorage reflects the state storage backend @@ -65,7 +65,7 @@ type Store struct { // // NOTE: The migration manager is optional and can be nil if no migration is required. func New( - logger log.Logger, + logger corelog.Logger, ss store.VersionedDatabase, sc store.Committer, pm *pruning.Manager, @@ -73,7 +73,7 @@ func New( m metrics.StoreMetrics, ) (store.RootStore, error) { return &Store{ - logger: logger.With("module", "root_store"), + logger: logger, initialVersion: 1, stateStorage: ss, stateCommitment: sc, diff --git a/store/v2/snapshots/manager.go b/store/v2/snapshots/manager.go index 75e6e4ad616..3bee0a5832b 100644 --- a/store/v2/snapshots/manager.go +++ b/store/v2/snapshots/manager.go @@ -11,7 +11,7 @@ import ( "sort" "sync" - "cosmossdk.io/core/log" + corelog "cosmossdk.io/core/log" corestore "cosmossdk.io/core/store" errorsmod "cosmossdk.io/errors" storeerrors "cosmossdk.io/store/v2/errors" @@ -41,7 +41,7 @@ type Manager struct { // storageSnapshotter is the snapshotter for the storage state. storageSnapshotter StorageSnapshotter - logger log.Logger + logger corelog.Logger mtx sync.Mutex operation operation @@ -76,7 +76,7 @@ const ( var ErrOptsZeroSnapshotInterval = errors.New("snapshot-interval must not be 0") // NewManager creates a new manager. -func NewManager(store *Store, opts SnapshotOptions, commitSnapshotter CommitSnapshotter, storageSnapshotter StorageSnapshotter, extensions map[string]ExtensionSnapshotter, logger log.Logger) *Manager { +func NewManager(store *Store, opts SnapshotOptions, commitSnapshotter CommitSnapshotter, storageSnapshotter StorageSnapshotter, extensions map[string]ExtensionSnapshotter, logger corelog.Logger) *Manager { if extensions == nil { extensions = map[string]ExtensionSnapshotter{} } @@ -86,7 +86,7 @@ func NewManager(store *Store, opts SnapshotOptions, commitSnapshotter CommitSnap commitSnapshotter: commitSnapshotter, storageSnapshotter: storageSnapshotter, extensions: extensions, - logger: logger.With("module", "snapshot_manager"), + logger: logger, } } diff --git a/store/v2/snapshots/manager_test.go b/store/v2/snapshots/manager_test.go index 2be8d407875..4fd33e1b36f 100644 --- a/store/v2/snapshots/manager_test.go +++ b/store/v2/snapshots/manager_test.go @@ -8,7 +8,6 @@ import ( "github.com/stretchr/testify/require" coretesting "cosmossdk.io/core/testing" - "cosmossdk.io/log" "cosmossdk.io/store/v2/snapshots" "cosmossdk.io/store/v2/snapshots/types" ) @@ -355,7 +354,7 @@ func TestSnapshot_Take_Prune(t *testing.T) { extSnapshotter := newExtSnapshotter(10) expectChunks := snapshotItems(items, extSnapshotter) - manager := snapshots.NewManager(store, opts, commitSnapshotter, &mockStorageSnapshotter{}, nil, log.NewNopLogger()) + manager := snapshots.NewManager(store, opts, commitSnapshotter, &mockStorageSnapshotter{}, nil, coretesting.NewNopLogger()) err := manager.RegisterExtensions(extSnapshotter) require.NoError(t, err) diff --git a/tests/go.mod b/tests/go.mod index ce552b6aa69..1dd30f25688 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -94,7 +94,7 @@ require ( github.com/cosmos/crypto v0.1.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/iavl v1.2.0 // indirect + github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.1 // indirect @@ -241,7 +241,6 @@ replace ( cosmossdk.io/collections => ../collections cosmossdk.io/core => ../core cosmossdk.io/core/testing => ../core/testing - cosmossdk.io/log => ../log cosmossdk.io/store => ../store cosmossdk.io/x/accounts => ../x/accounts cosmossdk.io/x/accounts/defaults/lockup => ../x/accounts/defaults/lockup diff --git a/tests/go.sum b/tests/go.sum index 5c9a5948ff5..581fde54450 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -196,6 +196,8 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= +cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= @@ -317,8 +319,8 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= -github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= -github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo= diff --git a/tests/integration/store/rootmulti/rollback_test.go b/tests/integration/store/rootmulti/rollback_test.go index c06dadcf82f..22a6dce5684 100644 --- a/tests/integration/store/rootmulti/rollback_test.go +++ b/tests/integration/store/rootmulti/rollback_test.go @@ -9,7 +9,7 @@ import ( dbm "github.com/cosmos/cosmos-db" "gotest.tools/v3/assert" - coretesting "cosmossdk.io/core/testing" + "cosmossdk.io/log" "cosmossdk.io/simapp" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" @@ -18,7 +18,7 @@ import ( func TestRollback(t *testing.T) { db := dbm.NewMemDB() options := simapp.SetupOptions{ - Logger: coretesting.NewNopLogger(), + Logger: log.NewNopLogger(), DB: db, AppOpts: simtestutil.NewAppOptionsWithFlagHome(t.TempDir()), } diff --git a/testutil/context.go b/testutil/context.go index 105638ab191..12c36f11307 100644 --- a/testutil/context.go +++ b/testutil/context.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/assert" "cosmossdk.io/core/header" - coretesting "cosmossdk.io/core/testing" + "cosmossdk.io/log" "cosmossdk.io/store" "cosmossdk.io/store/metrics" storetypes "cosmossdk.io/store/types" @@ -19,14 +19,14 @@ import ( // DefaultContext creates a sdk.Context with a fresh MemDB that can be used in tests. func DefaultContext(key, tkey storetypes.StoreKey) sdk.Context { db := dbm.NewMemDB() - cms := store.NewCommitMultiStore(db, coretesting.NewNopLogger(), metrics.NewNoOpMetrics()) + cms := store.NewCommitMultiStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics()) cms.MountStoreWithDB(key, storetypes.StoreTypeIAVL, db) cms.MountStoreWithDB(tkey, storetypes.StoreTypeTransient, db) err := cms.LoadLatestVersion() if err != nil { panic(err) } - ctx := sdk.NewContext(cms, false, coretesting.NewNopLogger()) + ctx := sdk.NewContext(cms, false, log.NewNopLogger()) return ctx } @@ -39,7 +39,7 @@ func DefaultContextWithKeys( memKeys map[string]*storetypes.MemoryStoreKey, ) sdk.Context { db := dbm.NewMemDB() - cms := store.NewCommitMultiStore(db, coretesting.NewNopLogger(), metrics.NewNoOpMetrics()) + cms := store.NewCommitMultiStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics()) for _, key := range keys { cms.MountStoreWithDB(key, storetypes.StoreTypeIAVL, db) @@ -58,7 +58,7 @@ func DefaultContextWithKeys( panic(err) } - return sdk.NewContext(cms, false, coretesting.NewNopLogger()) + return sdk.NewContext(cms, false, log.NewNopLogger()) } type TestContext struct { @@ -70,13 +70,13 @@ type TestContext struct { func DefaultContextWithDB(tb testing.TB, key, tkey storetypes.StoreKey) TestContext { tb.Helper() db := dbm.NewMemDB() - cms := store.NewCommitMultiStore(db, coretesting.NewNopLogger(), metrics.NewNoOpMetrics()) + cms := store.NewCommitMultiStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics()) cms.MountStoreWithDB(key, storetypes.StoreTypeIAVL, db) cms.MountStoreWithDB(tkey, storetypes.StoreTypeTransient, db) err := cms.LoadLatestVersion() assert.NoError(tb, err) - ctx := sdk.NewContext(cms, false, coretesting.NewNopLogger()).WithHeaderInfo(header.Info{Time: time.Now()}) + ctx := sdk.NewContext(cms, false, log.NewNopLogger()).WithHeaderInfo(header.Info{Time: time.Now()}) return TestContext{ctx, db, cms} } diff --git a/testutil/mock/logger.go b/testutil/mock/logger.go index 1a8080da357..800210aa241 100644 --- a/testutil/mock/logger.go +++ b/testutil/mock/logger.go @@ -7,7 +7,7 @@ package mock import ( reflect "reflect" - log "cosmossdk.io/core/log" + log "cosmossdk.io/log" gomock "github.com/golang/mock/gomock" ) diff --git a/testutils/sims/runner.go b/testutils/sims/runner.go index 0518b1b34a8..34acc544bdc 100644 --- a/testutils/sims/runner.go +++ b/testutils/sims/runner.go @@ -9,8 +9,7 @@ import ( dbm "github.com/cosmos/cosmos-db" "github.com/stretchr/testify/require" - "cosmossdk.io/core/log" - tlog "cosmossdk.io/log" + "cosmossdk.io/log" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" @@ -109,9 +108,9 @@ func RunWithSeeds[T SimulationApp]( testInstance := NewSimulationAppInstance(t, tCfg, appFactory) var runLogger log.Logger if cli.FlagVerboseValue { - runLogger = tlog.NewTestLogger(t) + runLogger = log.NewTestLogger(t) } else { - runLogger = tlog.NewTestLoggerInfo(t) + runLogger = log.NewTestLoggerInfo(t) } runLogger = runLogger.With("seed", tCfg.Seed) @@ -176,9 +175,9 @@ func NewSimulationAppInstance[T SimulationApp]( dbDir := filepath.Join(workDir, "leveldb-app-sim") var logger log.Logger if cli.FlagVerboseValue { - logger = tlog.NewTestLogger(t) + logger = log.NewTestLogger(t) } else { - logger = tlog.NewTestLoggerError(t) + logger = log.NewTestLoggerError(t) } logger = logger.With("seed", tCfg.Seed) diff --git a/types/context.go b/types/context.go index 72a94484743..04b74c19d8c 100644 --- a/types/context.go +++ b/types/context.go @@ -9,7 +9,7 @@ import ( "cosmossdk.io/core/comet" "cosmossdk.io/core/header" - "cosmossdk.io/core/log" + "cosmossdk.io/log" "cosmossdk.io/store/gaskv" storetypes "cosmossdk.io/store/types" ) diff --git a/types/mempool/mempool_test.go b/types/mempool/mempool_test.go index 01c1fdd9002..5c3215857c6 100644 --- a/types/mempool/mempool_test.go +++ b/types/mempool/mempool_test.go @@ -12,8 +12,8 @@ import ( _ "cosmossdk.io/api/cosmos/counter/v1" _ "cosmossdk.io/api/cosmos/crypto/secp256k1" - coretesting "cosmossdk.io/core/testing" "cosmossdk.io/core/transaction" + "cosmossdk.io/log" "cosmossdk.io/x/auth/signing" codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" @@ -175,7 +175,7 @@ func fetchTxs(iterator mempool.Iterator, maxBytes int64) []sdk.Tx { func (s *MempoolTestSuite) TestDefaultMempool() { t := s.T() - ctx := sdk.NewContext(nil, false, coretesting.NewNopLogger()) + ctx := sdk.NewContext(nil, false, log.NewNopLogger()) accounts := simtypes.RandomAccounts(rand.New(rand.NewSource(0)), 10) txCount := 1000 var txs []testTx @@ -267,7 +267,7 @@ func TestMempoolTestSuite(t *testing.T) { } func (s *MempoolTestSuite) TestSampleTxs() { - ctxt := sdk.NewContext(nil, false, coretesting.NewNopLogger()) + ctxt := sdk.NewContext(nil, false, log.NewNopLogger()) t := s.T() s.resetMempool() mp := s.mempool diff --git a/types/mempool/priority_nonce_test.go b/types/mempool/priority_nonce_test.go index 3357c2684fd..0a2f40355fb 100644 --- a/types/mempool/priority_nonce_test.go +++ b/types/mempool/priority_nonce_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/require" - coretesting "cosmossdk.io/core/testing" + "cosmossdk.io/log" "cosmossdk.io/x/auth/signing" sdk "github.com/cosmos/cosmos-sdk/types" @@ -83,7 +83,7 @@ func (a signerExtractionAdapter) GetSigners(tx sdk.Tx) ([]mempool.SignerData, er func (s *MempoolTestSuite) TestPriorityNonceTxOrderWithAdapter() { t := s.T() - ctx := sdk.NewContext(nil, false, coretesting.NewNopLogger()) + ctx := sdk.NewContext(nil, false, log.NewNopLogger()) accounts := simtypes.RandomAccounts(rand.New(rand.NewSource(0)), 5) sa := accounts[0].Address sb := accounts[1].Address @@ -142,7 +142,7 @@ func (s *MempoolTestSuite) TestPriorityNonceTxOrderWithAdapter() { func (s *MempoolTestSuite) TestPriorityNonceTxOrder() { t := s.T() - ctx := sdk.NewContext(nil, false, coretesting.NewNopLogger()) + ctx := sdk.NewContext(nil, false, log.NewNopLogger()) accounts := simtypes.RandomAccounts(rand.New(rand.NewSource(0)), 5) sa := accounts[0].Address sb := accounts[1].Address @@ -341,7 +341,7 @@ func (s *MempoolTestSuite) TestPriorityNonceTxOrder() { func (s *MempoolTestSuite) TestIterator() { t := s.T() - ctx := sdk.NewContext(nil, false, coretesting.NewNopLogger()) + ctx := sdk.NewContext(nil, false, log.NewNopLogger()) accounts := simtypes.RandomAccounts(rand.New(rand.NewSource(0)), 2) sa := accounts[0].Address sb := accounts[1].Address @@ -396,7 +396,7 @@ func (s *MempoolTestSuite) TestIterator() { } func (s *MempoolTestSuite) TestPriorityTies() { - ctx := sdk.NewContext(nil, false, coretesting.NewNopLogger()) + ctx := sdk.NewContext(nil, false, log.NewNopLogger()) accounts := simtypes.RandomAccounts(rand.New(rand.NewSource(0)), 3) sa := accounts[0].Address sb := accounts[1].Address @@ -520,7 +520,7 @@ func (s *MempoolTestSuite) TestRandomGeneratedTxs() { ) t := s.T() - ctx := sdk.NewContext(nil, false, coretesting.NewNopLogger()) + ctx := sdk.NewContext(nil, false, log.NewNopLogger()) seed := time.Now().UnixNano() t.Logf("running with seed: %d", seed) @@ -556,7 +556,7 @@ func (s *MempoolTestSuite) TestRandomWalkTxs() { s.mempool = mempool.DefaultPriorityMempool() t := s.T() - ctx := sdk.NewContext(nil, false, coretesting.NewNopLogger()) + ctx := sdk.NewContext(nil, false, log.NewNopLogger()) seed := time.Now().UnixNano() // interesting failing seeds: @@ -729,7 +729,7 @@ func TestTxOrderN(t *testing.T) { func TestPriorityNonceMempool_NextSenderTx(t *testing.T) { accounts := simtypes.RandomAccounts(rand.New(rand.NewSource(0)), 2) - ctx := sdk.NewContext(nil, false, coretesting.NewNopLogger()) + ctx := sdk.NewContext(nil, false, log.NewNopLogger()) accA := accounts[0].Address accB := accounts[1].Address @@ -759,7 +759,7 @@ func TestPriorityNonceMempool_NextSenderTx(t *testing.T) { func TestNextSenderTx_TxLimit(t *testing.T) { accounts := simtypes.RandomAccounts(rand.New(rand.NewSource(0)), 2) - ctx := sdk.NewContext(nil, false, coretesting.NewNopLogger()) + ctx := sdk.NewContext(nil, false, log.NewNopLogger()) sa := accounts[0].Address sb := accounts[1].Address @@ -835,7 +835,7 @@ func TestNextSenderTx_TxLimit(t *testing.T) { func TestNextSenderTx_TxReplacement(t *testing.T) { accounts := simtypes.RandomAccounts(rand.New(rand.NewSource(0)), 1) - ctx := sdk.NewContext(nil, false, coretesting.NewNopLogger()) + ctx := sdk.NewContext(nil, false, log.NewNopLogger()) sa := accounts[0].Address txs := []testTx{ diff --git a/types/mempool/sender_nonce_property_test.go b/types/mempool/sender_nonce_property_test.go index b4eb36f7581..5ebda7d6f93 100644 --- a/types/mempool/sender_nonce_property_test.go +++ b/types/mempool/sender_nonce_property_test.go @@ -6,7 +6,7 @@ import ( "github.com/stretchr/testify/require" "pgregory.net/rapid" - coretesting "cosmossdk.io/core/testing" + "cosmossdk.io/log" "cosmossdk.io/x/auth/signing" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" @@ -33,7 +33,7 @@ func AddressGenerator(t *rapid.T) *rapid.Generator[sdk.AccAddress] { } func testMempoolProperties(t *rapid.T) { - ctx := sdk.NewContext(nil, false, coretesting.NewNopLogger()) + ctx := sdk.NewContext(nil, false, log.NewNopLogger()) mp := mempool.NewSenderNonceMempool() genMultipleAddress := rapid.SliceOfNDistinct(AddressGenerator(t), 1, 10, func(acc sdk.AccAddress) string { diff --git a/types/mempool/sender_nonce_test.go b/types/mempool/sender_nonce_test.go index 8b56a8a0299..d4e4fe565ee 100644 --- a/types/mempool/sender_nonce_test.go +++ b/types/mempool/sender_nonce_test.go @@ -7,7 +7,7 @@ import ( "github.com/stretchr/testify/require" - coretesting "cosmossdk.io/core/testing" + "cosmossdk.io/log" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/mempool" @@ -16,7 +16,7 @@ import ( func (s *MempoolTestSuite) TestTxOrder() { t := s.T() - ctx := sdk.NewContext(nil, false, coretesting.NewNopLogger()) + ctx := sdk.NewContext(nil, false, log.NewNopLogger()) accounts := simtypes.RandomAccounts(rand.New(rand.NewSource(0)), 5) sa := accounts[0].Address sb := accounts[1].Address @@ -140,7 +140,7 @@ func (s *MempoolTestSuite) TestTxOrder() { func (s *MempoolTestSuite) TestMaxTx() { t := s.T() - ctx := sdk.NewContext(nil, false, coretesting.NewNopLogger()) + ctx := sdk.NewContext(nil, false, log.NewNopLogger()) accounts := simtypes.RandomAccounts(rand.New(rand.NewSource(0)), 1) mp := mempool.NewSenderNonceMempool(mempool.SenderNonceMaxTxOpt(1)) @@ -170,7 +170,7 @@ func (s *MempoolTestSuite) TestMaxTx() { func (s *MempoolTestSuite) TestTxNotFoundOnSender() { t := s.T() - ctx := sdk.NewContext(nil, false, coretesting.NewNopLogger()) + ctx := sdk.NewContext(nil, false, log.NewNopLogger()) accounts := simtypes.RandomAccounts(rand.New(rand.NewSource(0)), 1) mp := mempool.NewSenderNonceMempool(mempool.SenderNonceMaxTxOpt(5000)) diff --git a/types/module/module_test.go b/types/module/module_test.go index 7d1ecfee0ba..ad8ff817846 100644 --- a/types/module/module_test.go +++ b/types/module/module_test.go @@ -14,7 +14,7 @@ import ( "google.golang.org/grpc" "cosmossdk.io/core/appmodule" - coretesting "cosmossdk.io/core/testing" + "cosmossdk.io/log" authtypes "cosmossdk.io/x/auth/types" "github.com/cosmos/cosmos-sdk/codec" @@ -171,7 +171,7 @@ func TestManager_InitGenesis(t *testing.T) { require.NotNil(t, mm) require.Equal(t, 3, len(mm.Modules)) - ctx := sdk.NewContext(nil, false, coretesting.NewNopLogger()) + ctx := sdk.NewContext(nil, false, log.NewNopLogger()) genesisData := map[string]json.RawMessage{"module1": json.RawMessage(`{"key": "value"}`)} // this should error since the validator set is empty even after init genesis @@ -220,7 +220,7 @@ func TestManager_ExportGenesis(t *testing.T) { require.NotNil(t, mm) require.Equal(t, 3, len(mm.Modules)) - ctx := sdk.NewContext(nil, false, coretesting.NewNopLogger()) + ctx := sdk.NewContext(nil, false, log.NewNopLogger()) mockAppModule1.EXPECT().ExportGenesis(gomock.Eq(ctx)).AnyTimes().Return(json.RawMessage(`{"key1": "value1"}`), nil) mockAppModule2.EXPECT().ExportGenesis(gomock.Eq(ctx)).AnyTimes().Return(json.RawMessage(`{"key2": "value2"}`), nil) @@ -304,7 +304,7 @@ func TestCoreAPIManager_InitGenesis(t *testing.T) { require.NotNil(t, mm) require.Equal(t, 1, len(mm.Modules)) - ctx := sdk.NewContext(nil, false, coretesting.NewNopLogger()) + ctx := sdk.NewContext(nil, false, log.NewNopLogger()) genesisData := map[string]json.RawMessage{"module1": json.RawMessage(`{"key": "value"}`)} // this should panic since the validator set is empty even after init genesis @@ -326,7 +326,7 @@ func TestCoreAPIManager_ExportGenesis(t *testing.T) { require.NotNil(t, mm) require.Equal(t, 2, len(mm.Modules)) - ctx := sdk.NewContext(nil, false, coretesting.NewNopLogger()) + ctx := sdk.NewContext(nil, false, log.NewNopLogger()) want := map[string]json.RawMessage{ "module1": json.RawMessage(`{ "someField": "someKey" diff --git a/x/accounts/defaults/lockup/go.mod b/x/accounts/defaults/lockup/go.mod index b5a31476bd5..35267bb203e 100644 --- a/x/accounts/defaults/lockup/go.mod +++ b/x/accounts/defaults/lockup/go.mod @@ -57,7 +57,7 @@ require ( github.com/cosmos/cosmos-db v1.0.2 // indirect github.com/cosmos/cosmos-proto v1.0.0-beta.5 github.com/cosmos/go-bip39 v1.0.0 // indirect - github.com/cosmos/iavl v1.2.0 // indirect + github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.1 // indirect @@ -158,7 +158,6 @@ replace ( cosmossdk.io/collections => ../../../../collections // TODO tag new collections ASAP cosmossdk.io/core => ../../../../core cosmossdk.io/core/testing => ../../../../core/testing - cosmossdk.io/log => ../../../../log cosmossdk.io/x/accounts => ../../. cosmossdk.io/x/auth => ../../../auth cosmossdk.io/x/bank => ../../../bank diff --git a/x/accounts/defaults/lockup/go.sum b/x/accounts/defaults/lockup/go.sum index 0e5cfe5cf50..50f921c26d8 100644 --- a/x/accounts/defaults/lockup/go.sum +++ b/x/accounts/defaults/lockup/go.sum @@ -8,6 +8,8 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= +cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= @@ -93,8 +95,8 @@ github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiK github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ4GUkT+tbFI= github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= -github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= -github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= diff --git a/x/accounts/defaults/multisig/go.mod b/x/accounts/defaults/multisig/go.mod index 4d2f36bbf0b..482921159b7 100644 --- a/x/accounts/defaults/multisig/go.mod +++ b/x/accounts/defaults/multisig/go.mod @@ -52,7 +52,7 @@ require ( github.com/cosmos/crypto v0.1.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/iavl v1.2.0 // indirect + github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.1 // indirect @@ -177,7 +177,6 @@ replace ( cosmossdk.io/collections => ../../../../collections // TODO tag new collections ASAP cosmossdk.io/core => ../../../../core cosmossdk.io/core/testing => ../../../../core/testing - cosmossdk.io/log => ../../../../log cosmossdk.io/x/accounts => ../../. cosmossdk.io/x/auth => ../../../auth cosmossdk.io/x/bank => ../../../bank diff --git a/x/accounts/defaults/multisig/go.sum b/x/accounts/defaults/multisig/go.sum index 1516cc35ec1..b56674a06af 100644 --- a/x/accounts/defaults/multisig/go.sum +++ b/x/accounts/defaults/multisig/go.sum @@ -8,6 +8,8 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= +cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= @@ -111,8 +113,8 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= -github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= -github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= diff --git a/x/accounts/go.mod b/x/accounts/go.mod index 6a31a443a56..a91192d1984 100644 --- a/x/accounts/go.mod +++ b/x/accounts/go.mod @@ -62,7 +62,7 @@ require ( github.com/cosmos/crypto v0.1.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/iavl v1.2.0 // indirect + github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.1 // indirect @@ -184,7 +184,6 @@ replace ( cosmossdk.io/collections => ../../collections cosmossdk.io/core => ../../core cosmossdk.io/core/testing => ../../core/testing - cosmossdk.io/log => ../../log cosmossdk.io/x/accounts/defaults/multisig => ./defaults/multisig cosmossdk.io/x/auth => ../auth cosmossdk.io/x/bank => ../bank diff --git a/x/accounts/go.sum b/x/accounts/go.sum index 35a06991392..e4d12d7e10b 100644 --- a/x/accounts/go.sum +++ b/x/accounts/go.sum @@ -8,6 +8,8 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= +cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= @@ -113,8 +115,8 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= -github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= -github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= diff --git a/x/auth/go.mod b/x/auth/go.mod index fc2484be29d..bcfb743e0ec 100644 --- a/x/auth/go.mod +++ b/x/auth/go.mod @@ -62,7 +62,7 @@ require ( github.com/cosmos/crypto v0.1.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/iavl v1.2.0 // indirect + github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.1 // indirect @@ -177,7 +177,6 @@ replace ( cosmossdk.io/collections => ../../collections cosmossdk.io/core => ../../core cosmossdk.io/core/testing => ../../core/testing - cosmossdk.io/log => ../../log cosmossdk.io/x/accounts => ../accounts cosmossdk.io/x/bank => ../bank cosmossdk.io/x/consensus => ../consensus diff --git a/x/auth/go.sum b/x/auth/go.sum index 4879cfa3455..4e269960625 100644 --- a/x/auth/go.sum +++ b/x/auth/go.sum @@ -8,6 +8,8 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= +cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= @@ -111,8 +113,8 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= -github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= -github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= diff --git a/x/authz/go.mod b/x/authz/go.mod index 0d3fa3c1bce..648be6a3102 100644 --- a/x/authz/go.mod +++ b/x/authz/go.mod @@ -30,6 +30,7 @@ require ( require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect cosmossdk.io/collections v0.4.0 // indirect + cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000 cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 cosmossdk.io/x/consensus v0.0.0-00010101000000-000000000000 // indirect filippo.io/edwards25519 v1.1.0 // indirect @@ -53,7 +54,7 @@ require ( github.com/cosmos/crypto v0.1.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/iavl v1.2.0 // indirect + github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.1 // indirect @@ -165,11 +166,10 @@ require ( sigs.k8s.io/yaml v1.4.0 // indirect ) -require cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000 +require cosmossdk.io/log v1.3.1 require ( buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect - cosmossdk.io/log v1.3.1 // indirect cosmossdk.io/schema v0.1.1 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect ) @@ -182,7 +182,6 @@ replace ( cosmossdk.io/collections => ../../collections cosmossdk.io/core => ../../core cosmossdk.io/core/testing => ../../core/testing - cosmossdk.io/log => ../../log cosmossdk.io/store => ../../store cosmossdk.io/x/accounts => ../accounts cosmossdk.io/x/auth => ../auth diff --git a/x/authz/go.sum b/x/authz/go.sum index c89bb859d75..8d4b41eff91 100644 --- a/x/authz/go.sum +++ b/x/authz/go.sum @@ -8,6 +8,8 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= +cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= @@ -109,8 +111,8 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= -github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= -github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= diff --git a/x/authz/keeper/genesis_test.go b/x/authz/keeper/genesis_test.go index 20a4c0acb16..6cc9db97202 100644 --- a/x/authz/keeper/genesis_test.go +++ b/x/authz/keeper/genesis_test.go @@ -9,6 +9,7 @@ import ( "cosmossdk.io/core/header" coretesting "cosmossdk.io/core/testing" + "cosmossdk.io/log" sdkmath "cosmossdk.io/math" storetypes "cosmossdk.io/store/types" "cosmossdk.io/x/authz/keeper" @@ -58,7 +59,7 @@ func (suite *GenesisTestSuite) SetupTest() { suite.baseApp = baseapp.NewBaseApp( "authz", - coretesting.NewNopLogger(), + log.NewNopLogger(), testCtx.DB, suite.encCfg.TxConfig.TxDecoder(), ) diff --git a/x/authz/keeper/keeper_test.go b/x/authz/keeper/keeper_test.go index ac8cda6adb6..72bd049b1c7 100644 --- a/x/authz/keeper/keeper_test.go +++ b/x/authz/keeper/keeper_test.go @@ -9,6 +9,7 @@ import ( "cosmossdk.io/core/header" coretesting "cosmossdk.io/core/testing" + "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" "cosmossdk.io/x/authz" authzkeeper "cosmossdk.io/x/authz/keeper" @@ -56,7 +57,7 @@ func (s *TestSuite) SetupTest() { s.baseApp = baseapp.NewBaseApp( "authz", - coretesting.NewNopLogger(), + log.NewNopLogger(), testCtx.DB, s.encCfg.TxConfig.TxDecoder(), ) diff --git a/x/authz/module/abci_test.go b/x/authz/module/abci_test.go index b2c8dbb9f5a..00fda78e2a5 100644 --- a/x/authz/module/abci_test.go +++ b/x/authz/module/abci_test.go @@ -9,6 +9,7 @@ import ( "cosmossdk.io/core/header" coretesting "cosmossdk.io/core/testing" + "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/authz" @@ -36,7 +37,7 @@ func TestExpiredGrantsQueue(t *testing.T) { baseApp := baseapp.NewBaseApp( "authz", - coretesting.NewNopLogger(), + log.NewNopLogger(), testCtx.DB, encCfg.TxConfig.TxDecoder(), ) diff --git a/x/bank/go.mod b/x/bank/go.mod index 4346329fe3a..ff9bb6ebbcb 100644 --- a/x/bank/go.mod +++ b/x/bank/go.mod @@ -55,7 +55,7 @@ require ( github.com/cosmos/crypto v0.1.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/iavl v1.2.0 // indirect + github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.1 // indirect @@ -181,7 +181,6 @@ replace ( cosmossdk.io/collections => ../../collections cosmossdk.io/core => ../../core cosmossdk.io/core/testing => ../../core/testing - cosmossdk.io/log => ../../log cosmossdk.io/x/accounts => ../accounts cosmossdk.io/x/auth => ../auth cosmossdk.io/x/consensus => ../consensus diff --git a/x/bank/go.sum b/x/bank/go.sum index 4879cfa3455..4e269960625 100644 --- a/x/bank/go.sum +++ b/x/bank/go.sum @@ -8,6 +8,8 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= +cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= @@ -111,8 +113,8 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= -github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= -github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= diff --git a/x/bank/keeper/keeper.go b/x/bank/keeper/keeper.go index 31e4720bbd4..03f01765c67 100644 --- a/x/bank/keeper/keeper.go +++ b/x/bank/keeper/keeper.go @@ -6,7 +6,6 @@ import ( "cosmossdk.io/core/appmodule" "cosmossdk.io/core/event" - "cosmossdk.io/core/log" errorsmod "cosmossdk.io/errors" "cosmossdk.io/math" authtypes "cosmossdk.io/x/auth/types" @@ -92,9 +91,6 @@ func NewBaseKeeper( panic(fmt.Errorf("invalid bank authority address: %w", err)) } - // add the module name to the logger - env.Logger = env.Logger.With(log.ModuleKey, "x/"+types.ModuleName) - return BaseKeeper{ Environment: env, BaseSendKeeper: NewBaseSendKeeper(env, cdc, ak, blockedAddrs, authority), diff --git a/x/circuit/go.mod b/x/circuit/go.mod index 654470697de..17b772ed428 100644 --- a/x/circuit/go.mod +++ b/x/circuit/go.mod @@ -54,7 +54,7 @@ require ( github.com/cosmos/crypto v0.1.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/iavl v1.2.0 // indirect + github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.1 // indirect @@ -177,7 +177,6 @@ replace ( cosmossdk.io/api => ../../api cosmossdk.io/core => ../../core cosmossdk.io/core/testing => ../../core/testing - cosmossdk.io/log => ../../log cosmossdk.io/x/accounts => ../accounts cosmossdk.io/x/auth => ../auth cosmossdk.io/x/bank => ../bank diff --git a/x/circuit/go.sum b/x/circuit/go.sum index 08da56c9d15..81d16c68890 100644 --- a/x/circuit/go.sum +++ b/x/circuit/go.sum @@ -10,6 +10,8 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= +cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= @@ -113,8 +115,8 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= -github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= -github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= diff --git a/x/consensus/go.mod b/x/consensus/go.mod index 1577c4a61aa..b638d69e19a 100644 --- a/x/consensus/go.mod +++ b/x/consensus/go.mod @@ -53,7 +53,7 @@ require ( github.com/cosmos/crypto v0.1.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/iavl v1.2.0 // indirect + github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.1 // indirect @@ -174,7 +174,6 @@ replace ( cosmossdk.io/api => ../../api cosmossdk.io/core => ../../core cosmossdk.io/core/testing => ../../core/testing - cosmossdk.io/log => ../../log cosmossdk.io/x/accounts => ../accounts cosmossdk.io/x/auth => ../auth cosmossdk.io/x/bank => ../bank diff --git a/x/consensus/go.sum b/x/consensus/go.sum index 496f78619dc..d2a9b023b85 100644 --- a/x/consensus/go.sum +++ b/x/consensus/go.sum @@ -10,6 +10,8 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= +cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= @@ -113,8 +115,8 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= -github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= -github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= diff --git a/x/distribution/go.mod b/x/distribution/go.mod index 420cfda6f63..bc58aea6317 100644 --- a/x/distribution/go.mod +++ b/x/distribution/go.mod @@ -65,7 +65,7 @@ require ( github.com/cosmos/crypto v0.1.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/iavl v1.2.0 // indirect + github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.1 // indirect @@ -182,7 +182,6 @@ replace ( cosmossdk.io/collections => ../../collections cosmossdk.io/core => ../../core cosmossdk.io/core/testing => ../../core/testing - cosmossdk.io/log => ../../log cosmossdk.io/x/accounts => ../accounts cosmossdk.io/x/auth => ../auth cosmossdk.io/x/bank => ../bank diff --git a/x/distribution/go.sum b/x/distribution/go.sum index 4879cfa3455..4e269960625 100644 --- a/x/distribution/go.sum +++ b/x/distribution/go.sum @@ -8,6 +8,8 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= +cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= @@ -111,8 +113,8 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= -github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= -github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= diff --git a/x/epochs/go.mod b/x/epochs/go.mod index ac8c5c24e82..9ff57f6eff8 100644 --- a/x/epochs/go.mod +++ b/x/epochs/go.mod @@ -51,7 +51,7 @@ require ( github.com/cosmos/crypto v0.1.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/iavl v1.2.0 // indirect + github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.1 // indirect @@ -179,7 +179,6 @@ replace ( cosmossdk.io/api => ../../api cosmossdk.io/core => ../../core cosmossdk.io/core/testing => ../../core/testing - cosmossdk.io/log => ../../log cosmossdk.io/x/accounts => ../accounts cosmossdk.io/x/auth => ../auth cosmossdk.io/x/bank => ../bank diff --git a/x/epochs/go.sum b/x/epochs/go.sum index 496f78619dc..d2a9b023b85 100644 --- a/x/epochs/go.sum +++ b/x/epochs/go.sum @@ -10,6 +10,8 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= +cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= @@ -113,8 +115,8 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= -github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= -github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= diff --git a/x/evidence/go.mod b/x/evidence/go.mod index 48d3b802e6a..6e69b3e184c 100644 --- a/x/evidence/go.mod +++ b/x/evidence/go.mod @@ -57,7 +57,7 @@ require ( github.com/cosmos/crypto v0.1.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/iavl v1.2.0 // indirect + github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.1 // indirect @@ -177,7 +177,6 @@ replace ( cosmossdk.io/api => ../../api cosmossdk.io/core => ../../core cosmossdk.io/core/testing => ../../core/testing - cosmossdk.io/log => ../../log cosmossdk.io/x/accounts => ../accounts cosmossdk.io/x/auth => ../auth cosmossdk.io/x/bank => ../bank diff --git a/x/evidence/go.sum b/x/evidence/go.sum index 08da56c9d15..81d16c68890 100644 --- a/x/evidence/go.sum +++ b/x/evidence/go.sum @@ -10,6 +10,8 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= +cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= @@ -113,8 +115,8 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= -github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= -github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= diff --git a/x/evidence/keeper/keeper_test.go b/x/evidence/keeper/keeper_test.go index cb5b54bc9b4..3ec2a425e60 100644 --- a/x/evidence/keeper/keeper_test.go +++ b/x/evidence/keeper/keeper_test.go @@ -127,10 +127,6 @@ func (suite *KeeperTestSuite) SetupTest() { types.RegisterQueryServer(queryHelper, keeper.NewQuerier(evidenceKeeper)) suite.queryClient = types.NewQueryClient(queryHelper) suite.evidenceKeeper = *evidenceKeeper - - suite.Require().Equal(testCtx.Ctx.Logger().With("module", "x/"+types.ModuleName), - suite.evidenceKeeper.Logger) - suite.msgServer = keeper.NewMsgServerImpl(suite.evidenceKeeper) } diff --git a/x/feegrant/go.mod b/x/feegrant/go.mod index 635aae07660..48f76e69f4b 100644 --- a/x/feegrant/go.mod +++ b/x/feegrant/go.mod @@ -61,7 +61,7 @@ require ( github.com/cosmos/crypto v0.1.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/iavl v1.2.0 // indirect + github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.1 // indirect @@ -182,7 +182,6 @@ replace ( cosmossdk.io/collections => ../../collections cosmossdk.io/core => ../../core cosmossdk.io/core/testing => ../../core/testing - cosmossdk.io/log => ../../log cosmossdk.io/x/accounts => ../accounts cosmossdk.io/x/auth => ../auth cosmossdk.io/x/bank => ../bank diff --git a/x/feegrant/go.sum b/x/feegrant/go.sum index 5f0cfa9d7fd..8413c200c45 100644 --- a/x/feegrant/go.sum +++ b/x/feegrant/go.sum @@ -8,6 +8,8 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= +cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= @@ -119,8 +121,8 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= -github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= -github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= diff --git a/x/feegrant/keeper/keeper.go b/x/feegrant/keeper/keeper.go index c68f992878b..ad3f5d59c65 100644 --- a/x/feegrant/keeper/keeper.go +++ b/x/feegrant/keeper/keeper.go @@ -2,14 +2,12 @@ package keeper import ( "context" - "fmt" "time" "cosmossdk.io/collections" "cosmossdk.io/core/appmodule" corecontext "cosmossdk.io/core/context" "cosmossdk.io/core/event" - "cosmossdk.io/core/log" errorsmod "cosmossdk.io/errors" "cosmossdk.io/x/auth/ante" "cosmossdk.io/x/feegrant" @@ -60,11 +58,6 @@ func NewKeeper(env appmodule.Environment, cdc codec.BinaryCodec, ak feegrant.Acc } } -// Logger returns a module-specific logger. -func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", fmt.Sprintf("x/%s", feegrant.ModuleName)) -} - // GrantAllowance creates a new grant func (k Keeper) GrantAllowance(ctx context.Context, granter, grantee sdk.AccAddress, feeAllowance feegrant.FeeAllowanceI) error { // Checking for duplicate entry diff --git a/x/gov/go.mod b/x/gov/go.mod index df9c1d63dd9..18ca83213bd 100644 --- a/x/gov/go.mod +++ b/x/gov/go.mod @@ -9,7 +9,7 @@ require ( cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000 cosmossdk.io/depinject v1.0.0 cosmossdk.io/errors v1.0.1 - cosmossdk.io/log v1.3.1 // indirect + cosmossdk.io/log v1.3.1 cosmossdk.io/math v1.3.0 cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 @@ -63,7 +63,7 @@ require ( github.com/cosmos/crypto v0.1.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/iavl v1.2.0 // indirect + github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.1 // indirect @@ -181,7 +181,6 @@ replace ( cosmossdk.io/collections => ../../collections cosmossdk.io/core => ../../core cosmossdk.io/core/testing => ../../core/testing - cosmossdk.io/log => ../../log cosmossdk.io/x/accounts => ../accounts cosmossdk.io/x/auth => ../auth cosmossdk.io/x/bank => ../bank diff --git a/x/gov/go.sum b/x/gov/go.sum index 94340b7551c..e1b34dbc8d8 100644 --- a/x/gov/go.sum +++ b/x/gov/go.sum @@ -8,6 +8,8 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= +cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= @@ -117,8 +119,8 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= -github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= -github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= diff --git a/x/gov/keeper/common_test.go b/x/gov/keeper/common_test.go index 7a59f7e5a42..5b18aaaf3da 100644 --- a/x/gov/keeper/common_test.go +++ b/x/gov/keeper/common_test.go @@ -11,6 +11,7 @@ import ( "cosmossdk.io/core/header" coretesting "cosmossdk.io/core/testing" + "cosmossdk.io/log" "cosmossdk.io/math" storetypes "cosmossdk.io/store/types" authtypes "cosmossdk.io/x/auth/types" @@ -127,7 +128,7 @@ func setupGovKeeper(t *testing.T, expectations ...func(sdk.Context, mocks)) ( baseApp := baseapp.NewBaseApp( "authz", - coretesting.NewNopLogger(), + log.NewNopLogger(), testCtx.DB, encCfg.TxConfig.TxDecoder(), ) @@ -193,7 +194,7 @@ func setupGovKeeperWithMaxVoteOptionsLen(t *testing.T, maxVoteOptionsLen uint64, baseApp := baseapp.NewBaseApp( "authz", - coretesting.NewNopLogger(), + log.NewNopLogger(), testCtx.DB, encCfg.TxConfig.TxDecoder(), ) diff --git a/x/group/go.mod b/x/group/go.mod index 6ee302bcfaf..8f229dfbbc9 100644 --- a/x/group/go.mod +++ b/x/group/go.mod @@ -69,7 +69,7 @@ require ( github.com/cosmos/crypto v0.1.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/iavl v1.2.0 // indirect + github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.1 // indirect @@ -188,7 +188,6 @@ replace ( cosmossdk.io/collections => ../../collections cosmossdk.io/core => ../../core cosmossdk.io/core/testing => ../../core/testing - cosmossdk.io/log => ../../log cosmossdk.io/x/accounts => ../accounts cosmossdk.io/x/accounts/defaults/multisig => ../accounts/defaults/multisig cosmossdk.io/x/auth => ../auth diff --git a/x/group/go.sum b/x/group/go.sum index 64812e20104..34b225a6d09 100644 --- a/x/group/go.sum +++ b/x/group/go.sum @@ -8,6 +8,8 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= +cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= @@ -123,8 +125,8 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= -github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= -github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= diff --git a/x/mint/go.mod b/x/mint/go.mod index bbbc298e8dc..f97f79aa072 100644 --- a/x/mint/go.mod +++ b/x/mint/go.mod @@ -6,6 +6,7 @@ require ( cosmossdk.io/api v0.7.5 cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.12.1-0.20231114100755-569e3ff6a0d7 + cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000 cosmossdk.io/depinject v1.0.0 cosmossdk.io/errors v1.0.1 cosmossdk.io/log v1.3.1 @@ -51,7 +52,7 @@ require ( github.com/cosmos/cosmos-db v1.0.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/iavl v1.2.0 // indirect + github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.1 // indirect @@ -159,7 +160,6 @@ require ( require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect - cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/schema v0.1.1 // indirect cosmossdk.io/x/consensus v0.0.0-00010101000000-000000000000 // indirect github.com/cometbft/cometbft/api v1.0.0-rc.1 // indirect @@ -181,7 +181,6 @@ replace ( cosmossdk.io/api => ../../api cosmossdk.io/core => ../../core cosmossdk.io/core/testing => ../../core/testing - cosmossdk.io/log => ../../log cosmossdk.io/x/accounts => ../accounts cosmossdk.io/x/auth => ../auth cosmossdk.io/x/bank => ../bank diff --git a/x/mint/go.sum b/x/mint/go.sum index edcd1d37e23..079d8d65f32 100644 --- a/x/mint/go.sum +++ b/x/mint/go.sum @@ -10,6 +10,8 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= +cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= @@ -115,8 +117,8 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= -github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= -github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= diff --git a/x/mint/keeper/keeper.go b/x/mint/keeper/keeper.go index 3f31a3ff325..14ee19cde86 100644 --- a/x/mint/keeper/keeper.go +++ b/x/mint/keeper/keeper.go @@ -7,7 +7,6 @@ import ( "cosmossdk.io/collections" "cosmossdk.io/core/appmodule" "cosmossdk.io/core/event" - "cosmossdk.io/log" "cosmossdk.io/math" "cosmossdk.io/x/mint/types" @@ -23,7 +22,6 @@ type Keeper struct { cdc codec.BinaryCodec stakingKeeper types.StakingKeeper bankKeeper types.BankKeeper - logger log.Logger feeCollectorName string // the address capable of executing a MsgUpdateParams message. Typically, this // should be the x/gov module account. @@ -55,7 +53,6 @@ func NewKeeper( cdc: cdc, stakingKeeper: sk, bankKeeper: bk, - logger: env.Logger, feeCollectorName: feeCollectorName, authority: authority, Params: collections.NewItem(sb, types.ParamsKey, "params", codec.CollValue[types.Params](cdc)), @@ -141,7 +138,7 @@ func (k Keeper) DefaultMintFn(ic types.InflationCalculationFn) types.MintFn { // calculate the difference between maxSupply and totalSupply diff := maxSupply.Sub(totalSupply) if diff.LTE(math.ZeroInt()) { - k.logger.Info("max supply reached, no new tokens will be minted") + k.Environment.Logger.Info("max supply reached, no new tokens will be minted") return nil } diff --git a/x/mint/keeper/keeper_test.go b/x/mint/keeper/keeper_test.go index d3d0281c756..01291777790 100644 --- a/x/mint/keeper/keeper_test.go +++ b/x/mint/keeper/keeper_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/suite" "cosmossdk.io/core/appmodule" - "cosmossdk.io/log" + coretesting "cosmossdk.io/core/testing" "cosmossdk.io/math" storetypes "cosmossdk.io/store/types" authtypes "cosmossdk.io/x/auth/types" @@ -44,7 +44,7 @@ func (s *KeeperTestSuite) SetupTest() { encCfg := moduletestutil.MakeTestEncodingConfig(codectestutil.CodecOptions{}, mint.AppModule{}) key := storetypes.NewKVStoreKey(types.StoreKey) storeService := runtime.NewKVStoreService(key) - env := runtime.NewEnvironment(storeService, log.NewNopLogger()) + env := runtime.NewEnvironment(storeService, coretesting.NewNopLogger()) testCtx := testutil.DefaultContextWithDB(s.T(), key, storetypes.NewTransientStoreKey("transient_test")) s.ctx = testCtx.Ctx diff --git a/x/nft/go.mod b/x/nft/go.mod index fc10149a2ab..e4884dbfa32 100644 --- a/x/nft/go.mod +++ b/x/nft/go.mod @@ -25,7 +25,6 @@ require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect cosmossdk.io/collections v0.4.0 // indirect - cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/schema v0.1.1 // indirect cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 // indirect @@ -55,7 +54,7 @@ require ( github.com/cosmos/crypto v0.1.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/iavl v1.2.0 // indirect + github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.1 // indirect @@ -177,7 +176,6 @@ replace ( cosmossdk.io/api => ../../api cosmossdk.io/core => ../../core cosmossdk.io/core/testing => ../../core/testing - cosmossdk.io/log => ../../log cosmossdk.io/x/accounts => ../accounts cosmossdk.io/x/auth => ../auth cosmossdk.io/x/bank => ../bank diff --git a/x/nft/go.sum b/x/nft/go.sum index 08da56c9d15..81d16c68890 100644 --- a/x/nft/go.sum +++ b/x/nft/go.sum @@ -10,6 +10,8 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= +cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= @@ -113,8 +115,8 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= -github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= -github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= diff --git a/x/params/go.mod b/x/params/go.mod index 89d78a5e582..05f1c5dd0cd 100644 --- a/x/params/go.mod +++ b/x/params/go.mod @@ -29,7 +29,6 @@ require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect cosmossdk.io/collections v0.4.0 // indirect - cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/schema v0.1.1 // indirect cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 // indirect @@ -57,7 +56,7 @@ require ( github.com/cosmos/crypto v0.1.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/iavl v1.2.0 // indirect + github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.1 // indirect @@ -178,7 +177,6 @@ replace ( cosmossdk.io/api => ../../api cosmossdk.io/core => ../../core cosmossdk.io/core/testing => ../../core/testing - cosmossdk.io/log => ../../log cosmossdk.io/x/accounts => ../accounts cosmossdk.io/x/auth => ../auth cosmossdk.io/x/bank => ../bank diff --git a/x/params/go.sum b/x/params/go.sum index 08da56c9d15..81d16c68890 100644 --- a/x/params/go.sum +++ b/x/params/go.sum @@ -10,6 +10,8 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= +cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= @@ -113,8 +115,8 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= -github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= -github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= diff --git a/x/protocolpool/go.mod b/x/protocolpool/go.mod index 0c4ad683e2a..a02f7312608 100644 --- a/x/protocolpool/go.mod +++ b/x/protocolpool/go.mod @@ -6,9 +6,9 @@ require ( cosmossdk.io/api v0.7.5 cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.12.1-0.20231114100755-569e3ff6a0d7 + cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000 cosmossdk.io/depinject v1.0.0 cosmossdk.io/errors v1.0.1 - cosmossdk.io/log v1.3.1 cosmossdk.io/math v1.3.0 cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 @@ -28,7 +28,7 @@ require ( require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect - cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000 // indirect + cosmossdk.io/log v1.3.1 // indirect cosmossdk.io/schema v0.1.1 // indirect cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 // indirect cosmossdk.io/x/consensus v0.0.0-00010101000000-000000000000 // indirect @@ -57,7 +57,7 @@ require ( github.com/cosmos/crypto v0.1.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/iavl v1.2.0 // indirect + github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.1 // indirect @@ -177,7 +177,6 @@ replace ( cosmossdk.io/api => ../../api cosmossdk.io/core => ../../core cosmossdk.io/core/testing => ../../core/testing - cosmossdk.io/log => ../../log cosmossdk.io/x/accounts => ../accounts cosmossdk.io/x/auth => ../auth cosmossdk.io/x/bank => ../bank diff --git a/x/protocolpool/go.sum b/x/protocolpool/go.sum index 08da56c9d15..81d16c68890 100644 --- a/x/protocolpool/go.sum +++ b/x/protocolpool/go.sum @@ -10,6 +10,8 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= +cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= @@ -113,8 +115,8 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= -github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= -github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= diff --git a/x/protocolpool/keeper/keeper_test.go b/x/protocolpool/keeper/keeper_test.go index 1f5b1f1bce0..7100d2dec5c 100644 --- a/x/protocolpool/keeper/keeper_test.go +++ b/x/protocolpool/keeper/keeper_test.go @@ -9,7 +9,7 @@ import ( "cosmossdk.io/core/appmodule" "cosmossdk.io/core/header" - "cosmossdk.io/log" + coretesting "cosmossdk.io/core/testing" "cosmossdk.io/math" storetypes "cosmossdk.io/store/types" authtypes "cosmossdk.io/x/auth/types" @@ -49,7 +49,7 @@ type KeeperTestSuite struct { func (s *KeeperTestSuite) SetupTest() { key := storetypes.NewKVStoreKey(types.StoreKey) storeService := runtime.NewKVStoreService(key) - environment := runtime.NewEnvironment(storeService, log.NewNopLogger()) + environment := runtime.NewEnvironment(storeService, coretesting.NewNopLogger()) testCtx := testutil.DefaultContextWithDB(s.T(), key, storetypes.NewTransientStoreKey("transient_test")) ctx := testCtx.Ctx.WithHeaderInfo(header.Info{Time: time.Now()}) encCfg := moduletestutil.MakeTestEncodingConfig(codectestutil.CodecOptions{}) diff --git a/x/simulation/simulate.go b/x/simulation/simulate.go index 15bbd353cc2..cd4fbe59079 100644 --- a/x/simulation/simulate.go +++ b/x/simulation/simulate.go @@ -16,7 +16,7 @@ import ( "cosmossdk.io/core/address" "cosmossdk.io/core/header" - "cosmossdk.io/core/log" + corelog "cosmossdk.io/core/log" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" @@ -61,7 +61,7 @@ func initChain( // operations, testing the provided invariants, but using the provided config.Seed. func SimulateFromSeed( // exists for backwards compatibility only tb testing.TB, - logger log.Logger, + logger corelog.Logger, w io.Writer, app *baseapp.BaseApp, appStateFn simulation.AppStateFn, @@ -81,7 +81,7 @@ func SimulateFromSeed( // exists for backwards compatibility only // operations, testing the provided invariants, but using the provided config.Seed. func SimulateFromSeedX( tb testing.TB, - logger log.Logger, + logger corelog.Logger, w io.Writer, app *baseapp.BaseApp, appStateFn simulation.AppStateFn, diff --git a/x/slashing/go.mod b/x/slashing/go.mod index 90077e02500..011b2cf8417 100644 --- a/x/slashing/go.mod +++ b/x/slashing/go.mod @@ -58,7 +58,7 @@ require ( github.com/cosmos/crypto v0.1.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/iavl v1.2.0 // indirect + github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.1 // indirect @@ -178,7 +178,6 @@ replace ( cosmossdk.io/api => ../../api cosmossdk.io/core => ../../core cosmossdk.io/core/testing => ../../core/testing - cosmossdk.io/log => ../../log cosmossdk.io/x/accounts => ../accounts cosmossdk.io/x/auth => ../auth cosmossdk.io/x/bank => ../bank diff --git a/x/slashing/go.sum b/x/slashing/go.sum index 28336175165..6a7a5c66451 100644 --- a/x/slashing/go.sum +++ b/x/slashing/go.sum @@ -10,6 +10,8 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= +cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= @@ -115,8 +117,8 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= -github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= -github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= diff --git a/x/staking/go.mod b/x/staking/go.mod index 8f761dfc98c..8d3086240a8 100644 --- a/x/staking/go.mod +++ b/x/staking/go.mod @@ -55,7 +55,7 @@ require ( github.com/cosmos/cosmos-db v1.0.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/iavl v1.2.0 // indirect + github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.1 // indirect @@ -158,7 +158,7 @@ require ( require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect - cosmossdk.io/log v1.3.1 // indirect + cosmossdk.io/log v1.3.1 cosmossdk.io/x/consensus v0.0.0-00010101000000-000000000000 github.com/cosmos/crypto v0.1.2 // indirect github.com/dgraph-io/badger/v4 v4.2.0 // indirect @@ -183,7 +183,6 @@ replace ( cosmossdk.io/collections => ../../collections cosmossdk.io/core => ../../core cosmossdk.io/core/testing => ../../core/testing - cosmossdk.io/log => ../../log cosmossdk.io/x/accounts => ../accounts cosmossdk.io/x/auth => ../auth cosmossdk.io/x/bank => ../bank diff --git a/x/staking/go.sum b/x/staking/go.sum index 4879cfa3455..4e269960625 100644 --- a/x/staking/go.sum +++ b/x/staking/go.sum @@ -8,6 +8,8 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= +cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= @@ -111,8 +113,8 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= -github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= -github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= diff --git a/x/staking/keeper/keeper_test.go b/x/staking/keeper/keeper_test.go index e148a7114dd..0c4311a906e 100644 --- a/x/staking/keeper/keeper_test.go +++ b/x/staking/keeper/keeper_test.go @@ -11,6 +11,7 @@ import ( "cosmossdk.io/collections" "cosmossdk.io/core/header" coretesting "cosmossdk.io/core/testing" + "cosmossdk.io/log" "cosmossdk.io/math" storetypes "cosmossdk.io/store/types" authtypes "cosmossdk.io/x/auth/types" @@ -65,7 +66,7 @@ func (s *KeeperTestSuite) SetupTest() { s.baseApp = baseapp.NewBaseApp( "staking", - coretesting.NewNopLogger(), + log.NewNopLogger(), testCtx.DB, encCfg.TxConfig.TxDecoder(), ) diff --git a/x/upgrade/go.mod b/x/upgrade/go.mod index ad960559819..cae69857a63 100644 --- a/x/upgrade/go.mod +++ b/x/upgrade/go.mod @@ -72,7 +72,7 @@ require ( github.com/cosmos/crypto v0.1.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/iavl v1.2.0 // indirect + github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.1 // indirect @@ -208,7 +208,7 @@ replace ( cosmossdk.io/api => ../../api cosmossdk.io/core => ../../core cosmossdk.io/core/testing => ../../core/testing - cosmossdk.io/log => ../../log + cosmossdk.io/store => ../../store cosmossdk.io/x/accounts => ../accounts cosmossdk.io/x/auth => ../auth cosmossdk.io/x/bank => ../bank diff --git a/x/upgrade/go.sum b/x/upgrade/go.sum index 7d486fa36fe..5e176963697 100644 --- a/x/upgrade/go.sum +++ b/x/upgrade/go.sum @@ -198,12 +198,12 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= +cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= cosmossdk.io/schema v0.1.1/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= -cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc h1:R9O9d75e0qZYUsVV0zzi+D7cNLnX2JrUOQNoIPaF0Bg= -cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc/go.mod h1:amTTatOUV3u1PsKmNb87z6/galCxrRbz9kRdJkL0DyU= cosmossdk.io/x/protocolpool v0.0.0-20230925135524-a1bc045b3190 h1:XQJj9Dv9Gtze0l2TF79BU5lkP6MkUveTUuKICmxoz+o= cosmossdk.io/x/protocolpool v0.0.0-20230925135524-a1bc045b3190/go.mod h1:7WUGupOvmlHJoIMBz1JbObQxeo6/TDiuDBxmtod8HRg= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= @@ -321,8 +321,8 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= -github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= -github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE= +github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= diff --git a/x/upgrade/keeper/abci_test.go b/x/upgrade/keeper/abci_test.go index a07f49a7a28..4360a37797c 100644 --- a/x/upgrade/keeper/abci_test.go +++ b/x/upgrade/keeper/abci_test.go @@ -13,6 +13,7 @@ import ( "cosmossdk.io/core/appmodule" "cosmossdk.io/core/header" coretesting "cosmossdk.io/core/testing" + "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/upgrade" @@ -122,7 +123,7 @@ func setupTest(t *testing.T, height int64, skip map[int64]bool) *TestSuite { testCtx := testutil.DefaultContextWithDB(t, key, storetypes.NewTransientStoreKey("transient_test")) s.baseApp = baseapp.NewBaseApp( "upgrade", - coretesting.NewNopLogger(), + log.NewNopLogger(), testCtx.DB, s.encCfg.TxConfig.TxDecoder(), ) diff --git a/x/upgrade/keeper/keeper_test.go b/x/upgrade/keeper/keeper_test.go index e26013a1b94..a7add3e24f6 100644 --- a/x/upgrade/keeper/keeper_test.go +++ b/x/upgrade/keeper/keeper_test.go @@ -12,6 +12,7 @@ import ( "cosmossdk.io/core/appmodule" "cosmossdk.io/core/header" coretesting "cosmossdk.io/core/testing" + "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/upgrade" @@ -54,7 +55,7 @@ func (s *KeeperTestSuite) SetupTest() { s.baseApp = baseapp.NewBaseApp( "upgrade", - coretesting.NewNopLogger(), + log.NewNopLogger(), testCtx.DB, s.encCfg.TxConfig.TxDecoder(), ) diff --git a/x/upgrade/types/storeloader_test.go b/x/upgrade/types/storeloader_test.go index 41f9e9956a5..0d784b17ad6 100644 --- a/x/upgrade/types/storeloader_test.go +++ b/x/upgrade/types/storeloader_test.go @@ -28,7 +28,7 @@ func useUpgradeLoader(height int64, upgrades *storetypes.StoreUpgrades) func(*ba func initStore(t *testing.T, db dbm.DB, storeKey string, k, v []byte) { t.Helper() - rs := rootmulti.NewStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics()) + rs := rootmulti.NewStore(db, coretesting.NewNopLogger(), metrics.NewNoOpMetrics()) rs.SetPruning(pruningtypes.NewPruningOptions(pruningtypes.PruningNothing)) key := storetypes.NewKVStoreKey(storeKey) rs.MountStoreWithDB(key, storetypes.StoreTypeIAVL, nil) @@ -46,7 +46,7 @@ func initStore(t *testing.T, db dbm.DB, storeKey string, k, v []byte) { func checkStore(t *testing.T, db dbm.DB, ver int64, storeKey string, k, v []byte) { t.Helper() - rs := rootmulti.NewStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics()) + rs := rootmulti.NewStore(db, coretesting.NewNopLogger(), metrics.NewNoOpMetrics()) rs.SetPruning(pruningtypes.NewPruningOptions(pruningtypes.PruningNothing)) key := storetypes.NewKVStoreKey(storeKey) rs.MountStoreWithDB(key, storetypes.StoreTypeIAVL, nil) @@ -119,9 +119,9 @@ func TestSetLoader(t *testing.T) { // load the app with the existing db opts := []func(*baseapp.BaseApp){baseapp.SetPruning(pruningtypes.NewPruningOptions(pruningtypes.PruningNothing))} - logger := coretesting.NewNopLogger() + logger := log.NewNopLogger() - oldApp := baseapp.NewBaseApp(t.Name(), logger.With("instance", "orig"), db, nil, opts...) + oldApp := baseapp.NewBaseApp(t.Name(), logger, db, nil, opts...) oldApp.MountStores(storetypes.NewKVStoreKey(tc.origStoreKey)) err := oldApp.LoadLatestVersion() From 2e0884564fdbe11e505d9cf48be618b917f42cf7 Mon Sep 17 00:00:00 2001 From: Cosmos SDK <113218068+github-prbot@users.noreply.github.com> Date: Fri, 26 Jul 2024 17:14:27 +0200 Subject: [PATCH 10/15] chore: fix spelling errors (#21092) Co-authored-by: github-merge-queue <118344674+github-merge-queue@users.noreply.github.com> Co-authored-by: Julien Robert --- .github/.codespellignore | 3 ++- server/v2/store/commands.go | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/.codespellignore b/.github/.codespellignore index e1e8758d0c3..4ac943d563d 100644 --- a/.github/.codespellignore +++ b/.github/.codespellignore @@ -4,4 +4,5 @@ keypair pastTime hasTables Nam -EyT \ No newline at end of file +EyT +upTo \ No newline at end of file diff --git a/server/v2/store/commands.go b/server/v2/store/commands.go index e1c8a20dfb6..c22cd56ce37 100644 --- a/server/v2/store/commands.go +++ b/server/v2/store/commands.go @@ -64,8 +64,8 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`, return fmt.Errorf("the database has no valid heights to prune, the latest height: %v", latestHeight) } - upTo := latestHeight - keepRecent - cmd.Printf("pruning heights up to %v\n", upTo) + diff := latestHeight - keepRecent + cmd.Printf("pruning heights up to %v\n", diff) err = rootStore.Prune(latestHeight) if err != nil { From b05bb2601edbabc7bc63bd9c36ad1b81e4d526e0 Mon Sep 17 00:00:00 2001 From: Alexander Peters Date: Sat, 27 Jul 2024 20:11:24 +0200 Subject: [PATCH 11/15] fix(stf): fixes to make init genesis pass (#21088) Co-authored-by: marbar3778 --- runtime/v2/builder.go | 6 ++++-- runtime/v2/manager.go | 2 +- schema/appdata/async.go | 2 +- schema/appdata/mux_test.go | 1 + schema/module_schema_test.go | 1 + server/v2/stf/core_event_service.go | 10 ++++++---- server/v2/store/commands.go | 2 +- simapp/v2/app_di.go | 1 + 8 files changed, 16 insertions(+), 9 deletions(-) diff --git a/runtime/v2/builder.go b/runtime/v2/builder.go index a073761cbcf..b7869fa3f0a 100644 --- a/runtime/v2/builder.go +++ b/runtime/v2/builder.go @@ -128,8 +128,10 @@ func (a *AppBuilder[T]) Build(opts ...AppBuilderOption[T]) (*App[T], error) { home := v.GetString(FlagHome) storeOpts := rootstore.DefaultStoreOptions() - if err := v.Sub("store.options").Unmarshal(&storeOpts); err != nil { - return nil, fmt.Errorf("failed to store options: %w", err) + if s := v.Sub("store.options"); s != nil { + if err := s.Unmarshal(&storeOpts); err != nil { + return nil, fmt.Errorf("failed to store options: %w", err) + } } scRawDb, err := db.NewDB(db.DBType(v.GetString("store.app-db-backend")), "application", filepath.Join(home, "data"), nil) diff --git a/runtime/v2/manager.go b/runtime/v2/manager.go index f52cb1aeb48..7f6d7a6d06f 100644 --- a/runtime/v2/manager.go +++ b/runtime/v2/manager.go @@ -166,7 +166,7 @@ func (m *MM[T]) InitGenesisJSON( case appmodulev2.HasGenesis: m.logger.Debug("running initialization for module", "module", moduleName) if err := module.InitGenesis(ctx, genesisData[moduleName]); err != nil { - return err + return fmt.Errorf("init module %s: %w", moduleName, err) } case appmodulev2.HasABCIGenesis: m.logger.Debug("running initialization for module", "module", moduleName) diff --git a/schema/appdata/async.go b/schema/appdata/async.go index 0d4126ed2a0..4112ae839fe 100644 --- a/schema/appdata/async.go +++ b/schema/appdata/async.go @@ -15,7 +15,7 @@ type AsyncListenerOptions struct { BufferSize int // DoneWaitGroup is an optional wait-group that listener goroutines will notify via Add(1) when they are started - // and Done() after they are cancelled and completed. + // and Done() after they are canceled and completed. DoneWaitGroup *sync.WaitGroup } diff --git a/schema/appdata/mux_test.go b/schema/appdata/mux_test.go index b5e3a95dd56..e5fbad0b64e 100644 --- a/schema/appdata/mux_test.go +++ b/schema/appdata/mux_test.go @@ -119,6 +119,7 @@ func callCollector(i int, onCall func(string, int, Packet)) Listener { } func checkExpectedCallOrder(t *testing.T, actual, expected []string) { + t.Helper() if len(actual) != len(expected) { t.Fatalf("expected %d calls, got %d", len(expected), len(actual)) } diff --git a/schema/module_schema_test.go b/schema/module_schema_test.go index 454ae743064..2e4a927acc5 100644 --- a/schema/module_schema_test.go +++ b/schema/module_schema_test.go @@ -297,6 +297,7 @@ func TestModuleSchema_LookupType(t *testing.T) { } func exampleSchema(t *testing.T) ModuleSchema { + t.Helper() return requireModuleSchema(t, []ObjectType{ { Name: "object1", diff --git a/server/v2/stf/core_event_service.go b/server/v2/stf/core_event_service.go index 5bd94c6ea74..137f654ec78 100644 --- a/server/v2/stf/core_event_service.go +++ b/server/v2/stf/core_event_service.go @@ -1,10 +1,12 @@ package stf import ( + "bytes" "context" "encoding/json" "slices" + "github.com/cosmos/gogoproto/jsonpb" gogoproto "github.com/cosmos/gogoproto/proto" "golang.org/x/exp/maps" @@ -55,14 +57,14 @@ func (em *eventManager) EmitNonConsensus(event gogoproto.Message) error { // TypedEventToEvent takes typed event and converts to Event object func TypedEventToEvent(tev gogoproto.Message) (event.Event, error) { evtType := gogoproto.MessageName(tev) - evtJSON, err := gogoproto.Marshal(tev) - if err != nil { + buf := new(bytes.Buffer) + jm := &jsonpb.Marshaler{OrigName: true, EmitDefaults: true, AnyResolver: nil} + if err := jm.Marshal(buf, tev); err != nil { return event.Event{}, err } var attrMap map[string]json.RawMessage - err = json.Unmarshal(evtJSON, &attrMap) - if err != nil { + if err := json.Unmarshal(buf.Bytes(), &attrMap); err != nil { return event.Event{}, err } diff --git a/server/v2/store/commands.go b/server/v2/store/commands.go index c22cd56ce37..dc44892f3b8 100644 --- a/server/v2/store/commands.go +++ b/server/v2/store/commands.go @@ -129,7 +129,7 @@ func createRootStore(cmd *cobra.Command, rootDir string, v *viper.Viper, logger } storeOpts := root.DefaultStoreOptions() - if v != nil { + if v != nil && v.Sub("store.options") != nil { if err := v.Sub("store.options").Unmarshal(&storeOpts); err != nil { return nil, 0, fmt.Errorf("failed to store options: %w", err) } diff --git a/simapp/v2/app_di.go b/simapp/v2/app_di.go index 0099f8f0f9d..7cde4042f3c 100644 --- a/simapp/v2/app_di.go +++ b/simapp/v2/app_di.go @@ -36,6 +36,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/std" + _ "github.com/cosmos/cosmos-sdk/x/genutil" ) // DefaultNodeHome default home directories for the application daemon From 73a9396a0a2e4e2e62e2a0cf7b256e4c7a2989a4 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Sun, 28 Jul 2024 09:28:05 +0200 Subject: [PATCH 12/15] ci: make init-simapp v1 / v2 consistent (#21082) --- .github/workflows/test.yml | 22 ++++++++++++++-- .github/workflows/v2-test.yml | 36 ++++++++++++++++++++++----- scripts/build/testing.mk | 2 ++ scripts/init-simapp-v2.sh | 23 +++++++++++++++++ scripts/init-simapp.sh | 10 +++++--- scripts/simapp-v2-init.sh | 47 ----------------------------------- 6 files changed, 82 insertions(+), 58 deletions(-) create mode 100755 scripts/init-simapp-v2.sh delete mode 100755 scripts/simapp-v2-init.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8adcb9dc72e..9deffe53d6f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -536,7 +536,7 @@ jobs: if: env.GIT_DIFF run: | cd simapp - go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock' ./... + go test -mod=readonly -timeout 30m -tags='norace ledger test_ledger_mock' ./... - name: tests simapp v1 if: env.GIT_DIFF run: | @@ -562,10 +562,28 @@ jobs: go.sum **/go.mod **/go.sum + - name: tests simapp + if: env.GIT_DIFF + run: | + cd simapp/v2 + go test -mod=readonly -timeout 30m -tags='norace ledger test_ledger_mock' ./... - name: simapp-v2-smoke-test if: env.GIT_DIFF run: | - ./scripts/simapp-v2-init.sh + COSMOS_BUILD_OPTIONS=v2 make install + ./scripts/init-simapp-v2.sh + simdv2 start & + SIMD_PID=$! + cnt=0 + while ! simdv2 query block --type=height 5; do + cnt=$((cnt + 1)) + if [ $cnt -gt 30 ]; then + kill -9 "$SIMD_PID" + exit 1 + fi + sleep 1 + done + kill -9 "$SIMD_PID" test-collections: runs-on: ubuntu-latest diff --git a/.github/workflows/v2-test.yml b/.github/workflows/v2-test.yml index 7433a47a133..9bde9c3f39d 100644 --- a/.github/workflows/v2-test.yml +++ b/.github/workflows/v2-test.yml @@ -1,4 +1,4 @@ -name: v2 core Tests +name: v2 core Tests on: pull_request: merge_group: @@ -37,7 +37,7 @@ jobs: - name: test & coverage report creation if: env.GIT_DIFF run: | - cd server/v2 && go test -mod=readonly -race -timeout 30m -covermode=atomic -tags='ledger test_ledger_mock' + cd server/v2 && go test -mod=readonly -race -timeout 30m -tags='ledger test_ledger_mock' stf: runs-on: ubuntu-latest strategy: @@ -60,9 +60,9 @@ jobs: - name: test & coverage report creation if: env.GIT_DIFF run: | - cd server/v2/stf && go test -mod=readonly -race -timeout 30m -covermode=atomic -tags='ledger test_ledger_mock' - - appamanger: + cd server/v2/stf && go test -mod=readonly -race -timeout 30m -tags='ledger test_ledger_mock' + + appmanager: runs-on: ubuntu-latest strategy: fail-fast: false @@ -84,4 +84,28 @@ jobs: - name: test & coverage report creation if: env.GIT_DIFF run: | - cd server/v2/appmanager && go test -mod=readonly -race -timeout 30m -covermode=atomic -tags='ledger test_ledger_mock' \ No newline at end of file + cd server/v2/appmanager && go test -mod=readonly -race -timeout 30m -tags='ledger test_ledger_mock' + + cometbft: + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: "1.22" + check-latest: true + cache: true + cache-dependency-path: go.sum + - uses: technote-space/get-diff-action@v6.1.2 + id: git_diff + with: + PATTERNS: | + server/v2/cometbft/**/*.go + server/v2/cometbft/go.mod + server/v2/cometbft/go.sum + - name: test & coverage report creation + if: env.GIT_DIFF + run: | + cd server/v2/cometbft && go test -mod=readonly -race -timeout 30m -tags='ledger test_ledger_mock' diff --git a/scripts/build/testing.mk b/scripts/build/testing.mk index 8289d538ac6..98f1afe2a63 100644 --- a/scripts/build/testing.mk +++ b/scripts/build/testing.mk @@ -6,6 +6,8 @@ #? init-simapp: Initializes a single local node network init-simapp: ./scripts/init-simapp.sh +init-simapp-v2: + ./scripts/init-simapp-v2.sh #? test: Run `make test-unit` test: test-unit diff --git a/scripts/init-simapp-v2.sh b/scripts/init-simapp-v2.sh new file mode 100755 index 00000000000..a4788dfee83 --- /dev/null +++ b/scripts/init-simapp-v2.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +SIMD_BIN=${SIMD_BIN:=$(which simdv2 2>/dev/null)} + +if [ -z "$SIMD_BIN" ]; then echo "SIMD_BIN is not set. Make sure to run 'COSMOS_BUILD_OPTIONS=v2 make install' before"; exit 1; fi +echo "using $SIMD_BIN" +SIMD_HOME=$($SIMD_BIN config home) +if [ -d "$SIMD_HOME" ]; then rm -rv $SIMD_HOME; fi +$SIMD_BIN config set client chain-id simapp-v2-chain +$SIMD_BIN config set client keyring-backend test +$SIMD_BIN config set client keyring-default-keyname alice +$SIMD_BIN config set app api.enable true +$SIMD_BIN keys add alice --indiscreet +$SIMD_BIN keys add bob --indiscreet +$SIMD_BIN init simapp-v2-node --chain-id simapp-v2-chain +# to change the voting_period +jq '.app_state.gov.params.voting_period = "600s"' $SIMD_HOME/config/genesis.json > temp.json && mv temp.json $SIMD_HOME/config/genesis.json +jq '.app_state.gov.params.expedited_voting_period = "300s"' $SIMD_HOME/config/genesis.json > temp.json && mv temp.json $SIMD_HOME/config/genesis.json +jq '.app_state.mint.minter.inflation = "0.300000000000000000"' $SIMD_HOME/config/genesis.json > temp.json && mv temp.json $SIMD_HOME/config/genesis.json # to change the inflation +$SIMD_BIN genesis add-genesis-account alice 5000000000stake --keyring-backend test +$SIMD_BIN genesis add-genesis-account bob 5000000000stake --keyring-backend test +$SIMD_BIN genesis gentx alice 1000000stake --chain-id demo +$SIMD_BIN genesis collect-gentxs \ No newline at end of file diff --git a/scripts/init-simapp.sh b/scripts/init-simapp.sh index b7f08949564..d3995197fde 100755 --- a/scripts/init-simapp.sh +++ b/scripts/init-simapp.sh @@ -2,9 +2,9 @@ SIMD_BIN=${SIMD_BIN:=$(which simd 2>/dev/null)} -if [ -z "$SIMD_BIN" ]; then echo "SIMD_BIN is not set. Make sure to run make install before"; exit 1; fi -echo "using $SIMD_BIN" -if [ -d "$($SIMD_BIN config home)" ]; then rm -rv $($SIMD_BIN config home); fi +if [ -z "$SIMD_BIN" ]; then echo "SIMD_BIN is not set. Make sure to run 'make install' before"; exit 1; fi +SIMD_HOME=$($SIMD_BIN config home) +if [ -d "$SIMD_HOME" ]; then rm -rv $SIMD_HOME; fi $SIMD_BIN config set client chain-id demo $SIMD_BIN config set client keyring-backend test $SIMD_BIN config set client keyring-default-keyname alice @@ -12,6 +12,10 @@ $SIMD_BIN config set app api.enable true $SIMD_BIN keys add alice --indiscreet $SIMD_BIN keys add bob --indiscreet $SIMD_BIN init test --chain-id demo +# to change the voting_period +jq '.app_state.gov.params.voting_period = "600s"' $SIMD_HOME/config/genesis.json > temp.json && mv temp.json $SIMD_HOME/config/genesis.json +jq '.app_state.gov.params.expedited_voting_period = "300s"' $SIMD_HOME/config/genesis.json > temp.json && mv temp.json $SIMD_HOME/config/genesis.json +jq '.app_state.mint.minter.inflation = "0.300000000000000000"' $SIMD_HOME/config/genesis.json > temp.json && mv temp.json $SIMD_HOME/config/genesis.json # to change the inflation $SIMD_BIN genesis add-genesis-account alice 5000000000stake --keyring-backend test $SIMD_BIN genesis add-genesis-account bob 5000000000stake --keyring-backend test $SIMD_BIN genesis gentx alice 1000000stake --chain-id demo diff --git a/scripts/simapp-v2-init.sh b/scripts/simapp-v2-init.sh deleted file mode 100755 index 7d22970e460..00000000000 --- a/scripts/simapp-v2-init.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit -set -o nounset -set -x - -ROOT=$PWD - -SIMD="$ROOT/build/simdv2" -CONFIG="${CONFIG:-$HOME/.simappv2/config}" - -COSMOS_BUILD_OPTIONS=v2 make build - -if [ -d "$($SIMD config home)" ]; then rm -rv $($SIMD config home); fi - -$SIMD init simapp-v2-node --chain-id simapp-v2-chain - -cd "$CONFIG" - -# to change the voting_period -jq '.app_state.gov.voting_params.voting_period = "600s"' genesis.json > temp.json && mv temp.json genesis.json - -# to change the inflation -jq '.app_state.mint.minter.inflation = "0.300000000000000000"' genesis.json > temp.json && mv temp.json genesis.json - -$SIMD config set client chain-id simapp-v2-chain -$SIMD keys add test_validator --indiscreet -VALIDATOR_ADDRESS=$($SIMD keys show test_validator -a --keyring-backend test) - -$SIMD genesis add-genesis-account "$VALIDATOR_ADDRESS" 1000000000stake -$SIMD genesis gentx test_validator 1000000000stake --keyring-backend test -$SIMD genesis collect-gentxs - -$SIMD start & -SIMD_PID=$! - -cnt=0 -while ! $SIMD query block --type=height 5; do - cnt=$((cnt + 1)) - if [ $cnt -gt 30 ]; then - kill -9 "$SIMD_PID" - exit 1 - fi - sleep 1 -done - -kill -9 "$SIMD_PID" From 3f22acc5d9ceafb14cc6bbd250bd9185b37900a7 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Mon, 29 Jul 2024 12:08:48 +0700 Subject: [PATCH 13/15] refactor(simd/v2): Rename to `minimum-gas-price` (#21099) --- scripts/local-testnet.sh | 2 +- simapp/v2/simdv2/cmd/testnet.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/local-testnet.sh b/scripts/local-testnet.sh index c3e1162a6aa..c73710dbab1 100644 --- a/scripts/local-testnet.sh +++ b/scripts/local-testnet.sh @@ -10,7 +10,7 @@ SIMD="$ROOT/build/simdv2" COSMOS_BUILD_OPTIONS=v2 make build -$SIMD testnet init-files --chain-id=testing --output-dir="$HOME/.testnet" --validator-count=3 --keyring-backend=test --min-gas-prices=0.000001stake --commit-timeout=900ms --single-host +$SIMD testnet init-files --chain-id=testing --output-dir="$HOME/.testnet" --validator-count=3 --keyring-backend=test --minimum-gas-prices=0.000001stake --commit-timeout=900ms --single-host $SIMD start --log_level=info --home "$HOME/.testnet/node0/simdv2" & $SIMD start --log_level=info --home "$HOME/.testnet/node1/simdv2" & diff --git a/simapp/v2/simdv2/cmd/testnet.go b/simapp/v2/simdv2/cmd/testnet.go index be770f9d74e..2d4c3b348db 100644 --- a/simapp/v2/simdv2/cmd/testnet.go +++ b/simapp/v2/simdv2/cmd/testnet.go @@ -41,7 +41,7 @@ import ( ) var ( - flagMinGasPrices = "min-gas-prices" + flagMinGasPrices = "minimum-gas-prices" flagNodeDirPrefix = "node-dir-prefix" flagNumValidators = "validator-count" flagOutputDir = "output-dir" From e7b6d731479115f743f688c5a5f5523ed170610b Mon Sep 17 00:00:00 2001 From: Akhil Kumar P <36399231+akhilkumarpilli@users.noreply.github.com> Date: Mon, 29 Jul 2024 11:46:21 +0530 Subject: [PATCH 14/15] feat(confix): add migration to v2 (#21052) --- store/v2/commitment/iavl/config.go | 4 +- tools/confix/cmd/migrate.go | 29 +++++-- tools/confix/cmd/mutate.go | 7 +- tools/confix/data/v2-app.toml | 59 ++++++++++++++ tools/confix/data/v2-client.toml | 27 ++++++ tools/confix/match.go | 63 ++++++++++++++ tools/confix/migrations.go | 127 +++++++++++++++++++++++++++-- tools/confix/upgrade.go | 13 ++- 8 files changed, 305 insertions(+), 24 deletions(-) create mode 100644 tools/confix/data/v2-app.toml create mode 100644 tools/confix/data/v2-client.toml create mode 100644 tools/confix/match.go diff --git a/store/v2/commitment/iavl/config.go b/store/v2/commitment/iavl/config.go index d4b9b3bd0cb..027f8f2788b 100644 --- a/store/v2/commitment/iavl/config.go +++ b/store/v2/commitment/iavl/config.go @@ -2,8 +2,8 @@ package iavl // Config is the configuration for the IAVL tree. type Config struct { - CacheSize int `mapstructure:"cache_size" toml:"cache_size" comment:"CacheSize set the size of the iavl tree cache."` - SkipFastStorageUpgrade bool `mapstructure:"skip_fast_storage_upgrade" toml:"skip_fast_storage_upgrade" comment:"If true, the tree will work like no fast storage and always not upgrade fast storage."` + CacheSize int `mapstructure:"cache-size" toml:"cache-size" comment:"CacheSize set the size of the iavl tree cache."` + SkipFastStorageUpgrade bool `mapstructure:"skip-fast-storage-upgrade" toml:"skip-fast-storage-upgrade" comment:"If true, the tree will work like no fast storage and always not upgrade fast storage."` } // DefaultConfig returns the default configuration for the IAVL tree. diff --git a/tools/confix/cmd/migrate.go b/tools/confix/cmd/migrate.go index ccab1f4e217..a7122161d14 100644 --- a/tools/confix/cmd/migrate.go +++ b/tools/confix/cmd/migrate.go @@ -32,15 +32,31 @@ In case of any error in updating the file, no output is written.`, RunE: func(cmd *cobra.Command, args []string) error { var configPath string clientCtx := client.GetClientContextFromCmd(cmd) + + configType := confix.AppConfigType + isClient, _ := cmd.Flags().GetBool(confix.ClientConfigType) + + if isClient { + configType = confix.ClientConfigType + } + switch { case len(args) > 1: configPath = args[1] case clientCtx.HomeDir != "": - configPath = filepath.Join(clientCtx.HomeDir, "config", "app.toml") + suffix := "app.toml" + if isClient { + suffix = "client.toml" + } + configPath = filepath.Join(clientCtx.HomeDir, "config", suffix) default: return errors.New("must provide a path to the app.toml or client.toml") } + if strings.HasSuffix(configPath, "client.toml") && !isClient { + return errors.New("app.toml file expected, got client.toml, use --client flag to migrate client.toml") + } + targetVersion := args[0] plan, ok := confix.Migrations[targetVersion] if !ok { @@ -62,15 +78,10 @@ In case of any error in updating the file, no output is written.`, outputPath = "" } - configType := confix.AppConfigType - if ok, _ := cmd.Flags().GetBool(confix.ClientConfigType); ok { - configPath = strings.ReplaceAll(configPath, "app.toml", "client.toml") // for the case we are using the home dir of client ctx - configType = confix.ClientConfigType - } else if strings.HasSuffix(configPath, "client.toml") { - return errors.New("app.toml file expected, got client.toml, use --client flag to migrate client.toml") - } + // get transformation steps and formatDoc in which plan need to be applied + steps, formatDoc := plan(rawFile, targetVersion, configType) - if err := confix.Upgrade(ctx, plan(rawFile, targetVersion, configType), configPath, outputPath, FlagSkipValidate); err != nil { + if err := confix.Upgrade(ctx, steps, formatDoc, configPath, outputPath, FlagSkipValidate); err != nil { return fmt.Errorf("failed to migrate config: %w", err) } diff --git a/tools/confix/cmd/mutate.go b/tools/confix/cmd/mutate.go index 73ae7c3d1e7..772f38e7a86 100644 --- a/tools/confix/cmd/mutate.go +++ b/tools/confix/cmd/mutate.go @@ -73,7 +73,12 @@ func SetCommand() *cobra.Command { ctx = confix.WithLogWriter(ctx, cmd.ErrOrStderr()) } - return confix.Upgrade(ctx, plan, filename, outputPath, FlagSkipValidate) + doc, err := confix.LoadConfig(filename) + if err != nil { + return err + } + + return confix.Upgrade(ctx, plan, doc, filename, outputPath, FlagSkipValidate) }, } diff --git a/tools/confix/data/v2-app.toml b/tools/confix/data/v2-app.toml new file mode 100644 index 00000000000..6a93006eccf --- /dev/null +++ b/tools/confix/data/v2-app.toml @@ -0,0 +1,59 @@ +[comet] +# min-retain-blocks defines the minimum block height offset from the current block being committed, such that all blocks past this offset are pruned from CometBFT. A value of 0 indicates that no blocks should be pruned. +min-retain-blocks = 0 +# index-events defines the set of events in the form {eventType}.{attributeKey}, which informs CometBFT what to index. If empty, all events will be indexed. +index-events = [] +# halt-height contains a non-zero block height at which a node will gracefully halt and shutdown that can be used to assist upgrades and testing. +halt-height = 0 +# halt-time contains a non-zero minimum block time (in Unix seconds) at which a node will gracefully halt and shutdown that can be used to assist upgrades and testing. +halt-time = 0 +# address defines the CometBFT RPC server address to bind to. +address = 'tcp://127.0.0.1:26658' +# transport defines the CometBFT RPC server transport protocol: socket, grpc +transport = 'socket' +# trace enables the CometBFT RPC server to output trace information about its internal operations. +trace = false +# standalone starts the application without the CometBFT node. The node should be started separately. +standalone = false + +[grpc] +# Enable defines if the gRPC server should be enabled. +enable = true +# Address defines the gRPC server address to bind to. +address = 'localhost:9090' +# MaxRecvMsgSize defines the max message size in bytes the server can receive. +# The default value is 10MB. +max-recv-msg-size = 10485760 +# MaxSendMsgSize defines the max message size in bytes the server can send. +# The default value is math.MaxInt32. +max-send-msg-size = 2147483647 + +[store] +# The type of database for application and snapshots databases. +app-db-backend = 'goleveldb' + +[store.options] +# State storage database type. Currently we support: 0 for SQLite, 1 for Pebble +ss-type = 0 +# State commitment database type. Currently we support:0 for iavl, 1 for iavl v2 +sc-type = 0 + +# Pruning options for state storage +[store.options.ss-pruning-option] +# Number of recent heights to keep on disk. +keep-recent = 2 +# Height interval at which pruned heights are removed from disk. +interval = 1 + +# Pruning options for state commitment +[store.options.sc-pruning-option] +# Number of recent heights to keep on disk. +keep-recent = 2 +# Height interval at which pruned heights are removed from disk. +interval = 1 + +[store.options.iavl-config] +# CacheSize set the size of the iavl tree cache. +cache-size = 100000 +# If true, the tree will work like no fast storage and always not upgrade fast storage. +skip-fast-storage-upgrade = true diff --git a/tools/confix/data/v2-client.toml b/tools/confix/data/v2-client.toml new file mode 100644 index 00000000000..04fa4067a28 --- /dev/null +++ b/tools/confix/data/v2-client.toml @@ -0,0 +1,27 @@ +# This is a TOML config file. +# For more information, see https://github.com/toml-lang/toml + +############################################################################### +### Client Configuration ### +############################################################################### + +# The network chain ID +chain-id = "" +# The keyring's backend, where the keys are stored (os|file|kwallet|pass|test|memory) +keyring-backend = "test" +# Default key name, if set, defines the default key to use for signing transaction when the --from flag is not specified +keyring-default-keyname = "" +# CLI output format (text|json) +output = "text" +# : to CometBFT RPC interface for this chain +node = "tcp://localhost:26657" +# Transaction broadcasting mode (sync|async) +broadcast-mode = "sync" + +# gRPC server endpoint to which the client will connect. +# It can be overwritten by the --grpc-addr flag in each command. +grpc-address = "" + +# Allow the gRPC client to connect over insecure channels. +# It can be overwritten by the --grpc-insecure flag in each command. +grpc-insecure = false diff --git a/tools/confix/match.go b/tools/confix/match.go new file mode 100644 index 00000000000..9e05d5f0219 --- /dev/null +++ b/tools/confix/match.go @@ -0,0 +1,63 @@ +package confix + +import ( + "sort" + + "github.com/creachadair/tomledit" + "github.com/creachadair/tomledit/transform" +) + +// MatchKeys diffs the keyspaces of the TOML documents in files lhs and rhs. +// Comments, order, and values are ignored for comparison purposes. +// It will return in the format of map[oldKey]newKey +func MatchKeys(lhs, rhs *tomledit.Document) map[string]string { + matches := matchDocs(map[string]string{}, allKVs(lhs.Global), allKVs(rhs.Global)) + + lsec, rsec := lhs.Sections, rhs.Sections + transform.SortSectionsByName(lsec) + transform.SortSectionsByName(rsec) + + i, j := 0, 0 + for i < len(lsec) && j < len(rsec) { + switch { + case lsec[i].Name.Before(rsec[j].Name): + i++ + case rsec[j].Name.Before(lsec[i].Name): + j++ + default: + matches = matchDocs(matches, allKVs(lsec[i]), allKVs(rsec[j])) + i++ + j++ + } + } + + return matches +} + +// matchDocs get all the keys matching in lhs and rhs. +// value of keys are ignored +func matchDocs(matchesMap map[string]string, lhs, rhs []KV) map[string]string { + sort.Slice(lhs, func(i, j int) bool { + return lhs[i].Key < lhs[j].Key + }) + sort.Slice(rhs, func(i, j int) bool { + return rhs[i].Key < rhs[j].Key + }) + + i, j := 0, 0 + for i < len(lhs) && j < len(rhs) { + switch { + case lhs[i].Key < rhs[j].Key: + i++ + case lhs[i].Key > rhs[j].Key: + j++ + default: + // key exists in both lhs and rhs + matchesMap[lhs[i].Key] = rhs[j].Key + i++ + j++ + } + } + + return matchesMap +} diff --git a/tools/confix/migrations.go b/tools/confix/migrations.go index 2eece120fe5..737ed6b822c 100644 --- a/tools/confix/migrations.go +++ b/tools/confix/migrations.go @@ -19,7 +19,7 @@ const ( ) // MigrationMap defines a mapping from a version to a transformation plan. -type MigrationMap map[string]func(from *tomledit.Document, to, planType string) transform.Plan +type MigrationMap map[string]func(from *tomledit.Document, to, planType string) (transform.Plan, *tomledit.Document) var Migrations = MigrationMap{ "v0.45": NoPlan, // Confix supports only the current supported SDK version. So we do not support v0.44 -> v0.45. @@ -27,11 +27,34 @@ var Migrations = MigrationMap{ "v0.47": PlanBuilder, "v0.50": PlanBuilder, "v0.52": PlanBuilder, + "v2": V2PlanBuilder, // "v0.xx.x": PlanBuilder, // add specific migration in case of configuration changes in minor versions } +type v2KeyChangesMap map[string][]string + +// list all the keys which are need to be modified in v2 +var v2KeyChanges = v2KeyChangesMap{ + "min-retain-blocks": []string{"comet.min-retain-blocks"}, + "index-events": []string{"comet.index-events"}, + "halt-height": []string{"comet.halt-height"}, + "halt-time": []string{"comet.halt-time"}, + "app-db-backend": []string{"store.app-db-backend"}, + "pruning-keep-recent": []string{ + "store.options.ss-pruning-option.keep-recent", + "store.options.sc-pruning-option.keep-recent", + }, + "pruning-interval": []string{ + "store.options.ss-pruning-option.interval", + "store.options.sc-pruning-option.interval", + }, + "iavl-cache-size": []string{"store.options.iavl-config.cache-size"}, + "iavl-disable-fastnode": []string{"store.options.iavl-config.skip-fast-storage-upgrade"}, + // Add other key mappings as needed +} + // PlanBuilder is a function that returns a transformation plan for a given diff between two files. -func PlanBuilder(from *tomledit.Document, to, planType string) transform.Plan { +func PlanBuilder(from *tomledit.Document, to, planType string) (transform.Plan, *tomledit.Document) { plan := transform.Plan{} deletedSections := map[string]bool{} @@ -114,11 +137,105 @@ func PlanBuilder(from *tomledit.Document, to, planType string) transform.Plan { plan = append(plan, step) } - return plan + return plan, from } // NoPlan returns a no-op plan. -func NoPlan(_ *tomledit.Document, to, planType string) transform.Plan { +func NoPlan(from *tomledit.Document, to, planType string) (transform.Plan, *tomledit.Document) { fmt.Printf("no migration needed to %s\n", to) - return transform.Plan{} + return transform.Plan{}, from +} + +// V2PlanBuilder is a function that returns a transformation plan to convert to v2 config +func V2PlanBuilder(from *tomledit.Document, to, planType string) (transform.Plan, *tomledit.Document) { + target, err := LoadLocalConfig(to, planType) + if err != nil { + panic(fmt.Errorf("failed to parse file: %w. This file should have been valid", err)) + } + + plan := transform.Plan{} + plan = updateMatchedKeysPlan(from, target, plan) + plan = applyKeyChangesPlan(from, plan) + + return plan, target +} + +// updateMatchedKeysPlan updates all matched keys with old key values +func updateMatchedKeysPlan(from, target *tomledit.Document, plan transform.Plan) transform.Plan { + matches := MatchKeys(from, target) + for oldKey, newKey := range matches { + oldEntry := getEntry(from, oldKey) + if oldEntry == nil { + continue + } + + // check if the key "app-db-backend" exists and if its value is empty in the existing config + // If the value is empty, update the key value with the default value + // of v2 i.e., goleveldb to prevent network failures. + if isAppDBBackend(newKey, oldEntry) { + continue // lets keep app-db-backend with v2 default value + } + + // update newKey value with old entry value + step := createUpdateStep(oldKey, newKey, oldEntry) + plan = append(plan, step) + } + return plan +} + +// applyKeyChangesPlan checks if key changes are needed with the "to" version and applies them +func applyKeyChangesPlan(from *tomledit.Document, plan transform.Plan) transform.Plan { + changes := v2KeyChanges + for oldKey, newKeys := range changes { + oldEntry := getEntry(from, oldKey) + if oldEntry == nil { + continue + } + + for _, newKey := range newKeys { + // check if the key "app-db-backend" exists and if its value is empty in the existing config + // If the value is empty, update the key value with the default value + // of v2 i.e., goleveldb to prevent network failures. + if isAppDBBackend(newKey, oldEntry) { + continue // lets keep app-db-backend with v2 default value + } + + // update newKey value with old entry value + step := createUpdateStep(oldKey, newKey, oldEntry) + plan = append(plan, step) + } + } + return plan +} + +// getEntry retrieves the first entry for the given key from the document +func getEntry(doc *tomledit.Document, key string) *parser.KeyValue { + splitKeys := strings.Split(key, ".") + entry := doc.First(splitKeys...) + if entry == nil || entry.KeyValue == nil { + return nil + } + return entry.KeyValue +} + +// isAppDBBackend checks if the key is "store.app-db-backend" and the value is empty +func isAppDBBackend(key string, entry *parser.KeyValue) bool { + return key == "store.app-db-backend" && entry.Value.String() == `""` +} + +// createUpdateStep creates a transformation step to update a key with a new key value +func createUpdateStep(oldKey, newKey string, oldEntry *parser.KeyValue) transform.Step { + return transform.Step{ + Desc: fmt.Sprintf("updating %s key with %s key", oldKey, newKey), + T: transform.Func(func(_ context.Context, doc *tomledit.Document) error { + splitNewKeys := strings.Split(newKey, ".") + newEntry := doc.First(splitNewKeys...) + if newEntry == nil || newEntry.KeyValue == nil { + return nil + } + + newEntry.KeyValue.Value = oldEntry.Value + return nil + }), + } } diff --git a/tools/confix/upgrade.go b/tools/confix/upgrade.go index d6b4ff7f71a..d212bbfb792 100644 --- a/tools/confix/upgrade.go +++ b/tools/confix/upgrade.go @@ -28,16 +28,11 @@ import ( // Upgrade is a convenience wrapper for calls to LoadConfig, ApplyFixes, and // CheckValid. If the caller requires more control over the behavior of the // Upgrade, call those functions directly. -func Upgrade(ctx context.Context, plan transform.Plan, configPath, outputPath string, skipValidate bool) error { +func Upgrade(ctx context.Context, plan transform.Plan, doc *tomledit.Document, configPath, outputPath string, skipValidate bool) error { if configPath == "" { return errors.New("empty input configuration path") } - doc, err := LoadConfig(configPath) - if err != nil { - return fmt.Errorf("loading config: %w", err) - } - // transforms doc and reports whether it succeeded. if err := plan.Apply(ctx, doc); err != nil { return fmt.Errorf("updating %q: %w", configPath, err) @@ -48,14 +43,18 @@ func Upgrade(ctx context.Context, plan transform.Plan, configPath, outputPath st return fmt.Errorf("formatting config: %w", err) } + // ignore validation for serverv2 by checking any default field found in doc + isServerV2 := doc.First(strings.Split("store.options.ss-pruning-option", ".")...) != nil + // allow to skip validation - if !skipValidate { + if !skipValidate && !isServerV2 { // verify that file is valid after applying fixes if err := CheckValid(configPath, buf.Bytes()); err != nil { return fmt.Errorf("updated config is invalid: %w", err) } } + var err error if outputPath == "" { _, err = os.Stdout.Write(buf.Bytes()) } else { From 9b6f61e3d0236f7d6f33a9da50d6c007f007e064 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Mon, 29 Jul 2024 11:54:10 +0200 Subject: [PATCH 15/15] feat(indexer/postgres): block, tx and event schemas (#21078) --- indexer/postgres/base_sql.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/indexer/postgres/base_sql.go b/indexer/postgres/base_sql.go index 81e1ac70424..32eb38f364c 100644 --- a/indexer/postgres/base_sql.go +++ b/indexer/postgres/base_sql.go @@ -5,4 +5,29 @@ const BaseSQL = ` CREATE OR REPLACE FUNCTION nanos_to_timestamptz(nanos bigint) RETURNS timestamptz AS $$ SELECT to_timestamp(nanos / 1000000000) + (nanos / 1000000000) * INTERVAL '1 microsecond' $$ LANGUAGE SQL IMMUTABLE; + +CREATE TABLE IF NOT EXISTS block +( + number BIGINT NOT NULL PRIMARY KEY, + header JSONB NULL +); + +CREATE TABLE IF NOT EXISTS tx +( + id BIGSERIAL PRIMARY KEY, + block_number BIGINT NOT NULL REFERENCES block (number), + index_in_block BIGINT NOT NULL, + data JSONB NOT NULL +); + +CREATE TABLE IF NOT EXISTS event +( + id BIGSERIAL PRIMARY KEY, + block_number BIGINT NOT NULL REFERENCES block (number), + tx_id BIGINT NULL REFERENCES tx (id), + msg_index BIGINT NULL, + event_index BIGINT NULL, + type TEXT NOT NULL, + data JSONB NOT NULL +); `