Skip to content

Commit

Permalink
feat: upgrade fetchd to dorado version (ECO-965) (#198)
Browse files Browse the repository at this point in the history
* feat: upgrade fetchd to dorado version

Dependencies:

- bump cosmos-sdk to v0.45.1
- bump tendermint to v0.34.16
- bump wasmd to v0.23.0
- integrate ibc-go v2.0.3

Modules:

- update app and commands to integrate new feegrant and authz modules
- remove airdrop module

Commands:

- removed capricorn migration commands (stake-reconciliation-migrate and
  capricorn-migrate)

Remaining changes are only compatibility fixes with the new cosmos-sdk
version

* fix: missing ptr dereference in initAppConfig

* Update networks.md with dorado -rc1

* docs: add gas prices for testnet networks

* chores: bump ibc-go version (#205)

* fix: add back reconciliation command

* fix: bump wasmd to v0.24

bring back support to 20bytes long contract address (see: CosmWasm/wasmd#758)

* chores: wakeup CI

* fix: bump go requirements to 1.17 to allow wasmvm to build (#208)

* Dorado migration (#204)

* fix: bump go requirements to 1.17 to allow wasmvm to build

* feat: add dorado-migrate command

* chores: fmt

* feat: add initial nanonomx supply to dorado-migrate command

* docs: remove redundant info

* chores: switch cosmos-sdk to proper tagged version

* docs: update software versions

Co-authored-by: Ian Harris <[email protected]>
  • Loading branch information
daeMOn63 and Ian Harris authored Mar 23, 2022
1 parent 32af1b6 commit 18cfae0
Show file tree
Hide file tree
Showing 18 changed files with 1,021 additions and 721 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.16-buster as builder
FROM golang:1.17-buster as builder

# Set up dependencies
ENV PACKAGES jq curl wget jq file make git
Expand Down
67 changes: 67 additions & 0 deletions app/ante.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package app

import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
channelkeeper "github.com/cosmos/ibc-go/v2/modules/core/04-channel/keeper"
ibcante "github.com/cosmos/ibc-go/v2/modules/core/ante"

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

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

IBCChannelkeeper channelkeeper.Keeper
WasmConfig *wasmTypes.WasmConfig
TXCounterStoreKey sdk.StoreKey
}

func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
if options.AccountKeeper == nil {
return nil, sdkerrors.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")
}
if options.SignModeHandler == nil {
return nil, sdkerrors.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")
}
if options.TXCounterStoreKey == nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "tx counter key is required for ante builder")
}

var sigGasConsumer = options.SigGasConsumer
if sigGasConsumer == nil {
sigGasConsumer = ante.DefaultSigVerificationGasConsumer
}

anteDecorators := []sdk.AnteDecorator{
ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first
wasmkeeper.NewLimitSimulationGasDecorator(options.WasmConfig.SimulationGasLimit), // after setup context to enforce limits early
wasmkeeper.NewCountTXDecorator(options.TXCounterStoreKey),
ante.NewRejectExtensionOptionsDecorator(),
ante.NewMempoolFeeDecorator(),
ante.NewValidateBasicDecorator(),
ante.NewTxTimeoutHeightDecorator(),
ante.NewValidateMemoDecorator(options.AccountKeeper),
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper),
// SetPubKeyDecorator must be called before all signature verification decorators
ante.NewSetPubKeyDecorator(options.AccountKeeper),
ante.NewValidateSigCountDecorator(options.AccountKeeper),
ante.NewSigGasConsumeDecorator(options.AccountKeeper, sigGasConsumer),
ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler),
ante.NewIncrementSequenceDecorator(options.AccountKeeper),
ibcante.NewAnteDecorator(options.IBCChannelkeeper),
}

return sdk.ChainAnteDecorators(anteDecorators...), nil
}
Loading

0 comments on commit 18cfae0

Please sign in to comment.