(no commit message provided)

This commit is contained in:
Prad Nukala
2024-07-06 00:55:50 -04:00
committed by Prad Nukala (aider)
parent 2f976209db
commit 775150830f
13 changed files with 262 additions and 1601 deletions
+33 -332
View File
@@ -5,22 +5,18 @@ package types
import (
fmt "fmt"
_ "github.com/cosmos/cosmos-proto"
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/cosmos/gogoproto/proto"
io "io"
math "math"
math_bits "math/bits"
_ "github.com/cosmos/cosmos-proto"
types "github.com/cosmos/cosmos-sdk/x/auth/types"
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/cosmos/gogoproto/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
var (
_ = proto.Marshal
_ = fmt.Errorf
_ = math.Inf
)
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
@@ -28,54 +24,6 @@ var (
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// EthAccount implements the authtypes.AccountI interface and embeds an
// authtypes.BaseAccount type. It is compatible with the auth AccountKeeper.
type EthAccount struct {
// base_account is an authtypes.BaseAccount
*types.BaseAccount `protobuf:"bytes,1,opt,name=base_account,json=baseAccount,proto3,embedded=base_account" json:"base_account,omitempty" yaml:"base_account"`
// code_hash is the hash calculated from the code contents
CodeHash string `protobuf:"bytes,2,opt,name=code_hash,json=codeHash,proto3" json:"code_hash,omitempty" yaml:"code_hash"`
// controller is the address of the controller
Controller string `protobuf:"bytes,3,opt,name=controller,proto3" json:"controller,omitempty" yaml:"controller"`
}
func (m *EthAccount) Reset() { *m = EthAccount{} }
func (*EthAccount) ProtoMessage() {}
func (*EthAccount) Descriptor() ([]byte, []int) {
return fileDescriptor_f1c7ebf7d0ca3c72, []int{0}
}
func (m *EthAccount) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *EthAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_EthAccount.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *EthAccount) XXX_Merge(src proto.Message) {
xxx_messageInfo_EthAccount.Merge(m, src)
}
func (m *EthAccount) XXX_Size() int {
return m.Size()
}
func (m *EthAccount) XXX_DiscardUnknown() {
xxx_messageInfo_EthAccount.DiscardUnknown(m)
}
var xxx_messageInfo_EthAccount proto.InternalMessageInfo
// DIDDocument defines a DID document
type DIDDocument struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
@@ -90,13 +38,11 @@ func (m *DIDDocument) Reset() { *m = DIDDocument{} }
func (m *DIDDocument) String() string { return proto.CompactTextString(m) }
func (*DIDDocument) ProtoMessage() {}
func (*DIDDocument) Descriptor() ([]byte, []int) {
return fileDescriptor_f1c7ebf7d0ca3c72, []int{1}
return fileDescriptor_f1c7ebf7d0ca3c72, []int{0}
}
func (m *DIDDocument) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *DIDDocument) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_DIDDocument.Marshal(b, m, deterministic)
@@ -109,15 +55,12 @@ func (m *DIDDocument) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
return b[:n], nil
}
}
func (m *DIDDocument) XXX_Merge(src proto.Message) {
xxx_messageInfo_DIDDocument.Merge(m, src)
}
func (m *DIDDocument) XXX_Size() int {
return m.Size()
}
func (m *DIDDocument) XXX_DiscardUnknown() {
xxx_messageInfo_DIDDocument.DiscardUnknown(m)
}
@@ -177,13 +120,11 @@ func (m *VerificationMethod) Reset() { *m = VerificationMethod{} }
func (m *VerificationMethod) String() string { return proto.CompactTextString(m) }
func (*VerificationMethod) ProtoMessage() {}
func (*VerificationMethod) Descriptor() ([]byte, []int) {
return fileDescriptor_f1c7ebf7d0ca3c72, []int{2}
return fileDescriptor_f1c7ebf7d0ca3c72, []int{1}
}
func (m *VerificationMethod) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *VerificationMethod) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_VerificationMethod.Marshal(b, m, deterministic)
@@ -196,15 +137,12 @@ func (m *VerificationMethod) XXX_Marshal(b []byte, deterministic bool) ([]byte,
return b[:n], nil
}
}
func (m *VerificationMethod) XXX_Merge(src proto.Message) {
xxx_messageInfo_VerificationMethod.Merge(m, src)
}
func (m *VerificationMethod) XXX_Size() int {
return m.Size()
}
func (m *VerificationMethod) XXX_DiscardUnknown() {
xxx_messageInfo_VerificationMethod.DiscardUnknown(m)
}
@@ -233,7 +171,6 @@ func (m *VerificationMethod) GetPublicKey() *PublicKey {
}
func init() {
proto.RegisterType((*EthAccount)(nil), "did.v1.EthAccount")
proto.RegisterType((*DIDDocument)(nil), "did.v1.DIDDocument")
proto.RegisterType((*VerificationMethod)(nil), "did.v1.VerificationMethod")
}
@@ -241,90 +178,31 @@ func init() {
func init() { proto.RegisterFile("did/v1/account.proto", fileDescriptor_f1c7ebf7d0ca3c72) }
var fileDescriptor_f1c7ebf7d0ca3c72 = []byte{
// 544 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x53, 0x3d, 0x6f, 0xd3, 0x40,
0x18, 0xb6, 0x5d, 0x28, 0xcd, 0x05, 0x95, 0xf6, 0x9a, 0x4a, 0x26, 0x48, 0x76, 0xe4, 0x01, 0x85,
0xa1, 0x36, 0x49, 0xc5, 0x52, 0xb1, 0x10, 0x05, 0x44, 0x84, 0x2a, 0x21, 0x0f, 0x1d, 0x58, 0xcc,
0xd9, 0x3e, 0xe2, 0x53, 0x1d, 0x5f, 0xe4, 0xbb, 0x98, 0xfa, 0x1f, 0x30, 0x32, 0x32, 0x66, 0x65,
0x63, 0xe0, 0x47, 0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39, 0xd8, 0x16, 0x0d, 0x36, 0x98, 0x95, 0x01, 0xb8, 0xdb, 0xe7, 0xce, 0xc4,
0x8c, 0x7f, 0x16, 0x2c, 0x8e, 0xa2, 0xba, 0x49, 0xf8, 0x14, 0x80, 0xf1, 0xc4, 0x8f, 0x49, 0xe0,
0x5d, 0xe3, 0x5c, 0x1c, 0x40, 0xbd, 0x7b, 0x5c, 0xce, 0xf1, 0xad, 0x40, 0xde, 0xe0, 0xdc, 0xad,
0x8d, 0xcb, 0x67, 0xef, 0xf9, 0x8f, 0x85, 0xa1, 0xce, 0x16, 0x86, 0xfa, 0x7b, 0x61, 0xa8, 0x9f,
0x97, 0x86, 0x32, 0x5b, 0x1a, 0xca, 0xaf, 0xa5, 0xa1, 0xbc, 0xb3, 0x2a, 0x57, 0x40, 0x13, 0x46,
0x93, 0xd4, 0x89, 0x3e, 0xa2, 0xdc, 0xb9, 0x71, 0xd6, 0xff, 0x87, 0x58, 0xbf, 0xbf, 0x2f, 0xfe,
0x8d, 0xf3, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x6c, 0xbf, 0x4c, 0xf3, 0xa2, 0x03, 0x00, 0x00,
}
func (m *EthAccount) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *EthAccount) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *EthAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Controller) > 0 {
i -= len(m.Controller)
copy(dAtA[i:], m.Controller)
i = encodeVarintAccount(dAtA, i, uint64(len(m.Controller)))
i--
dAtA[i] = 0x1a
}
if len(m.CodeHash) > 0 {
i -= len(m.CodeHash)
copy(dAtA[i:], m.CodeHash)
i = encodeVarintAccount(dAtA, i, uint64(len(m.CodeHash)))
i--
dAtA[i] = 0x12
}
if m.BaseAccount != nil {
{
size, err := m.BaseAccount.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintAccount(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
// 374 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x91, 0xb1, 0x8e, 0x9b, 0x40,
0x10, 0x86, 0x0d, 0x4e, 0x9c, 0x78, 0x2d, 0x39, 0xc9, 0x86, 0x48, 0xc4, 0x05, 0x42, 0x2e, 0x22,
0xd2, 0x40, 0x6c, 0xb7, 0xa9, 0x22, 0x1a, 0x2b, 0xb2, 0x14, 0x51, 0xa4, 0x48, 0x83, 0x60, 0x77,
0x03, 0xab, 0x83, 0x1d, 0xc4, 0x2e, 0xdc, 0xf1, 0x16, 0xf7, 0x1a, 0xf7, 0x26, 0x57, 0xba, 0xbc,
0xf2, 0x64, 0xbf, 0xc8, 0xc9, 0x80, 0x7d, 0x96, 0xdd, 0x0d, 0xdf, 0xff, 0xcf, 0xcf, 0xec, 0x0c,
0x32, 0x28, 0xa7, 0x5e, 0xbd, 0xf0, 0x22, 0x42, 0xa0, 0x12, 0xca, 0x2d, 0x4a, 0x50, 0x80, 0x47,
0x94, 0x53, 0xb7, 0x5e, 0xcc, 0xbe, 0x12, 0x90, 0x39, 0xc8, 0xb0, 0xa5, 0x5e, 0xf7, 0xd1, 0x59,
0x66, 0x46, 0x02, 0x09, 0x74, 0xfc, 0x50, 0x1d, 0x69, 0x1f, 0x97, 0x30, 0xc1, 0x24, 0xef, 0xbd,
0xf3, 0x07, 0x1d, 0x4d, 0xfc, 0xb5, 0xef, 0x03, 0xa9, 0x72, 0x26, 0x14, 0x9e, 0x22, 0x9d, 0x53,
0x53, 0xb3, 0x35, 0x67, 0x1c, 0xe8, 0x9c, 0xe2, 0x0d, 0x32, 0x6a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0xdc, 0x03, 0x21, 0x41, 0x94, 0x5e, 0x7a, 0x1b, 0x35, 0xde, 0x9d, 0x77, 0x38, 0xb6,
0x6a, 0x0a, 0x26, 0xe3, 0x51, 0x7b, 0xe8, 0xd5, 0x4b, 0x00, 0x00, 0x00, 0xff, 0xff, 0x30, 0x7a,
0x87, 0xb1, 0x4f, 0x02, 0x00, 0x00,
}
func (m *DIDDocument) Marshal() (dAtA []byte, err error) {
@@ -467,28 +345,6 @@ func encodeVarintAccount(dAtA []byte, offset int, v uint64) int {
dAtA[offset] = uint8(v)
return base
}
func (m *EthAccount) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.BaseAccount != nil {
l = m.BaseAccount.Size()
n += 1 + l + sovAccount(uint64(l))
}
l = len(m.CodeHash)
if l > 0 {
n += 1 + l + sovAccount(uint64(l))
}
l = len(m.Controller)
if l > 0 {
n += 1 + l + sovAccount(uint64(l))
}
return n
}
func (m *DIDDocument) Size() (n int) {
if m == nil {
return 0
@@ -556,162 +412,9 @@ func (m *VerificationMethod) Size() (n int) {
func sovAccount(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozAccount(x uint64) (n int) {
return sovAccount(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *EthAccount) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowAccount
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: EthAccount: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: EthAccount: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BaseAccount", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowAccount
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthAccount
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthAccount
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.BaseAccount == nil {
m.BaseAccount = &types.BaseAccount{}
}
if err := m.BaseAccount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CodeHash", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowAccount
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthAccount
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthAccount
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.CodeHash = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Controller", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowAccount
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthAccount
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthAccount
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Controller = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipAccount(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthAccount
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *DIDDocument) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
@@ -956,7 +659,6 @@ func (m *DIDDocument) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *VerificationMethod) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
@@ -1107,7 +809,6 @@ func (m *VerificationMethod) Unmarshal(dAtA []byte) error {
}
return nil
}
func skipAccount(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
-146
View File
@@ -1,146 +0,0 @@
// Copyright Tharsis Labs Ltd.(Evmos)
// SPDX-License-Identifier:ENCL-1.0(https://github.com/evmos/evmos/blob/main/LICENSE)
package types
import (
"bytes"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
)
var (
_ authtypes.AccountI = (*EthAccount)(nil)
_ EthAccountI = (*EthAccount)(nil)
_ authtypes.GenesisAccount = (*EthAccount)(nil)
_ codectypes.UnpackInterfacesMessage = (*EthAccount)(nil)
)
var emptyCodeHash = crypto.Keccak256(nil)
const (
// AccountTypeEOA defines the type for externally owned accounts (EOAs)
AccountTypeEOA = int8(iota + 1)
// AccountTypeContract defines the type for contract accounts
AccountTypeContract
)
// EthAccountI represents the interface of an EVM compatible account
type EthAccountI interface {
authtypes.AccountI
// EthAddress returns the ethereum Address representation of the AccAddress
EthAddress() common.Address
// CodeHash is the keccak256 hash of the contract code (if any)
GetCodeHash() common.Hash
// SetCodeHash sets the code hash to the account fields
SetCodeHash(code common.Hash) error
// Type returns the type of Ethereum Account (EOA or Contract)
Type() int8
}
// ----------------------------------------------------------------------------
// Main Evmos account
// ----------------------------------------------------------------------------
// ProtoAccount defines the prototype function for BaseAccount used for an
// AccountKeeper.
func ProtoAccount() authtypes.AccountI {
return &EthAccount{
BaseAccount: &authtypes.BaseAccount{},
CodeHash: common.BytesToHash(emptyCodeHash).String(),
}
}
// GetAccountNumber returns account number.
func (acc EthAccount) GetAccountNumber() uint64 {
return acc.BaseAccount.AccountNumber
}
// GetAddress returns account address.
func (acc EthAccount) GetAddress() sdk.AccAddress {
addr, _ := sdk.AccAddressFromBech32(acc.BaseAccount.Address)
return addr
}
// GetBaseAccount returns base account.
func (acc EthAccount) GetBaseAccount() *authtypes.BaseAccount {
return acc.BaseAccount
}
// GetPubKey returns the PubKey
func (acc EthAccount) GetPubKey() cryptotypes.PubKey {
return acc.GetBaseAccount().GetPubKey()
}
// GetSequence returns the sequence
func (acc EthAccount) GetSequence() uint64 {
return acc.BaseAccount.Sequence
}
// EthAddress returns the account address ethereum format.
func (acc EthAccount) EthAddress() common.Address {
return common.BytesToAddress(acc.GetAddress().Bytes())
}
// GetCodeHash returns the account code hash in byte format
func (acc EthAccount) GetCodeHash() common.Hash {
return common.HexToHash(acc.CodeHash)
}
// SetAccountNumber sets the account number
func (acc *EthAccount) SetAccountNumber(accNum uint64) error {
acc.BaseAccount.AccountNumber = accNum
return nil
}
// SetAddress sets the address
func (acc *EthAccount) SetAddress(addr sdk.AccAddress) error {
acc.BaseAccount.Address = addr.String()
return nil
}
// SetCodeHash sets the account code hash to the EthAccount fields
func (acc *EthAccount) SetCodeHash(codeHash common.Hash) error {
acc.CodeHash = codeHash.Hex()
return nil
}
// SetPubKey sets the pubkey
func (acc *EthAccount) SetPubKey(pubkey cryptotypes.PubKey) error {
acc.BaseAccount.PubKey = codectypes.UnsafePackAny(pubkey)
return nil
}
// SetSequence sets the sequence
func (acc *EthAccount) SetSequence(seq uint64) error {
acc.BaseAccount.Sequence = seq
return nil
}
// Type returns the type of Ethereum Account (EOA or Contract)
func (acc EthAccount) Type() int8 {
if bytes.Equal(emptyCodeHash, common.HexToHash(acc.CodeHash).Bytes()) {
return AccountTypeEOA
}
return AccountTypeContract
}
// Stringreturns the string representation of the EthAccount
func (acc EthAccount) String() string {
return acc.EthAddress().String()
}
// Validate checks if the Evmos account fields are valid
func (acc EthAccount) Validate() error {
return nil
}
// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces
func (acc EthAccount) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
return nil
}
+4 -14
View File
@@ -4,10 +4,8 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
// this line is used by starport scaffolding # 1
)
@@ -28,18 +26,10 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
}
func RegisterInterfaces(registry types.InterfaceRegistry) {
registry.RegisterImplementations(
(*authtypes.AccountI)(nil),
&EthAccount{},
)
registry.RegisterImplementations(
(*authtypes.GenesisAccount)(nil),
&EthAccount{},
)
registry.RegisterImplementations(
(*cryptotypes.PubKey)(nil),
&PublicKey{},
)
//registry.RegisterImplementations(
//(*cryptotypes.PubKey)(nil),
// &PublicKey{},
//)
registry.RegisterImplementations(
(*sdk.Msg)(nil),
-71
View File
@@ -1,71 +0,0 @@
package types
import (
"bytes"
"encoding/hex"
fmt "fmt"
"math/big"
cmtcrypto "github.com/cometbft/cometbft/crypto"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
"golang.org/x/crypto/sha3"
"github.com/onsonr/crypto/core/curves"
"github.com/onsonr/crypto/signatures/ecdsa"
)
// Address returns the address of the public key
func (k *PublicKey) Address() cryptotypes.Address {
return cmtcrypto.AddressHash(k.Key)
}
// Bytes returns the byte representation of the public key
func (k *PublicKey) Bytes() []byte {
return k.Key
}
// String returns the hex string representation of the public key
func (k *PublicKey) String() string {
return hex.EncodeToString(k.Key)
}
// VerifySignature verifies the signature of a message
func (k *PublicKey) VerifySignature(msg []byte, sig []byte) bool {
pp, err := BuildEcPoint(k.Key)
if err != nil {
return false
}
sigEd, err := ecdsa.DeserializeSecp256k1Signature(sig)
if err != nil {
return false
}
hash := sha3.New256()
_, err = hash.Write(msg)
if err != nil {
return false
}
digest := hash.Sum(nil)
return curves.VerifyEcdsa(pp, digest[:], sigEd)
}
// Equals returns true if the public keys are equal
func (k *PublicKey) Equals(other cryptotypes.PubKey) bool {
return bytes.Equal(k.Key, other.Bytes())
}
// Type returns the public key type
func (k *PublicKey) Type() string {
return k.KeyType
}
// BuildEcPoint builds an elliptic curve point from a compressed byte slice
func BuildEcPoint(pubKey []byte) (*curves.EcPoint, error) {
crv := curves.K256()
x := new(big.Int).SetBytes(pubKey[1:33])
y := new(big.Int).SetBytes(pubKey[33:])
ecCurve, err := crv.ToEllipticCurve()
if err != nil {
return nil, fmt.Errorf("error converting curve: %v", err)
}
return &curves.EcPoint{X: x, Y: y, Curve: ecCurve}, nil
}
+59 -74
View File
@@ -112,7 +112,7 @@ type Controller struct {
// The DID of the controller
Did string `protobuf:"bytes,2,opt,name=did,proto3" json:"did,omitempty"`
// The public key of the controller
PublicKey *PublicKey `protobuf:"bytes,3,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
PublicKey []byte `protobuf:"bytes,3,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
// The vault address or identifier
VaultCid string `protobuf:"bytes,4,opt,name=vault_cid,json=vaultCid,proto3" json:"vault_cid,omitempty"`
// Fingerprint is the Accumulator of discrete credential identifiers
@@ -166,7 +166,7 @@ func (m *Controller) GetDid() string {
return ""
}
func (m *Controller) GetPublicKey() *PublicKey {
func (m *Controller) GetPublicKey() []byte {
if m != nil {
return m.PublicKey
}
@@ -200,7 +200,7 @@ type Delegation struct {
// The controller DID
ControllerDid string `protobuf:"bytes,5,opt,name=controller_did,json=controllerDid,proto3" json:"controller_did,omitempty"`
// The delegation proof or verification method
PublicKey *PublicKey `protobuf:"bytes,6,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
PublicKey []byte `protobuf:"bytes,6,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
// IBC Channel ID
ChannelId uint64 `protobuf:"varint,7,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"`
}
@@ -273,7 +273,7 @@ func (m *Delegation) GetControllerDid() string {
return ""
}
func (m *Delegation) GetPublicKey() *PublicKey {
func (m *Delegation) GetPublicKey() []byte {
if m != nil {
return m.PublicKey
}
@@ -370,38 +370,37 @@ func init() {
func init() { proto.RegisterFile("did/v1/state.proto", fileDescriptor_f44bb702879c34b4) }
var fileDescriptor_f44bb702879c34b4 = []byte{
// 491 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x3f, 0x6f, 0x13, 0x31,
0x18, 0x87, 0xe3, 0x24, 0xcd, 0x9f, 0x37, 0x69, 0x28, 0x56, 0x25, 0x8e, 0x22, 0x4e, 0x21, 0x08,
0xa9, 0x2c, 0x39, 0x0a, 0x1b, 0x62, 0x29, 0x2d, 0x03, 0x62, 0x41, 0x81, 0x89, 0xe5, 0x74, 0x39,
0xbf, 0x4d, 0xac, 0x5c, 0xec, 0x93, 0xed, 0x1c, 0xdc, 0x97, 0x40, 0x0c, 0xcc, 0xfd, 0x0a, 0x7c,
0x0d, 0xc6, 0x4a, 0x2c, 0x8c, 0x28, 0xf9, 0x06, 0x8c, 0x4c, 0xe8, 0xec, 0x2b, 0x8d, 0x92, 0x0c,
0x6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0x61, 0x30,
0xe1, 0x66, 0xba, 0x18, 0x0f, 0x63, 0x39, 0x0f, 0xa4, 0xd0, 0x52, 0xa8, 0x60, 0xfa, 0x31, 0xca,
0x83, 0x4f, 0x41, 0xf1, 0x5e, 0x0a, 0x63, 0x3d, 0x6e, 0xd8, 0xb7, 0xf2, 0xec, 0x6f, 0x00, 0x00,
0x00, 0xff, 0xff, 0x01, 0xe3, 0x83, 0xf7, 0x78, 0x03, 0x00, 0x00,
// 475 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x93, 0x3f, 0x6f, 0xd3, 0x40,
0x18, 0xc6, 0x7b, 0x89, 0x9b, 0x3f, 0x6f, 0xd2, 0x50, 0x9d, 0x2a, 0x61, 0x8a, 0xb0, 0x82, 0x11,
0x52, 0x59, 0x62, 0x55, 0x6c, 0x88, 0xa5, 0xb4, 0x0c, 0x88, 0x2d, 0x30, 0xb1, 0x58, 0x8e, 0xef,
0x6d, 0x72, 0x8a, 0x73, 0x67, 0xdd, 0x5d, 0x0c, 0xfe, 0x12, 0x88, 0x81, 0x11, 0xf5, 0xf3, 0x30,
0x56, 0x62, 0x61, 0x44, 0xc9, 0xc0, 0xce, 0x27, 0x40, 0xbe, 0x33, 0x34, 0x4a, 0xb2, 0xf9, 0x7e,
0xef, 0xd9, 0xf7, 0x7b, 0x1e, 0xf9, 0x80, 0x32, 0xce, 0xa2, 0xe2, 0x3c, 0xd2, 0x26, 0x31, 0x38,
0xca, 0x95, 0x34, 0x92, 0xb6, 0x18, 0x67, 0xa3, 0xe2, 0xfc, 0xf4, 0x7e, 0x2a, 0xf5, 0x42, 0xea,
0x48, 0xaa, 0x45, 0xb5, 0x45, 0xaa, 0x85, 0xdb, 0x70, 0x7a, 0x52, 0xbf, 0x34, 0x45, 0x81, 0x9a,
0x6b, 0x47, 0xc3, 0xaf, 0x04, 0x7a, 0x17, 0xc6, 0x60, 0xf5,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e, 0x85, 0xc1, 0x5d, 0x63, 0x71, 0x75, 0x80, 0xeb, 0xf1, 0xe8, 0x8e, 0x5e, 0xed,
0x34, 0xd1, 0xda, 0x6e, 0xc2, 0x99, 0x08, 0x81, 0x59, 0xcc, 0x99, 0xdf, 0x1e, 0x92, 0x33, 0xcf,
0x9a, 0x54, 0xe4, 0x0d, 0xdb, 0x4a, 0xda, 0x0c, 0x6f, 0x08, 0xb4, 0xdf, 0xa1, 0x2a, 0x78, 0x8a,
0x3b, 0x31, 0x1f, 0x43, 0x5f, 0xbb, 0xd1, 0xe6, 0xff, 0xd1, 0xab, 0x99, 0x0d, 0xf6, 0x0c, 0x8e,
0xff, 0x6d, 0x41, 0xc1, 0x72, 0x59, 0xf5, 0xeb, 0xd2, 0xdf, 0xab, 0xf9, 0xeb, 0x1a, 0xef, 0x89,
0xe7, 0xed, 0x89, 0xb7, 0x25, 0xe8, 0xbd, 0x7a, 0xf9, 0x7d, 0x15, 0x90, 0xdb, 0x55, 0x40, 0x7e,
0xad, 0x02, 0xf2, 0x65, 0x1d, 0x1c, 0xdc, 0xae, 0x83, 0x83, 0x9f, 0xeb, 0xe0, 0xe0, 0x43, 0x38,
0xe5, 0x66, 0xb6, 0x9c, 0x8c, 0x52, 0xb9, 0x88, 0xa4, 0xd0, 0x52, 0xa8, 0x68, 0xf6, 0x31, 0x29,
0xa3, 0x4f, 0x51, 0x75, 0x13, 0x2a, 0x63, 0x3d, 0x69, 0xd9, 0x5b, 0xf0, 0xfc, 0x6f, 0x00, 0x00,
0x00, 0xff, 0xff, 0xa0, 0x45, 0x5a, 0xc7, 0x52, 0x03, 0x00, 0x00,
}
func (m *Attestation) Marshal() (dAtA []byte, err error) {
@@ -496,15 +495,10 @@ func (m *Controller) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i--
dAtA[i] = 0x22
}
if m.PublicKey != nil {
{
size, err := m.PublicKey.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintState(dAtA, i, uint64(size))
}
if len(m.PublicKey) > 0 {
i -= len(m.PublicKey)
copy(dAtA[i:], m.PublicKey)
i = encodeVarintState(dAtA, i, uint64(len(m.PublicKey)))
i--
dAtA[i] = 0x1a
}
@@ -550,15 +544,10 @@ func (m *Delegation) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i--
dAtA[i] = 0x38
}
if m.PublicKey != nil {
{
size, err := m.PublicKey.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintState(dAtA, i, uint64(size))
}
if len(m.PublicKey) > 0 {
i -= len(m.PublicKey)
copy(dAtA[i:], m.PublicKey)
i = encodeVarintState(dAtA, i, uint64(len(m.PublicKey)))
i--
dAtA[i] = 0x32
}
@@ -705,8 +694,8 @@ func (m *Controller) Size() (n int) {
if l > 0 {
n += 1 + l + sovState(uint64(l))
}
if m.PublicKey != nil {
l = m.PublicKey.Size()
l = len(m.PublicKey)
if l > 0 {
n += 1 + l + sovState(uint64(l))
}
l = len(m.VaultCid)
@@ -746,8 +735,8 @@ func (m *Delegation) Size() (n int) {
if l > 0 {
n += 1 + l + sovState(uint64(l))
}
if m.PublicKey != nil {
l = m.PublicKey.Size()
l = len(m.PublicKey)
if l > 0 {
n += 1 + l + sovState(uint64(l))
}
if m.ChannelId != 0 {
@@ -1094,7 +1083,7 @@ func (m *Controller) Unmarshal(dAtA []byte) error {
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field PublicKey", wireType)
}
var msglen int
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowState
@@ -1104,26 +1093,24 @@ func (m *Controller) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
if byteLen < 0 {
return ErrInvalidLengthState
}
postIndex := iNdEx + msglen
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthState
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.PublicKey = append(m.PublicKey[:0], dAtA[iNdEx:postIndex]...)
if m.PublicKey == nil {
m.PublicKey = &PublicKey{}
}
if err := m.PublicKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
m.PublicKey = []byte{}
}
iNdEx = postIndex
case 4:
@@ -1406,7 +1393,7 @@ func (m *Delegation) Unmarshal(dAtA []byte) error {
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field PublicKey", wireType)
}
var msglen int
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowState
@@ -1416,26 +1403,24 @@ func (m *Delegation) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
if byteLen < 0 {
return ErrInvalidLengthState
}
postIndex := iNdEx + msglen
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthState
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.PublicKey = append(m.PublicKey[:0], dAtA[iNdEx:postIndex]...)
if m.PublicKey == nil {
m.PublicKey = &PublicKey{}
}
if err := m.PublicKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
m.PublicKey = []byte{}
}
iNdEx = postIndex
case 7:
+14 -57
View File
@@ -6,10 +6,6 @@ package types
import (
context "context"
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
_ "github.com/cosmos/cosmos-proto"
_ "github.com/cosmos/cosmos-sdk/types/msgservice"
_ "github.com/cosmos/gogoproto/gogoproto"
@@ -18,14 +14,15 @@ import (
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
io "io"
math "math"
math_bits "math/bits"
)
// Reference imports to suppress errors if they are not otherwise used.
var (
_ = proto.Marshal
_ = fmt.Errorf
_ = math.Inf
)
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
@@ -51,11 +48,9 @@ func (*MsgUpdateParams) ProtoMessage() {}
func (*MsgUpdateParams) Descriptor() ([]byte, []int) {
return fileDescriptor_d73284df019ff211, []int{0}
}
func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic)
@@ -68,15 +63,12 @@ func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, err
return b[:n], nil
}
}
func (m *MsgUpdateParams) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgUpdateParams.Merge(m, src)
}
func (m *MsgUpdateParams) XXX_Size() int {
return m.Size()
}
func (m *MsgUpdateParams) XXX_DiscardUnknown() {
xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m)
}
@@ -101,7 +93,8 @@ func (m *MsgUpdateParams) GetParams() Params {
// MsgUpdateParams message.
//
// Since: cosmos-sdk 0.47
type MsgUpdateParamsResponse struct{}
type MsgUpdateParamsResponse struct {
}
func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} }
func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) }
@@ -109,11 +102,9 @@ func (*MsgUpdateParamsResponse) ProtoMessage() {}
func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_d73284df019ff211, []int{1}
}
func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic)
@@ -126,15 +117,12 @@ func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]b
return b[:n], nil
}
}
func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src)
}
func (m *MsgUpdateParamsResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m)
}
@@ -159,11 +147,9 @@ func (*MsgInitializeController) ProtoMessage() {}
func (*MsgInitializeController) Descriptor() ([]byte, []int) {
return fileDescriptor_d73284df019ff211, []int{2}
}
func (m *MsgInitializeController) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgInitializeController) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgInitializeController.Marshal(b, m, deterministic)
@@ -176,15 +162,12 @@ func (m *MsgInitializeController) XXX_Marshal(b []byte, deterministic bool) ([]b
return b[:n], nil
}
}
func (m *MsgInitializeController) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgInitializeController.Merge(m, src)
}
func (m *MsgInitializeController) XXX_Size() int {
return m.Size()
}
func (m *MsgInitializeController) XXX_DiscardUnknown() {
xxx_messageInfo_MsgInitializeController.DiscardUnknown(m)
}
@@ -231,11 +214,9 @@ func (*MsgInitializeControllerResponse) ProtoMessage() {}
func (*MsgInitializeControllerResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_d73284df019ff211, []int{3}
}
func (m *MsgInitializeControllerResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgInitializeControllerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgInitializeControllerResponse.Marshal(b, m, deterministic)
@@ -248,15 +229,12 @@ func (m *MsgInitializeControllerResponse) XXX_Marshal(b []byte, deterministic bo
return b[:n], nil
}
}
func (m *MsgInitializeControllerResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgInitializeControllerResponse.Merge(m, src)
}
func (m *MsgInitializeControllerResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgInitializeControllerResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgInitializeControllerResponse.DiscardUnknown(m)
}
@@ -288,11 +266,9 @@ func (*MsgAuthenticateController) ProtoMessage() {}
func (*MsgAuthenticateController) Descriptor() ([]byte, []int) {
return fileDescriptor_d73284df019ff211, []int{4}
}
func (m *MsgAuthenticateController) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgAuthenticateController) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgAuthenticateController.Marshal(b, m, deterministic)
@@ -305,15 +281,12 @@ func (m *MsgAuthenticateController) XXX_Marshal(b []byte, deterministic bool) ([
return b[:n], nil
}
}
func (m *MsgAuthenticateController) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgAuthenticateController.Merge(m, src)
}
func (m *MsgAuthenticateController) XXX_Size() int {
return m.Size()
}
func (m *MsgAuthenticateController) XXX_DiscardUnknown() {
xxx_messageInfo_MsgAuthenticateController.DiscardUnknown(m)
}
@@ -349,7 +322,8 @@ func (m *MsgAuthenticateController) GetOrigin() string {
}
// MsgAuthenticateControllerResponse is the response type for the Authenticate RPC.
type MsgAuthenticateControllerResponse struct{}
type MsgAuthenticateControllerResponse struct {
}
func (m *MsgAuthenticateControllerResponse) Reset() { *m = MsgAuthenticateControllerResponse{} }
func (m *MsgAuthenticateControllerResponse) String() string { return proto.CompactTextString(m) }
@@ -357,11 +331,9 @@ func (*MsgAuthenticateControllerResponse) ProtoMessage() {}
func (*MsgAuthenticateControllerResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_d73284df019ff211, []int{5}
}
func (m *MsgAuthenticateControllerResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgAuthenticateControllerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgAuthenticateControllerResponse.Marshal(b, m, deterministic)
@@ -374,15 +346,12 @@ func (m *MsgAuthenticateControllerResponse) XXX_Marshal(b []byte, deterministic
return b[:n], nil
}
}
func (m *MsgAuthenticateControllerResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgAuthenticateControllerResponse.Merge(m, src)
}
func (m *MsgAuthenticateControllerResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgAuthenticateControllerResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgAuthenticateControllerResponse.DiscardUnknown(m)
}
@@ -438,10 +407,8 @@ var fileDescriptor_d73284df019ff211 = []byte{
}
// Reference imports to suppress errors if they are not otherwise used.
var (
_ context.Context
_ grpc.ClientConn
)
var _ context.Context
var _ grpc.ClientConn
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
@@ -509,16 +476,15 @@ type MsgServer interface {
}
// UnimplementedMsgServer can be embedded to have forward compatible implementations.
type UnimplementedMsgServer struct{}
type UnimplementedMsgServer struct {
}
func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
}
func (*UnimplementedMsgServer) InitializeController(ctx context.Context, req *MsgInitializeController) (*MsgInitializeControllerResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method InitializeController not implemented")
}
func (*UnimplementedMsgServer) AuthenticateController(ctx context.Context, req *MsgAuthenticateController) (*MsgAuthenticateControllerResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method AuthenticateController not implemented")
}
@@ -837,7 +803,6 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int {
dAtA[offset] = uint8(v)
return base
}
func (m *MsgUpdateParams) Size() (n int) {
if m == nil {
return 0
@@ -943,11 +908,9 @@ func (m *MsgAuthenticateControllerResponse) Size() (n int) {
func sovTx(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozTx(x uint64) (n int) {
return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
@@ -1063,7 +1026,6 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
@@ -1114,7 +1076,6 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *MsgInitializeController) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
@@ -1293,7 +1254,6 @@ func (m *MsgInitializeController) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *MsgInitializeControllerResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
@@ -1376,7 +1336,6 @@ func (m *MsgInitializeControllerResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *MsgAuthenticateController) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
@@ -1555,7 +1514,6 @@ func (m *MsgAuthenticateController) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *MsgAuthenticateControllerResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
@@ -1606,7 +1564,6 @@ func (m *MsgAuthenticateControllerResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
func skipTx(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
-15
View File
@@ -1,15 +0,0 @@
package types
import (
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
)
// PublicKey defines the interface for all public keys
type SonrPublicKey interface {
Address() cryptotypes.Address
Bytes() []byte
String() string
VerifySignature(msg []byte, sig []byte) bool
Equals(other cryptotypes.PubKey) bool
Type() string
}