Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Cosmos SDK and IBC Upgrade for Testnet V2 #383

Merged
merged 8 commits into from
Dec 10, 2023
Merged
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
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.20.11
go-version: 1.21
id: go

- name: Check out code into the Go module directory
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ jobs:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: 1.20
go-version: 1.21

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
Expand All @@ -47,9 +47,9 @@ jobs:
run: echo "LATEST_RELEASE_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV

- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: 1.20
go-version: 1.21

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
Expand Down
2 changes: 1 addition & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ env:

before:
hooks:
- go mod tidy -compat=1.19
- go mod tidy -compat=1.21

builds:
- id: ubuntu-amd64
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.20
FROM golang:1.21

# Set up dependencies
ENV PACKAGES curl make git libc-dev bash gcc python3 jq
Expand Down
13 changes: 6 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@ GOOS = $(shell go env GOOS)
GOARCH = $(shell go env GOARCH)

SDK_VERSION := $(shell go list -m github.com/cosmos/cosmos-sdk | sed 's:.* ::')
TM_VERSION := $(shell go list -m github.com/tendermint/tendermint | sed 's:.* ::')
BFT_VERSION := $(shell go list -m github.com/cometbft/cometbft | sed 's:.* ::')

ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=hid-node \
-X github.com/cosmos/cosmos-sdk/version.AppName=hid-node \
-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \
-X github.com/tendermint/tendermint/version.TMCoreSemVer=$(TM_VERSION) \
-X github.com/hypersign-protocol/hid-node/app.ProposalsEnabled=true # enable x/wasm based proposals
-X github.com/cometbft/cometbft/version.TMCoreSemVer=$(BFT_VERSION)

BUILD_FLAGS := -ldflags '$(ldflags)'

Expand All @@ -33,16 +32,16 @@ export GO111MODULE=on
all: proto-gen-go proto-gen-swagger build

go-version-check:
ifneq ($(GO_MINOR_VERSION),20)
@echo "ERROR: Go version 1.20 is required to build hid-noded binary"
ifneq ($(GO_MINOR_VERSION),21)
@echo "ERROR: Go version 1.21 is required to build hid-noded binary"
exit 1
endif

go.sum: go.mod
@echo "--> Ensure dependencies have not been modified"
@go mod verify

install: go-version-check go.sum
install: go.sum go-version-check
go install -mod=readonly $(BUILD_FLAGS) $(HIDNODE_CMD_DIR)

build: go-version-check
Expand All @@ -58,7 +57,7 @@ proto-gen-go:

proto-gen-swagger:
@echo "Generating swagger docs"
./scripts/protoc-swagger-gen.sh
./scripts/protocgen-swagger.sh

proto-gen-ts:
@echo "Generating typescript code from protobuf"
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ The Hypersign Identity Network is a permissionless blockchain network to manage
- Store/Update status of a Verifiable Credential
- Stake `$HID` tokens
- Submit Governance Proposals
- Transfer `$HID` tokens within and across different Tendermint-based blockchains
- Transfer `$HID` tokens within and across different Tendermint-based blockchains using IBC
- Deploy CosmWasm Smart Contracts (Governance Based)

## Prerequisite

Following are the prerequisites that needs to be installed:

- Golang (Installation Guide: https://go.dev/doc/install) (version: 1.20)
- Golang (Installation Guide: https://go.dev/doc/install) (version: 1.21)
- make
- jq

Expand Down
27 changes: 16 additions & 11 deletions app/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ package app

import (
"github.com/cosmos/cosmos-sdk/x/auth/ante"
"github.com/cosmos/ibc-go/v4/modules/core/keeper"
"github.com/cosmos/ibc-go/v7/modules/core/keeper"

"cosmossdk.io/errors"

wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmTypes "github.com/CosmWasm/wasmd/x/wasm/types"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
ibcante "github.com/cosmos/ibc-go/v4/modules/core/ante"
ibcante "github.com/cosmos/ibc-go/v7/modules/core/ante"
ssiante "github.com/hypersign-protocol/hid-node/x/ssi/ante"
)

Expand All @@ -18,29 +21,30 @@ type HandlerOptions struct {
ante.HandlerOptions

IBCKeeper *keeper.Keeper
WasmKeeper *wasmkeeper.Keeper
WasmConfig *wasmTypes.WasmConfig
TXCounterStoreKey sdk.StoreKey
TXCounterStoreKey storetypes.StoreKey
SsiKeeper ssiante.SsiKeeper
}

func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
if options.AccountKeeper == nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "account keeper is required for AnteHandler")
return nil, errors.Wrap(sdkerrors.ErrLogic, "account keeper is required for AnteHandler")
}
if options.BankKeeper == nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "bank keeper is required for AnteHandler")
return nil, errors.Wrap(sdkerrors.ErrLogic, "bank keeper is required for AnteHandler")
}
if options.SignModeHandler == nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "sign mode handler is required for ante builder")
return nil, errors.Wrap(sdkerrors.ErrLogic, "sign mode handler is required for ante builder")
}
if options.WasmConfig == nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "wasm config is required for ante builder")
return nil, errors.Wrap(sdkerrors.ErrLogic, "wasm config is required for ante builder")
}
if options.TXCounterStoreKey == nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "tx counter key is required for ante builder")
return nil, errors.Wrap(sdkerrors.ErrLogic, "tx counter key is required for ante builder")
}
if options.SsiKeeper == nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "ssi keeper is required for ante builder")
return nil, errors.Wrap(sdkerrors.ErrLogic, "ssi keeper is required for ante builder")
}

sigGasConsumer := options.SigGasConsumer
Expand All @@ -52,7 +56,8 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
ante.NewSetUpContextDecorator(),
wasmkeeper.NewLimitSimulationGasDecorator(options.WasmConfig.SimulationGasLimit), // after setup context to enforce limits early
wasmkeeper.NewCountTXDecorator(options.TXCounterStoreKey),
ante.NewRejectExtensionOptionsDecorator(),
wasmkeeper.NewGasRegisterDecorator(options.WasmKeeper.GetGasRegister()),
ante.NewExtensionOptionsDecorator(options.ExtensionOptionChecker),
ssiante.NewSSITxDecorator(), // SSITxDecorator MUST always be called before MempoolFeeDecorator
ssiante.NewMempoolFeeDecorator(), // MempoolFeeDecorator MUST always be called before DeductFeeDecorator
ante.NewValidateBasicDecorator(),
Expand All @@ -65,7 +70,7 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
ante.NewSigGasConsumeDecorator(options.AccountKeeper, sigGasConsumer),
ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler),
ante.NewIncrementSequenceDecorator(options.AccountKeeper),
ibcante.NewAnteDecorator(options.IBCKeeper),
ibcante.NewRedundantRelayDecorator(options.IBCKeeper),
}

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