Skip to content

Commit e354a2d

Browse files
authored
Merge pull request #702 from axone-protocol/feat/bump-wasm-0.52.0
Feat/bump wasm 0.52.0
2 parents eb3ea9e + d82e0c4 commit e354a2d

File tree

7 files changed

+155
-135
lines changed

7 files changed

+155
-135
lines changed

Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ FROM golang:1.21-alpine3.18 AS go-builder
44
WORKDIR /src
55

66
# CosmWasm: see https://github.com/CosmWasm/wasmvm/releases
7-
ADD https://github.com/CosmWasm/wasmvm/releases/download/v2.0.0/libwasmvm_muslc.aarch64.a /lib/libwasmvm_muslc.aarch64.a
8-
ADD https://github.com/CosmWasm/wasmvm/releases/download/v2.0.0/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.x86_64.a
7+
ADD https://github.com/CosmWasm/wasmvm/releases/download/v2.1.0/libwasmvm_muslc.aarch64.a /lib/libwasmvm_muslc.aarch64.a
8+
ADD https://github.com/CosmWasm/wasmvm/releases/download/v2.1.0/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.x86_64.a
99

1010
# hadolint ignore=DL4006
1111
RUN set -eux \
1212
&& apk add --no-cache ca-certificates=20240226-r0 build-base=0.5-r3 git=2.40.1-r0 linux-headers=6.3-r0 \
13-
&& sha256sum /lib/libwasmvm_muslc.aarch64.a | grep 3b478b3e51d31e53ce9324a8895d2cd7278af5179b9a02ea55d8627958e42afa \
14-
&& sha256sum /lib/libwasmvm_muslc.x86_64.a | grep ca08bb7b73b49b483611d9755bb8455620bb8c0faf3014400908ed49bf3b19a5
13+
&& sha256sum /lib/libwasmvm_muslc.aarch64.a | grep 06945cae8fced839a2be0980887a1c5d04d15fd29837ac644a648d555c49ab4d \
14+
&& sha256sum /lib/libwasmvm_muslc.x86_64.a | grep df4bd912c35be48781a40edea88fd5f409c643fb27e0dc043184ef51dc50a1cc
1515

1616
COPY . /src/
1717

app/app.go

Lines changed: 42 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"net/http"
1010
"os"
1111
"path/filepath"
12-
"slices"
1312
"sort"
1413

1514
"github.com/CosmWasm/wasmd/x/wasm"
@@ -20,8 +19,6 @@ import (
2019
"github.com/ignite/cli/ignite/pkg/openapiconsole"
2120
"github.com/prometheus/client_golang/prometheus"
2221
"github.com/spf13/cast"
23-
"google.golang.org/protobuf/reflect/protodesc"
24-
"google.golang.org/protobuf/types/descriptorpb"
2522

2623
abci "github.com/cometbft/cometbft/abci/types"
2724
tmos "github.com/cometbft/cometbft/libs/os"
@@ -111,6 +108,7 @@ import (
111108
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
112109
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
113110

111+
ibccallbacks "github.com/cosmos/ibc-go/modules/apps/callbacks"
114112
"github.com/cosmos/ibc-go/modules/capability"
115113
capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper"
116114
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
@@ -493,6 +491,7 @@ func New(
493491
// register the governance hooks
494492
),
495493
)
494+
496495
// Create IBC Keeper
497496
app.IBCKeeper = ibckeeper.NewKeeper(
498497
appCodec,
@@ -504,6 +503,16 @@ func New(
504503
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
505504
)
506505

506+
// IBC Fee Module keeper
507+
app.IBCFeeKeeper = ibcfeekeeper.NewKeeper(
508+
appCodec, keys[ibcfeetypes.StoreKey],
509+
app.IBCKeeper.ChannelKeeper, // may be replaced with IBC middleware
510+
app.IBCKeeper.ChannelKeeper,
511+
app.IBCKeeper.PortKeeper,
512+
app.AccountKeeper,
513+
app.BankKeeper,
514+
)
515+
507516
// Create Transfer Keepers
508517
app.TransferKeeper = ibctransferkeeper.NewKeeper(
509518
appCodec,
@@ -518,16 +527,6 @@ func New(
518527
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
519528
)
520529

521-
// IBC Fee Module keeper
522-
app.IBCFeeKeeper = ibcfeekeeper.NewKeeper(
523-
appCodec, keys[ibcfeetypes.StoreKey],
524-
app.IBCKeeper.ChannelKeeper, // may be replaced with IBC middleware
525-
app.IBCKeeper.ChannelKeeper,
526-
app.IBCKeeper.PortKeeper,
527-
app.AccountKeeper,
528-
app.BankKeeper,
529-
)
530-
531530
app.ICAHostKeeper = icahostkeeper.NewKeeper(
532531
appCodec,
533532
keys[icahosttypes.StoreKey],
@@ -540,6 +539,8 @@ func New(
540539
app.MsgServiceRouter(),
541540
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
542541
)
542+
// set grpc router for ica host
543+
app.ICAHostKeeper.WithQueryRouter(app.GRPCQueryRouter())
543544

544545
app.ICAControllerKeeper = icacontrollerkeeper.NewKeeper(
545546
appCodec,
@@ -606,36 +607,53 @@ func New(
606607
app.GRPCQueryRouter(),
607608
wasmDir,
608609
wasmConfig,
609-
axonewasm.AllCapabilities(),
610+
wasmkeeper.BuiltInCapabilities(),
610611
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
611612
wasmOpts...,
612613
)
613614

614-
// Create Transfer Stack
615-
var transferStack ibcporttypes.IBCModule
616-
transferStack = transfer.NewIBCModule(app.TransferKeeper)
617-
transferStack = ibcfee.NewIBCMiddleware(transferStack, app.IBCFeeKeeper)
615+
// Create fee enabled wasm ibc Stack
616+
var wasmStack ibcporttypes.IBCModule
617+
wasmStackIBCHandler := wasm.NewIBCHandler(app.WasmKeeper, app.IBCKeeper.ChannelKeeper, app.IBCFeeKeeper)
618+
wasmStack = ibcfee.NewIBCMiddleware(wasmStackIBCHandler, app.IBCFeeKeeper)
619+
618620
// Create Interchain Accounts Stack
619621
// SendPacket, since it is originating from the application to core IBC:
620622
// icaAuthModuleKeeper.SendTx -> icaController.SendPacket -> fee.SendPacket -> channel.SendPacket
621623
var icaControllerStack ibcporttypes.IBCModule
624+
622625
// integration point for custom authentication modules
623626
//nolint:lll
624627
// see https://medium.com/the-interchain-foundation/ibc-go-v6-changes-to-interchain-accounts-and-how-it-impacts-your-chain-806c185300d7
625628
var noAuthzModule ibcporttypes.IBCModule
626629
icaControllerStack = icacontroller.NewIBCMiddleware(noAuthzModule, app.ICAControllerKeeper)
630+
icaControllerStack = icacontroller.NewIBCMiddleware(icaControllerStack, app.ICAControllerKeeper)
631+
icaControllerStack = ibccallbacks.NewIBCMiddleware(
632+
icaControllerStack,
633+
app.IBCFeeKeeper,
634+
wasmStackIBCHandler,
635+
wasm.DefaultMaxIBCCallbackGas,
636+
)
637+
icaICS4Wrapper := icaControllerStack.(ibcporttypes.ICS4Wrapper)
627638
icaControllerStack = ibcfee.NewIBCMiddleware(icaControllerStack, app.IBCFeeKeeper)
628639

640+
// Since the callbacks middleware itself is an ics4wrapper, it needs to be passed to the ica controller keeper
641+
app.ICAControllerKeeper.WithICS4Wrapper(icaICS4Wrapper)
642+
629643
// RecvPacket, message that originates from core IBC and goes down to app, the flow is:
630644
// channel.RecvPacket -> fee.OnRecvPacket -> icaHost.OnRecvPacket
631645
var icaHostStack ibcporttypes.IBCModule
632646
icaHostStack = icahost.NewIBCModule(app.ICAHostKeeper)
633647
icaHostStack = ibcfee.NewIBCMiddleware(icaHostStack, app.IBCFeeKeeper)
634648

635-
// Create fee enabled wasm ibc Stack
636-
var wasmStack ibcporttypes.IBCModule
637-
wasmStack = wasm.NewIBCHandler(app.WasmKeeper, app.IBCKeeper.ChannelKeeper, app.IBCFeeKeeper)
638-
wasmStack = ibcfee.NewIBCMiddleware(wasmStack, app.IBCFeeKeeper)
649+
// Create Transfer Stack
650+
var transferStack ibcporttypes.IBCModule
651+
transferStack = transfer.NewIBCModule(app.TransferKeeper)
652+
transferStack = ibccallbacks.NewIBCMiddleware(transferStack, app.IBCFeeKeeper, wasmStackIBCHandler, wasm.DefaultMaxIBCCallbackGas)
653+
transferICS4Wrapper := transferStack.(ibcporttypes.ICS4Wrapper)
654+
transferStack = ibcfee.NewIBCMiddleware(transferStack, app.IBCFeeKeeper)
655+
// Since the callbacks middleware itself is an ics4wrapper, it needs to be passed to the ica controller keeper
656+
app.TransferKeeper.WithICS4Wrapper(transferICS4Wrapper)
639657

640658
// Create static IBC router, add transfer route, then set and seal it
641659
ibcRouter := ibcporttypes.NewRouter()
@@ -860,17 +878,8 @@ func New(
860878
app.setPostHandler()
861879

862880
// At startup, after all modules have been registered, check that all proto
863-
// annotations are correct, ignoring `google.crypto.tink`.
864-
fds, err := proto.MergedGlobalFileDescriptors()
865-
if err != nil {
866-
panic(err)
867-
}
868-
fds = &descriptorpb.FileDescriptorSet{
869-
File: slices.DeleteFunc(fds.File, func(e *descriptorpb.FileDescriptorProto) bool {
870-
return e.GetPackage() == "google.crypto.tink"
871-
}),
872-
}
873-
protoFiles, err := protodesc.NewFiles(fds)
881+
// annotations are correct.
882+
protoFiles, err := proto.MergedRegistry()
874883
if err != nil {
875884
panic(err)
876885
}

app/wasm/capabilities.go

Lines changed: 0 additions & 17 deletions
This file was deleted.

cmd/axoned/cmd/root.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import (
1212
"github.com/spf13/cobra"
1313
"github.com/spf13/pflag"
1414
"github.com/spf13/viper"
15+
"google.golang.org/protobuf/reflect/protoreflect"
16+
"google.golang.org/protobuf/reflect/protoregistry"
1517

1618
cmtcfg "github.com/cometbft/cometbft/config"
1719

@@ -50,6 +52,8 @@ import (
5052
//
5153
//nolint:funlen
5254
func NewRootCmd() *cobra.Command {
55+
sanitizeProtoRegistry()
56+
5357
// Set config
5458
initSDKConfig()
5559

@@ -408,3 +412,19 @@ var tempDir = func() string {
408412

409413
return dir
410414
}
415+
416+
// sanitizeProtoRegistry removes all the unused proto definitions from the global registry to avoid surprises as the
417+
// cosmos sdk rely on it.
418+
func sanitizeProtoRegistry() {
419+
safeRegistry := new(protoregistry.Files)
420+
protoregistry.GlobalFiles.RangeFiles(func(d protoreflect.FileDescriptor) bool {
421+
if d.FullName() != "google.crypto.tink" {
422+
if err := safeRegistry.RegisterFile(d); err != nil {
423+
panic(err)
424+
}
425+
}
426+
return true
427+
})
428+
429+
protoregistry.GlobalFiles = safeRegistry
430+
}

docs/command/axoned_tx_interchain-accounts_controller_register.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ axoned tx interchain-accounts controller register [connection-id] [flags]
3838
--node string <host>:<port> to CometBFT rpc interface for this chain (default "tcp://localhost:26657")
3939
--note string Note to add a description to the transaction (previously --memo)
4040
--offline Offline mode (does not allow any online functionality)
41-
--ordering string Channel ordering, can be one of: ORDER_ORDERED, ORDER_UNORDERED (default "ORDER_ORDERED")
41+
--ordering string Channel ordering, can be one of: ORDER_ORDERED, ORDER_UNORDERED (default "ORDER_UNORDERED")
4242
-o, --output string Output format (text|json) (default "json")
4343
-s, --sequence uint The sequence number of the signing account (offline mode only)
4444
--sign-mode string Choose sign mode (direct|amino-json|direct-aux|textual), this is an advanced feature

0 commit comments

Comments
 (0)