Skip to content

Commit

Permalink
feat: update cosmwasm
Browse files Browse the repository at this point in the history
  • Loading branch information
gluax committed Oct 24, 2024
1 parent 9e4d72d commit 5dce834
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 15 deletions.
4 changes: 3 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ import (
"github.com/sedaprotocol/seda-chain/app/keepers"
appparams "github.com/sedaprotocol/seda-chain/app/params"
"github.com/sedaprotocol/seda-chain/app/utils"

// Used in cosmos-sdk when registering the route for swagger docs.
_ "github.com/sedaprotocol/seda-chain/client/docs/statik"
"github.com/sedaprotocol/seda-chain/x/batching"
Expand Down Expand Up @@ -282,6 +283,7 @@ func NewApp(
homePath string,
invCheckPeriod uint,
appOpts servertypes.AppOptions,
wasmDirectory string,
baseAppOptions ...func(*baseapp.BaseApp),
) *App {
/* =================================================== */
Expand Down Expand Up @@ -576,7 +578,7 @@ func NewApp(
// If evidence needs to be handled for the app, set routes in router here and seal
app.EvidenceKeeper = *evidenceKeeper

wasmDir := filepath.Join(homePath, "wasm")
wasmDir := filepath.Join(homePath, wasmDirectory)
wasmConfig, err := wasm.ReadWasmConfig(appOpts)
if err != nil {
panic(fmt.Sprintf("error while reading wasm config: %s", err))
Expand Down
9 changes: 5 additions & 4 deletions app/wasm.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package app

import "strings"

// The last arguments can contain custom message handlers, and custom query handlers,
// if we want to allow any custom callbacks
// See https://github.com/CosmWasm/cosmwasm/blob/main/docs/CAPABILITIES-BUILT-IN.md
Expand All @@ -13,8 +11,11 @@ var wasmCapabilities = []string{
"cosmwasm_1_2",
"cosmwasm_1_3",
"cosmwasm_1_4",
"cosmwasm_1_5",
"cosmwasm_2_0",
"cosmwasm_2_1",
}

func GetWasmCapabilities() string {
return strings.Join(wasmCapabilities, ",")
func GetWasmCapabilities() []string {
return wasmCapabilities
}
3 changes: 3 additions & 0 deletions cmd/sedad/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ func NewRootCmd() *cobra.Command {
app.DefaultNodeHome,
0,
simtestutil.NewAppOptionsWithFlagHome(tempDir()),
tempDir(),
baseapp.SetChainID("tempchainid"),
)
encodingConfig := app.EncodingConfig{
Expand Down Expand Up @@ -347,6 +348,7 @@ func newApp(
cast.ToString(appOpts.Get(sdkflags.FlagHome)),
cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod)),
appOpts,
"wasm",
baseapp.SetPruning(pruningOpts),
baseapp.SetMinGasPrices(cast.ToString(appOpts.Get(server.FlagMinGasPrices))),
baseapp.SetHaltHeight(cast.ToUint64(appOpts.Get(server.FlagHaltHeight))),
Expand Down Expand Up @@ -387,6 +389,7 @@ func appExport(
homePath,
uint(1),
appOpts,
tempDir(),
)

if height != -1 {
Expand Down
7 changes: 5 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ require (
cosmossdk.io/x/feegrant v0.1.1
cosmossdk.io/x/tx v0.13.4
cosmossdk.io/x/upgrade v0.1.4
github.com/CosmWasm/wasmd v0.50.0
github.com/CosmWasm/wasmd v0.53.0
github.com/CosmWasm/wasmvm v1.5.4
github.com/aws/aws-sdk-go v1.55.5
github.com/cometbft/cometbft v0.38.12
Expand All @@ -45,7 +45,7 @@ require (
github.com/pkg/errors v0.9.1
github.com/rakyll/statik v0.1.7
github.com/rs/zerolog v1.33.0
github.com/sedaprotocol/seda-wasm-vm/tallyvm v1.3.0
github.com/sedaprotocol/seda-wasm-vm/tallyvm v1.3.1
github.com/spf13/cast v1.7.0
github.com/spf13/cobra v1.8.1
github.com/spf13/pflag v1.0.5
Expand All @@ -70,6 +70,7 @@ require (
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
github.com/99designs/keyring v1.2.2 // indirect
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
github.com/CosmWasm/wasmvm/v2 v2.1.3 // indirect
github.com/DataDog/datadog-go v4.8.3+incompatible // indirect
github.com/DataDog/zstd v1.5.5 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
Expand Down Expand Up @@ -100,6 +101,7 @@ require (
github.com/cosmos/btcutil v1.0.5 // indirect
github.com/cosmos/gogogateway v1.2.0 // indirect
github.com/cosmos/iavl v1.2.0 // indirect
github.com/cosmos/ibc-go/modules/apps/callbacks v0.2.1-0.20231113120333-342c00b0f8bd // indirect
github.com/cosmos/ics23/go v0.10.0 // indirect
github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect
github.com/cosmos/rosetta-sdk-go v0.10.0 // indirect
Expand Down Expand Up @@ -204,6 +206,7 @@ require (
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sasha-s/go-deadlock v0.3.1 // indirect
github.com/shamaton/msgpack/v2 v2.2.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
Expand Down
14 changes: 10 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,12 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/CosmWasm/wasmd v0.50.0 h1:NVaGqCSTRfb9UTDHJwT6nQIWcb6VjlQl88iI+u1+qjE=
github.com/CosmWasm/wasmd v0.50.0/go.mod h1:UjmShW4l9YxaMytwJZ7IB7MWzHiynSZP3DdWrG0FRtk=
github.com/CosmWasm/wasmd v0.53.0 h1:kdaoAi20bIb4VCsxw9pRaT2g5PpIp82Wqrr9DRVN9ao=
github.com/CosmWasm/wasmd v0.53.0/go.mod h1:FJl/aWjdpGof3usAMFQpDe07Rkx77PUzp0cygFMOvtw=
github.com/CosmWasm/wasmvm v1.5.4 h1:Opqy65ubJ8bMsT08dn85VjRdsLJVPIAgIXif92qOMGc=
github.com/CosmWasm/wasmvm v1.5.4/go.mod h1:Q0bSEtlktzh7W2hhEaifrFp1Erx11ckQZmjq8FLCyys=
github.com/CosmWasm/wasmvm/v2 v2.1.3 h1:CSJTauZqkHyb9yic6JVYCjiGUgxI2MJV2QzfSu8m49c=
github.com/CosmWasm/wasmvm/v2 v2.1.3/go.mod h1:bMhLQL4Yp9CzJi9A83aR7VO9wockOsSlZbT4ztOl6bg=
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q=
github.com/DataDog/datadog-go v4.8.3+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
Expand Down Expand Up @@ -394,6 +396,8 @@ github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM=
github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI=
github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8 v8.0.1 h1:BHn+JWZILxkUT9IrlP1ctUfo9ENGi+EmiZ9om1XSHIw=
github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8 v8.0.1/go.mod h1:82hPO/tRawbuFad2gPwChvpZ0JEIoNi91LwVneAYCeM=
github.com/cosmos/ibc-go/modules/apps/callbacks v0.2.1-0.20231113120333-342c00b0f8bd h1:Lx+/5dZ/nN6qPXP2Ofog6u1fmlkCFA1ElcOconnofEM=
github.com/cosmos/ibc-go/modules/apps/callbacks v0.2.1-0.20231113120333-342c00b0f8bd/go.mod h1:JWfpWVKJKiKtd53/KbRoKfxWl8FsT2GPcNezTOk0o5Q=
github.com/cosmos/ibc-go/modules/capability v1.0.1 h1:ibwhrpJ3SftEEZRxCRkH0fQZ9svjthrX2+oXdZvzgGI=
github.com/cosmos/ibc-go/modules/capability v1.0.1/go.mod h1:rquyOV262nGJplkumH+/LeYs04P3eV8oB7ZM4Ygqk4E=
github.com/cosmos/ibc-go/v8 v8.4.0 h1:K2PfX0AZ+1XKZytHGEMuSjQXG/MZshPb83RSTQt2+cE=
Expand Down Expand Up @@ -1017,8 +1021,10 @@ github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg
github.com/seccomp/libseccomp-golang v0.9.2-0.20220502022130-f33da4d89646/go.mod h1:JA8cRccbGaA1s33RQf7Y1+q9gHmZX1yB/z9WDN1C6fg=
github.com/sedaprotocol/rosetta-seda v0.0.0-20240427181737-e1d7563b2529 h1:VbJcd022MkoohRyAfktHnN99Brt/4eJr01mdLqPhGaE=
github.com/sedaprotocol/rosetta-seda v0.0.0-20240427181737-e1d7563b2529/go.mod h1:GdlDqGJN2g55PHiwYJs2bQMlL0rdlQQbauK4dcrOI6w=
github.com/sedaprotocol/seda-wasm-vm/tallyvm v1.3.0 h1:V9QkO7LgzshDPfKg608ycgJK82XCmMcJq/bQD+//bx0=
github.com/sedaprotocol/seda-wasm-vm/tallyvm v1.3.0/go.mod h1:AaX9uRy6qD2q+o1SapTRnGUe9HHZWTmBN2BVNAptq3U=
github.com/sedaprotocol/seda-wasm-vm/tallyvm v1.3.1 h1:mGT3yGW0fKSk9t89ULK7eG7SAgafLgnPdZLhdJ7g+7U=
github.com/sedaprotocol/seda-wasm-vm/tallyvm v1.3.1/go.mod h1:AaX9uRy6qD2q+o1SapTRnGUe9HHZWTmBN2BVNAptq3U=
github.com/shamaton/msgpack/v2 v2.2.0 h1:IP1m01pHwCrMa6ZccP9B3bqxEMKMSmMVAVKk54g3L/Y=
github.com/shamaton/msgpack/v2 v2.2.0/go.mod h1:6khjYnkx73f7VQU7wjcFS9DFjs+59naVWJv1TB7qdOI=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
Expand Down
6 changes: 6 additions & 0 deletions simulation/simulation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ func BenchmarkSimulation(b *testing.B) {
app.DefaultNodeHome,
0,
appOptions,
os.TempDir(),
baseapp.SetChainID(config.ChainID),
)
require.Equal(b, app.Name, bApp.Name())
Expand Down Expand Up @@ -158,6 +159,7 @@ func TestAppStateDeterminism(t *testing.T) {
app.DefaultNodeHome,
simcli.FlagPeriodValue,
appOptions,
os.TempDir(),
fauxMerkleModeOpt,
baseapp.SetChainID(chainID),
)
Expand Down Expand Up @@ -235,6 +237,7 @@ func TestAppExportImport(t *testing.T) {
app.DefaultNodeHome,
0,
appOptions,
os.TempDir(),
baseapp.SetChainID(config.ChainID),
)
require.Equal(t, app.Name, bApp.Name())
Expand Down Expand Up @@ -295,6 +298,7 @@ func TestAppExportImport(t *testing.T) {
app.DefaultNodeHome,
0,
appOptions,
os.TempDir(),
baseapp.SetChainID(config.ChainID),
)
require.Equal(t, app.Name, bApp.Name())
Expand Down Expand Up @@ -388,6 +392,7 @@ func TestAppSimulationAfterImport(t *testing.T) {
app.DefaultNodeHome,
0,
appOptions,
os.TempDir(),
fauxMerkleModeOpt,
baseapp.SetChainID(config.ChainID),
)
Expand Down Expand Up @@ -454,6 +459,7 @@ func TestAppSimulationAfterImport(t *testing.T) {
app.DefaultNodeHome,
0,
appOptions,
os.TempDir(),
fauxMerkleModeOpt,
baseapp.SetChainID(config.ChainID),
)
Expand Down
6 changes: 4 additions & 2 deletions x/batching/keeper/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package keeper_test

import (
"bytes"
"strings"
"testing"
"time"

Expand Down Expand Up @@ -64,6 +63,9 @@ var wasmCapabilities = []string{
"cosmwasm_1_2",
"cosmwasm_1_3",
"cosmwasm_1_4",
"cosmwasm_1_5",
"cosmwasm_2_0",
"cosmwasm_2_1",
}

const (
Expand Down Expand Up @@ -163,7 +165,7 @@ func initFixture(tb testing.TB) *fixture {
nil, nil, nil, nil,
tempDir,
wasmtypes.DefaultWasmConfig(),
strings.Join(wasmCapabilities, ","),
wasmCapabilities,
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
[]wasmkeeper.Option{}...,
)
Expand Down
3 changes: 1 addition & 2 deletions x/tally/keeper/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package keeper_test
import (
"bytes"
"encoding/json"
"strings"
"testing"
"time"

Expand Down Expand Up @@ -160,7 +159,7 @@ func initFixture(tb testing.TB) *fixture {
nil,
tempDir,
wasmtypes.DefaultWasmConfig(),
strings.Join(wasmCapabilities, ","),
wasmCapabilities,
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
[]wasmkeeper.Option{}...,
)
Expand Down

0 comments on commit 5dce834

Please sign in to comment.