Skip to content

Commit

Permalink
fix wasmbindings (#742)
Browse files Browse the repository at this point in the history
## 1. Overview
-  removed unused wasmbindings in `wasmbindings/`
-  added allowed stargate queries
- updated tokenfactory bindings

<!-- What are you changing, removing, or adding in this review? -->

## 2. Implementation details

<!-- Describe the implementation (highlights only) as well as design
rationale. -->

## 3. How to test/use

<!-- How can people test/use this? -->

## 4. Checklist

<!-- Checklist for PR author(s). -->

- [ ] Does the Readme need to be updated?

## 5. Limitations (optional)

<!-- Describe any limitation of the capabilities listed in the Overview
section. -->

## 6. Future Work (optional)
- add other stargate queries and wasm bindings depending on the modules
if require
<!-- Describe follow up work, if any. -->
  • Loading branch information
ajansari95 authored Aug 6, 2024
1 parent 2c788f4 commit 948caac
Show file tree
Hide file tree
Showing 20 changed files with 84 additions and 753 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
go mod download

# Cosmwasm - Download correct libwasmvm version
RUN ARCH=$(uname -m) && WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm | sed 's/.* //') && \
RUN ARCH=$(uname -m) && WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm/v2 | sed 's/.* //') && \
wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/libwasmvm_muslc.$ARCH.a \
-O /lib/libwasmvm_muslc.a && \
# verify checksum
Expand All @@ -52,7 +52,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
-X github.com/cosmos/cosmos-sdk/version.BuildTags=${BUILD_TAGS} \
-w -s -linkmode=external -extldflags '-Wl,-z,muldefs -static'" \
-trimpath \
-o build/quasard \
-o /quasar/build/quasard \
/quasar/cmd/quasard/main.go

# --------------------------------------------------------
Expand All @@ -70,4 +70,4 @@ EXPOSE 26656
EXPOSE 26657
EXPOSE 1317

CMD ["quasard"]
ENTRYPOINT ["quasard"]
10 changes: 9 additions & 1 deletion app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ import (
ibchost "github.com/cosmos/ibc-go/v8/modules/core/exported"
ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper"
appparams "github.com/quasar-finance/quasar/app/params"
"github.com/quasar-finance/quasar/wasmbindings"
epochsmodulekeeper "github.com/quasar-finance/quasar/x/epochs/keeper"
epochsmoduletypes "github.com/quasar-finance/quasar/x/epochs/types"
tfbindings "github.com/quasar-finance/quasar/x/tokenfactory/bindings"
Expand Down Expand Up @@ -436,9 +437,16 @@ func (appKeepers *AppKeepers) InitNormalKeepers(

tmpBankBaseKeeper := appKeepers.BankKeeper.(bankkeeper.BaseKeeper)

// wasmOpts = append(owasm.RegisterCustomPlugins(appKeepers.QOracleKeeper, &tmpBankBaseKeeper, callback), wasmOpts...)
wasmOpts = append(tfbindings.RegisterCustomPlugins(&tmpBankBaseKeeper, &appKeepers.TfKeeper), wasmOpts...)

queryPlugins := wasmkeeper.WithQueryPlugins(
&wasmkeeper.QueryPlugins{
Stargate: wasmkeeper.AcceptListStargateQuerier(wasmbindings.AcceptedStargateQueries(), bApp.GRPCQueryRouter(), appCodec),
Grpc: wasmkeeper.AcceptListGrpcQuerier(wasmbindings.AcceptedStargateQueries(), bApp.GRPCQueryRouter(), appCodec),
})

wasmOpts = append(wasmOpts, queryPlugins)

// The last arguments can contain custom message handlers, and custom query handlers,
// if we want to allow any custom callbacks
supportedFeatures := "cosmwasm_1_1,cosmwasm_1_2,cosmwasm_1_4,iterator,staking,stargate"
Expand Down
8 changes: 3 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/quasar-finance/quasar

go 1.22.3
go 1.22.4

require (
cosmossdk.io/api v0.7.5
Expand All @@ -12,8 +12,8 @@ require (
cosmossdk.io/x/evidence v0.1.1
cosmossdk.io/x/feegrant v0.1.1
cosmossdk.io/x/upgrade v0.1.4
github.com/CosmWasm/wasmd v0.50.0
github.com/CosmWasm/wasmvm v1.5.2
github.com/CosmWasm/wasmd v0.51.0
github.com/CosmWasm/wasmvm/v2 v2.0.1
github.com/cometbft/cometbft v0.38.9
github.com/cometbft/cometbft-db v0.11.0
github.com/cosmos/cosmos-proto v1.0.0-beta.5
Expand Down Expand Up @@ -333,8 +333,6 @@ require (
sigs.k8s.io/yaml v1.4.0 // indirect
)

require github.com/CosmWasm/wasmvm/v2 v2.0.1

require (
cosmossdk.io/collections v0.4.0 // indirect
// github.com/CosmWasm/wasmvm/v2 v2.0.1 // indirect
Expand Down
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0=
github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
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/wasmvm v1.5.2 h1:+pKB1Mz9GZVt1vadxB+EDdD1FOz3dMNjIKq/58/lrag=
github.com/CosmWasm/wasmvm v1.5.2/go.mod h1:Q0bSEtlktzh7W2hhEaifrFp1Erx11ckQZmjq8FLCyys=
github.com/CosmWasm/wasmd v0.51.0 h1:3A2o20RrdF7P1D3Xb+R7A/pHbbHWsYCDXrHLa7S0SC8=
github.com/CosmWasm/wasmd v0.51.0/go.mod h1:7TSaj5HoolghujuVWeExqmcUKgpcYWEySGLSODbnnwY=
github.com/CosmWasm/wasmvm/v2 v2.0.1 h1:0YCQ7MKGNri7NFeRp75erPJXrqyCtH4gdc9jMstyMzk=
github.com/CosmWasm/wasmvm/v2 v2.0.1/go.mod h1:su9lg5qLr7adV95eOfzjZWkGiky8WNaNIHDr7Fpu7Ck=
github.com/Crocmagnon/fatcontext v0.2.2 h1:OrFlsDdOj9hW/oBEJBNSuH7QWf+E9WPVHw+x52bXVbk=
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/dockerfiles/osmosis.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
go mod download

# Cosmwasm - Download correct libwasmvm version
RUN export WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm | awk '{print $NF}') && \
RUN export WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm/v2 | awk '{print $NF}') && \
wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/libwasmvm_muslc.$(uname -m).a \
-O /lib/libwasmvm_muslc.a
# && \
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/dockerfiles/quasar.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
go mod download

# Cosmwasm - Download correct libwasmvm version
RUN export WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm | awk '{print $NF}') && \
RUN export WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm/v2 | awk '{print $NF}') && \
wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/libwasmvm_muslc.$(uname -m).a \
-O /lib/libwasmvm_muslc.a && \
# verify checksum
Expand Down
27 changes: 0 additions & 27 deletions wasmbinding/README.md

This file was deleted.

94 changes: 0 additions & 94 deletions wasmbinding/bindings/msg.go

This file was deleted.

25 changes: 0 additions & 25 deletions wasmbinding/bindings/query.go

This file was deleted.

Loading

0 comments on commit 948caac

Please sign in to comment.