Skip to content

Commit

Permalink
chore(backport): feat: add grants by grantee authz query (backport co…
Browse files Browse the repository at this point in the history
…smos#10944) (#368)

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
p0mvn and mergify[bot] committed Oct 14, 2022
1 parent ccdfad5 commit fccc192
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 37 deletions.
1 change: 0 additions & 1 deletion client/cmd.go
Expand Up @@ -250,7 +250,6 @@ func readTxCommandFlags(clientCtx Context, flagSet *pflag.FlagSet) (Context, err
clientCtx = clientCtx.WithSignModeStr(flags.SignModeLegacyAminoJSON)
}
}

return clientCtx, nil
}

Expand Down
2 changes: 2 additions & 0 deletions client/flags/flags.go
Expand Up @@ -35,6 +35,8 @@ const (
SignModeDirect = "direct"
// SignModeLegacyAminoJSON is the value of the --sign-mode flag for SIGN_MODE_LEGACY_AMINO_JSON
SignModeLegacyAminoJSON = "amino-json"
// SignModeEIP191 is the value of the --sign-mode flag for SIGN_MODE_EIP_191
SignModeEIP191 = "eip-191"
)

// List of CLI flags
Expand Down
2 changes: 2 additions & 0 deletions client/tx/factory.go
Expand Up @@ -39,6 +39,8 @@ func NewFactoryCLI(clientCtx client.Context, flagSet *pflag.FlagSet) Factory {
signMode = signing.SignMode_SIGN_MODE_DIRECT
case flags.SignModeLegacyAminoJSON:
signMode = signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON
case flags.SignModeEIP191:
signMode = signing.SignMode_SIGN_MODE_EIP_191
}

accNum, _ := flagSet.GetUint64(flags.FlagAccountNumber)
Expand Down
12 changes: 12 additions & 0 deletions proto/cosmos/tx/signing/v1beta1/signing.proto
Expand Up @@ -24,6 +24,18 @@ enum SignMode {
// SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses
// Amino JSON and will be removed in the future
SIGN_MODE_LEGACY_AMINO_JSON = 127;

// SIGN_MODE_EIP_191 specifies the sign mode for EIP 191 signing on the Cosmos
// SDK. Ref: https://eips.ethereum.org/EIPS/eip-191
//
// Currently, SIGN_MODE_EIP_191 is registered as a SignMode enum variant,
// but is not implemented on the SDK by default. To enable EIP-191, you need
// to pass a custom `TxConfig` that has an implementation of
// `SignModeHandler` for EIP-191. The SDK may decide to fully support
// EIP-191 in the future.
//
// Since: cosmos-sdk 0.45.2
SIGN_MODE_EIP_191 = 191;
}

// SignatureDescriptors wraps multiple SignatureDescriptor's.
Expand Down
79 changes: 44 additions & 35 deletions types/tx/signing/signing.pb.go

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

9 changes: 8 additions & 1 deletion x/auth/tx/config.go
Expand Up @@ -23,9 +23,16 @@ type config struct {

// NewTxConfig returns a new protobuf TxConfig using the provided ProtoCodec and sign modes. The
// first enabled sign mode will become the default sign mode.
// NOTE: Use NewTxConfigWithHandler to provide a custom signing handler in case the sign mode
// is not supported by default (eg: SignMode_SIGN_MODE_EIP_191).
func NewTxConfig(protoCodec codec.ProtoCodecMarshaler, enabledSignModes []signingtypes.SignMode) client.TxConfig {
return NewTxConfigWithHandler(protoCodec, makeSignModeHandler(enabledSignModes))
}

// NewTxConfig returns a new protobuf TxConfig using the provided ProtoCodec and signing handler.
func NewTxConfigWithHandler(protoCodec codec.ProtoCodecMarshaler, handler signing.SignModeHandler) client.TxConfig {
return &config{
handler: makeSignModeHandler(enabledSignModes),
handler: handler,
decoder: DefaultTxDecoder(protoCodec),
encoder: DefaultTxEncoder(),
jsonDecoder: DefaultJSONTxDecoder(protoCodec),
Expand Down

0 comments on commit fccc192

Please sign in to comment.