diff --git a/common/common.pb.go b/common/common.pb.go index 683a844041..4277cc8dc6 100644 --- a/common/common.pb.go +++ b/common/common.pb.go @@ -11,6 +11,7 @@ import ( _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/gogo/protobuf/proto" + ethereum "github.com/zeta-chain/zetacore/common/ethereum" ) // Reference imports to suppress errors if they are not otherwise used. @@ -255,48 +256,284 @@ func (m *Chain) GetChainId() int64 { return 0 } +type BlockHeader struct { + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"` + ParentHash []byte `protobuf:"bytes,3,opt,name=parent_hash,json=parentHash,proto3" json:"parent_hash,omitempty"` + ChainId int64 `protobuf:"varint,4,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + // chain specific header + Header HeaderData `protobuf:"bytes,5,opt,name=header,proto3" json:"header"` +} + +func (m *BlockHeader) Reset() { *m = BlockHeader{} } +func (m *BlockHeader) String() string { return proto.CompactTextString(m) } +func (*BlockHeader) ProtoMessage() {} +func (*BlockHeader) Descriptor() ([]byte, []int) { + return fileDescriptor_8f954d82c0b891f6, []int{2} +} +func (m *BlockHeader) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BlockHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BlockHeader.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 *BlockHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlockHeader.Merge(m, src) +} +func (m *BlockHeader) XXX_Size() int { + return m.Size() +} +func (m *BlockHeader) XXX_DiscardUnknown() { + xxx_messageInfo_BlockHeader.DiscardUnknown(m) +} + +var xxx_messageInfo_BlockHeader proto.InternalMessageInfo + +func (m *BlockHeader) GetHeight() int64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *BlockHeader) GetHash() []byte { + if m != nil { + return m.Hash + } + return nil +} + +func (m *BlockHeader) GetParentHash() []byte { + if m != nil { + return m.ParentHash + } + return nil +} + +func (m *BlockHeader) GetChainId() int64 { + if m != nil { + return m.ChainId + } + return 0 +} + +func (m *BlockHeader) GetHeader() HeaderData { + if m != nil { + return m.Header + } + return HeaderData{} +} + +type HeaderData struct { + // Types that are valid to be assigned to Data: + // + // *HeaderData_EthereumHeader + Data isHeaderData_Data `protobuf_oneof:"data"` +} + +func (m *HeaderData) Reset() { *m = HeaderData{} } +func (m *HeaderData) String() string { return proto.CompactTextString(m) } +func (*HeaderData) ProtoMessage() {} +func (*HeaderData) Descriptor() ([]byte, []int) { + return fileDescriptor_8f954d82c0b891f6, []int{3} +} +func (m *HeaderData) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HeaderData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HeaderData.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 *HeaderData) XXX_Merge(src proto.Message) { + xxx_messageInfo_HeaderData.Merge(m, src) +} +func (m *HeaderData) XXX_Size() int { + return m.Size() +} +func (m *HeaderData) XXX_DiscardUnknown() { + xxx_messageInfo_HeaderData.DiscardUnknown(m) +} + +var xxx_messageInfo_HeaderData proto.InternalMessageInfo + +type isHeaderData_Data interface { + isHeaderData_Data() + MarshalTo([]byte) (int, error) + Size() int +} + +type HeaderData_EthereumHeader struct { + EthereumHeader []byte `protobuf:"bytes,1,opt,name=ethereum_header,json=ethereumHeader,proto3,oneof" json:"ethereum_header,omitempty"` +} + +func (*HeaderData_EthereumHeader) isHeaderData_Data() {} + +func (m *HeaderData) GetData() isHeaderData_Data { + if m != nil { + return m.Data + } + return nil +} + +func (m *HeaderData) GetEthereumHeader() []byte { + if x, ok := m.GetData().(*HeaderData_EthereumHeader); ok { + return x.EthereumHeader + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*HeaderData) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*HeaderData_EthereumHeader)(nil), + } +} + +type Proof struct { + // Types that are valid to be assigned to Proof: + // + // *Proof_EthereumProof + Proof isProof_Proof `protobuf_oneof:"proof"` +} + +func (m *Proof) Reset() { *m = Proof{} } +func (m *Proof) String() string { return proto.CompactTextString(m) } +func (*Proof) ProtoMessage() {} +func (*Proof) Descriptor() ([]byte, []int) { + return fileDescriptor_8f954d82c0b891f6, []int{4} +} +func (m *Proof) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Proof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Proof.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 *Proof) XXX_Merge(src proto.Message) { + xxx_messageInfo_Proof.Merge(m, src) +} +func (m *Proof) XXX_Size() int { + return m.Size() +} +func (m *Proof) XXX_DiscardUnknown() { + xxx_messageInfo_Proof.DiscardUnknown(m) +} + +var xxx_messageInfo_Proof proto.InternalMessageInfo + +type isProof_Proof interface { + isProof_Proof() + MarshalTo([]byte) (int, error) + Size() int +} + +type Proof_EthereumProof struct { + EthereumProof *ethereum.Proof `protobuf:"bytes,1,opt,name=ethereum_proof,json=ethereumProof,proto3,oneof" json:"ethereum_proof,omitempty"` +} + +func (*Proof_EthereumProof) isProof_Proof() {} + +func (m *Proof) GetProof() isProof_Proof { + if m != nil { + return m.Proof + } + return nil +} + +func (m *Proof) GetEthereumProof() *ethereum.Proof { + if x, ok := m.GetProof().(*Proof_EthereumProof); ok { + return x.EthereumProof + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*Proof) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*Proof_EthereumProof)(nil), + } +} + func init() { proto.RegisterEnum("common.ReceiveStatus", ReceiveStatus_name, ReceiveStatus_value) proto.RegisterEnum("common.CoinType", CoinType_name, CoinType_value) proto.RegisterEnum("common.ChainName", ChainName_name, ChainName_value) proto.RegisterType((*PubKeySet)(nil), "common.PubKeySet") proto.RegisterType((*Chain)(nil), "common.Chain") + proto.RegisterType((*BlockHeader)(nil), "common.BlockHeader") + proto.RegisterType((*HeaderData)(nil), "common.HeaderData") + proto.RegisterType((*Proof)(nil), "common.Proof") } func init() { proto.RegisterFile("common/common.proto", fileDescriptor_8f954d82c0b891f6) } var fileDescriptor_8f954d82c0b891f6 = []byte{ - // 476 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x92, 0x41, 0x8b, 0xd3, 0x40, - 0x14, 0xc7, 0x93, 0x76, 0x9b, 0x34, 0xaf, 0x6b, 0x3b, 0xce, 0x0a, 0xae, 0x7b, 0xc8, 0xca, 0xa2, - 0x20, 0x0b, 0x6e, 0x77, 0x2b, 0x55, 0xc4, 0x83, 0xb0, 0x41, 0x45, 0x04, 0x91, 0x74, 0x4f, 0x7b, - 0x29, 0x93, 0xc9, 0x23, 0x09, 0x26, 0x99, 0x90, 0x4c, 0x84, 0xfa, 0x29, 0xfc, 0x0a, 0x82, 0x07, - 0x3f, 0x8a, 0xc7, 0x3d, 0x7a, 0x5a, 0xa4, 0xfd, 0x16, 0x9e, 0x64, 0x26, 0x4d, 0xea, 0x29, 0x6f, - 0x7e, 0xf3, 0x7b, 0xf3, 0xfe, 0x64, 0x06, 0x0e, 0xb8, 0xc8, 0x32, 0x91, 0x4f, 0x9b, 0xcf, 0x59, - 0x51, 0x0a, 0x29, 0xa8, 0xd5, 0xac, 0x8e, 0xee, 0x45, 0x22, 0x12, 0x1a, 0x4d, 0x55, 0xd5, 0xec, - 0x9e, 0xc4, 0xe0, 0x7c, 0xaa, 0x83, 0x0f, 0xb8, 0x5a, 0x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 0x3c, 0xcc, - 0x0a, 0xb9, 0x22, 0x06, 0x9d, 0xc0, 0x08, 0x65, 0xbc, 0xcc, 0x58, 0x92, 0xe7, 0x28, 0x89, 0x49, - 0x09, 0xec, 0x7f, 0x45, 0xc9, 0x3a, 0xd2, 0x53, 0x4a, 0x20, 0x79, 0x07, 0xfa, 0xf4, 0x00, 0x26, - 0x85, 0x48, 0x57, 0x91, 0xc8, 0x3b, 0xb8, 0xa7, 0xad, 0x6a, 0x67, 0x0d, 0x28, 0x85, 0x71, 0x24, - 0xb0, 0x4c, 0x93, 0xa5, 0xc4, 0x4a, 0x2a, 0x66, 0x29, 0x96, 0xd5, 0x59, 0xc0, 0x76, 0xcc, 0x56, - 0xa7, 0x45, 0x2c, 0x67, 0x3c, 0xc6, 0x0e, 0x0e, 0x95, 0x18, 0x30, 0x11, 0xb0, 0xa0, 0x63, 0x4e, - 0x3b, 0xa1, 0x05, 0xd0, 0x45, 0x6d, 0xc9, 0xa8, 0x8d, 0xda, 0x82, 0x7d, 0x7d, 0x78, 0x13, 0x22, - 0x15, 0x9c, 0xa5, 0x0a, 0x8e, 0x5b, 0xab, 0xc4, 0x48, 0x89, 0x64, 0xd2, 0xfc, 0xa3, 0xcb, 0xd7, - 0xbf, 0xd6, 0xae, 0x79, 0xb3, 0x76, 0xcd, 0x3f, 0x6b, 0xd7, 0xfc, 0xb6, 0x71, 0x8d, 0x9b, 0x8d, - 0x6b, 0xfc, 0xde, 0xb8, 0xc6, 0xf5, 0xe3, 0x28, 0x91, 0x71, 0x1d, 0xa8, 0x2b, 0x9f, 0xaa, 0x89, - 0x4f, 0xf5, 0x65, 0xea, 0x92, 0x8b, 0x12, 0xb7, 0xcf, 0x37, 0xb0, 0xf4, 0x0b, 0x7d, 0xf6, 0x2f, - 0x00, 0x00, 0xff, 0xff, 0xba, 0x90, 0x73, 0x66, 0xd6, 0x02, 0x00, 0x00, + // 639 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0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 0x12, 0xa3, 0x5c, 0xb5, 0x04, 0x1d, 0xd9, 0x3c, 0x5f, + 0x62, 0xc1, 0x5c, 0xba, 0x10, 0xb0, 0x5b, 0x5a, 0x29, 0xfa, 0x42, 0x34, 0x7b, 0xf9, 0x77, 0x34, + 0x3e, 0xbd, 0x5a, 0x5b, 0xea, 0xf5, 0xda, 0x52, 0x7f, 0xad, 0x2d, 0xf5, 0xcb, 0xad, 0xa5, 0x5c, + 0xdf, 0x5a, 0xca, 0xcf, 0x5b, 0x4b, 0xb9, 0x78, 0xe0, 0x87, 0x3c, 0x58, 0x3a, 0xe2, 0x45, 0x3b, + 0x12, 0x13, 0x1f, 0xc9, 0x77, 0x51, 0x86, 0x2e, 0x4b, 0xb1, 0xf8, 0x57, 0x70, 0x34, 0xf9, 0xc3, + 0x7e, 0xfc, 0x27, 0x00, 0x00, 0xff, 0xff, 0x2e, 0x3c, 0x8a, 0x97, 0x2d, 0x04, 0x00, 0x00, } func (m *PubKeySet) Marshal() (dAtA []byte, err error) { @@ -369,6 +606,164 @@ func (m *Chain) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *BlockHeader) 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 *BlockHeader) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BlockHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCommon(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + if m.ChainId != 0 { + i = encodeVarintCommon(dAtA, i, uint64(m.ChainId)) + i-- + dAtA[i] = 0x20 + } + if len(m.ParentHash) > 0 { + i -= len(m.ParentHash) + copy(dAtA[i:], m.ParentHash) + i = encodeVarintCommon(dAtA, i, uint64(len(m.ParentHash))) + i-- + dAtA[i] = 0x1a + } + if len(m.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = encodeVarintCommon(dAtA, i, uint64(len(m.Hash))) + i-- + dAtA[i] = 0x12 + } + if m.Height != 0 { + i = encodeVarintCommon(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *HeaderData) 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 *HeaderData) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HeaderData) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Data != nil { + { + size := m.Data.Size() + i -= size + if _, err := m.Data.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + return len(dAtA) - i, nil +} + +func (m *HeaderData_EthereumHeader) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HeaderData_EthereumHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.EthereumHeader != nil { + i -= len(m.EthereumHeader) + copy(dAtA[i:], m.EthereumHeader) + i = encodeVarintCommon(dAtA, i, uint64(len(m.EthereumHeader))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} +func (m *Proof) 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 *Proof) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Proof) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Proof != nil { + { + size := m.Proof.Size() + i -= size + if _, err := m.Proof.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + return len(dAtA) - i, nil +} + +func (m *Proof_EthereumProof) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Proof_EthereumProof) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.EthereumProof != nil { + { + size, err := m.EthereumProof.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCommon(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} func encodeVarintCommon(dAtA []byte, offset int, v uint64) int { offset -= sovCommon(v) base := offset @@ -394,31 +789,307 @@ func (m *PubKeySet) Size() (n int) { if l > 0 { n += 1 + l + sovCommon(uint64(l)) } - return n -} + return n +} + +func (m *Chain) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ChainName != 0 { + n += 1 + sovCommon(uint64(m.ChainName)) + } + if m.ChainId != 0 { + n += 1 + sovCommon(uint64(m.ChainId)) + } + return n +} + +func (m *BlockHeader) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Height != 0 { + n += 1 + sovCommon(uint64(m.Height)) + } + l = len(m.Hash) + if l > 0 { + n += 1 + l + sovCommon(uint64(l)) + } + l = len(m.ParentHash) + if l > 0 { + n += 1 + l + sovCommon(uint64(l)) + } + if m.ChainId != 0 { + n += 1 + sovCommon(uint64(m.ChainId)) + } + l = m.Header.Size() + n += 1 + l + sovCommon(uint64(l)) + return n +} + +func (m *HeaderData) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Data != nil { + n += m.Data.Size() + } + return n +} + +func (m *HeaderData_EthereumHeader) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.EthereumHeader != nil { + l = len(m.EthereumHeader) + n += 1 + l + sovCommon(uint64(l)) + } + return n +} +func (m *Proof) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Proof != nil { + n += m.Proof.Size() + } + return n +} + +func (m *Proof_EthereumProof) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.EthereumProof != nil { + l = m.EthereumProof.Size() + n += 1 + l + sovCommon(uint64(l)) + } + return n +} + +func sovCommon(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozCommon(x uint64) (n int) { + return sovCommon(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *PubKeySet) 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 ErrIntOverflowCommon + } + 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: PubKeySet: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PubKeySet: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Secp256k1", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCommon + } + 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 ErrInvalidLengthCommon + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCommon + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Secp256k1 = PubKey(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ed25519", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCommon + } + 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 ErrInvalidLengthCommon + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCommon + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Ed25519 = PubKey(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCommon(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCommon + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Chain) 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 ErrIntOverflowCommon + } + 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: Chain: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Chain: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainName", wireType) + } + m.ChainName = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCommon + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ChainName |= ChainName(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + } + m.ChainId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCommon + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ChainId |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipCommon(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCommon + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } -func (m *Chain) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ChainName != 0 { - n += 1 + sovCommon(uint64(m.ChainName)) - } - if m.ChainId != 0 { - n += 1 + sovCommon(uint64(m.ChainId)) + if iNdEx > l { + return io.ErrUnexpectedEOF } - return n -} - -func sovCommon(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozCommon(x uint64) (n int) { - return sovCommon(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + return nil } -func (m *PubKeySet) Unmarshal(dAtA []byte) error { +func (m *BlockHeader) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -441,17 +1112,36 @@ func (m *PubKeySet) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: PubKeySet: wiretype end group for non-group") + return fmt.Errorf("proto: BlockHeader: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: PubKeySet: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: BlockHeader: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCommon + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Secp256k1", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowCommon @@ -461,29 +1151,31 @@ func (m *PubKeySet) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLengthCommon } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthCommon } if postIndex > l { return io.ErrUnexpectedEOF } - m.Secp256k1 = PubKey(dAtA[iNdEx:postIndex]) + m.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...) + if m.Hash == nil { + m.Hash = []byte{} + } iNdEx = postIndex - case 2: + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Ed25519", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ParentHash", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowCommon @@ -493,23 +1185,77 @@ func (m *PubKeySet) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLengthCommon } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthCommon } if postIndex > l { return io.ErrUnexpectedEOF } - m.Ed25519 = PubKey(dAtA[iNdEx:postIndex]) + m.ParentHash = append(m.ParentHash[:0], dAtA[iNdEx:postIndex]...) + if m.ParentHash == nil { + m.ParentHash = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + } + m.ChainId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCommon + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ChainId |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCommon + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCommon + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCommon + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -532,7 +1278,7 @@ func (m *PubKeySet) Unmarshal(dAtA []byte) error { } return nil } -func (m *Chain) Unmarshal(dAtA []byte) error { +func (m *HeaderData) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -555,17 +1301,17 @@ func (m *Chain) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Chain: wiretype end group for non-group") + return fmt.Errorf("proto: HeaderData: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Chain: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: HeaderData: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainName", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EthereumHeader", wireType) } - m.ChainName = 0 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowCommon @@ -575,16 +1321,80 @@ func (m *Chain) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ChainName |= ChainName(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + if byteLen < 0 { + return ErrInvalidLengthCommon } - m.ChainId = 0 + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthCommon + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := make([]byte, postIndex-iNdEx) + copy(v, dAtA[iNdEx:postIndex]) + m.Data = &HeaderData_EthereumHeader{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCommon(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCommon + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Proof) 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 ErrIntOverflowCommon + } + 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: Proof: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Proof: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EthereumProof", wireType) + } + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowCommon @@ -594,11 +1404,27 @@ func (m *Chain) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ChainId |= int64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthCommon + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCommon + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := ðereum.Proof{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Proof = &Proof_EthereumProof{v} + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipCommon(dAtA[iNdEx:]) diff --git a/common/headers.go b/common/headers.go new file mode 100644 index 0000000000..e05a3f0c18 --- /dev/null +++ b/common/headers.go @@ -0,0 +1,68 @@ +package common + +import ( + "bytes" + "encoding/hex" + "errors" + "fmt" + + ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/rlp" +) + +// NewEthereumHeader returns a new HeaderData containing an Ethereum header +func NewEthereumHeader(header []byte) HeaderData { + return HeaderData{ + Data: &HeaderData_EthereumHeader{ + EthereumHeader: header, + }, + } +} + +// ParentHash extracts the parent hash from the header +func (h HeaderData) ParentHash() ([]byte, error) { + switch data := h.Data.(type) { + case *HeaderData_EthereumHeader: + var header ethtypes.Header + if err := rlp.DecodeBytes(data.EthereumHeader, &header); err != nil { + return nil, err + } + return header.ParentHash.Bytes(), nil + default: + return nil, errors.New("unrecognized header type") + } +} + +// Validate performs a basic validation of the HeaderData +func (h HeaderData) Validate(blockHash []byte, height int64) error { + switch data := h.Data.(type) { + case *HeaderData_EthereumHeader: + return validateEthereumHeader(data.EthereumHeader, blockHash, height) + default: + return errors.New("unrecognized header type") + } +} + +// validateEthereumHeader performs a basic validation of the Ethereum header +func validateEthereumHeader(headerBytes []byte, blockHash []byte, height int64) error { + // on ethereum the block header is ~538 bytes in RLP encoding + if len(headerBytes) > 1024 { + return fmt.Errorf("header too long (%d)", len(headerBytes)) + } + + // RLP encoded block header + var header ethtypes.Header + if err := rlp.DecodeBytes(headerBytes, &header); err != nil { + return fmt.Errorf("cannot decode RLP (%s)", err) + } + if err := header.SanityCheck(); err != nil { + return fmt.Errorf("sanity check failed (%s)", err) + } + if bytes.Compare(blockHash, header.Hash().Bytes()) != 0 { + return fmt.Errorf("tx hash mismatch (%s) vs (%s)", hex.EncodeToString(blockHash), header.Hash().Hex()) + } + if height != header.Number.Int64() { + return fmt.Errorf("height mismatch (%d) vs (%d)", height, header.Number.Int64()) + } + return nil +} diff --git a/common/proof.go b/common/proof.go new file mode 100644 index 0000000000..615c39b1f5 --- /dev/null +++ b/common/proof.go @@ -0,0 +1,61 @@ +package common + +import ( + "errors" + + ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/rlp" + "github.com/zeta-chain/zetacore/common/ethereum" +) + +// ErrInvalidProof is a error type for invalid proofs embedding the underlying error +type ErrInvalidProof struct { + Err error +} + +func NewErrInvalidProof(err error) ErrInvalidProof { + return ErrInvalidProof{ + Err: err, + } +} + +func (e ErrInvalidProof) Error() string { + return e.Err.Error() +} + +// IsErrorInvalidProof returns true if the error is an ErrInvalidProof +func IsErrorInvalidProof(err error) bool { + return errors.As(err, &ErrInvalidProof{}) +} + +// NewEthereumProof returns a new Proof containing an Ethereum proof +func NewEthereumProof(proof *ethereum.Proof) *Proof { + return &Proof{ + Proof: &Proof_EthereumProof{ + EthereumProof: proof, + }, + } +} + +// Verify verifies the proof against the header +func (p Proof) Verify(headerData HeaderData, txIndex int) ([]byte, error) { + switch proof := p.Proof.(type) { + case *Proof_EthereumProof: + ethHeaderBytes := headerData.GetEthereumHeader() + if ethHeaderBytes == nil { + return nil, errors.New("can't verify ethereum proof against non-ethereum header") + } + var ethHeader ethtypes.Header + err := rlp.DecodeBytes(ethHeaderBytes, ðHeader) + if err != nil { + return nil, err + } + val, err := proof.EthereumProof.Verify(ethHeader.TxHash, txIndex) + if err != nil { + return nil, NewErrInvalidProof(err) + } + return val, nil + default: + return nil, errors.New("unrecognized proof type") + } +} diff --git a/common/proof_test.go b/common/proof_test.go new file mode 100644 index 0000000000..0615407684 --- /dev/null +++ b/common/proof_test.go @@ -0,0 +1,15 @@ +package common_test + +import ( + "errors" + "testing" + + "github.com/stretchr/testify/require" + "github.com/zeta-chain/zetacore/common" +) + +func Test_IsErrorInvalidProof(t *testing.T) { + require.False(t, common.IsErrorInvalidProof(nil)) + require.False(t, common.IsErrorInvalidProof(errors.New("foo"))) + require.True(t, common.IsErrorInvalidProof(common.NewErrInvalidProof(errors.New("foo")))) +} diff --git a/contrib/localnet/orchestrator/smoketest/test_deposit_eth.go b/contrib/localnet/orchestrator/smoketest/test_deposit_eth.go index e79b23feb5..cea789d273 100644 --- a/contrib/localnet/orchestrator/smoketest/test_deposit_eth.go +++ b/contrib/localnet/orchestrator/smoketest/test_deposit_eth.go @@ -123,7 +123,7 @@ func (sm *SmokeTest) TestDepositEtherIntoZRC20() { BlockHash: blockHash.Hex(), TxIndex: int64(txIndex), TxHash: txHash.Hex(), - Proof: txProof, + Proof: common.NewEthereumProof(txProof), ChainId: 0, }) if err != nil { diff --git a/docs/openapi/openapi.swagger.yaml b/docs/openapi/openapi.swagger.yaml index 9f41bdb20f..025b70c325 100644 --- a/docs/openapi/openapi.swagger.yaml +++ b/docs/openapi/openapi.swagger.yaml @@ -27610,7 +27610,7 @@ paths: in: query required: false type: string - - name: proof.keys + - name: proof.ethereum_proof.keys in: query required: false type: array @@ -27618,7 +27618,7 @@ paths: type: string format: byte collectionFormat: multi - - name: proof.values + - name: proof.ethereum_proof.values in: query required: false type: array @@ -50202,6 +50202,24 @@ definitions: - VOTE_OPTION_ABSTAIN: VOTE_OPTION_ABSTAIN defines an abstain vote option. - VOTE_OPTION_NO: VOTE_OPTION_NO defines a no vote option. - VOTE_OPTION_NO_WITH_VETO: VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. + commonBlockHeader: + type: object + properties: + height: + type: string + format: int64 + hash: + type: string + format: byte + parent_hash: + type: string + format: byte + chain_id: + type: string + format: int64 + header: + $ref: '#/definitions/commonHeaderData' + title: chain specific header commonChain: type: object properties: @@ -50247,6 +50265,18 @@ definitions: - Gas: Ether, BNB, Matic, Klay, BTC, etc - ERC20: ERC20 token - Cmd: not a real coin, rather a command + commonHeaderData: + type: object + properties: + ethereum_header: + type: string + format: byte + title: binary encoded headers; RLP for ethereum + commonProof: + type: object + properties: + ethereum_proof: + $ref: '#/definitions/ethereumProof' commonPubKeySet: type: object properties: @@ -50849,25 +50879,6 @@ definitions: items: type: object $ref: '#/definitions/observerNode' - observerBlockHeader: - type: object - properties: - header: - type: string - format: byte - title: binary encoded headers; RLP for ethereum - height: - type: string - format: int64 - hash: - type: string - format: byte - parentHash: - type: string - format: byte - chain_id: - type: string - format: int64 observerCoreParams: type: object properties: @@ -51047,7 +51058,7 @@ definitions: type: array items: type: object - $ref: '#/definitions/observerBlockHeader' + $ref: '#/definitions/commonBlockHeader' pagination: $ref: '#/definitions/v1beta1PageResponse' observerQueryAllNodeAccountResponse: @@ -51091,7 +51102,7 @@ definitions: type: object properties: block_header: - $ref: '#/definitions/observerBlockHeader' + $ref: '#/definitions/commonBlockHeader' observerQueryGetCoreParamsForChainResponse: type: object properties: diff --git a/docs/spec/crosschain/messages.md b/docs/spec/crosschain/messages.md index 21a3916c8d..a64c725032 100644 --- a/docs/spec/crosschain/messages.md +++ b/docs/spec/crosschain/messages.md @@ -2,10 +2,8 @@ ## MsgAddToOutTxTracker -Adds a new record to the outbound transaction tracker. - -Only the admin policy account and the observer validators are authorized to -broadcast this message. +AddToOutTxTracker adds a new record to the outbound transaction tracker. +only the admin policy account and the observer validators are authorized to broadcast this message. ```proto message MsgAddToOutTxTracker { @@ -13,7 +11,7 @@ message MsgAddToOutTxTracker { int64 chain_id = 2; uint64 nonce = 3; string tx_hash = 4; - ethereum.Proof proof = 5; + common.Proof proof = 5; string block_hash = 6; int64 tx_index = 7; } @@ -21,9 +19,8 @@ message MsgAddToOutTxTracker { ## MsgRemoveFromOutTxTracker -Removes a record from the outbound transaction tracker by chain ID and nonce. - -Only the admin policy account is authorized to broadcast this message. +RemoveFromOutTxTracker removes a record from the outbound transaction tracker by chain ID and nonce. +only the admin policy account is authorized to broadcast this message. ```proto message MsgRemoveFromOutTxTracker { diff --git a/docs/spec/observer/messages.md b/docs/spec/observer/messages.md index 4a34d7779b..2ae574f73a 100644 --- a/docs/spec/observer/messages.md +++ b/docs/spec/observer/messages.md @@ -72,15 +72,15 @@ message MsgUpdateKeygen { ## MsgAddBlockHeader -MsgAddBlockHeader handles adding a block header to the store, through majority voting of observers +AddBlockHeader handles adding a block header to the store, through majority voting of observers ```proto message MsgAddBlockHeader { string creator = 1; int64 chain_id = 2; bytes block_hash = 3; - bytes block_header = 4; - int64 height = 5; + int64 height = 4; + common.HeaderData header = 5; } ``` diff --git a/proto/common/common.proto b/proto/common/common.proto index 936d542bba..161f533034 100644 --- a/proto/common/common.proto +++ b/proto/common/common.proto @@ -1,10 +1,10 @@ syntax = "proto3"; package common; +import "common/ethereum/ethereum.proto"; //option (gogoproto.goproto_stringer_all) = false; //option (gogoproto.stringer_all) = false; //option (gogoproto.goproto_getters_all) = false; - import "gogoproto/gogo.proto"; option go_package = "github.com/zeta-chain/zetacore/common"; @@ -62,3 +62,24 @@ message Chain { ChainName chain_name = 1; int64 chain_id = 2; } + +message BlockHeader { + int64 height = 1; + bytes hash = 2; + bytes parent_hash = 3; + int64 chain_id = 4; + // chain specific header + HeaderData header = 5 [(gogoproto.nullable) = false]; +} + +message HeaderData { + oneof data { + bytes ethereum_header = 1; // binary encoded headers; RLP for ethereum + } +} + +message Proof { + oneof proof { + ethereum.Proof ethereum_proof = 1; + } +} diff --git a/proto/crosschain/tx.proto b/proto/crosschain/tx.proto index 033d2d83cd..417b899787 100644 --- a/proto/crosschain/tx.proto +++ b/proto/crosschain/tx.proto @@ -2,7 +2,6 @@ syntax = "proto3"; package zetachain.zetacore.crosschain; import "common/common.proto"; -import "common/ethereum/ethereum.proto"; import "gogoproto/gogo.proto"; option go_package = "github.com/zeta-chain/zetacore/x/crosschain/types"; @@ -27,6 +26,7 @@ message MsgUpdateTssAddress { } message MsgUpdateTssAddressResponse {} + message MsgWhitelistERC20 { string creator = 1; string erc20_address = 2; @@ -44,7 +44,7 @@ message MsgAddToOutTxTracker { int64 chain_id = 2; uint64 nonce = 3; string tx_hash = 4; - ethereum.Proof proof = 5; + common.Proof proof = 5; string block_hash = 6; int64 tx_index = 7; } diff --git a/proto/observer/headers.proto b/proto/observer/headers.proto deleted file mode 100644 index af1544c4f7..0000000000 --- a/proto/observer/headers.proto +++ /dev/null @@ -1,15 +0,0 @@ -syntax = "proto3"; -package zetachain.zetacore.observer; - -import "gogoproto/gogo.proto"; -import "observer/observer.proto"; - -option go_package = "github.com/zeta-chain/zetacore/x/observer/types"; - -message BlockHeader { - bytes header = 1; // binary encoded headers; RLP for ethereum - int64 height = 2; - bytes hash = 3; - bytes parentHash = 4; - int64 chain_id = 5; -} diff --git a/proto/observer/query.proto b/proto/observer/query.proto index a989c2c2a5..f210f5e84c 100644 --- a/proto/observer/query.proto +++ b/proto/observer/query.proto @@ -2,13 +2,11 @@ syntax = "proto3"; package zetachain.zetacore.observer; import "common/common.proto"; -import "common/ethereum/ethereum.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "observer/ballot.proto"; import "observer/blame.proto"; -import "observer/headers.proto"; import "observer/keygen.proto"; import "observer/node_account.proto"; import "observer/observer.proto"; @@ -99,9 +97,9 @@ service Query { message QueryProveRequest { uint64 chain_id = 1; string tx_hash = 2; - ethereum.Proof proof = 5; - string block_hash = 6; - int64 tx_index = 7; + common.Proof proof = 3; + string block_hash = 4; + int64 tx_index = 5; } message QueryProveResponse { @@ -218,7 +216,7 @@ message QueryAllBlockHeaderRequest { } message QueryAllBlockHeaderResponse { - repeated BlockHeader block_headers = 1; + repeated common.BlockHeader block_headers = 1; cosmos.base.query.v1beta1.PageResponse pagination = 2; } @@ -227,5 +225,5 @@ message QueryGetBlockHeaderByHashRequest { } message QueryGetBlockHeaderByHashResponse { - BlockHeader block_header = 1; + common.BlockHeader block_header = 1; } diff --git a/proto/observer/tx.proto b/proto/observer/tx.proto index 589030dc74..368af443b5 100644 --- a/proto/observer/tx.proto +++ b/proto/observer/tx.proto @@ -4,7 +4,6 @@ package zetachain.zetacore.observer; import "common/common.proto"; import "gogoproto/gogo.proto"; import "observer/blame.proto"; -import "observer/headers.proto"; import "observer/observer.proto"; import "observer/params.proto"; @@ -24,8 +23,8 @@ message MsgAddBlockHeader { string creator = 1; int64 chain_id = 2; bytes block_hash = 3; - bytes block_header = 4; - int64 height = 5; + int64 height = 4; + common.HeaderData header = 5 [(gogoproto.nullable) = false]; } message MsgAddBlockHeaderResponse {} diff --git a/rpc/apis.go b/rpc/apis.go index 3256f42d77..da130ad0a1 100644 --- a/rpc/apis.go +++ b/rpc/apis.go @@ -20,21 +20,14 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/server" - "github.com/ethereum/go-ethereum/rpc" - ethermint "github.com/evmos/ethermint/types" + rpcclient "github.com/tendermint/tendermint/rpc/jsonrpc/client" "github.com/zeta-chain/zetacore/rpc/backend" - "github.com/zeta-chain/zetacore/rpc/namespaces/ethereum/debug" "github.com/zeta-chain/zetacore/rpc/namespaces/ethereum/eth" "github.com/zeta-chain/zetacore/rpc/namespaces/ethereum/eth/filters" - "github.com/zeta-chain/zetacore/rpc/namespaces/ethereum/miner" "github.com/zeta-chain/zetacore/rpc/namespaces/ethereum/net" - "github.com/zeta-chain/zetacore/rpc/namespaces/ethereum/personal" - "github.com/zeta-chain/zetacore/rpc/namespaces/ethereum/txpool" "github.com/zeta-chain/zetacore/rpc/namespaces/ethereum/web3" - - rpcclient "github.com/tendermint/tendermint/rpc/jsonrpc/client" ) // RPC namespaces and API version @@ -47,8 +40,8 @@ const ( Web3Namespace = "web3" EthNamespace = "eth" - PersonalNamespace = "personal" NetNamespace = "net" + PersonalNamespace = "personal" TxPoolNamespace = "txpool" DebugNamespace = "debug" MinerNamespace = "miner" @@ -112,64 +105,66 @@ func init() { }, } }, - PersonalNamespace: func(ctx *server.Context, - clientCtx client.Context, - _ *rpcclient.WSClient, - allowUnprotectedTxs bool, - indexer ethermint.EVMTxIndexer, - ) []rpc.API { - evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer) - return []rpc.API{ - { - Namespace: PersonalNamespace, - Version: apiVersion, - Service: personal.NewAPI(ctx.Logger, evmBackend), - Public: false, - }, - } - }, - TxPoolNamespace: func(ctx *server.Context, _ client.Context, _ *rpcclient.WSClient, _ bool, _ ethermint.EVMTxIndexer) []rpc.API { - return []rpc.API{ - { - Namespace: TxPoolNamespace, - Version: apiVersion, - Service: txpool.NewPublicAPI(ctx.Logger), - Public: true, - }, - } - }, - DebugNamespace: func(ctx *server.Context, - clientCtx client.Context, - _ *rpcclient.WSClient, - allowUnprotectedTxs bool, - indexer ethermint.EVMTxIndexer, - ) []rpc.API { - evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer) - return []rpc.API{ - { - Namespace: DebugNamespace, - Version: apiVersion, - Service: debug.NewAPI(ctx, evmBackend), - Public: true, - }, - } - }, - MinerNamespace: func(ctx *server.Context, - clientCtx client.Context, - _ *rpcclient.WSClient, - allowUnprotectedTxs bool, - indexer ethermint.EVMTxIndexer, - ) []rpc.API { - evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer) - return []rpc.API{ - { - Namespace: MinerNamespace, - Version: apiVersion, - Service: miner.NewPrivateAPI(ctx, evmBackend), - Public: false, - }, - } - }, + // Disabled + // NOTE: Public field of API is deprecated and defined only for compatibility. + //PersonalNamespace: func(ctx *server.Context, + // clientCtx client.Context, + // _ *rpcclient.WSClient, + // allowUnprotectedTxs bool, + // indexer ethermint.EVMTxIndexer, + //) []rpc.API { + // evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer) + // return []rpc.API{ + // { + // Namespace: PersonalNamespace, + // Version: apiVersion, + // Service: personal.NewAPI(ctx.Logger, evmBackend), + // Public: false, + // }, + // } + //}, + //TxPoolNamespace: func(ctx *server.Context, _ client.Context, _ *rpcclient.WSClient, _ bool, _ ethermint.EVMTxIndexer) []rpc.API { + // return []rpc.API{ + // { + // Namespace: TxPoolNamespace, + // Version: apiVersion, + // Service: txpool.NewPublicAPI(ctx.Logger), + // Public: true, + // }, + // } + //}, + //DebugNamespace: func(ctx *server.Context, + // clientCtx client.Context, + // _ *rpcclient.WSClient, + // allowUnprotectedTxs bool, + // indexer ethermint.EVMTxIndexer, + //) []rpc.API { + // evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer) + // return []rpc.API{ + // { + // Namespace: DebugNamespace, + // Version: apiVersion, + // Service: debug.NewAPI(ctx, evmBackend), + // Public: true, + // }, + // } + //}, + //MinerNamespace: func(ctx *server.Context, + // clientCtx client.Context, + // _ *rpcclient.WSClient, + // allowUnprotectedTxs bool, + // indexer ethermint.EVMTxIndexer, + //) []rpc.API { + // evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer) + // return []rpc.API{ + // { + // Namespace: MinerNamespace, + // Version: apiVersion, + // Service: miner.NewPrivateAPI(ctx, evmBackend), + // Public: false, + // }, + // } + //}, } } diff --git a/rpc/namespaces/ethereum/debug/api.go b/rpc/namespaces/ethereum/debug/api.go index 0620b67be0..94f771ab39 100644 --- a/rpc/namespaces/ethereum/debug/api.go +++ b/rpc/namespaces/ethereum/debug/api.go @@ -27,18 +27,14 @@ import ( "sync" "time" - "github.com/davecgh/go-spew/spew" - - evmtypes "github.com/evmos/ethermint/x/evm/types" - - stderrors "github.com/pkg/errors" - "github.com/cosmos/cosmos-sdk/server" - + "github.com/davecgh/go-spew/spew" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/consensus/ethash" "github.com/ethereum/go-ethereum/rlp" + evmtypes "github.com/evmos/ethermint/x/evm/types" + stderrors "github.com/pkg/errors" "github.com/tendermint/tendermint/libs/log" "github.com/zeta-chain/zetacore/rpc/backend" rpctypes "github.com/zeta-chain/zetacore/rpc/types" diff --git a/rpc/namespaces/ethereum/eth/api.go b/rpc/namespaces/ethereum/eth/api.go index d62ddbe18c..7d05848b91 100644 --- a/rpc/namespaces/ethereum/eth/api.go +++ b/rpc/namespaces/ethereum/eth/api.go @@ -18,20 +18,14 @@ package eth import ( "context" - "github.com/ethereum/go-ethereum/signer/core/apitypes" - - "github.com/ethereum/go-ethereum/rpc" - - "github.com/tendermint/tendermint/libs/log" - "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" ethtypes "github.com/ethereum/go-ethereum/core/types" - - "github.com/zeta-chain/zetacore/rpc/backend" - + "github.com/ethereum/go-ethereum/rpc" ethermint "github.com/evmos/ethermint/types" evmtypes "github.com/evmos/ethermint/x/evm/types" + "github.com/tendermint/tendermint/libs/log" + "github.com/zeta-chain/zetacore/rpc/backend" rpctypes "github.com/zeta-chain/zetacore/rpc/types" ) @@ -67,7 +61,6 @@ type EthereumAPI interface { // Allows developers to both send ETH from one address to another, write data // on-chain, and interact with smart contracts. SendRawTransaction(data hexutil.Bytes) (common.Hash, error) - SendTransaction(args evmtypes.TransactionArgs) (common.Hash, error) // eth_sendPrivateTransaction // eth_cancel PrivateTransaction @@ -111,9 +104,7 @@ type EthereumAPI interface { // Other Syncing() (interface{}, error) Coinbase() (string, error) - Sign(address common.Address, data hexutil.Bytes) (hexutil.Bytes, error) GetTransactionLogs(txHash common.Hash) ([]*ethtypes.Log, error) - SignTypedData(address common.Address, typedData apitypes.TypedData) (hexutil.Bytes, error) FillTransaction(args evmtypes.TransactionArgs) (*rpctypes.SignTransactionResult, error) Resend(ctx context.Context, args evmtypes.TransactionArgs, gasPrice *hexutil.Big, gasLimit *hexutil.Uint64) (common.Hash, error) GetPendingTransactions() ([]*rpctypes.RPCTransaction, error) @@ -125,6 +116,11 @@ type EthereumAPI interface { // eth_getWork (on Ethereum.org) // eth_submitWork (on Ethereum.org) // eth_submitHashrate (on Ethereum.org) + + // Disabled APIs for security reasons + //SendTransaction(args evmtypes.TransactionArgs) (common.Hash, error) + //Sign(address common.Address, data hexutil.Bytes) (hexutil.Bytes, error) + //SignTypedData(address common.Address, typedData apitypes.TypedData) (hexutil.Bytes, error) } var _ EthereumAPI = (*PublicAPI)(nil) @@ -230,12 +226,6 @@ func (e *PublicAPI) SendRawTransaction(data hexutil.Bytes) (common.Hash, error) return e.backend.SendRawTransaction(data) } -// SendTransaction sends an Ethereum transaction. -func (e *PublicAPI) SendTransaction(args evmtypes.TransactionArgs) (common.Hash, error) { - e.logger.Debug("eth_sendTransaction", "args", args.String()) - return e.backend.SendTransaction(args) -} - /////////////////////////////////////////////////////////////////////////////// /// Account Information /// /////////////////////////////////////////////////////////////////////////////// @@ -416,12 +406,6 @@ func (e *PublicAPI) Coinbase() (string, error) { return ethAddr.Hex(), nil } -// Sign signs the provided data using the private key of address via Geth's signature standard. -func (e *PublicAPI) Sign(address common.Address, data hexutil.Bytes) (hexutil.Bytes, error) { - e.logger.Debug("eth_sign", "address", address.Hex(), "data", common.Bytes2Hex(data)) - return e.backend.Sign(address, data) -} - // GetTransactionLogs returns the logs given a transaction hash. func (e *PublicAPI) GetTransactionLogs(txHash common.Hash) ([]*ethtypes.Log, error) { e.logger.Debug("eth_getTransactionLogs", "hash", txHash) @@ -448,12 +432,6 @@ func (e *PublicAPI) GetTransactionLogs(txHash common.Hash) ([]*ethtypes.Log, err return backend.TxLogsFromEvents(resBlockResult.TxsResults[res.TxIndex].Events, int(res.MsgIndex)) } -// SignTypedData signs EIP-712 conformant typed data -func (e *PublicAPI) SignTypedData(address common.Address, typedData apitypes.TypedData) (hexutil.Bytes, error) { - e.logger.Debug("eth_signTypedData", "address", address.Hex(), "data", typedData) - return e.backend.SignTypedData(address, typedData) -} - // FillTransaction fills the defaults (nonce, gas, gasPrice or 1559 fields) // on a given unsigned transaction, and returns it to the caller for further // processing (signing + broadcast). @@ -527,3 +505,25 @@ func (e *PublicAPI) GetPendingTransactions() ([]*rpctypes.RPCTransaction, error) return result, nil } + +/////////////////////////////////////////////////////////////////////////////// +/// Disabled /// +/////////////////////////////////////////////////////////////////////////////// + +//// SendTransaction sends an Ethereum transaction. +//func (e *PublicAPI) SendTransaction(args evmtypes.TransactionArgs) (common.Hash, error) { +// e.logger.Debug("eth_sendTransaction", "args", args.String()) +// return e.backend.SendTransaction(args) +//} +// +//// Sign signs the provided data using the private key of address via Geth's signature standard. +//func (e *PublicAPI) Sign(address common.Address, data hexutil.Bytes) (hexutil.Bytes, error) { +// e.logger.Debug("eth_sign", "address", address.Hex(), "data", common.Bytes2Hex(data)) +// return e.backend.Sign(address, data) +//} +// +//// SignTypedData signs EIP-712 conformant typed data +//func (e *PublicAPI) SignTypedData(address common.Address, typedData apitypes.TypedData) (hexutil.Bytes, error) { +// e.logger.Debug("eth_signTypedData", "address", address.Hex(), "data", typedData) +// return e.backend.SignTypedData(address, typedData) +//} diff --git a/rpc/namespaces/ethereum/eth/filters/api.go b/rpc/namespaces/ethereum/eth/filters/api.go index f6a9135a16..0268c7217d 100644 --- a/rpc/namespaces/ethereum/eth/filters/api.go +++ b/rpc/namespaces/ethereum/eth/filters/api.go @@ -22,20 +22,16 @@ import ( "time" "github.com/cosmos/cosmos-sdk/client" - "github.com/zeta-chain/zetacore/rpc/types" - - "github.com/tendermint/tendermint/libs/log" - - coretypes "github.com/tendermint/tendermint/rpc/core/types" - rpcclient "github.com/tendermint/tendermint/rpc/jsonrpc/client" - tmtypes "github.com/tendermint/tendermint/types" - "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/eth/filters" "github.com/ethereum/go-ethereum/rpc" - evmtypes "github.com/evmos/ethermint/x/evm/types" + "github.com/tendermint/tendermint/libs/log" + coretypes "github.com/tendermint/tendermint/rpc/core/types" + rpcclient "github.com/tendermint/tendermint/rpc/jsonrpc/client" + tmtypes "github.com/tendermint/tendermint/types" + "github.com/zeta-chain/zetacore/rpc/types" ) // FilterAPI gathers diff --git a/rpc/namespaces/ethereum/eth/filters/filter_system.go b/rpc/namespaces/ethereum/eth/filters/filter_system.go index ac69cfc53d..ba203cf685 100644 --- a/rpc/namespaces/ethereum/eth/filters/filter_system.go +++ b/rpc/namespaces/ethereum/eth/filters/filter_system.go @@ -21,23 +21,19 @@ import ( "sync" "time" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/common" + ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/eth/filters" + "github.com/ethereum/go-ethereum/rpc" + evmtypes "github.com/evmos/ethermint/x/evm/types" "github.com/pkg/errors" - tmjson "github.com/tendermint/tendermint/libs/json" "github.com/tendermint/tendermint/libs/log" tmquery "github.com/tendermint/tendermint/libs/pubsub/query" coretypes "github.com/tendermint/tendermint/rpc/core/types" rpcclient "github.com/tendermint/tendermint/rpc/jsonrpc/client" tmtypes "github.com/tendermint/tendermint/types" - - "github.com/ethereum/go-ethereum/common" - ethtypes "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/eth/filters" - "github.com/ethereum/go-ethereum/rpc" - - sdk "github.com/cosmos/cosmos-sdk/types" - - evmtypes "github.com/evmos/ethermint/x/evm/types" "github.com/zeta-chain/zetacore/rpc/ethereum/pubsub" ) diff --git a/rpc/namespaces/ethereum/eth/filters/filters.go b/rpc/namespaces/ethereum/eth/filters/filters.go index 7bcb08fd75..4355182001 100644 --- a/rpc/namespaces/ethereum/eth/filters/filters.go +++ b/rpc/namespaces/ethereum/eth/filters/filters.go @@ -21,17 +21,15 @@ import ( "fmt" "math/big" - "github.com/zeta-chain/zetacore/rpc/backend" - "github.com/zeta-chain/zetacore/rpc/types" - - "github.com/pkg/errors" - "github.com/tendermint/tendermint/libs/log" - tmrpctypes "github.com/tendermint/tendermint/rpc/core/types" - "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/eth/filters" + "github.com/pkg/errors" + "github.com/tendermint/tendermint/libs/log" + tmrpctypes "github.com/tendermint/tendermint/rpc/core/types" + "github.com/zeta-chain/zetacore/rpc/backend" + "github.com/zeta-chain/zetacore/rpc/types" ) // BloomIV represents the bit indexes and value inside the bloom filter that belong diff --git a/rpc/namespaces/ethereum/miner/api.go b/rpc/namespaces/ethereum/miner/api.go index 901c567a46..9d5e8fc556 100644 --- a/rpc/namespaces/ethereum/miner/api.go +++ b/rpc/namespaces/ethereum/miner/api.go @@ -17,12 +17,9 @@ package miner import ( "github.com/cosmos/cosmos-sdk/server" - "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/tendermint/tendermint/libs/log" - "github.com/zeta-chain/zetacore/rpc/backend" ) diff --git a/rpc/namespaces/ethereum/personal/api.go b/rpc/namespaces/ethereum/personal/api.go index 49b654c8dc..fa182c4759 100644 --- a/rpc/namespaces/ethereum/personal/api.go +++ b/rpc/namespaces/ethereum/personal/api.go @@ -21,22 +21,17 @@ import ( "os" "time" - "github.com/zeta-chain/zetacore/rpc/backend" - - "github.com/evmos/ethermint/crypto/hd" - ethermint "github.com/evmos/ethermint/types" - - "github.com/tendermint/tendermint/libs/log" - "github.com/cosmos/cosmos-sdk/crypto/keyring" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/crypto" - + "github.com/evmos/ethermint/crypto/hd" + ethermint "github.com/evmos/ethermint/types" evmtypes "github.com/evmos/ethermint/x/evm/types" + "github.com/tendermint/tendermint/libs/log" + "github.com/zeta-chain/zetacore/rpc/backend" ) // PrivateAccountAPI is the personal_ prefixed set of APIs in the Web3 JSON-RPC spec. diff --git a/rpc/namespaces/ethereum/txpool/api.go b/rpc/namespaces/ethereum/txpool/api.go index e8320b6655..89fb056bde 100644 --- a/rpc/namespaces/ethereum/txpool/api.go +++ b/rpc/namespaces/ethereum/txpool/api.go @@ -16,10 +16,8 @@ package txpool import ( - "github.com/tendermint/tendermint/libs/log" - "github.com/ethereum/go-ethereum/common/hexutil" - + "github.com/tendermint/tendermint/libs/log" "github.com/zeta-chain/zetacore/rpc/types" ) diff --git a/rpc/namespaces/ethereum/web3/api.go b/rpc/namespaces/ethereum/web3/api.go index 47f522785d..46e09d9637 100644 --- a/rpc/namespaces/ethereum/web3/api.go +++ b/rpc/namespaces/ethereum/web3/api.go @@ -19,10 +19,9 @@ import ( "fmt" "runtime" - "github.com/zeta-chain/zetacore/common" - "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/crypto" + "github.com/zeta-chain/zetacore/common" ) // PublicAPI is the web3_ prefixed set of APIs in the Web3 JSON-RPC spec. diff --git a/rpc/websockets.go b/rpc/websockets.go index c76a028ea3..ba0419efcc 100644 --- a/rpc/websockets.go +++ b/rpc/websockets.go @@ -27,27 +27,28 @@ import ( "sync" "github.com/cosmos/cosmos-sdk/client" - "github.com/gorilla/mux" - "github.com/gorilla/websocket" - "github.com/pkg/errors" - "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/eth/filters" "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rpc" - + evmtypes "github.com/evmos/ethermint/x/evm/types" + "github.com/gorilla/mux" + "github.com/gorilla/websocket" + "github.com/pkg/errors" "github.com/tendermint/tendermint/libs/log" rpcclient "github.com/tendermint/tendermint/rpc/jsonrpc/client" tmtypes "github.com/tendermint/tendermint/types" - - evmtypes "github.com/evmos/ethermint/x/evm/types" "github.com/zeta-chain/zetacore/rpc/ethereum/pubsub" rpcfilters "github.com/zeta-chain/zetacore/rpc/namespaces/ethereum/eth/filters" "github.com/zeta-chain/zetacore/rpc/types" "github.com/zeta-chain/zetacore/server/config" ) +const ( + messageSizeLimit = 32 * 1024 * 1024 // 32MB +) + type WebsocketsServer interface { Start() } @@ -139,6 +140,8 @@ func (s *websocketsServer) ServeHTTP(w http.ResponseWriter, r *http.Request) { return } + conn.SetReadLimit(messageSizeLimit) + s.readLoop(&wsConn{ mux: new(sync.Mutex), conn: conn, diff --git a/testutil/keeper/mocks/crosschain/account.go b/testutil/keeper/mocks/crosschain/account.go index 9044c1009c..626900da83 100644 --- a/testutil/keeper/mocks/crosschain/account.go +++ b/testutil/keeper/mocks/crosschain/account.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.33.2. DO NOT EDIT. +// Code generated by mockery v2.33.3. DO NOT EDIT. package mocks diff --git a/testutil/keeper/mocks/crosschain/bank.go b/testutil/keeper/mocks/crosschain/bank.go index 8fef8170d5..cdf1e371ef 100644 --- a/testutil/keeper/mocks/crosschain/bank.go +++ b/testutil/keeper/mocks/crosschain/bank.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.33.2. DO NOT EDIT. +// Code generated by mockery v2.33.3. DO NOT EDIT. package mocks diff --git a/testutil/keeper/mocks/crosschain/fungible.go b/testutil/keeper/mocks/crosschain/fungible.go index 7b8b6884a3..ccd55ffa06 100644 --- a/testutil/keeper/mocks/crosschain/fungible.go +++ b/testutil/keeper/mocks/crosschain/fungible.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.33.2. DO NOT EDIT. +// Code generated by mockery v2.33.3. DO NOT EDIT. package mocks diff --git a/testutil/keeper/mocks/crosschain/observer.go b/testutil/keeper/mocks/crosschain/observer.go index 252c36e1cf..5811d9ba4d 100644 --- a/testutil/keeper/mocks/crosschain/observer.go +++ b/testutil/keeper/mocks/crosschain/observer.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.33.2. DO NOT EDIT. +// Code generated by mockery v2.33.3. DO NOT EDIT. package mocks @@ -173,18 +173,18 @@ func (_m *CrosschainObserverKeeper) GetBallot(ctx types.Context, index string) ( } // GetBlockHeader provides a mock function with given fields: ctx, hash -func (_m *CrosschainObserverKeeper) GetBlockHeader(ctx types.Context, hash []byte) (observertypes.BlockHeader, bool) { +func (_m *CrosschainObserverKeeper) GetBlockHeader(ctx types.Context, hash []byte) (common.BlockHeader, bool) { ret := _m.Called(ctx, hash) - var r0 observertypes.BlockHeader + var r0 common.BlockHeader var r1 bool - if rf, ok := ret.Get(0).(func(types.Context, []byte) (observertypes.BlockHeader, bool)); ok { + if rf, ok := ret.Get(0).(func(types.Context, []byte) (common.BlockHeader, bool)); ok { return rf(ctx, hash) } - if rf, ok := ret.Get(0).(func(types.Context, []byte) observertypes.BlockHeader); ok { + if rf, ok := ret.Get(0).(func(types.Context, []byte) common.BlockHeader); ok { r0 = rf(ctx, hash) } else { - r0 = ret.Get(0).(observertypes.BlockHeader) + r0 = ret.Get(0).(common.BlockHeader) } if rf, ok := ret.Get(1).(func(types.Context, []byte) bool); ok { diff --git a/testutil/keeper/mocks/crosschain/staking.go b/testutil/keeper/mocks/crosschain/staking.go index f35ad1190d..3027f516b1 100644 --- a/testutil/keeper/mocks/crosschain/staking.go +++ b/testutil/keeper/mocks/crosschain/staking.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.33.2. DO NOT EDIT. +// Code generated by mockery v2.33.3. DO NOT EDIT. package mocks diff --git a/testutil/keeper/mocks/fungible/account.go b/testutil/keeper/mocks/fungible/account.go index d94cae3a4f..8ca9535cad 100644 --- a/testutil/keeper/mocks/fungible/account.go +++ b/testutil/keeper/mocks/fungible/account.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.33.2. DO NOT EDIT. +// Code generated by mockery v2.33.3. DO NOT EDIT. package mocks diff --git a/testutil/keeper/mocks/fungible/bank.go b/testutil/keeper/mocks/fungible/bank.go index 3d78731354..a061b091f4 100644 --- a/testutil/keeper/mocks/fungible/bank.go +++ b/testutil/keeper/mocks/fungible/bank.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.33.2. DO NOT EDIT. +// Code generated by mockery v2.33.3. DO NOT EDIT. package mocks diff --git a/testutil/keeper/mocks/fungible/evm.go b/testutil/keeper/mocks/fungible/evm.go index 42e3917ec1..8f6884d536 100644 --- a/testutil/keeper/mocks/fungible/evm.go +++ b/testutil/keeper/mocks/fungible/evm.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.33.2. DO NOT EDIT. +// Code generated by mockery v2.33.3. DO NOT EDIT. package mocks diff --git a/testutil/keeper/mocks/fungible/observer.go b/testutil/keeper/mocks/fungible/observer.go index 3dee529922..13f419d80a 100644 --- a/testutil/keeper/mocks/fungible/observer.go +++ b/testutil/keeper/mocks/fungible/observer.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.33.2. DO NOT EDIT. +// Code generated by mockery v2.33.3. DO NOT EDIT. package mocks diff --git a/x/crosschain/keeper/keeper_out_tx_tracker.go b/x/crosschain/keeper/keeper_out_tx_tracker.go index 75b6e9cd1d..f0ed81f469 100644 --- a/x/crosschain/keeper/keeper_out_tx_tracker.go +++ b/x/crosschain/keeper/keeper_out_tx_tracker.go @@ -5,15 +5,16 @@ import ( "fmt" "strings" + cosmoserrors "cosmossdk.io/errors" + "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/query" eth "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/rlp" + "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/x/crosschain/types" - zetaObserverTypes "github.com/zeta-chain/zetacore/x/observer/types" + observertypes "github.com/zeta-chain/zetacore/x/observer/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) @@ -159,29 +160,27 @@ func (k Keeper) OutTxTracker(c context.Context, req *types.QueryGetOutTxTrackerR // Messages -// Adds a new record to the outbound transaction tracker. -// -// Only the admin policy account and the observer validators are authorized to -// broadcast this message. +// AddToOutTxTracker adds a new record to the outbound transaction tracker. +// only the admin policy account and the observer validators are authorized to broadcast this message. func (k msgServer) AddToOutTxTracker(goCtx context.Context, msg *types.MsgAddToOutTxTracker) (*types.MsgAddToOutTxTrackerResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) chain := k.zetaObserverKeeper.GetParams(ctx).GetChainFromChainID(msg.ChainId) if chain == nil { - return nil, zetaObserverTypes.ErrSupportedChains + return nil, observertypes.ErrSupportedChains } if msg.Proof == nil { // without proof, only certain accounts can send this message - adminPolicyAccount := k.zetaObserverKeeper.GetParams(ctx).GetAdminPolicyAccount(zetaObserverTypes.Policy_Type_out_tx_tracker) + adminPolicyAccount := k.zetaObserverKeeper.GetParams(ctx).GetAdminPolicyAccount(observertypes.Policy_Type_out_tx_tracker) isAdmin := msg.Creator == adminPolicyAccount isObserver, err := k.zetaObserverKeeper.IsAuthorized(ctx, msg.Creator, chain) if err != nil { ctx.Logger().Error("Error while checking if the account is an observer", err) - return nil, sdkerrors.Wrap(zetaObserverTypes.ErrNotAuthorized, fmt.Sprintf("error IsAuthorized %s", msg.Creator)) + return nil, cosmoserrors.Wrap(observertypes.ErrNotAuthorized, fmt.Sprintf("error IsAuthorized %s", msg.Creator)) } // Sender needs to be either the admin policy account or an observer if !(isAdmin || isObserver) { - return nil, sdkerrors.Wrap(zetaObserverTypes.ErrNotAuthorized, fmt.Sprintf("Creator %s", msg.Creator)) + return nil, cosmoserrors.Wrap(observertypes.ErrNotAuthorized, fmt.Sprintf("Creator %s", msg.Creator)) } } @@ -190,14 +189,14 @@ func (k msgServer) AddToOutTxTracker(goCtx context.Context, msg *types.MsgAddToO blockHash := eth.HexToHash(msg.BlockHash) res, found := k.zetaObserverKeeper.GetBlockHeader(ctx, blockHash.Bytes()) if !found { - return nil, sdkerrors.Wrap(zetaObserverTypes.ErrBlockHeaderNotFound, fmt.Sprintf("block header not found %s", msg.BlockHash)) + return nil, cosmoserrors.Wrap(observertypes.ErrBlockHeaderNotFound, fmt.Sprintf("block header not found %s", msg.BlockHash)) } - var header ethtypes.Header - err := rlp.DecodeBytes(res.Header, &header) - if err != nil { + + // verify and process the proof + val, err := msg.Proof.Verify(res.Header, int(msg.TxIndex)) + if err != nil && !common.IsErrorInvalidProof(err) { return nil, err } - val, err := msg.Proof.Verify(header.TxHash, int(msg.TxIndex)) if err == nil { var txx ethtypes.Transaction err = txx.UnmarshalBinary(val) @@ -272,13 +271,12 @@ func (k msgServer) AddToOutTxTracker(goCtx context.Context, msg *types.MsgAddToO return &types.MsgAddToOutTxTrackerResponse{}, nil } -// Removes a record from the outbound transaction tracker by chain ID and nonce. -// -// Only the admin policy account is authorized to broadcast this message. +// RemoveFromOutTxTracker removes a record from the outbound transaction tracker by chain ID and nonce. +// only the admin policy account is authorized to broadcast this message. func (k msgServer) RemoveFromOutTxTracker(goCtx context.Context, msg *types.MsgRemoveFromOutTxTracker) (*types.MsgRemoveFromOutTxTrackerResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - if msg.Creator != k.zetaObserverKeeper.GetParams(ctx).GetAdminPolicyAccount(zetaObserverTypes.Policy_Type_out_tx_tracker) { - return &types.MsgRemoveFromOutTxTrackerResponse{}, zetaObserverTypes.ErrNotAuthorizedPolicy + if msg.Creator != k.zetaObserverKeeper.GetParams(ctx).GetAdminPolicyAccount(observertypes.Policy_Type_out_tx_tracker) { + return &types.MsgRemoveFromOutTxTrackerResponse{}, observertypes.ErrNotAuthorizedPolicy } k.RemoveOutTxTracker(ctx, msg.ChainId, msg.Nonce) diff --git a/x/crosschain/types/expected_keepers.go b/x/crosschain/types/expected_keepers.go index 53a540c927..f6f31365b2 100644 --- a/x/crosschain/types/expected_keepers.go +++ b/x/crosschain/types/expected_keepers.go @@ -66,7 +66,7 @@ type ZetaObserverKeeper interface { IsAuthorized(ctx sdk.Context, address string, chain *common.Chain) (bool, error) FindBallot(ctx sdk.Context, index string, chain *common.Chain, observationType zetaObserverTypes.ObservationType) (ballot zetaObserverTypes.Ballot, isNew bool, err error) AddBallotToList(ctx sdk.Context, ballot zetaObserverTypes.Ballot) - GetBlockHeader(ctx sdk.Context, hash []byte) (val zetaObserverTypes.BlockHeader, found bool) + GetBlockHeader(ctx sdk.Context, hash []byte) (val common.BlockHeader, found bool) } type FungibleKeeper interface { diff --git a/x/crosschain/types/message_add_to_out_tx_tracker.go b/x/crosschain/types/message_add_to_out_tx_tracker.go index dffccbb32b..06716762a1 100644 --- a/x/crosschain/types/message_add_to_out_tx_tracker.go +++ b/x/crosschain/types/message_add_to_out_tx_tracker.go @@ -3,14 +3,22 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/zeta-chain/zetacore/common/ethereum" + "github.com/zeta-chain/zetacore/common" ) const TypeMsgAddToOutTxTracker = "AddToTracker" var _ sdk.Msg = &MsgAddToOutTxTracker{} -func NewMsgAddToOutTxTracker(creator string, chain int64, nonce uint64, txHash string, proof *ethereum.Proof, blockHash string, txIndex int64) *MsgAddToOutTxTracker { +func NewMsgAddToOutTxTracker( + creator string, + chain int64, + nonce uint64, + txHash string, + proof *common.Proof, + blockHash string, + txIndex int64, +) *MsgAddToOutTxTracker { return &MsgAddToOutTxTracker{ Creator: creator, ChainId: chain, diff --git a/x/crosschain/types/tx.pb.go b/x/crosschain/types/tx.pb.go index a27cf5db9f..f255d88bc9 100644 --- a/x/crosschain/types/tx.pb.go +++ b/x/crosschain/types/tx.pb.go @@ -15,7 +15,6 @@ import ( grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" common "github.com/zeta-chain/zetacore/common" - ethereum "github.com/zeta-chain/zetacore/common/ethereum" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -249,13 +248,13 @@ func (m *MsgWhitelistERC20Response) XXX_DiscardUnknown() { var xxx_messageInfo_MsgWhitelistERC20Response proto.InternalMessageInfo type MsgAddToOutTxTracker struct { - Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - Nonce uint64 `protobuf:"varint,3,opt,name=nonce,proto3" json:"nonce,omitempty"` - TxHash string `protobuf:"bytes,4,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"` - Proof *ethereum.Proof `protobuf:"bytes,5,opt,name=proof,proto3" json:"proof,omitempty"` - BlockHash string `protobuf:"bytes,6,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` - TxIndex int64 `protobuf:"varint,7,opt,name=tx_index,json=txIndex,proto3" json:"tx_index,omitempty"` + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + Nonce uint64 `protobuf:"varint,3,opt,name=nonce,proto3" json:"nonce,omitempty"` + TxHash string `protobuf:"bytes,4,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"` + Proof *common.Proof `protobuf:"bytes,5,opt,name=proof,proto3" json:"proof,omitempty"` + BlockHash string `protobuf:"bytes,6,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` + TxIndex int64 `protobuf:"varint,7,opt,name=tx_index,json=txIndex,proto3" json:"tx_index,omitempty"` } func (m *MsgAddToOutTxTracker) Reset() { *m = MsgAddToOutTxTracker{} } @@ -319,7 +318,7 @@ func (m *MsgAddToOutTxTracker) GetTxHash() string { return "" } -func (m *MsgAddToOutTxTracker) GetProof() *ethereum.Proof { +func (m *MsgAddToOutTxTracker) GetProof() *common.Proof { if m != nil { return m.Proof } @@ -1231,93 +1230,93 @@ func init() { func init() { proto.RegisterFile("crosschain/tx.proto", fileDescriptor_81d6d611190b7635) } var fileDescriptor_81d6d611190b7635 = []byte{ - // 1375 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0x4f, 0x6f, 0x1b, 0x45, - 0x14, 0xcf, 0x36, 0x89, 0x63, 0xbf, 0xc4, 0x69, 0x32, 0x49, 0x9b, 0xed, 0xa6, 0x75, 0xda, 0x2d, - 0x2d, 0x15, 0x6a, 0xec, 0xe2, 0x82, 0x28, 0x85, 0x03, 0x4d, 0x54, 0xd2, 0x50, 0x9c, 0x44, 0x1b, - 0x17, 0xa4, 0x5e, 0xac, 0xf5, 0xee, 0x64, 0xbd, 0x8a, 0x77, 0xc7, 0xda, 0x19, 0x47, 0x76, 0xc5, - 0x09, 0x89, 0x03, 0x37, 0x0e, 0x48, 0x20, 0xbe, 0x00, 0x5f, 0xa5, 0xdc, 0x2a, 0x4e, 0xfc, 0x91, - 0x2a, 0x68, 0xbe, 0x01, 0x9f, 0x00, 0xcd, 0x9f, 0xdd, 0x78, 0x9d, 0xd8, 0x4e, 0x82, 0x38, 0x79, - 0xde, 0x9b, 0xf7, 0xe7, 0xf7, 0xe6, 0xbd, 0x37, 0xf3, 0xd6, 0xb0, 0xe0, 0x44, 0x84, 0x52, 0xa7, - 0x61, 0xfb, 0x61, 0x89, 0x75, 0x8a, 0xad, 0x88, 0x30, 0x82, 0xae, 0xbd, 0xc0, 0xcc, 0x16, 0xbc, - 0xa2, 0x58, 0x91, 0x08, 0x17, 0x8f, 0xe4, 0x8c, 0x05, 0x87, 0x04, 0x01, 0x09, 0x4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0x91, 0xb4, 0xf1, 0xde, 0x59, 0xa4, 0x13, 0x8f, 0x3f, 0x69, 0xa0, 0x0f, 0x9c, 0x20, 0x1e, 0x8e, - 0x36, 0x39, 0x48, 0xd7, 0x58, 0x3b, 0xbf, 0x6e, 0x02, 0xee, 0x07, 0x0d, 0x96, 0x06, 0xdd, 0xed, - 0x1f, 0x9e, 0xd5, 0x7e, 0xa2, 0x6a, 0x3c, 0x3a, 0xb7, 0x6a, 0x6f, 0x85, 0xf6, 0x7d, 0xe7, 0x9d, - 0xa2, 0x42, 0xd3, 0x1a, 0xa7, 0xa9, 0xd0, 0x93, 0xbf, 0xbb, 0xd0, 0xd7, 0x1a, 0xcc, 0x1d, 0xfb, - 0xac, 0x2d, 0x8f, 0x36, 0xd7, 0xaf, 0x63, 0x3c, 0x3c, 0xbb, 0x4e, 0x0c, 0x62, 0xed, 0xe9, 0xcb, - 0x37, 0x05, 0xed, 0xd5, 0x9b, 0x82, 0xf6, 0xd7, 0x9b, 0x82, 0xf6, 0xdd, 0x61, 0x61, 0xec, 0xd5, - 0x61, 0x61, 0xec, 0xb7, 0xc3, 0xc2, 0xd8, 0xf3, 0x77, 0x7b, 0x5e, 0x30, 0x6e, 0x75, 0x55, 0xfe, - 0x03, 0x10, 0x3b, 0x28, 0x75, 0x4a, 0xbd, 0xff, 0x0b, 0xf0, 0x07, 0xad, 0x9e, 0x11, 0x5f, 0xec, - 0xf7, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xc9, 0xb3, 0x25, 0xb5, 0x32, 0x10, 0x00, 0x00, + // 1361 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0xcd, 0x6e, 0xdb, 0xc6, + 0x13, 0x37, 0x63, 0x5b, 0x96, 0xc6, 0x96, 0x63, 0xaf, 0x9d, 0x98, 0xa1, 0x13, 0x39, 0xa1, 0xff, + 0xc9, 0x3f, 0x28, 0x62, 0x29, 0x75, 0x5a, 0x34, 0x4d, 0x7b, 0x68, 0x6c, 0xa4, 0x8e, 0x9b, 0xca, + 0x0e, 0x68, 0xa5, 0x05, 0x72, 0x21, 0x28, 0x72, 0x4d, 0x11, 0x16, 0xb9, 0x02, 0x77, 0x65, 0x48, + 0x41, 0x4f, 0x05, 0x7a, 0xe8, 0xad, 0x87, 0x02, 0x2d, 0xfa, 0x02, 0x7d, 0x95, 0xf4, 0x16, 0xf4, + 0xd4, 0xf6, 0x10, 0xb4, 0xc9, 0x1b, 0xf4, 0x09, 0x8a, 0xfd, 0x20, 0x2d, 0xca, 0x96, 0x64, 0xbb, + 0xe8, 0x89, 0x3b, 0xb3, 0xf3, 0xf1, 0x9b, 0x9d, 0x99, 0xdd, 0x21, 0x2c, 0xb8, 0x31, 0xa1, 0xd4, + 0x6d, 0x38, 0x41, 0x54, 0x61, 0x9d, 0x72, 0x2b, 0x26, 0x8c, 0xa0, 0x6b, 0x2f, 0x30, 0x73, 0x04, + 0xaf, 0x2c, 0x56, 0x24, 0xc6, 0xe5, 0x23, 0x39, 0x63, 0xc1, 0x25, 0x61, 0x48, 0xa2, 0x8a, 0xfc, + 0x48, 0x1d, 0x63, 0xd1, 0x27, 0x3e, 0x11, 0xcb, 0x0a, 0x5f, 0x49, 0xae, 0xb9, 0x03, 0x0b, 0x55, + 0xea, 0x3f, 0x6b, 0x79, 0x0e, 0xc3, 0x35, 0x4a, 0x1f, 0x7a, 0x5e, 0x8c, 0x29, 0x45, 0x3a, 0x4c, + 0xb9, 0x31, 0x76, 0x18, 0x89, 0x75, 0xed, 0xba, 0x76, 0xbb, 0x60, 0x25, 0x24, 0xba, 0x06, 0xc0, + 0x28, 0xb5, 0x5b, 0xed, 0xfa, 0x01, 0xee, 0xea, 0x17, 0xc4, 0x66, 0x81, 0x51, 0xfa, 0x54, 0x30, + 0xcc, 0x6b, 0xb0, 0x7c, 0x82, 0x3d, 0x0b, 0xd3, 0x16, 0x89, 0x28, 0x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 0xac, 0xd5, 0xb1, 0x4d, 0x4a, 0x13, 0x09, 0x57, 0x9e, 0xdc, 0x16, 0xe4, 0x9c, + 0x90, 0xb4, 0x23, 0x26, 0x1f, 0xa5, 0x8d, 0xca, 0x19, 0x53, 0x6e, 0x29, 0x75, 0x1e, 0x65, 0x88, + 0x29, 0x75, 0x7c, 0x79, 0xf4, 0x05, 0x2b, 0x21, 0xd1, 0x55, 0x00, 0x7e, 0xe4, 0xaa, 0x83, 0x0b, + 0x12, 0x67, 0x10, 0xa9, 0xc6, 0xbd, 0x05, 0x17, 0x83, 0xc8, 0x56, 0x8f, 0xa3, 0xec, 0x56, 0xd9, + 0x72, 0xc5, 0x20, 0xea, 0x6d, 0xd1, 0xcc, 0x74, 0x30, 0x2d, 0x24, 0xd2, 0xe9, 0x20, 0x9b, 0xd7, + 0x99, 0x51, 0x79, 0xe5, 0xb6, 0x58, 0xc7, 0x26, 0x71, 0xe0, 0x07, 0x91, 0x5e, 0x94, 0x80, 0x58, + 0x67, 0x57, 0xd0, 0xfc, 0xfe, 0x73, 0x28, 0xc5, 0x4c, 0x9f, 0x15, 0x1b, 0x92, 0x30, 0xff, 0x07, + 0xe6, 0xe0, 0x14, 0xa7, 0x95, 0xf0, 0xad, 0x06, 0xb3, 0x55, 0xea, 0xef, 0x61, 0xb6, 0x43, 0x3c, + 0xfc, 0x04, 0x77, 0x87, 0x4d, 0x79, 0x15, 0x28, 0xc8, 0x87, 0x6f, 0x0f, 0x33, 0x51, 0x00, 0xd3, + 0xeb, 0xf3, 0xe9, 0xf0, 0xd0, 0xae, 0x3f, 0x11, 0x1b, 0xd6, 0x91, 0x0c, 0xba, 0x03, 0x88, 0xd7, + 0x37, 0x0d, 0xfc, 0x08, 0xc7, 0xb6, 0x9a, 0xcc, 0xd4, 0x95, 0x38, 0xc7, 0x28, 0xdd, 0x13, 0x1b, + 0x8a, 0x6f, 0xea, 0x70, 0x39, 0x0b, 0x25, 0x41, 0xb9, 0xfe, 0x4b, 0x01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, 0xea, 0x6d, 0x69, 0xec, 0xb7, 0xb7, 0xa5, 0xb1, 0xe7, 0xef, 0xf6, 0xbc, 0x60, 0xdc, 0xea, + 0x9a, 0xfc, 0xbf, 0x4f, 0x1c, 0x54, 0x3a, 0x95, 0xde, 0xbf, 0x7e, 0xfe, 0xa0, 0xd5, 0x73, 0xe2, + 0x7f, 0xfd, 0xde, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xd7, 0x41, 0x25, 0x03, 0x10, 0x10, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -3536,7 +3535,7 @@ func (m *MsgAddToOutTxTracker) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Proof == nil { - m.Proof = ðereum.Proof{} + m.Proof = &common.Proof{} } if err := m.Proof.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/x/observer/keeper/keeper_block_header.go b/x/observer/keeper/block_header.go similarity index 80% rename from x/observer/keeper/keeper_block_header.go rename to x/observer/keeper/block_header.go index 36fba2ff14..6bd64b34e4 100644 --- a/x/observer/keeper/keeper_block_header.go +++ b/x/observer/keeper/block_header.go @@ -6,20 +6,21 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" + "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/x/observer/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) -// SetNodeAccount set a specific nodeAccount in the store from its index -func (k Keeper) SetBlockHeader(ctx sdk.Context, header types.BlockHeader) { +// SetBlockHeader set a specific block header in the store from its index +func (k Keeper) SetBlockHeader(ctx sdk.Context, header common.BlockHeader) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.BlockHeaderKey)) b := k.cdc.MustMarshal(&header) store.Set(header.Hash, b) } -// GetNodeAccount returns a nodeAccount from its index -func (k Keeper) GetBlockHeader(ctx sdk.Context, hash []byte) (val types.BlockHeader, found bool) { +// GetBlockHeader returns a block header from its hash +func (k Keeper) GetBlockHeader(ctx sdk.Context, hash []byte) (val common.BlockHeader, found bool) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.BlockHeaderKey)) b := store.Get(hash) @@ -31,13 +32,13 @@ func (k Keeper) GetBlockHeader(ctx sdk.Context, hash []byte) (val types.BlockHea return val, true } -// RemoveNodeAccount removes a nodeAccount from the store +// RemoveBlockHeader removes a block header from the store func (k Keeper) RemoveBlockHeader(ctx sdk.Context, hash []byte) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.BlockHeaderKey)) store.Delete(hash) } -// GRPC querier for block header +// GetAllBlockHeaders queries all for block header func (k Keeper) GetAllBlockHeaders(c context.Context, req *types.QueryAllBlockHeaderRequest) (*types.QueryAllBlockHeaderResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") @@ -46,9 +47,9 @@ func (k Keeper) GetAllBlockHeaders(c context.Context, req *types.QueryAllBlockHe store := ctx.KVStore(k.storeKey) blockHeaderStore := prefix.NewStore(store, types.KeyPrefix(types.BlockHeaderKey)) - var blockHeaders []*types.BlockHeader + var blockHeaders []*common.BlockHeader pageRes, err := query.Paginate(blockHeaderStore, req.Pagination, func(key []byte, value []byte) error { - var blockHeader types.BlockHeader + var blockHeader common.BlockHeader if err := k.cdc.Unmarshal(value, &blockHeader); err != nil { return err } @@ -62,15 +63,12 @@ func (k Keeper) GetAllBlockHeaders(c context.Context, req *types.QueryAllBlockHe return &types.QueryAllBlockHeaderResponse{BlockHeaders: blockHeaders, Pagination: pageRes}, nil } +// GetBlockHeaderByHash queries block header by hash func (k Keeper) GetBlockHeaderByHash(c context.Context, req *types.QueryGetBlockHeaderByHashRequest) (*types.QueryGetBlockHeaderByHashResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } - if len(req.BlockHash) != 32 { - return nil, status.Error(codes.InvalidArgument, "invalid hash") - } - header, found := k.GetBlockHeader(sdk.UnwrapSDKContext(c), req.BlockHash) if !found { return nil, status.Error(codes.NotFound, "not found") diff --git a/x/observer/keeper/grpc_query_prove.go b/x/observer/keeper/grpc_query_prove.go index 99db2ae44a..e4880f4c2e 100644 --- a/x/observer/keeper/grpc_query_prove.go +++ b/x/observer/keeper/grpc_query_prove.go @@ -4,10 +4,11 @@ import ( "context" "fmt" + "github.com/zeta-chain/zetacore/common" + sdk "github.com/cosmos/cosmos-sdk/types" eth "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/rlp" "github.com/zeta-chain/zetacore/x/observer/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -24,14 +25,13 @@ func (k Keeper) Prove(c context.Context, req *types.QueryProveRequest) (*types.Q if !found { return nil, status.Error(codes.NotFound, "block header not found") } - var header ethtypes.Header - err := rlp.DecodeBytes(res.Header, &header) - if err != nil { - return nil, status.Error(codes.Internal, fmt.Sprintf("failed to decode header: %s", err)) - } + proven := false - val, err := req.Proof.Verify(header.TxHash, int(req.TxIndex)) + val, err := req.Proof.Verify(res.Header, int(req.TxIndex)) + if err != nil && !common.IsErrorInvalidProof(err) { + return nil, status.Error(codes.Internal, err.Error()) + } if err == nil { var txx ethtypes.Transaction err = txx.UnmarshalBinary(val) diff --git a/x/observer/keeper/msg_server_add_block_header.go b/x/observer/keeper/msg_server_add_block_header.go index caf53cffe6..8ee4ffa5cd 100644 --- a/x/observer/keeper/msg_server_add_block_header.go +++ b/x/observer/keeper/msg_server_add_block_header.go @@ -2,57 +2,64 @@ package keeper import ( "context" - "fmt" + "encoding/hex" + + cosmoserrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/x/observer/types" ) -// MsgAddBlockHeader handles adding a block header to the store, through majority voting of observers +// AddBlockHeader handles adding a block header to the store, through majority voting of observers func (k msgServer) AddBlockHeader(goCtx context.Context, msg *types.MsgAddBlockHeader) (*types.MsgAddBlockHeaderResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - observationType := types.ObservationType_InBoundTx + + // check authorization for this chain chain := common.GetChainFromChainID(msg.ChainId) ok, err := k.IsAuthorized(ctx, msg.Creator, chain) if !ok { - return nil, err + return nil, cosmoserrors.Wrap(types.ErrNotAuthorizedPolicy, err.Error()) } - ballot, _, err := k.FindBallot(ctx, msg.Digest(), chain, observationType) + // add vote to ballot + ballot, _, err := k.FindBallot(ctx, msg.Digest(), chain, types.ObservationType_InBoundTx) if err != nil { - return nil, sdkerrors.Wrap(err, "failed to find ballot") + return nil, cosmoserrors.Wrap(err, "failed to find ballot") } ballot, err = k.AddVoteToBallot(ctx, ballot, msg.Creator, types.VoteType_SuccessObservation) if err != nil { - return nil, sdkerrors.Wrap(err, "failed to add vote to ballot") + return nil, cosmoserrors.Wrap(err, "failed to add vote to ballot") } _, isFinalized := k.CheckIfFinalizingVote(ctx, ballot) if !isFinalized { return &types.MsgAddBlockHeaderResponse{}, nil } + /** + * Vote finalized, add block header to store + */ _, found := k.GetBlockHeader(ctx, msg.BlockHash) if found { - return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("block header with hash %s already exists", msg.BlockHeader)) + return nil, cosmoserrors.Wrap(types.ErrBlockAlreadyExist, hex.EncodeToString(msg.BlockHash)) } - pHash, err := msg.ParentHash() // error is checked in BasicValidation in msg; check again for extra caution + // NOTE: error is checked in BasicValidation in msg; check again for extra caution + pHash, err := msg.Header.ParentHash() if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("failed to get parent hash: %s", err.Error())) + return nil, cosmoserrors.Wrap(types.ErrNoParentHash, err.Error()) } // TODO: add check for parent block header's existence here https://github.com/zeta-chain/node/issues/1133 - bh := types.BlockHeader{ - Header: msg.BlockHeader, + bh := common.BlockHeader{ + Header: msg.Header, Height: msg.Height, Hash: msg.BlockHash, ParentHash: pHash, ChainId: msg.ChainId, } - k.SetBlockHeader(ctx, bh) + return &types.MsgAddBlockHeaderResponse{}, nil } diff --git a/x/observer/types/errors.go b/x/observer/types/errors.go index 5df4dab889..afe8422699 100644 --- a/x/observer/types/errors.go +++ b/x/observer/types/errors.go @@ -7,25 +7,26 @@ import ( ) var ( - ErrUnableToAddVote = errorsmod.Register(ModuleName, 1100, "Unable to add vote ") - ErrParamsThreshold = errorsmod.Register(ModuleName, 1101, "Threshold cannot be more than 1") - ErrSupportedChains = errorsmod.Register(ModuleName, 1102, "Err chain not supported") - ErrInvalidStatus = errorsmod.Register(ModuleName, 1103, "Invalid Voting Status") + ErrUnableToAddVote = errorsmod.Register(ModuleName, 1100, "unable to add vote ") + ErrParamsThreshold = errorsmod.Register(ModuleName, 1101, "threshold cannot be more than 1") + ErrSupportedChains = errorsmod.Register(ModuleName, 1102, "chain not supported") + ErrInvalidStatus = errorsmod.Register(ModuleName, 1103, "invalid Voting Status") - ErrObserverNotPresent = errorsmod.Register(ModuleName, 1105, "Observer for type and observation does not exist") - ErrNotValidator = errorsmod.Register(ModuleName, 1106, "User needs to be a validator before applying to become an observer") - ErrValidatorStatus = errorsmod.Register(ModuleName, 1107, "Corresponding validator needs to be bonded and not jailerd") - ErrInvalidAddress = errorsmod.Register(ModuleName, 1108, "Invalid Address") - ErrSelfDelegation = errorsmod.Register(ModuleName, 1109, "Self Delegation for operator not found") - ErrCheckObserverDelegation = errorsmod.Register(ModuleName, 1110, "Observer delegation not sufficient") - ErrNotAuthorizedPolicy = errorsmod.Register(ModuleName, 1111, "Msg Sender is not the authorized policy") - ErrCoreParamsNotSet = errorsmod.Register(ModuleName, 1112, "Core params has not been set") - ErrKeygenNotFound = errorsmod.Register(ModuleName, 1113, "Err Keygen not found, Keygen block can only be updated,New keygen cannot be set") - ErrKeygenBlockTooLow = errorsmod.Register(ModuleName, 1114, "Please set a block number at-least 10 blocks higher than the current block number") - ErrKeygenCompleted = errorsmod.Register(ModuleName, 1115, "Keygen already completed") - ErrNotAuthorized = errorsmod.Register(ModuleName, 1116, "Err not authorized") - ErrInvalidCoinType = errorsmod.Register(ModuleName, 1117, "Invalid coin type") - ErrObserverCountNegative = errorsmod.Register(ModuleName, 1118, "Observer count cannot be negative") - ErrInvalidPubKey = errorsmod.Register(ModuleName, 1119, "Invalid PubKey") - ErrBlockHeaderNotFound = errorsmod.Register(ModuleName, 1120, "Block header not found") + ErrObserverNotPresent = errorsmod.Register(ModuleName, 1105, "observer for type and observation does not exist") + ErrNotValidator = errorsmod.Register(ModuleName, 1106, "user needs to be a validator before applying to become an observer") + ErrValidatorStatus = errorsmod.Register(ModuleName, 1107, "corresponding validator needs to be bonded and not jailerd") + ErrInvalidAddress = errorsmod.Register(ModuleName, 1108, "invalid Address") + ErrSelfDelegation = errorsmod.Register(ModuleName, 1109, "self Delegation for operator not found") + ErrCheckObserverDelegation = errorsmod.Register(ModuleName, 1110, "observer delegation not sufficient") + ErrNotAuthorizedPolicy = errorsmod.Register(ModuleName, 1111, "msg Sender is not the authorized policy") + ErrCoreParamsNotSet = errorsmod.Register(ModuleName, 1112, "core params has not been set") + ErrKeygenNotFound = errorsmod.Register(ModuleName, 1113, "Keygen not found, Keygen block can only be updated,New keygen cannot be set") + ErrKeygenBlockTooLow = errorsmod.Register(ModuleName, 1114, "please set a block number at-least 10 blocks higher than the current block number") + ErrKeygenCompleted = errorsmod.Register(ModuleName, 1115, "keygen already completed") + ErrNotAuthorized = errorsmod.Register(ModuleName, 1116, "not authorized") + + ErrBlockHeaderNotFound = errorsmod.Register(ModuleName, 1117, "block header not found") + ErrUnrecognizedBlockHeader = errorsmod.Register(ModuleName, 1118, "unrecognized block header") + ErrBlockAlreadyExist = errorsmod.Register(ModuleName, 1119, "block already exists") + ErrNoParentHash = errorsmod.Register(ModuleName, 1120, "no parent hash") ) diff --git a/x/observer/types/headers.pb.go b/x/observer/types/headers.pb.go deleted file mode 100644 index 63acd00960..0000000000 --- a/x/observer/types/headers.pb.go +++ /dev/null @@ -1,500 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: observer/headers.proto - -package types - -import ( - fmt "fmt" - io "io" - math "math" - math_bits "math/bits" - - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -type BlockHeader struct { - Header []byte `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` - Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` - Hash []byte `protobuf:"bytes,3,opt,name=hash,proto3" json:"hash,omitempty"` - ParentHash []byte `protobuf:"bytes,4,opt,name=parentHash,proto3" json:"parentHash,omitempty"` - ChainId int64 `protobuf:"varint,5,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` -} - -func (m *BlockHeader) Reset() { *m = BlockHeader{} } -func (m *BlockHeader) String() string { return proto.CompactTextString(m) } -func (*BlockHeader) ProtoMessage() {} -func (*BlockHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_2b67bad3a61a5de9, []int{0} -} -func (m *BlockHeader) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *BlockHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_BlockHeader.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 *BlockHeader) XXX_Merge(src proto.Message) { - xxx_messageInfo_BlockHeader.Merge(m, src) -} -func (m *BlockHeader) XXX_Size() int { - return m.Size() -} -func (m *BlockHeader) XXX_DiscardUnknown() { - xxx_messageInfo_BlockHeader.DiscardUnknown(m) -} - -var xxx_messageInfo_BlockHeader proto.InternalMessageInfo - -func (m *BlockHeader) GetHeader() []byte { - if m != nil { - return m.Header - } - return nil -} - -func (m *BlockHeader) GetHeight() int64 { - if m != nil { - return m.Height - } - return 0 -} - -func (m *BlockHeader) GetHash() []byte { - if m != nil { - return m.Hash - } - return nil -} - -func (m *BlockHeader) GetParentHash() []byte { - if m != nil { - return m.ParentHash - } - return nil -} - -func (m *BlockHeader) GetChainId() int64 { - if m != nil { - return m.ChainId - } - return 0 -} - -func init() { - proto.RegisterType((*BlockHeader)(nil), "zetachain.zetacore.observer.BlockHeader") -} - -func init() { proto.RegisterFile("observer/headers.proto", fileDescriptor_2b67bad3a61a5de9) } - -var fileDescriptor_2b67bad3a61a5de9 = []byte{ - // 245 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xcb, 0x4f, 0x2a, 0x4e, - 0x2d, 0x2a, 0x4b, 0x2d, 0xd2, 0xcf, 0x48, 0x4d, 0x4c, 0x49, 0x2d, 0x2a, 0xd6, 0x2b, 0x28, 0xca, - 0x2f, 0xc9, 0x17, 0x92, 0xae, 0x4a, 0x2d, 0x49, 0x4c, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x03, 0xb3, - 0xf2, 0x8b, 0x52, 0xf5, 0x60, 0x4a, 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0xea, 0xf4, 0x41, - 0x2c, 0x88, 0x16, 0x29, 0x71, 0xb8, 0x51, 0x30, 0x06, 0x44, 0x42, 0xa9, 0x87, 0x91, 0x8b, 0xdb, - 0x29, 0x27, 0x3f, 0x39, 0xdb, 0x03, 0x6c, 0x85, 0x90, 0x18, 0x17, 0x1b, 0xc4, 0x32, 0x09, 0x46, - 0x05, 0x46, 0x0d, 0x9e, 0x20, 0x28, 0x0f, 0x22, 0x9e, 0x99, 0x9e, 0x51, 0x22, 0xc1, 0xa4, 0xc0, - 0xa8, 0xc1, 0x1c, 0x04, 0xe5, 0x09, 0x09, 0x71, 0xb1, 0x64, 0x24, 0x16, 0x67, 0x48, 0x30, 0x83, - 0x55, 0x83, 0xd9, 0x42, 0x72, 0x5c, 0x5c, 0x05, 0x89, 0x45, 0xa9, 0x79, 0x25, 0x1e, 0x20, 0x19, - 0x16, 0xb0, 0x0c, 0x92, 0x88, 0x90, 0x24, 0x17, 0x07, 0xd8, 0xf5, 0xf1, 0x99, 0x29, 0x12, 0xac, - 0x60, 0xd3, 0xd8, 0xc1, 0x7c, 0xcf, 0x14, 0x27, 0xcf, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, - 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, - 0x96, 0x63, 0x88, 0xd2, 0x4f, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x07, - 0xf9, 0x5a, 0x17, 0xac, 0x45, 0x1f, 0x16, 0x00, 0xfa, 0x15, 0x70, 0x9f, 0xe9, 0x97, 0x54, 0x16, - 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x3d, 0x68, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xba, 0x02, 0xb5, - 0x91, 0x46, 0x01, 0x00, 0x00, -} - -func (m *BlockHeader) 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 *BlockHeader) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BlockHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ChainId != 0 { - i = encodeVarintHeaders(dAtA, i, uint64(m.ChainId)) - i-- - dAtA[i] = 0x28 - } - if len(m.ParentHash) > 0 { - i -= len(m.ParentHash) - copy(dAtA[i:], m.ParentHash) - i = encodeVarintHeaders(dAtA, i, uint64(len(m.ParentHash))) - i-- - dAtA[i] = 0x22 - } - if len(m.Hash) > 0 { - i -= len(m.Hash) - copy(dAtA[i:], m.Hash) - i = encodeVarintHeaders(dAtA, i, uint64(len(m.Hash))) - i-- - dAtA[i] = 0x1a - } - if m.Height != 0 { - i = encodeVarintHeaders(dAtA, i, uint64(m.Height)) - i-- - dAtA[i] = 0x10 - } - if len(m.Header) > 0 { - i -= len(m.Header) - copy(dAtA[i:], m.Header) - i = encodeVarintHeaders(dAtA, i, uint64(len(m.Header))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintHeaders(dAtA []byte, offset int, v uint64) int { - offset -= sovHeaders(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *BlockHeader) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Header) - if l > 0 { - n += 1 + l + sovHeaders(uint64(l)) - } - if m.Height != 0 { - n += 1 + sovHeaders(uint64(m.Height)) - } - l = len(m.Hash) - if l > 0 { - n += 1 + l + sovHeaders(uint64(l)) - } - l = len(m.ParentHash) - if l > 0 { - n += 1 + l + sovHeaders(uint64(l)) - } - if m.ChainId != 0 { - n += 1 + sovHeaders(uint64(m.ChainId)) - } - return n -} - -func sovHeaders(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozHeaders(x uint64) (n int) { - return sovHeaders(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *BlockHeader) 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 ErrIntOverflowHeaders - } - 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: BlockHeader: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BlockHeader: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHeaders - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthHeaders - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthHeaders - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Header = append(m.Header[:0], dAtA[iNdEx:postIndex]...) - if m.Header == nil { - m.Header = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) - } - m.Height = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHeaders - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Height |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHeaders - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthHeaders - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthHeaders - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...) - if m.Hash == nil { - m.Hash = []byte{} - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ParentHash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHeaders - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthHeaders - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthHeaders - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ParentHash = append(m.ParentHash[:0], dAtA[iNdEx:postIndex]...) - if m.ParentHash == nil { - m.ParentHash = []byte{} - } - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) - } - m.ChainId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHeaders - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ChainId |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipHeaders(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthHeaders - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipHeaders(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowHeaders - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowHeaders - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowHeaders - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthHeaders - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupHeaders - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthHeaders - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthHeaders = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowHeaders = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupHeaders = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/observer/types/messages_add_block_header.go b/x/observer/types/messages_add_block_header.go index d216494393..8db4410195 100644 --- a/x/observer/types/messages_add_block_header.go +++ b/x/observer/types/messages_add_block_header.go @@ -1,13 +1,11 @@ package types import ( - "bytes" + cosmoserrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/rlp" "github.com/zeta-chain/zetacore/common" ) @@ -17,13 +15,13 @@ const ( TypeMsgAddBlockHeader = "add_block_header" ) -func NewMsgAddBlockHeader(creator string, chainID int64, blockHash []byte, height int64, header []byte) *MsgAddBlockHeader { +func NewMsgAddBlockHeader(creator string, chainID int64, blockHash []byte, height int64, header common.HeaderData) *MsgAddBlockHeader { return &MsgAddBlockHeader{ - Creator: creator, - ChainId: chainID, - BlockHash: blockHash, - Height: height, - BlockHeader: header, + Creator: creator, + ChainId: chainID, + BlockHash: blockHash, + Height: height, + Header: header, } } @@ -51,33 +49,23 @@ func (msg *MsgAddBlockHeader) GetSignBytes() []byte { func (msg *MsgAddBlockHeader) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return cosmoserrors.Wrapf(sdkerrors.ErrInvalidAddress, err.Error()) } - if len(msg.BlockHash) > 32 { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid msg.txhash; too long (%d)", len(msg.BlockHash)) - } - if len(msg.BlockHeader) > 1024 { // on ethereum the block header is ~538 bytes in RLP encoding - return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid msg.blockheader; too long (%d)", len(msg.BlockHeader)) - } if common.IsEthereum(msg.ChainId) { - // RLP encoded block header - var header types.Header - err = rlp.DecodeBytes(msg.BlockHeader, &header) - if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid block header; cannot decode RLP (%s)", err) - } - if err = header.SanityCheck(); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid block header; sanity check failed (%s)", err) - } - if bytes.Compare(msg.BlockHash, header.Hash().Bytes()) != 0 { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid block header; tx hash mismatch") - } - if msg.Height != header.Number.Int64() { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid block header; height mismatch") + if len(msg.BlockHash) > 32 { + return cosmoserrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid msg.txhash; too long (%d)", len(msg.BlockHash)) } } else { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid chain id (%d)", msg.ChainId) + return cosmoserrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid chain id (%d)", msg.ChainId) + } + + if err := msg.Header.Validate(msg.BlockHash, msg.Height); err != nil { + return cosmoserrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid block header (%s)", err) + } + + if _, err := msg.Header.ParentHash(); err != nil { + return cosmoserrors.Wrapf(sdkerrors.ErrInvalidRequest, "can't get parent hash (%s)", err) } return nil @@ -89,13 +77,3 @@ func (msg *MsgAddBlockHeader) Digest() string { hash := crypto.Keccak256Hash([]byte(m.String())) return hash.Hex() } - -func (msg *MsgAddBlockHeader) ParentHash() ([]byte, error) { - var header types.Header - err := rlp.DecodeBytes(msg.BlockHeader, &header) - if err != nil { - return nil, err - } - - return header.ParentHash.Bytes(), nil -} diff --git a/x/observer/types/query.pb.go b/x/observer/types/query.pb.go index 91ff1026cf..d1e116394d 100644 --- a/x/observer/types/query.pb.go +++ b/x/observer/types/query.pb.go @@ -15,7 +15,6 @@ import ( grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" common "github.com/zeta-chain/zetacore/common" - ethereum "github.com/zeta-chain/zetacore/common/ethereum" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -34,11 +33,11 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type QueryProveRequest struct { - ChainId uint64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - TxHash string `protobuf:"bytes,2,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"` - Proof *ethereum.Proof `protobuf:"bytes,5,opt,name=proof,proto3" json:"proof,omitempty"` - BlockHash string `protobuf:"bytes,6,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` - TxIndex int64 `protobuf:"varint,7,opt,name=tx_index,json=txIndex,proto3" json:"tx_index,omitempty"` + ChainId uint64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + TxHash string `protobuf:"bytes,2,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"` + Proof *common.Proof `protobuf:"bytes,3,opt,name=proof,proto3" json:"proof,omitempty"` + BlockHash string `protobuf:"bytes,4,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` + TxIndex int64 `protobuf:"varint,5,opt,name=tx_index,json=txIndex,proto3" json:"tx_index,omitempty"` } func (m *QueryProveRequest) Reset() { *m = QueryProveRequest{} } @@ -88,7 +87,7 @@ func (m *QueryProveRequest) GetTxHash() string { return "" } -func (m *QueryProveRequest) GetProof() *ethereum.Proof { +func (m *QueryProveRequest) GetProof() *common.Proof { if m != nil { return m.Proof } @@ -1452,8 +1451,8 @@ func (m *QueryAllBlockHeaderRequest) GetPagination() *query.PageRequest { } type QueryAllBlockHeaderResponse struct { - BlockHeaders []*BlockHeader `protobuf:"bytes,1,rep,name=block_headers,json=blockHeaders,proto3" json:"block_headers,omitempty"` - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` + BlockHeaders []*common.BlockHeader `protobuf:"bytes,1,rep,name=block_headers,json=blockHeaders,proto3" json:"block_headers,omitempty"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } func (m *QueryAllBlockHeaderResponse) Reset() { *m = QueryAllBlockHeaderResponse{} } @@ -1489,7 +1488,7 @@ func (m *QueryAllBlockHeaderResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryAllBlockHeaderResponse proto.InternalMessageInfo -func (m *QueryAllBlockHeaderResponse) GetBlockHeaders() []*BlockHeader { +func (m *QueryAllBlockHeaderResponse) GetBlockHeaders() []*common.BlockHeader { if m != nil { return m.BlockHeaders } @@ -1548,7 +1547,7 @@ func (m *QueryGetBlockHeaderByHashRequest) GetBlockHash() []byte { } type QueryGetBlockHeaderByHashResponse struct { - BlockHeader *BlockHeader `protobuf:"bytes,1,opt,name=block_header,json=blockHeader,proto3" json:"block_header,omitempty"` + BlockHeader *common.BlockHeader `protobuf:"bytes,1,opt,name=block_header,json=blockHeader,proto3" json:"block_header,omitempty"` } func (m *QueryGetBlockHeaderByHashResponse) Reset() { *m = QueryGetBlockHeaderByHashResponse{} } @@ -1584,7 +1583,7 @@ func (m *QueryGetBlockHeaderByHashResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryGetBlockHeaderByHashResponse proto.InternalMessageInfo -func (m *QueryGetBlockHeaderByHashResponse) GetBlockHeader() *BlockHeader { +func (m *QueryGetBlockHeaderByHashResponse) GetBlockHeader() *common.BlockHeader { if m != nil { return m.BlockHeader } @@ -1632,121 +1631,120 @@ func init() { func init() { proto.RegisterFile("observer/query.proto", fileDescriptor_dcb801e455adaee4) } var fileDescriptor_dcb801e455adaee4 = []byte{ - // 1823 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x59, 0xcd, 0x4f, 0x1b, 0x49, - 0x16, 0xa7, 0x21, 0x18, 0x78, 0x86, 0x00, 0x15, 0x92, 0x80, 0x01, 0xe3, 0xad, 0x2c, 0x89, 0x03, - 0x89, 0x1d, 0x1c, 0x69, 0xf3, 0x41, 0x20, 0xc2, 0x28, 0x21, 0xe4, 0x93, 0x75, 0x76, 0xb3, 0xab, - 0x95, 0x76, 0xad, 0xb6, 0x5d, 0xd8, 0x4e, 0xda, 0x5d, 0x4e, 0x77, 0x43, 0xf0, 0x46, 0x48, 0xab, - 0x3d, 0xef, 0x4a, 0x91, 0x56, 0xda, 0xbf, 0x61, 0x2e, 0x33, 0x87, 0x48, 0xa3, 0x39, 0x44, 0x73, - 0x99, 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 0xf0, 0x5f, 0xe1, - 0x44, 0x4b, 0xaf, 0x70, 0xb1, 0x01, 0x11, 0x9e, 0x34, 0xe6, 0x23, 0x9a, 0x39, 0x93, 0xea, 0xb0, - 0x21, 0x53, 0xdc, 0x38, 0x7b, 0xec, 0xed, 0xcf, 0x0b, 0x7d, 0x39, 0x61, 0x88, 0x1f, 0x40, 0x9c, - 0x79, 0xce, 0xb2, 0xed, 0x90, 0x6d, 0x6c, 0x97, 0x88, 0x6e, 0x55, 0x77, 0xab, 0xc4, 0x70, 0x52, - 0xba, 0x0c, 0x93, 0x7c, 0xaf, 0xe4, 0xab, 0xee, 0x18, 0x8b, 0x37, 0x92, 0x9b, 0xe0, 0x03, 0x4d, - 0x1b, 0x6c, 0xc1, 0xc8, 0x13, 0x6a, 0x11, 0xe3, 0x7e, 0xd5, 0xb4, 0xd0, 0x19, 0x18, 0xdb, 0xb7, - 0x1b, 0x79, 0xb5, 0x54, 0x32, 0x88, 0x69, 0x0a, 0xab, 0x51, 0xd6, 0xb9, 0xc1, 0xfb, 0x50, 0x16, - 0x46, 0xec, 0x76, 0xde, 0x6a, 0xd4, 0x09, 0x5b, 0x98, 0xe3, 0x99, 0xc5, 0x8e, 0x34, 0x6c, 0xff, - 0x7f, 0x6a, 0xd4, 0x49, 0x6e, 0x78, 0x5f, 0x7c, 0xe1, 0x2f, 0xfa, 0x61, 0x21, 0x90, 0x85, 0xc8, - 0x55, 0x2f, 0x34, 0xd0, 0x3a, 0x44, 0x18, 0x48, 0x73, 0xba, 0x3f, 0x31, 0x90, 0x8c, 0x66, 0xce, - 0x76, 0x45, 0xc4, 0x18, 0xe7, 0x84, 0x15, 0xfa, 0x0b, 0x4c, 0xf0, 0x51, 0x76, 0xf8, 0x38, 0xb7, - 0x01, 0xc6, 0xed, 0x42, 0x47, 0x4f, 0x8f, 0x9a, 0x46, 0x8c, 0xe2, 0x38, 0x6d, 0xed, 0x40, 0x0f, - 0x61, 0x4c, 0xb0, 0x30, 0x2d, 0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c, 0xeb, 0x98, 0x97, 0xa6, 0xb7, - 0x1c, 0x14, 0xdd, 0x6f, 0x3c, 0x0b, 0x33, 0xed, 0xf1, 0x9c, 0x65, 0x7a, 0x0a, 0x31, 0xbf, 0x41, - 0x01, 0xe2, 0xbe, 0x1f, 0x88, 0xe5, 0x90, 0x20, 0xd8, 0x29, 0x93, 0x81, 0x64, 0x9a, 0xb1, 0x1e, - 0xd2, 0x12, 0xd9, 0xe0, 0x97, 0x8e, 0x93, 0xb1, 0x29, 0x18, 0xe4, 0x15, 0x99, 0x6f, 0x59, 0xde, - 0xc0, 0x4f, 0x61, 0xd6, 0xd7, 0x46, 0x00, 0xbc, 0x07, 0xa3, 0xf2, 0x05, 0x26, 0x10, 0x26, 0x3b, - 0x22, 0x94, 0xfd, 0x44, 0xf5, 0x66, 0x03, 0x97, 0x04, 0xbe, 0x0d, 0x4d, 0xf3, 0xc1, 0x77, 0x1b, - 0xa0, 0x79, 0xad, 0x8b, 0x40, 0x67, 0x53, 0x5c, 0x03, 0xa4, 0x6c, 0x0d, 0x90, 0xe2, 0x72, 0x43, - 0x68, 0x80, 0xd4, 0x8e, 0x5a, 0x76, 0xae, 0xba, 0x9c, 0x64, 0x89, 0x5f, 0x2b, 0x82, 0x92, 0x37, - 0x8c, 0xa0, 0x74, 0x17, 0xa2, 0x52, 0xb7, 0xd8, 0x8a, 0x3d, 0x30, 0x92, 0x1a, 0x68, 0xab, 0x05, - 0x73, 0xbf, 0xd8, 0x43, 0xdd, 0x30, 0x73, 0x20, 0x2d, 0xa0, 0x9d, 0xf3, 0xbe, 0x45, 0xac, 0x1d, - 0xf7, 0x8e, 0xbf, 0x6d, 0x5f, 0xf1, 0xce, 0x46, 0xfa, 0x97, 0x22, 0x0e, 0xbc, 0xdf, 0x14, 0x41, - 0xed, 0xef, 0x30, 0xe1, 0x55, 0x08, 0x22, 0x91, 0x9d, 0x4b, 0xad, 0xc7, 0x9f, 0xb8, 0x16, 0xc7, - 0xeb, 0xad, 0x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, 0xce, 0x13, 0xe4, 0x10, - 0xfd, 0x47, 0x81, 0x41, 0xf6, 0x2f, 0x7d, 0x94, 0x0a, 0x21, 0xe2, 0xa5, 0x5f, 0x29, 0x62, 0xe9, - 0xd0, 0xf3, 0x05, 0x5c, 0xcc, 0xe0, 0xce, 0xa1, 0x98, 0x7f, 0xa9, 0xb4, 0xe7, 0x66, 0xb7, 0xdf, - 0xbe, 0x8f, 0x2b, 0xef, 0xde, 0xc7, 0x95, 0x5f, 0xde, 0xc7, 0x95, 0x57, 0x1f, 0xe2, 0x7d, 0xef, - 0x3e, 0xc4, 0xfb, 0x7e, 0xf8, 0x10, 0xef, 0xfb, 0x5b, 0xba, 0x5c, 0xb5, 0x2a, 0x7b, 0x85, 0x54, - 0x91, 0xd6, 0x7c, 0x6b, 0xc2, 0x41, 0xd3, 0x95, 0xd5, 0xa8, 0x13, 0xb3, 0x10, 0x61, 0x3f, 0xb1, - 0x5c, 0xfe, 0x2d, 0x00, 0x00, 0xff, 0xff, 0xc6, 0x48, 0x99, 0x25, 0xf6, 0x1a, 0x00, 0x00, + // 1800 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x59, 0xcd, 0x4f, 0x1b, 0xcf, + 0x19, 0x66, 0x21, 0x38, 0xf0, 0x1a, 0x02, 0x0c, 0xe4, 0x17, 0x30, 0x60, 0xdc, 0xa1, 0x49, 0x1c, + 0x48, 0xec, 0xe0, 0x48, 0xf9, 0x22, 0x10, 0x61, 0x94, 0x10, 0xf2, 0x49, 0x9d, 0x36, 0xad, 0x5a, + 0xb5, 0xd6, 0xda, 0x1e, 0x8c, 0x93, 0x65, 0xc7, 0xd9, 0x5d, 0x08, 0x6e, 0x84, 0x54, 0xf5, 0xdc, + 0x4a, 0x91, 0x2a, 0xf5, 0xdc, 0x53, 0x6f, 0xed, 0x21, 0x97, 0x1e, 0xa2, 0x5e, 0x7a, 0x69, 0x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 0xb1, 0x1c, 0x11, 0x04, 0xbb, 0x65, + 0x2a, 0x90, 0x5c, 0x73, 0xad, 0xa7, 0xb4, 0x42, 0x36, 0x78, 0xc9, 0x91, 0x11, 0x9b, 0x82, 0x41, + 0x9e, 0x91, 0xf9, 0x91, 0xe5, 0x0d, 0xfc, 0x12, 0x66, 0x03, 0x6d, 0x04, 0xc0, 0x47, 0x30, 0xa2, + 0x96, 0x2f, 0x81, 0x30, 0xdd, 0x11, 0xa1, 0xea, 0x27, 0x6e, 0x36, 0x1b, 0xb8, 0x22, 0xf0, 0x6d, + 0x18, 0x46, 0x00, 0xbe, 0xfb, 0x00, 0xcd, 0xe2, 0x2d, 0x16, 0xba, 0x90, 0xe1, 0x95, 0x3e, 0xe3, + 0x56, 0xfa, 0x0c, 0x17, 0x0d, 0xa2, 0xd2, 0x67, 0x76, 0xf4, 0xaa, 0x2c, 0x74, 0x05, 0xc5, 0x12, + 0xbf, 0xd7, 0x04, 0x25, 0xff, 0x32, 0x82, 0xd2, 0x43, 0x88, 0x2b, 0xdd, 0xe2, 0x28, 0xf6, 0xc0, + 0x48, 0x69, 0xa0, 0xad, 0x16, 0xcc, 0xfd, 0xe2, 0x0c, 0x75, 0xc3, 0xcc, 0x81, 0xb4, 0x80, 0x96, + 0xf7, 0x7d, 0x8b, 0x38, 0x3b, 0x5e, 0x85, 0xbf, 0xef, 0x16, 0x78, 0x79, 0x90, 0x7e, 0xa1, 0x89, + 0x0b, 0x1f, 0x34, 0x45, 0x50, 0xfb, 0x29, 0x8c, 0xfb, 0xf5, 0x81, 0x08, 0x64, 0xe7, 0x54, 0xeb, + 0xf3, 0x27, 0xca, 0xe2, 0x58, 0xbd, 0xb5, 0x1b, 0x9f, 0x83, 0xb3, 0x12, 0xc1, 0x23, 0x26, 0x75, + 0x24, 0xb6, 0x1f, 0xc0, 0x37, 0xfe, 0x01, 0x81, 0x68, 0x15, 0x62, 0x5c, 0x15, 0x45, 0xaa, 0xca, + 0xc2, 0x58, 0x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x70, 0x31, 0x83, 0x3b, + 0x87, 0x12, 0xc1, 0xa9, 0xd2, 0x9d, 0x9b, 0xdf, 0xfe, 0xf8, 0x39, 0xa9, 0x7d, 0xfa, 0x9c, 0xd4, + 0xfe, 0xf7, 0x39, 0xa9, 0xbd, 0xfb, 0x92, 0xec, 0xfb, 0xf4, 0x25, 0xd9, 0xf7, 0xaf, 0x2f, 0xc9, + 0xbe, 0x1f, 0x67, 0xab, 0x35, 0x67, 0xef, 0xa0, 0xe4, 0xbe, 0x68, 0x02, 0x73, 0xc2, 0x51, 0xd3, + 0x95, 0xd3, 0xa8, 0x13, 0xbb, 0x14, 0x63, 0x3f, 0x9b, 0x5c, 0xfb, 0x36, 0x00, 0x00, 0xff, 0xff, + 0x2e, 0xac, 0xc8, 0xff, 0x92, 0x1a, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2452,14 +2450,14 @@ func (m *QueryProveRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { if m.TxIndex != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.TxIndex)) i-- - dAtA[i] = 0x38 + dAtA[i] = 0x28 } if len(m.BlockHash) > 0 { i -= len(m.BlockHash) copy(dAtA[i:], m.BlockHash) i = encodeVarintQuery(dAtA, i, uint64(len(m.BlockHash))) i-- - dAtA[i] = 0x32 + dAtA[i] = 0x22 } if m.Proof != nil { { @@ -2471,7 +2469,7 @@ func (m *QueryProveRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x2a + dAtA[i] = 0x1a } if len(m.TxHash) > 0 { i -= len(m.TxHash) @@ -4157,7 +4155,7 @@ func (m *QueryProveRequest) Unmarshal(dAtA []byte) error { } m.TxHash = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 5: + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType) } @@ -4187,13 +4185,13 @@ func (m *QueryProveRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Proof == nil { - m.Proof = ðereum.Proof{} + m.Proof = &common.Proof{} } if err := m.Proof.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 6: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", wireType) } @@ -4225,7 +4223,7 @@ func (m *QueryProveRequest) Unmarshal(dAtA []byte) error { } m.BlockHash = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 7: + case 5: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field TxIndex", wireType) } @@ -6753,7 +6751,7 @@ func (m *QueryAllBlockHeaderResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.BlockHeaders = append(m.BlockHeaders, &BlockHeader{}) + m.BlockHeaders = append(m.BlockHeaders, &common.BlockHeader{}) if err := m.BlockHeaders[len(m.BlockHeaders)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -6958,7 +6956,7 @@ func (m *QueryGetBlockHeaderByHashResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.BlockHeader == nil { - m.BlockHeader = &BlockHeader{} + m.BlockHeader = &common.BlockHeader{} } if err := m.BlockHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/x/observer/types/tx.pb.go b/x/observer/types/tx.pb.go index 8019e5dc5a..cb6f2df8f9 100644 --- a/x/observer/types/tx.pb.go +++ b/x/observer/types/tx.pb.go @@ -13,7 +13,7 @@ import ( _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" - _ "github.com/zeta-chain/zetacore/common" + common "github.com/zeta-chain/zetacore/common" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -31,11 +31,11 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type MsgAddBlockHeader struct { - Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - BlockHash []byte `protobuf:"bytes,3,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` - BlockHeader []byte `protobuf:"bytes,4,opt,name=block_header,json=blockHeader,proto3" json:"block_header,omitempty"` - Height int64 `protobuf:"varint,5,opt,name=height,proto3" json:"height,omitempty"` + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + BlockHash []byte `protobuf:"bytes,3,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` + Height int64 `protobuf:"varint,4,opt,name=height,proto3" json:"height,omitempty"` + Header common.HeaderData `protobuf:"bytes,5,opt,name=header,proto3" json:"header"` } func (m *MsgAddBlockHeader) Reset() { *m = MsgAddBlockHeader{} } @@ -92,18 +92,18 @@ func (m *MsgAddBlockHeader) GetBlockHash() []byte { return nil } -func (m *MsgAddBlockHeader) GetBlockHeader() []byte { +func (m *MsgAddBlockHeader) GetHeight() int64 { if m != nil { - return m.BlockHeader + return m.Height } - return nil + return 0 } -func (m *MsgAddBlockHeader) GetHeight() int64 { +func (m *MsgAddBlockHeader) GetHeader() common.HeaderData { if m != nil { - return m.Height + return m.Header } - return 0 + return common.HeaderData{} } type MsgAddBlockHeaderResponse struct { @@ -632,53 +632,53 @@ func init() { func init() { proto.RegisterFile("observer/tx.proto", fileDescriptor_1bcd40fa296a2b1d) } var fileDescriptor_1bcd40fa296a2b1d = []byte{ - // 723 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xcb, 0x6e, 0xd3, 0x4c, - 0x14, 0xae, 0xff, 0xfe, 0xbd, 0xe4, 0xa4, 0xea, 0xc5, 0xbd, 0x39, 0xa9, 0x1a, 0x05, 0x6f, 0x28, - 0x50, 0x62, 0x68, 0x01, 0x21, 0x24, 0x16, 0x29, 0x82, 0x36, 0x42, 0xa5, 0x95, 0x25, 0x58, 0xb0, - 0xb1, 0xc6, 0x9e, 0x53, 0xdb, 0x6a, 0x3c, 0x13, 0x79, 0x1c, 0x94, 0xb0, 0x60, 0xcf, 0x02, 0xc4, - 0x33, 0xf0, 0x2c, 0x2c, 0x58, 0x76, 0xc9, 0x12, 0xb5, 0x1b, 0x1e, 0x03, 0x65, 0x7c, 0x69, 0x2e, - 0x25, 0x4d, 0xba, 0xf2, 0xcc, 0x39, 0xdf, 0xf9, 0xce, 0x77, 0x2e, 0xd6, 0xc0, 0x12, 0xb7, 0x05, - 0x86, 0x1f, 0x30, 0x34, 0xa2, 0x56, 0xa5, 0x11, 0xf2, 0x88, 0xab, 0x1b, 0x1f, 0x31, 0x22, 0x8e, - 0x47, 0x7c, 0x56, 0x91, 0x27, 0x1e, 0x62, 0x25, 0x45, 0x15, 0x97, 0x1d, 0x1e, 0x04, 0x9c, 0x19, - 0xf1, 0x27, 0x8e, 0x28, 0xae, 0xb8, 0xdc, 0xe5, 0xf2, 0x68, 0x74, 0x4e, 0xa9, 0x35, 0xa3, 0xb6, - 0xeb, 0x24, 0xc0, 0xc4, 0xba, 0x96, 0x59, 0x3d, 0x24, 0x14, 0x43, 0x91, 0xd8, 0xd7, 0x33, 0x7b, - 0x7a, 0x48, 0x1c, 0xab, 0x99, 0xa3, 0x41, 0x42, 0x12, 0x24, 0x78, 0xfd, 0xbb, 0x02, 0x4b, 0x87, - 0xc2, 0xad, 0x52, 0xba, 0x57, 0xe7, 0xce, 0xe9, 0x81, 0x24, 0x53, 0x35, 0x98, 0x71, 0x42, 0x24, - 0x11, 0x0f, 0x35, 0xa5, 0xac, 0x6c, 0xe5, 0xcc, 0xf4, 0xaa, 0x16, 0x60, 0x56, 0xd6, 0x64,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 0xc4, 0xea, 0x27, 0x58, 0x1c, - 0xf8, 0x53, 0x1f, 0x5c, 0x47, 0xd4, 0x1f, 0x51, 0x7c, 0x3a, 0x6e, 0x44, 0x96, 0x3f, 0x84, 0xb9, - 0x9e, 0x75, 0xdd, 0x1e, 0xa1, 0x88, 0x0c, 0x5d, 0x7c, 0x34, 0x0e, 0x3a, 0xcb, 0xf9, 0x45, 0x81, - 0xd5, 0xab, 0x97, 0xef, 0xf1, 0x68, 0x75, 0xf4, 0x85, 0x15, 0x9f, 0xdf, 0x28, 0xac, 0xbb, 0x07, - 0x3d, 0x7b, 0xb5, 0x3d, 0x1a, 0x5d, 0x8c, 0xbe, 0xbe, 0x07, 0x57, 0x2d, 0x9c, 0xda, 0x82, 0xf9, - 0xbe, 0x27, 0xa6, 0x32, 0x52, 0x2f, 0x33, 0x7c, 0xf1, 0xc9, 0x78, 0xf8, 0x34, 0xf3, 0x5e, 0xed, - 0xe7, 0x79, 0x49, 0x39, 0x3b, 0x2f, 0x29, 0xbf, 0xcf, 0x4b, 0xca, 0xb7, 0x8b, 0xd2, 0xc4, 0xd9, - 0x45, 0x69, 0xe2, 0xd7, 0x45, 0x69, 0xe2, 0xbd, 0xe1, 0xfa, 0x91, 0xd7, 0xb4, 0x2b, 0x0e, 0x0f, - 0x8c, 0x0e, 0xe3, 0x7d, 0x49, 0x6e, 0xa4, 0xe4, 0x46, 0xcb, 0xb8, 0x7c, 0xd4, 0xdb, 0x0d, 0x14, - 0xf6, 0xb4, 0x7c, 0x32, 0x77, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0xe6, 0x14, 0x0f, 0x4d, 0xed, - 0x07, 0x00, 0x00, + // 731 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0x49, 0x6f, 0xd3, 0x40, + 0x14, 0x8e, 0xe9, 0x9a, 0x97, 0xaa, 0x8b, 0xbb, 0x39, 0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, 0x1a, 0x8c, 0x53, 0x34, 0x48, 0xad, 0xc6, 0x5b, + 0xcc, 0x37, 0x38, 0x6b, 0x74, 0xc4, 0x88, 0x66, 0x75, 0x99, 0x50, 0xfa, 0x96, 0x53, 0xac, 0x84, + 0xae, 0x43, 0xd6, 0xe8, 0xa8, 0x0a, 0xac, 0xf5, 0x56, 0x91, 0x14, 0xf8, 0x45, 0x82, 0x85, 0x78, + 0x2e, 0xc4, 0xc1, 0xf7, 0xdc, 0xc7, 0x9b, 0x2d, 0x52, 0x25, 0x58, 0x24, 0xe2, 0xa0, 0x61, 0xb3, + 0x63, 0x2e, 0x4a, 0xc8, 0x94, 0xd5, 0xa1, 0x13, 0x11, 0x09, 0x83, 0x65, 0x23, 0x0e, 0x56, 0xd9, + 0x31, 0x57, 0xb3, 0xb0, 0xde, 0x27, 0x25, 0x91, 0xf9, 0x4d, 0x02, 0x25, 0x99, 0xd3, 0x11, 0xba, + 0x8e, 0xed, 0x79, 0x36, 0x67, 0xaf, 0x1b, 0xc4, 0x1a, 0xb6, 0x26, 0xf7, 0x60, 0xd1, 0xf6, 0xaa, + 0xcc, 0xe4, 0x2d, 0x46, 0x5f, 0x31, 0x62, 0x36, 0x90, 0x0a, 0x69, 0xb3, 0xfa, 0x80, 0x5d, 0xde, + 0x82, 0x25, 0xdb, 0x3b, 0x6c, 0xf9, 0x3d, 0xe0, 0xb0, 0xa5, 0x83, 0x0e, 0x55, 0x85, 0xc2, 0xff, + 0xf4, 0x24, 0xa2, 0x2b, 0xa2, 0xb5, 0x21, 0xe6, 0x0d, 0x76, 0x2c, 0x64, 0x43, 0xa4, 0xae, 0xc0, + 0x94, 0xf8, 0xed, 0xa2, 0xbe, 0x86, 0x97, 0xa8, 0x25, 0xdd, 0x14, 0x31, 0x7b, 0xf9, 0xef, 0x14, + 0x4c, 0x1c, 0x78, 0x96, 0xcc, 0x21, 0xd3, 0xbd, 0x9e, 0xf7, 0x87, 0xf6, 0xbc, 0x77, 0x0b, 0x72, + 0x3b, 0x63, 0x80, 0xe3, 0xc4, 0xf2, 0x67, 0x58, 0x1c, 0xf8, 0x53, 0xb7, 0xaf, 0x23, 0xea, 0x8f, + 0xc8, 0x3d, 0x1d, 0x37, 0x22, 0xc9, 0xef, 0xc2, 0x5c, 0xcf, 0xba, 0x6e, 0x8d, 0x50, 0x44, 0x82, + 0xce, 0x3d, 0x1a, 0x07, 0x9d, 0xe4, 0xfc, 0x2a, 0xc1, 0xea, 0xd5, 0xcb, 0xf7, 0x78, 0xb4, 0x3a, + 0xfa, 0xc2, 0x72, 0xcf, 0x6f, 0x14, 0xd6, 0xdd, 0x83, 0x9e, 0xbd, 0xda, 0x1a, 0x8d, 0x2e, 0x44, + 0x5f, 0xdf, 0x83, 0xab, 0x16, 0x4e, 0x6e, 0xc3, 0x7c, 0xdf, 0x8b, 0x53, 0x1a, 0xa9, 0x97, 0x09, + 0x3e, 0xf7, 0x64, 0x3c, 0x7c, 0x9c, 0x79, 0xb7, 0x7a, 0x7a, 0x9e, 0x97, 0xce, 0xce, 0xf3, 0xd2, + 0x9f, 0xf3, 0xbc, 0xf4, 0xfd, 0x22, 0x9f, 0x3a, 0xbb, 0xc8, 0xa7, 0x7e, 0x5d, 0xe4, 0x53, 0x1f, + 0x34, 0xcb, 0xf6, 0xeb, 0x2d, 0x33, 0x78, 0x7d, 0xb4, 0x80, 0xf1, 0x81, 0x20, 0xd7, 0x62, 0x72, + 0xad, 0xad, 0x5d, 0xbe, 0xe5, 0x9d, 0x26, 0x7a, 0xe6, 0xb4, 0x78, 0x41, 0x77, 0xfe, 0x05, 0x00, + 0x00, 0xff, 0xff, 0xf9, 0x62, 0xcd, 0x1c, 0xe4, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -961,17 +961,20 @@ func (m *MsgAddBlockHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a if m.Height != 0 { i = encodeVarintTx(dAtA, i, uint64(m.Height)) i-- - dAtA[i] = 0x28 - } - if len(m.BlockHeader) > 0 { - i -= len(m.BlockHeader) - copy(dAtA[i:], m.BlockHeader) - i = encodeVarintTx(dAtA, i, uint64(len(m.BlockHeader))) - i-- - dAtA[i] = 0x22 + dAtA[i] = 0x20 } if len(m.BlockHash) > 0 { i -= len(m.BlockHash) @@ -1389,13 +1392,11 @@ func (m *MsgAddBlockHeader) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.BlockHeader) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } if m.Height != 0 { n += 1 + sovTx(uint64(m.Height)) } + l = m.Header.Size() + n += 1 + l + sovTx(uint64(l)) return n } @@ -1670,10 +1671,10 @@ func (m *MsgAddBlockHeader) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BlockHeader", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) } - var byteLen int + m.Height = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1683,31 +1684,16 @@ func (m *MsgAddBlockHeader) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + m.Height |= int64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BlockHeader = append(m.BlockHeader[:0], dAtA[iNdEx:postIndex]...) - if m.BlockHeader == nil { - m.BlockHeader = []byte{} - } - iNdEx = postIndex case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) } - m.Height = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1717,11 +1703,25 @@ func (m *MsgAddBlockHeader) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Height |= int64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) diff --git a/zetaclient/evm_client.go b/zetaclient/evm_client.go index 0e95cb3bea..1d77e6fb5a 100644 --- a/zetaclient/evm_client.go +++ b/zetaclient/evm_client.go @@ -830,7 +830,13 @@ func (ob *EVMChainClient) observeInTX() error { ob.logger.ExternalChainWatcher.Error().Err(err).Msgf("error encoding block header: %d", bn) continue } - _, err = ob.zetaClient.PostAddBlockHeader(ob.chain.ChainId, block.Hash().Bytes(), block.Number().Int64(), headerRLP) + + _, err = ob.zetaClient.PostAddBlockHeader( + ob.chain.ChainId, + block.Hash().Bytes(), + block.Number().Int64(), + common.NewEthereumHeader(headerRLP), + ) if err != nil { ob.logger.ExternalChainWatcher.Error().Err(err).Msgf("error posting block header: %d", bn) continue diff --git a/zetaclient/query.go b/zetaclient/query.go index a93c52c5e4..9e00acab4c 100644 --- a/zetaclient/query.go +++ b/zetaclient/query.go @@ -12,7 +12,6 @@ import ( upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" tmtypes "github.com/tendermint/tendermint/proto/tendermint/types" "github.com/zeta-chain/zetacore/common" - "github.com/zeta-chain/zetacore/common/ethereum" "github.com/zeta-chain/zetacore/x/crosschain/types" zetaObserverTypes "github.com/zeta-chain/zetacore/x/observer/types" "google.golang.org/grpc" @@ -299,7 +298,7 @@ func (b *ZetaCoreBridge) GetPendingNonces() (*types.QueryAllPendingNoncesRespons return resp, nil } -func (b *ZetaCoreBridge) Prove(blockHash string, txHash string, txIndex int64, proof *ethereum.Proof, chainID uint64) (bool, error) { +func (b *ZetaCoreBridge) Prove(blockHash string, txHash string, txIndex int64, proof *common.Proof, chainID uint64) (bool, error) { client := zetaObserverTypes.NewQueryClient(b.grpcConn) resp, err := client.Prove(context.Background(), &zetaObserverTypes.QueryProveRequest{ BlockHash: blockHash, diff --git a/zetaclient/tx.go b/zetaclient/tx.go index 5b23ef5a73..4e0b0b150c 100644 --- a/zetaclient/tx.go +++ b/zetaclient/tx.go @@ -8,7 +8,6 @@ import ( "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/authz" - "github.com/zeta-chain/zetacore/common/ethereum" "github.com/zeta-chain/zetacore/zetaclient/config" "gitlab.com/thorchain/tss/go-tss/blame" @@ -55,7 +54,7 @@ func (b *ZetaCoreBridge) PostGasPrice(chain common.Chain, gasPrice uint64, suppl return "", fmt.Errorf("post gasprice failed after %d retries", DefaultRetryInterval) } -func (b *ZetaCoreBridge) AddTxHashToOutTxTracker(chainID int64, nonce uint64, txHash string, proof *ethereum.Proof, blockHash string, txIndex int64) (string, error) { +func (b *ZetaCoreBridge) AddTxHashToOutTxTracker(chainID int64, nonce uint64, txHash string, proof *common.Proof, blockHash string, txIndex int64) (string, error) { signerAddress := b.keys.GetOperatorAddress().String() msg := types.NewMsgAddToOutTxTracker(signerAddress, chainID, nonce, txHash, proof, blockHash, txIndex) authzMsg, authzSigner := b.WrapMessageWithAuthz(msg) @@ -192,10 +191,11 @@ func (b *ZetaCoreBridge) PostBlameData(blame *blame.Blame, chainID int64, index return "", fmt.Errorf("post blame data failed after %d retries", DefaultRetryCount) } -func (b *ZetaCoreBridge) PostAddBlockHeader(chainID int64, txhash []byte, height int64, header []byte) (string, error) { +func (b *ZetaCoreBridge) PostAddBlockHeader(chainID int64, txhash []byte, height int64, header common.HeaderData) (string, error) { signerAddress := b.keys.GetOperatorAddress().String() msg := observerTypes.NewMsgAddBlockHeader(signerAddress, chainID, txhash, height, header) authzMsg, authzSigner := b.WrapMessageWithAuthz(msg) + var gasLimit uint64 = DefaultGasLimit for i := 0; i < DefaultRetryCount; i++ { zetaTxHash, err := b.Broadcast(gasLimit, authzMsg, authzSigner)