Conversation
📝 WalkthroughWalkthroughThe PR removes the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested reviewers
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@api/sourcehub/bulletin/post.pulsar.go`:
- Around line 708-726: The deleted Post.proof field must be reserved to avoid
future tag/name reuse; in the proto definition for message Post
(proto/sourcehub/bulletin/post.proto) add a reserved declaration that reserves
tag 5 and the name "proof" (e.g., reserve the numeric tag 5 and the identifier
proof) so historical messages with proof bytes won't be mis-decoded by any
future field using that tag or name.
In `@x/bulletin/types/message_create_post.go`:
- Around line 11-16: The MsgCreatePost proto removed field 4 ("proof") but did
not reserve that number/name, so update proto/sourcehub/bulletin/tx.proto to add
`reserved 4;` and `reserved "proof";` inside the MsgCreatePost message, then
regenerate the Go types (which will update MsgCreatePost and NewMsgCreatePost in
message_create_post.go) so old serialized tx bytes don't map to a new field;
ensure the regenerated code retains the same constructor signature
(NewMsgCreatePost) and the MsgCreatePost struct but with the reserved comment
reflected.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 42ee7b4c-f676-434e-adb5-f0c2ded4e5d1
⛔ Files ignored due to path filters (2)
x/bulletin/types/post.pb.gois excluded by!**/*.pb.gox/bulletin/types/tx.pb.gois excluded by!**/*.pb.go
📒 Files selected for processing (12)
api/sourcehub/bulletin/post.pulsar.goapi/sourcehub/bulletin/tx.pulsar.goproto/sourcehub/bulletin/post.protoproto/sourcehub/bulletin/tx.protox/bulletin/keeper/bulletin_test.gox/bulletin/keeper/grpc_query_test.gox/bulletin/keeper/keeper_test.gox/bulletin/keeper/msg_server.gox/bulletin/keeper/msg_server_test.gox/bulletin/module/autocli.gox/bulletin/types/errors.gox/bulletin/types/message_create_post.go
💤 Files with no reviewable changes (8)
- proto/sourcehub/bulletin/post.proto
- x/bulletin/types/errors.go
- proto/sourcehub/bulletin/tx.proto
- x/bulletin/keeper/msg_server_test.go
- x/bulletin/keeper/grpc_query_test.go
- x/bulletin/keeper/bulletin_test.go
- x/bulletin/keeper/keeper_test.go
- x/bulletin/keeper/msg_server.go
📜 Review details
🔇 Additional comments (1)
x/bulletin/module/autocli.go (1)
74-77: Looks good.The
create-postcommand now aligns with the updated schema after removingproof.
| 0x74, 0x69, 0x6e, 0x22, 0x6f, 0x0a, 0x04, 0x50, 0x6f, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, | ||
| 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x6e, | ||
| 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, | ||
| 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x72, 0x65, | ||
| 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x64, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, | ||
| 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x44, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, | ||
| 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x61, 0x79, | ||
| 0x6c, 0x6f, 0x61, 0x64, 0x42, 0xb1, 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x6f, 0x75, | ||
| 0x72, 0x63, 0x65, 0x68, 0x75, 0x62, 0x2e, 0x62, 0x75, 0x6c, 0x6c, 0x65, 0x74, 0x69, 0x6e, 0x42, | ||
| 0x09, 0x50, 0x6f, 0x73, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x23, 0x63, 0x6f, | ||
| 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, | ||
| 0x6f, 0x75, 0x72, 0x63, 0x65, 0x68, 0x75, 0x62, 0x2f, 0x62, 0x75, 0x6c, 0x6c, 0x65, 0x74, 0x69, | ||
| 0x6e, 0xa2, 0x02, 0x03, 0x53, 0x42, 0x58, 0xaa, 0x02, 0x12, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, | ||
| 0x68, 0x75, 0x62, 0x2e, 0x42, 0x75, 0x6c, 0x6c, 0x65, 0x74, 0x69, 0x6e, 0xca, 0x02, 0x12, 0x53, | ||
| 0x6f, 0x75, 0x72, 0x63, 0x65, 0x68, 0x75, 0x62, 0x5c, 0x42, 0x75, 0x6c, 0x6c, 0x65, 0x74, 0x69, | ||
| 0x6e, 0xe2, 0x02, 0x1e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x68, 0x75, 0x62, 0x5c, 0x42, 0x75, | ||
| 0x6c, 0x6c, 0x65, 0x74, 0x69, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, | ||
| 0x74, 0x61, 0xea, 0x02, 0x13, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x68, 0x75, 0x62, 0x3a, 0x3a, | ||
| 0x42, 0x75, 0x6c, 0x6c, 0x65, 0x74, 0x69, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
sed -n '/message Post {/,/}/p' proto/sourcehub/bulletin/post.protoRepository: sourcenetwork/sourcehub
Length of output: 171
Reserve the deleted Post.proof tag/name in the proto schema.
Field 5 was removed from message Post but the tag and name are not reserved. For persisted messages stored in databases, this creates a compatibility issue: a future field added at tag 5 could decode historical proof bytes incorrectly.
Add the following to proto/sourcehub/bulletin/post.proto:
message Post {
+ reserved 5;
+ reserved "proof";
string id = 1;
string namespace = 2;
string creator_did = 3;
bytes payload = 4;
}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@api/sourcehub/bulletin/post.pulsar.go` around lines 708 - 726, The deleted
Post.proof field must be reserved to avoid future tag/name reuse; in the proto
definition for message Post (proto/sourcehub/bulletin/post.proto) add a reserved
declaration that reserves tag 5 and the name "proof" (e.g., reserve the numeric
tag 5 and the identifier proof) so historical messages with proof bytes won't be
mis-decoded by any future field using that tag or name.
| func NewMsgCreatePost(creator string, namespace string, payload []byte) *MsgCreatePost { | ||
| return &MsgCreatePost{ | ||
| Creator: creator, | ||
| Namespace: namespace, | ||
| Payload: payload, | ||
| Proof: proof, | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
sed -n '/message MsgCreatePost {/,/}/p' proto/sourcehub/bulletin/tx.protoRepository: sourcenetwork/sourcehub
Length of output: 227
Reserve the removed MsgCreatePost.proof wire slot.
The proto definition at proto/sourcehub/bulletin/tx.proto omits field 4 (the removed proof field) but lacks corresponding reserved declarations. Field number 4 and the name "proof" must be reserved to prevent accidental reuse, which would cause older transaction bytes to deserialize incorrectly into a different field.
Add the following to the MsgCreatePost message:
Required proto change
message MsgCreatePost {
option (cosmos.msg.v1.signer) = "creator";
+ reserved 4;
+ reserved "proof";
string creator = 1;
string namespace = 2;
bytes payload = 3;
string artifact = 5;
}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@x/bulletin/types/message_create_post.go` around lines 11 - 16, The
MsgCreatePost proto removed field 4 ("proof") but did not reserve that
number/name, so update proto/sourcehub/bulletin/tx.proto to add `reserved 4;`
and `reserved "proof";` inside the MsgCreatePost message, then regenerate the Go
types (which will update MsgCreatePost and NewMsgCreatePost in
message_create_post.go) so old serialized tx bytes don't map to a new field;
ensure the regenerated code retains the same constructor signature
(NewMsgCreatePost) and the MsgCreatePost struct but with the reserved comment
reflected.
Description
This PR updates the bulletin
Postand updates related logic & tests.