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

feat: eip 191 signing #NTRN-454 #848

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion app/ante_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func NewAnteHandler(options HandlerOptions, logger log.Logger) (sdk.AnteHandler,
ante.NewSetPubKeyDecorator(options.AccountKeeper),
ante.NewValidateSigCountDecorator(options.AccountKeeper),
ante.NewSigGasConsumeDecorator(options.AccountKeeper, sigGasConsumer),
ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler),
NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler),
ante.NewIncrementSequenceDecorator(options.AccountKeeper),
ibcante.NewRedundantRelayDecorator(options.IBCKeeper),
}
Expand Down
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -1125,7 +1125,7 @@ func New(
HandlerOptions: ante.HandlerOptions{
FeegrantKeeper: app.FeeGrantKeeper,
SignModeHandler: encodingConfig.TxConfig.SignModeHandler(),
SigGasConsumer: ante.DefaultSigVerificationGasConsumer,
SigGasConsumer: DefaultSigVerificationGasConsumer,
},
BankKeeper: app.BankKeeper,
AccountKeeper: app.AccountKeeper,
Expand Down
4 changes: 4 additions & 0 deletions app/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package app
import (
"github.com/cosmos/cosmos-sdk/std"

ethcryptocodec "github.com/neutron-org/neutron/v5/x/crypto/codec"

"github.com/neutron-org/neutron/v5/app/params"
)

Expand All @@ -11,6 +13,8 @@ func MakeEncodingConfig() params.EncodingConfig {
encodingConfig := params.MakeEncodingConfig()
std.RegisterLegacyAminoCodec(encodingConfig.Amino)
std.RegisterInterfaces(encodingConfig.InterfaceRegistry)
ethcryptocodec.RegisterLegacyAminoCodec(encodingConfig.Amino)
ethcryptocodec.RegisterInterfaces(encodingConfig.InterfaceRegistry)
ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino)
ModuleBasics.RegisterInterfaces(encodingConfig.InterfaceRegistry)
return encodingConfig
Expand Down
16 changes: 15 additions & 1 deletion app/params/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ package params

import (
"cosmossdk.io/x/tx/signing"
"cosmossdk.io/x/tx/signing/aminojson"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/address"
"github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth/tx"
"github.com/cosmos/gogoproto/proto"

neutrontx "github.com/neutron-org/neutron/v5/tx"
)

// EncodingConfig specifies the concrete encoding types to use for a given app.
Expand Down Expand Up @@ -38,7 +41,18 @@ func MakeEncodingConfig() EncodingConfig {
panic(err)
}
marshaler := codec.NewProtoCodec(reg)
txCfg := tx.NewTxConfig(marshaler, tx.DefaultSignModes)

signingOptions, err := tx.NewDefaultSigningOptions()
if err != nil {
panic(err)
}
txCfg := tx.NewTxConfig(
marshaler,
tx.DefaultSignModes,
neutrontx.NewSignModeEIP191Handler(aminojson.SignModeHandlerOptions{
FileResolver: signingOptions.FileResolver,
TypeResolver: signingOptions.TypeResolver,
}))

return EncodingConfig{
InterfaceRegistry: reg,
Expand Down
Loading
Loading