Skip to content

Commit

Permalink
Quasar chain uprgade (#607)
Browse files Browse the repository at this point in the history
## 1. Overview

Chain upgrade from sdk45 to sdk47

## 2. Implementation details

Changes made in this PR are mostly on adding few new modules into play
and upgrading versions of old dependencies :
1. Wasm bumped from v31 to v45
2. IBC from v4 to v7
3. Wasmvm from 1.2 to 1.5
4. IBC was light client added
5. Cosmos sdk from v45 to v47.12
6. Async ICQ from v4 to v7
7. Tendermint to cometbft
8. and so on... 

## 3. How to test/use

Testing can be done by running : 
1. Compile v1.0.0 or download from tagged versions as `quasarnodedv1`
2. Change directory to `demos/upgrade-handler/v2.0.0`
3. Run upgrade_test.sh. 

Upgrade test will run the old binary with relayer setup and some IBC
connections to Osmosis chain.
And then it will perform some pre upgrade transactions and then post the
upgrade proposal.
Once the desired block height is reached then the setup will
automatically stop the old chain and start with new binary.
New binary once started, it will be tested using the post_upgrade
actions on chain.

## 4. Future Work (optional)

1. Update interchaintest e2e in sdk 50 upgrade
2. Cleanup makefiles
3. Cleanup protos
4. Cleanup unused modules.

---------

Co-authored-by: akure <[email protected]>
Co-authored-by: Ajaz Ahmed Ansari <[email protected]>
Co-authored-by: Ajaz Ahmed <[email protected]>
  • Loading branch information
4 people authored Jul 22, 2024
1 parent 3548515 commit 662bd74
Show file tree
Hide file tree
Showing 292 changed files with 6,249 additions and 3,961 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint_go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
if: env.GIT_DIFF
uses: actions/setup-go@v4
with:
go-version: 1.20.7
go-version: 1.21
- name: Display go version
if: env.GIT_DIFF
run: go version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
if: env.GIT_DIFF
uses: actions/setup-go@v3
with:
go-version: 1.20.7
go-version: 1.21
- name: Display go version
if: env.GIT_DIFF
run: go version
Expand Down
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,20 @@ go.sum: go.mod
###############################################################################

proto-all: proto-format proto-gen

BUF_VERSION=1.26.1
BUILDER_VERSION=0.13.5
proto-gen:
@echo "Generating Protobuf files"
@sh ./scripts/protocgen.sh

proto-gen-1:
@echo "🤖 Generating code from protobuf..."
@echo "PWD is $(PWD)"

@docker run --rm --volume "$(PWD)":/workspace --workdir /workspace \
ghcr.io/cosmos/proto-builder:$(BUILDER_VERSION) sh ./scripts/protocgen.sh
@echo "✅ Completed code generation!"

proto-doc:
@echo "Generating Protoc docs"
@sh ./scripts/generate-docs.sh
Expand Down
57 changes: 57 additions & 0 deletions ante/ante.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package ante

import (
errorsmod "cosmossdk.io/errors"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
ibcante "github.com/cosmos/ibc-go/v7/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
)

// HandlerOptions extend the SDK's AnteHandler options by requiring the IBC
// channel keeper.
type HandlerOptions struct {
ante.HandlerOptions
Codec codec.BinaryCodec
IBCkeeper *ibckeeper.Keeper
}

func NewAnteHandler(opts HandlerOptions) (sdk.AnteHandler, error) {
if opts.AccountKeeper == nil {
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "account keeper is required for AnteHandler")
}
if opts.BankKeeper == nil {
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "bank keeper is required for AnteHandler")
}
if opts.SignModeHandler == nil {
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "sign mode handler is required for AnteHandler")
}
if opts.IBCkeeper == nil {
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "IBC keeper is required for AnteHandler")
}

sigGasConsumer := opts.SigGasConsumer
if sigGasConsumer == nil {
sigGasConsumer = ante.DefaultSigVerificationGasConsumer
}

anteDecorators := []sdk.AnteDecorator{
ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first
ante.NewExtensionOptionsDecorator(opts.ExtensionOptionChecker),
ante.NewValidateBasicDecorator(),
ante.NewTxTimeoutHeightDecorator(),
ante.NewValidateMemoDecorator(opts.AccountKeeper),
ante.NewConsumeGasForTxSizeDecorator(opts.AccountKeeper),
ante.NewDeductFeeDecorator(opts.AccountKeeper, opts.BankKeeper, opts.FeegrantKeeper, opts.TxFeeChecker),
ante.NewSetPubKeyDecorator(opts.AccountKeeper), // SetPubKeyDecorator must be called before all signature verification decorators
ante.NewValidateSigCountDecorator(opts.AccountKeeper),
ante.NewSigGasConsumeDecorator(opts.AccountKeeper, sigGasConsumer),
ante.NewSigVerificationDecorator(opts.AccountKeeper, opts.SignModeHandler),
ante.NewIncrementSequenceDecorator(opts.AccountKeeper),
ibcante.NewRedundantRelayDecorator(opts.IBCkeeper),
}

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

0 comments on commit 662bd74

Please sign in to comment.