laconicd/x/onboarding/msgs.go
Isha Venikar a21e9ea387 Implement onboarding module for testnet validator enrollment (#3)
* Add proto files for onboarding module

* Add generated proto bindings

* Define onboarding object

* Define the participants state in keeper

* Update genesis file to initialize and export module state to/from genesis

* Add msg to onboard participant

* Register command to enroll participant

* Add functionality to decode ethereum address from signature

* Add comments for messages and fields

* Fix lint errors in proto files

* Add message validation and events in msg_server

* Reuse crypto utils from go-nitro

* Sign entire eth_payload object

* Use google API for rpc method

* Regenerate proto bindings

---------

Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-07-16 09:25:39 +05:30

28 lines
613 B
Go

package onboarding
import (
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)
var (
_ sdk.Msg = &MsgOnboardParticipant{}
)
func (msg MsgOnboardParticipant) ValidateBasic() error {
if len(msg.Participant) == 0 {
return errorsmod.Wrap(sdkerrors.ErrorInvalidSigner, msg.Participant)
}
if len(msg.EthPayload.Address) != 42 {
return errorsmod.Wrap(sdkerrors.ErrInvalidAddress, msg.Participant)
}
if len(msg.EthSignature) != 132 {
return errorsmod.Wrap(sdkerrors.ErrNoSignatures, "Invalid signature.")
}
return nil
}