-
Notifications
You must be signed in to change notification settings - Fork 4
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
fix(btcstaking): restore AddReceiver/RemoveReceiver #47
Conversation
Warning Rate limit exceeded@473n has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 20 minutes and 7 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughRecent updates to the Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Actionable comments posted: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
x/btcstaking/types/tx.pb.go
is excluded by!**/*.pb.go
Files selected for processing (3)
- proto/lorenzo/btcstaking/v1/tx.proto (2 hunks)
- x/btcstaking/keeper/msg_server.go (1 hunks)
- x/btcstaking/types/msg.go (3 hunks)
Additional comments not posted (8)
x/btcstaking/types/msg.go (6)
6-6
: Added import forerrorsmod
is appropriate given its use in error handling within the new message types.
17-18
: The interface assertions forMsgRemoveReceiver
andMsgAddReceiver
ensure that these types correctly implement thesdk.Msg
interface.
36-39
: TheGetSigners
method forMsgAddReceiver
correctly retrieves the address from theAuthority
field. Ensure that theAuthority
field is always set correctly as this method assumes it is in Bech32 format.
41-48
: TheValidateBasic
method forMsgAddReceiver
adequately checks for the validity of theAuthority
address and theReceiver
. The use oferrorsmod.Wrap
provides a clear error context.
51-54
: Similar toMsgAddReceiver
, theGetSigners
method forMsgRemoveReceiver
retrieves the signer's address. Consistency in handling addresses across message types is good practice.
56-63
: TheValidateBasic
method forMsgRemoveReceiver
performs necessary validations on theAuthority
address and checks if theReceiver
field is not empty, which is crucial for identifying the target receiver.proto/lorenzo/btcstaking/v1/tx.proto (2)
20-23
: The addition ofAddReceiver
andRemoveReceiver
RPC methods in the service definition allows external clients to interact with these functionalities through gRPC. Ensure that the corresponding server implementations are correctly handling these calls.
70-86
: The message typesMsgAddReceiver
andMsgRemoveReceiver
are well-defined with necessary fields. The use of[ (cosmos_proto.scalar) = "cosmos.AddressString" ]
ensures that theauthority
field is treated as a string representation of an address, which is consistent with Cosmos SDK standards.
x/btcstaking/keeper/msg_server.go
Outdated
func (ms msgServer) AddReceiver(goCtx context.Context, req *types.MsgAddReceiver) (*types.MsgAddReceiverResponse, error) { | ||
return nil, fmt.Errorf("deprecated, use UpdateParams instead") | ||
} | ||
func (ms msgServer) RemoveReceiver(goCtx context.Context, req *types.MsgRemoveReceiver) (*types.MsgRemoveReceiverResponse, error) { | ||
return nil, fmt.Errorf("deprecated, use UpdateParams instead") | ||
} |
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.
The methods AddReceiver
and RemoveReceiver
are marked as deprecated and advise the use of UpdateParams
instead. If these methods are not intended to be used, consider removing them or implementing a redirect mechanism within these methods to UpdateParams
.
message MsgAddReceiver { | ||
option (cosmos.msg.v1.signer) = "authority"; | ||
|
||
string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; | ||
|
||
Receiver receiver = 2 [ (gogoproto.nullable) = false ]; | ||
} | ||
|
||
message MsgAddReceiverResponse {} | ||
message MsgRemoveReceiver { |
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.
MsgAddReceiver
and MsgRemoveReceiver
should be registered.example:
func RegisterInterfaces(registry cdctypes.InterfaceRegistry) {
// Register messages
registry.RegisterImplementations(
(*sdk.Msg)(nil),
&MsgCreateBTCStaking{},
&MsgBurnRequest{},
&MsgAddReceiver{},
&MsgRemoveReceiver{},
)
msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
}
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.
done.
Summary by CodeRabbit
New Features
Deprecations
AddReceiver
andRemoveReceiver
methods now return deprecation errors, advising the use ofUpdateParams
instead.