Update keeper to onboard a participant
Some checks failed
Protobuf / lint (pull_request) Successful in 1m8s
Build / build (pull_request) Successful in 2m40s
Integration Tests / test-integration (pull_request) Successful in 2m56s
E2E Tests / test-e2e (pull_request) Successful in 4m55s
Unit Tests / test-unit (pull_request) Successful in 1m58s
SDK Tests / sdk_tests_nameservice_expiry (pull_request) Successful in 8m6s
SDK Tests / sdk_tests (pull_request) Failing after 10m4s
SDK Tests / sdk_tests_auctions (pull_request) Successful in 14m34s

This commit is contained in:
Prathamesh Musale 2024-07-25 16:34:40 +05:30
parent f3d6e44af1
commit 9bc09b9259
3 changed files with 14 additions and 2 deletions

View File

@ -100,6 +100,8 @@ func (k Keeper) OnboardParticipant(
participant := &onboardingTypes.Participant{ participant := &onboardingTypes.Participant{
CosmosAddress: signerAddress.String(), CosmosAddress: signerAddress.String(),
NitroAddress: nitroAddress, NitroAddress: nitroAddress,
Role: msg.Role,
KycId: msg.KycId,
} }
if err := k.StoreParticipant(ctx, participant); err != nil { if err := k.StoreParticipant(ctx, participant); err != nil {

View File

@ -26,11 +26,13 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions {
RpcCommandOptions: []*autocliv1.RpcCommandOptions{ RpcCommandOptions: []*autocliv1.RpcCommandOptions{
{ {
RpcMethod: "OnboardParticipant", RpcMethod: "OnboardParticipant",
Use: "enroll", Use: "enroll [eth_payload] [eth_signature] [role] [kyc_id]",
Short: "Enroll a testnet validator", Short: "Enroll a testnet validator",
PositionalArgs: []*autocliv1.PositionalArgDescriptor{ PositionalArgs: []*autocliv1.PositionalArgDescriptor{
{ProtoField: "eth_payload"}, {ProtoField: "eth_payload"},
{ProtoField: "eth_signature"}, {ProtoField: "eth_signature"},
{ProtoField: "role"},
{ProtoField: "kyc_id"},
}, },
}, },
}, },

View File

@ -18,7 +18,15 @@ func (msg MsgOnboardParticipant) ValidateBasic() error {
} }
if len(msg.EthSignature) != 132 { if len(msg.EthSignature) != 132 {
return errorsmod.Wrap(sdkerrors.ErrNoSignatures, "Invalid signature.") return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "Invalid signature.")
}
if msg.Role == ROLE_UNSPECIFIED {
return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "Participant role not specified.")
}
if len(msg.KycId) == 0 {
return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "Empty KYC ID.")
} }
return nil return nil