Rename ethereum_address to nitro_address in onboarding module (#8)

* Rename ethereum_address to nitro_address

* Use camel case for variables in gql schema

* Fix indentation in proto files

* Fix proto lint errors

---------

Co-authored-by: IshaVenikar <ishavenikar7@gmail.com>
This commit is contained in:
2024-07-16 09:25:39 +05:30
committed by nabarun
co-authored by IshaVenikar
parent f23f691646
commit a8a59ad0c1
13 changed files with 278 additions and 272 deletions
+5 -4
View File
@@ -87,18 +87,19 @@ func (k Keeper) OnboardParticipant(
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "Invalid format for payload")
}
ethereumAddress, err := utils.DecodeEthereumAddress(message, msg.EthSignature)
// Decode eth address from signature which should be the nitro address of the participant
nitroAddress, err := utils.DecodeEthereumAddress(message, msg.EthSignature)
if err != nil {
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "Failed to decode Ethereum address")
}
if ethereumAddress != msg.EthPayload.Address {
if nitroAddress != msg.EthPayload.Address {
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "Recovered ethereum address does not match the address set in payload")
}
participant := &onboardingTypes.Participant{
CosmosAddress: signerAddress.String(),
EthereumAddress: ethereumAddress,
CosmosAddress: signerAddress.String(),
NitroAddress: nitroAddress,
}
if err := k.StoreParticipant(ctx, participant); err != nil {
+36 -35
View File
@@ -68,10 +68,11 @@ func (m *Params) GetOnboardingEnabled() bool {
return false
}
// Participant defines the data that will be stored for each enrolled participant
// Participant defines the data that will be stored for each enrolled
// participant
type Participant struct {
CosmosAddress string `protobuf:"bytes,1,opt,name=cosmos_address,json=cosmosAddress,proto3" json:"cosmos_address,omitempty" json:"cosmos_address" yaml:"cosmos_address"`
EthereumAddress string `protobuf:"bytes,2,opt,name=ethereum_address,json=ethereumAddress,proto3" json:"ethereum_address,omitempty" json:"ethereum_address" yaml:"ethereum_address"`
CosmosAddress string `protobuf:"bytes,1,opt,name=cosmos_address,json=cosmosAddress,proto3" json:"cosmos_address,omitempty" json:"cosmos_address" yaml:"cosmos_address"`
NitroAddress string `protobuf:"bytes,2,opt,name=nitro_address,json=nitroAddress,proto3" json:"nitro_address,omitempty" json:"nitro_address" yaml:"nitro_address"`
}
func (m *Participant) Reset() { *m = Participant{} }
@@ -114,9 +115,9 @@ func (m *Participant) GetCosmosAddress() string {
return ""
}
func (m *Participant) GetEthereumAddress() string {
func (m *Participant) GetNitroAddress() string {
if m != nil {
return m.EthereumAddress
return m.NitroAddress
}
return ""
}
@@ -185,29 +186,29 @@ func init() {
}
var fileDescriptor_59afed779274eaf0 = []byte{
// 346 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x92, 0xcd, 0x4a, 0xc3, 0x40,
0x14, 0x85, 0x1b, 0x85, 0xaa, 0x23, 0xfe, 0x0d, 0x0a, 0x2a, 0x98, 0xd4, 0xb8, 0x29, 0x14, 0x33,
0x94, 0x2e, 0x04, 0x5d, 0x19, 0xe8, 0xbe, 0x64, 0xe1, 0xc2, 0x85, 0x65, 0x92, 0x8c, 0x69, 0x24,
0xc9, 0x2d, 0x33, 0x63, 0xb0, 0x6f, 0xe1, 0x4b, 0x09, 0x2e, 0xbb, 0x74, 0x15, 0xa4, 0x7d, 0x83,
0x3c, 0x81, 0x24, 0xd3, 0xf4, 0xd7, 0xdd, 0xcc, 0xb9, 0xe7, 0x7c, 0x67, 0x60, 0x2e, 0xba, 0xf1,
0x18, 0xf7, 0x08, 0x24, 0x2e, 0x50, 0xee, 0x87, 0x49, 0x40, 0xd2, 0xf6, 0xd2, 0xcd, 0x1a, 0x72,
0x90, 0x80, 0x71, 0x61, 0xb2, 0x96, 0xe4, 0xb4, 0x7d, 0x79, 0x1a, 0x40, 0x00, 0xe5, 0x98, 0x14,
0x27, 0xe5, 0x34, 0x87, 0xa8, 0xde, 0xa3, 0x9c, 0xc6, 0x02, 0xbf, 0x22, 0xbc, 0x08, 0xf4, 0x59,
0x42, 0xdd, 0x88, 0xf9, 0xe7, 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0xea,
0x41, 0x12, 0x7a, 0x3e, 0xf9, 0x58, 0xda, 0x12, 0xb7, 0x5e, 0x7e, 0x7e, 0xe7, 0x2f, 0x00, 0x00,
0xff, 0xff, 0x45, 0x07, 0xf1, 0x0c, 0x4d, 0x02, 0x00, 0x00,
// 343 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x92, 0xcf, 0x4a, 0xc3, 0x30,
0x1c, 0xc7, 0x57, 0x85, 0xa9, 0xd1, 0x09, 0x06, 0x05, 0x15, 0x6c, 0x67, 0xbd, 0x4c, 0xc6, 0x5a,
0xc6, 0x0e, 0x82, 0x9e, 0x2c, 0xec, 0x3e, 0x7a, 0xf0, 0xe0, 0x65, 0xa4, 0x7f, 0xac, 0x91, 0x36,
0xbf, 0x91, 0x84, 0xe2, 0xde, 0xc2, 0xd7, 0xf1, 0x0d, 0x3c, 0xee, 0xe8, 0xa9, 0xc8, 0xf6, 0x06,
0x7d, 0x02, 0x69, 0xb3, 0x6e, 0xeb, 0xf4, 0x96, 0xdf, 0xf7, 0xcf, 0xe7, 0x17, 0x48, 0xd0, 0x8d,
0x1f, 0x72, 0xdf, 0x06, 0xe6, 0x01, 0xe1, 0x01, 0x65, 0x91, 0x9d, 0xf6, 0x37, 0x26, 0x6b, 0xc2,
0x41, 0x02, 0xc6, 0x45, 0xc8, 0xda, 0x90, 0xd3, 0xfe, 0xe5, 0x69, 0x04, 0x11, 0x94, 0xb6, 0x5d,
0x9c, 0x54, 0xd2, 0x9c, 0xa0, 0xe6, 0x88, 0x70, 0x92, 0x08, 0xfc, 0x82, 0xf0, 0xba, 0x30, 0x0e,
0x19, 0xf1, 0xe2, 0x30, 0x38, 0xd7, 0xda, 0x5a, 0x67, 0xdf, 0xb9, 0xcb, 0x33, 0x63, 0xf0, 0x26,
0x80, 0xdd, 0x9b, 0x7f, 0x33, 0x66, 0x7b, 0x4a, 0x92, 0xf8, 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x34, 0x41, 0x02, 0x00, 0x00,
}
func (m *Params) Marshal() (dAtA []byte, err error) {
@@ -263,10 +264,10 @@ func (m *Participant) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
if len(m.EthereumAddress) > 0 {
i -= len(m.EthereumAddress)
copy(dAtA[i:], m.EthereumAddress)
i = encodeVarintOnboarding(dAtA, i, uint64(len(m.EthereumAddress)))
if len(m.NitroAddress) > 0 {
i -= len(m.NitroAddress)
copy(dAtA[i:], m.NitroAddress)
i = encodeVarintOnboarding(dAtA, i, uint64(len(m.NitroAddress)))
i--
dAtA[i] = 0x12
}
@@ -350,7 +351,7 @@ func (m *Participant) Size() (n int) {
if l > 0 {
n += 1 + l + sovOnboarding(uint64(l))
}
l = len(m.EthereumAddress)
l = len(m.NitroAddress)
if l > 0 {
n += 1 + l + sovOnboarding(uint64(l))
}
@@ -513,7 +514,7 @@ func (m *Participant) Unmarshal(dAtA []byte) error {
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field EthereumAddress", wireType)
return fmt.Errorf("proto: wrong wireType = %d for field NitroAddress", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
@@ -541,7 +542,7 @@ func (m *Participant) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.EthereumAddress = string(dAtA[iNdEx:postIndex])
m.NitroAddress = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
+2 -1
View File
@@ -92,7 +92,8 @@ func (m *MsgOnboardParticipant) GetEthSignature() string {
return ""
}
// MsgOnboardParticipantResponse defines the Msg/OnboardParticipant response type.
// MsgOnboardParticipantResponse defines the Msg/OnboardParticipant response
// type.
type MsgOnboardParticipantResponse struct {
}