-
Notifications
You must be signed in to change notification settings - Fork 405
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
Remove json type cast for contract msgs #520
Conversation
Codecov Report
@@ Coverage Diff @@
## master #520 +/- ##
==========================================
+ Coverage 58.68% 58.71% +0.03%
==========================================
Files 43 43
Lines 4504 4508 +4
==========================================
+ Hits 2643 2647 +4
Misses 1644 1644
Partials 217 217
|
This cast was there for historical reasons. Pre-stargate, we had annoying strings like @webmaster128 can correct me here if I am wrong, but I believe this change will have no impact on the The only other concern I have is the CLI query output. Can you check if this changes, and if it does, maybe a way to properly format/present this for such queries. Or will this only affect eg. block explorers?
If there are no issues breaking the output to clients, I am very supportive of this change. |
The gogoproto annotation does not change non-gogoproto code generation at all. So this is safe from my point of view. The annotation was invalid and it is good that it is removed because the type json.RawMessage
but we have no guerantee at all that the bytes sent are valid JSON. I.e. a simple cast is not good enough. If we needed that type, we had to do a validation followed by a cast. |
The CLI is using the GRPC query endpoint only. We store the init message with the Code history entry as raw json entry. The CLI query for this works as before:
{
"entries": [
{
"operation": "CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT",
"code_id": "2",
"msg": {
"verifier": "wasm1alz4eapgf0rq3ezf3xge9pz7uhkpdyu2mmrrup",
"beneficiary": "wasm18t98u4xqa8zaq3ewfeq0u7yeee8cqc2sq9keek"
}
},
{
"operation": "CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE",
"code_id": "3",
"msg": {
"payout": "wasm18t98u4xqa8zaq3ewfeq0u7yeee8cqc2sq9keek"
}
}
],
"pagination": {}
} I have not tested the query with the legacy REST endpoint but I would not expect any differences as the history model has not changed. |
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.
Thanks for responding to my question. Good answer and happy to see this merged in.
Removes the cast type as it can cause some issues when unmarshaling from base64 encoded type. Better let the standardlib handle this.