Skip to content

chore: Remove proof from bulletin post#107

Merged
iverc merged 4 commits intodevfrom
iverc/fix-bulletin-post
Apr 7, 2026
Merged

chore: Remove proof from bulletin post#107
iverc merged 4 commits intodevfrom
iverc/fix-bulletin-post

Conversation

@iverc
Copy link
Copy Markdown
Contributor

@iverc iverc commented Apr 7, 2026

Description

This PR updates the bulletin Post and updates related logic & tests.

@iverc iverc requested a review from JesseAbram April 7, 2026 04:44
@iverc iverc self-assigned this Apr 7, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 7, 2026

📝 Walkthrough

Walkthrough

The PR removes the proof field from both the Post message and MsgCreatePost message across protobuf definitions, generated Pulsar Go code, business logic, tests, CLI, and error handling. The field removal is propagated through all dependent code including message constructors, validation, keeper operations, and test fixtures.

Changes

Cohort / File(s) Summary
Proto Definitions
proto/sourcehub/bulletin/post.proto, proto/sourcehub/bulletin/tx.proto
Removed bytes proof field declaration from Post message (field 5) and MsgCreatePost message (field 4).
Generated Pulsar Code
api/sourcehub/bulletin/post.pulsar.go, api/sourcehub/bulletin/tx.pulsar.go
Removed field descriptor, fast reflection support (Range, Has, Clear, Get, Set, Mutable), marshalling logic, unmarshal branch, struct field, and getter method for proof in both Post and MsgCreatePost. Updated embedded raw protobuf descriptors.
Message Types & Errors
x/bulletin/types/message_create_post.go, x/bulletin/types/errors.go
Removed proof parameter from NewMsgCreatePost constructor, removed proof validation from ValidateBasic, and deleted ErrInvalidPostProof sentinel error.
Keeper & Server Logic
x/bulletin/keeper/msg_server.go
Removed Proof field assignment from post creation literal in CreatePost method.
CLI
x/bulletin/module/autocli.go
Removed [proof] positional argument from CreatePost RPC command in autocli descriptor.
Tests
x/bulletin/keeper/bulletin_test.go, x/bulletin/keeper/keeper_test.go, x/bulletin/keeper/msg_server_test.go, x/bulletin/keeper/grpc_query_test.go
Removed Proof field initialization from types.Post and types.MsgCreatePost test fixtures; removed proof assertions and an entire negative test case validating proof errors.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • fix: Protos #104: Modifies generated MsgCreatePost protobuf Go code in tx.pulsar.go and related types, adding an artifact field while this PR removes the proof field from the same message definitions.

Suggested reviewers

  • JesseAbram

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between f0564ce and abff9da.

⛔ Files ignored due to path filters (2)
  • x/bulletin/types/post.pb.go is excluded by !**/*.pb.go
  • x/bulletin/types/tx.pb.go is excluded by !**/*.pb.go
📒 Files selected for processing (12)
  • api/sourcehub/bulletin/post.pulsar.go
  • api/sourcehub/bulletin/tx.pulsar.go
  • proto/sourcehub/bulletin/post.proto
  • proto/sourcehub/bulletin/tx.proto
  • x/bulletin/keeper/bulletin_test.go
  • x/bulletin/keeper/grpc_query_test.go
  • x/bulletin/keeper/keeper_test.go
  • x/bulletin/keeper/msg_server.go
  • x/bulletin/keeper/msg_server_test.go
  • x/bulletin/module/autocli.go
  • x/bulletin/types/errors.go
  • x/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-post command now aligns with the updated schema after removing proof.

Comment on lines +708 to +726
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,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
sed -n '/message Post {/,/}/p' proto/sourcehub/bulletin/post.proto

Repository: 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.

Comment on lines +11 to 16
func NewMsgCreatePost(creator string, namespace string, payload []byte) *MsgCreatePost {
return &MsgCreatePost{
Creator: creator,
Namespace: namespace,
Payload: payload,
Proof: proof,
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
sed -n '/message MsgCreatePost {/,/}/p' proto/sourcehub/bulletin/tx.proto

Repository: 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.

@iverc iverc merged commit d5fe809 into dev Apr 7, 2026
2 checks passed
@iverc iverc deleted the iverc/fix-bulletin-post branch April 7, 2026 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants