Skip to content

Commit 662bd74

Browse files
arhamchordiaakureajansari95Ajaz Ahmed
authored
Quasar chain uprgade (#607)
## 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]>
1 parent 3548515 commit 662bd74

File tree

292 files changed

+6249
-3961
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

292 files changed

+6249
-3961
lines changed

.github/workflows/lint_go.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
if: env.GIT_DIFF
4040
uses: actions/setup-go@v4
4141
with:
42-
go-version: 1.20.7
42+
go-version: 1.21
4343
- name: Display go version
4444
if: env.GIT_DIFF
4545
run: go version

.github/workflows/test_go.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
if: env.GIT_DIFF
3939
uses: actions/setup-go@v3
4040
with:
41-
go-version: 1.20.7
41+
go-version: 1.21
4242
- name: Display go version
4343
if: env.GIT_DIFF
4444
run: go version

Makefile

+10-1
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,20 @@ go.sum: go.mod
176176
###############################################################################
177177

178178
proto-all: proto-format proto-gen
179-
179+
BUF_VERSION=1.26.1
180+
BUILDER_VERSION=0.13.5
180181
proto-gen:
181182
@echo "Generating Protobuf files"
182183
@sh ./scripts/protocgen.sh
183184

185+
proto-gen-1:
186+
@echo "🤖 Generating code from protobuf..."
187+
@echo "PWD is $(PWD)"
188+
189+
@docker run --rm --volume "$(PWD)":/workspace --workdir /workspace \
190+
ghcr.io/cosmos/proto-builder:$(BUILDER_VERSION) sh ./scripts/protocgen.sh
191+
@echo "✅ Completed code generation!"
192+
184193
proto-doc:
185194
@echo "Generating Protoc docs"
186195
@sh ./scripts/generate-docs.sh

ante/ante.go

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
package ante
2+
3+
import (
4+
errorsmod "cosmossdk.io/errors"
5+
"github.com/cosmos/cosmos-sdk/codec"
6+
sdk "github.com/cosmos/cosmos-sdk/types"
7+
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
8+
"github.com/cosmos/cosmos-sdk/x/auth/ante"
9+
ibcante "github.com/cosmos/ibc-go/v7/modules/core/ante"
10+
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
11+
)
12+
13+
// HandlerOptions extend the SDK's AnteHandler options by requiring the IBC
14+
// channel keeper.
15+
type HandlerOptions struct {
16+
ante.HandlerOptions
17+
Codec codec.BinaryCodec
18+
IBCkeeper *ibckeeper.Keeper
19+
}
20+
21+
func NewAnteHandler(opts HandlerOptions) (sdk.AnteHandler, error) {
22+
if opts.AccountKeeper == nil {
23+
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "account keeper is required for AnteHandler")
24+
}
25+
if opts.BankKeeper == nil {
26+
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "bank keeper is required for AnteHandler")
27+
}
28+
if opts.SignModeHandler == nil {
29+
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "sign mode handler is required for AnteHandler")
30+
}
31+
if opts.IBCkeeper == nil {
32+
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "IBC keeper is required for AnteHandler")
33+
}
34+
35+
sigGasConsumer := opts.SigGasConsumer
36+
if sigGasConsumer == nil {
37+
sigGasConsumer = ante.DefaultSigVerificationGasConsumer
38+
}
39+
40+
anteDecorators := []sdk.AnteDecorator{
41+
ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first
42+
ante.NewExtensionOptionsDecorator(opts.ExtensionOptionChecker),
43+
ante.NewValidateBasicDecorator(),
44+
ante.NewTxTimeoutHeightDecorator(),
45+
ante.NewValidateMemoDecorator(opts.AccountKeeper),
46+
ante.NewConsumeGasForTxSizeDecorator(opts.AccountKeeper),
47+
ante.NewDeductFeeDecorator(opts.AccountKeeper, opts.BankKeeper, opts.FeegrantKeeper, opts.TxFeeChecker),
48+
ante.NewSetPubKeyDecorator(opts.AccountKeeper), // SetPubKeyDecorator must be called before all signature verification decorators
49+
ante.NewValidateSigCountDecorator(opts.AccountKeeper),
50+
ante.NewSigGasConsumeDecorator(opts.AccountKeeper, sigGasConsumer),
51+
ante.NewSigVerificationDecorator(opts.AccountKeeper, opts.SignModeHandler),
52+
ante.NewIncrementSequenceDecorator(opts.AccountKeeper),
53+
ibcante.NewRedundantRelayDecorator(opts.IBCkeeper),
54+
}
55+
56+
return sdk.ChainAnteDecorators(anteDecorators...), nil
57+
}

0 commit comments

Comments
 (0)