fix: amino JSON signing for MsgSetRoutingIsmDomain#157
Conversation
Add a unit test that reproduces the bug where Amino JSON signing fails for MsgSetRoutingIsmDomain with "unknown protobuf field" because the nested Route message's field descriptors are not resolvable via gogoproto.HybridResolver. Also add a TxConfig() accessor to simapp.App for future integration-level amino signing tests. Closes bcp-innovations#156 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Go runs init() functions in alphabetical file order. Since tx.pb.go
sorts before types.pb.go, tx.proto's file descriptor was registered
first. tx.proto references the Route message from types.proto, but
types.proto wasn't in the registry yet, so Route became a placeholder
with 0 fields. This broke Amino JSON signing because RejectUnknownFields
saw the 0-field placeholder and rejected all Route fields as unknown.
Add proto_init.go which sorts before tx.pb.go ('p' < 't') and registers
types.proto early. When tx.pb.go's init() subsequently processes
tx.proto, it resolves Route correctly from the registry.
Closes bcp-innovations#156
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
IMO this was super hacky so I researched two alternatives:
|
|
The same bug is likely also occurring for warp tx.proto and types.proto because tx.proto imports
|
|
TBH I think this implementation is hacky and doesn't resolve it for all modules. Going to opt for
|
|
We should probably do the proto init thing for x/warp too. |
…ning Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… JSON signing Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
MsgSetRoutingIsmDomain
|
Updated the PR title. This PR actually fixes amino JSON signing for multiple messages but that would be a long PR title. |
|
I just read the contributor guidelines and this prob deserves a CHANGELOG. |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Hey, this deserves a Changelog, but will add this later. |
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> (cherry picked from commit 0afaa4a)
…161) Co-authored-by: Rootul P <rootulp@gmail.com>
|
I added a changelog in a787d3a |
Closes #156
Summary
MsgSetRoutingIsmDomainfail with"unknown protobuf field"for the nestedRoutemessageproto_init.goto registertypes.protobeforetx.proto, ensuringRouteresolves correctlyGetSignBytessucceeds forMsgSetRoutingIsmDomainRoot Cause
Go runs
init()functions in alphabetical file order. Sincetx.pb.gosorts beforetypes.pb.go('x' < 'y'),tx.proto's file descriptor was registered first.tx.protoreferences theRoutemessage fromtypes.proto, buttypes.protowasn't in the registry yet, soRoutebecame a placeholder with 0 fields.RejectUnknownFieldsused this broken placeholder and rejected allRoutefields as unknown.Fix
proto_init.gosorts beforetx.pb.go('p' < 't') and registerstypes.protoearly. Whentx.pb.go'sinit()subsequently processestx.proto,Routeresolves correctly from the registry with its 2 fields.Context
See celestia-app#6541 for the original report. This blocked Celestia's multisig signers from submitting
MsgSetRoutingIsmDomaintransactions.Test plan
go test ./x/core/01_interchain_security/types/ -run TestAminoJSONSigningMsgSetRoutingIsmDomain -vpasses🤖 Generated with Claude Code