Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 1 addition & 16 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,6 @@ name: Go
on: push

jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Install Go
uses: actions/setup-go@v3
with:
go-version: '1.20'

- name: Run tests
run: make test

lint:
name: Lint
runs-on: ubuntu-latest
Expand All @@ -28,7 +13,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: '1.20'
go-version: "1.20"

- name: Lint
uses: golangci/[email protected]
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
on: [push, pull_request]
name: Test
jobs:
test:
strategy:
matrix:
go-version: [1.20.x]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- run: go test ./...
25 changes: 12 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -182,28 +182,27 @@ test:
### Protobuf ###
################################################################################

# We use osmolabs' docker image instead of tendermintdev/sdk-proto-gen.
# The only difference is that the Osmosis version uses Go 1.19 while the
# tendermintdev one uses 1.18.
protoVer=v0.8
protoImageName=osmolabs/osmo-proto-gen:$(protoVer)
containerProtoGenGo=mars-proto-gen-go-$(protoVer)
containerProtoGenSwagger=mars-proto-gen-swagger-$(protoVer)

protoVer=0.13.1
protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer)
protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(protoImageName)

proto-gen: proto-go-gen proto-swagger-gen

proto-go-gen:
@echo "🤖 Generating Go code from protobuf..."
@if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoGenGo}$$"; then docker start -a $(containerProtoGenGo); else docker run --name $(containerProtoGenGo) -v $(CURDIR):/workspace --workdir /workspace $(protoImageName) \
sh ./scripts/protocgen.sh; fi
@echo "Generating Protobuf files"
@$(protoImage) sh ./scripts/protocgen.sh
@echo "✅ Completed Go code generation!"


proto-swagger-gen:
@echo "🤖 Generating Swagger code from protobuf..."
@if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoGenSwagger}$$"; then docker start -a $(containerProtoGenSwagger); else docker run --name $(containerProtoGenSwagger) -v $(CURDIR):/workspace --workdir /workspace $(protoImageName) \
sh ./scripts/protoc-swagger-gen.sh; fi
@echo "Generating Protobuf Swagger"
@$(protoImage) sh ./scripts/protoc-swagger-gen.sh
@echo "✅ Completed Swagger code generation!"




################################################################################
### Docker ###
################################################################################
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ A `marsd` executable will be created in the `$GOBIN` directory.

Contents of this repository are open source under [GNU General Public License v3](./LICENSE) or later.

[1]: https://github.com/tendermint/tendermint
[1]: https://github.com/cometbft/cometbft
[2]: https://github.com/cosmos/cosmos-sdk
[3]: https://github.com/cosmos/ibc-go
[4]: https://github.com/CosmWasm/wasmd
Expand Down
16 changes: 8 additions & 8 deletions app/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
"github.com/mars-protocol/hub/v2/x/gov/keeper"

ibcante "github.com/cosmos/ibc-go/v6/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v6/modules/core/keeper"
ibcante "github.com/cosmos/ibc-go/v7/modules/core/ante"

wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
)

// HandlerOptions extends the SDK's `AnteHandler` options by requiring
// additional keepers.
// HandlerOptions extend the SDK's AnteHandler options by requiring the IBC
// channel keeper.
type HandlerOptions struct {
ante.HandlerOptions

IBCKeeper *ibckeeper.Keeper
WasmConfig wasmtypes.WasmConfig
TxCounterStoreKey storetypes.StoreKey
IBCKeeper *keeper.Keeper
WasmConfig *wasmtypes.WasmConfig
TXCounterStoreKey storetypes.StoreKey
}

// NewAnteHandler returns an AnteHandler that checks and increments sequence
Expand Down Expand Up @@ -62,7 +62,7 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {

// wasm
wasmkeeper.NewLimitSimulationGasDecorator(options.WasmConfig.SimulationGasLimit),
wasmkeeper.NewCountTXDecorator(options.TxCounterStoreKey),
wasmkeeper.NewCountTXDecorator(options.TXCounterStoreKey),
}

return sdk.ChainAnteDecorators(anteDecorators...), nil
Expand Down
Loading