From 781d9007e843db5b0b5502812a223c2bd01d6d80 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 20 Sep 2024 10:49:27 +0000 Subject: [PATCH] refactor(simapp/v2): remove RunWithCtx (backport #21739) (#21826) Co-authored-by: Matt Kocubinski Co-authored-by: Julien Robert --- server/v2/cometbft/abci_test.go | 6 ++++-- server/v2/cometbft/go.mod | 6 +++--- server/v2/cometbft/go.sum | 12 ++++++------ simapp/v2/app_di.go | 1 + simapp/v2/go.mod | 10 +++++----- simapp/v2/go.sum | 20 ++++++++++---------- simapp/v2/simdv2/cmd/root_di.go | 1 + 7 files changed, 30 insertions(+), 26 deletions(-) diff --git a/server/v2/cometbft/abci_test.go b/server/v2/cometbft/abci_test.go index 72801a61197..3af3fbec8f2 100644 --- a/server/v2/cometbft/abci_test.go +++ b/server/v2/cometbft/abci_test.go @@ -678,8 +678,10 @@ func setUpConsensus(t *testing.T, gasLimit uint64, mempool mempool.Mempool[mock. ValidateTxGasLimit: gasLimit, QueryGasLimit: gasLimit, SimulationGasLimit: gasLimit, - InitGenesis: func(ctx context.Context, src io.Reader, txHandler func(json.RawMessage) error) error { - return nil + InitGenesis: func(ctx context.Context, src io.Reader, txHandler func(json.RawMessage) error) (store.WriterMap, error) { + _, st, err := mockStore.StateLatest() + require.NoError(t, err) + return branch.DefaultNewWriterMap(st), nil }, } diff --git a/server/v2/cometbft/go.mod b/server/v2/cometbft/go.mod index cfec5280e36..8dc98a1688d 100644 --- a/server/v2/cometbft/go.mod +++ b/server/v2/cometbft/go.mod @@ -20,9 +20,9 @@ require ( cosmossdk.io/core v1.0.0 // main cosmossdk.io/errors v1.0.1 cosmossdk.io/log v1.4.1 - cosmossdk.io/server/v2 v2.0.0-20240918153713-01212de2d9dc // main - cosmossdk.io/server/v2/appmanager v0.0.0-20240918153713-01212de2d9dc // main - cosmossdk.io/server/v2/stf v0.0.0-20240918153713-01212de2d9dc // main + cosmossdk.io/server/v2 v2.0.0-20240920095614-aa90bb43d8f8 // main + cosmossdk.io/server/v2/appmanager v0.0.0-20240920095614-aa90bb43d8f8 // main + cosmossdk.io/server/v2/stf v0.0.0-20240920095614-aa90bb43d8f8 // main cosmossdk.io/store/v2 v2.0.0-20240916221850-7856d226038c // main cosmossdk.io/x/consensus v0.0.0-00010101000000-000000000000 github.com/cometbft/cometbft v1.0.0-rc1.0.20240908111210-ab0be101882f diff --git a/server/v2/cometbft/go.sum b/server/v2/cometbft/go.sum index ee152374655..bd4eb8e0e07 100644 --- a/server/v2/cometbft/go.sum +++ b/server/v2/cometbft/go.sum @@ -24,12 +24,12 @@ cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/schema v0.3.0 h1:01lcaM4trhzZ1HQTfTV8z6Ma1GziOZ/YmdzBN3F720c= cosmossdk.io/schema v0.3.0/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= -cosmossdk.io/server/v2 v2.0.0-20240918153713-01212de2d9dc h1:6lX4zEWS3jApSahbytOB0YVgdV4DEPK0pt06227h9Ng= -cosmossdk.io/server/v2 v2.0.0-20240918153713-01212de2d9dc/go.mod h1:OOnpz5j7kFoqr9gSJ4vdM4tq6FXXuJJm7KlikmyTYKk= -cosmossdk.io/server/v2/appmanager v0.0.0-20240918153713-01212de2d9dc h1:eEAmv+489lbcPJ+xWlyRR4CPCSBEYY7jJ7ayHYJwAfM= -cosmossdk.io/server/v2/appmanager v0.0.0-20240918153713-01212de2d9dc/go.mod h1:qMT4t+uQP/gnfWtA3XTHsDCicXHRyYHxnLyEpRIHVxs= -cosmossdk.io/server/v2/stf v0.0.0-20240918153713-01212de2d9dc h1:K7VVR3N2slgDcl+QMZp9LUpsrT1huGIiWoYBndagW/A= -cosmossdk.io/server/v2/stf v0.0.0-20240918153713-01212de2d9dc/go.mod h1:e/pdNHJIOxL1wFKGkERDxLY0chj0+ZIetIPTkRgjX2o= +cosmossdk.io/server/v2 v2.0.0-20240920095614-aa90bb43d8f8 h1:f9ngoXKselr0qkU0YWC0p/uvCI8/CqXBhzbx6jorQ/4= +cosmossdk.io/server/v2 v2.0.0-20240920095614-aa90bb43d8f8/go.mod h1:OOnpz5j7kFoqr9gSJ4vdM4tq6FXXuJJm7KlikmyTYKk= +cosmossdk.io/server/v2/appmanager v0.0.0-20240920095614-aa90bb43d8f8 h1:OyZVYhHSPxSCKJvxIh5QWFyPKUj0bV6PPIiuxnYGVcU= +cosmossdk.io/server/v2/appmanager v0.0.0-20240920095614-aa90bb43d8f8/go.mod h1:/xDfniqVtn5nraiHkNJ4e6rYU0e83YAGsSjwmUA6H8k= +cosmossdk.io/server/v2/stf v0.0.0-20240920095614-aa90bb43d8f8 h1:nPZQrhpMT26r8QZ7pLuJeWTFIeOFpq24y26P0ED4iW8= +cosmossdk.io/server/v2/stf v0.0.0-20240920095614-aa90bb43d8f8/go.mod h1:e/pdNHJIOxL1wFKGkERDxLY0chj0+ZIetIPTkRgjX2o= cosmossdk.io/store v1.0.0-rc.0.0.20240913190136-3bc707a5a214 h1:UUW0+2UgbDwQ452o2aw4DrVSWmowcad7DB7Vln+N94I= cosmossdk.io/store v1.0.0-rc.0.0.20240913190136-3bc707a5a214/go.mod h1:ct8HATr+s48YYTRXEyP3HF33v9qEVWHMxwOL8P/v4iQ= cosmossdk.io/store/v2 v2.0.0-20240916221850-7856d226038c h1:x0NX01A+QWckckb1hi9p8mYW4OXTYEzsohQK2qBtIHg= diff --git a/simapp/v2/app_di.go b/simapp/v2/app_di.go index 3a324562763..25f62b8f3ca 100644 --- a/simapp/v2/app_di.go +++ b/simapp/v2/app_di.go @@ -69,6 +69,7 @@ func NewSimApp[T transaction.Tx]( // merge the AppConfig and other configuration in one config appConfig = depinject.Configs( AppConfig(), + runtime.DefaultServiceBindings(), depinject.Supply( logger, viper, diff --git a/simapp/v2/go.mod b/simapp/v2/go.mod index 46c6e6abcc5..ef59f2667c4 100644 --- a/simapp/v2/go.mod +++ b/simapp/v2/go.mod @@ -10,8 +10,8 @@ require ( cosmossdk.io/depinject v1.0.0 cosmossdk.io/log v1.4.1 cosmossdk.io/math v1.3.0 - cosmossdk.io/runtime/v2 v2.0.0-20240916221850-7856d226038c // main - cosmossdk.io/server/v2 v2.0.0-20240918153713-01212de2d9dc // main + cosmossdk.io/runtime/v2 v2.0.0-20240920095614-aa90bb43d8f8 // main + cosmossdk.io/server/v2 v2.0.0-20240920095614-aa90bb43d8f8 // main cosmossdk.io/server/v2/cometbft v0.0.0-00010101000000-000000000000 cosmossdk.io/store/v2 v2.0.0-20240916221850-7856d226038c // main cosmossdk.io/tools/confix v0.0.0-00010101000000-000000000000 @@ -56,8 +56,8 @@ require ( cosmossdk.io/errors v1.0.1 // indirect cosmossdk.io/errors/v2 v2.0.0-20240731132947-df72853b3ca5 // indirect cosmossdk.io/schema v0.3.0 // indirect - cosmossdk.io/server/v2/appmanager v0.0.0-20240918153713-01212de2d9dc // indirect; main - cosmossdk.io/server/v2/stf v0.0.0-20240918153713-01212de2d9dc // indirect; main + cosmossdk.io/server/v2/appmanager v0.0.0-20240920095614-aa90bb43d8f8 // indirect; main + cosmossdk.io/server/v2/stf v0.0.0-20240920095614-aa90bb43d8f8 // indirect; main cosmossdk.io/store v1.1.1-0.20240909133312-50288938d1b6 // indirect; main cosmossdk.io/x/accounts/defaults/base v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/accounts/defaults/lockup v0.0.0-20240417181816-5e7aae0db1f5 // indirect @@ -249,7 +249,7 @@ replace ( cosmossdk.io/api => cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 // main cosmossdk.io/client/v2 => ../../client/v2 // pseudo version lower than the latest tag - cosmossdk.io/core => cosmossdk.io/core v1.0.0-alpha.3 // main + cosmossdk.io/core => cosmossdk.io/core v1.0.0-alpha.3.0.20240920095614-aa90bb43d8f8 // main cosmossdk.io/server/v2/cometbft => ../../server/v2/cometbft // pseudo version lower than the latest tag cosmossdk.io/store => cosmossdk.io/store v1.0.0-rc.0.0.20240913190136-3bc707a5a214 // main diff --git a/simapp/v2/go.sum b/simapp/v2/go.sum index 18f0786da45..dcbe2bb110a 100644 --- a/simapp/v2/go.sum +++ b/simapp/v2/go.sum @@ -196,8 +196,8 @@ cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 h1:YV9M+9pClbzPncO5XMSc3kI cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897/go.mod h1:oqpDMZQpEgSo0Cm4F+0yxoC9UQbo/SlodZR4zeOqBsE= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab h1:E/IWad76v1Nc4Atswaccpt7twJ0VwHkbY94/PhmZfTo= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab/go.mod h1:Or+5eVAo1aiS1DnPK90eQykGc59LGBWtqwBoJcxXTmw= -cosmossdk.io/core v1.0.0-alpha.3 h1:pnxaYAas7llXgVz1lM7X6De74nWrhNKnB3yMKe4OUUA= -cosmossdk.io/core v1.0.0-alpha.3/go.mod h1:3u9cWq1FAVtiiCrDPpo4LhR+9V6k/ycSG4/Y/tREWCY= +cosmossdk.io/core v1.0.0-alpha.3.0.20240920095614-aa90bb43d8f8 h1:kBXv2cxy3M6nGQozQBAg6fmzeLT839GRuOy3CuITDbY= +cosmossdk.io/core v1.0.0-alpha.3.0.20240920095614-aa90bb43d8f8/go.mod h1:3u9cWq1FAVtiiCrDPpo4LhR+9V6k/ycSG4/Y/tREWCY= cosmossdk.io/core/testing v0.0.0-20240913164418-aaf72f20c10b h1:uEMbr7Hdpz0fU+GXU6mSN2vgoQnr66WYUpRuiba2aEk= cosmossdk.io/core/testing v0.0.0-20240913164418-aaf72f20c10b/go.mod h1:FllCSj/ZYskfb982HKqBSISO8DkBY4Euqq768HSFz68= cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= @@ -210,16 +210,16 @@ cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= -cosmossdk.io/runtime/v2 v2.0.0-20240916221850-7856d226038c h1:vnh9YoW/8fyrSpkyhHnUk3DymwmpE5U2ooRdJImfwEo= -cosmossdk.io/runtime/v2 v2.0.0-20240916221850-7856d226038c/go.mod h1:d0B92058w/s/Yegf0ySClPPJn+Vp7Cz+H3ORggSSGm4= +cosmossdk.io/runtime/v2 v2.0.0-20240920095614-aa90bb43d8f8 h1:Pt87wX5wD/skW7ALfiHrIBzB7HNKPNzYKwLXHs/52vA= +cosmossdk.io/runtime/v2 v2.0.0-20240920095614-aa90bb43d8f8/go.mod h1:hKm9tvxe1a82KH2KfPlAaFk31cjNIC/N8KGQzuwmfi4= cosmossdk.io/schema v0.3.0 h1:01lcaM4trhzZ1HQTfTV8z6Ma1GziOZ/YmdzBN3F720c= cosmossdk.io/schema v0.3.0/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= -cosmossdk.io/server/v2 v2.0.0-20240918153713-01212de2d9dc h1:6lX4zEWS3jApSahbytOB0YVgdV4DEPK0pt06227h9Ng= -cosmossdk.io/server/v2 v2.0.0-20240918153713-01212de2d9dc/go.mod h1:OOnpz5j7kFoqr9gSJ4vdM4tq6FXXuJJm7KlikmyTYKk= -cosmossdk.io/server/v2/appmanager v0.0.0-20240918153713-01212de2d9dc h1:eEAmv+489lbcPJ+xWlyRR4CPCSBEYY7jJ7ayHYJwAfM= -cosmossdk.io/server/v2/appmanager v0.0.0-20240918153713-01212de2d9dc/go.mod h1:qMT4t+uQP/gnfWtA3XTHsDCicXHRyYHxnLyEpRIHVxs= -cosmossdk.io/server/v2/stf v0.0.0-20240918153713-01212de2d9dc h1:K7VVR3N2slgDcl+QMZp9LUpsrT1huGIiWoYBndagW/A= -cosmossdk.io/server/v2/stf v0.0.0-20240918153713-01212de2d9dc/go.mod h1:e/pdNHJIOxL1wFKGkERDxLY0chj0+ZIetIPTkRgjX2o= +cosmossdk.io/server/v2 v2.0.0-20240920095614-aa90bb43d8f8 h1:f9ngoXKselr0qkU0YWC0p/uvCI8/CqXBhzbx6jorQ/4= +cosmossdk.io/server/v2 v2.0.0-20240920095614-aa90bb43d8f8/go.mod h1:OOnpz5j7kFoqr9gSJ4vdM4tq6FXXuJJm7KlikmyTYKk= +cosmossdk.io/server/v2/appmanager v0.0.0-20240920095614-aa90bb43d8f8 h1:OyZVYhHSPxSCKJvxIh5QWFyPKUj0bV6PPIiuxnYGVcU= +cosmossdk.io/server/v2/appmanager v0.0.0-20240920095614-aa90bb43d8f8/go.mod h1:/xDfniqVtn5nraiHkNJ4e6rYU0e83YAGsSjwmUA6H8k= +cosmossdk.io/server/v2/stf v0.0.0-20240920095614-aa90bb43d8f8 h1:nPZQrhpMT26r8QZ7pLuJeWTFIeOFpq24y26P0ED4iW8= +cosmossdk.io/server/v2/stf v0.0.0-20240920095614-aa90bb43d8f8/go.mod h1:e/pdNHJIOxL1wFKGkERDxLY0chj0+ZIetIPTkRgjX2o= cosmossdk.io/store v1.0.0-rc.0.0.20240913190136-3bc707a5a214 h1:UUW0+2UgbDwQ452o2aw4DrVSWmowcad7DB7Vln+N94I= cosmossdk.io/store v1.0.0-rc.0.0.20240913190136-3bc707a5a214/go.mod h1:ct8HATr+s48YYTRXEyP3HF33v9qEVWHMxwOL8P/v4iQ= cosmossdk.io/store/v2 v2.0.0-20240916221850-7856d226038c h1:x0NX01A+QWckckb1hi9p8mYW4OXTYEzsohQK2qBtIHg= diff --git a/simapp/v2/simdv2/cmd/root_di.go b/simapp/v2/simdv2/cmd/root_di.go index fd5b62b9384..1ad834b53a5 100644 --- a/simapp/v2/simdv2/cmd/root_di.go +++ b/simapp/v2/simdv2/cmd/root_di.go @@ -37,6 +37,7 @@ func NewRootCmd[T transaction.Tx]() *cobra.Command { if err := depinject.Inject( depinject.Configs( simapp.AppConfig(), + runtime.DefaultServiceBindings(), depinject.Supply(log.NewNopLogger()), depinject.Provide( codec.ProvideInterfaceRegistry,