Skip to content

Commit

Permalink
feat: cosmos-sdk 47
Browse files Browse the repository at this point in the history
Signed-off-by: Artur Troian <[email protected]>
  • Loading branch information
troian committed Jul 12, 2024
1 parent f417f49 commit 8d8baa2
Show file tree
Hide file tree
Showing 325 changed files with 6,856 additions and 14,695 deletions.
2 changes: 2 additions & 0 deletions .goreleaser-docker.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
project_name: node
dist: ./.cache/goreleaser-docker
env:
- GO111MODULE=on
- CGO_ENABLED=1
Expand Down
1 change: 1 addition & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
project_name: node
dist: ./.cache/goreleaser
env:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The `main` branch contains new features and is under active development; the `ma

Akash Suite is the reference implementation of the [Akash Protocol](https://ipfs.io/ipfs/QmdV52bF7j4utynJ6L11RgG93FuJiUmBH1i7pRD6NjUt6B). Akash is an actively-developed prototype currently focused on the distributed marketplace functionality.

The Suite is composed of one binary, `akash`, which contains a ([tendermint](https://github.com/tendermint/tendermint)-powered) blockchain node that
The Suite is composed of one binary, `akash`, which contains a ([tendermint](https://github.com/cometbft/cometbft)-powered) blockchain node that
implements the decentralized exchange as well as client functionality to access the exchange and network data in general.

## Get Started with Akash
Expand Down
2 changes: 1 addition & 1 deletion _docs/adr/adr-001-network-upgrades.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Each file has steps in form of comment with `StepX` prefix. Each step must be im
package v0_24_0

import (
"github.com/tendermint/tendermint/libs/log"
"github.com/cometbft/cometbft/libs/log"

storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down
46 changes: 31 additions & 15 deletions app/ante.go
Original file line number Diff line number Diff line change
@@ -1,78 +1,94 @@
package app

import (
"github.com/cosmos/cosmos-sdk/client"
"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"
govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper"
auctionante "github.com/skip-mev/block-sdk/x/auction/ante"
auctionkeeper "github.com/skip-mev/block-sdk/x/auction/keeper"

"github.com/akash-network/node/app/decorators"
agovkeeper "github.com/akash-network/node/x/gov/keeper"
astakingkeeper "github.com/akash-network/node/x/staking/keeper"
"pkg.akt.dev/akashd/app/decorators"
agovkeeper "pkg.akt.dev/akashd/x/gov/keeper"
astakingkeeper "pkg.akt.dev/akashd/x/staking/keeper"
)

// BlockSDKAnteHandlerParams are the parameters necessary to configure the block-sdk antehandlers
type BlockSDKAnteHandlerParams struct {
mevLane auctionante.MEVLane
auctionKeeper auctionkeeper.Keeper
txConfig client.TxConfig
}

// HandlerOptions extends the SDK's AnteHandler options
type HandlerOptions struct {
ante.HandlerOptions
CDC codec.BinaryCodec
AStakingKeeper astakingkeeper.IKeeper
GovKeeper *govkeeper.Keeper
AGovKeeper agovkeeper.IKeeper
BlockSDK BlockSDKAnteHandlerParams
}

// NewAnteHandler returns an AnteHandler that checks and increments sequence
// numbers, checks signatures & account numbers, and deducts fees from the first
// signer.
func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
if options.AccountKeeper == nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "account keeper is required for ante builder")
return nil, sdkerrors.ErrLogic.Wrap("account keeper is required for ante builder")
}

if options.BankKeeper == nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "bank keeper is required for ante builder")
return nil, sdkerrors.ErrLogic.Wrap("bank keeper is required for ante builder")
}

if options.SignModeHandler == nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "sign mode handler is required for ante builder")
return nil, sdkerrors.ErrLogic.Wrap("sign mode handler is required for ante builder")
}

if options.SigGasConsumer == nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "sig gas consumer handler is required for ante builder")
return nil, sdkerrors.ErrLogic.Wrap("sig gas consumer handler is required for ante builder")
}

if options.AStakingKeeper == nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "custom akash staking keeper is required for ante builder")
return nil, sdkerrors.ErrLogic.Wrap("custom akash staking keeper is required for ante builder")
}

if options.GovKeeper == nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "akash governance keeper is required for ante builder")
return nil, sdkerrors.ErrLogic.Wrap("akash governance keeper is required for ante builder")
}

if options.AGovKeeper == nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "custom akash governance keeper is required for ante builder")
return nil, sdkerrors.ErrLogic.Wrap("custom akash governance keeper is required for ante builder")
}

if options.FeegrantKeeper == nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "akash feegrant keeper is required for ante builder")
return nil, sdkerrors.ErrLogic.Wrap("akash feegrant keeper is required for ante builder")
}

anteDecorators := []sdk.AnteDecorator{
ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first
ante.NewRejectExtensionOptionsDecorator(),
ante.NewMempoolFeeDecorator(),
// ante.NewRejectExtensionOptionsDecorator(),
// ante.NewMempoolFeeDecorator(),
ante.NewValidateBasicDecorator(),
ante.NewTxTimeoutHeightDecorator(),
ante.NewValidateMemoDecorator(options.AccountKeeper),
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper),
ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, nil),
ante.NewSetPubKeyDecorator(options.AccountKeeper), // SetPubKeyDecorator must be called before all signature verification decorators
ante.NewValidateSigCountDecorator(options.AccountKeeper),
ante.NewSigGasConsumeDecorator(options.AccountKeeper, options.SigGasConsumer),
ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler),
ante.NewIncrementSequenceDecorator(options.AccountKeeper),
decorators.NewMinCommissionDecorator(options.CDC, options.AStakingKeeper),
decorators.NewGovPreventSpamDecorator(options.CDC, *options.GovKeeper, options.AGovKeeper),
// auction module antehandler
auctionante.NewAuctionDecorator(
options.BlockSDK.auctionKeeper,
options.BlockSDK.txConfig.TxEncoder(),
options.BlockSDK.mevLane,
),
}

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

0 comments on commit 8d8baa2

Please sign in to comment.