-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
refactor!: use x/tx/signing in client.TxConfig #15822
Changes from 1 commit
db53c1d
0019cb9
f44fee6
49c18df
14539c4
5f2b4de
02c2340
147cbdf
55e1d36
55acfe3
bedd4b9
21927ef
623bacf
43ea1b4
e32f007
bff8090
0a25910
3f0a4f2
d24dbc2
2e62758
2c9bd78
863c869
e0cecb1
d0317b3
8365099
ec82685
dc0d717
c4c4cdd
6e691fc
0010ceb
0b9eb03
4843d63
caf6987
a246afc
c6f2033
978f4f4
a8069dc
3851398
6c363f5
c66aefd
8fc3108
7364f41
a0acb58
f04a10c
59ab3ce
ae3fe65
79c0f89
d4bb593
96a693d
0796a6c
ad658b5
c270393
4ad00c5
8e516b2
f138251
8973802
76c6363
dd3cd93
05d52af
f3211b8
147dc83
d1af44c
e8398d2
cd4f11f
2bb6750
3bcaa98
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,10 @@ type config struct { | |
// 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). Use NewTxConfigWithTextual | ||
// to enable SIGN_MODE_TEXTUAL (for testing purposes for now). | ||
// | ||
// We prefer to use depinject to provide client.TxConfig, but we permit this constructor usage. Within the SDK, | ||
// this constructor is primarily used in tests, but also sees usage in app chains like: | ||
// https://github.com/evmos/evmos/blob/719363fbb92ff3ea9649694bd088e4c6fe9c195f/encoding/config.go#L37 | ||
// TODO: collapse enabledSignModes and customSignModes | ||
func NewTxConfig(protoCodec codec.ProtoCodecMarshaler, enabledSignModes []signingtypes.SignMode, | ||
customSignModes ...txsigning.SignModeHandler, | ||
|
@@ -39,7 +43,8 @@ func NewTxConfig(protoCodec codec.ProtoCodecMarshaler, enabledSignModes []signin | |
} | ||
} | ||
|
||
// prefer depinject usage but permit this; it is primary used in tests. | ||
// protoFiles should perhaps be a parameter to this function, but the choice was made here to not break the | ||
// NewTxConfig API. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Anything else to elaborate on this choice? I'm still wary of the internalized reference to a global value here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
protoFiles := sdk.MergedProtoRegistry() | ||
typeResolver := protoregistry.GlobalTypes | ||
signersContext, err := txsigning.NewGetSignersContext(txsigning.GetSignersOptions{ProtoFiles: protoFiles}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is unnecessary because of #15873. Just use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a compile error right now. I think it is OK to land this in main first then work on #15873 (which is still failing tests) then refactor? |
||
|
@@ -64,13 +69,21 @@ func NewTxConfig(protoCodec codec.ProtoCodecMarshaler, enabledSignModes []signin | |
return NewTxConfigWithHandler(protoCodec, makeSignModeHandler(enabledSignModes, signModeOptions, customSignModes...)) | ||
} | ||
|
||
func NewTxConfigWithOptions(protoCodec codec.ProtoCodecMarshaler, enabledSignModes []signingtypes.SignMode, | ||
signModeOptions SignModeOptions, customSignModes ...txsigning.SignModeHandler, | ||
) client.TxConfig { | ||
return NewTxConfigWithHandler(protoCodec, makeSignModeHandler(enabledSignModes, signModeOptions, customSignModes...)) | ||
} | ||
|
||
// NewTxConfigWithTextual is like NewTxConfig with the ability to add | ||
// a SIGN_MODE_TEXTUAL renderer. It is currently still EXPERIMENTAL, for should | ||
// be used for TESTING purposes only, until Textual is fully released. | ||
// | ||
// Deprecated: use NewTxConfigWithOptions instead. | ||
func NewTxConfigWithTextual(protoCodec codec.ProtoCodecMarshaler, enabledSignModes []signingtypes.SignMode, | ||
signModeOptions SignModeOptions, customSignModes ...txsigning.SignModeHandler, | ||
) client.TxConfig { | ||
return NewTxConfigWithHandler(protoCodec, makeSignModeHandler(enabledSignModes, signModeOptions, customSignModes...)) | ||
return NewTxConfigWithOptions(protoCodec, enabledSignModes, signModeOptions, customSignModes...) | ||
} | ||
|
||
// NewTxConfigWithHandler returns a new protobuf TxConfig using the provided ProtoCodec and signing handler. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here too.