From 5d08b848727759a8eb8f496b279fe7063509ab1c Mon Sep 17 00:00:00 2001 From: Paul Date: Tue, 7 Dec 2021 13:37:09 +0800 Subject: [PATCH 01/38] Init proto message --- .../profiles/v1beta1/models_chain_links.proto | 14 + x/profiles/types/models_chain_links.pb.go | 318 +++++++++++++++--- 2 files changed, 292 insertions(+), 40 deletions(-) diff --git a/proto/desmos/profiles/v1beta1/models_chain_links.proto b/proto/desmos/profiles/v1beta1/models_chain_links.proto index 3b25ee6b76..1d3e256b6a 100644 --- a/proto/desmos/profiles/v1beta1/models_chain_links.proto +++ b/proto/desmos/profiles/v1beta1/models_chain_links.proto @@ -93,4 +93,18 @@ message Base58Address { // Value contains the Base58-encoded address string value = 1 [ (gogoproto.moretags) = "yaml:\"value\"" ]; +} + +// HexAddress represents a Hex-encoded address +message HexAddress { + option (gogoproto.goproto_getters) = false; + option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = true; + option (cosmos_proto.implements_interface) = "AddressData"; + + // Value represents the Hex-encoded address value + string value = 1 [ (gogoproto.moretags) = "yaml:\"value\"" ]; + + // Prefix represents the prefix of the Hex address + string prefix = 2 [ (gogoproto.moretags) = "yaml:\"prefix\"" ]; } \ No newline at end of file diff --git a/x/profiles/types/models_chain_links.pb.go b/x/profiles/types/models_chain_links.pb.go index 063f57f612..915a32a47c 100644 --- a/x/profiles/types/models_chain_links.pb.go +++ b/x/profiles/types/models_chain_links.pb.go @@ -241,12 +241,54 @@ func (m *Base58Address) XXX_DiscardUnknown() { var xxx_messageInfo_Base58Address proto.InternalMessageInfo +// HexAddress represents a Hex-encoded address +type HexAddress struct { + // Value represents the Hex-encoded address value + Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty" yaml:"value"` + // Prefix represents the prefix of the Hex address + Prefix string `protobuf:"bytes,2,opt,name=prefix,proto3" json:"prefix,omitempty" yaml:"prefix"` +} + +func (m *HexAddress) Reset() { *m = HexAddress{} } +func (m *HexAddress) String() string { return proto.CompactTextString(m) } +func (*HexAddress) ProtoMessage() {} +func (*HexAddress) Descriptor() ([]byte, []int) { + return fileDescriptor_1c1946212735e419, []int{5} +} +func (m *HexAddress) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HexAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HexAddress.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 *HexAddress) XXX_Merge(src proto.Message) { + xxx_messageInfo_HexAddress.Merge(m, src) +} +func (m *HexAddress) XXX_Size() int { + return m.Size() +} +func (m *HexAddress) XXX_DiscardUnknown() { + xxx_messageInfo_HexAddress.DiscardUnknown(m) +} + +var xxx_messageInfo_HexAddress proto.InternalMessageInfo + func init() { proto.RegisterType((*ChainLink)(nil), "desmos.profiles.v1beta1.ChainLink") proto.RegisterType((*ChainConfig)(nil), "desmos.profiles.v1beta1.ChainConfig") proto.RegisterType((*Proof)(nil), "desmos.profiles.v1beta1.Proof") proto.RegisterType((*Bech32Address)(nil), "desmos.profiles.v1beta1.Bech32Address") proto.RegisterType((*Base58Address)(nil), "desmos.profiles.v1beta1.Base58Address") + proto.RegisterType((*HexAddress)(nil), "desmos.profiles.v1beta1.HexAddress") } func init() { @@ -254,46 +296,47 @@ func init() { } var fileDescriptor_1c1946212735e419 = []byte{ - // 624 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xbf, 0x6f, 0xd3, 0x4e, - 0x14, 0x8f, 0xbf, 0x6d, 0x5a, 0xe5, 0x92, 0x7c, 0x69, 0x8f, 0x20, 0x42, 0x2b, 0xf9, 0xca, 0x81, - 0x50, 0x19, 0x6a, 0xd3, 0x14, 0x24, 0xd4, 0x89, 0xba, 0x4c, 0x94, 0x01, 0xac, 0x4e, 0x2c, 0xd1, - 0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0xed, 0xa3, 0x9e, 0x3d, 0x9a, 0xfe, 0x74, 0xc4, 0x38, 0xa5, 0xdc, 0x5b, 0x50, - 0x5b, 0xdc, 0xfa, 0x1d, 0x00, 0x00, 0xff, 0xff, 0xc3, 0x02, 0x28, 0xe3, 0x94, 0x04, 0x00, 0x00, + // 633 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x54, 0xbd, 0x6e, 0xd3, 0x40, + 0x1c, 0x8f, 0x69, 0xd3, 0x2a, 0x97, 0x04, 0x5a, 0x13, 0x44, 0x68, 0x25, 0x5f, 0x39, 0x10, 0x2a, + 0x43, 0x6d, 0x9a, 0x82, 0x84, 0x3a, 0x51, 0x97, 0x01, 0x51, 0x06, 0xb0, 0x3a, 0xb1, 0x44, 0x67, + 0xe7, 0xe2, 0x5a, 0xb5, 0x7d, 0x96, 0xef, 0x5c, 0x25, 0x12, 0x12, 0x2b, 0x63, 0x47, 0xc6, 0x4e, + 0x3c, 0x01, 0x4f, 0xc0, 0x54, 0x31, 0x55, 0x4c, 0x4c, 0x06, 0xb5, 0x0b, 0xb3, 0x9f, 0x00, 0xdd, + 0x9d, 0xdd, 0x84, 0x56, 0x45, 0x62, 0x62, 0xbb, 0xfb, 0xff, 0x3e, 0xee, 0xff, 0x65, 0x83, 0x47, + 0x03, 0xc2, 0x22, 0xca, 0xac, 0x24, 0xa5, 0xc3, 0x20, 0x24, 0xcc, 0x3a, 0x58, 0x77, 0x09, 0xc7, + 0xeb, 0x56, 0x44, 0x07, 0x24, 0x64, 0x7d, 0x6f, 0x0f, 0x07, 0x71, 0x3f, 0x0c, 0xe2, 0x7d, 0x66, + 0x26, 0x29, 0xe5, 0x54, 0xbf, 0xad, 0x14, 0x66, 0xa5, 0x30, 0x4b, 0xc5, 0x52, 0xc7, 0xa7, 0x3e, + 0x95, 0x1c, 0x4b, 0x9c, 0x14, 0x7d, 0xe9, 0x8e,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, 0xc1, 0xa8, 0xcc, 0x76, 0xb1, 0xc8, 0x61, 0xbb, 0xda, 0x1f, + 0x11, 0x17, 0xb5, 0xc9, 0xc3, 0xe6, 0xf2, 0xf4, 0x8b, 0xdf, 0xfe, 0xdc, 0x59, 0xb4, 0x0b, 0xda, + 0x36, 0x66, 0xe4, 0xc9, 0xd3, 0x7f, 0x4c, 0xe0, 0xef, 0xae, 0xef, 0x00, 0x78, 0x41, 0x46, 0xff, + 0xa9, 0x26, 0x7b, 0xe7, 0xf8, 0xd4, 0xd0, 0x4e, 0x4e, 0x0d, 0xed, 0xe7, 0xa9, 0xa1, 0x1d, 0x9e, + 0x19, 0xb5, 0x93, 0x33, 0xa3, 0xf6, 0xfd, 0xcc, 0xa8, 0xbd, 0x5d, 0xf7, 0x03, 0xbe, 0x97, 0xb9, + 0xa6, 0x47, 0x23, 0x4b, 0x7d, 0x40, 0x6b, 0x21, 0x76, 0x59, 0x79, 0xb6, 0x0e, 0x7a, 0xd6, 0x68, + 0xf2, 0xcb, 0xe3, 0xe3, 0x84, 0x30, 0x77, 0x4e, 0xee, 0xd0, 0xc6, 0xef, 0x00, 0x00, 0x00, 0xff, + 0xff, 0xc6, 0xc7, 0xe8, 0x24, 0x12, 0x05, 0x00, 0x00, } func (this *ChainLink) Equal(that interface{}) bool { @@ -437,6 +480,33 @@ func (this *Base58Address) Equal(that interface{}) bool { } return true } +func (this *HexAddress) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*HexAddress) + if !ok { + that2, ok := that.(HexAddress) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Value != that1.Value { + return false + } + if this.Prefix != that1.Prefix { + return false + } + return true +} func (m *ChainLink) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -653,6 +723,43 @@ func (m *Base58Address) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *HexAddress) 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 *HexAddress) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HexAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Prefix) > 0 { + i -= len(m.Prefix) + copy(dAtA[i:], m.Prefix) + i = encodeVarintModelsChainLinks(dAtA, i, uint64(len(m.Prefix))) + i-- + dAtA[i] = 0x12 + } + if len(m.Value) > 0 { + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = encodeVarintModelsChainLinks(dAtA, i, uint64(len(m.Value))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintModelsChainLinks(dAtA []byte, offset int, v uint64) int { offset -= sovModelsChainLinks(v) base := offset @@ -751,6 +858,23 @@ func (m *Base58Address) Size() (n int) { return n } +func (m *HexAddress) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Value) + if l > 0 { + n += 1 + l + sovModelsChainLinks(uint64(l)) + } + l = len(m.Prefix) + if l > 0 { + n += 1 + l + sovModelsChainLinks(uint64(l)) + } + return n +} + func sovModelsChainLinks(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1402,6 +1526,120 @@ func (m *Base58Address) Unmarshal(dAtA []byte) error { } return nil } +func (m *HexAddress) 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 ErrIntOverflowModelsChainLinks + } + 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: HexAddress: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HexAddress: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowModelsChainLinks + } + 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 ErrInvalidLengthModelsChainLinks + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthModelsChainLinks + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Prefix", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowModelsChainLinks + } + 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 ErrInvalidLengthModelsChainLinks + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthModelsChainLinks + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Prefix = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipModelsChainLinks(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthModelsChainLinks + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipModelsChainLinks(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 From 91aab8efc7492327c154468b71967bce6c7bd227 Mon Sep 17 00:00:00 2001 From: Paul Date: Thu, 9 Dec 2021 15:09:56 +0800 Subject: [PATCH 02/38] Implement eth address data --- x/profiles/types/models_chain_links.go | 40 +++++++++++++++++++++ x/profiles/types/models_chain_links_test.go | 18 ++++++++++ 2 files changed, 58 insertions(+) diff --git a/x/profiles/types/models_chain_links.go b/x/profiles/types/models_chain_links.go index 7888154134..396efcc7c9 100644 --- a/x/profiles/types/models_chain_links.go +++ b/x/profiles/types/models_chain_links.go @@ -10,6 +10,8 @@ import ( "github.com/cosmos/cosmos-sdk/types/bech32" "github.com/tendermint/tendermint/crypto/tmhash" + "github.com/btcsuite/btcd/btcec" + "github.com/ethereum/go-ethereum/crypto" "github.com/gogo/protobuf/proto" "github.com/mr-tron/base58" @@ -202,6 +204,44 @@ func (b Base58Address) VerifyPubKey(key cryptotypes.PubKey) (bool, error) { // -------------------------------------------------------------------------------------------------------------------- +var _ AddressData = &HexAddress{} + +// NewHexAddress returns a new HexAddress instance +func NewHexAddress(value, prefix string) *HexAddress { + return &HexAddress{Value: value, Prefix: prefix} +} + +func (h HexAddress) Validate() error { + addr := h.Value[len(h.Prefix):] + if strings.TrimSpace(addr) == "" { + return fmt.Errorf("address cannot be empty or blank") + } + + if _, err := hex.DecodeString(addr); err != nil { + return fmt.Errorf("invalid Hex address") + } + return nil +} + +func (h HexAddress) GetValue() string { + return h.Value +} + +func (h HexAddress) VerifyPubKey(key cryptotypes.PubKey) (bool, error) { + addr := h.Value[len(h.Prefix):] + bz, err := hex.DecodeString(addr) + if err != nil { + return false, err + } + uncompressPub, err := btcec.ParsePubKey(key.Bytes(), btcec.S256()) + if err != nil { + return false, err + } + return bytes.Equal(crypto.Keccak256(uncompressPub.SerializeUncompressed()[1:])[12:], bz), err +} + +// -------------------------------------------------------------------------------------------------------------------- + // UnpackAddressData deserializes the given any type value as an address data using the provided unpacker func UnpackAddressData(unpacker codectypes.AnyUnpacker, addressAny *codectypes.Any) (AddressData, error) { var address AddressData diff --git a/x/profiles/types/models_chain_links_test.go b/x/profiles/types/models_chain_links_test.go index 153aac527c..f10f4db3bf 100644 --- a/x/profiles/types/models_chain_links_test.go +++ b/x/profiles/types/models_chain_links_test.go @@ -13,6 +13,7 @@ import ( codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/bech32" @@ -138,6 +139,17 @@ func TestProof_Verify(t *testing.T) { require.NoError(t, err) base58SigHex := hex.EncodeToString(base58Sig) + // Ethereum + ethPrivKeyBz, err := hex.DecodeString("2842d8f3701d16711b9ee320f32efe38e6b0891e243eaf6515250e7b006de53e") + require.NoError(t, err) + ethPrivKey := secp256k1.PrivKey{Key: ethPrivKeyBz} + ethPubKey := ethPrivKey.PubKey() + + ethAddr := "0x941991947B6eC9F5537bcaC30C1295E8154Df4cC" + ethSig, err := ethPrivKey.Sign([]byte(plainText)) + require.NoError(t, err) + ethSigHex := hex.EncodeToString(ethSig) + invalidAny, err := codectypes.NewAnyWithValue(bech32PrivKey) require.NoError(t, err) @@ -189,6 +201,12 @@ func TestProof_Verify(t *testing.T) { addressData: types.NewBech32Address(bech32Addr, "cosmos"), shouldErr: false, }, + { + name: "correct proof with Hex address returns no error", + proof: types.NewProof(ethPubKey, ethSigHex, hex.EncodeToString([]byte(plainText))), + addressData: types.NewHexAddress(ethAddr, "0x"), + shouldErr: false, + }, } for _, tc := range testCases { From 653c707bd5b82d74d918e10546c853a7df6b0271 Mon Sep 17 00:00:00 2001 From: Paul Date: Thu, 9 Dec 2021 15:19:53 +0800 Subject: [PATCH 03/38] Rename hex address into eth address --- go.mod | 4 +- go.sum | 147 +++++++++++++++++- .../profiles/v1beta1/models_chain_links.proto | 8 +- x/profiles/types/models_chain_links.go | 25 +-- x/profiles/types/models_chain_links.pb.go | 134 ++++++++-------- x/profiles/types/models_chain_links_test.go | 10 +- 6 files changed, 236 insertions(+), 92 deletions(-) diff --git a/go.mod b/go.mod index 9671c778d7..f9c2c62249 100644 --- a/go.mod +++ b/go.mod @@ -4,16 +4,17 @@ go 1.15 require ( github.com/armon/go-metrics v0.3.10 + github.com/btcsuite/btcd v0.22.0-beta github.com/cosmos/cosmos-sdk v0.44.5 github.com/cosmos/go-bip39 v1.0.0 github.com/cosmos/ibc-go v1.2.4 github.com/desmos-labs/Go-Emoji-Utils v1.1.1-0.20210623064146-c30bc8196d0f + github.com/ethereum/go-ethereum v1.10.13 github.com/ghodss/yaml v1.0.0 github.com/gogo/protobuf v1.3.3 github.com/golang/protobuf v1.5.2 github.com/gorilla/mux v1.8.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 - github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect github.com/manifoldco/promptui v0.9.0 github.com/mr-tron/base58 v1.2.0 github.com/rakyll/statik v0.1.7 @@ -21,7 +22,6 @@ require ( github.com/spf13/cast v1.4.1 github.com/spf13/cobra v1.2.1 github.com/stretchr/testify v1.7.0 - github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954 // indirect github.com/tendermint/tendermint v0.34.15 github.com/tendermint/tm-db v0.6.6 google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4 diff --git a/go.sum b/go.sum index 2a2ffb0b74..92d2a777f3 100644 --- a/go.sum +++ b/go.sum @@ -1,11 +1,13 @@ bazil.org/fuse v0.0.0-20200407214033-5883e5a4b512/go.mod h1:FbcW6z/2VytnFDhZfumh8Ss8zxHE6qpMP5sHTRe0EaM= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.43.0/go.mod h1:BOSR3VbTLkk6FDC/TcffxP4NF/FFBGA5ku+jvKOP7pg= cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.51.0/go.mod h1:hWtGJ6gnXH+KgDv+V0zFGDvpi07n3z8ZNj3T1RW0Gcw= cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= @@ -29,6 +31,7 @@ cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvf cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/bigtable v1.2.0/go.mod h1:JcVAOl45lrTmQfLj7T6TxyMzIN/3FGGcFm+2xVAli2o= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= @@ -42,6 +45,7 @@ cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0Zeo cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +collectd.org v0.3.0/go.mod h1:A/8DzQBkF6abtvrT2j/AU/4tiBgJWYyh0y/oB/4MlWE= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.0.0-beta.2 h1:/BZRNzm8N4K4eWfK28dL4yescorxtO7YG1yun8fy+pI= filippo.io/edwards25519 v1.0.0-beta.2/go.mod h1:X+pm78QAUPtFLi1z9PYIlS/bdDnvbCOGKtZ+ACWEf7o= @@ -66,6 +70,7 @@ github.com/BurntSushi/toml v0.4.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbi github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= +github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ= @@ -85,6 +90,7 @@ github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWX github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/VictoriaMetrics/fastcache v1.5.7/go.mod h1:ptDBkNMQI4RtmVo8VS/XwRY6RoTu1dAWCbrk+6WsEM8= +github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= github.com/Workiva/go-datastructures v1.0.52/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA= @@ -103,8 +109,10 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= +github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/apache/arrow/go/arrow v0.0.0-20191024131854-af6fa24be0db/go.mod h1:VTxUBvSJ3s3eHAg65PNgrsn5BtqCRPdmyXh6rAfdxN0= github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/aristanetworks/goarista v0.0.0-20170210015632-ea17b1a17847/go.mod h1:D/tb0zPVXnP7fmsLZjtdUhSsumbK/ij54UXjjVgMGxQ= @@ -122,8 +130,17 @@ github.com/aws/aws-sdk-go v1.25.48/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpi github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.40.45/go.mod h1:585smgzpB/KqRA+K3y/NL/oYRqQvpNJYvLm+LY1U59Q= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= +github.com/aws/aws-sdk-go-v2 v1.2.0/go.mod h1:zEQs02YRBw1DjK0PoJv3ygDYOFTre1ejlJWl8FwAuQo= github.com/aws/aws-sdk-go-v2 v1.9.1/go.mod h1:cK/D0BBs0b/oWPIcX/Z/obahJK1TT7IPVjy53i/mX/4= +github.com/aws/aws-sdk-go-v2/config v1.1.1/go.mod h1:0XsVy9lBI/BCXm+2Tuvt39YmdHwS5unDQmxZOYe8F5Y= +github.com/aws/aws-sdk-go-v2/credentials v1.1.1/go.mod h1:mM2iIjwl7LULWtS6JCACyInboHirisUUdkBPoTHMOUo= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.0.2/go.mod h1:3hGg3PpiEjHnrkrlasTfxFqUsZ2GCk/fMUn4CbKgSkM= github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.8.1/go.mod h1:CM+19rL1+4dFWnOQKwDc7H1KwXTz+h61oUSHyhV0b3o= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.0.2/go.mod h1:45MfaXZ0cNbeuT0KQ1XJylq8A6+OpVV2E5kvY/Kq+u8= +github.com/aws/aws-sdk-go-v2/service/route53 v1.1.1/go.mod h1:rLiOUrPLW/Er5kRcQ7NkwbjlijluLsrIbu/iyl35RO4= +github.com/aws/aws-sdk-go-v2/service/sso v1.1.1/go.mod h1:SuZJxklHxLAXgLTc1iFXbEWkXs7QRTQpCLGaKIprQW0= +github.com/aws/aws-sdk-go-v2/service/sts v1.1.1/go.mod h1:Wi0EBZwiz/K44YliU0EKxqTCJGUfYTWXrrBwkq736bM= +github.com/aws/smithy-go v1.1.0/go.mod h1:EzMw8dbp/YJL4A5/sbhGddag+NPT7q084agLbB9LgIw= github.com/aws/smithy-go v1.8.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= @@ -135,6 +152,8 @@ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kB github.com/bits-and-blooms/bitset v1.2.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM= +github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c= +github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= github.com/btcsuite/btcd v0.0.0-20171128150713-2e60448ffcc6/go.mod h1:Dmm/EzmjnCiweXmzRIAiUWCInVmPgjkzgv5k4tVyXiQ= github.com/btcsuite/btcd v0.0.0-20190115013929-ed77733ec07d/go.mod h1:d3C0AkH6BRcvO8T0UEPu53cnw4IbV63x1bEjildYhO0= github.com/btcsuite/btcd v0.0.0-20190315201642-aa6e0f35703c/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= @@ -156,6 +175,7 @@ github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= +github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOCSiVIqS34= github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= github.com/casbin/casbin/v2 v2.37.0/go.mod h1:vByNa/Fchek0KZUgG5wEsl7iFsiviAYKRtgrQfcJqHg= github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= @@ -181,6 +201,7 @@ github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp github.com/clbanning/mxj v1.8.4/go.mod h1:BVjHeAH+rl9rs6f+QIpeRl0tfu10SXn1pUSa5PVGJng= github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= github.com/cloudflare/cloudflare-go v0.10.2-0.20190916151808-a80f83b9add9/go.mod h1:1MxXX1Ux4x6mqPmjkUgTP1CdXIBXKX7T+Jk9Gxrmx+U= +github.com/cloudflare/cloudflare-go v0.14.0/go.mod h1:EnwdgGMaFOruiPZRFSgn+TsQ3hQ7C/YWzIGLeu5c304= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= @@ -188,6 +209,8 @@ github.com/coinbase/rosetta-sdk-go v0.6.10 h1:rgHD/nHjxLh0lMEdfGDqpTtlvtSBwULqrr github.com/coinbase/rosetta-sdk-go v0.6.10/go.mod h1:J/JFMsfcePrjJZkwQFLh+hJErkAmdm9Iyy3D5Y0LfXo= github.com/confio/ics23/go v0.6.6 h1:pkOy18YxxJ/r0XFDCnrl4Bjv6h4LkBSpLS6F38mrKL8= github.com/confio/ics23/go v0.6.6/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= +github.com/consensys/bavard v0.1.8-0.20210406032232-f3452dc9b572/go.mod h1:Bpd0/3mZuaj6Sj+PqrmIquiOKy397AKGThQPaGzNXAQ= +github.com/consensys/gnark-crypto v0.4.1-0.20210426202927-39ac3d4b3f1f/go.mod h1:815PAHg3wvysy0SyIqanF8gZ0Y1wjk/hrDHD/iT88+Q= github.com/containerd/console v1.0.2/go.mod h1:ytZPjGgY2oeTkAONYafi2kSj0aYggsf8acV1PGKCbzQ= github.com/containerd/continuity v0.0.0-20190827140505-75bee3e2ccb6/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= github.com/containerd/continuity v0.2.0 h1:j/9Wnn+hrEWjLvHuIxUU1YI5JjEjVlT2AA68cse9rwY= @@ -221,15 +244,19 @@ github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:ma github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= github.com/cyphar/filepath-securejoin v0.2.2/go.mod h1:FpkQEhXnPnOthhzymB7CGsFk2G9VLXONKD9G7QGMM+4= github.com/danieljoos/wincred v1.0.2 h1:zf4bhty2iLuwgjgpraD2E9UbvO+fe54XXGJbOwe23fU= github.com/danieljoos/wincred v1.0.2/go.mod h1:SnuYRW9lp1oJrZX/dXJqr0cPK5gYXqx3EJbmjhLdK9U= +github.com/dave/jennifer v1.2.0/go.mod h1:fIb+770HOpJ2fmN9EPPKOqm1vMGhB+TwXKMZhrIygKg= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= +github.com/deepmap/oapi-codegen v1.6.0/go.mod h1:ryDa9AgbELGeB+YEXE1dR53yAjHwFvE9iAUlWl9Al3M= +github.com/deepmap/oapi-codegen v1.8.2/go.mod h1:YLgSKSDv/bZQB7N4ws6luhozi3cEdRktEqrX88CvjIw= github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f h1:U5y3Y5UE0w7amNe7Z5G/twsBW0KEalRQXZzf8ufSh9I= github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f/go.mod h1:xH/i4TFMt8koVQZ6WFms69WAsDWr2XsYL3Hkl7jkoLE= github.com/desmos-labs/Go-Emoji-Utils v1.1.1-0.20210623064146-c30bc8196d0f h1:gUywWy8Pw1ROmF4o/qLy/FP1bEyEtjPg6a/RgdXmcCA= @@ -244,17 +271,21 @@ github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KP github.com/dgraph-io/ristretto v0.0.3 h1:jh22xisGBjrEVnRZ1DVTpBVQm0Xndu8sMl0CWDzSIBI= github.com/dgraph-io/ristretto v0.0.3/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-bitstream v0.0.0-20180413035011-3522498ce2c8/go.mod h1:VMaSuZ+SZcx/wljOQKvp5srsbCiKDEb6K2wC4+PiBmQ= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= +github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/dop251/goja v0.0.0-20200721192441-a695b0cdd498/go.mod h1:Mw6PkjjMXWbTj+nnj4s3QPXq1jaT0s5pC0iFD4+BOAA= +github.com/dop251/goja v0.0.0-20211011172007-d99e4b8cbf48/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= +github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= @@ -264,11 +295,14 @@ github.com/dvyukov/go-fuzz v0.0.0-20200318091601-be3528f3a813/go.mod h1:11Gm+ccJ github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= +github.com/eclipse/paho.mqtt.golang v1.2.0/go.mod h1:H9keYFcgq3Qr5OUJm/JZI/i6U7joQ8SYLhZwfeOo6Ts= github.com/edsrzf/mmap-go v0.0.0-20160512033002-935e0e8a636c/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ethereum/go-ethereum v1.9.25/go.mod h1:vMkFiYLHI4tgPw4k2j4MHKoovchFE8plZ0M9VMk4/oM= +github.com/ethereum/go-ethereum v1.10.13 h1:DEYFP9zk+Gruf3ae1JOJVhNmxK28ee+sMELPLgYTXpA= +github.com/ethereum/go-ethereum v1.10.13/go.mod h1:W3yfrFyL9C1pHcwY5hmRHVDaorTiQxhYBkKyu5mEDHw= github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 h1:0JZ+dUmQeA8IIVUMzysrX4/AKuQwWhV2dYQuPZdvdSQ= github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= @@ -283,6 +317,7 @@ github.com/fatih/color v1.12.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGE github.com/felixge/httpsnoop v1.0.1 h1:lvB5Jl89CsZtGIWuTcDM1E/vkVs49/Ml7JJe07l8SPQ= github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/fjl/memsize v0.0.0-20180418122429-ca190fb6ffbc/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= +github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= @@ -295,6 +330,8 @@ github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4 github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI= github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= +github.com/getkin/kin-openapi v0.53.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= +github.com/getkin/kin-openapi v0.61.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= @@ -302,6 +339,9 @@ github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm github.com/gin-gonic/gin v1.5.0/go.mod h1:Nd6IXA8m5kNZdNEHMBd93KT+mdY3+bewLgRvmCsR2Do= github.com/gin-gonic/gin v1.6.3 h1:ahKqKTFpO5KTPHxWZjEdPScmYaGtLo8Y4DMHoEsnp14= github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= +github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= +github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24= +github.com/go-chi/chi/v5 v5.0.0/go.mod h1:BBug9lr0cqtdAhsu6R4AAdvufI0/XBzAQSsUqJpoZOs= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -319,6 +359,8 @@ github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= +github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM= @@ -330,7 +372,9 @@ github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+ github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1Vv0sFl1UcHBOY= github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= github.com/go-sourcemap/sourcemap v2.1.2+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= +github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-zookeeper/zk v1.0.2/go.mod h1:nOB03cncLtlp4t+UAkGSV+9beXP/akpekBwL+UX1Qcw= @@ -343,10 +387,13 @@ github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/E github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/gateway v1.1.0 h1:u0SuhL9+Il+UbjM9VIE3ntfRujKbvVpFvNB4HbjeVQ0= github.com/gogo/gateway v1.1.0/go.mod h1:S7rR8FRQyG3QFESeSv4l2WnsyzlCLG0CzBbUUo/mbic= github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= +github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= +github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -385,11 +432,14 @@ github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiu github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3-0.20201103224600-674baa8c7fc3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.3 h1:fHPg5GQYlCeLIPB9BZqMVR5nR9A+IM5zcgeTdjMYmLA= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= +github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golangci/lint-1 v0.0.0-20181222135242-d2cdd8c08219/go.mod h1:/X8TswGSh1pIozq4ZwCfxS0WA5JGXguxk94ar/4c87Y= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/flatbuffers v1.11.0/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -431,6 +481,7 @@ github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm4 github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.5/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= @@ -452,6 +503,7 @@ github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/ad github.com/gotestyourself/gotestyourself v2.2.0+incompatible h1:AQwinXlbQR2HvPjQZOmDhRqsv5mZf+Jb1RnSLxcqZcI= github.com/gotestyourself/gotestyourself v2.2.0+incompatible/go.mod h1:zZKM6oeNM8k+FRljX1mnzVYeS8wiGgQyvST1/GafPbY= github.com/graph-gophers/graphql-go v0.0.0-20191115155744-f33e81362277/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= +github.com/graph-gophers/graphql-go v0.0.0-20201113091052-beb923fada29/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= @@ -477,6 +529,7 @@ github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyN github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= @@ -514,11 +567,14 @@ github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/J github.com/hashicorp/serf v0.9.5/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKENpqIUyk= github.com/hdevalence/ed25519consensus v0.0.0-20210204194344-59a8610d2b87 h1:uUjLpLt6bVvZ72SQc/B4dXcPBw4Vgd7soowdRl52qEM= github.com/hdevalence/ed25519consensus v0.0.0-20210204194344-59a8610d2b87/go.mod h1:XGsKKeXxeRr95aEOgipvluMPlgjr7dGlk9ZTWOjcUcg= +github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= github.com/holiman/uint256 v1.1.1/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= +github.com/holiman/uint256 v1.2.0/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/hudl/fargo v1.4.0/go.mod h1:9Ai6uvFy5fQNq6VPKtg+Ceq1+eTY4nKUlR2JElEOcDo= github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc= +github.com/huin/goupnp v1.0.2/go.mod h1:0dxJBVBHqTMjIUMkESDTNgOOx/Mw5wYIfyFmdzSamkM= github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= @@ -526,9 +582,20 @@ github.com/improbable-eng/grpc-web v0.14.1 h1:NrN4PY71A6tAz2sKDvC5JCauENWp0ykG8O github.com/improbable-eng/grpc-web v0.14.1/go.mod h1:zEjGHa8DAlkoOXmswrNvhUGEYQA9UI7DhrGeHR1DMGU= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/influxdata/flux v0.65.1/go.mod h1:J754/zds0vvpfwuq7Gc2wRdVwEodfpCFM7mYlOw2LqY= github.com/influxdata/influxdb v1.2.3-0.20180221223340-01288bdb0883/go.mod h1:qZna6X/4elxqT3yI9iZYdZrWWdeFOOprn86kgg4+IzY= +github.com/influxdata/influxdb v1.8.3/go.mod h1:JugdFhsvvI8gadxOI6noqNeeBHvWNTbfYGtiAn+2jhI= +github.com/influxdata/influxdb-client-go/v2 v2.4.0/go.mod h1:vLNHdxTJkIf2mSLvGrpj8TCcISApPoXkaxP8g9uRlW8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= github.com/influxdata/influxdb1-client v0.0.0-20200827194710-b269163b24ab/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +github.com/influxdata/influxql v1.1.1-0.20200828144457-65d3ef77d385/go.mod h1:gHp9y86a/pxhjJ+zMjNXiQAA197Xk9wLxaz+fGG+kWk= +github.com/influxdata/line-protocol v0.0.0-20180522152040-32c6aa80de5e/go.mod h1:4kt73NQhadE3daL3WhR5EJ/J2ocX0PZzwxQ0gXJ7oFE= +github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo= +github.com/influxdata/line-protocol v0.0.0-20210311194329-9aa0e372d097/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo= +github.com/influxdata/promql/v2 v2.12.0/go.mod h1:fxOPu+DY0bqCTCECchSRtWfc+0X19ybifQhZoQNF5D8= +github.com/influxdata/roaring v0.4.13-0.20180809181101-fc520f41fab6/go.mod h1:bSgUQ7q5ZLSO+bKBGqJiCBGAl+9DxyW63zLTujjUlOE= +github.com/influxdata/tdigest v0.0.0-20181121200506-bf2b5ad3c0a9/go.mod h1:Js0mqiSBE6Ffsg94weZZ2c+v/ciT8QRHFOap7EKDrR0= +github.com/influxdata/usage-client v0.0.0-20160829180054-6d3895376368/go.mod h1:Wbbw6tYNvwa5dlB6304Sd+82Z3f7PmVZHVKU637d4po= github.com/jackpal/go-nat-pmp v1.0.2-0.20160603034137-1fa385a6f458/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e/go.mod h1:G1CVv03EnqU1wYL2dFwXxW2An0az9JTl/ZsqXQeBlkU= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= @@ -553,38 +620,50 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +github.com/jsternberg/zap-logfmt v1.0.0/go.mod h1:uvPs/4X51zdkcm5jXl5SYoN+4RK21K8mysFmDaM/h+o= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.1.1-0.20170430222011-975b5c4c7c21/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= +github.com/jwilder/encoding v0.0.0-20170811194829-b4e1701a28ef/go.mod h1:Ct9fl0F6iIOGgxJ5npU/IUOhOhqlVrGjyIZc8/MagT0= github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= +github.com/karalabe/usb v0.0.0-20211005121534-4c5740d64559/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d h1:Z+RDyXzjKE0i2sTjZ/b1uxiGtPhFy34Ou/Tk0qwN0kM= github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d/go.mod h1:JJNrCn9otv/2QP4D7SMJBgaleKpOf66PnW6F5WGNRIc= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= +github.com/klauspost/compress v1.4.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.13.4/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/klauspost/compress v1.13.5/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= +github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= +github.com/klauspost/crc32 v0.0.0-20161016154125-cb6bfca970f6/go.mod h1:+ZoRqAPRLkC4NPOvfYeR5KNOrY6TD+/sAC3HXPZgDYg= +github.com/klauspost/pgzip v1.0.2-0.20170402124221-0bf5dcad4ada/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/labstack/echo/v4 v4.2.1/go.mod h1:AA49e0DZ8kk5jTOOCKNuPR6oTnBS0dYiM4FW1e6jwpg= +github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= +github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= github.com/leodido/go-urn v1.1.0/go.mod h1:+cyI34gQWZcE1eQU7NVgKkkzdXDQHr1dBMtdAPozLkw= github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= +github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.10.3/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lib/pq v1.10.4 h1:SO9z7FRPzA03QhHKJrH5BXA6HU1rS4V2nIVrrNC1iYk= @@ -598,12 +677,17 @@ github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czP github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls= github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= +github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYthEiA= github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWtQEhdbn6Pgg= +github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd/go.mod h1:9ELz6aaclSIGnZBoaSLZ3NAl1VTufbOrXBPvtcy6WiQ= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.0/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= github.com/mattn/go-ieproxy v0.0.0-20190702010315-6dee0af9227d/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= @@ -620,6 +704,9 @@ github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27k github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= +github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= +github.com/mattn/go-tty v0.0.0-20180907095812-13ff1204f104/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= @@ -643,6 +730,7 @@ github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RR github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.4.2 h1:6h7AQ0yhTcIsmFmnAwQls75jp2Gzs4iB8W7pjMO+rqo= github.com/mitchellh/mapstructure v1.4.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= github.com/moby/sys/mountinfo v0.4.1/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= @@ -654,6 +742,7 @@ github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjY github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/mrunalp/fileutils v0.5.0/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2QJNHXfbSQ= +github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE+eKJXWVjKXM4ck2QobLqTDytGJbLLhJg= github.com/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs= github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= @@ -676,7 +765,6 @@ github.com/nats-io/nkeys v0.2.0/go.mod h1:XdZpAbhgyyODYqjTawOnIOI7VlbKSarI9Gfy1t github.com/nats-io/nkeys v0.3.0/go.mod h1:gvUNGjVcM2IPr5rCsRsC6Wb3Hr2CQAm08dsxtV6A5y4= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/neilotoole/errgroup v0.1.5/go.mod h1:Q2nLGf+594h0CLBs/Mbg6qOr7GtqDK7C2S41udRnToE= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nishanths/predeclared v0.0.0-20200524104333-86fad755b4d3/go.mod h1:nt3d53pc1VYcphSCIaYAJtnPYnr3Zyn8fMq2wvPGPso= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= @@ -688,6 +776,7 @@ github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/olekukonko/tablewriter v0.0.2-0.20190409134802-7e037d187b0c/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= +github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= @@ -716,6 +805,7 @@ github.com/opencontainers/selinux v1.8.2/go.mod h1:MUIHuUEvKB1wtJjQdOyYRgOnLD2xA github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/opentracing/opentracing-go v1.0.3-0.20180606204148-bd9c31933947/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxSfWAKL3wpBW7V8scJMt8N8gnaMCS9E/cA= @@ -737,6 +827,7 @@ github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIw github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/paulbellamy/ratecounter v0.2.0/go.mod h1:Hfx1hDpSGoqxkVVpBi/IlYD7kChlfo5C6hzIHwPqfFE= github.com/pborman/uuid v0.0.0-20170112150404-1b00554d8222/go.mod h1:VyrYX9gd7irzKovcSS6BIIEwPRkP2Wm2m9ufcdFSJ34= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= @@ -745,9 +836,14 @@ github.com/pelletier/go-toml v1.9.4 h1:tjENF6MfZAg8e4ZmZTeWaWiT2vXtsoO6+iuOjFhEC github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= github.com/performancecopilot/speed/v4 v4.0.0/go.mod h1:qxrSyuDGrTOWfV+uKRFhfxw6h/4HXRGUiZiufxo49BM= +github.com/peterh/liner v1.0.1-0.20180619022028-8c1271fcf47f/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= +github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 h1:q2e307iGHPdTGp0hoxKjt1H5pDo6utceo3dQVK3I5XQ= +github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 h1:q2e307iGHPdTGp0hoxKjt1H5pDo6utceo3dQVK3I5XQ= +github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= +github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= github.com/philhofer/fwd v1.1.1/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= @@ -757,6 +853,7 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= +github.com/pkg/term v0.0.0-20180730021639-bffc007b7fd5/go.mod h1:eCbImbZ95eXtAUIbLAuAVnBnwf83mjf6QIVH8SHYwqQ= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= @@ -782,6 +879,7 @@ github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7q github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= @@ -813,6 +911,7 @@ github.com/regen-network/cosmos-proto v0.3.1 h1:rV7iM4SSFAagvy8RiyhiACbWEGotmqzy github.com/regen-network/cosmos-proto v0.3.1/go.mod h1:jO0sVX6a1B36nmE8C9xBFXpNwWejXC7QqCOnH3O0+YM= github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4= github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI= +github.com/retailnext/hllpp v1.0.1-0.20180308014038-101a6d2f8b52/go.mod h1:RDpi1RftBQPUCDRw6SmxeaREsAaRKnOclghuzp/WRzc= github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= @@ -835,7 +934,11 @@ github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa/go.mod h1:F7 github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo= github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY= +github.com/segmentio/kafka-go v0.1.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= +github.com/segmentio/kafka-go v0.2.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= +github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/shirou/gopsutil v2.20.5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= @@ -891,6 +994,7 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/testify v1.2.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -902,8 +1006,8 @@ github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= -github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954 h1:xQdMZ1WLrgkkvOZ/LDQxjVxMLdby7osSh4ZEVa5sIjs= -github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= +github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= +github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= github.com/tendermint/btcd v0.1.1 h1:0VcxPfflS2zZ3RiOAHkBiFUcPvbtRj5O7zHmcJWHV7s= @@ -922,7 +1026,10 @@ github.com/tidwall/gjson v1.6.7/go.mod h1:zeFuBCIqD4sN/gmqBzZ4j7Jd6UcA2Fc56x7QFs github.com/tidwall/match v1.0.3/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.0.2/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tidwall/sjson v1.1.4/go.mod h1:wXpKXu8CtDjKAZ+3DrKY5ROCorDFahq8l0tey/Lx1fg= +github.com/tinylib/msgp v1.0.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= github.com/tinylib/msgp v1.1.5/go.mod h1:eQsjooMTnV42mHu917E26IogZ2930nFyBQdofk10Udg= +github.com/tklauser/go-sysconf v0.3.5/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITnppBXY/rYEFI= +github.com/tklauser/numcpus v0.2.2/go.mod h1:x3qojaO3uyYt0i56EW/VUYs7uBvdl2fkfZFu0T9wgjM= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/ttacon/chalk v0.0.0-20160626202418-22c06c80ed31/go.mod h1:onvgF043R+lC5RZ8IT9rBXDaEDnpnw/Cl+HFiw+v/7Q= @@ -938,12 +1045,18 @@ github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= +github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= +github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= +github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= +github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE= github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU= github.com/vmihailenco/msgpack/v5 v5.1.4/go.mod h1:C5gboKD0TJPqWDTVTtrQNfRbiBwHZGo8UTqP/9/XvLI= github.com/vmihailenco/tagparser v0.1.2/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= +github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208/go.mod h1:IotVbo4F+mw0EzQ08zFqg7pK3FebNXpaMsRy2RT+Ees= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/xlab/treeprint v0.0.0-20180616005107-d6fb6747feb6/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/ybbus/jsonrpc v2.1.2+incompatible/go.mod h1:XJrh1eMSzdIYFbM08flv0wp5G35eRniyeGut1z+LSiE= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -983,6 +1096,7 @@ go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+ go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= +go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= @@ -1008,12 +1122,16 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210915214749-c084706c2272/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1104,6 +1222,7 @@ golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= @@ -1111,6 +1230,8 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210903162142-ad29c8ab022f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210903162142-ad29c8ab022f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210917221730-978cfadd31cf/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211005001312-d4b1ae081e3b h1:SXy8Ld8oKlcogOvUAh0J5Pm5RKzgYBMMxLxt6n5XW50= @@ -1180,6 +1301,7 @@ golang.org/x/sys v0.0.0-20191210023423-ac6580df4449/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200107162124-548cf772de50/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1201,6 +1323,7 @@ golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200824131525-c12d262b63d8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1216,9 +1339,12 @@ golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210420205809-ac73e9fd8988/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1229,6 +1355,7 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210903071746-97244b99971b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210917161153-d61c044b1678/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1253,6 +1380,8 @@ golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxb golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1283,6 +1412,7 @@ golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200108203644-89082a384178/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200117012304-6edc0a871e69/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= @@ -1325,7 +1455,10 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= +gonum.org/v1/gonum v0.0.0-20181121035319-3f7ecaa7e8ca/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= +gonum.org/v1/gonum v0.6.0/go.mod h1:9mxDZsDKxgMAuccQkewq682L+0eCu4dCN2yonUJTCLU= gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0= +gonum.org/v1/netlib v0.0.0-20181029234149-ec6d1f5cefe6/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= @@ -1371,6 +1504,7 @@ google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRn google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= +google.golang.org/genproto v0.0.0-20190716160619-c506a9f90610/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= @@ -1378,6 +1512,7 @@ google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvx google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200108215221-bd8f9a0ef82f/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= @@ -1447,8 +1582,9 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b h1:QRR6H1YWRnHb4Y/HeNFCTJLFVxaq6wH4YuVdsUOr75U= gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= @@ -1488,6 +1624,7 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= nhooyr.io/websocket v1.8.6 h1:s+C3xAMLwGmlI31Nyn/eAehUlZPwfYZu2JXM621Q5/k= nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= diff --git a/proto/desmos/profiles/v1beta1/models_chain_links.proto b/proto/desmos/profiles/v1beta1/models_chain_links.proto index 1d3e256b6a..aa4f89f32e 100644 --- a/proto/desmos/profiles/v1beta1/models_chain_links.proto +++ b/proto/desmos/profiles/v1beta1/models_chain_links.proto @@ -95,16 +95,16 @@ message Base58Address { string value = 1 [ (gogoproto.moretags) = "yaml:\"value\"" ]; } -// HexAddress represents a Hex-encoded address -message HexAddress { +// EthAddress represents a Eth address +message EthAddress { option (gogoproto.goproto_getters) = false; option (gogoproto.equal) = true; option (gogoproto.goproto_stringer) = true; option (cosmos_proto.implements_interface) = "AddressData"; - // Value represents the Hex-encoded address value + // Value represents the Eth address value string value = 1 [ (gogoproto.moretags) = "yaml:\"value\"" ]; - // Prefix represents the prefix of the Hex address + // Prefix represents the prefix of the Eth address string prefix = 2 [ (gogoproto.moretags) = "yaml:\"prefix\"" ]; } \ No newline at end of file diff --git a/x/profiles/types/models_chain_links.go b/x/profiles/types/models_chain_links.go index 396efcc7c9..7068ba3cb9 100644 --- a/x/profiles/types/models_chain_links.go +++ b/x/profiles/types/models_chain_links.go @@ -204,15 +204,15 @@ func (b Base58Address) VerifyPubKey(key cryptotypes.PubKey) (bool, error) { // -------------------------------------------------------------------------------------------------------------------- -var _ AddressData = &HexAddress{} +var _ AddressData = &EthAddress{} -// NewHexAddress returns a new HexAddress instance -func NewHexAddress(value, prefix string) *HexAddress { - return &HexAddress{Value: value, Prefix: prefix} +// NewEthAddress returns a new EthAddress instance +func NewEthAddress(value, prefix string) *EthAddress { + return &EthAddress{Value: value, Prefix: prefix} } -func (h HexAddress) Validate() error { - addr := h.Value[len(h.Prefix):] +func (e EthAddress) Validate() error { + addr := e.Value[len(e.Prefix):] if strings.TrimSpace(addr) == "" { return fmt.Errorf("address cannot be empty or blank") } @@ -223,21 +223,22 @@ func (h HexAddress) Validate() error { return nil } -func (h HexAddress) GetValue() string { - return h.Value +func (e EthAddress) GetValue() string { + return e.Value } -func (h HexAddress) VerifyPubKey(key cryptotypes.PubKey) (bool, error) { - addr := h.Value[len(h.Prefix):] +func (e EthAddress) VerifyPubKey(key cryptotypes.PubKey) (bool, error) { + addr := e.Value[len(e.Prefix):] bz, err := hex.DecodeString(addr) if err != nil { return false, err } - uncompressPub, err := btcec.ParsePubKey(key.Bytes(), btcec.S256()) + pub, err := btcec.ParsePubKey(key.Bytes(), btcec.S256()) if err != nil { return false, err } - return bytes.Equal(crypto.Keccak256(uncompressPub.SerializeUncompressed()[1:])[12:], bz), err + uncompressedPub := pub.SerializeUncompressed() + return bytes.Equal(crypto.Keccak256(uncompressedPub[1:])[12:], bz), err } // -------------------------------------------------------------------------------------------------------------------- diff --git a/x/profiles/types/models_chain_links.pb.go b/x/profiles/types/models_chain_links.pb.go index 915a32a47c..a985ef2802 100644 --- a/x/profiles/types/models_chain_links.pb.go +++ b/x/profiles/types/models_chain_links.pb.go @@ -241,26 +241,26 @@ func (m *Base58Address) XXX_DiscardUnknown() { var xxx_messageInfo_Base58Address proto.InternalMessageInfo -// HexAddress represents a Hex-encoded address -type HexAddress struct { - // Value represents the Hex-encoded address value +// EthAddress represents a Eth address +type EthAddress struct { + // Value represents the Eth address value Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty" yaml:"value"` - // Prefix represents the prefix of the Hex address + // Prefix represents the prefix of the Eth address Prefix string `protobuf:"bytes,2,opt,name=prefix,proto3" json:"prefix,omitempty" yaml:"prefix"` } -func (m *HexAddress) Reset() { *m = HexAddress{} } -func (m *HexAddress) String() string { return proto.CompactTextString(m) } -func (*HexAddress) ProtoMessage() {} -func (*HexAddress) Descriptor() ([]byte, []int) { +func (m *EthAddress) Reset() { *m = EthAddress{} } +func (m *EthAddress) String() string { return proto.CompactTextString(m) } +func (*EthAddress) ProtoMessage() {} +func (*EthAddress) Descriptor() ([]byte, []int) { return fileDescriptor_1c1946212735e419, []int{5} } -func (m *HexAddress) XXX_Unmarshal(b []byte) error { +func (m *EthAddress) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *HexAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *EthAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_HexAddress.Marshal(b, m, deterministic) + return xxx_messageInfo_EthAddress.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -270,17 +270,17 @@ func (m *HexAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *HexAddress) XXX_Merge(src proto.Message) { - xxx_messageInfo_HexAddress.Merge(m, src) +func (m *EthAddress) XXX_Merge(src proto.Message) { + xxx_messageInfo_EthAddress.Merge(m, src) } -func (m *HexAddress) XXX_Size() int { +func (m *EthAddress) XXX_Size() int { return m.Size() } -func (m *HexAddress) XXX_DiscardUnknown() { - xxx_messageInfo_HexAddress.DiscardUnknown(m) +func (m *EthAddress) XXX_DiscardUnknown() { + xxx_messageInfo_EthAddress.DiscardUnknown(m) } -var xxx_messageInfo_HexAddress proto.InternalMessageInfo +var xxx_messageInfo_EthAddress proto.InternalMessageInfo func init() { proto.RegisterType((*ChainLink)(nil), "desmos.profiles.v1beta1.ChainLink") @@ -288,7 +288,7 @@ func init() { proto.RegisterType((*Proof)(nil), "desmos.profiles.v1beta1.Proof") proto.RegisterType((*Bech32Address)(nil), "desmos.profiles.v1beta1.Bech32Address") proto.RegisterType((*Base58Address)(nil), "desmos.profiles.v1beta1.Base58Address") - proto.RegisterType((*HexAddress)(nil), "desmos.profiles.v1beta1.HexAddress") + proto.RegisterType((*EthAddress)(nil), "desmos.profiles.v1beta1.EthAddress") } func init() { @@ -296,47 +296,47 @@ func init() { } var fileDescriptor_1c1946212735e419 = []byte{ - // 633 bytes of a gzipped FileDescriptorProto + // 632 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x54, 0xbd, 0x6e, 0xd3, 0x40, 0x1c, 0x8f, 0x69, 0xd3, 0x2a, 0x97, 0x04, 0x5a, 0x13, 0x44, 0x68, 0x25, 0x5f, 0x39, 0x10, 0x2a, - 0x43, 0x6d, 0x9a, 0x82, 0x84, 0x3a, 0x51, 0x97, 0x01, 0x51, 0x06, 0xb0, 0x3a, 0xb1, 0x44, 0x67, - 0xe7, 0xe2, 0x5a, 0xb5, 0x7d, 0x96, 0xef, 0x5c, 0x25, 0x12, 0x12, 0x2b, 0x63, 0x47, 0xc6, 0x4e, - 0x3c, 0x01, 0x4f, 0xc0, 0x54, 0x31, 0x55, 0x4c, 0x4c, 0x06, 0xb5, 0x0b, 0xb3, 0x9f, 0x00, 0xdd, - 0x9d, 0xdd, 0x84, 0x56, 0x45, 0x62, 0x62, 0xbb, 0xfb, 0xff, 0x3e, 0xee, 0xff, 0x65, 0x83, 0x47, - 0x03, 0xc2, 0x22, 0xca, 0xac, 0x24, 0xa5, 0xc3, 0x20, 0x24, 0xcc, 0x3a, 0x58, 0x77, 0x09, 0xc7, - 0xeb, 0x56, 0x44, 0x07, 0x24, 0x64, 0x7d, 0x6f, 0x0f, 0x07, 0x71, 0x3f, 0x0c, 0xe2, 0x7d, 0x66, - 0x26, 0x29, 0xe5, 0x54, 0xbf, 0xad, 0x14, 0x66, 0xa5, 0x30, 0x4b, 0xc5, 0x52, 0xc7, 0xa7, 0x3e, - 0x95, 0x1c, 0x4b, 0x9c, 0x14, 0x7d, 0xe9, 0x8e, 0x4f, 0xa9, 0x1f, 0x12, 0x4b, 0xde, 0xdc, 0x6c, - 0x68, 0xe1, 0x78, 0x5c, 0x42, 0xf0, 0x22, 0xc4, 0x83, 0x88, 0x30, 0x8e, 0xa3, 0xa4, 0xd2, 0x7a, - 0x54, 0x3c, 0xd5, 0x57, 0xa6, 0xea, 0xa2, 0x20, 0xf4, 0x69, 0x06, 0x34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ef, 0xae, 0xef, 0x00, 0x78, 0x41, 0x46, 0xff, - 0xa9, 0x26, 0x7b, 0xe7, 0xf8, 0xd4, 0xd0, 0x4e, 0x4e, 0x0d, 0xed, 0xe7, 0xa9, 0xa1, 0x1d, 0x9e, - 0x19, 0xb5, 0x93, 0x33, 0xa3, 0xf6, 0xfd, 0xcc, 0xa8, 0xbd, 0x5d, 0xf7, 0x03, 0xbe, 0x97, 0xb9, - 0xa6, 0x47, 0x23, 0x4b, 0x7d, 0x40, 0x6b, 0x21, 0x76, 0x59, 0x79, 0xb6, 0x0e, 0x7a, 0xd6, 0x68, - 0xf2, 0xcb, 0xe3, 0xe3, 0x84, 0x30, 0x77, 0x4e, 0xee, 0xd0, 0xc6, 0xef, 0x00, 0x00, 0x00, 0xff, - 0xff, 0xc6, 0xc7, 0xe8, 0x24, 0x12, 0x05, 0x00, 0x00, + 0x43, 0x6d, 0x9a, 0x82, 0x84, 0x3a, 0x51, 0x17, 0x16, 0xca, 0x00, 0x56, 0x27, 0x96, 0xe8, 0xec, + 0x5c, 0x1c, 0xab, 0xb6, 0xcf, 0xf2, 0x9d, 0xab, 0x44, 0x42, 0x62, 0x65, 0xec, 0xc8, 0xd8, 0x89, + 0x27, 0xe0, 0x09, 0x98, 0x2a, 0xa6, 0x8a, 0x89, 0xc9, 0xa0, 0x76, 0x61, 0xce, 0x13, 0xa0, 0xbb, + 0xb3, 0x9b, 0xd0, 0x2a, 0x48, 0x4c, 0x6c, 0x77, 0xff, 0xdf, 0xc7, 0xfd, 0xbf, 0x6c, 0xf0, 0xa8, + 0x47, 0x58, 0x44, 0x99, 0x95, 0xa4, 0xb4, 0x1f, 0x84, 0x84, 0x59, 0x87, 0x9b, 0x2e, 0xe1, 0x78, + 0xd3, 0x8a, 0x68, 0x8f, 0x84, 0xac, 0xeb, 0x0d, 0x70, 0x10, 0x77, 0xc3, 0x20, 0x3e, 0x60, 0x66, + 0x92, 0x52, 0x4e, 0xf5, 0xdb, 0x4a, 0x61, 0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 0x30, 0x2b, 0x3b, 0xb1, 0x34, 0x59, 0x0b, 0x19, 0x46, 0x8e, 0x82, 0xf5, + 0x87, 0x60, 0x21, 0x49, 0x49, 0x3f, 0x18, 0x16, 0xd9, 0x2e, 0x8f, 0x73, 0xd8, 0x2c, 0xf7, 0x47, + 0xc4, 0x45, 0x6d, 0xf2, 0xb0, 0xbd, 0x3a, 0xfd, 0xe2, 0xb7, 0x3f, 0x77, 0x16, 0xed, 0x83, 0xa6, + 0x8d, 0x19, 0x79, 0xf2, 0xf4, 0x1f, 0x13, 0xf8, 0xbb, 0xeb, 0x3b, 0x00, 0x5e, 0xf0, 0xc1, 0x7f, + 0xaa, 0xc9, 0xde, 0x3b, 0x39, 0x33, 0xb4, 0xd3, 0x33, 0x43, 0xfb, 0x79, 0x66, 0x68, 0x47, 0xe7, + 0x46, 0xe5, 0xf4, 0xdc, 0xa8, 0x7c, 0x3f, 0x37, 0x2a, 0x6f, 0x37, 0xfd, 0x80, 0x0f, 0x32, 0xd7, + 0xf4, 0x68, 0x64, 0xa9, 0x0f, 0x68, 0x23, 0xc4, 0x2e, 0x2b, 0xce, 0xd6, 0x61, 0xc7, 0x1a, 0x4e, + 0x7e, 0x79, 0x7c, 0x94, 0x10, 0xe6, 0x2e, 0xc8, 0x1d, 0xda, 0xfa, 0x1d, 0x00, 0x00, 0xff, 0xff, + 0x59, 0xbb, 0x73, 0xd3, 0x12, 0x05, 0x00, 0x00, } func (this *ChainLink) Equal(that interface{}) bool { @@ -480,14 +480,14 @@ func (this *Base58Address) Equal(that interface{}) bool { } return true } -func (this *HexAddress) Equal(that interface{}) bool { +func (this *EthAddress) Equal(that interface{}) bool { if that == nil { return this == nil } - that1, ok := that.(*HexAddress) + that1, ok := that.(*EthAddress) if !ok { - that2, ok := that.(HexAddress) + that2, ok := that.(EthAddress) if ok { that1 = &that2 } else { @@ -723,7 +723,7 @@ func (m *Base58Address) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *HexAddress) Marshal() (dAtA []byte, err error) { +func (m *EthAddress) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -733,12 +733,12 @@ func (m *HexAddress) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *HexAddress) MarshalTo(dAtA []byte) (int, error) { +func (m *EthAddress) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *HexAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *EthAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -858,7 +858,7 @@ func (m *Base58Address) Size() (n int) { return n } -func (m *HexAddress) Size() (n int) { +func (m *EthAddress) Size() (n int) { if m == nil { return 0 } @@ -1526,7 +1526,7 @@ func (m *Base58Address) Unmarshal(dAtA []byte) error { } return nil } -func (m *HexAddress) Unmarshal(dAtA []byte) error { +func (m *EthAddress) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1549,10 +1549,10 @@ func (m *HexAddress) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: HexAddress: wiretype end group for non-group") + return fmt.Errorf("proto: EthAddress: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: HexAddress: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: EthAddress: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: diff --git a/x/profiles/types/models_chain_links_test.go b/x/profiles/types/models_chain_links_test.go index f10f4db3bf..4ac004abce 100644 --- a/x/profiles/types/models_chain_links_test.go +++ b/x/profiles/types/models_chain_links_test.go @@ -189,6 +189,12 @@ func TestProof_Verify(t *testing.T) { addressData: types.NewBase58Address("HWQ14mk82aRMAad2TdxFHbeqLeUGo5SiBxTXyZyTesJT"), shouldErr: true, }, + { + name: "wrong Eth address returns error", + proof: types.NewProof(ethPubKey, ethSigHex, hex.EncodeToString([]byte(plainText))), + addressData: types.NewEthAddress("0xcdAFfbFd8c131464fEE561e3d9b585141e403719", "0x"), + shouldErr: true, + }, { name: "correct proof with Base58 address returns no error", proof: types.NewProof(base58PubKey, base58SigHex, hex.EncodeToString([]byte(plainText))), @@ -202,9 +208,9 @@ func TestProof_Verify(t *testing.T) { shouldErr: false, }, { - name: "correct proof with Hex address returns no error", + name: "correct proof with Eth address returns no error", proof: types.NewProof(ethPubKey, ethSigHex, hex.EncodeToString([]byte(plainText))), - addressData: types.NewHexAddress(ethAddr, "0x"), + addressData: types.NewEthAddress(ethAddr, "0x"), shouldErr: false, }, } From c3d959d0ab65a3f59a605f5d595421b14157c9a7 Mon Sep 17 00:00:00 2001 From: Paul Date: Thu, 9 Dec 2021 16:36:35 +0800 Subject: [PATCH 04/38] Fix tests --- x/profiles/types/models_chain_links.go | 14 +++--- x/profiles/types/models_chain_links_test.go | 49 +++++++++++++++++++++ 2 files changed, 58 insertions(+), 5 deletions(-) diff --git a/x/profiles/types/models_chain_links.go b/x/profiles/types/models_chain_links.go index 7068ba3cb9..670fbef28f 100644 --- a/x/profiles/types/models_chain_links.go +++ b/x/profiles/types/models_chain_links.go @@ -212,13 +212,17 @@ func NewEthAddress(value, prefix string) *EthAddress { } func (e EthAddress) Validate() error { - addr := e.Value[len(e.Prefix):] - if strings.TrimSpace(addr) == "" { - return fmt.Errorf("address cannot be empty or blank") + if len(strings.TrimSpace(e.Value)) <= len(e.Prefix) { + return fmt.Errorf("address cannot be smaller than prefix") + } + + prefix, addrWithoutPrefix := e.Value[:len(e.Prefix)], e.Value[len(e.Prefix):] + if prefix != e.Prefix { + return fmt.Errorf("prefix does not match") } - if _, err := hex.DecodeString(addr); err != nil { - return fmt.Errorf("invalid Hex address") + if _, err := hex.DecodeString(addrWithoutPrefix); err != nil { + return fmt.Errorf("invalid Eth address") } return nil } diff --git a/x/profiles/types/models_chain_links_test.go b/x/profiles/types/models_chain_links_test.go index 4ac004abce..e3ed5bbea1 100644 --- a/x/profiles/types/models_chain_links_test.go +++ b/x/profiles/types/models_chain_links_test.go @@ -330,6 +330,55 @@ func TestBase58Address_GetValue(t *testing.T) { // -------------------------------------------------------------------------------------------------------------------- +func TestEthAddress_Validate(t *testing.T) { + testCases := []struct { + name string + address *types.EthAddress + shouldErr bool + }{ + { + name: "address smaller than prefix returns error", + address: types.NewEthAddress("", ""), + shouldErr: true, + }, + { + name: "prefix does not match returns error", + address: types.NewEthAddress("0184", "0x"), + shouldErr: true, + }, + { + name: "invalid address returns error", + address: types.NewEthAddress("0OiIjJ", "0x"), + shouldErr: true, + }, + { + name: "valid address returns no error", + address: types.NewEthAddress("0x941991947B6eC9F5537bcaC30C1295E8154Df4cC", "0x"), + shouldErr: false, + }, + } + + for _, tc := range testCases { + tc := tc + t.Run(tc.name, func(t *testing.T) { + err := tc.address.Validate() + + if tc.shouldErr { + require.Error(t, err) + } else { + require.NoError(t, err) + } + }) + } +} + +func TestEthAddress_GetValue(t *testing.T) { + data := types.NewEthAddress("0x941991947B6eC9F5537bcaC30C1295E8154Df4cC", "0x") + require.Equal(t, "0x941991947B6eC9F5537bcaC30C1295E8154Df4cC", data.GetValue()) +} + +// -------------------------------------------------------------------------------------------------------------------- + func TestUnpackAddressData(t *testing.T) { testCases := []struct { name string From 2fca2005488678b16a4c1004a6029e4527e4ff15 Mon Sep 17 00:00:00 2001 From: Paul Date: Thu, 9 Dec 2021 16:51:48 +0800 Subject: [PATCH 05/38] Revert mod --- go.mod | 2 ++ 1 file changed, 2 insertions(+) diff --git a/go.mod b/go.mod index f9c2c62249..bd5b7c7a5b 100644 --- a/go.mod +++ b/go.mod @@ -15,6 +15,7 @@ require ( github.com/golang/protobuf v1.5.2 github.com/gorilla/mux v1.8.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 + github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect github.com/manifoldco/promptui v0.9.0 github.com/mr-tron/base58 v1.2.0 github.com/rakyll/statik v0.1.7 @@ -22,6 +23,7 @@ require ( github.com/spf13/cast v1.4.1 github.com/spf13/cobra v1.2.1 github.com/stretchr/testify v1.7.0 + github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954 // indirect github.com/tendermint/tendermint v0.34.15 github.com/tendermint/tm-db v0.6.6 google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4 From 0ea0890b2837eefa7107f624e4cf97b3c1517239 Mon Sep 17 00:00:00 2001 From: Paul Date: Thu, 9 Dec 2021 16:53:07 +0800 Subject: [PATCH 06/38] Add comments --- x/profiles/types/models_chain_links.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/x/profiles/types/models_chain_links.go b/x/profiles/types/models_chain_links.go index 670fbef28f..2a00ec69ca 100644 --- a/x/profiles/types/models_chain_links.go +++ b/x/profiles/types/models_chain_links.go @@ -227,10 +227,12 @@ func (e EthAddress) Validate() error { return nil } +// GetValue implements AddressData func (e EthAddress) GetValue() string { return e.Value } +// VerifyPubKey implements AddressData func (e EthAddress) VerifyPubKey(key cryptotypes.PubKey) (bool, error) { addr := e.Value[len(e.Prefix):] bz, err := hex.DecodeString(addr) From 1dd59b0e9074df90f0f4838a614245b038e05257 Mon Sep 17 00:00:00 2001 From: Paul Date: Thu, 9 Dec 2021 16:54:04 +0800 Subject: [PATCH 07/38] Fix typo --- x/profiles/types/models_chain_links_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/profiles/types/models_chain_links_test.go b/x/profiles/types/models_chain_links_test.go index e3ed5bbea1..6d4ca2aa92 100644 --- a/x/profiles/types/models_chain_links_test.go +++ b/x/profiles/types/models_chain_links_test.go @@ -337,7 +337,7 @@ func TestEthAddress_Validate(t *testing.T) { shouldErr bool }{ { - name: "address smaller than prefix returns error", + name: "address smaller than prefix length returns error", address: types.NewEthAddress("", ""), shouldErr: true, }, From 651fb21a8e23dce788f73e1e6575dddcdf63575c Mon Sep 17 00:00:00 2001 From: Paul Date: Thu, 9 Dec 2021 17:01:21 +0800 Subject: [PATCH 08/38] Run go mod tidy --- go.mod | 2 -- 1 file changed, 2 deletions(-) diff --git a/go.mod b/go.mod index bd5b7c7a5b..f9c2c62249 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,6 @@ require ( github.com/golang/protobuf v1.5.2 github.com/gorilla/mux v1.8.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 - github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect github.com/manifoldco/promptui v0.9.0 github.com/mr-tron/base58 v1.2.0 github.com/rakyll/statik v0.1.7 @@ -23,7 +22,6 @@ require ( github.com/spf13/cast v1.4.1 github.com/spf13/cobra v1.2.1 github.com/stretchr/testify v1.7.0 - github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954 // indirect github.com/tendermint/tendermint v0.34.15 github.com/tendermint/tm-db v0.6.6 google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4 From 38f0bb588a02e72017a8cb6b155de6cd79fb3fc9 Mon Sep 17 00:00:00 2001 From: Paul Date: Fri, 10 Dec 2021 11:10:23 +0800 Subject: [PATCH 09/38] Update proto/desmos/profiles/v1beta1/models_chain_links.proto Co-authored-by: Leonardo Bragagnolo --- proto/desmos/profiles/v1beta1/models_chain_links.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/desmos/profiles/v1beta1/models_chain_links.proto b/proto/desmos/profiles/v1beta1/models_chain_links.proto index aa4f89f32e..287bb61ac8 100644 --- a/proto/desmos/profiles/v1beta1/models_chain_links.proto +++ b/proto/desmos/profiles/v1beta1/models_chain_links.proto @@ -95,7 +95,7 @@ message Base58Address { string value = 1 [ (gogoproto.moretags) = "yaml:\"value\"" ]; } -// EthAddress represents a Eth address +// EthAddress represents an Eth address message EthAddress { option (gogoproto.goproto_getters) = false; option (gogoproto.equal) = true; From 62947af578069162a114d7fe82631e04dece9329 Mon Sep 17 00:00:00 2001 From: Paul Date: Fri, 10 Dec 2021 11:10:33 +0800 Subject: [PATCH 10/38] Update x/profiles/types/models_chain_links.go Co-authored-by: Leonardo Bragagnolo --- x/profiles/types/models_chain_links.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/profiles/types/models_chain_links.go b/x/profiles/types/models_chain_links.go index 2a00ec69ca..e6b1a597fd 100644 --- a/x/profiles/types/models_chain_links.go +++ b/x/profiles/types/models_chain_links.go @@ -212,7 +212,7 @@ func NewEthAddress(value, prefix string) *EthAddress { } func (e EthAddress) Validate() error { - if len(strings.TrimSpace(e.Value)) <= len(e.Prefix) { + if len(strings.TrimSpace(e.Value)) <= len(strings.TrimSpace(e.Prefix)) { return fmt.Errorf("address cannot be smaller than prefix") } From d946c68ffcf270995a1a36383e75d3bb9be3a4d4 Mon Sep 17 00:00:00 2001 From: Paul Date: Fri, 10 Dec 2021 11:10:39 +0800 Subject: [PATCH 11/38] Update x/profiles/types/models_chain_links.go Co-authored-by: Leonardo Bragagnolo --- x/profiles/types/models_chain_links.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/profiles/types/models_chain_links.go b/x/profiles/types/models_chain_links.go index e6b1a597fd..a66dc9cae1 100644 --- a/x/profiles/types/models_chain_links.go +++ b/x/profiles/types/models_chain_links.go @@ -239,7 +239,7 @@ func (e EthAddress) VerifyPubKey(key cryptotypes.PubKey) (bool, error) { if err != nil { return false, err } - pub, err := btcec.ParsePubKey(key.Bytes(), btcec.S256()) + pubKey, err := btcec.ParsePubKey(key.Bytes(), btcec.S256()) if err != nil { return false, err } From d4be22d5218f0a419d61e69ebea12cfad4788812 Mon Sep 17 00:00:00 2001 From: Paul Date: Fri, 10 Dec 2021 11:10:47 +0800 Subject: [PATCH 12/38] Update x/profiles/types/models_chain_links.go Co-authored-by: Leonardo Bragagnolo --- x/profiles/types/models_chain_links.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/profiles/types/models_chain_links.go b/x/profiles/types/models_chain_links.go index a66dc9cae1..146cd22e75 100644 --- a/x/profiles/types/models_chain_links.go +++ b/x/profiles/types/models_chain_links.go @@ -243,7 +243,7 @@ func (e EthAddress) VerifyPubKey(key cryptotypes.PubKey) (bool, error) { if err != nil { return false, err } - uncompressedPub := pub.SerializeUncompressed() + uncompressedPubKey := pubKey.SerializeUncompressed() return bytes.Equal(crypto.Keccak256(uncompressedPub[1:])[12:], bz), err } From f1d78377e8d10a3cb96d0aa701dc0d0b84c11d81 Mon Sep 17 00:00:00 2001 From: Paul Date: Fri, 10 Dec 2021 11:10:54 +0800 Subject: [PATCH 13/38] Update x/profiles/types/models_chain_links.go Co-authored-by: Leonardo Bragagnolo --- x/profiles/types/models_chain_links.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/profiles/types/models_chain_links.go b/x/profiles/types/models_chain_links.go index 146cd22e75..7f5f718251 100644 --- a/x/profiles/types/models_chain_links.go +++ b/x/profiles/types/models_chain_links.go @@ -244,7 +244,7 @@ func (e EthAddress) VerifyPubKey(key cryptotypes.PubKey) (bool, error) { return false, err } uncompressedPubKey := pubKey.SerializeUncompressed() - return bytes.Equal(crypto.Keccak256(uncompressedPub[1:])[12:], bz), err + return bytes.Equal(crypto.Keccak256(uncompressedPubKey[1:])[12:], bz), err } // -------------------------------------------------------------------------------------------------------------------- From 8b1fa039f4821d8c299d3130b663ce93fde45279 Mon Sep 17 00:00:00 2001 From: Paul Date: Fri, 10 Dec 2021 11:27:41 +0800 Subject: [PATCH 14/38] Add lost tests --- x/profiles/types/models_chain_links.go | 8 ++++++++ x/profiles/types/models_chain_links_test.go | 12 +++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/x/profiles/types/models_chain_links.go b/x/profiles/types/models_chain_links.go index 7f5f718251..86db046139 100644 --- a/x/profiles/types/models_chain_links.go +++ b/x/profiles/types/models_chain_links.go @@ -212,6 +212,14 @@ func NewEthAddress(value, prefix string) *EthAddress { } func (e EthAddress) Validate() error { + if strings.TrimSpace(e.Value) == "" { + return fmt.Errorf("value cannot be empty or blank") + } + + if strings.TrimSpace(e.Prefix) == "" { + return fmt.Errorf("prefix cannot be empty or blank") + } + if len(strings.TrimSpace(e.Value)) <= len(strings.TrimSpace(e.Prefix)) { return fmt.Errorf("address cannot be smaller than prefix") } diff --git a/x/profiles/types/models_chain_links_test.go b/x/profiles/types/models_chain_links_test.go index 6d4ca2aa92..032a94547a 100644 --- a/x/profiles/types/models_chain_links_test.go +++ b/x/profiles/types/models_chain_links_test.go @@ -336,9 +336,19 @@ func TestEthAddress_Validate(t *testing.T) { address *types.EthAddress shouldErr bool }{ + { + name: "empty address returns error", + address: types.NewEthAddress("", "0x"), + shouldErr: true, + }, + { + name: "empty prefix returns error", + address: types.NewEthAddress("0x941991947B6eC9F5537bcaC30C1295E8154Df4cC", ""), + shouldErr: true, + }, { name: "address smaller than prefix length returns error", - address: types.NewEthAddress("", ""), + address: types.NewEthAddress("0", "0x"), shouldErr: true, }, { From 03c40eed5417882f6d645e06bc575f8874de9592 Mon Sep 17 00:00:00 2001 From: Paul Date: Fri, 10 Dec 2021 11:32:59 +0800 Subject: [PATCH 15/38] Add spaced address test --- x/profiles/types/models_chain_links_test.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/x/profiles/types/models_chain_links_test.go b/x/profiles/types/models_chain_links_test.go index 032a94547a..e183af11e4 100644 --- a/x/profiles/types/models_chain_links_test.go +++ b/x/profiles/types/models_chain_links_test.go @@ -348,7 +348,7 @@ func TestEthAddress_Validate(t *testing.T) { }, { name: "address smaller than prefix length returns error", - address: types.NewEthAddress("0", "0x"), + address: types.NewEthAddress("0x", "0x"), shouldErr: true, }, { @@ -361,6 +361,11 @@ func TestEthAddress_Validate(t *testing.T) { address: types.NewEthAddress("0OiIjJ", "0x"), shouldErr: true, }, + { + name: "spaced address returns error", + address: types.NewEthAddress("0x 941991947B6eC9F5537bcaC30C1295E8154Df4cC", "0x"), + shouldErr: true, + }, { name: "valid address returns no error", address: types.NewEthAddress("0x941991947B6eC9F5537bcaC30C1295E8154Df4cC", "0x"), From e3927381f6134c442b5cca6e42ce5a4187b00345 Mon Sep 17 00:00:00 2001 From: Paul Date: Fri, 10 Dec 2021 11:39:05 +0800 Subject: [PATCH 16/38] Update changelog --- ...4b2b9fdf0923da002de55a8cf4fab6e91fddd7dcc4c1854efab.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changeset/entries/6b0bd955ce8e24b2b9fdf0923da002de55a8cf4fab6e91fddd7dcc4c1854efab.yaml diff --git a/.changeset/entries/6b0bd955ce8e24b2b9fdf0923da002de55a8cf4fab6e91fddd7dcc4c1854efab.yaml b/.changeset/entries/6b0bd955ce8e24b2b9fdf0923da002de55a8cf4fab6e91fddd7dcc4c1854efab.yaml new file mode 100644 index 0000000000..f619174ca4 --- /dev/null +++ b/.changeset/entries/6b0bd955ce8e24b2b9fdf0923da002de55a8cf4fab6e91fddd7dcc4c1854efab.yaml @@ -0,0 +1,6 @@ +type: feat +module: x/profiles +pull_request: 688 +description: add support for eth address in chain link +backward_compatible: true +date: 2021-12-10T03:38:53.1017055Z From 21e0dc4c4aadf2c970ee03ad355b0af88e2b8ed9 Mon Sep 17 00:00:00 2001 From: Paul Date: Fri, 10 Dec 2021 11:46:01 +0800 Subject: [PATCH 17/38] Remove extra space --- x/profiles/types/models_chain_links_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/x/profiles/types/models_chain_links_test.go b/x/profiles/types/models_chain_links_test.go index e183af11e4..dab3089fba 100644 --- a/x/profiles/types/models_chain_links_test.go +++ b/x/profiles/types/models_chain_links_test.go @@ -13,7 +13,6 @@ import ( codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/bech32" From e23ecf9e5dcefe898ef7f0a9c8ebdf4346d94496 Mon Sep 17 00:00:00 2001 From: Paul Date: Fri, 10 Dec 2021 11:58:11 +0800 Subject: [PATCH 18/38] Remove strings trimspace in prefix and address length checking --- x/profiles/types/models_chain_links.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/profiles/types/models_chain_links.go b/x/profiles/types/models_chain_links.go index 86db046139..ecf89dddf0 100644 --- a/x/profiles/types/models_chain_links.go +++ b/x/profiles/types/models_chain_links.go @@ -220,7 +220,7 @@ func (e EthAddress) Validate() error { return fmt.Errorf("prefix cannot be empty or blank") } - if len(strings.TrimSpace(e.Value)) <= len(strings.TrimSpace(e.Prefix)) { + if len(e.Value) <= len(e.Prefix) { return fmt.Errorf("address cannot be smaller than prefix") } From aae6d0bb050615224ef785671a60c8050d6459f6 Mon Sep 17 00:00:00 2001 From: Paul Date: Fri, 10 Dec 2021 12:49:54 +0800 Subject: [PATCH 19/38] Register interface --- x/profiles/types/codec.go | 2 ++ x/profiles/types/models_chain_links.go | 1 + 2 files changed, 3 insertions(+) diff --git a/x/profiles/types/codec.go b/x/profiles/types/codec.go index 574be9a946..aa08f77aa9 100644 --- a/x/profiles/types/codec.go +++ b/x/profiles/types/codec.go @@ -29,6 +29,7 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterInterface((*AddressData)(nil), nil) cdc.RegisterConcrete(&Bech32Address{}, "desmos/Bech32Address", nil) cdc.RegisterConcrete(&Base58Address{}, "desmos/Base58Address", nil) + cdc.RegisterConcrete(&EthAddress{}, "desmos/EthAddress", nil) cdc.RegisterConcrete(&Profile{}, "desmos/Profile", nil) } @@ -42,6 +43,7 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { (*AddressData)(nil), &Bech32Address{}, &Base58Address{}, + &EthAddress{}, ) registry.RegisterImplementations((*sdk.Msg)(nil), diff --git a/x/profiles/types/models_chain_links.go b/x/profiles/types/models_chain_links.go index ecf89dddf0..43415ef128 100644 --- a/x/profiles/types/models_chain_links.go +++ b/x/profiles/types/models_chain_links.go @@ -211,6 +211,7 @@ func NewEthAddress(value, prefix string) *EthAddress { return &EthAddress{Value: value, Prefix: prefix} } +// Validate implements AddressData func (e EthAddress) Validate() error { if strings.TrimSpace(e.Value) == "" { return fmt.Errorf("value cannot be empty or blank") From c2897d7655c2ca42ee8ea254321aa20d437f6145 Mon Sep 17 00:00:00 2001 From: Paul Date: Fri, 10 Dec 2021 18:38:22 +0800 Subject: [PATCH 20/38] Remove prefix --- .../profiles/v1beta1/models_chain_links.proto | 3 - x/profiles/types/models_chain_links.go | 16 +-- x/profiles/types/models_chain_links.pb.go | 130 ++++++------------ x/profiles/types/models_chain_links_test.go | 23 ++-- 4 files changed, 56 insertions(+), 116 deletions(-) diff --git a/proto/desmos/profiles/v1beta1/models_chain_links.proto b/proto/desmos/profiles/v1beta1/models_chain_links.proto index 287bb61ac8..51e2fb5271 100644 --- a/proto/desmos/profiles/v1beta1/models_chain_links.proto +++ b/proto/desmos/profiles/v1beta1/models_chain_links.proto @@ -104,7 +104,4 @@ message EthAddress { // Value represents the Eth address value string value = 1 [ (gogoproto.moretags) = "yaml:\"value\"" ]; - - // Prefix represents the prefix of the Eth address - string prefix = 2 [ (gogoproto.moretags) = "yaml:\"prefix\"" ]; } \ No newline at end of file diff --git a/x/profiles/types/models_chain_links.go b/x/profiles/types/models_chain_links.go index 43415ef128..04a778bf38 100644 --- a/x/profiles/types/models_chain_links.go +++ b/x/profiles/types/models_chain_links.go @@ -207,8 +207,8 @@ func (b Base58Address) VerifyPubKey(key cryptotypes.PubKey) (bool, error) { var _ AddressData = &EthAddress{} // NewEthAddress returns a new EthAddress instance -func NewEthAddress(value, prefix string) *EthAddress { - return &EthAddress{Value: value, Prefix: prefix} +func NewEthAddress(value string) *EthAddress { + return &EthAddress{Value: value} } // Validate implements AddressData @@ -217,16 +217,12 @@ func (e EthAddress) Validate() error { return fmt.Errorf("value cannot be empty or blank") } - if strings.TrimSpace(e.Prefix) == "" { - return fmt.Errorf("prefix cannot be empty or blank") - } - - if len(e.Value) <= len(e.Prefix) { + if len(e.Value) <= 2 { return fmt.Errorf("address cannot be smaller than prefix") } - prefix, addrWithoutPrefix := e.Value[:len(e.Prefix)], e.Value[len(e.Prefix):] - if prefix != e.Prefix { + prefix, addrWithoutPrefix := e.Value[:2], e.Value[2:] + if prefix != "0x" { return fmt.Errorf("prefix does not match") } @@ -243,7 +239,7 @@ func (e EthAddress) GetValue() string { // VerifyPubKey implements AddressData func (e EthAddress) VerifyPubKey(key cryptotypes.PubKey) (bool, error) { - addr := e.Value[len(e.Prefix):] + addr := e.Value[2:] bz, err := hex.DecodeString(addr) if err != nil { return false, err diff --git a/x/profiles/types/models_chain_links.pb.go b/x/profiles/types/models_chain_links.pb.go index a985ef2802..c376d851b8 100644 --- a/x/profiles/types/models_chain_links.pb.go +++ b/x/profiles/types/models_chain_links.pb.go @@ -241,12 +241,10 @@ func (m *Base58Address) XXX_DiscardUnknown() { var xxx_messageInfo_Base58Address proto.InternalMessageInfo -// EthAddress represents a Eth address +// EthAddress represents an Eth address type EthAddress struct { // Value represents the Eth address value Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty" yaml:"value"` - // Prefix represents the prefix of the Eth address - Prefix string `protobuf:"bytes,2,opt,name=prefix,proto3" json:"prefix,omitempty" yaml:"prefix"` } func (m *EthAddress) Reset() { *m = EthAddress{} } @@ -297,46 +295,46 @@ func init() { var fileDescriptor_1c1946212735e419 = []byte{ // 632 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x54, 0xbd, 0x6e, 0xd3, 0x40, - 0x1c, 0x8f, 0x69, 0xd3, 0x2a, 0x97, 0x04, 0x5a, 0x13, 0x44, 0x68, 0x25, 0x5f, 0x39, 0x10, 0x2a, - 0x43, 0x6d, 0x9a, 0x82, 0x84, 0x3a, 0x51, 0x17, 0x16, 0xca, 0x00, 0x56, 0x27, 0x96, 0xe8, 0xec, - 0x5c, 0x1c, 0xab, 0xb6, 0xcf, 0xf2, 0x9d, 0xab, 0x44, 0x42, 0x62, 0x65, 0xec, 0xc8, 0xd8, 0x89, - 0x27, 0xe0, 0x09, 0x98, 0x2a, 0xa6, 0x8a, 0x89, 0xc9, 0xa0, 0x76, 0x61, 0xce, 0x13, 0xa0, 0xbb, - 0xb3, 0x9b, 0xd0, 0x2a, 0x48, 0x4c, 0x6c, 0x77, 0xff, 0xdf, 0xc7, 0xfd, 0xbf, 0x6c, 0xf0, 0xa8, - 0x47, 0x58, 0x44, 0x99, 0x95, 0xa4, 0xb4, 0x1f, 0x84, 0x84, 0x59, 0x87, 0x9b, 0x2e, 0xe1, 0x78, - 0xd3, 0x8a, 0x68, 0x8f, 0x84, 0xac, 0xeb, 0x0d, 0x70, 0x10, 0x77, 0xc3, 0x20, 0x3e, 0x60, 0x66, - 0x92, 0x52, 0x4e, 0xf5, 0xdb, 0x4a, 0x61, 0x96, 0x0a, 0xb3, 0x50, 0xac, 0xb4, 0x7c, 0xea, 0x53, - 0xc9, 0xb1, 0xc4, 0x49, 0xd1, 0x57, 0xee, 0xf8, 0x94, 0xfa, 0x21, 0xb1, 0xe4, 0xcd, 0xcd, 0xfa, - 0x16, 0x8e, 0x47, 0x05, 0x04, 0x2f, 0x43, 0x3c, 0x88, 0x08, 0xe3, 0x38, 0x4a, 0x4a, 0xad, 0x47, - 0xc5, 0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1, 0xe8, 0x28, 0x27, 0x43, + 0x2e, 0x47, 0x5d, 0xb3, 0xef, 0x8c, 0x73, 0xb8, 0x5c, 0xe4, 0xb8, 0xc4, 0x90, 0x53, 0x93, 0x97, + 0x03, 0x32, 0xe4, 0x57, 0x1e, 0xf1, 0x1e, 0x34, 0x6d, 0xe2, 0x0d, 0xb6, 0x3a, 0xc5, 0x1e, 0xe9, + 0x8f, 0x40, 0xf5, 0x08, 0x87, 0x59, 0xd9, 0x89, 0xa5, 0xc9, 0x5a, 0xc8, 0x30, 0x72, 0x14, 0xac, + 0x3f, 0x06, 0x0b, 0x49, 0x4a, 0xfa, 0xc1, 0xb0, 0xa8, 0x76, 0x79, 0x9c, 0xc3, 0x66, 0xb9, 0x3f, + 0x22, 0x2e, 0xde, 0x26, 0x0f, 0xdb, 0xab, 0xd3, 0x19, 0xbf, 0xfd, 0xb9, 0xb3, 0xe8, 0x00, 0x34, + 0x6d, 0xcc, 0xc8, 0xb3, 0xe7, 0xff, 0x58, 0xc0, 0xdf, 0x5d, 0xf7, 0x01, 0x78, 0xc5, 0x07, 0xff, + 0xd3, 0xd2, 0xde, 0x3b, 0x3d, 0x37, 0xb4, 0xb3, 0x73, 0x43, 0xfb, 0x79, 0x6e, 0x68, 0xc7, 0x17, + 0x46, 0xe5, 0xec, 0xc2, 0xa8, 0x7c, 0xbf, 0x30, 0x2a, 0xef, 0x36, 0xfd, 0x80, 0x0f, 0x32, 0xd7, + 0xf4, 0x68, 0x64, 0xa9, 0xaf, 0x62, 0x23, 0xc4, 0x2e, 0x2b, 0xce, 0xd6, 0x51, 0xc7, 0x1a, 0x4e, + 0xfe, 0x63, 0x7c, 0x94, 0x10, 0xe6, 0x2e, 0xc8, 0xc5, 0xd8, 0xfa, 0x1d, 0x00, 0x00, 0xff, 0xff, + 0x0a, 0x20, 0xf2, 0xb2, 0xe7, 0x04, 0x00, 0x00, } func (this *ChainLink) Equal(that interface{}) bool { @@ -502,9 +500,6 @@ func (this *EthAddress) Equal(that interface{}) bool { if this.Value != that1.Value { return false } - if this.Prefix != that1.Prefix { - return false - } return true } func (m *ChainLink) Marshal() (dAtA []byte, err error) { @@ -743,13 +738,6 @@ func (m *EthAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Prefix) > 0 { - i -= len(m.Prefix) - copy(dAtA[i:], m.Prefix) - i = encodeVarintModelsChainLinks(dAtA, i, uint64(len(m.Prefix))) - i-- - dAtA[i] = 0x12 - } if len(m.Value) > 0 { i -= len(m.Value) copy(dAtA[i:], m.Value) @@ -868,10 +856,6 @@ func (m *EthAddress) Size() (n int) { if l > 0 { n += 1 + l + sovModelsChainLinks(uint64(l)) } - l = len(m.Prefix) - if l > 0 { - n += 1 + l + sovModelsChainLinks(uint64(l)) - } return n } @@ -1587,38 +1571,6 @@ func (m *EthAddress) Unmarshal(dAtA []byte) error { } m.Value = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Prefix", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowModelsChainLinks - } - 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 ErrInvalidLengthModelsChainLinks - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthModelsChainLinks - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Prefix = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipModelsChainLinks(dAtA[iNdEx:]) diff --git a/x/profiles/types/models_chain_links_test.go b/x/profiles/types/models_chain_links_test.go index dab3089fba..845eb6e423 100644 --- a/x/profiles/types/models_chain_links_test.go +++ b/x/profiles/types/models_chain_links_test.go @@ -191,7 +191,7 @@ func TestProof_Verify(t *testing.T) { { name: "wrong Eth address returns error", proof: types.NewProof(ethPubKey, ethSigHex, hex.EncodeToString([]byte(plainText))), - addressData: types.NewEthAddress("0xcdAFfbFd8c131464fEE561e3d9b585141e403719", "0x"), + addressData: types.NewEthAddress("0xcdAFfbFd8c131464fEE561e3d9b585141e403719"), shouldErr: true, }, { @@ -209,7 +209,7 @@ func TestProof_Verify(t *testing.T) { { name: "correct proof with Eth address returns no error", proof: types.NewProof(ethPubKey, ethSigHex, hex.EncodeToString([]byte(plainText))), - addressData: types.NewEthAddress(ethAddr, "0x"), + addressData: types.NewEthAddress(ethAddr), shouldErr: false, }, } @@ -337,37 +337,32 @@ func TestEthAddress_Validate(t *testing.T) { }{ { name: "empty address returns error", - address: types.NewEthAddress("", "0x"), - shouldErr: true, - }, - { - name: "empty prefix returns error", - address: types.NewEthAddress("0x941991947B6eC9F5537bcaC30C1295E8154Df4cC", ""), + address: types.NewEthAddress(""), shouldErr: true, }, { name: "address smaller than prefix length returns error", - address: types.NewEthAddress("0x", "0x"), + address: types.NewEthAddress("0"), shouldErr: true, }, { name: "prefix does not match returns error", - address: types.NewEthAddress("0184", "0x"), + address: types.NewEthAddress("0184"), shouldErr: true, }, { name: "invalid address returns error", - address: types.NewEthAddress("0OiIjJ", "0x"), + address: types.NewEthAddress("0OiIjJ"), shouldErr: true, }, { name: "spaced address returns error", - address: types.NewEthAddress("0x 941991947B6eC9F5537bcaC30C1295E8154Df4cC", "0x"), + address: types.NewEthAddress("0x 941991947B6eC9F5537bcaC30C1295E8154Df4cC"), shouldErr: true, }, { name: "valid address returns no error", - address: types.NewEthAddress("0x941991947B6eC9F5537bcaC30C1295E8154Df4cC", "0x"), + address: types.NewEthAddress("0x941991947B6eC9F5537bcaC30C1295E8154Df4cC"), shouldErr: false, }, } @@ -387,7 +382,7 @@ func TestEthAddress_Validate(t *testing.T) { } func TestEthAddress_GetValue(t *testing.T) { - data := types.NewEthAddress("0x941991947B6eC9F5537bcaC30C1295E8154Df4cC", "0x") + data := types.NewEthAddress("0x941991947B6eC9F5537bcaC30C1295E8154Df4cC") require.Equal(t, "0x941991947B6eC9F5537bcaC30C1295E8154Df4cC", data.GetValue()) } From f55623ac9ec86513a7d79110876c51b77f1c9981 Mon Sep 17 00:00:00 2001 From: Paul Date: Fri, 10 Dec 2021 18:42:21 +0800 Subject: [PATCH 21/38] Rename eth address into eth hex address --- .../profiles/v1beta1/models_chain_links.proto | 6 +- x/profiles/types/codec.go | 4 +- x/profiles/types/models_chain_links.go | 14 +- x/profiles/types/models_chain_links.pb.go | 132 +++++++++--------- x/profiles/types/models_chain_links_test.go | 24 ++-- 5 files changed, 90 insertions(+), 90 deletions(-) diff --git a/proto/desmos/profiles/v1beta1/models_chain_links.proto b/proto/desmos/profiles/v1beta1/models_chain_links.proto index 51e2fb5271..35a7efdacd 100644 --- a/proto/desmos/profiles/v1beta1/models_chain_links.proto +++ b/proto/desmos/profiles/v1beta1/models_chain_links.proto @@ -95,13 +95,13 @@ message Base58Address { string value = 1 [ (gogoproto.moretags) = "yaml:\"value\"" ]; } -// EthAddress represents an Eth address -message EthAddress { +// EthHexAddress represents an Eth Hex-encoded address +message EthHexAddress { option (gogoproto.goproto_getters) = false; option (gogoproto.equal) = true; option (gogoproto.goproto_stringer) = true; option (cosmos_proto.implements_interface) = "AddressData"; - // Value represents the Eth address value + // Value represents the Eth hex address value string value = 1 [ (gogoproto.moretags) = "yaml:\"value\"" ]; } \ No newline at end of file diff --git a/x/profiles/types/codec.go b/x/profiles/types/codec.go index aa08f77aa9..2bd4b6301e 100644 --- a/x/profiles/types/codec.go +++ b/x/profiles/types/codec.go @@ -29,7 +29,7 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterInterface((*AddressData)(nil), nil) cdc.RegisterConcrete(&Bech32Address{}, "desmos/Bech32Address", nil) cdc.RegisterConcrete(&Base58Address{}, "desmos/Base58Address", nil) - cdc.RegisterConcrete(&EthAddress{}, "desmos/EthAddress", nil) + cdc.RegisterConcrete(&EthHexAddress{}, "desmos/EthHexAddress", nil) cdc.RegisterConcrete(&Profile{}, "desmos/Profile", nil) } @@ -43,7 +43,7 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { (*AddressData)(nil), &Bech32Address{}, &Base58Address{}, - &EthAddress{}, + &EthHexAddress{}, ) registry.RegisterImplementations((*sdk.Msg)(nil), diff --git a/x/profiles/types/models_chain_links.go b/x/profiles/types/models_chain_links.go index 04a778bf38..9efdce4ba6 100644 --- a/x/profiles/types/models_chain_links.go +++ b/x/profiles/types/models_chain_links.go @@ -204,15 +204,15 @@ func (b Base58Address) VerifyPubKey(key cryptotypes.PubKey) (bool, error) { // -------------------------------------------------------------------------------------------------------------------- -var _ AddressData = &EthAddress{} +var _ AddressData = &EthHexAddress{} -// NewEthAddress returns a new EthAddress instance -func NewEthAddress(value string) *EthAddress { - return &EthAddress{Value: value} +// NewEthHexAddress returns a new EthHexAddress instance +func NewEthHexAddress(value string) *EthHexAddress { + return &EthHexAddress{Value: value} } // Validate implements AddressData -func (e EthAddress) Validate() error { +func (e EthHexAddress) Validate() error { if strings.TrimSpace(e.Value) == "" { return fmt.Errorf("value cannot be empty or blank") } @@ -233,12 +233,12 @@ func (e EthAddress) Validate() error { } // GetValue implements AddressData -func (e EthAddress) GetValue() string { +func (e EthHexAddress) GetValue() string { return e.Value } // VerifyPubKey implements AddressData -func (e EthAddress) VerifyPubKey(key cryptotypes.PubKey) (bool, error) { +func (e EthHexAddress) VerifyPubKey(key cryptotypes.PubKey) (bool, error) { addr := e.Value[2:] bz, err := hex.DecodeString(addr) if err != nil { diff --git a/x/profiles/types/models_chain_links.pb.go b/x/profiles/types/models_chain_links.pb.go index c376d851b8..4e055feaa6 100644 --- a/x/profiles/types/models_chain_links.pb.go +++ b/x/profiles/types/models_chain_links.pb.go @@ -241,24 +241,24 @@ func (m *Base58Address) XXX_DiscardUnknown() { var xxx_messageInfo_Base58Address proto.InternalMessageInfo -// EthAddress represents an Eth address -type EthAddress struct { - // Value represents the Eth address value +// EthHexAddress represents an Eth Hex-encoded address +type EthHexAddress struct { + // Value represents the Eth hex address value Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty" yaml:"value"` } -func (m *EthAddress) Reset() { *m = EthAddress{} } -func (m *EthAddress) String() string { return proto.CompactTextString(m) } -func (*EthAddress) ProtoMessage() {} -func (*EthAddress) Descriptor() ([]byte, []int) { +func (m *EthHexAddress) Reset() { *m = EthHexAddress{} } +func (m *EthHexAddress) String() string { return proto.CompactTextString(m) } +func (*EthHexAddress) ProtoMessage() {} +func (*EthHexAddress) Descriptor() ([]byte, []int) { return fileDescriptor_1c1946212735e419, []int{5} } -func (m *EthAddress) XXX_Unmarshal(b []byte) error { +func (m *EthHexAddress) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *EthAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *EthHexAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_EthAddress.Marshal(b, m, deterministic) + return xxx_messageInfo_EthHexAddress.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -268,17 +268,17 @@ func (m *EthAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *EthAddress) XXX_Merge(src proto.Message) { - xxx_messageInfo_EthAddress.Merge(m, src) +func (m *EthHexAddress) XXX_Merge(src proto.Message) { + xxx_messageInfo_EthHexAddress.Merge(m, src) } -func (m *EthAddress) XXX_Size() int { +func (m *EthHexAddress) XXX_Size() int { return m.Size() } -func (m *EthAddress) XXX_DiscardUnknown() { - xxx_messageInfo_EthAddress.DiscardUnknown(m) +func (m *EthHexAddress) XXX_DiscardUnknown() { + xxx_messageInfo_EthHexAddress.DiscardUnknown(m) } -var xxx_messageInfo_EthAddress proto.InternalMessageInfo +var xxx_messageInfo_EthHexAddress proto.InternalMessageInfo func init() { proto.RegisterType((*ChainLink)(nil), "desmos.profiles.v1beta1.ChainLink") @@ -286,7 +286,7 @@ func init() { proto.RegisterType((*Proof)(nil), "desmos.profiles.v1beta1.Proof") proto.RegisterType((*Bech32Address)(nil), "desmos.profiles.v1beta1.Bech32Address") proto.RegisterType((*Base58Address)(nil), "desmos.profiles.v1beta1.Base58Address") - proto.RegisterType((*EthAddress)(nil), "desmos.profiles.v1beta1.EthAddress") + proto.RegisterType((*EthHexAddress)(nil), "desmos.profiles.v1beta1.EthHexAddress") } func init() { @@ -294,47 +294,47 @@ func init() { } var fileDescriptor_1c1946212735e419 = []byte{ - // 632 bytes of a gzipped FileDescriptorProto + // 633 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x3f, 0x6f, 0xd3, 0x40, 0x14, 0x8f, 0x69, 0xd3, 0x2a, 0x97, 0x04, 0x5a, 0x13, 0x44, 0x68, 0x25, 0x5f, 0x39, 0x10, 0x2a, - 0x43, 0x6d, 0x9a, 0x82, 0x84, 0x3a, 0x51, 0x17, 0x16, 0xca, 0x40, 0xad, 0x4e, 0x2c, 0xd1, 0xd9, - 0xb9, 0x38, 0x56, 0x6d, 0x9f, 0xe5, 0x3b, 0x57, 0xc9, 0xc4, 0xca, 0xd8, 0x91, 0xb1, 0x13, 0x9f, - 0x80, 0x4f, 0xc0, 0x54, 0x31, 0x55, 0x4c, 0x4c, 0x06, 0xb5, 0x0b, 0x73, 0x3e, 0x01, 0xba, 0x3b, - 0xbb, 0x09, 0xad, 0x82, 0x84, 0xc4, 0x76, 0xf7, 0x7e, 0x7f, 0xde, 0xbb, 0xf7, 0x9e, 0x0d, 0x9e, - 0xf4, 0x08, 0x8b, 0x28, 0xb3, 0x92, 0x94, 0xf6, 0x83, 0x90, 0x30, 0xeb, 0x68, 0xd3, 0x25, 0x1c, - 0x6f, 0x5a, 0x11, 0xed, 0x91, 0x90, 0x75, 0xbd, 0x01, 0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0x2e, 0xc8, 0xdd, 0xd8, 0xfa, 0x1d, 0x00, 0x00, 0xff, + 0xff, 0x00, 0xc6, 0x33, 0x15, 0xea, 0x04, 0x00, 0x00, } func (this *ChainLink) Equal(that interface{}) bool { @@ -478,14 +478,14 @@ func (this *Base58Address) Equal(that interface{}) bool { } return true } -func (this *EthAddress) Equal(that interface{}) bool { +func (this *EthHexAddress) Equal(that interface{}) bool { if that == nil { return this == nil } - that1, ok := that.(*EthAddress) + that1, ok := that.(*EthHexAddress) if !ok { - that2, ok := that.(EthAddress) + that2, ok := that.(EthHexAddress) if ok { that1 = &that2 } else { @@ -718,7 +718,7 @@ func (m *Base58Address) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *EthAddress) Marshal() (dAtA []byte, err error) { +func (m *EthHexAddress) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -728,12 +728,12 @@ func (m *EthAddress) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *EthAddress) MarshalTo(dAtA []byte) (int, error) { +func (m *EthHexAddress) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *EthAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *EthHexAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -846,7 +846,7 @@ func (m *Base58Address) Size() (n int) { return n } -func (m *EthAddress) Size() (n int) { +func (m *EthHexAddress) Size() (n int) { if m == nil { return 0 } @@ -1510,7 +1510,7 @@ func (m *Base58Address) Unmarshal(dAtA []byte) error { } return nil } -func (m *EthAddress) Unmarshal(dAtA []byte) error { +func (m *EthHexAddress) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1533,10 +1533,10 @@ func (m *EthAddress) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: EthAddress: wiretype end group for non-group") + return fmt.Errorf("proto: EthHexAddress: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: EthAddress: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: EthHexAddress: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: diff --git a/x/profiles/types/models_chain_links_test.go b/x/profiles/types/models_chain_links_test.go index 845eb6e423..5f464d134c 100644 --- a/x/profiles/types/models_chain_links_test.go +++ b/x/profiles/types/models_chain_links_test.go @@ -191,7 +191,7 @@ func TestProof_Verify(t *testing.T) { { name: "wrong Eth address returns error", proof: types.NewProof(ethPubKey, ethSigHex, hex.EncodeToString([]byte(plainText))), - addressData: types.NewEthAddress("0xcdAFfbFd8c131464fEE561e3d9b585141e403719"), + addressData: types.NewEthHexAddress("0xcdAFfbFd8c131464fEE561e3d9b585141e403719"), shouldErr: true, }, { @@ -209,7 +209,7 @@ func TestProof_Verify(t *testing.T) { { name: "correct proof with Eth address returns no error", proof: types.NewProof(ethPubKey, ethSigHex, hex.EncodeToString([]byte(plainText))), - addressData: types.NewEthAddress(ethAddr), + addressData: types.NewEthHexAddress(ethAddr), shouldErr: false, }, } @@ -329,40 +329,40 @@ func TestBase58Address_GetValue(t *testing.T) { // -------------------------------------------------------------------------------------------------------------------- -func TestEthAddress_Validate(t *testing.T) { +func TestEthHexAddress_Validate(t *testing.T) { testCases := []struct { name string - address *types.EthAddress + address *types.EthHexAddress shouldErr bool }{ { name: "empty address returns error", - address: types.NewEthAddress(""), + address: types.NewEthHexAddress(""), shouldErr: true, }, { name: "address smaller than prefix length returns error", - address: types.NewEthAddress("0"), + address: types.NewEthHexAddress("0"), shouldErr: true, }, { name: "prefix does not match returns error", - address: types.NewEthAddress("0184"), + address: types.NewEthHexAddress("0184"), shouldErr: true, }, { name: "invalid address returns error", - address: types.NewEthAddress("0OiIjJ"), + address: types.NewEthHexAddress("0OiIjJ"), shouldErr: true, }, { name: "spaced address returns error", - address: types.NewEthAddress("0x 941991947B6eC9F5537bcaC30C1295E8154Df4cC"), + address: types.NewEthHexAddress("0x 941991947B6eC9F5537bcaC30C1295E8154Df4cC"), shouldErr: true, }, { name: "valid address returns no error", - address: types.NewEthAddress("0x941991947B6eC9F5537bcaC30C1295E8154Df4cC"), + address: types.NewEthHexAddress("0x941991947B6eC9F5537bcaC30C1295E8154Df4cC"), shouldErr: false, }, } @@ -381,8 +381,8 @@ func TestEthAddress_Validate(t *testing.T) { } } -func TestEthAddress_GetValue(t *testing.T) { - data := types.NewEthAddress("0x941991947B6eC9F5537bcaC30C1295E8154Df4cC") +func TestEthHexAddress_GetValue(t *testing.T) { + data := types.NewEthHexAddress("0x941991947B6eC9F5537bcaC30C1295E8154Df4cC") require.Equal(t, "0x941991947B6eC9F5537bcaC30C1295E8154Df4cC", data.GetValue()) } From c63a52428d7a2cd831d978f0c4fe9fa2fd01b152 Mon Sep 17 00:00:00 2001 From: Paul Date: Fri, 10 Dec 2021 18:56:31 +0800 Subject: [PATCH 22/38] Fix test name --- x/profiles/types/models_chain_links_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/profiles/types/models_chain_links_test.go b/x/profiles/types/models_chain_links_test.go index 5f464d134c..349108ef34 100644 --- a/x/profiles/types/models_chain_links_test.go +++ b/x/profiles/types/models_chain_links_test.go @@ -189,7 +189,7 @@ func TestProof_Verify(t *testing.T) { shouldErr: true, }, { - name: "wrong Eth address returns error", + name: "wrong Eth hex address returns error", proof: types.NewProof(ethPubKey, ethSigHex, hex.EncodeToString([]byte(plainText))), addressData: types.NewEthHexAddress("0xcdAFfbFd8c131464fEE561e3d9b585141e403719"), shouldErr: true, @@ -207,7 +207,7 @@ func TestProof_Verify(t *testing.T) { shouldErr: false, }, { - name: "correct proof with Eth address returns no error", + name: "correct proof with Eth hex address returns no error", proof: types.NewProof(ethPubKey, ethSigHex, hex.EncodeToString([]byte(plainText))), addressData: types.NewEthHexAddress(ethAddr), shouldErr: false, From 5580de90642d9e32e07ee61161eb5956aaa473a6 Mon Sep 17 00:00:00 2001 From: Paul Date: Mon, 13 Dec 2021 15:00:51 +0800 Subject: [PATCH 23/38] Rename EthHexAddress into HexAddress --- .../profiles/v1beta1/models_chain_links.proto | 4 +- x/profiles/types/codec.go | 4 +- x/profiles/types/models_chain_links.go | 27 ++-- x/profiles/types/models_chain_links.pb.go | 128 +++++++++--------- x/profiles/types/models_chain_links_test.go | 30 ++-- 5 files changed, 97 insertions(+), 96 deletions(-) diff --git a/proto/desmos/profiles/v1beta1/models_chain_links.proto b/proto/desmos/profiles/v1beta1/models_chain_links.proto index 35a7efdacd..1d98f744f9 100644 --- a/proto/desmos/profiles/v1beta1/models_chain_links.proto +++ b/proto/desmos/profiles/v1beta1/models_chain_links.proto @@ -95,8 +95,8 @@ message Base58Address { string value = 1 [ (gogoproto.moretags) = "yaml:\"value\"" ]; } -// EthHexAddress represents an Eth Hex-encoded address -message EthHexAddress { +// HexAddress represents an Eth Hex-encoded address +message HexAddress { option (gogoproto.goproto_getters) = false; option (gogoproto.equal) = true; option (gogoproto.goproto_stringer) = true; diff --git a/x/profiles/types/codec.go b/x/profiles/types/codec.go index 2bd4b6301e..c05bb0f413 100644 --- a/x/profiles/types/codec.go +++ b/x/profiles/types/codec.go @@ -29,7 +29,7 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterInterface((*AddressData)(nil), nil) cdc.RegisterConcrete(&Bech32Address{}, "desmos/Bech32Address", nil) cdc.RegisterConcrete(&Base58Address{}, "desmos/Base58Address", nil) - cdc.RegisterConcrete(&EthHexAddress{}, "desmos/EthHexAddress", nil) + cdc.RegisterConcrete(&HexAddress{}, "desmos/HexAddress", nil) cdc.RegisterConcrete(&Profile{}, "desmos/Profile", nil) } @@ -43,7 +43,7 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { (*AddressData)(nil), &Bech32Address{}, &Base58Address{}, - &EthHexAddress{}, + &HexAddress{}, ) registry.RegisterImplementations((*sdk.Msg)(nil), diff --git a/x/profiles/types/models_chain_links.go b/x/profiles/types/models_chain_links.go index 9efdce4ba6..7e7f39ab1e 100644 --- a/x/profiles/types/models_chain_links.go +++ b/x/profiles/types/models_chain_links.go @@ -204,42 +204,43 @@ func (b Base58Address) VerifyPubKey(key cryptotypes.PubKey) (bool, error) { // -------------------------------------------------------------------------------------------------------------------- -var _ AddressData = &EthHexAddress{} +var _ AddressData = &HexAddress{} -// NewEthHexAddress returns a new EthHexAddress instance -func NewEthHexAddress(value string) *EthHexAddress { - return &EthHexAddress{Value: value} +// NewHexAddress returns a new HexAddress instance +// NOTE: Currently it mainly supports ethereum hex address +func NewHexAddress(value string) *HexAddress { + return &HexAddress{Value: value} } // Validate implements AddressData -func (e EthHexAddress) Validate() error { - if strings.TrimSpace(e.Value) == "" { +func (h HexAddress) Validate() error { + if strings.TrimSpace(h.Value) == "" { return fmt.Errorf("value cannot be empty or blank") } - if len(e.Value) <= 2 { + if len(h.Value) <= 2 { return fmt.Errorf("address cannot be smaller than prefix") } - prefix, addrWithoutPrefix := e.Value[:2], e.Value[2:] + prefix, addrWithoutPrefix := h.Value[:2], h.Value[2:] if prefix != "0x" { return fmt.Errorf("prefix does not match") } if _, err := hex.DecodeString(addrWithoutPrefix); err != nil { - return fmt.Errorf("invalid Eth address") + return fmt.Errorf("invalid hex address") } return nil } // GetValue implements AddressData -func (e EthHexAddress) GetValue() string { - return e.Value +func (h HexAddress) GetValue() string { + return h.Value } // VerifyPubKey implements AddressData -func (e EthHexAddress) VerifyPubKey(key cryptotypes.PubKey) (bool, error) { - addr := e.Value[2:] +func (h HexAddress) VerifyPubKey(key cryptotypes.PubKey) (bool, error) { + addr := h.Value[2:] bz, err := hex.DecodeString(addr) if err != nil { return false, err diff --git a/x/profiles/types/models_chain_links.pb.go b/x/profiles/types/models_chain_links.pb.go index 4e055feaa6..de9e574cbd 100644 --- a/x/profiles/types/models_chain_links.pb.go +++ b/x/profiles/types/models_chain_links.pb.go @@ -241,24 +241,24 @@ func (m *Base58Address) XXX_DiscardUnknown() { var xxx_messageInfo_Base58Address proto.InternalMessageInfo -// EthHexAddress represents an Eth Hex-encoded address -type EthHexAddress struct { +// HexAddress represents an Eth Hex-encoded address +type HexAddress struct { // Value represents the Eth hex address value Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty" yaml:"value"` } -func (m *EthHexAddress) Reset() { *m = EthHexAddress{} } -func (m *EthHexAddress) String() string { return proto.CompactTextString(m) } -func (*EthHexAddress) ProtoMessage() {} -func (*EthHexAddress) Descriptor() ([]byte, []int) { +func (m *HexAddress) Reset() { *m = HexAddress{} } +func (m *HexAddress) String() string { return proto.CompactTextString(m) } +func (*HexAddress) ProtoMessage() {} +func (*HexAddress) Descriptor() ([]byte, []int) { return fileDescriptor_1c1946212735e419, []int{5} } -func (m *EthHexAddress) XXX_Unmarshal(b []byte) error { +func (m *HexAddress) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *EthHexAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *HexAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_EthHexAddress.Marshal(b, m, deterministic) + return xxx_messageInfo_HexAddress.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -268,17 +268,17 @@ func (m *EthHexAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error return b[:n], nil } } -func (m *EthHexAddress) XXX_Merge(src proto.Message) { - xxx_messageInfo_EthHexAddress.Merge(m, src) +func (m *HexAddress) XXX_Merge(src proto.Message) { + xxx_messageInfo_HexAddress.Merge(m, src) } -func (m *EthHexAddress) XXX_Size() int { +func (m *HexAddress) XXX_Size() int { return m.Size() } -func (m *EthHexAddress) XXX_DiscardUnknown() { - xxx_messageInfo_EthHexAddress.DiscardUnknown(m) +func (m *HexAddress) XXX_DiscardUnknown() { + xxx_messageInfo_HexAddress.DiscardUnknown(m) } -var xxx_messageInfo_EthHexAddress proto.InternalMessageInfo +var xxx_messageInfo_HexAddress proto.InternalMessageInfo func init() { proto.RegisterType((*ChainLink)(nil), "desmos.profiles.v1beta1.ChainLink") @@ -286,7 +286,7 @@ func init() { proto.RegisterType((*Proof)(nil), "desmos.profiles.v1beta1.Proof") proto.RegisterType((*Bech32Address)(nil), "desmos.profiles.v1beta1.Bech32Address") proto.RegisterType((*Base58Address)(nil), "desmos.profiles.v1beta1.Base58Address") - proto.RegisterType((*EthHexAddress)(nil), "desmos.profiles.v1beta1.EthHexAddress") + proto.RegisterType((*HexAddress)(nil), "desmos.profiles.v1beta1.HexAddress") } func init() { @@ -297,44 +297,44 @@ var fileDescriptor_1c1946212735e419 = []byte{ // 633 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x3f, 0x6f, 0xd3, 0x40, 0x14, 0x8f, 0x69, 0xd3, 0x2a, 0x97, 0x04, 0x5a, 0x13, 0x44, 0x68, 0x25, 0x5f, 0x39, 0x10, 0x2a, - 0x43, 0x6d, 0x9a, 0x82, 0x84, 0x3a, 0x51, 0x17, 0x24, 0x44, 0x19, 0xc0, 0xea, 0xc4, 0x12, 0x9d, - 0x9d, 0x8b, 0x63, 0xd5, 0xf6, 0x59, 0xbe, 0x73, 0x95, 0x4c, 0xac, 0x8c, 0x1d, 0x19, 0x3b, 0xf1, - 0x09, 0xf8, 0x04, 0x4c, 0x15, 0x53, 0xc5, 0xc4, 0x64, 0x50, 0xbb, 0x30, 0xe7, 0x13, 0xa0, 0xbb, - 0xb3, 0x9b, 0xd0, 0x2a, 0x42, 0x48, 0x6c, 0x77, 0xef, 0xf7, 0xe7, 0xbd, 0x7b, 0xef, 0xd9, 0xe0, - 0x51, 0x8f, 0xb0, 0x88, 0x32, 0x2b, 0x49, 0x69, 0x3f, 0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x6b, 0x21, 0x76, 0x59, 0x79, 0xb6, 0x0e, 0x7b, 0xd6, 0x68, + 0xf2, 0x1f, 0xe3, 0xe3, 0x84, 0x30, 0x77, 0x4e, 0x2e, 0xc6, 0xc6, 0xef, 0x00, 0x00, 0x00, 0xff, + 0xff, 0x12, 0x59, 0x8b, 0x41, 0xe7, 0x04, 0x00, 0x00, } func (this *ChainLink) Equal(that interface{}) bool { @@ -478,14 +478,14 @@ func (this *Base58Address) Equal(that interface{}) bool { } return true } -func (this *EthHexAddress) Equal(that interface{}) bool { +func (this *HexAddress) Equal(that interface{}) bool { if that == nil { return this == nil } - that1, ok := that.(*EthHexAddress) + that1, ok := that.(*HexAddress) if !ok { - that2, ok := that.(EthHexAddress) + that2, ok := that.(HexAddress) if ok { that1 = &that2 } else { @@ -718,7 +718,7 @@ func (m *Base58Address) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *EthHexAddress) Marshal() (dAtA []byte, err error) { +func (m *HexAddress) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -728,12 +728,12 @@ func (m *EthHexAddress) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *EthHexAddress) MarshalTo(dAtA []byte) (int, error) { +func (m *HexAddress) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *EthHexAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *HexAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -846,7 +846,7 @@ func (m *Base58Address) Size() (n int) { return n } -func (m *EthHexAddress) Size() (n int) { +func (m *HexAddress) Size() (n int) { if m == nil { return 0 } @@ -1510,7 +1510,7 @@ func (m *Base58Address) Unmarshal(dAtA []byte) error { } return nil } -func (m *EthHexAddress) Unmarshal(dAtA []byte) error { +func (m *HexAddress) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1533,10 +1533,10 @@ func (m *EthHexAddress) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: EthHexAddress: wiretype end group for non-group") + return fmt.Errorf("proto: HexAddress: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: EthHexAddress: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: HexAddress: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: diff --git a/x/profiles/types/models_chain_links_test.go b/x/profiles/types/models_chain_links_test.go index 349108ef34..a23c53f2d7 100644 --- a/x/profiles/types/models_chain_links_test.go +++ b/x/profiles/types/models_chain_links_test.go @@ -138,7 +138,7 @@ func TestProof_Verify(t *testing.T) { require.NoError(t, err) base58SigHex := hex.EncodeToString(base58Sig) - // Ethereum + // Ethereum Hex ethPrivKeyBz, err := hex.DecodeString("2842d8f3701d16711b9ee320f32efe38e6b0891e243eaf6515250e7b006de53e") require.NoError(t, err) ethPrivKey := secp256k1.PrivKey{Key: ethPrivKeyBz} @@ -189,9 +189,9 @@ func TestProof_Verify(t *testing.T) { shouldErr: true, }, { - name: "wrong Eth hex address returns error", + name: "wrong Hex address returns error", proof: types.NewProof(ethPubKey, ethSigHex, hex.EncodeToString([]byte(plainText))), - addressData: types.NewEthHexAddress("0xcdAFfbFd8c131464fEE561e3d9b585141e403719"), + addressData: types.NewHexAddress("0xcdAFfbFd8c131464fEE561e3d9b585141e403719"), shouldErr: true, }, { @@ -207,9 +207,9 @@ func TestProof_Verify(t *testing.T) { shouldErr: false, }, { - name: "correct proof with Eth hex address returns no error", + name: "correct proof with Hexex address returns no error", proof: types.NewProof(ethPubKey, ethSigHex, hex.EncodeToString([]byte(plainText))), - addressData: types.NewEthHexAddress(ethAddr), + addressData: types.NewHexAddress(ethAddr), shouldErr: false, }, } @@ -329,40 +329,40 @@ func TestBase58Address_GetValue(t *testing.T) { // -------------------------------------------------------------------------------------------------------------------- -func TestEthHexAddress_Validate(t *testing.T) { +func TestHexAddress_Validate(t *testing.T) { testCases := []struct { name string - address *types.EthHexAddress + address *types.HexAddress shouldErr bool }{ { name: "empty address returns error", - address: types.NewEthHexAddress(""), + address: types.NewHexAddress(""), shouldErr: true, }, { name: "address smaller than prefix length returns error", - address: types.NewEthHexAddress("0"), + address: types.NewHexAddress("0"), shouldErr: true, }, { name: "prefix does not match returns error", - address: types.NewEthHexAddress("0184"), + address: types.NewHexAddress("0184"), shouldErr: true, }, { name: "invalid address returns error", - address: types.NewEthHexAddress("0OiIjJ"), + address: types.NewHexAddress("0OiIjJ"), shouldErr: true, }, { name: "spaced address returns error", - address: types.NewEthHexAddress("0x 941991947B6eC9F5537bcaC30C1295E8154Df4cC"), + address: types.NewHexAddress("0x 941991947B6eC9F5537bcaC30C1295E8154Df4cC"), shouldErr: true, }, { name: "valid address returns no error", - address: types.NewEthHexAddress("0x941991947B6eC9F5537bcaC30C1295E8154Df4cC"), + address: types.NewHexAddress("0x941991947B6eC9F5537bcaC30C1295E8154Df4cC"), shouldErr: false, }, } @@ -381,8 +381,8 @@ func TestEthHexAddress_Validate(t *testing.T) { } } -func TestEthHexAddress_GetValue(t *testing.T) { - data := types.NewEthHexAddress("0x941991947B6eC9F5537bcaC30C1295E8154Df4cC") +func TestHexAddress_GetValue(t *testing.T) { + data := types.NewHexAddress("0x941991947B6eC9F5537bcaC30C1295E8154Df4cC") require.Equal(t, "0x941991947B6eC9F5537bcaC30C1295E8154Df4cC", data.GetValue()) } From 5fdf2266c567cd3e1af87125efe6d4a8b10b09c1 Mon Sep 17 00:00:00 2001 From: Paul Date: Mon, 13 Dec 2021 15:03:26 +0800 Subject: [PATCH 24/38] Fix typo --- x/profiles/types/models_chain_links_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/profiles/types/models_chain_links_test.go b/x/profiles/types/models_chain_links_test.go index a23c53f2d7..f4aa605122 100644 --- a/x/profiles/types/models_chain_links_test.go +++ b/x/profiles/types/models_chain_links_test.go @@ -207,7 +207,7 @@ func TestProof_Verify(t *testing.T) { shouldErr: false, }, { - name: "correct proof with Hexex address returns no error", + name: "correct proof with Hex address returns no error", proof: types.NewProof(ethPubKey, ethSigHex, hex.EncodeToString([]byte(plainText))), addressData: types.NewHexAddress(ethAddr), shouldErr: false, From 74d2313002f8ab0c86125531b1a90f39f8feb7fd Mon Sep 17 00:00:00 2001 From: Paul Date: Mon, 13 Dec 2021 15:08:12 +0800 Subject: [PATCH 25/38] Update comment --- x/profiles/types/models_chain_links.go | 2 +- x/profiles/types/models_chain_links_test.go | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/x/profiles/types/models_chain_links.go b/x/profiles/types/models_chain_links.go index 7e7f39ab1e..29ee9b0d2d 100644 --- a/x/profiles/types/models_chain_links.go +++ b/x/profiles/types/models_chain_links.go @@ -207,7 +207,7 @@ func (b Base58Address) VerifyPubKey(key cryptotypes.PubKey) (bool, error) { var _ AddressData = &HexAddress{} // NewHexAddress returns a new HexAddress instance -// NOTE: Currently it mainly supports ethereum hex address +// NOTE: Currently it only supports keccak256-uncompressed addresses func NewHexAddress(value string) *HexAddress { return &HexAddress{Value: value} } diff --git a/x/profiles/types/models_chain_links_test.go b/x/profiles/types/models_chain_links_test.go index f4aa605122..51bdb3b9ec 100644 --- a/x/profiles/types/models_chain_links_test.go +++ b/x/profiles/types/models_chain_links_test.go @@ -138,16 +138,16 @@ func TestProof_Verify(t *testing.T) { require.NoError(t, err) base58SigHex := hex.EncodeToString(base58Sig) - // Ethereum Hex - ethPrivKeyBz, err := hex.DecodeString("2842d8f3701d16711b9ee320f32efe38e6b0891e243eaf6515250e7b006de53e") + // Hex + hexPrivKeyBz, err := hex.DecodeString("2842d8f3701d16711b9ee320f32efe38e6b0891e243eaf6515250e7b006de53e") require.NoError(t, err) - ethPrivKey := secp256k1.PrivKey{Key: ethPrivKeyBz} - ethPubKey := ethPrivKey.PubKey() + hexPrivKey := secp256k1.PrivKey{Key: hexPrivKeyBz} + hexPubKey := hexPrivKey.PubKey() - ethAddr := "0x941991947B6eC9F5537bcaC30C1295E8154Df4cC" - ethSig, err := ethPrivKey.Sign([]byte(plainText)) + hexAddr := "0x941991947B6eC9F5537bcaC30C1295E8154Df4cC" + hexSig, err := hexPrivKey.Sign([]byte(plainText)) require.NoError(t, err) - ethSigHex := hex.EncodeToString(ethSig) + hexSigHex := hex.EncodeToString(hexSig) invalidAny, err := codectypes.NewAnyWithValue(bech32PrivKey) require.NoError(t, err) @@ -190,7 +190,7 @@ func TestProof_Verify(t *testing.T) { }, { name: "wrong Hex address returns error", - proof: types.NewProof(ethPubKey, ethSigHex, hex.EncodeToString([]byte(plainText))), + proof: types.NewProof(hexPubKey, hexSigHex, hex.EncodeToString([]byte(plainText))), addressData: types.NewHexAddress("0xcdAFfbFd8c131464fEE561e3d9b585141e403719"), shouldErr: true, }, @@ -208,8 +208,8 @@ func TestProof_Verify(t *testing.T) { }, { name: "correct proof with Hex address returns no error", - proof: types.NewProof(ethPubKey, ethSigHex, hex.EncodeToString([]byte(plainText))), - addressData: types.NewHexAddress(ethAddr), + proof: types.NewProof(hexPubKey, hexSigHex, hex.EncodeToString([]byte(plainText))), + addressData: types.NewHexAddress(hexAddr), shouldErr: false, }, } From 8a37f063c08e8d9f5c8a7ba7aba32fb16157a754 Mon Sep 17 00:00:00 2001 From: Paul Date: Mon, 13 Dec 2021 15:16:30 +0800 Subject: [PATCH 26/38] Update changeset --- ...e8e24b2b9fdf0923da002de55a8cf4fab6e91fddd7dcc4c1854efab.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/entries/6b0bd955ce8e24b2b9fdf0923da002de55a8cf4fab6e91fddd7dcc4c1854efab.yaml b/.changeset/entries/6b0bd955ce8e24b2b9fdf0923da002de55a8cf4fab6e91fddd7dcc4c1854efab.yaml index f619174ca4..d752745416 100644 --- a/.changeset/entries/6b0bd955ce8e24b2b9fdf0923da002de55a8cf4fab6e91fddd7dcc4c1854efab.yaml +++ b/.changeset/entries/6b0bd955ce8e24b2b9fdf0923da002de55a8cf4fab6e91fddd7dcc4c1854efab.yaml @@ -1,6 +1,6 @@ type: feat module: x/profiles pull_request: 688 -description: add support for eth address in chain link +description: add support for hex address in chain link backward_compatible: true date: 2021-12-10T03:38:53.1017055Z From e677d1332aa345bbb52126c1b2f44bbd1d8c8cf7 Mon Sep 17 00:00:00 2001 From: Paul Date: Mon, 13 Dec 2021 16:35:24 +0800 Subject: [PATCH 27/38] Update proto/desmos/profiles/v1beta1/models_chain_links.proto Co-authored-by: Leonardo Bragagnolo --- proto/desmos/profiles/v1beta1/models_chain_links.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/desmos/profiles/v1beta1/models_chain_links.proto b/proto/desmos/profiles/v1beta1/models_chain_links.proto index 1d98f744f9..caa3c73aa1 100644 --- a/proto/desmos/profiles/v1beta1/models_chain_links.proto +++ b/proto/desmos/profiles/v1beta1/models_chain_links.proto @@ -95,7 +95,7 @@ message Base58Address { string value = 1 [ (gogoproto.moretags) = "yaml:\"value\"" ]; } -// HexAddress represents an Eth Hex-encoded address +// HexAddress represents an Hex-encoded address message HexAddress { option (gogoproto.goproto_getters) = false; option (gogoproto.equal) = true; From bf5c129e018b9a35c833023f4e635a6dd378d074 Mon Sep 17 00:00:00 2001 From: Paul Date: Mon, 13 Dec 2021 16:35:30 +0800 Subject: [PATCH 28/38] Update proto/desmos/profiles/v1beta1/models_chain_links.proto Co-authored-by: Leonardo Bragagnolo --- proto/desmos/profiles/v1beta1/models_chain_links.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/desmos/profiles/v1beta1/models_chain_links.proto b/proto/desmos/profiles/v1beta1/models_chain_links.proto index caa3c73aa1..f90f2a8679 100644 --- a/proto/desmos/profiles/v1beta1/models_chain_links.proto +++ b/proto/desmos/profiles/v1beta1/models_chain_links.proto @@ -102,6 +102,6 @@ message HexAddress { option (gogoproto.goproto_stringer) = true; option (cosmos_proto.implements_interface) = "AddressData"; - // Value represents the Eth hex address value + // Value represents the hex address value string value = 1 [ (gogoproto.moretags) = "yaml:\"value\"" ]; } \ No newline at end of file From 2afd7079be5621f2e0ea7686b8ebf75703201856 Mon Sep 17 00:00:00 2001 From: Paul Date: Mon, 13 Dec 2021 16:36:42 +0800 Subject: [PATCH 29/38] Apply suggestions --- x/profiles/types/models_chain_links.go | 2 +- x/profiles/types/models_chain_links.pb.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/x/profiles/types/models_chain_links.go b/x/profiles/types/models_chain_links.go index 29ee9b0d2d..9782f6a324 100644 --- a/x/profiles/types/models_chain_links.go +++ b/x/profiles/types/models_chain_links.go @@ -224,7 +224,7 @@ func (h HexAddress) Validate() error { prefix, addrWithoutPrefix := h.Value[:2], h.Value[2:] if prefix != "0x" { - return fmt.Errorf("prefix does not match") + return fmt.Errorf("address prefix does not match the 0x prefix") } if _, err := hex.DecodeString(addrWithoutPrefix); err != nil { diff --git a/x/profiles/types/models_chain_links.pb.go b/x/profiles/types/models_chain_links.pb.go index de9e574cbd..be479b4a84 100644 --- a/x/profiles/types/models_chain_links.pb.go +++ b/x/profiles/types/models_chain_links.pb.go @@ -241,9 +241,9 @@ func (m *Base58Address) XXX_DiscardUnknown() { var xxx_messageInfo_Base58Address proto.InternalMessageInfo -// HexAddress represents an Eth Hex-encoded address +// HexAddress represents an Hex-encoded address type HexAddress struct { - // Value represents the Eth hex address value + // Value represents the hex address value Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty" yaml:"value"` } From de49d1729cef515ea62b5b0787079a3536f1a394 Mon Sep 17 00:00:00 2001 From: Paul Date: Thu, 16 Dec 2021 10:29:41 +0800 Subject: [PATCH 30/38] Update x/profiles/types/models_chain_links.go Co-authored-by: Riccardo Montagnin --- x/profiles/types/models_chain_links.go | 1 - 1 file changed, 1 deletion(-) diff --git a/x/profiles/types/models_chain_links.go b/x/profiles/types/models_chain_links.go index 9782f6a324..560880bf0a 100644 --- a/x/profiles/types/models_chain_links.go +++ b/x/profiles/types/models_chain_links.go @@ -207,7 +207,6 @@ func (b Base58Address) VerifyPubKey(key cryptotypes.PubKey) (bool, error) { var _ AddressData = &HexAddress{} // NewHexAddress returns a new HexAddress instance -// NOTE: Currently it only supports keccak256-uncompressed addresses func NewHexAddress(value string) *HexAddress { return &HexAddress{Value: value} } From ac2c2189bfd3f562ee5cc564ae91eeff7f6c8bb0 Mon Sep 17 00:00:00 2001 From: Paul Date: Thu, 16 Dec 2021 10:29:51 +0800 Subject: [PATCH 31/38] Update proto/desmos/profiles/v1beta1/models_chain_links.proto Co-authored-by: Riccardo Montagnin --- proto/desmos/profiles/v1beta1/models_chain_links.proto | 1 + 1 file changed, 1 insertion(+) diff --git a/proto/desmos/profiles/v1beta1/models_chain_links.proto b/proto/desmos/profiles/v1beta1/models_chain_links.proto index f90f2a8679..5c30455ed5 100644 --- a/proto/desmos/profiles/v1beta1/models_chain_links.proto +++ b/proto/desmos/profiles/v1beta1/models_chain_links.proto @@ -96,6 +96,7 @@ message Base58Address { } // HexAddress represents an Hex-encoded address +// NOTE: Currently it only supports keccak256-uncompressed addresses message HexAddress { option (gogoproto.goproto_getters) = false; option (gogoproto.equal) = true; From 54c3afbd9eba6a70e891adf89f98c68cf41c6739 Mon Sep 17 00:00:00 2001 From: Paul Date: Thu, 16 Dec 2021 10:42:10 +0800 Subject: [PATCH 32/38] Apply suggestions --- x/profiles/types/models_chain_links.pb.go | 1 + 1 file changed, 1 insertion(+) diff --git a/x/profiles/types/models_chain_links.pb.go b/x/profiles/types/models_chain_links.pb.go index be479b4a84..0ddaa8abed 100644 --- a/x/profiles/types/models_chain_links.pb.go +++ b/x/profiles/types/models_chain_links.pb.go @@ -242,6 +242,7 @@ func (m *Base58Address) XXX_DiscardUnknown() { var xxx_messageInfo_Base58Address proto.InternalMessageInfo // HexAddress represents an Hex-encoded address +// NOTE: Currently it only supports keccak256-uncompressed addresses type HexAddress struct { // Value represents the hex address value Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty" yaml:"value"` From 11a855d32f4f64dc3bc7c56c12d21a1d201df584 Mon Sep 17 00:00:00 2001 From: Paul Date: Mon, 20 Dec 2021 12:50:06 +0800 Subject: [PATCH 33/38] Add prefix --- .../profiles/v1beta1/models_chain_links.proto | 3 + x/profiles/types/models_chain_links.go | 17 ++- x/profiles/types/models_chain_links.pb.go | 128 ++++++++++++------ x/profiles/types/models_chain_links_test.go | 18 +-- 4 files changed, 110 insertions(+), 56 deletions(-) diff --git a/proto/desmos/profiles/v1beta1/models_chain_links.proto b/proto/desmos/profiles/v1beta1/models_chain_links.proto index 5c30455ed5..d363a1fbfc 100644 --- a/proto/desmos/profiles/v1beta1/models_chain_links.proto +++ b/proto/desmos/profiles/v1beta1/models_chain_links.proto @@ -105,4 +105,7 @@ message HexAddress { // Value represents the hex address value string value = 1 [ (gogoproto.moretags) = "yaml:\"value\"" ]; + + // Prefix represents the prefix of the Eth address + string prefix = 2 [ (gogoproto.moretags) = "yaml:\"prefix\"" ]; } \ No newline at end of file diff --git a/x/profiles/types/models_chain_links.go b/x/profiles/types/models_chain_links.go index 560880bf0a..80c74730bf 100644 --- a/x/profiles/types/models_chain_links.go +++ b/x/profiles/types/models_chain_links.go @@ -207,8 +207,8 @@ func (b Base58Address) VerifyPubKey(key cryptotypes.PubKey) (bool, error) { var _ AddressData = &HexAddress{} // NewHexAddress returns a new HexAddress instance -func NewHexAddress(value string) *HexAddress { - return &HexAddress{Value: value} +func NewHexAddress(value, prefix string) *HexAddress { + return &HexAddress{Value: value, Prefix: prefix} } // Validate implements AddressData @@ -217,13 +217,16 @@ func (h HexAddress) Validate() error { return fmt.Errorf("value cannot be empty or blank") } - if len(h.Value) <= 2 { + if len(h.Value) <= len(h.Prefix) { return fmt.Errorf("address cannot be smaller than prefix") } - prefix, addrWithoutPrefix := h.Value[:2], h.Value[2:] - if prefix != "0x" { - return fmt.Errorf("address prefix does not match the 0x prefix") + prefix, addrWithoutPrefix := h.Value[:len(h.Prefix)], h.Value[len(h.Prefix):] + if prefix != h.Prefix { + return fmt.Errorf("prefix does not match") + } + if len(h.Value) <= len(h.Prefix) { + return fmt.Errorf("address cannot be smaller than prefix") } if _, err := hex.DecodeString(addrWithoutPrefix); err != nil { @@ -239,7 +242,7 @@ func (h HexAddress) GetValue() string { // VerifyPubKey implements AddressData func (h HexAddress) VerifyPubKey(key cryptotypes.PubKey) (bool, error) { - addr := h.Value[2:] + addr := h.Value[len(h.Prefix):] bz, err := hex.DecodeString(addr) if err != nil { return false, err diff --git a/x/profiles/types/models_chain_links.pb.go b/x/profiles/types/models_chain_links.pb.go index 0ddaa8abed..9f170e1f02 100644 --- a/x/profiles/types/models_chain_links.pb.go +++ b/x/profiles/types/models_chain_links.pb.go @@ -246,6 +246,8 @@ var xxx_messageInfo_Base58Address proto.InternalMessageInfo type HexAddress struct { // Value represents the hex address value Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty" yaml:"value"` + // Prefix represents the prefix of the Eth address + Prefix string `protobuf:"bytes,2,opt,name=prefix,proto3" json:"prefix,omitempty" yaml:"prefix"` } func (m *HexAddress) Reset() { *m = HexAddress{} } @@ -296,46 +298,46 @@ func init() { var fileDescriptor_1c1946212735e419 = []byte{ // 633 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x3f, 0x6f, 0xd3, 0x40, - 0x14, 0x8f, 0x69, 0xd3, 0x2a, 0x97, 0x04, 0x5a, 0x13, 0x44, 0x68, 0x25, 0x5f, 0x39, 0x10, 0x2a, - 0x43, 0x6d, 0x9a, 0x82, 0x84, 0x3a, 0x51, 0x97, 0x01, 0x51, 0x06, 0x6a, 0x75, 0x62, 0x89, 0xce, - 0xce, 0xc5, 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x7d, 0x15, 0x6b, 0x21, 0x76, 0x59, 0x79, 0xb6, 0x0e, 0x7b, 0xd6, 0x68, - 0xf2, 0x1f, 0xe3, 0xe3, 0x84, 0x30, 0x77, 0x4e, 0x2e, 0xc6, 0xc6, 0xef, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x12, 0x59, 0x8b, 0x41, 0xe7, 0x04, 0x00, 0x00, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x54, 0xbd, 0x6e, 0xd3, 0x40, + 0x1c, 0x8f, 0x69, 0xd3, 0x2a, 0x97, 0x04, 0x5a, 0x13, 0x44, 0x68, 0x25, 0x5f, 0x39, 0x10, 0x2a, + 0x43, 0x6d, 0x9a, 0x82, 0x84, 0x3a, 0x51, 0x97, 0x01, 0x51, 0x06, 0xb0, 0x3a, 0xb1, 0x44, 0x67, + 0xe7, 0xe2, 0x5a, 0xb5, 0x7d, 0x96, 0xef, 0x5c, 0x25, 0x12, 0x12, 0x2b, 0x63, 0x47, 0xc6, 0x4e, + 0x3c, 0x01, 0x4f, 0xc0, 0x54, 0x31, 0x55, 0x4c, 0x4c, 0x06, 0xb5, 0x0b, 0xb3, 0x9f, 0x00, 0xdd, + 0x9d, 0xdd, 0x84, 0x56, 0x45, 0x62, 0x62, 0xbb, 0xfb, 0xff, 0x3e, 0xee, 0xff, 0x65, 0x83, 0x47, + 0x03, 0xc2, 0x22, 0xca, 0xac, 0x24, 0xa5, 0xc3, 0x20, 0x24, 0xcc, 0x3a, 0x58, 0x77, 0x09, 0xc7, + 0xeb, 0x56, 0x44, 0x07, 0x24, 0x64, 0x7d, 0x6f, 0x0f, 0x07, 0x71, 0x3f, 0x0c, 0xe2, 0x7d, 0x66, + 0x26, 0x29, 0xe5, 0x54, 0xbf, 0xad, 0x14, 0x66, 0xa5, 0x30, 0x4b, 0xc5, 0x52, 0xc7, 0xa7, 0x3e, + 0x95, 0x1c, 0x4b, 0x9c, 0x14,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x73, 0x49, 0x4a, 0x86, 0xc1, 0xa8, 0xcc, 0x76, 0xb1, 0xc8, 0x61, 0xbb, 0xda, 0x1f, + 0x11, 0x17, 0xb5, 0xc9, 0xc3, 0xe6, 0xf2, 0xf4, 0x8b, 0xdf, 0xfe, 0xdc, 0x59, 0xb4, 0x0b, 0xda, + 0x36, 0x66, 0xe4, 0xc9, 0xd3, 0x7f, 0x4c, 0xe0, 0xef, 0xae, 0xef, 0x00, 0x78, 0x41, 0x46, 0xff, + 0xa9, 0x26, 0x7b, 0xe7, 0xf8, 0xd4, 0xd0, 0x4e, 0x4e, 0x0d, 0xed, 0xe7, 0xa9, 0xa1, 0x1d, 0x9e, + 0x19, 0xb5, 0x93, 0x33, 0xa3, 0xf6, 0xfd, 0xcc, 0xa8, 0xbd, 0x5d, 0xf7, 0x03, 0xbe, 0x97, 0xb9, + 0xa6, 0x47, 0x23, 0x4b, 0x7d, 0x40, 0x6b, 0x21, 0x76, 0x59, 0x79, 0xb6, 0x0e, 0x7a, 0xd6, 0x68, + 0xf2, 0xcb, 0xe3, 0xe3, 0x84, 0x30, 0x77, 0x4e, 0xee, 0xd0, 0xc6, 0xef, 0x00, 0x00, 0x00, 0xff, + 0xff, 0xc6, 0xc7, 0xe8, 0x24, 0x12, 0x05, 0x00, 0x00, } func (this *ChainLink) Equal(that interface{}) bool { @@ -501,6 +503,9 @@ func (this *HexAddress) Equal(that interface{}) bool { if this.Value != that1.Value { return false } + if this.Prefix != that1.Prefix { + return false + } return true } func (m *ChainLink) Marshal() (dAtA []byte, err error) { @@ -739,6 +744,13 @@ func (m *HexAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.Prefix) > 0 { + i -= len(m.Prefix) + copy(dAtA[i:], m.Prefix) + i = encodeVarintModelsChainLinks(dAtA, i, uint64(len(m.Prefix))) + i-- + dAtA[i] = 0x12 + } if len(m.Value) > 0 { i -= len(m.Value) copy(dAtA[i:], m.Value) @@ -857,6 +869,10 @@ func (m *HexAddress) Size() (n int) { if l > 0 { n += 1 + l + sovModelsChainLinks(uint64(l)) } + l = len(m.Prefix) + if l > 0 { + n += 1 + l + sovModelsChainLinks(uint64(l)) + } return n } @@ -1572,6 +1588,38 @@ func (m *HexAddress) Unmarshal(dAtA []byte) error { } m.Value = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Prefix", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowModelsChainLinks + } + 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 ErrInvalidLengthModelsChainLinks + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthModelsChainLinks + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Prefix = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipModelsChainLinks(dAtA[iNdEx:]) diff --git a/x/profiles/types/models_chain_links_test.go b/x/profiles/types/models_chain_links_test.go index 51bdb3b9ec..41bd150bef 100644 --- a/x/profiles/types/models_chain_links_test.go +++ b/x/profiles/types/models_chain_links_test.go @@ -191,7 +191,7 @@ func TestProof_Verify(t *testing.T) { { name: "wrong Hex address returns error", proof: types.NewProof(hexPubKey, hexSigHex, hex.EncodeToString([]byte(plainText))), - addressData: types.NewHexAddress("0xcdAFfbFd8c131464fEE561e3d9b585141e403719"), + addressData: types.NewHexAddress("0xcdAFfbFd8c131464fEE561e3d9b585141e403719", "0x"), shouldErr: true, }, { @@ -209,7 +209,7 @@ func TestProof_Verify(t *testing.T) { { name: "correct proof with Hex address returns no error", proof: types.NewProof(hexPubKey, hexSigHex, hex.EncodeToString([]byte(plainText))), - addressData: types.NewHexAddress(hexAddr), + addressData: types.NewHexAddress(hexAddr, "0x"), shouldErr: false, }, } @@ -337,32 +337,32 @@ func TestHexAddress_Validate(t *testing.T) { }{ { name: "empty address returns error", - address: types.NewHexAddress(""), + address: types.NewHexAddress("", ""), shouldErr: true, }, { name: "address smaller than prefix length returns error", - address: types.NewHexAddress("0"), + address: types.NewHexAddress("0", "0x"), shouldErr: true, }, { name: "prefix does not match returns error", - address: types.NewHexAddress("0184"), + address: types.NewHexAddress("0184", "0x"), shouldErr: true, }, { name: "invalid address returns error", - address: types.NewHexAddress("0OiIjJ"), + address: types.NewHexAddress("0x0OiIjJ", "0x"), shouldErr: true, }, { name: "spaced address returns error", - address: types.NewHexAddress("0x 941991947B6eC9F5537bcaC30C1295E8154Df4cC"), + address: types.NewHexAddress("0x 941991947B6eC9F5537bcaC30C1295E8154Df4cC", "0x"), shouldErr: true, }, { name: "valid address returns no error", - address: types.NewHexAddress("0x941991947B6eC9F5537bcaC30C1295E8154Df4cC"), + address: types.NewHexAddress("0x941991947B6eC9F5537bcaC30C1295E8154Df4cC", "0x"), shouldErr: false, }, } @@ -382,7 +382,7 @@ func TestHexAddress_Validate(t *testing.T) { } func TestHexAddress_GetValue(t *testing.T) { - data := types.NewHexAddress("0x941991947B6eC9F5537bcaC30C1295E8154Df4cC") + data := types.NewHexAddress("0x941991947B6eC9F5537bcaC30C1295E8154Df4cC", "0x") require.Equal(t, "0x941991947B6eC9F5537bcaC30C1295E8154Df4cC", data.GetValue()) } From fd395d81f12465e669b608f3526e004827c2ea99 Mon Sep 17 00:00:00 2001 From: Paul Date: Mon, 20 Dec 2021 12:51:46 +0800 Subject: [PATCH 34/38] Remove duplicated checking --- x/profiles/types/models_chain_links.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/x/profiles/types/models_chain_links.go b/x/profiles/types/models_chain_links.go index 80c74730bf..66f6df9d44 100644 --- a/x/profiles/types/models_chain_links.go +++ b/x/profiles/types/models_chain_links.go @@ -225,9 +225,6 @@ func (h HexAddress) Validate() error { if prefix != h.Prefix { return fmt.Errorf("prefix does not match") } - if len(h.Value) <= len(h.Prefix) { - return fmt.Errorf("address cannot be smaller than prefix") - } if _, err := hex.DecodeString(addrWithoutPrefix); err != nil { return fmt.Errorf("invalid hex address") From 1dc6deae98e7f6a9c7f205c5aea582ef241db8f5 Mon Sep 17 00:00:00 2001 From: Paul Date: Mon, 20 Dec 2021 16:22:13 +0800 Subject: [PATCH 35/38] Update x/profiles/types/models_chain_links_test.go Co-authored-by: Riccardo Montagnin --- x/profiles/types/models_chain_links_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/profiles/types/models_chain_links_test.go b/x/profiles/types/models_chain_links_test.go index 41bd150bef..ff539340a1 100644 --- a/x/profiles/types/models_chain_links_test.go +++ b/x/profiles/types/models_chain_links_test.go @@ -341,7 +341,7 @@ func TestHexAddress_Validate(t *testing.T) { shouldErr: true, }, { - name: "address smaller than prefix length returns error", + name: "address value shorter than prefix returns error", address: types.NewHexAddress("0", "0x"), shouldErr: true, }, From be63ecbcf9cecfcc25fa13dffe947c6e801c4118 Mon Sep 17 00:00:00 2001 From: Paul Date: Mon, 20 Dec 2021 16:22:19 +0800 Subject: [PATCH 36/38] Update proto/desmos/profiles/v1beta1/models_chain_links.proto Co-authored-by: Riccardo Montagnin --- proto/desmos/profiles/v1beta1/models_chain_links.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/desmos/profiles/v1beta1/models_chain_links.proto b/proto/desmos/profiles/v1beta1/models_chain_links.proto index d363a1fbfc..d6579bd58c 100644 --- a/proto/desmos/profiles/v1beta1/models_chain_links.proto +++ b/proto/desmos/profiles/v1beta1/models_chain_links.proto @@ -106,6 +106,6 @@ message HexAddress { // Value represents the hex address value string value = 1 [ (gogoproto.moretags) = "yaml:\"value\"" ]; - // Prefix represents the prefix of the Eth address + // Prefix represents the optional prefix used during address encoding (e.g. 0x) string prefix = 2 [ (gogoproto.moretags) = "yaml:\"prefix\"" ]; } \ No newline at end of file From ee6bb4b4bf3abdfbad1341de48e79f1ef88bc93e Mon Sep 17 00:00:00 2001 From: Paul Date: Mon, 20 Dec 2021 16:22:26 +0800 Subject: [PATCH 37/38] Update x/profiles/types/models_chain_links_test.go Co-authored-by: Riccardo Montagnin --- x/profiles/types/models_chain_links_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/profiles/types/models_chain_links_test.go b/x/profiles/types/models_chain_links_test.go index ff539340a1..c532077c0f 100644 --- a/x/profiles/types/models_chain_links_test.go +++ b/x/profiles/types/models_chain_links_test.go @@ -346,7 +346,7 @@ func TestHexAddress_Validate(t *testing.T) { shouldErr: true, }, { - name: "prefix does not match returns error", + name: "not matching prefix returns error", address: types.NewHexAddress("0184", "0x"), shouldErr: true, }, From 60f40f5ed5445e0395cd1bdee1ff6b5697f29aa0 Mon Sep 17 00:00:00 2001 From: Paul Date: Mon, 20 Dec 2021 16:27:54 +0800 Subject: [PATCH 38/38] Apply suggestions --- x/profiles/types/models_chain_links_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/profiles/types/models_chain_links_test.go b/x/profiles/types/models_chain_links_test.go index c532077c0f..e697189695 100644 --- a/x/profiles/types/models_chain_links_test.go +++ b/x/profiles/types/models_chain_links_test.go @@ -336,8 +336,8 @@ func TestHexAddress_Validate(t *testing.T) { shouldErr bool }{ { - name: "empty address returns error", - address: types.NewHexAddress("", ""), + name: "empty and blank address returns error", + address: types.NewHexAddress(" ", ""), shouldErr: true, }, {