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

fix: antehandler to fit sdk v0.45 #1918

Merged
merged 31 commits into from
Dec 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
663e14f
pause
okwme Nov 15, 2022
64cc456
no vscode errors
okwme Nov 16, 2022
0fe4e8c
Merge branch 'main' into okwme/downgrade-v0-45
okwme Nov 16, 2022
fc8f2be
rewrite go.sum, go.work.sum and fix amino import
okwme Nov 16, 2022
fca3ab5
Merge branch 'main' into okwme/downgrade-v0-45
okwme Nov 16, 2022
5e7bd79
remove mauth docs
okwme Nov 16, 2022
d7e19d0
gofumpt
okwme Nov 16, 2022
180ca63
fix find
okwme Nov 16, 2022
75d0f9a
cant get docker to build locally
okwme Nov 16, 2022
824c208
debug ibc test
okwme Nov 16, 2022
5169a9b
fix ibc test
okwme Nov 16, 2022
43f495b
merge with main
okwme Nov 17, 2022
e7f9145
passing e2e
okwme Nov 17, 2022
02b3256
clean up commented out tests
okwme Nov 17, 2022
a266175
remove more mauth
okwme Nov 17, 2022
283ab55
forgot to save
okwme Nov 17, 2022
8435cc4
merge with main
okwme Nov 17, 2022
61743e1
Merge branch 'main' into okwme/downgrade-v0-45
okwme Nov 17, 2022
e55d9b2
merge with main
okwme Nov 17, 2022
3601da2
add back middleware test
okwme Nov 18, 2022
8f846a8
Merge branch 'main' into okwme/downgrade-v0-45
okwme Nov 18, 2022
18ccf80
fix upgrade
okwme Nov 18, 2022
785b267
fix test setup
okwme Nov 18, 2022
ed9c986
add TODO note
okwme Nov 18, 2022
0673b1b
remove multihop test
okwme Nov 18, 2022
0453fd7
fix: antehandler in sdkv0.45
Nov 23, 2022
bdb3e77
test: add back globalfee e2e test
Nov 23, 2022
5d2294f
fix: failure of verifying sending token amount
Nov 30, 2022
8621e17
chore: remove comments
Nov 30, 2022
9306504
merge main
Nov 30, 2022
d5497a7
feat: simplify fee logic
Nov 30, 2022
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
8 changes: 3 additions & 5 deletions ante/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
ibcante "github.com/cosmos/ibc-go/v3/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/keeper"

gaiafeeante "github.com/cosmos/gaia/v8/x/globalfee/ante"
Expand Down Expand Up @@ -47,22 +48,19 @@ func NewAnteHandler(opts HandlerOptions) (sdk.AnteHandler, error) {

anteDecorators := []sdk.AnteDecorator{
ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first
// ante.NewExtensionOptionsDecorator(opts.ExtensionOptionChecker),
ante.NewRejectExtensionOptionsDecorator(),
ante.NewValidateBasicDecorator(),
ante.NewTxTimeoutHeightDecorator(),
ante.NewValidateMemoDecorator(opts.AccountKeeper),
ante.NewConsumeGasForTxSizeDecorator(opts.AccountKeeper),
gaiafeeante.NewFeeDecorator(opts.BypassMinFeeMsgTypes, opts.GlobalFeeSubspace, opts.StakingSubspace),
// if opts.TxFeeCheck is nil, it is the default fee check
ante.NewDeductFeeDecorator(opts.AccountKeeper, opts.BankKeeper, opts.FeegrantKeeper),
// 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),
// TODO: check what this is
// ibcante.NewRedundantRelayDecorator(opts.IBCkeeper),
ibcante.NewAnteDecorator(opts.IBCkeeper),
}

return sdk.ChainAnteDecorators(anteDecorators...), nil
Expand Down
12 changes: 0 additions & 12 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,18 +197,6 @@ func NewGaiaApp(
FeegrantKeeper: app.FeeGrantKeeper,
SignModeHandler: encodingConfig.TxConfig.SignModeHandler(),
SigGasConsumer: ante.DefaultSigVerificationGasConsumer,
// TxFeeChecker is not the default fee check, it will not check if the fee meets min_gas_price, this is checked in NewFeeWithBypassDecorator already.
// TxFeeChecker: func(ctx sdk.Context, tx sdk.Tx) (sdk.Coins, int64, error) {
// feeTx, ok := tx.(sdk.FeeTx)
// if !ok {
// return nil, 0, sdkerrors.Wrap(sdkerrors.ErrTxDecode, "Tx must be a FeeTx")
// }

// feeCoins := feeTx.GetFee()
// priority := gaiafeeante.GetTxPriority(feeCoins)

// return feeCoins, priority, nil
// },
},
IBCkeeper: app.IBCKeeper,
BypassMinFeeMsgTypes: bypassMinFeeMsgTypes,
Expand Down
Empty file added docs/modules/gov.md
Empty file.
7 changes: 2 additions & 5 deletions tests/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ func (s *IntegrationTestSuite) TestGov() {

// globalfee in genesis is set to be "0.00001uatom"
func (s *IntegrationTestSuite) TestQueryGlobalFeesInGenesis() {
// TODO: Fix and add back this test
s.T().Skip()
chainAAPIEndpoint := fmt.Sprintf("http://%s", s.valResources[s.chainA.id][0].GetHostPort("1317/tcp"))
feeInGenesis, err := sdk.ParseDecCoins(initialGlobalFeeAmt + uatomDenom)
s.Require().NoError(err)
Expand Down Expand Up @@ -66,9 +64,7 @@ test4: gov propose globalfee = 0.000001uatom (lower than min_gas_price), 0photo
test5: check balance correct: all the successful bank sent tokens are received
test6: gov propose change back to initial globalfee = 0.00001photon, This is for not influence other e2e tests.
*/
// TODO: add back global fee tests
func (s *IntegrationTestSuite) TestGlobalFees() {
s.T().Skip()
chainAAPIEndpoint := fmt.Sprintf("http://%s", s.valResources[s.chainA.id][0].GetHostPort("1317/tcp"))

submitterAddr := s.chainA.validators[0].keyInfo.GetAddress()
Expand All @@ -79,7 +75,8 @@ func (s *IntegrationTestSuite) TestGlobalFees() {
var beforeRecipientPhotonBalance sdk.Coin
s.Require().Eventually(
func() bool {
beforeRecipientPhotonBalance, err := getSpecificBalance(chainAAPIEndpoint, recipient, photonDenom)
var err error
beforeRecipientPhotonBalance, err = getSpecificBalance(chainAAPIEndpoint, recipient, photonDenom)
s.Require().NoError(err)

return beforeRecipientPhotonBalance.IsValid()
Expand Down