forked from cerc-io/laconicd
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>
This commit is contained in:
@@ -2,12 +2,29 @@ package module
|
||||
|
||||
import (
|
||||
autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
|
||||
|
||||
onboardingv1 "git.vdb.to/cerc-io/laconicd/api/cerc/onboarding/v1"
|
||||
)
|
||||
|
||||
// AutoCLIOptions implements the autocli.HasAutoCLIConfig interface.
|
||||
func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions {
|
||||
return &autocliv1.ModuleOptions{
|
||||
Query: nil,
|
||||
Tx: nil,
|
||||
// TODO: Use JSON file for input
|
||||
Tx: &autocliv1.ServiceCommandDescriptor{
|
||||
Service: onboardingv1.Msg_ServiceDesc.ServiceName,
|
||||
RpcCommandOptions: []*autocliv1.RpcCommandOptions{
|
||||
{
|
||||
RpcMethod: "OnboardParticipant",
|
||||
Use: "enroll",
|
||||
Short: "Enroll a testnet validator",
|
||||
PositionalArgs: []*autocliv1.PositionalArgDescriptor{
|
||||
{ProtoField: "ethPayload"},
|
||||
{ProtoField: "ethSignature"},
|
||||
{ProtoField: "message"},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion }
|
||||
func (am AppModule) RegisterServices(cfg module.Configurator) {
|
||||
// TODO: Implement
|
||||
// Register servers
|
||||
// onboarding.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper))
|
||||
onboarding.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper))
|
||||
// onboarding.RegisterQueryServer(cfg.QueryServer(), keeper.NewQueryServerImpl(am.keeper))
|
||||
|
||||
// Register in place module state migration migrations
|
||||
@@ -82,7 +82,7 @@ func (am AppModule) RegisterServices(cfg module.Configurator) {
|
||||
|
||||
// DefaultGenesis returns default genesis state as raw bytes for the module.
|
||||
func (AppModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {
|
||||
return cdc.MustMarshalJSON(onboarding.NewGenesisState())
|
||||
return cdc.MustMarshalJSON(onboarding.DefaultGenesisState())
|
||||
}
|
||||
|
||||
// ValidateGenesis performs genesis state validation for the circuit module.
|
||||
|
||||
Reference in New Issue
Block a user