diff --git a/proto/babylon/btccheckpoint/btccheckpoint.proto b/proto/babylon/btccheckpoint/btccheckpoint.proto index 6c8085fcb..bdb44326f 100644 --- a/proto/babylon/btccheckpoint/btccheckpoint.proto +++ b/proto/babylon/btccheckpoint/btccheckpoint.proto @@ -5,6 +5,40 @@ import "gogoproto/gogo.proto"; option go_package = "github.com/babylonchain/babylon/x/btccheckpoint/types"; +// Consider we have a Merkle tree with following structure: +// ROOT +// / \ +// H1234 H5555 +// / \ \ +// H12 H34 H55 +// / \ / \ / +// H1 H2 H3 H4 H5 +// L1 L2 L3 L4 L5 +// To prove L3 was part of ROOT we need: +// - btc_transaction_index = 2 which in binary is 010 +// (where 0 means going left, 1 means going right in the tree) +// - merkle_nodes we'd have H4 || H12 || H5555 +// By looking at 010 we would know that H4 is a right sibling, +// H12 is left, H5555 is right again. +message BTCSpvProof { + // Valid bitcoin transaction containing OP_RETURN opcode. + bytes btc_transaction = 1; + // Index of transaction within the block. Index is needed to determine if + // currently hashed node is left or right. + uint32 btc_transaction_index = 2; + // List of concatenated intermediate merkle tree nodes, without root node and + // leaf node against which we calculate the proof. Each node has 32 byte + // length. Example proof can look like: 32_bytes_of_node1 || 32_bytes_of_node2 + // || 32_bytes_of_node3 so the length of the proof will always be divisible + // by 32. + bytes merkle_nodes = 3; + // Valid btc header which confirms btc_transaction. + // Should have exactly 80 bytes + bytes confirming_btc_header = 4 + [ (gogoproto.customtype) = + "github.com/babylonchain/babylon/types.BTCHeaderBytes" ]; +} + // Each provided OP_RETURN transaction can be idendtified by hash of block in // which transaction was included and transaction index in the block message TransactionKey { @@ -39,6 +73,25 @@ enum BtcStatus { EPOCH_STATUS_FINALIZED = 2 [(gogoproto.enumvalue_customname) = "Finalized"]; } +// TransactionInfo is the info of a tx that contains Babylon checkpoint, including +// - the position of the tx on BTC blockchain +// - the full tx content +// - the Merkle proof that this tx is on the above position +message TransactionInfo { + // key is the position (txIdx, blockHash) of this tx on BTC blockchain + // Although it is already a part of SubmissionKey, we store it here again + // to make TransactionInfo self-contained. + // For example, storing the key allows TransactionInfo to not relay on + // the fact that TransactionInfo will be ordered in the same order as + // TransactionKeys in SubmissionKey. + TransactionKey key = 1; + // transaction is the full transaction in bytes + bytes transaction = 2; + // proof is the Merkle proof that this tx is included in the position in `key` + // TODO: maybe it could use here better format as we already processed and + // valideated the proof? + bytes proof = 3; +} // TODO: Determine if we should keep any block number or depth info. // On one hand it may be usefull to determine if block is stable or not, on other @@ -49,12 +102,11 @@ message SubmissionData { // Address of submitter of given checkpoint. Required to payup the reward to // submitter of given checkpoint bytes submitter = 1; - // Required to recover address of sender of btc transction to payup the reward. - // TODO: Maybe it is worth recovering senders while processing the InsertProof - // message, and store only those. Another point is that it is not that simple - // to recover sender of btc tx. - repeated bytes btctransaction = 2; - + // txs_info is the two `TransactionInfo`s corresponding to the submission + // It is used for + // - recovering address of sender of btc transction to payup the reward. + // - allowing the ZoneConcierge module to prove the checkpoint is submitted to BTC + repeated TransactionInfo txs_info = 2; uint64 epoch = 3; } diff --git a/proto/babylon/btccheckpoint/tx.proto b/proto/babylon/btccheckpoint/tx.proto index ebe36e887..e4d0f775b 100644 --- a/proto/babylon/btccheckpoint/tx.proto +++ b/proto/babylon/btccheckpoint/tx.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package babylon.btccheckpoint.v1; import "gogoproto/gogo.proto"; +import "babylon/btccheckpoint/btccheckpoint.proto"; option go_package = "github.com/babylonchain/babylon/x/btccheckpoint/types"; @@ -11,43 +12,9 @@ service Msg { returns (MsgInsertBTCSpvProofResponse); } -// Consider we have a Merkle tree with following structure: -// ROOT -// / \ -// H1234 H5555 -// / \ \ -// H12 H34 H55 -// / \ / \ / -// H1 H2 H3 H4 H5 -// L1 L2 L3 L4 L5 -// To prove L3 was part of ROOT we need: -// - btc_transaction_index = 2 which in binary is 010 -// (where 0 means going left, 1 means going right in the tree) -// - merkle_nodes we'd have H4 || H12 || H5555 -// By looking at 010 we would know that H4 is a right sibling, -// H12 is left, H5555 is right again. -message BTCSpvProof { - // Valid bitcoin transaction containing OP_RETURN opcode. - bytes btc_transaction = 1; - // Index of transaction within the block. Index is needed to determine if - // currently hashed node is left or right. - uint32 btc_transaction_index = 2; - // List of concatenated intermediate merkle tree nodes, without root node and - // leaf node against which we calculate the proof. Each node has 32 byte - // length. Example proof can look like: 32_bytes_of_node1 || 32_bytes_of_node2 - // || 32_bytes_of_node3 so the length of the proof will always be divisible - // by 32. - bytes merkle_nodes = 3; - // Valid btc header which confirms btc_transaction. - // Should have exactly 80 bytes - bytes confirming_btc_header = 4 - [ (gogoproto.customtype) = - "github.com/babylonchain/babylon/types.BTCHeaderBytes" ]; -} - message MsgInsertBTCSpvProof { string submitter = 1; - repeated BTCSpvProof proofs = 2; + repeated babylon.btccheckpoint.v1.BTCSpvProof proofs = 2; } message MsgInsertBTCSpvProofResponse {} diff --git a/proto/babylon/zoneconcierge/query.proto b/proto/babylon/zoneconcierge/query.proto index 156216300..67389d2b1 100644 --- a/proto/babylon/zoneconcierge/query.proto +++ b/proto/babylon/zoneconcierge/query.proto @@ -97,5 +97,6 @@ message QueryFinalizedChainInfoResponse { // proof_epoch_sealed is the proof that the epoch is sealed babylon.zoneconcierge.v1.ProofEpochSealed proof_epoch_sealed = 7; // proof_epoch_submitted is the proof that the epoch's checkpoint is included in BTC ledger - babylon.btccheckpoint.v1.BTCSpvProof proof_epoch_submitted = 8; + // It is the two TransactionInfo in the best (i.e., earliest) checkpoint submission + repeated babylon.btccheckpoint.v1.TransactionInfo proof_epoch_submitted = 8; } diff --git a/x/btccheckpoint/keeper/msg_server.go b/x/btccheckpoint/keeper/msg_server.go index 1c7710d6f..79c37bbe6 100644 --- a/x/btccheckpoint/keeper/msg_server.go +++ b/x/btccheckpoint/keeper/msg_server.go @@ -7,6 +7,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) +var _ types.MsgServer = msgServer{} + type msgServer struct { k Keeper } @@ -61,12 +63,23 @@ func (m msgServer) InsertBTCSpvProof(ctx context.Context, req *types.MsgInsertBT return nil, err } + // construct TransactionInfo pair and the submission data + txsInfo := make([]*types.TransactionInfo, len(submissionKey.Key)) + for i := range submissionKey.Key { + // creating a per-iteration `txKey` variable rather than assigning it in the `for` statement + // in order to prevent overwriting previous `txKey` + // see https://github.com/golang/go/discussions/56010 + txKey := submissionKey.Key[i] + txsInfo[i] = types.NewTransactionInfo(txKey, req.Proofs[i].BtcTransaction, req.Proofs[i].MerkleNodes) + } + submissionData := rawSubmission.GetSubmissionData(epochNum, txsInfo) + // Everything is fine, save new checkpoint and update Epoch data err = m.k.addEpochSubmission( sdkCtx, epochNum, submissionKey, - rawSubmission.GetSubmissionData(epochNum), + submissionData, rawCheckpointBytes, ) @@ -76,5 +89,3 @@ func (m msgServer) InsertBTCSpvProof(ctx context.Context, req *types.MsgInsertBT return &types.MsgInsertBTCSpvProofResponse{}, nil } - -var _ types.MsgServer = msgServer{} diff --git a/x/btccheckpoint/keeper/msg_server_test.go b/x/btccheckpoint/keeper/msg_server_test.go index fdf61c4c7..268588f5c 100644 --- a/x/btccheckpoint/keeper/msg_server_test.go +++ b/x/btccheckpoint/keeper/msg_server_test.go @@ -226,6 +226,17 @@ func TestSubmitValidNewCheckpoint(t *testing.T) { t.Errorf("Submission data with invalid epoch") } + if len(submissionData.TxsInfo) != 2 { + t.Errorf("Submission data with invalid TransactionInfo") + } + + for i, txInfo := range submissionData.TxsInfo { + require.Equal(t, submissionKey.Key[i].Index, txInfo.Key.Index) + require.True(t, submissionKey.Key[i].Hash.Eq(txInfo.Key.Hash)) + require.Equal(t, msg.Proofs[i].BtcTransaction, txInfo.Transaction) + require.Equal(t, msg.Proofs[i].MerkleNodes, txInfo.Proof) + } + ed1 := tk.getEpochData(epoch) // TODO Add custom equal fo submission key and transaction key to check diff --git a/x/btccheckpoint/types/btccheckpoint.pb.go b/x/btccheckpoint/types/btccheckpoint.pb.go index e13f0f8d2..8e9bb809e 100644 --- a/x/btccheckpoint/types/btccheckpoint.pb.go +++ b/x/btccheckpoint/types/btccheckpoint.pb.go @@ -58,6 +58,92 @@ func (BtcStatus) EnumDescriptor() ([]byte, []int) { return fileDescriptor_da8b9af3dbd18a36, []int{0} } +// Consider we have a Merkle tree with following structure: +// ROOT +// / \ +// H1234 H5555 +// / \ \ +// H12 H34 H55 +// / \ / \ / +// H1 H2 H3 H4 H5 +// L1 L2 L3 L4 L5 +// To prove L3 was part of ROOT we need: +// - btc_transaction_index = 2 which in binary is 010 +// (where 0 means going left, 1 means going right in the tree) +// - merkle_nodes we'd have H4 || H12 || H5555 +// By looking at 010 we would know that H4 is a right sibling, +// H12 is left, H5555 is right again. +type BTCSpvProof struct { + // Valid bitcoin transaction containing OP_RETURN opcode. + BtcTransaction []byte `protobuf:"bytes,1,opt,name=btc_transaction,json=btcTransaction,proto3" json:"btc_transaction,omitempty"` + // Index of transaction within the block. Index is needed to determine if + // currently hashed node is left or right. + BtcTransactionIndex uint32 `protobuf:"varint,2,opt,name=btc_transaction_index,json=btcTransactionIndex,proto3" json:"btc_transaction_index,omitempty"` + // List of concatenated intermediate merkle tree nodes, without root node and + // leaf node against which we calculate the proof. Each node has 32 byte + // length. Example proof can look like: 32_bytes_of_node1 || 32_bytes_of_node2 + // || 32_bytes_of_node3 so the length of the proof will always be divisible + // by 32. + MerkleNodes []byte `protobuf:"bytes,3,opt,name=merkle_nodes,json=merkleNodes,proto3" json:"merkle_nodes,omitempty"` + // Valid btc header which confirms btc_transaction. + // Should have exactly 80 bytes + ConfirmingBtcHeader *github_com_babylonchain_babylon_types.BTCHeaderBytes `protobuf:"bytes,4,opt,name=confirming_btc_header,json=confirmingBtcHeader,proto3,customtype=github.com/babylonchain/babylon/types.BTCHeaderBytes" json:"confirming_btc_header,omitempty"` +} + +func (m *BTCSpvProof) Reset() { *m = BTCSpvProof{} } +func (m *BTCSpvProof) String() string { return proto.CompactTextString(m) } +func (*BTCSpvProof) ProtoMessage() {} +func (*BTCSpvProof) Descriptor() ([]byte, []int) { + return fileDescriptor_da8b9af3dbd18a36, []int{0} +} +func (m *BTCSpvProof) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BTCSpvProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BTCSpvProof.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 *BTCSpvProof) XXX_Merge(src proto.Message) { + xxx_messageInfo_BTCSpvProof.Merge(m, src) +} +func (m *BTCSpvProof) XXX_Size() int { + return m.Size() +} +func (m *BTCSpvProof) XXX_DiscardUnknown() { + xxx_messageInfo_BTCSpvProof.DiscardUnknown(m) +} + +var xxx_messageInfo_BTCSpvProof proto.InternalMessageInfo + +func (m *BTCSpvProof) GetBtcTransaction() []byte { + if m != nil { + return m.BtcTransaction + } + return nil +} + +func (m *BTCSpvProof) GetBtcTransactionIndex() uint32 { + if m != nil { + return m.BtcTransactionIndex + } + return 0 +} + +func (m *BTCSpvProof) GetMerkleNodes() []byte { + if m != nil { + return m.MerkleNodes + } + return nil +} + // Each provided OP_RETURN transaction can be idendtified by hash of block in // which transaction was included and transaction index in the block type TransactionKey struct { @@ -69,7 +155,7 @@ func (m *TransactionKey) Reset() { *m = TransactionKey{} } func (m *TransactionKey) String() string { return proto.CompactTextString(m) } func (*TransactionKey) ProtoMessage() {} func (*TransactionKey) Descriptor() ([]byte, []int) { - return fileDescriptor_da8b9af3dbd18a36, []int{0} + return fileDescriptor_da8b9af3dbd18a36, []int{1} } func (m *TransactionKey) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -121,7 +207,7 @@ func (m *SubmissionKey) Reset() { *m = SubmissionKey{} } func (m *SubmissionKey) String() string { return proto.CompactTextString(m) } func (*SubmissionKey) ProtoMessage() {} func (*SubmissionKey) Descriptor() ([]byte, []int) { - return fileDescriptor_da8b9af3dbd18a36, []int{1} + return fileDescriptor_da8b9af3dbd18a36, []int{2} } func (m *SubmissionKey) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -157,6 +243,80 @@ func (m *SubmissionKey) GetKey() []*TransactionKey { return nil } +// TransactionInfo is the info of a tx that contains Babylon checkpoint, including +// - the position of the tx on BTC blockchain +// - the full tx content +// - the Merkle proof that this tx is on the above position +type TransactionInfo struct { + // key is the position (txIdx, blockHash) of this tx on BTC blockchain + // Although it is already a part of SubmissionKey, we store it here again + // to make TransactionInfo self-contained. + // For example, storing the key allows TransactionInfo to not relay on + // the fact that TransactionInfo will be ordered in the same order as + // TransactionKeys in SubmissionKey. + Key *TransactionKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // transaction is the full transaction in bytes + Transaction []byte `protobuf:"bytes,2,opt,name=transaction,proto3" json:"transaction,omitempty"` + // proof is the Merkle proof that this tx is included in the position in `key` + // TODO: maybe it could use here better format as we already processed and + // valideated the proof? + Proof []byte `protobuf:"bytes,3,opt,name=proof,proto3" json:"proof,omitempty"` +} + +func (m *TransactionInfo) Reset() { *m = TransactionInfo{} } +func (m *TransactionInfo) String() string { return proto.CompactTextString(m) } +func (*TransactionInfo) ProtoMessage() {} +func (*TransactionInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_da8b9af3dbd18a36, []int{3} +} +func (m *TransactionInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TransactionInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TransactionInfo.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 *TransactionInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_TransactionInfo.Merge(m, src) +} +func (m *TransactionInfo) XXX_Size() int { + return m.Size() +} +func (m *TransactionInfo) XXX_DiscardUnknown() { + xxx_messageInfo_TransactionInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_TransactionInfo proto.InternalMessageInfo + +func (m *TransactionInfo) GetKey() *TransactionKey { + if m != nil { + return m.Key + } + return nil +} + +func (m *TransactionInfo) GetTransaction() []byte { + if m != nil { + return m.Transaction + } + return nil +} + +func (m *TransactionInfo) GetProof() []byte { + if m != nil { + return m.Proof + } + return nil +} + // TODO: Determine if we should keep any block number or depth info. // On one hand it may be usefull to determine if block is stable or not, on other // depth/block number info, without context (i.e info about chain) is pretty useless @@ -166,19 +326,19 @@ type SubmissionData struct { // Address of submitter of given checkpoint. Required to payup the reward to // submitter of given checkpoint Submitter []byte `protobuf:"bytes,1,opt,name=submitter,proto3" json:"submitter,omitempty"` - // Required to recover address of sender of btc transction to payup the reward. - // TODO: Maybe it is worth recovering senders while processing the InsertProof - // message, and store only those. Another point is that it is not that simple - // to recover sender of btc tx. - Btctransaction [][]byte `protobuf:"bytes,2,rep,name=btctransaction,proto3" json:"btctransaction,omitempty"` - Epoch uint64 `protobuf:"varint,3,opt,name=epoch,proto3" json:"epoch,omitempty"` + // txs_info is the two `TransactionInfo`s corresponding to the submission + // It is used for + // - recovering address of sender of btc transction to payup the reward. + // - allowing the ZoneConcierge module to prove the checkpoint is submitted to BTC + TxsInfo []*TransactionInfo `protobuf:"bytes,2,rep,name=txs_info,json=txsInfo,proto3" json:"txs_info,omitempty"` + Epoch uint64 `protobuf:"varint,3,opt,name=epoch,proto3" json:"epoch,omitempty"` } func (m *SubmissionData) Reset() { *m = SubmissionData{} } func (m *SubmissionData) String() string { return proto.CompactTextString(m) } func (*SubmissionData) ProtoMessage() {} func (*SubmissionData) Descriptor() ([]byte, []int) { - return fileDescriptor_da8b9af3dbd18a36, []int{2} + return fileDescriptor_da8b9af3dbd18a36, []int{4} } func (m *SubmissionData) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -214,9 +374,9 @@ func (m *SubmissionData) GetSubmitter() []byte { return nil } -func (m *SubmissionData) GetBtctransaction() [][]byte { +func (m *SubmissionData) GetTxsInfo() []*TransactionInfo { if m != nil { - return m.Btctransaction + return m.TxsInfo } return nil } @@ -244,7 +404,7 @@ func (m *EpochData) Reset() { *m = EpochData{} } func (m *EpochData) String() string { return proto.CompactTextString(m) } func (*EpochData) ProtoMessage() {} func (*EpochData) Descriptor() ([]byte, []int) { - return fileDescriptor_da8b9af3dbd18a36, []int{3} + return fileDescriptor_da8b9af3dbd18a36, []int{5} } func (m *EpochData) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -296,8 +456,10 @@ func (m *EpochData) GetRawCheckpoint() []byte { func init() { proto.RegisterEnum("babylon.btccheckpoint.v1.BtcStatus", BtcStatus_name, BtcStatus_value) + proto.RegisterType((*BTCSpvProof)(nil), "babylon.btccheckpoint.v1.BTCSpvProof") proto.RegisterType((*TransactionKey)(nil), "babylon.btccheckpoint.v1.TransactionKey") proto.RegisterType((*SubmissionKey)(nil), "babylon.btccheckpoint.v1.SubmissionKey") + proto.RegisterType((*TransactionInfo)(nil), "babylon.btccheckpoint.v1.TransactionInfo") proto.RegisterType((*SubmissionData)(nil), "babylon.btccheckpoint.v1.SubmissionData") proto.RegisterType((*EpochData)(nil), "babylon.btccheckpoint.v1.EpochData") } @@ -307,38 +469,101 @@ func init() { } var fileDescriptor_da8b9af3dbd18a36 = []byte{ - // 486 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x93, 0xcf, 0x6e, 0xd3, 0x40, - 0x10, 0xc6, 0xbd, 0x49, 0xa8, 0x94, 0x25, 0xb1, 0x22, 0xab, 0x42, 0x56, 0x84, 0x8c, 0x15, 0x04, - 0xb8, 0x1c, 0x1c, 0x51, 0x84, 0xc4, 0xbf, 0x4b, 0xed, 0x38, 0x4a, 0x54, 0xda, 0x54, 0xb6, 0x7b, - 0xe9, 0x25, 0x5a, 0x3b, 0x4b, 0xbc, 0x6a, 0xe2, 0x8d, 0xbc, 0x1b, 0x1a, 0xf3, 0x04, 0x88, 0x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0xac, 0xbc, 0xfb, - 0xac, 0x49, 0xd6, 0xe0, 0xeb, 0x52, 0x03, 0x97, 0x4b, 0x0d, 0xfc, 0x5c, 0x6a, 0xe0, 0xc3, 0x4a, - 0x93, 0x2e, 0x57, 0x9a, 0xf4, 0x6d, 0xa5, 0x49, 0x67, 0x4f, 0xfe, 0x77, 0x56, 0x8b, 0x6b, 0x7f, - 0x81, 0x38, 0xb3, 0x60, 0x47, 0x9c, 0xf3, 0xe3, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x85, 0xdb, - 0x51, 0xd6, 0x2b, 0x03, 0x00, 0x00, + // 633 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x4f, 0x4f, 0xdb, 0x4e, + 0x10, 0xcd, 0x86, 0xc0, 0xef, 0x97, 0x0d, 0x09, 0x68, 0x81, 0xca, 0x42, 0x95, 0x49, 0x53, 0x55, + 0x84, 0x1e, 0x12, 0x95, 0xb6, 0x12, 0xfd, 0x73, 0xc1, 0x49, 0x10, 0x11, 0xe5, 0x8f, 0x6c, 0x73, + 0xe1, 0x62, 0xad, 0x37, 0x9b, 0xd8, 0x22, 0xf1, 0x46, 0xde, 0x05, 0x92, 0xde, 0x2b, 0x55, 0x9c, + 0xaa, 0xde, 0x7b, 0xea, 0xad, 0x9f, 0xa4, 0x47, 0x8e, 0x15, 0x07, 0x54, 0xc1, 0xc7, 0xe8, 0xa5, + 0xf2, 0xae, 0x4b, 0x62, 0x5a, 0xd4, 0x72, 0xf3, 0xcc, 0xbe, 0x99, 0x7d, 0xef, 0xcd, 0x78, 0xe1, + 0x8a, 0x8b, 0xdd, 0x61, 0x97, 0x05, 0x55, 0x57, 0x10, 0xe2, 0x51, 0x72, 0xd8, 0x67, 0x7e, 0x20, + 0x92, 0x51, 0xa5, 0x1f, 0x32, 0xc1, 0x90, 0x16, 0x43, 0x2b, 0xc9, 0xc3, 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0f, 0xf1, 0x49, 0xed, 0x3a, 0xf9, + 0xf8, 0x23, 0x80, 0xd9, 0xeb, 0x62, 0xb4, 0x02, 0xef, 0x35, 0xf6, 0x76, 0x6b, 0x9b, 0x8e, 0x65, + 0xaf, 0xdb, 0xfb, 0x96, 0x63, 0xed, 0x1b, 0xdb, 0x4d, 0xdb, 0x6e, 0xd4, 0x67, 0x53, 0x8b, 0xf9, + 0xd3, 0x4f, 0xc5, 0xac, 0x15, 0x3b, 0xd8, 0xfa, 0x0d, 0x5a, 0xdb, 0xdd, 0xd9, 0x68, 0x9a, 0xdb, + 0x8d, 0xfa, 0x2c, 0x50, 0xd0, 0x9a, 0x5a, 0xfb, 0x3f, 0x40, 0x37, 0x9a, 0x3b, 0xeb, 0x6f, 0x9a, + 0x07, 0x8d, 0xfa, 0x6c, 0x5a, 0x41, 0x37, 0xfc, 0x00, 0x77, 0xfd, 0xb7, 0xb4, 0xb5, 0x98, 0x79, + 0xff, 0x59, 0x4f, 0x19, 0xbb, 0x5f, 0x2f, 0x75, 0x70, 0x76, 0xa9, 0x83, 0xef, 0x97, 0x3a, 0xf8, + 0x70, 0xa5, 0xa7, 0xce, 0xae, 0xf4, 0xd4, 0xb7, 0x2b, 0x3d, 0x75, 0xf0, 0xfc, 0x6f, 0xdb, 0x3f, + 0xb8, 0xf1, 0x54, 0xc9, 0xbf, 0xc1, 0x9d, 0x92, 0x6f, 0xce, 0xd3, 0x9f, 0x01, 0x00, 0x00, 0xff, + 0xff, 0xc7, 0x34, 0x1c, 0x27, 0xd0, 0x04, 0x00, 0x00, +} + +func (m *BTCSpvProof) 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 *BTCSpvProof) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BTCSpvProof) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ConfirmingBtcHeader != nil { + { + size := m.ConfirmingBtcHeader.Size() + i -= size + if _, err := m.ConfirmingBtcHeader.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintBtccheckpoint(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if len(m.MerkleNodes) > 0 { + i -= len(m.MerkleNodes) + copy(dAtA[i:], m.MerkleNodes) + i = encodeVarintBtccheckpoint(dAtA, i, uint64(len(m.MerkleNodes))) + i-- + dAtA[i] = 0x1a + } + if m.BtcTransactionIndex != 0 { + i = encodeVarintBtccheckpoint(dAtA, i, uint64(m.BtcTransactionIndex)) + i-- + dAtA[i] = 0x10 + } + if len(m.BtcTransaction) > 0 { + i -= len(m.BtcTransaction) + copy(dAtA[i:], m.BtcTransaction) + i = encodeVarintBtccheckpoint(dAtA, i, uint64(len(m.BtcTransaction))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *TransactionKey) Marshal() (dAtA []byte, err error) { @@ -418,6 +643,55 @@ func (m *SubmissionKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *TransactionInfo) 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 *TransactionInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TransactionInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Proof) > 0 { + i -= len(m.Proof) + copy(dAtA[i:], m.Proof) + i = encodeVarintBtccheckpoint(dAtA, i, uint64(len(m.Proof))) + i-- + dAtA[i] = 0x1a + } + if len(m.Transaction) > 0 { + i -= len(m.Transaction) + copy(dAtA[i:], m.Transaction) + i = encodeVarintBtccheckpoint(dAtA, i, uint64(len(m.Transaction))) + i-- + dAtA[i] = 0x12 + } + if m.Key != nil { + { + size, err := m.Key.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintBtccheckpoint(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *SubmissionData) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -443,11 +717,16 @@ func (m *SubmissionData) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x18 } - if len(m.Btctransaction) > 0 { - for iNdEx := len(m.Btctransaction) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Btctransaction[iNdEx]) - copy(dAtA[i:], m.Btctransaction[iNdEx]) - i = encodeVarintBtccheckpoint(dAtA, i, uint64(len(m.Btctransaction[iNdEx]))) + if len(m.TxsInfo) > 0 { + for iNdEx := len(m.TxsInfo) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.TxsInfo[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintBtccheckpoint(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0x12 } @@ -522,6 +801,30 @@ func encodeVarintBtccheckpoint(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } +func (m *BTCSpvProof) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.BtcTransaction) + if l > 0 { + n += 1 + l + sovBtccheckpoint(uint64(l)) + } + if m.BtcTransactionIndex != 0 { + n += 1 + sovBtccheckpoint(uint64(m.BtcTransactionIndex)) + } + l = len(m.MerkleNodes) + if l > 0 { + n += 1 + l + sovBtccheckpoint(uint64(l)) + } + if m.ConfirmingBtcHeader != nil { + l = m.ConfirmingBtcHeader.Size() + n += 1 + l + sovBtccheckpoint(uint64(l)) + } + return n +} + func (m *TransactionKey) Size() (n int) { if m == nil { return 0 @@ -553,6 +856,27 @@ func (m *SubmissionKey) Size() (n int) { return n } +func (m *TransactionInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Key != nil { + l = m.Key.Size() + n += 1 + l + sovBtccheckpoint(uint64(l)) + } + l = len(m.Transaction) + if l > 0 { + n += 1 + l + sovBtccheckpoint(uint64(l)) + } + l = len(m.Proof) + if l > 0 { + n += 1 + l + sovBtccheckpoint(uint64(l)) + } + return n +} + func (m *SubmissionData) Size() (n int) { if m == nil { return 0 @@ -563,9 +887,9 @@ func (m *SubmissionData) Size() (n int) { if l > 0 { n += 1 + l + sovBtccheckpoint(uint64(l)) } - if len(m.Btctransaction) > 0 { - for _, b := range m.Btctransaction { - l = len(b) + if len(m.TxsInfo) > 0 { + for _, e := range m.TxsInfo { + l = e.Size() n += 1 + l + sovBtccheckpoint(uint64(l)) } } @@ -603,6 +927,178 @@ func sovBtccheckpoint(x uint64) (n int) { func sozBtccheckpoint(x uint64) (n int) { return sovBtccheckpoint(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } +func (m *BTCSpvProof) 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 ErrIntOverflowBtccheckpoint + } + 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: BTCSpvProof: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BTCSpvProof: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BtcTransaction", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBtccheckpoint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthBtccheckpoint + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthBtccheckpoint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BtcTransaction = append(m.BtcTransaction[:0], dAtA[iNdEx:postIndex]...) + if m.BtcTransaction == nil { + m.BtcTransaction = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BtcTransactionIndex", wireType) + } + m.BtcTransactionIndex = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBtccheckpoint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BtcTransactionIndex |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MerkleNodes", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBtccheckpoint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthBtccheckpoint + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthBtccheckpoint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MerkleNodes = append(m.MerkleNodes[:0], dAtA[iNdEx:postIndex]...) + if m.MerkleNodes == nil { + m.MerkleNodes = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConfirmingBtcHeader", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBtccheckpoint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthBtccheckpoint + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthBtccheckpoint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_babylonchain_babylon_types.BTCHeaderBytes + m.ConfirmingBtcHeader = &v + if err := m.ConfirmingBtcHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipBtccheckpoint(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthBtccheckpoint + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *TransactionKey) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -791,6 +1287,160 @@ func (m *SubmissionKey) Unmarshal(dAtA []byte) error { } return nil } +func (m *TransactionInfo) 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 ErrIntOverflowBtccheckpoint + } + 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: TransactionInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TransactionInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBtccheckpoint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthBtccheckpoint + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthBtccheckpoint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Key == nil { + m.Key = &TransactionKey{} + } + if err := m.Key.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Transaction", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBtccheckpoint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthBtccheckpoint + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthBtccheckpoint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Transaction = append(m.Transaction[:0], dAtA[iNdEx:postIndex]...) + if m.Transaction == nil { + m.Transaction = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBtccheckpoint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthBtccheckpoint + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthBtccheckpoint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Proof = append(m.Proof[:0], dAtA[iNdEx:postIndex]...) + if m.Proof == nil { + m.Proof = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipBtccheckpoint(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthBtccheckpoint + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *SubmissionData) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -856,9 +1506,9 @@ func (m *SubmissionData) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Btctransaction", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TxsInfo", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowBtccheckpoint @@ -868,23 +1518,25 @@ func (m *SubmissionData) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthBtccheckpoint } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthBtccheckpoint } if postIndex > l { return io.ErrUnexpectedEOF } - m.Btctransaction = append(m.Btctransaction, make([]byte, postIndex-iNdEx)) - copy(m.Btctransaction[len(m.Btctransaction)-1], dAtA[iNdEx:postIndex]) + m.TxsInfo = append(m.TxsInfo, &TransactionInfo{}) + if err := m.TxsInfo[len(m.TxsInfo)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 3: if wireType != 0 { diff --git a/x/btccheckpoint/types/tx.pb.go b/x/btccheckpoint/types/tx.pb.go index 3a61ad6a1..654faf41a 100644 --- a/x/btccheckpoint/types/tx.pb.go +++ b/x/btccheckpoint/types/tx.pb.go @@ -6,7 +6,6 @@ package types import ( context "context" fmt "fmt" - github_com_babylonchain_babylon_types "github.com/babylonchain/babylon/types" _ "github.com/gogo/protobuf/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" @@ -29,92 +28,6 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// Consider we have a Merkle tree with following structure: -// ROOT -// / \ -// H1234 H5555 -// / \ \ -// H12 H34 H55 -// / \ / \ / -// H1 H2 H3 H4 H5 -// L1 L2 L3 L4 L5 -// To prove L3 was part of ROOT we need: -// - btc_transaction_index = 2 which in binary is 010 -// (where 0 means going left, 1 means going right in the tree) -// - merkle_nodes we'd have H4 || H12 || H5555 -// By looking at 010 we would know that H4 is a right sibling, -// H12 is left, H5555 is right again. -type BTCSpvProof struct { - // Valid bitcoin transaction containing OP_RETURN opcode. - BtcTransaction []byte `protobuf:"bytes,1,opt,name=btc_transaction,json=btcTransaction,proto3" json:"btc_transaction,omitempty"` - // Index of transaction within the block. Index is needed to determine if - // currently hashed node is left or right. - BtcTransactionIndex uint32 `protobuf:"varint,2,opt,name=btc_transaction_index,json=btcTransactionIndex,proto3" json:"btc_transaction_index,omitempty"` - // List of concatenated intermediate merkle tree nodes, without root node and - // leaf node against which we calculate the proof. Each node has 32 byte - // length. Example proof can look like: 32_bytes_of_node1 || 32_bytes_of_node2 - // || 32_bytes_of_node3 so the length of the proof will always be divisible - // by 32. - MerkleNodes []byte `protobuf:"bytes,3,opt,name=merkle_nodes,json=merkleNodes,proto3" json:"merkle_nodes,omitempty"` - // Valid btc header which confirms btc_transaction. - // Should have exactly 80 bytes - ConfirmingBtcHeader *github_com_babylonchain_babylon_types.BTCHeaderBytes `protobuf:"bytes,4,opt,name=confirming_btc_header,json=confirmingBtcHeader,proto3,customtype=github.com/babylonchain/babylon/types.BTCHeaderBytes" json:"confirming_btc_header,omitempty"` -} - -func (m *BTCSpvProof) Reset() { *m = BTCSpvProof{} } -func (m *BTCSpvProof) String() string { return proto.CompactTextString(m) } -func (*BTCSpvProof) ProtoMessage() {} -func (*BTCSpvProof) Descriptor() ([]byte, []int) { - return fileDescriptor_aeec89810b39ea83, []int{0} -} -func (m *BTCSpvProof) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *BTCSpvProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_BTCSpvProof.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 *BTCSpvProof) XXX_Merge(src proto.Message) { - xxx_messageInfo_BTCSpvProof.Merge(m, src) -} -func (m *BTCSpvProof) XXX_Size() int { - return m.Size() -} -func (m *BTCSpvProof) XXX_DiscardUnknown() { - xxx_messageInfo_BTCSpvProof.DiscardUnknown(m) -} - -var xxx_messageInfo_BTCSpvProof proto.InternalMessageInfo - -func (m *BTCSpvProof) GetBtcTransaction() []byte { - if m != nil { - return m.BtcTransaction - } - return nil -} - -func (m *BTCSpvProof) GetBtcTransactionIndex() uint32 { - if m != nil { - return m.BtcTransactionIndex - } - return 0 -} - -func (m *BTCSpvProof) GetMerkleNodes() []byte { - if m != nil { - return m.MerkleNodes - } - return nil -} - type MsgInsertBTCSpvProof struct { Submitter string `protobuf:"bytes,1,opt,name=submitter,proto3" json:"submitter,omitempty"` Proofs []*BTCSpvProof `protobuf:"bytes,2,rep,name=proofs,proto3" json:"proofs,omitempty"` @@ -124,7 +37,7 @@ func (m *MsgInsertBTCSpvProof) Reset() { *m = MsgInsertBTCSpvProof{} } func (m *MsgInsertBTCSpvProof) String() string { return proto.CompactTextString(m) } func (*MsgInsertBTCSpvProof) ProtoMessage() {} func (*MsgInsertBTCSpvProof) Descriptor() ([]byte, []int) { - return fileDescriptor_aeec89810b39ea83, []int{1} + return fileDescriptor_aeec89810b39ea83, []int{0} } func (m *MsgInsertBTCSpvProof) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -174,7 +87,7 @@ func (m *MsgInsertBTCSpvProofResponse) Reset() { *m = MsgInsertBTCSpvPro func (m *MsgInsertBTCSpvProofResponse) String() string { return proto.CompactTextString(m) } func (*MsgInsertBTCSpvProofResponse) ProtoMessage() {} func (*MsgInsertBTCSpvProofResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_aeec89810b39ea83, []int{2} + return fileDescriptor_aeec89810b39ea83, []int{1} } func (m *MsgInsertBTCSpvProofResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -204,7 +117,6 @@ func (m *MsgInsertBTCSpvProofResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgInsertBTCSpvProofResponse proto.InternalMessageInfo func init() { - proto.RegisterType((*BTCSpvProof)(nil), "babylon.btccheckpoint.v1.BTCSpvProof") proto.RegisterType((*MsgInsertBTCSpvProof)(nil), "babylon.btccheckpoint.v1.MsgInsertBTCSpvProof") proto.RegisterType((*MsgInsertBTCSpvProofResponse)(nil), "babylon.btccheckpoint.v1.MsgInsertBTCSpvProofResponse") } @@ -212,32 +124,24 @@ func init() { func init() { proto.RegisterFile("babylon/btccheckpoint/tx.proto", fileDescriptor_aeec89810b39ea83) } var fileDescriptor_aeec89810b39ea83 = []byte{ - // 397 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0xbf, 0xae, 0xda, 0x30, - 0x14, 0xc6, 0x31, 0x54, 0x48, 0x18, 0xda, 0xaa, 0x01, 0xa4, 0x08, 0x21, 0x97, 0x22, 0x55, 0x65, - 0x72, 0x54, 0xfa, 0x47, 0x5d, 0xba, 0x84, 0xa5, 0x0c, 0xb4, 0x55, 0xca, 0xd4, 0x25, 0x8a, 0x8d, - 0x49, 0x2c, 0x88, 0x1d, 0xd9, 0x06, 0x81, 0xba, 0xf5, 0x09, 0xfa, 0x58, 0x1d, 0x19, 0xab, 0x0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x13, 0xa6, 0xb1, 0x3b, 0xec, 0x7d, 0xca, 0x8e, 0xba, 0x4b, - 0xc3, 0xb4, 0x57, 0x3d, 0xc4, 0xba, 0x86, 0x6e, 0x9d, 0xb6, 0x86, 0xb5, 0x81, 0x0e, 0xfb, 0x42, - 0x33, 0x65, 0x8e, 0xa7, 0xd0, 0x84, 0x25, 0x3d, 0x23, 0x31, 0x37, 0x86, 0xa9, 0xac, 0xff, 0x92, - 0x77, 0x10, 0xac, 0x8f, 0xb0, 0x98, 0xa4, 0x98, 0xb6, 0xf3, 0xad, 0x42, 0xa7, 0xdc, 0x7d, 0x89, - 0xaf, 0x0d, 0x1d, 0x1f, 0x85, 0x7a, 0xbb, 0x43, 0x6d, 0x04, 0x9b, 0x97, 0x8a, 0x7a, 0x4c, 0x27, - 0x52, 0x68, 0xd6, 0xfd, 0x09, 0x60, 0x61, 0xa0, 0x43, 0xeb, 0x07, 0x7c, 0x76, 0xf7, 0x66, 0xf8, - 0x7a, 0xad, 0x4b, 0xa1, 0x8d, 0xf7, 0x0f, 0xe3, 0xf7, 0x97, 0x70, 0xbf, 0xfc, 0x5e, 0x23, 0xb0, - 0x5a, 0x23, 0xf0, 0x7f, 0x8d, 0xc0, 0xaf, 0x0d, 0xca, 0xad, 0x36, 0x28, 0xf7, 0x67, 0x83, 0x72, - 0xdf, 0xdf, 0xdd, 0x37, 0xfe, 0xc5, 0xf9, 0x6e, 0xa6, 0xcf, 0x41, 0x8a, 0xd9, 0xbe, 0xbd, 0xb9, - 0x0d, 0x00, 0x00, 0xff, 0xff, 0x3f, 0xd8, 0x97, 0x75, 0xc1, 0x02, 0x00, 0x00, + // 263 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0x4a, 0x4c, 0xaa, + 0xcc, 0xc9, 0xcf, 0xd3, 0x4f, 0x2a, 0x49, 0x4e, 0xce, 0x48, 0x4d, 0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0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x69, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, + 0x7e, 0xae, 0x3e, 0xd4, 0xec, 0xe4, 0x8c, 0xc4, 0xcc, 0x3c, 0x18, 0x47, 0xbf, 0x02, 0x3d, 0x22, + 0x2b, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0x21, 0x6e, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xc2, + 0x5a, 0x56, 0xbd, 0xee, 0x01, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -320,60 +224,6 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ Metadata: "babylon/btccheckpoint/tx.proto", } -func (m *BTCSpvProof) 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 *BTCSpvProof) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BTCSpvProof) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ConfirmingBtcHeader != nil { - { - size := m.ConfirmingBtcHeader.Size() - i -= size - if _, err := m.ConfirmingBtcHeader.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if len(m.MerkleNodes) > 0 { - i -= len(m.MerkleNodes) - copy(dAtA[i:], m.MerkleNodes) - i = encodeVarintTx(dAtA, i, uint64(len(m.MerkleNodes))) - i-- - dAtA[i] = 0x1a - } - if m.BtcTransactionIndex != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.BtcTransactionIndex)) - i-- - dAtA[i] = 0x10 - } - if len(m.BtcTransaction) > 0 { - i -= len(m.BtcTransaction) - copy(dAtA[i:], m.BtcTransaction) - i = encodeVarintTx(dAtA, i, uint64(len(m.BtcTransaction))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *MsgInsertBTCSpvProof) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -452,30 +302,6 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *BTCSpvProof) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.BtcTransaction) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.BtcTransactionIndex != 0 { - n += 1 + sovTx(uint64(m.BtcTransactionIndex)) - } - l = len(m.MerkleNodes) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.ConfirmingBtcHeader != nil { - l = m.ConfirmingBtcHeader.Size() - n += 1 + l + sovTx(uint64(l)) - } - return n -} - func (m *MsgInsertBTCSpvProof) Size() (n int) { if m == nil { return 0 @@ -510,178 +336,6 @@ func sovTx(x uint64) (n int) { func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *BTCSpvProof) 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 ErrIntOverflowTx - } - 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: BTCSpvProof: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BTCSpvProof: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BtcTransaction", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(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.BtcTransaction = append(m.BtcTransaction[:0], dAtA[iNdEx:postIndex]...) - if m.BtcTransaction == nil { - m.BtcTransaction = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BtcTransactionIndex", wireType) - } - m.BtcTransactionIndex = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BtcTransactionIndex |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MerkleNodes", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(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.MerkleNodes = append(m.MerkleNodes[:0], dAtA[iNdEx:postIndex]...) - if m.MerkleNodes == nil { - m.MerkleNodes = []byte{} - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConfirmingBtcHeader", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(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 - } - var v github_com_babylonchain_babylon_types.BTCHeaderBytes - m.ConfirmingBtcHeader = &v - if err := m.ConfirmingBtcHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *MsgInsertBTCSpvProof) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/btccheckpoint/types/types.go b/x/btccheckpoint/types/types.go index 74877216e..66797339d 100644 --- a/x/btccheckpoint/types/types.go +++ b/x/btccheckpoint/types/types.go @@ -91,13 +91,11 @@ func (rsc *RawCheckpointSubmission) GetSubmissionKey() SubmissionKey { } } -func (rsc *RawCheckpointSubmission) GetSubmissionData(epochNum uint64) SubmissionData { - - tBytes := [][]byte{rsc.Proof1.TransactionBytes, rsc.Proof2.TransactionBytes} +func (rsc *RawCheckpointSubmission) GetSubmissionData(epochNum uint64, txsInfo []*TransactionInfo) SubmissionData { return SubmissionData{ - Submitter: rsc.Submitter.Bytes(), - Btctransaction: tBytes, - Epoch: epochNum, + Submitter: rsc.Submitter.Bytes(), + TxsInfo: txsInfo, + Epoch: epochNum, } } @@ -151,3 +149,11 @@ func (newSubmission *SubmissionBtcInfo) IsBetterThan(currentBestSubmission *Subm // latest transaction of the submissions return newSubmission.LatestTxIndex < currentBestSubmission.LatestTxIndex } + +func NewTransactionInfo(txKey *TransactionKey, txBytes []byte, proof []byte) *TransactionInfo { + return &TransactionInfo{ + Key: txKey, + Transaction: txBytes, + Proof: proof, + } +} diff --git a/x/zoneconcierge/keeper/grpc_query.go b/x/zoneconcierge/keeper/grpc_query.go index cd0a9e1a4..06e3fbd88 100644 --- a/x/zoneconcierge/keeper/grpc_query.go +++ b/x/zoneconcierge/keeper/grpc_query.go @@ -84,11 +84,11 @@ func (k Keeper) FinalizedChainInfo(c context.Context, req *types.QueryFinalizedC ed := k.btccKeeper.GetEpochData(ctx, finalizedEpoch) if ed.Status != btcctypes.Finalized { err := fmt.Errorf("epoch %d should have been finalized, but is in status %s", finalizedEpoch, ed.Status.String()) - panic(err) + panic(err) // this can only be a programming error } if len(ed.Key) == 0 { err := fmt.Errorf("finalized epoch %d should have at least 1 checkpoint submission", finalizedEpoch) - panic(err) + panic(err) // this can only be a programming error } bestSubmissionKey := ed.Key[0] // index of checkpoint tx on BTC @@ -122,9 +122,18 @@ func (k Keeper) FinalizedChainInfo(c context.Context, req *types.QueryFinalizedC // proof that the epoch is sealed resp.ProofEpochSealed, err = k.ProveEpochSealed(ctx, finalizedEpoch) + if err != nil { + return nil, err + } - // TODO: proof that the epoch's checkpoint is submitted to BTC - // i.e., a BTCSpvProof for the BtcSubmissionKey + // proof that the epoch's checkpoint is submitted to BTC + // i.e., the two `TransactionInfo`s for the checkpoint + bestSubmissionData := k.btccKeeper.GetSubmissionData(ctx, *bestSubmissionKey) + if bestSubmissionData == nil { + err := fmt.Errorf("the best submission key for epoch %d has no submission data", finalizedEpoch) + panic(err) // this can only be a programming error + } + resp.ProofEpochSubmitted = bestSubmissionData.TxsInfo return resp, nil } diff --git a/x/zoneconcierge/keeper/grpc_query_test.go b/x/zoneconcierge/keeper/grpc_query_test.go index 60828d6d8..671b22f87 100644 --- a/x/zoneconcierge/keeper/grpc_query_test.go +++ b/x/zoneconcierge/keeper/grpc_query_test.go @@ -114,6 +114,8 @@ func FuzzFinalizedChainInfo(f *testing.F) { RawCheckpoint: datagen.RandomRawCheckpointDataForEpoch(epochNum).ExpectedOpReturn, } btccKeeper.EXPECT().GetEpochData(gomock.Any(), gomock.Eq(epochNum)).Return(mockEpochData).AnyTimes() + mockSubmissionData := &btcctypes.SubmissionData{TxsInfo: []*btcctypes.TransactionInfo{}} + btccKeeper.EXPECT().GetSubmissionData(gomock.Any(), gomock.Any()).Return(mockSubmissionData).AnyTimes() // mock epoching keeper epochingKeeper := zctypes.NewMockEpochingKeeper(ctrl) epochingKeeper.EXPECT().GetEpoch(gomock.Any()).Return(&epochingtypes.Epoch{EpochNumber: epochNum}).AnyTimes() diff --git a/x/zoneconcierge/keeper/proof_tx_in_block_test.go b/x/zoneconcierge/keeper/proof_tx_in_block_test.go index 882ae6b39..9280d2f42 100644 --- a/x/zoneconcierge/keeper/proof_tx_in_block_test.go +++ b/x/zoneconcierge/keeper/proof_tx_in_block_test.go @@ -69,6 +69,7 @@ func TestProveTxInBlock(t *testing.T) { require.NoError(t, err) txHash := resp.Hash + testNetwork.WaitForNextBlock() testNetwork.WaitForNextBlock() proof, err := zcKeeper.ProveTxInBlock(ctx, txHash) diff --git a/x/zoneconcierge/types/expected_keepers.go b/x/zoneconcierge/types/expected_keepers.go index 9dd6ccc83..22509e907 100644 --- a/x/zoneconcierge/types/expected_keepers.go +++ b/x/zoneconcierge/types/expected_keepers.go @@ -68,6 +68,7 @@ type ScopedKeeper interface { type BtcCheckpointKeeper interface { GetEpochData(ctx sdk.Context, e uint64) *btcctypes.EpochData + GetSubmissionData(ctx sdk.Context, sk btcctypes.SubmissionKey) *btcctypes.SubmissionData } type CheckpointingKeeper interface { diff --git a/x/zoneconcierge/types/mocked_keepers.go b/x/zoneconcierge/types/mocked_keepers.go index 998365544..039deaf2a 100644 --- a/x/zoneconcierge/types/mocked_keepers.go +++ b/x/zoneconcierge/types/mocked_keepers.go @@ -515,6 +515,20 @@ func (mr *MockBtcCheckpointKeeperMockRecorder) GetEpochData(ctx, e interface{}) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetEpochData", reflect.TypeOf((*MockBtcCheckpointKeeper)(nil).GetEpochData), ctx, e) } +// GetSubmissionData mocks base method. +func (m *MockBtcCheckpointKeeper) GetSubmissionData(ctx types2.Context, sk types.SubmissionKey) *types.SubmissionData { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetSubmissionData", ctx, sk) + ret0, _ := ret[0].(*types.SubmissionData) + return ret0 +} + +// GetSubmissionData indicates an expected call of GetSubmissionData. +func (mr *MockBtcCheckpointKeeperMockRecorder) GetSubmissionData(ctx, sk interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSubmissionData", reflect.TypeOf((*MockBtcCheckpointKeeper)(nil).GetSubmissionData), ctx, sk) +} + // MockCheckpointingKeeper is a mock of CheckpointingKeeper interface. type MockCheckpointingKeeper struct { ctrl *gomock.Controller diff --git a/x/zoneconcierge/types/query.pb.go b/x/zoneconcierge/types/query.pb.go index 4f77f79e1..882605704 100644 --- a/x/zoneconcierge/types/query.pb.go +++ b/x/zoneconcierge/types/query.pb.go @@ -363,7 +363,8 @@ type QueryFinalizedChainInfoResponse struct { // proof_epoch_sealed is the proof that the epoch is sealed ProofEpochSealed *ProofEpochSealed `protobuf:"bytes,7,opt,name=proof_epoch_sealed,json=proofEpochSealed,proto3" json:"proof_epoch_sealed,omitempty"` // proof_epoch_submitted is the proof that the epoch's checkpoint is included in BTC ledger - ProofEpochSubmitted *types2.BTCSpvProof `protobuf:"bytes,8,opt,name=proof_epoch_submitted,json=proofEpochSubmitted,proto3" json:"proof_epoch_submitted,omitempty"` + // It is the two TransactionInfo in the best (i.e., earliest) checkpoint submission + ProofEpochSubmitted []*types2.TransactionInfo `protobuf:"bytes,8,rep,name=proof_epoch_submitted,json=proofEpochSubmitted,proto3" json:"proof_epoch_submitted,omitempty"` } func (m *QueryFinalizedChainInfoResponse) Reset() { *m = QueryFinalizedChainInfoResponse{} } @@ -448,7 +449,7 @@ func (m *QueryFinalizedChainInfoResponse) GetProofEpochSealed() *ProofEpochSeale return nil } -func (m *QueryFinalizedChainInfoResponse) GetProofEpochSubmitted() *types2.BTCSpvProof { +func (m *QueryFinalizedChainInfoResponse) GetProofEpochSubmitted() []*types2.TransactionInfo { if m != nil { return m.ProofEpochSubmitted } @@ -469,62 +470,62 @@ func init() { func init() { proto.RegisterFile("babylon/zoneconcierge/query.proto", fileDescriptor_2caab7ee15063236) } var fileDescriptor_2caab7ee15063236 = []byte{ - // 871 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xcf, 0x8f, 0xdb, 0x44, - 0x18, 0x5d, 0x6f, 0x9b, 0xed, 0x66, 0x10, 0x55, 0x99, 0xa6, 0xe0, 0xa6, 0xe0, 0x2e, 0x46, 0xc0, - 0x52, 0x81, 0x8d, 0x17, 0x55, 0xb0, 0x42, 0x42, 0x22, 0x0b, 0x48, 0x11, 0x15, 0x6d, 0xbd, 0xbb, - 0x12, 0x20, 0x24, 0xcb, 0x76, 0x26, 0x8e, 0xb5, 0xc9, 0x8c, 0xeb, 0x99, 0xb8, 0x49, 0x11, 0x17, - 0xfe, 0x01, 0x90, 0xb8, 0x70, 0xe7, 0xc0, 0x89, 0xff, 0xa3, 0x07, 0x0e, 0x95, 0xb8, 0x70, 0x42, - 0x68, 0x97, 0x3f, 0x04, 0xf9, 0x9b, 0xb1, 0x63, 0xe7, 0x07, 0x1b, 0xf6, 0x12, 0xd9, 0xf3, 0xbd, - 0xf7, 0xbe, 0xf7, 0x8d, 0x67, 0x5e, 0xd0, 0xab, 0x81, 0x1f, 0x4c, 0x87, 0x8c, 0xda, 0x4f, 0x18, - 0x25, 0x21, 0xa3, 0x61, 0x4c, 0xd2, 0x88, 0xd8, 0x8f, 0xc6, 0x24, 0x9d, 0x5a, 0x49, 0xca, 0x04, - 0xc3, 0xba, 0x82, 0x58, 0x35, 0x88, 0x95, 0x39, 0xed, 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e, 0x9c, 0x34, 0x09, 0x00, 0x00, + // 877 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xdd, 0x6e, 0xdc, 0x44, + 0x18, 0x8d, 0x93, 0x6e, 0x9a, 0x9d, 0x8a, 0xaa, 0x4c, 0xb7, 0xe0, 0x6e, 0xc1, 0x5d, 0x8c, 0x04, + 0xdb, 0x0a, 0x6c, 0x1c, 0x54, 0x41, 0x84, 0x84, 0x44, 0x0a, 0x48, 0x11, 0x15, 0x6d, 0xdd, 0x44, + 0x42, 0x08, 0x64, 0x8d, 0xbd, 0xb3, 0x8e, 0x95, 0xdd, 0x19, 0xd7, 0x33, 0xd9, 0xee, 0x16, 0x71, + 0xc3, 0x0b, 0x80, 0xc4, 0x0d, 0x6f, 0xd0, 0x2b, 0xde, 0xa3, 0x17, 0x5c, 0x54, 0xe2, 0x86, 0x2b, + 0x84, 0x12, 0x1e, 0x04, 0xf9, 0x9b, 0xb1, 0xd7, 0xde, 0x1f, 0xb2, 0xcd, 0xcd, 0xca, 0x9e, 0xef, + 0x9c, 0xf3, 0x9d, 0x6f, 0x3c, 0x73, 0x16, 0xbd, 0x15, 0x92, 0x70, 0x32, 0xe0, 0xcc, 0x7d, 0xca, + 0x19, 0x8d, 0x38, 0x8b, 0x12, 0x9a, 0xc5, 0xd4, 0x7d, 0x7c, 0x4c, 0xb3, 0x89, 0x93, 0x66, 0x5c, + 0x72, 0x6c, 0x6a, 0x88, 0x53, 0x83, 0x38, 0x23, 0xaf, 0xdd, 0x8a, 0x79, 0xcc, 0x01, 0xe4, 0xe6, + 0x4f, 0x0a, 0xdf, 0x7e, 0x23, 0xe6, 0x3c, 0x1e, 0x50, 0x97, 0xa4, 0x89, 0x4b, 0x18, 0xe3, 0x92, + 0xc8, 0x84, 0x33, 0x51, 0x54, 0x25, 0x65, 0x3d, 0x9a, 0x0d, 0x13, 0x26, 0x5d, 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, 0xde, 0xc8, 0xd3, 0xc1, 0x88, 0x7f, 0x33, 0x50, 0xb3, 0x4c, 0x17, 0xec, 0x9e, 0xd1, + 0x66, 0x36, 0xa0, 0xda, 0x1f, 0xac, 0x4e, 0x58, 0xdd, 0x1a, 0x5c, 0x54, 0x81, 0x9f, 0x15, 0xd6, + 0xe0, 0xe2, 0xac, 0x64, 0xad, 0x12, 0x28, 0xab, 0x59, 0xab, 0xa6, 0x85, 0xfd, 0x11, 0x58, 0xf3, + 0xb0, 0x7b, 0x86, 0x35, 0xb8, 0xf6, 0xee, 0x0f, 0x45, 0x5c, 0xfd, 0x88, 0xff, 0x30, 0x10, 0x9e, + 0x4f, 0x21, 0xfc, 0xf1, 0x19, 0x0e, 0x96, 0x86, 0x61, 0x7b, 0xe7, 0x1c, 0x4c, 0x3d, 0xc4, 0x67, + 0x30, 0xc4, 0x27, 0x78, 0x67, 0xf9, 0x10, 0x8b, 0x22, 0xb1, 0x32, 0xce, 0xee, 0xfd, 0xe7, 0x27, + 0x96, 0xf1, 0xe2, 0xc4, 0x32, 0xfe, 0x39, 0xb1, 0x8c, 0x5f, 0x4e, 0xad, 0xb5, 0x17, 0xa7, 0xd6, + 0xda, 0x5f, 0xa7, 0xd6, 0xda, 0xb7, 0x77, 0xe2, 0x44, 0x1e, 0x1e, 0x87, 0x4e, 0xc4, 0x87, 0x85, + 0x3c, 0xd0, 0xca, 0x5e, 0xe3, 0x99, 0x6e, 0x90, 0x0f, 0xe1, 0x26, 0xfc, 0xa7, 0x7e, 0xf8, 0x5f, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x39, 0x51, 0xfc, 0x9c, 0x38, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -959,17 +960,19 @@ func (m *QueryFinalizedChainInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int _ = i var l int _ = l - if m.ProofEpochSubmitted != nil { - { - size, err := m.ProofEpochSubmitted.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if len(m.ProofEpochSubmitted) > 0 { + for iNdEx := len(m.ProofEpochSubmitted) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ProofEpochSubmitted[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x42 } - i-- - dAtA[i] = 0x42 } if m.ProofEpochSealed != nil { { @@ -1189,9 +1192,11 @@ func (m *QueryFinalizedChainInfoResponse) Size() (n int) { l = m.ProofEpochSealed.Size() n += 1 + l + sovQuery(uint64(l)) } - if m.ProofEpochSubmitted != nil { - l = m.ProofEpochSubmitted.Size() - n += 1 + l + sovQuery(uint64(l)) + if len(m.ProofEpochSubmitted) > 0 { + for _, e := range m.ProofEpochSubmitted { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } } return n } @@ -2047,10 +2052,8 @@ func (m *QueryFinalizedChainInfoResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.ProofEpochSubmitted == nil { - m.ProofEpochSubmitted = &types2.BTCSpvProof{} - } - if err := m.ProofEpochSubmitted.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.ProofEpochSubmitted = append(m.ProofEpochSubmitted, &types2.TransactionInfo{}) + if err := m.ProofEpochSubmitted[len(m.ProofEpochSubmitted)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex