Skip to content

Commit

Permalink
Refactor tx middleware to support pluggable feemarket module
Browse files Browse the repository at this point in the history
Closes: #11415
  • Loading branch information
yihuang committed Mar 18, 2022
1 parent 16e5d1a commit d4f51a2
Show file tree
Hide file tree
Showing 19 changed files with 618 additions and 363 deletions.
4 changes: 2 additions & 2 deletions api/cosmos/feegrant/v1beta1/feegrant.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/cosmos/feegrant/v1beta1/tx.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

365 changes: 261 additions & 104 deletions api/cosmos/tx/v1beta1/tx.pulsar.go

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions proto/cosmos/tx/v1beta1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ message AuthInfo {
//
// Since: cosmos-sdk 0.46
Tip tip = 3;

// extension_options are arbitrary options that can be added by chains
// when the default options are not sufficient. If any of these are present
// and can't be handled, the transaction will be rejected
repeated google.protobuf.Any extension_options = 1023;
}

// SignerInfo describes the public key and signing mode of a single top-level
Expand Down
1 change: 1 addition & 0 deletions simapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@ func (app *SimApp) setTxHandler(txConfig client.TxConfig, indexEventsStr []strin
SignModeHandler: txConfig.SignModeHandler(),
SigGasConsumer: authmiddleware.DefaultSigVerificationGasConsumer,
TxDecoder: txConfig.TxDecoder(),
FeeMarket: authmiddleware.StaticFeeMarket{},
})
if err != nil {
panic(err)
Expand Down
3 changes: 3 additions & 0 deletions types/errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ var (
// ErrAppConfig defines an error occurred if min-gas-prices field in BaseConfig is empty.
ErrAppConfig = Register(RootCodespace, 40, "error in app.toml")

// ErrUnknownAuthExtensionOptions defines an error for unknown auth_info extension options.
ErrUnknownAuthExtensionOptions = Register(RootCodespace, 41, "unknown auth_info extension options")

// ErrPanic is only set when we recover from a panic, so we know to
// redact potentially sensitive system info
ErrPanic = errorsmod.ErrPanic
Expand Down
197 changes: 132 additions & 65 deletions types/tx/tx.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions types/tx/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ func (t *Tx) FeeGranter() sdk.AccAddress {
return nil
}

func (t *Tx) AuthExtensionOptions() []*codectypes.Any {
return t.AuthInfo.ExtensionOptions
}

// UnpackInterfaces implements the UnpackInterfaceMessages.UnpackInterfaces method
func (t *Tx) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
if t.Body != nil {
Expand Down

0 comments on commit d4f51a2

Please sign in to comment.