diff --git a/go.mod b/go.mod index eb9c45471..ccb2faab5 100644 --- a/go.mod +++ b/go.mod @@ -41,7 +41,7 @@ require ( github.com/smartcontractkit/chain-selectors v1.0.89 github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.10 github.com/smartcontractkit/chainlink-protos/billing/go v0.0.0-20251024234028-0988426d98f4 - github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260226130359-963f935e0396 + github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260316115110-5ec1a23c833c github.com/smartcontractkit/chainlink-protos/linking-service/go v0.0.0-20251002192024-d2ad9222409b github.com/smartcontractkit/chainlink-protos/node-platform v0.0.0-20260205130626-db2a2aab956b github.com/smartcontractkit/chainlink-protos/storage-service v0.3.0 diff --git a/go.sum b/go.sum index bfa8dbdd0..e1db3d497 100644 --- a/go.sum +++ b/go.sum @@ -332,8 +332,8 @@ github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.10 h1:FJAFgXS9 github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.10/go.mod h1:oiDa54M0FwxevWwyAX773lwdWvFYYlYHHQV1LQ5HpWY= github.com/smartcontractkit/chainlink-protos/billing/go v0.0.0-20251024234028-0988426d98f4 h1:GCzrxDWn3b7jFfEA+WiYRi8CKoegsayiDoJBCjYkneE= github.com/smartcontractkit/chainlink-protos/billing/go v0.0.0-20251024234028-0988426d98f4/go.mod h1:HHGeDUpAsPa0pmOx7wrByCitjQ0mbUxf0R9v+g67uCA= -github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260226130359-963f935e0396 h1:03tbcwjyIEjvHba1IWOj1sfThwebm2XNzyFHSuZtlWc= -github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260226130359-963f935e0396/go.mod h1:Jqt53s27Tr0jDl8mdBXg1xhu6F8Fci8JOuq43tgHOM8= +github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260316115110-5ec1a23c833c h1:nWVg6Urlulci1bVEG2lns25FBgOBEBkO8DlmbQMAdE0= +github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260316115110-5ec1a23c833c/go.mod h1:Jqt53s27Tr0jDl8mdBXg1xhu6F8Fci8JOuq43tgHOM8= github.com/smartcontractkit/chainlink-protos/linking-service/go v0.0.0-20251002192024-d2ad9222409b h1:QuI6SmQFK/zyUlVWEf0GMkiUYBPY4lssn26nKSd/bOM= github.com/smartcontractkit/chainlink-protos/linking-service/go v0.0.0-20251002192024-d2ad9222409b/go.mod h1:qSTSwX3cBP3FKQwQacdjArqv0g6QnukjV4XuzO6UyoY= github.com/smartcontractkit/chainlink-protos/node-platform v0.0.0-20260205130626-db2a2aab956b h1:36knUpKHHAZ86K4FGWXtx8i/EQftGdk2bqCoEu/Cha8= diff --git a/pkg/capabilities/v2/chain-capabilities/aptos/client.pb.go b/pkg/capabilities/v2/chain-capabilities/aptos/client.pb.go index 347028bdf..02b2f2548 100644 --- a/pkg/capabilities/v2/chain-capabilities/aptos/client.pb.go +++ b/pkg/capabilities/v2/chain-capabilities/aptos/client.pb.go @@ -213,6 +213,52 @@ func (TransactionVariant) EnumDescriptor() ([]byte, []int) { return file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescGZIP(), []int{2} } +type ReceiverContractExecutionStatus int32 + +const ( + ReceiverContractExecutionStatus_RECEIVER_CONTRACT_EXECUTION_STATUS_SUCCESS ReceiverContractExecutionStatus = 0 + ReceiverContractExecutionStatus_RECEIVER_CONTRACT_EXECUTION_STATUS_REVERTED ReceiverContractExecutionStatus = 1 +) + +// Enum value maps for ReceiverContractExecutionStatus. +var ( + ReceiverContractExecutionStatus_name = map[int32]string{ + 0: "RECEIVER_CONTRACT_EXECUTION_STATUS_SUCCESS", + 1: "RECEIVER_CONTRACT_EXECUTION_STATUS_REVERTED", + } + ReceiverContractExecutionStatus_value = map[string]int32{ + "RECEIVER_CONTRACT_EXECUTION_STATUS_SUCCESS": 0, + "RECEIVER_CONTRACT_EXECUTION_STATUS_REVERTED": 1, + } +) + +func (x ReceiverContractExecutionStatus) Enum() *ReceiverContractExecutionStatus { + p := new(ReceiverContractExecutionStatus) + *p = x + return p +} + +func (x ReceiverContractExecutionStatus) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ReceiverContractExecutionStatus) Descriptor() protoreflect.EnumDescriptor { + return file_capabilities_blockchain_aptos_v1alpha_client_proto_enumTypes[3].Descriptor() +} + +func (ReceiverContractExecutionStatus) Type() protoreflect.EnumType { + return &file_capabilities_blockchain_aptos_v1alpha_client_proto_enumTypes[3] +} + +func (x ReceiverContractExecutionStatus) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ReceiverContractExecutionStatus.Descriptor instead. +func (ReceiverContractExecutionStatus) EnumDescriptor() ([]byte, []int) { + return file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescGZIP(), []int{3} +} + type AccountAPTBalanceRequest struct { state protoimpl.MessageState `protogen:"open.v1"` Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // 32-byte address @@ -304,6 +350,7 @@ func (x *AccountAPTBalanceReply) GetValue() uint64 { type ViewRequest struct { state protoimpl.MessageState `protogen:"open.v1"` Payload *ViewPayload `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` + LedgerVersion *uint64 `protobuf:"varint,2,opt,name=ledger_version,json=ledgerVersion,proto3,oneof" json:"ledger_version,omitempty"` // nil means use latest ledger version unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -345,6 +392,13 @@ func (x *ViewRequest) GetPayload() *ViewPayload { return nil } +func (x *ViewRequest) GetLedgerVersion() uint64 { + if x != nil && x.LedgerVersion != nil { + return *x.LedgerVersion + } + return 0 +} + type ViewReply struct { state protoimpl.MessageState `protogen:"open.v1"` Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` @@ -1272,13 +1326,14 @@ func (x *WriteReportRequest) GetReport() *sdk.ReportResponse { } type WriteReportReply struct { - state protoimpl.MessageState `protogen:"open.v1"` - TxStatus TxStatus `protobuf:"varint,1,opt,name=tx_status,json=txStatus,proto3,enum=capabilities.blockchain.aptos.v1alpha.TxStatus" json:"tx_status,omitempty"` - TxHash *string `protobuf:"bytes,2,opt,name=tx_hash,json=txHash,proto3,oneof" json:"tx_hash,omitempty"` // transaction hash (hex string with 0x prefix) - TransactionFee *uint64 `protobuf:"varint,3,opt,name=transaction_fee,json=transactionFee,proto3,oneof" json:"transaction_fee,omitempty"` // gas used in octas - ErrorMessage *string `protobuf:"bytes,4,opt,name=error_message,json=errorMessage,proto3,oneof" json:"error_message,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + TxStatus TxStatus `protobuf:"varint,1,opt,name=tx_status,json=txStatus,proto3,enum=capabilities.blockchain.aptos.v1alpha.TxStatus" json:"tx_status,omitempty"` + ReceiverContractExecutionStatus *ReceiverContractExecutionStatus `protobuf:"varint,2,opt,name=receiver_contract_execution_status,json=receiverContractExecutionStatus,proto3,enum=capabilities.blockchain.aptos.v1alpha.ReceiverContractExecutionStatus,oneof" json:"receiver_contract_execution_status,omitempty"` + TxHash *string `protobuf:"bytes,3,opt,name=tx_hash,json=txHash,proto3,oneof" json:"tx_hash,omitempty"` // transaction hash (hex string with 0x prefix) + TransactionFee *uint64 `protobuf:"varint,4,opt,name=transaction_fee,json=transactionFee,proto3,oneof" json:"transaction_fee,omitempty"` // gas used in octas + ErrorMessage *string `protobuf:"bytes,5,opt,name=error_message,json=errorMessage,proto3,oneof" json:"error_message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *WriteReportReply) Reset() { @@ -1318,6 +1373,13 @@ func (x *WriteReportReply) GetTxStatus() TxStatus { return TxStatus_TX_STATUS_FATAL } +func (x *WriteReportReply) GetReceiverContractExecutionStatus() ReceiverContractExecutionStatus { + if x != nil && x.ReceiverContractExecutionStatus != nil { + return *x.ReceiverContractExecutionStatus + } + return ReceiverContractExecutionStatus_RECEIVER_CONTRACT_EXECUTION_STATUS_SUCCESS +} + func (x *WriteReportReply) GetTxHash() string { if x != nil && x.TxHash != nil { return *x.TxHash @@ -1347,9 +1409,11 @@ const file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDesc = "" + "\x18AccountAPTBalanceRequest\x12\x18\n" + "\aaddress\x18\x01 \x01(\fR\aaddress\".\n" + "\x16AccountAPTBalanceReply\x12\x14\n" + - "\x05value\x18\x01 \x01(\x04R\x05value\"[\n" + + "\x05value\x18\x01 \x01(\x04R\x05value\"\x9a\x01\n" + "\vViewRequest\x12L\n" + - "\apayload\x18\x01 \x01(\v22.capabilities.blockchain.aptos.v1alpha.ViewPayloadR\apayload\"\x1f\n" + + "\apayload\x18\x01 \x01(\v22.capabilities.blockchain.aptos.v1alpha.ViewPayloadR\apayload\x12*\n" + + "\x0eledger_version\x18\x02 \x01(\x04H\x00R\rledgerVersion\x88\x01\x01B\x11\n" + + "\x0f_ledger_version\"\x1f\n" + "\tViewReply\x12\x12\n" + "\x04data\x18\x01 \x01(\fR\x04data\"\xd3\x01\n" + "\vViewPayload\x12G\n" + @@ -1418,12 +1482,14 @@ const file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDesc = "" + "\n" + "gas_config\x18\x02 \x01(\v20.capabilities.blockchain.aptos.v1alpha.GasConfigH\x00R\tgasConfig\x88\x01\x01\x123\n" + "\x06report\x18\x03 \x01(\v2\x1b.sdk.v1alpha.ReportResponseR\x06reportB\r\n" + - "\v_gas_config\"\x88\x02\n" + + "\v_gas_config\"\xca\x03\n" + "\x10WriteReportReply\x12L\n" + - "\ttx_status\x18\x01 \x01(\x0e2/.capabilities.blockchain.aptos.v1alpha.TxStatusR\btxStatus\x12\x1c\n" + - "\atx_hash\x18\x02 \x01(\tH\x00R\x06txHash\x88\x01\x01\x12,\n" + - "\x0ftransaction_fee\x18\x03 \x01(\x04H\x01R\x0etransactionFee\x88\x01\x01\x12(\n" + - "\rerror_message\x18\x04 \x01(\tH\x02R\ferrorMessage\x88\x01\x01B\n" + + "\ttx_status\x18\x01 \x01(\x0e2/.capabilities.blockchain.aptos.v1alpha.TxStatusR\btxStatus\x12\x98\x01\n" + + "\"receiver_contract_execution_status\x18\x02 \x01(\x0e2F.capabilities.blockchain.aptos.v1alpha.ReceiverContractExecutionStatusH\x00R\x1freceiverContractExecutionStatus\x88\x01\x01\x12\x1c\n" + + "\atx_hash\x18\x03 \x01(\tH\x01R\x06txHash\x88\x01\x01\x12,\n" + + "\x0ftransaction_fee\x18\x04 \x01(\x04H\x02R\x0etransactionFee\x88\x01\x01\x12(\n" + + "\rerror_message\x18\x05 \x01(\tH\x03R\ferrorMessage\x88\x01\x01B%\n" + + "#_receiver_contract_execution_statusB\n" + "\n" + "\b_tx_hashB\x12\n" + "\x10_transaction_feeB\x10\n" + @@ -1454,7 +1520,10 @@ const file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDesc = "" + "\"TRANSACTION_VARIANT_BLOCK_EPILOGUE\x10\x04\x12(\n" + "$TRANSACTION_VARIANT_STATE_CHECKPOINT\x10\x05\x12!\n" + "\x1dTRANSACTION_VARIANT_VALIDATOR\x10\x06\x12\x1f\n" + - "\x1bTRANSACTION_VARIANT_UNKNOWN\x10\a2\xa2\x06\n" + + "\x1bTRANSACTION_VARIANT_UNKNOWN\x10\a*\x82\x01\n" + + "\x1fReceiverContractExecutionStatus\x12.\n" + + "*RECEIVER_CONTRACT_EXECUTION_STATUS_SUCCESS\x10\x00\x12/\n" + + "+RECEIVER_CONTRACT_EXECUTION_STATUS_REVERTED\x10\x012\xa2\x06\n" + "\x06Client\x12\x93\x01\n" + "\x11AccountAPTBalance\x12?.capabilities.blockchain.aptos.v1alpha.AccountAPTBalanceRequest\x1a=.capabilities.blockchain.aptos.v1alpha.AccountAPTBalanceReply\x12l\n" + "\x04View\x122.capabilities.blockchain.aptos.v1alpha.ViewRequest\x1a0.capabilities.blockchain.aptos.v1alpha.ViewReply\x12\x93\x01\n" + @@ -1480,68 +1549,70 @@ func file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescGZIP() []byt return file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDescData } -var file_capabilities_blockchain_aptos_v1alpha_client_proto_enumTypes = make([]protoimpl.EnumInfo, 3) +var file_capabilities_blockchain_aptos_v1alpha_client_proto_enumTypes = make([]protoimpl.EnumInfo, 4) var file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes = make([]protoimpl.MessageInfo, 20) var file_capabilities_blockchain_aptos_v1alpha_client_proto_goTypes = []any{ - (TxStatus)(0), // 0: capabilities.blockchain.aptos.v1alpha.TxStatus - (TypeTagKind)(0), // 1: capabilities.blockchain.aptos.v1alpha.TypeTagKind - (TransactionVariant)(0), // 2: capabilities.blockchain.aptos.v1alpha.TransactionVariant - (*AccountAPTBalanceRequest)(nil), // 3: capabilities.blockchain.aptos.v1alpha.AccountAPTBalanceRequest - (*AccountAPTBalanceReply)(nil), // 4: capabilities.blockchain.aptos.v1alpha.AccountAPTBalanceReply - (*ViewRequest)(nil), // 5: capabilities.blockchain.aptos.v1alpha.ViewRequest - (*ViewReply)(nil), // 6: capabilities.blockchain.aptos.v1alpha.ViewReply - (*ViewPayload)(nil), // 7: capabilities.blockchain.aptos.v1alpha.ViewPayload - (*ModuleID)(nil), // 8: capabilities.blockchain.aptos.v1alpha.ModuleID - (*TypeTag)(nil), // 9: capabilities.blockchain.aptos.v1alpha.TypeTag - (*VectorTag)(nil), // 10: capabilities.blockchain.aptos.v1alpha.VectorTag - (*StructTag)(nil), // 11: capabilities.blockchain.aptos.v1alpha.StructTag - (*GenericTag)(nil), // 12: capabilities.blockchain.aptos.v1alpha.GenericTag - (*TransactionByHashRequest)(nil), // 13: capabilities.blockchain.aptos.v1alpha.TransactionByHashRequest - (*TransactionByHashReply)(nil), // 14: capabilities.blockchain.aptos.v1alpha.TransactionByHashReply - (*Transaction)(nil), // 15: capabilities.blockchain.aptos.v1alpha.Transaction - (*AccountTransactionsRequest)(nil), // 16: capabilities.blockchain.aptos.v1alpha.AccountTransactionsRequest - (*AccountTransactionsReply)(nil), // 17: capabilities.blockchain.aptos.v1alpha.AccountTransactionsReply - (*SubmitTransactionRequest)(nil), // 18: capabilities.blockchain.aptos.v1alpha.SubmitTransactionRequest - (*SubmitTransactionReply)(nil), // 19: capabilities.blockchain.aptos.v1alpha.SubmitTransactionReply - (*GasConfig)(nil), // 20: capabilities.blockchain.aptos.v1alpha.GasConfig - (*WriteReportRequest)(nil), // 21: capabilities.blockchain.aptos.v1alpha.WriteReportRequest - (*WriteReportReply)(nil), // 22: capabilities.blockchain.aptos.v1alpha.WriteReportReply - (*sdk.ReportResponse)(nil), // 23: sdk.v1alpha.ReportResponse + (TxStatus)(0), // 0: capabilities.blockchain.aptos.v1alpha.TxStatus + (TypeTagKind)(0), // 1: capabilities.blockchain.aptos.v1alpha.TypeTagKind + (TransactionVariant)(0), // 2: capabilities.blockchain.aptos.v1alpha.TransactionVariant + (ReceiverContractExecutionStatus)(0), // 3: capabilities.blockchain.aptos.v1alpha.ReceiverContractExecutionStatus + (*AccountAPTBalanceRequest)(nil), // 4: capabilities.blockchain.aptos.v1alpha.AccountAPTBalanceRequest + (*AccountAPTBalanceReply)(nil), // 5: capabilities.blockchain.aptos.v1alpha.AccountAPTBalanceReply + (*ViewRequest)(nil), // 6: capabilities.blockchain.aptos.v1alpha.ViewRequest + (*ViewReply)(nil), // 7: capabilities.blockchain.aptos.v1alpha.ViewReply + (*ViewPayload)(nil), // 8: capabilities.blockchain.aptos.v1alpha.ViewPayload + (*ModuleID)(nil), // 9: capabilities.blockchain.aptos.v1alpha.ModuleID + (*TypeTag)(nil), // 10: capabilities.blockchain.aptos.v1alpha.TypeTag + (*VectorTag)(nil), // 11: capabilities.blockchain.aptos.v1alpha.VectorTag + (*StructTag)(nil), // 12: capabilities.blockchain.aptos.v1alpha.StructTag + (*GenericTag)(nil), // 13: capabilities.blockchain.aptos.v1alpha.GenericTag + (*TransactionByHashRequest)(nil), // 14: capabilities.blockchain.aptos.v1alpha.TransactionByHashRequest + (*TransactionByHashReply)(nil), // 15: capabilities.blockchain.aptos.v1alpha.TransactionByHashReply + (*Transaction)(nil), // 16: capabilities.blockchain.aptos.v1alpha.Transaction + (*AccountTransactionsRequest)(nil), // 17: capabilities.blockchain.aptos.v1alpha.AccountTransactionsRequest + (*AccountTransactionsReply)(nil), // 18: capabilities.blockchain.aptos.v1alpha.AccountTransactionsReply + (*SubmitTransactionRequest)(nil), // 19: capabilities.blockchain.aptos.v1alpha.SubmitTransactionRequest + (*SubmitTransactionReply)(nil), // 20: capabilities.blockchain.aptos.v1alpha.SubmitTransactionReply + (*GasConfig)(nil), // 21: capabilities.blockchain.aptos.v1alpha.GasConfig + (*WriteReportRequest)(nil), // 22: capabilities.blockchain.aptos.v1alpha.WriteReportRequest + (*WriteReportReply)(nil), // 23: capabilities.blockchain.aptos.v1alpha.WriteReportReply + (*sdk.ReportResponse)(nil), // 24: sdk.v1alpha.ReportResponse } var file_capabilities_blockchain_aptos_v1alpha_client_proto_depIdxs = []int32{ - 7, // 0: capabilities.blockchain.aptos.v1alpha.ViewRequest.payload:type_name -> capabilities.blockchain.aptos.v1alpha.ViewPayload - 8, // 1: capabilities.blockchain.aptos.v1alpha.ViewPayload.module:type_name -> capabilities.blockchain.aptos.v1alpha.ModuleID - 9, // 2: capabilities.blockchain.aptos.v1alpha.ViewPayload.arg_types:type_name -> capabilities.blockchain.aptos.v1alpha.TypeTag + 8, // 0: capabilities.blockchain.aptos.v1alpha.ViewRequest.payload:type_name -> capabilities.blockchain.aptos.v1alpha.ViewPayload + 9, // 1: capabilities.blockchain.aptos.v1alpha.ViewPayload.module:type_name -> capabilities.blockchain.aptos.v1alpha.ModuleID + 10, // 2: capabilities.blockchain.aptos.v1alpha.ViewPayload.arg_types:type_name -> capabilities.blockchain.aptos.v1alpha.TypeTag 1, // 3: capabilities.blockchain.aptos.v1alpha.TypeTag.kind:type_name -> capabilities.blockchain.aptos.v1alpha.TypeTagKind - 10, // 4: capabilities.blockchain.aptos.v1alpha.TypeTag.vector:type_name -> capabilities.blockchain.aptos.v1alpha.VectorTag - 11, // 5: capabilities.blockchain.aptos.v1alpha.TypeTag.struct:type_name -> capabilities.blockchain.aptos.v1alpha.StructTag - 12, // 6: capabilities.blockchain.aptos.v1alpha.TypeTag.generic:type_name -> capabilities.blockchain.aptos.v1alpha.GenericTag - 9, // 7: capabilities.blockchain.aptos.v1alpha.VectorTag.element_type:type_name -> capabilities.blockchain.aptos.v1alpha.TypeTag - 9, // 8: capabilities.blockchain.aptos.v1alpha.StructTag.type_params:type_name -> capabilities.blockchain.aptos.v1alpha.TypeTag - 15, // 9: capabilities.blockchain.aptos.v1alpha.TransactionByHashReply.transaction:type_name -> capabilities.blockchain.aptos.v1alpha.Transaction + 11, // 4: capabilities.blockchain.aptos.v1alpha.TypeTag.vector:type_name -> capabilities.blockchain.aptos.v1alpha.VectorTag + 12, // 5: capabilities.blockchain.aptos.v1alpha.TypeTag.struct:type_name -> capabilities.blockchain.aptos.v1alpha.StructTag + 13, // 6: capabilities.blockchain.aptos.v1alpha.TypeTag.generic:type_name -> capabilities.blockchain.aptos.v1alpha.GenericTag + 10, // 7: capabilities.blockchain.aptos.v1alpha.VectorTag.element_type:type_name -> capabilities.blockchain.aptos.v1alpha.TypeTag + 10, // 8: capabilities.blockchain.aptos.v1alpha.StructTag.type_params:type_name -> capabilities.blockchain.aptos.v1alpha.TypeTag + 16, // 9: capabilities.blockchain.aptos.v1alpha.TransactionByHashReply.transaction:type_name -> capabilities.blockchain.aptos.v1alpha.Transaction 2, // 10: capabilities.blockchain.aptos.v1alpha.Transaction.type:type_name -> capabilities.blockchain.aptos.v1alpha.TransactionVariant - 15, // 11: capabilities.blockchain.aptos.v1alpha.AccountTransactionsReply.transactions:type_name -> capabilities.blockchain.aptos.v1alpha.Transaction - 8, // 12: capabilities.blockchain.aptos.v1alpha.SubmitTransactionRequest.receiver_module_id:type_name -> capabilities.blockchain.aptos.v1alpha.ModuleID - 20, // 13: capabilities.blockchain.aptos.v1alpha.SubmitTransactionRequest.gas_config:type_name -> capabilities.blockchain.aptos.v1alpha.GasConfig + 16, // 11: capabilities.blockchain.aptos.v1alpha.AccountTransactionsReply.transactions:type_name -> capabilities.blockchain.aptos.v1alpha.Transaction + 9, // 12: capabilities.blockchain.aptos.v1alpha.SubmitTransactionRequest.receiver_module_id:type_name -> capabilities.blockchain.aptos.v1alpha.ModuleID + 21, // 13: capabilities.blockchain.aptos.v1alpha.SubmitTransactionRequest.gas_config:type_name -> capabilities.blockchain.aptos.v1alpha.GasConfig 0, // 14: capabilities.blockchain.aptos.v1alpha.SubmitTransactionReply.tx_status:type_name -> capabilities.blockchain.aptos.v1alpha.TxStatus - 20, // 15: capabilities.blockchain.aptos.v1alpha.WriteReportRequest.gas_config:type_name -> capabilities.blockchain.aptos.v1alpha.GasConfig - 23, // 16: capabilities.blockchain.aptos.v1alpha.WriteReportRequest.report:type_name -> sdk.v1alpha.ReportResponse + 21, // 15: capabilities.blockchain.aptos.v1alpha.WriteReportRequest.gas_config:type_name -> capabilities.blockchain.aptos.v1alpha.GasConfig + 24, // 16: capabilities.blockchain.aptos.v1alpha.WriteReportRequest.report:type_name -> sdk.v1alpha.ReportResponse 0, // 17: capabilities.blockchain.aptos.v1alpha.WriteReportReply.tx_status:type_name -> capabilities.blockchain.aptos.v1alpha.TxStatus - 3, // 18: capabilities.blockchain.aptos.v1alpha.Client.AccountAPTBalance:input_type -> capabilities.blockchain.aptos.v1alpha.AccountAPTBalanceRequest - 5, // 19: capabilities.blockchain.aptos.v1alpha.Client.View:input_type -> capabilities.blockchain.aptos.v1alpha.ViewRequest - 13, // 20: capabilities.blockchain.aptos.v1alpha.Client.TransactionByHash:input_type -> capabilities.blockchain.aptos.v1alpha.TransactionByHashRequest - 16, // 21: capabilities.blockchain.aptos.v1alpha.Client.AccountTransactions:input_type -> capabilities.blockchain.aptos.v1alpha.AccountTransactionsRequest - 21, // 22: capabilities.blockchain.aptos.v1alpha.Client.WriteReport:input_type -> capabilities.blockchain.aptos.v1alpha.WriteReportRequest - 4, // 23: capabilities.blockchain.aptos.v1alpha.Client.AccountAPTBalance:output_type -> capabilities.blockchain.aptos.v1alpha.AccountAPTBalanceReply - 6, // 24: capabilities.blockchain.aptos.v1alpha.Client.View:output_type -> capabilities.blockchain.aptos.v1alpha.ViewReply - 14, // 25: capabilities.blockchain.aptos.v1alpha.Client.TransactionByHash:output_type -> capabilities.blockchain.aptos.v1alpha.TransactionByHashReply - 17, // 26: capabilities.blockchain.aptos.v1alpha.Client.AccountTransactions:output_type -> capabilities.blockchain.aptos.v1alpha.AccountTransactionsReply - 22, // 27: capabilities.blockchain.aptos.v1alpha.Client.WriteReport:output_type -> capabilities.blockchain.aptos.v1alpha.WriteReportReply - 23, // [23:28] is the sub-list for method output_type - 18, // [18:23] is the sub-list for method input_type - 18, // [18:18] is the sub-list for extension type_name - 18, // [18:18] is the sub-list for extension extendee - 0, // [0:18] is the sub-list for field type_name + 3, // 18: capabilities.blockchain.aptos.v1alpha.WriteReportReply.receiver_contract_execution_status:type_name -> capabilities.blockchain.aptos.v1alpha.ReceiverContractExecutionStatus + 4, // 19: capabilities.blockchain.aptos.v1alpha.Client.AccountAPTBalance:input_type -> capabilities.blockchain.aptos.v1alpha.AccountAPTBalanceRequest + 6, // 20: capabilities.blockchain.aptos.v1alpha.Client.View:input_type -> capabilities.blockchain.aptos.v1alpha.ViewRequest + 14, // 21: capabilities.blockchain.aptos.v1alpha.Client.TransactionByHash:input_type -> capabilities.blockchain.aptos.v1alpha.TransactionByHashRequest + 17, // 22: capabilities.blockchain.aptos.v1alpha.Client.AccountTransactions:input_type -> capabilities.blockchain.aptos.v1alpha.AccountTransactionsRequest + 22, // 23: capabilities.blockchain.aptos.v1alpha.Client.WriteReport:input_type -> capabilities.blockchain.aptos.v1alpha.WriteReportRequest + 5, // 24: capabilities.blockchain.aptos.v1alpha.Client.AccountAPTBalance:output_type -> capabilities.blockchain.aptos.v1alpha.AccountAPTBalanceReply + 7, // 25: capabilities.blockchain.aptos.v1alpha.Client.View:output_type -> capabilities.blockchain.aptos.v1alpha.ViewReply + 15, // 26: capabilities.blockchain.aptos.v1alpha.Client.TransactionByHash:output_type -> capabilities.blockchain.aptos.v1alpha.TransactionByHashReply + 18, // 27: capabilities.blockchain.aptos.v1alpha.Client.AccountTransactions:output_type -> capabilities.blockchain.aptos.v1alpha.AccountTransactionsReply + 23, // 28: capabilities.blockchain.aptos.v1alpha.Client.WriteReport:output_type -> capabilities.blockchain.aptos.v1alpha.WriteReportReply + 24, // [24:29] is the sub-list for method output_type + 19, // [19:24] is the sub-list for method input_type + 19, // [19:19] is the sub-list for extension type_name + 19, // [19:19] is the sub-list for extension extendee + 0, // [0:19] is the sub-list for field type_name } func init() { file_capabilities_blockchain_aptos_v1alpha_client_proto_init() } @@ -1549,6 +1620,7 @@ func file_capabilities_blockchain_aptos_v1alpha_client_proto_init() { if File_capabilities_blockchain_aptos_v1alpha_client_proto != nil { return } + file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[2].OneofWrappers = []any{} file_capabilities_blockchain_aptos_v1alpha_client_proto_msgTypes[6].OneofWrappers = []any{ (*TypeTag_Vector)(nil), (*TypeTag_Struct)(nil), @@ -1565,7 +1637,7 @@ func file_capabilities_blockchain_aptos_v1alpha_client_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDesc), len(file_capabilities_blockchain_aptos_v1alpha_client_proto_rawDesc)), - NumEnums: 3, + NumEnums: 4, NumMessages: 20, NumExtensions: 0, NumServices: 1, diff --git a/pkg/capabilities/v2/chain-capabilities/evm/client.pb.go b/pkg/capabilities/v2/chain-capabilities/evm/client.pb.go index a4327ae5c..81d2cc967 100644 --- a/pkg/capabilities/v2/chain-capabilities/evm/client.pb.go +++ b/pkg/capabilities/v2/chain-capabilities/evm/client.pb.go @@ -1791,7 +1791,7 @@ const file_capabilities_blockchain_evm_v1alpha_client_proto_rawDesc = "" + "\bTxStatus\x12\x13\n" + "\x0fTX_STATUS_FATAL\x10\x00\x12\x16\n" + "\x12TX_STATUS_REVERTED\x10\x01\x12\x15\n" + - "\x11TX_STATUS_SUCCESS\x10\x022\xcb\x11\n" + + "\x11TX_STATUS_SUCCESS\x10\x022\x91\x15\n" + "\x06Client\x12\x80\x01\n" + "\fCallContract\x128.capabilities.blockchain.evm.v1alpha.CallContractRequest\x1a6.capabilities.blockchain.evm.v1alpha.CallContractReply\x12z\n" + "\n" + @@ -1803,8 +1803,8 @@ const file_capabilities_blockchain_evm_v1alpha_client_proto_rawDesc = "" + "\x0eHeaderByNumber\x12:.capabilities.blockchain.evm.v1alpha.HeaderByNumberRequest\x1a8.capabilities.blockchain.evm.v1alpha.HeaderByNumberReply\x12v\n" + "\n" + "LogTrigger\x12<.capabilities.blockchain.evm.v1alpha.FilterLogTriggerRequest\x1a(.capabilities.blockchain.evm.v1alpha.Log0\x01\x12}\n" + - "\vWriteReport\x127.capabilities.blockchain.evm.v1alpha.WriteReportRequest\x1a5.capabilities.blockchain.evm.v1alpha.WriteReportReply\x1a\x90\b\x82\xb5\x18\x8b\b\b\x01\x12\tevm@1.0.0\x1a\xfb\a\n" + - "\rChainSelector\x12\xe9\a\x12\xe6\a\n" + + "\vWriteReport\x127.capabilities.blockchain.evm.v1alpha.WriteReportRequest\x1a5.capabilities.blockchain.evm.v1alpha.WriteReportReply\x1a\xd6\v\x82\xb5\x18\xd1\v\b\x01\x12\tevm@1.0.0\x1a\xc1\v\n" + + "\rChainSelector\x12\xaf\v\x12\xac\v\n" + "$\n" + "\x17apechain-testnet-curtis\x10\xc1ô\xf8\x8dĒ\xb2\x89\x01\n" + "\x17\n" + @@ -1817,6 +1817,10 @@ const file_capabilities_blockchain_evm_v1alpha_client_proto_rawDesc = "" + "\x1bbinance_smart_chain-mainnet\x10\xcf\xf7\x94\xf1\xd8핸\x9d\x01\n" + "(\n" + "\x1bbinance_smart_chain-testnet\x10\xfb\xad\xbe\x9c\x80\xae䊸\x01\n" + + "\x1a\n" + + "\x0ecronos-testnet\x10\xfd\xd9\xee\xad\xe0\xde\xda\xc8)\n" + + "\"\n" + + "\x15dtcc-testnet-andesite\x10҃\xe3Й\x96\xe5\xa4\xd7\x01\n" + "\x1c\n" + "\x10ethereum-mainnet\x10\x95\xf6\xf1\xe4ϲ\xa6\xc2E\n" + "'\n" + @@ -1828,6 +1832,8 @@ const file_capabilities_blockchain_evm_v1alpha_client_proto_rawDesc = "" + ")\n" + "\x1dethereum-mainnet-worldchain-1\x10\x87ﺷŶ¸\x1c\n" + "%\n" + + "\x19ethereum-mainnet-xlayer-1\x10\x96\xa5\xfc\x9c\xa6\xa8\xef\xed)\n" + + "%\n" + "\x19ethereum-mainnet-zksync-1\x10\x94\xee\x97\xd9\xed\xb4\xb1\xd7\x15\n" + "%\n" + "\x18ethereum-testnet-sepolia\x10ٵ\xe4\xce\xfc\xc9\xee\xa0\xde\x01\n" + @@ -1837,8 +1843,14 @@ const file_capabilities_blockchain_evm_v1alpha_client_proto_rawDesc = "" + "\x1fethereum-testnet-sepolia-base-1\x10\xb8ʹ\xef\xf6\x90\xaeȏ\x01\n" + ",\n" + " ethereum-testnet-sepolia-linea-1\x10\xeb\xaa\xd4\xfe\x82\xf9\xe6\xafO\n" + + "-\n" + + "!ethereum-testnet-sepolia-mantle-1\x10\xd5Ƹ\xee\xcd\xf6\xf2\xa6r\n" + "/\n" + "#ethereum-testnet-sepolia-optimism-1\x10\x9f\x86š\xbe\xd8\xc3\xc0H\n" + + "-\n" + + "!ethereum-testnet-sepolia-scroll-1\x10\x8b鴾ۺ\xed\xd1\x1f\n" + + "0\n" + + "#ethereum-testnet-sepolia-unichain-1\x10\xb4\xde\xfe\xe0엩\x96\xc4\x01\n" + "1\n" + "%ethereum-testnet-sepolia-worldchain-1\x10\xba\xdf\xe0\xc5ǩ\xf3\xc5I\n" + "-\n" + @@ -1848,7 +1860,15 @@ const file_capabilities_blockchain_evm_v1alpha_client_proto_rawDesc = "" + " \n" + "\x13ink-testnet-sepolia\x10\xe8\xf4\xa7\xa5\xf3\xe6\x96\xc0\x87\x01\n" + "\x19\n" + + "\rjovay-mainnet\x10\xb5\xc3Ě\xa1\x80ߒ\x15\n" + + "\x19\n" + "\rjovay-testnet\x10\xe4ϊ\x84\u07b2ގ\r\n" + + "\x1e\n" + + "\x11megaeth-testnet-2\x10\xe3\x8dވ\xb1\x8f\xfd\x93\xfd\x01\n" + + "$\n" + + "\x17pharos-atlantic-testnet\x10̙\xed\xe0μ\xaf\xb4\xdf\x01\n" + + "\x1a\n" + + "\x0epharos-mainnet\x10\xc8\xc1\x87\x9e\xf5\xef͡l\n" + "\x1a\n" + "\x0eplasma-testnet\x10՛\xbf\xa5ô\x99\x877\n" + "\x1b\n" + @@ -1856,7 +1876,13 @@ const file_capabilities_blockchain_evm_v1alpha_client_proto_rawDesc = "" + "!\n" + "\x14polygon-testnet-amoy\x10͏\xd6\xdf\xf1ǐ\xfa\xe1\x01\n" + "$\n" + - "\x18private-testnet-andesite\x10Ԧ\x98\xa5\xc1\x8f\xdc\xfc_b\x06proto3" + "\x18private-testnet-andesite\x10Ԧ\x98\xa5\xc1\x8f\xdc\xfc_\n" + + "\x19\n" + + "\rsonic-testnet\x10Ȉ\xfbԴ\xc6\xfa\xbc\x18\n" + + "\x18\n" + + "\vtac-testnet\x10\xd5ۍ\xe3\xfb\x9f\x93׃\x01\n" + + "\x1b\n" + + "\x0exlayer-testnet\x10ɾ\xa1\xb4\xad̼ݍ\x01b\x06proto3" var ( file_capabilities_blockchain_evm_v1alpha_client_proto_rawDescOnce sync.Once diff --git a/pkg/capabilities/v2/chain-capabilities/solana/generate.go b/pkg/capabilities/v2/chain-capabilities/solana/generate.go index 9cdf1a6b5..c84392320 100644 --- a/pkg/capabilities/v2/chain-capabilities/solana/generate.go +++ b/pkg/capabilities/v2/chain-capabilities/solana/generate.go @@ -1,2 +1,4 @@ -//go:generate go run ../../gen --pkg=github.com/smartcontractkit/chainlink-common/pkg/capabilities/v2/chain-capabilities/solana --file=capabilities/blockchain/solana/v1alpha/client.proto +// TODO(CRE-): Re-enable Solana proto regeneration once chainlink-protos/cre/go +// embeds capabilities/blockchain/solana/v1alpha/client.proto again. +//go:generate echo "skipping solana proto regen: source proto not available in chainlink-protos/cre/go" package solana diff --git a/pkg/chains/aptos/aptos.pb.go b/pkg/chains/aptos/aptos.pb.go index 1578de42c..96c0868dd 100644 --- a/pkg/chains/aptos/aptos.pb.go +++ b/pkg/chains/aptos/aptos.pb.go @@ -210,6 +210,86 @@ func (TxStatus) EnumDescriptor() ([]byte, []int) { return file_aptos_proto_rawDescGZIP(), []int{2} } +type LedgerVersionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LedgerVersionRequest) Reset() { + *x = LedgerVersionRequest{} + mi := &file_aptos_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LedgerVersionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LedgerVersionRequest) ProtoMessage() {} + +func (x *LedgerVersionRequest) ProtoReflect() protoreflect.Message { + mi := &file_aptos_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LedgerVersionRequest.ProtoReflect.Descriptor instead. +func (*LedgerVersionRequest) Descriptor() ([]byte, []int) { + return file_aptos_proto_rawDescGZIP(), []int{0} +} + +type LedgerVersionReply struct { + state protoimpl.MessageState `protogen:"open.v1"` + LedgerVersion uint64 `protobuf:"varint,1,opt,name=ledger_version,json=ledgerVersion,proto3" json:"ledger_version,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LedgerVersionReply) Reset() { + *x = LedgerVersionReply{} + mi := &file_aptos_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LedgerVersionReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LedgerVersionReply) ProtoMessage() {} + +func (x *LedgerVersionReply) ProtoReflect() protoreflect.Message { + mi := &file_aptos_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LedgerVersionReply.ProtoReflect.Descriptor instead. +func (*LedgerVersionReply) Descriptor() ([]byte, []int) { + return file_aptos_proto_rawDescGZIP(), []int{1} +} + +func (x *LedgerVersionReply) GetLedgerVersion() uint64 { + if x != nil { + return x.LedgerVersion + } + return 0 +} + type AccountAPTBalanceRequest struct { state protoimpl.MessageState `protogen:"open.v1"` Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // 32-byte address @@ -219,7 +299,7 @@ type AccountAPTBalanceRequest struct { func (x *AccountAPTBalanceRequest) Reset() { *x = AccountAPTBalanceRequest{} - mi := &file_aptos_proto_msgTypes[0] + mi := &file_aptos_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -231,7 +311,7 @@ func (x *AccountAPTBalanceRequest) String() string { func (*AccountAPTBalanceRequest) ProtoMessage() {} func (x *AccountAPTBalanceRequest) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[0] + mi := &file_aptos_proto_msgTypes[2] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -244,7 +324,7 @@ func (x *AccountAPTBalanceRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use AccountAPTBalanceRequest.ProtoReflect.Descriptor instead. func (*AccountAPTBalanceRequest) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{0} + return file_aptos_proto_rawDescGZIP(), []int{2} } func (x *AccountAPTBalanceRequest) GetAddress() []byte { @@ -263,7 +343,7 @@ type AccountAPTBalanceReply struct { func (x *AccountAPTBalanceReply) Reset() { *x = AccountAPTBalanceReply{} - mi := &file_aptos_proto_msgTypes[1] + mi := &file_aptos_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -275,7 +355,7 @@ func (x *AccountAPTBalanceReply) String() string { func (*AccountAPTBalanceReply) ProtoMessage() {} func (x *AccountAPTBalanceReply) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[1] + mi := &file_aptos_proto_msgTypes[3] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -288,7 +368,7 @@ func (x *AccountAPTBalanceReply) ProtoReflect() protoreflect.Message { // Deprecated: Use AccountAPTBalanceReply.ProtoReflect.Descriptor instead. func (*AccountAPTBalanceReply) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{1} + return file_aptos_proto_rawDescGZIP(), []int{3} } func (x *AccountAPTBalanceReply) GetValue() uint64 { @@ -301,13 +381,14 @@ func (x *AccountAPTBalanceReply) GetValue() uint64 { type ViewRequest struct { state protoimpl.MessageState `protogen:"open.v1"` Payload *ViewPayload `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` + LedgerVersion *uint64 `protobuf:"varint,2,opt,name=ledger_version,json=ledgerVersion,proto3,oneof" json:"ledger_version,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *ViewRequest) Reset() { *x = ViewRequest{} - mi := &file_aptos_proto_msgTypes[2] + mi := &file_aptos_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -319,7 +400,7 @@ func (x *ViewRequest) String() string { func (*ViewRequest) ProtoMessage() {} func (x *ViewRequest) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[2] + mi := &file_aptos_proto_msgTypes[4] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -332,7 +413,7 @@ func (x *ViewRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ViewRequest.ProtoReflect.Descriptor instead. func (*ViewRequest) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{2} + return file_aptos_proto_rawDescGZIP(), []int{4} } func (x *ViewRequest) GetPayload() *ViewPayload { @@ -342,6 +423,13 @@ func (x *ViewRequest) GetPayload() *ViewPayload { return nil } +func (x *ViewRequest) GetLedgerVersion() uint64 { + if x != nil && x.LedgerVersion != nil { + return *x.LedgerVersion + } + return 0 +} + type ViewReply struct { state protoimpl.MessageState `protogen:"open.v1"` Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` @@ -351,7 +439,7 @@ type ViewReply struct { func (x *ViewReply) Reset() { *x = ViewReply{} - mi := &file_aptos_proto_msgTypes[3] + mi := &file_aptos_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -363,7 +451,7 @@ func (x *ViewReply) String() string { func (*ViewReply) ProtoMessage() {} func (x *ViewReply) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[3] + mi := &file_aptos_proto_msgTypes[5] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -376,7 +464,7 @@ func (x *ViewReply) ProtoReflect() protoreflect.Message { // Deprecated: Use ViewReply.ProtoReflect.Descriptor instead. func (*ViewReply) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{3} + return file_aptos_proto_rawDescGZIP(), []int{5} } func (x *ViewReply) GetData() []byte { @@ -398,7 +486,7 @@ type ViewPayload struct { func (x *ViewPayload) Reset() { *x = ViewPayload{} - mi := &file_aptos_proto_msgTypes[4] + mi := &file_aptos_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -410,7 +498,7 @@ func (x *ViewPayload) String() string { func (*ViewPayload) ProtoMessage() {} func (x *ViewPayload) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[4] + mi := &file_aptos_proto_msgTypes[6] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -423,7 +511,7 @@ func (x *ViewPayload) ProtoReflect() protoreflect.Message { // Deprecated: Use ViewPayload.ProtoReflect.Descriptor instead. func (*ViewPayload) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{4} + return file_aptos_proto_rawDescGZIP(), []int{6} } func (x *ViewPayload) GetModule() *ModuleID { @@ -464,7 +552,7 @@ type ModuleID struct { func (x *ModuleID) Reset() { *x = ModuleID{} - mi := &file_aptos_proto_msgTypes[5] + mi := &file_aptos_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -476,7 +564,7 @@ func (x *ModuleID) String() string { func (*ModuleID) ProtoMessage() {} func (x *ModuleID) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[5] + mi := &file_aptos_proto_msgTypes[7] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -489,7 +577,7 @@ func (x *ModuleID) ProtoReflect() protoreflect.Message { // Deprecated: Use ModuleID.ProtoReflect.Descriptor instead. func (*ModuleID) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{5} + return file_aptos_proto_rawDescGZIP(), []int{7} } func (x *ModuleID) GetAddress() []byte { @@ -521,7 +609,7 @@ type TypeTag struct { func (x *TypeTag) Reset() { *x = TypeTag{} - mi := &file_aptos_proto_msgTypes[6] + mi := &file_aptos_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -533,7 +621,7 @@ func (x *TypeTag) String() string { func (*TypeTag) ProtoMessage() {} func (x *TypeTag) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[6] + mi := &file_aptos_proto_msgTypes[8] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -546,7 +634,7 @@ func (x *TypeTag) ProtoReflect() protoreflect.Message { // Deprecated: Use TypeTag.ProtoReflect.Descriptor instead. func (*TypeTag) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{6} + return file_aptos_proto_rawDescGZIP(), []int{8} } func (x *TypeTag) GetKind() TypeTagKind { @@ -621,7 +709,7 @@ type VectorTag struct { func (x *VectorTag) Reset() { *x = VectorTag{} - mi := &file_aptos_proto_msgTypes[7] + mi := &file_aptos_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -633,7 +721,7 @@ func (x *VectorTag) String() string { func (*VectorTag) ProtoMessage() {} func (x *VectorTag) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[7] + mi := &file_aptos_proto_msgTypes[9] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -646,7 +734,7 @@ func (x *VectorTag) ProtoReflect() protoreflect.Message { // Deprecated: Use VectorTag.ProtoReflect.Descriptor instead. func (*VectorTag) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{7} + return file_aptos_proto_rawDescGZIP(), []int{9} } func (x *VectorTag) GetElementType() *TypeTag { @@ -668,7 +756,7 @@ type StructTag struct { func (x *StructTag) Reset() { *x = StructTag{} - mi := &file_aptos_proto_msgTypes[8] + mi := &file_aptos_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -680,7 +768,7 @@ func (x *StructTag) String() string { func (*StructTag) ProtoMessage() {} func (x *StructTag) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[8] + mi := &file_aptos_proto_msgTypes[10] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -693,7 +781,7 @@ func (x *StructTag) ProtoReflect() protoreflect.Message { // Deprecated: Use StructTag.ProtoReflect.Descriptor instead. func (*StructTag) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{8} + return file_aptos_proto_rawDescGZIP(), []int{10} } func (x *StructTag) GetAddress() []byte { @@ -733,7 +821,7 @@ type GenericTag struct { func (x *GenericTag) Reset() { *x = GenericTag{} - mi := &file_aptos_proto_msgTypes[9] + mi := &file_aptos_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -745,7 +833,7 @@ func (x *GenericTag) String() string { func (*GenericTag) ProtoMessage() {} func (x *GenericTag) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[9] + mi := &file_aptos_proto_msgTypes[11] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -758,7 +846,7 @@ func (x *GenericTag) ProtoReflect() protoreflect.Message { // Deprecated: Use GenericTag.ProtoReflect.Descriptor instead. func (*GenericTag) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{9} + return file_aptos_proto_rawDescGZIP(), []int{11} } func (x *GenericTag) GetIndex() uint32 { @@ -777,7 +865,7 @@ type TransactionByHashRequest struct { func (x *TransactionByHashRequest) Reset() { *x = TransactionByHashRequest{} - mi := &file_aptos_proto_msgTypes[10] + mi := &file_aptos_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -789,7 +877,7 @@ func (x *TransactionByHashRequest) String() string { func (*TransactionByHashRequest) ProtoMessage() {} func (x *TransactionByHashRequest) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[10] + mi := &file_aptos_proto_msgTypes[12] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -802,7 +890,7 @@ func (x *TransactionByHashRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use TransactionByHashRequest.ProtoReflect.Descriptor instead. func (*TransactionByHashRequest) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{10} + return file_aptos_proto_rawDescGZIP(), []int{12} } func (x *TransactionByHashRequest) GetHash() string { @@ -821,7 +909,7 @@ type TransactionByHashReply struct { func (x *TransactionByHashReply) Reset() { *x = TransactionByHashReply{} - mi := &file_aptos_proto_msgTypes[11] + mi := &file_aptos_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -833,7 +921,7 @@ func (x *TransactionByHashReply) String() string { func (*TransactionByHashReply) ProtoMessage() {} func (x *TransactionByHashReply) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[11] + mi := &file_aptos_proto_msgTypes[13] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -846,7 +934,7 @@ func (x *TransactionByHashReply) ProtoReflect() protoreflect.Message { // Deprecated: Use TransactionByHashReply.ProtoReflect.Descriptor instead. func (*TransactionByHashReply) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{11} + return file_aptos_proto_rawDescGZIP(), []int{13} } func (x *TransactionByHashReply) GetTransaction() *Transaction { @@ -869,7 +957,7 @@ type Transaction struct { func (x *Transaction) Reset() { *x = Transaction{} - mi := &file_aptos_proto_msgTypes[12] + mi := &file_aptos_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -881,7 +969,7 @@ func (x *Transaction) String() string { func (*Transaction) ProtoMessage() {} func (x *Transaction) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[12] + mi := &file_aptos_proto_msgTypes[14] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -894,7 +982,7 @@ func (x *Transaction) ProtoReflect() protoreflect.Message { // Deprecated: Use Transaction.ProtoReflect.Descriptor instead. func (*Transaction) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{12} + return file_aptos_proto_rawDescGZIP(), []int{14} } func (x *Transaction) GetType() TransactionVariant { @@ -943,7 +1031,7 @@ type AccountTransactionsRequest struct { func (x *AccountTransactionsRequest) Reset() { *x = AccountTransactionsRequest{} - mi := &file_aptos_proto_msgTypes[13] + mi := &file_aptos_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -955,7 +1043,7 @@ func (x *AccountTransactionsRequest) String() string { func (*AccountTransactionsRequest) ProtoMessage() {} func (x *AccountTransactionsRequest) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[13] + mi := &file_aptos_proto_msgTypes[15] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -968,7 +1056,7 @@ func (x *AccountTransactionsRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use AccountTransactionsRequest.ProtoReflect.Descriptor instead. func (*AccountTransactionsRequest) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{13} + return file_aptos_proto_rawDescGZIP(), []int{15} } func (x *AccountTransactionsRequest) GetAddress() []byte { @@ -1001,7 +1089,7 @@ type AccountTransactionsReply struct { func (x *AccountTransactionsReply) Reset() { *x = AccountTransactionsReply{} - mi := &file_aptos_proto_msgTypes[14] + mi := &file_aptos_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1013,7 +1101,7 @@ func (x *AccountTransactionsReply) String() string { func (*AccountTransactionsReply) ProtoMessage() {} func (x *AccountTransactionsReply) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[14] + mi := &file_aptos_proto_msgTypes[16] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1026,7 +1114,7 @@ func (x *AccountTransactionsReply) ProtoReflect() protoreflect.Message { // Deprecated: Use AccountTransactionsReply.ProtoReflect.Descriptor instead. func (*AccountTransactionsReply) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{14} + return file_aptos_proto_rawDescGZIP(), []int{16} } func (x *AccountTransactionsReply) GetTransactions() []*Transaction { @@ -1047,7 +1135,7 @@ type SubmitTransactionRequest struct { func (x *SubmitTransactionRequest) Reset() { *x = SubmitTransactionRequest{} - mi := &file_aptos_proto_msgTypes[15] + mi := &file_aptos_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1059,7 +1147,7 @@ func (x *SubmitTransactionRequest) String() string { func (*SubmitTransactionRequest) ProtoMessage() {} func (x *SubmitTransactionRequest) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[15] + mi := &file_aptos_proto_msgTypes[17] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1072,7 +1160,7 @@ func (x *SubmitTransactionRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use SubmitTransactionRequest.ProtoReflect.Descriptor instead. func (*SubmitTransactionRequest) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{15} + return file_aptos_proto_rawDescGZIP(), []int{17} } func (x *SubmitTransactionRequest) GetReceiverModuleId() *ModuleID { @@ -1101,13 +1189,14 @@ type SubmitTransactionReply struct { TxStatus TxStatus `protobuf:"varint,1,opt,name=tx_status,json=txStatus,proto3,enum=loop.aptos.TxStatus" json:"tx_status,omitempty"` TxHash string `protobuf:"bytes,2,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"` TxIdempotencyKey string `protobuf:"bytes,3,opt,name=tx_idempotency_key,json=txIdempotencyKey,proto3" json:"tx_idempotency_key,omitempty"` + TransactionFee *uint64 `protobuf:"varint,4,opt,name=transaction_fee,json=transactionFee,proto3,oneof" json:"transaction_fee,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *SubmitTransactionReply) Reset() { *x = SubmitTransactionReply{} - mi := &file_aptos_proto_msgTypes[16] + mi := &file_aptos_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1119,7 +1208,7 @@ func (x *SubmitTransactionReply) String() string { func (*SubmitTransactionReply) ProtoMessage() {} func (x *SubmitTransactionReply) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[16] + mi := &file_aptos_proto_msgTypes[18] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1132,7 +1221,7 @@ func (x *SubmitTransactionReply) ProtoReflect() protoreflect.Message { // Deprecated: Use SubmitTransactionReply.ProtoReflect.Descriptor instead. func (*SubmitTransactionReply) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{16} + return file_aptos_proto_rawDescGZIP(), []int{18} } func (x *SubmitTransactionReply) GetTxStatus() TxStatus { @@ -1156,6 +1245,13 @@ func (x *SubmitTransactionReply) GetTxIdempotencyKey() string { return "" } +func (x *SubmitTransactionReply) GetTransactionFee() uint64 { + if x != nil && x.TransactionFee != nil { + return *x.TransactionFee + } + return 0 +} + type GasConfig struct { state protoimpl.MessageState `protogen:"open.v1"` MaxGasAmount uint64 `protobuf:"varint,1,opt,name=max_gas_amount,json=maxGasAmount,proto3" json:"max_gas_amount,omitempty"` // Maximum gas units willing to pay @@ -1166,7 +1262,7 @@ type GasConfig struct { func (x *GasConfig) Reset() { *x = GasConfig{} - mi := &file_aptos_proto_msgTypes[17] + mi := &file_aptos_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1178,7 +1274,7 @@ func (x *GasConfig) String() string { func (*GasConfig) ProtoMessage() {} func (x *GasConfig) ProtoReflect() protoreflect.Message { - mi := &file_aptos_proto_msgTypes[17] + mi := &file_aptos_proto_msgTypes[19] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1191,7 +1287,7 @@ func (x *GasConfig) ProtoReflect() protoreflect.Message { // Deprecated: Use GasConfig.ProtoReflect.Descriptor instead. func (*GasConfig) Descriptor() ([]byte, []int) { - return file_aptos_proto_rawDescGZIP(), []int{17} + return file_aptos_proto_rawDescGZIP(), []int{19} } func (x *GasConfig) GetMaxGasAmount() uint64 { @@ -1213,13 +1309,18 @@ var File_aptos_proto protoreflect.FileDescriptor const file_aptos_proto_rawDesc = "" + "\n" + "\vaptos.proto\x12\n" + - "loop.aptos\"4\n" + + "loop.aptos\"\x16\n" + + "\x14LedgerVersionRequest\";\n" + + "\x12LedgerVersionReply\x12%\n" + + "\x0eledger_version\x18\x01 \x01(\x04R\rledgerVersion\"4\n" + "\x18AccountAPTBalanceRequest\x12\x18\n" + "\aaddress\x18\x01 \x01(\fR\aaddress\".\n" + "\x16AccountAPTBalanceReply\x12\x14\n" + - "\x05value\x18\x01 \x01(\x04R\x05value\"@\n" + + "\x05value\x18\x01 \x01(\x04R\x05value\"\x7f\n" + "\vViewRequest\x121\n" + - "\apayload\x18\x01 \x01(\v2\x17.loop.aptos.ViewPayloadR\apayload\"\x1f\n" + + "\apayload\x18\x01 \x01(\v2\x17.loop.aptos.ViewPayloadR\apayload\x12*\n" + + "\x0eledger_version\x18\x02 \x01(\x04H\x00R\rledgerVersion\x88\x01\x01B\x11\n" + + "\x0f_ledger_version\"\x1f\n" + "\tViewReply\x12\x12\n" + "\x04data\x18\x01 \x01(\fR\x04data\"\x9d\x01\n" + "\vViewPayload\x12,\n" + @@ -1275,11 +1376,13 @@ const file_aptos_proto_rawDesc = "" + "\x0fencoded_payload\x18\x02 \x01(\fR\x0eencodedPayload\x129\n" + "\n" + "gas_config\x18\x03 \x01(\v2\x15.loop.aptos.GasConfigH\x00R\tgasConfig\x88\x01\x01B\r\n" + - "\v_gas_config\"\x92\x01\n" + + "\v_gas_config\"\xd4\x01\n" + "\x16SubmitTransactionReply\x121\n" + "\ttx_status\x18\x01 \x01(\x0e2\x14.loop.aptos.TxStatusR\btxStatus\x12\x17\n" + "\atx_hash\x18\x02 \x01(\tR\x06txHash\x12,\n" + - "\x12tx_idempotency_key\x18\x03 \x01(\tR\x10txIdempotencyKey\"W\n" + + "\x12tx_idempotency_key\x18\x03 \x01(\tR\x10txIdempotencyKey\x12,\n" + + "\x0ftransaction_fee\x18\x04 \x01(\x04H\x00R\x0etransactionFee\x88\x01\x01B\x12\n" + + "\x10_transaction_fee\"W\n" + "\tGasConfig\x12$\n" + "\x0emax_gas_amount\x18\x01 \x01(\x04R\fmaxGasAmount\x12$\n" + "\x0egas_unit_price\x18\x02 \x01(\x04R\fgasUnitPrice*\xb4\x02\n" + @@ -1309,8 +1412,9 @@ const file_aptos_proto_rawDesc = "" + "\bTxStatus\x12\x13\n" + "\x0fTX_STATUS_FATAL\x10\x00\x12\x16\n" + "\x12TX_STATUS_REVERTED\x10\x01\x12\x15\n" + - "\x11TX_STATUS_SUCCESS\x10\x022\xc1\x03\n" + - "\x05Aptos\x12]\n" + + "\x11TX_STATUS_SUCCESS\x10\x022\x94\x04\n" + + "\x05Aptos\x12Q\n" + + "\rLedgerVersion\x12 .loop.aptos.LedgerVersionRequest\x1a\x1e.loop.aptos.LedgerVersionReply\x12]\n" + "\x11AccountAPTBalance\x12$.loop.aptos.AccountAPTBalanceRequest\x1a\".loop.aptos.AccountAPTBalanceReply\x126\n" + "\x04View\x12\x17.loop.aptos.ViewRequest\x1a\x15.loop.aptos.ViewReply\x12]\n" + "\x11TransactionByHash\x12$.loop.aptos.TransactionByHashRequest\x1a\".loop.aptos.TransactionByHashReply\x12c\n" + @@ -1330,58 +1434,62 @@ func file_aptos_proto_rawDescGZIP() []byte { } var file_aptos_proto_enumTypes = make([]protoimpl.EnumInfo, 3) -var file_aptos_proto_msgTypes = make([]protoimpl.MessageInfo, 18) +var file_aptos_proto_msgTypes = make([]protoimpl.MessageInfo, 20) var file_aptos_proto_goTypes = []any{ (TypeTagKind)(0), // 0: loop.aptos.TypeTagKind (TransactionVariant)(0), // 1: loop.aptos.TransactionVariant (TxStatus)(0), // 2: loop.aptos.TxStatus - (*AccountAPTBalanceRequest)(nil), // 3: loop.aptos.AccountAPTBalanceRequest - (*AccountAPTBalanceReply)(nil), // 4: loop.aptos.AccountAPTBalanceReply - (*ViewRequest)(nil), // 5: loop.aptos.ViewRequest - (*ViewReply)(nil), // 6: loop.aptos.ViewReply - (*ViewPayload)(nil), // 7: loop.aptos.ViewPayload - (*ModuleID)(nil), // 8: loop.aptos.ModuleID - (*TypeTag)(nil), // 9: loop.aptos.TypeTag - (*VectorTag)(nil), // 10: loop.aptos.VectorTag - (*StructTag)(nil), // 11: loop.aptos.StructTag - (*GenericTag)(nil), // 12: loop.aptos.GenericTag - (*TransactionByHashRequest)(nil), // 13: loop.aptos.TransactionByHashRequest - (*TransactionByHashReply)(nil), // 14: loop.aptos.TransactionByHashReply - (*Transaction)(nil), // 15: loop.aptos.Transaction - (*AccountTransactionsRequest)(nil), // 16: loop.aptos.AccountTransactionsRequest - (*AccountTransactionsReply)(nil), // 17: loop.aptos.AccountTransactionsReply - (*SubmitTransactionRequest)(nil), // 18: loop.aptos.SubmitTransactionRequest - (*SubmitTransactionReply)(nil), // 19: loop.aptos.SubmitTransactionReply - (*GasConfig)(nil), // 20: loop.aptos.GasConfig + (*LedgerVersionRequest)(nil), // 3: loop.aptos.LedgerVersionRequest + (*LedgerVersionReply)(nil), // 4: loop.aptos.LedgerVersionReply + (*AccountAPTBalanceRequest)(nil), // 5: loop.aptos.AccountAPTBalanceRequest + (*AccountAPTBalanceReply)(nil), // 6: loop.aptos.AccountAPTBalanceReply + (*ViewRequest)(nil), // 7: loop.aptos.ViewRequest + (*ViewReply)(nil), // 8: loop.aptos.ViewReply + (*ViewPayload)(nil), // 9: loop.aptos.ViewPayload + (*ModuleID)(nil), // 10: loop.aptos.ModuleID + (*TypeTag)(nil), // 11: loop.aptos.TypeTag + (*VectorTag)(nil), // 12: loop.aptos.VectorTag + (*StructTag)(nil), // 13: loop.aptos.StructTag + (*GenericTag)(nil), // 14: loop.aptos.GenericTag + (*TransactionByHashRequest)(nil), // 15: loop.aptos.TransactionByHashRequest + (*TransactionByHashReply)(nil), // 16: loop.aptos.TransactionByHashReply + (*Transaction)(nil), // 17: loop.aptos.Transaction + (*AccountTransactionsRequest)(nil), // 18: loop.aptos.AccountTransactionsRequest + (*AccountTransactionsReply)(nil), // 19: loop.aptos.AccountTransactionsReply + (*SubmitTransactionRequest)(nil), // 20: loop.aptos.SubmitTransactionRequest + (*SubmitTransactionReply)(nil), // 21: loop.aptos.SubmitTransactionReply + (*GasConfig)(nil), // 22: loop.aptos.GasConfig } var file_aptos_proto_depIdxs = []int32{ - 7, // 0: loop.aptos.ViewRequest.payload:type_name -> loop.aptos.ViewPayload - 8, // 1: loop.aptos.ViewPayload.module:type_name -> loop.aptos.ModuleID - 9, // 2: loop.aptos.ViewPayload.arg_types:type_name -> loop.aptos.TypeTag + 9, // 0: loop.aptos.ViewRequest.payload:type_name -> loop.aptos.ViewPayload + 10, // 1: loop.aptos.ViewPayload.module:type_name -> loop.aptos.ModuleID + 11, // 2: loop.aptos.ViewPayload.arg_types:type_name -> loop.aptos.TypeTag 0, // 3: loop.aptos.TypeTag.kind:type_name -> loop.aptos.TypeTagKind - 10, // 4: loop.aptos.TypeTag.vector:type_name -> loop.aptos.VectorTag - 11, // 5: loop.aptos.TypeTag.struct:type_name -> loop.aptos.StructTag - 12, // 6: loop.aptos.TypeTag.generic:type_name -> loop.aptos.GenericTag - 9, // 7: loop.aptos.VectorTag.element_type:type_name -> loop.aptos.TypeTag - 9, // 8: loop.aptos.StructTag.type_params:type_name -> loop.aptos.TypeTag - 15, // 9: loop.aptos.TransactionByHashReply.transaction:type_name -> loop.aptos.Transaction + 12, // 4: loop.aptos.TypeTag.vector:type_name -> loop.aptos.VectorTag + 13, // 5: loop.aptos.TypeTag.struct:type_name -> loop.aptos.StructTag + 14, // 6: loop.aptos.TypeTag.generic:type_name -> loop.aptos.GenericTag + 11, // 7: loop.aptos.VectorTag.element_type:type_name -> loop.aptos.TypeTag + 11, // 8: loop.aptos.StructTag.type_params:type_name -> loop.aptos.TypeTag + 17, // 9: loop.aptos.TransactionByHashReply.transaction:type_name -> loop.aptos.Transaction 1, // 10: loop.aptos.Transaction.type:type_name -> loop.aptos.TransactionVariant - 15, // 11: loop.aptos.AccountTransactionsReply.transactions:type_name -> loop.aptos.Transaction - 8, // 12: loop.aptos.SubmitTransactionRequest.receiver_module_id:type_name -> loop.aptos.ModuleID - 20, // 13: loop.aptos.SubmitTransactionRequest.gas_config:type_name -> loop.aptos.GasConfig + 17, // 11: loop.aptos.AccountTransactionsReply.transactions:type_name -> loop.aptos.Transaction + 10, // 12: loop.aptos.SubmitTransactionRequest.receiver_module_id:type_name -> loop.aptos.ModuleID + 22, // 13: loop.aptos.SubmitTransactionRequest.gas_config:type_name -> loop.aptos.GasConfig 2, // 14: loop.aptos.SubmitTransactionReply.tx_status:type_name -> loop.aptos.TxStatus - 3, // 15: loop.aptos.Aptos.AccountAPTBalance:input_type -> loop.aptos.AccountAPTBalanceRequest - 5, // 16: loop.aptos.Aptos.View:input_type -> loop.aptos.ViewRequest - 13, // 17: loop.aptos.Aptos.TransactionByHash:input_type -> loop.aptos.TransactionByHashRequest - 16, // 18: loop.aptos.Aptos.AccountTransactions:input_type -> loop.aptos.AccountTransactionsRequest - 18, // 19: loop.aptos.Aptos.SubmitTransaction:input_type -> loop.aptos.SubmitTransactionRequest - 4, // 20: loop.aptos.Aptos.AccountAPTBalance:output_type -> loop.aptos.AccountAPTBalanceReply - 6, // 21: loop.aptos.Aptos.View:output_type -> loop.aptos.ViewReply - 14, // 22: loop.aptos.Aptos.TransactionByHash:output_type -> loop.aptos.TransactionByHashReply - 17, // 23: loop.aptos.Aptos.AccountTransactions:output_type -> loop.aptos.AccountTransactionsReply - 19, // 24: loop.aptos.Aptos.SubmitTransaction:output_type -> loop.aptos.SubmitTransactionReply - 20, // [20:25] is the sub-list for method output_type - 15, // [15:20] is the sub-list for method input_type + 3, // 15: loop.aptos.Aptos.LedgerVersion:input_type -> loop.aptos.LedgerVersionRequest + 5, // 16: loop.aptos.Aptos.AccountAPTBalance:input_type -> loop.aptos.AccountAPTBalanceRequest + 7, // 17: loop.aptos.Aptos.View:input_type -> loop.aptos.ViewRequest + 15, // 18: loop.aptos.Aptos.TransactionByHash:input_type -> loop.aptos.TransactionByHashRequest + 18, // 19: loop.aptos.Aptos.AccountTransactions:input_type -> loop.aptos.AccountTransactionsRequest + 20, // 20: loop.aptos.Aptos.SubmitTransaction:input_type -> loop.aptos.SubmitTransactionRequest + 4, // 21: loop.aptos.Aptos.LedgerVersion:output_type -> loop.aptos.LedgerVersionReply + 6, // 22: loop.aptos.Aptos.AccountAPTBalance:output_type -> loop.aptos.AccountAPTBalanceReply + 8, // 23: loop.aptos.Aptos.View:output_type -> loop.aptos.ViewReply + 16, // 24: loop.aptos.Aptos.TransactionByHash:output_type -> loop.aptos.TransactionByHashReply + 19, // 25: loop.aptos.Aptos.AccountTransactions:output_type -> loop.aptos.AccountTransactionsReply + 21, // 26: loop.aptos.Aptos.SubmitTransaction:output_type -> loop.aptos.SubmitTransactionReply + 21, // [21:27] is the sub-list for method output_type + 15, // [15:21] is the sub-list for method input_type 15, // [15:15] is the sub-list for extension type_name 15, // [15:15] is the sub-list for extension extendee 0, // [0:15] is the sub-list for field type_name @@ -1392,22 +1500,24 @@ func file_aptos_proto_init() { if File_aptos_proto != nil { return } - file_aptos_proto_msgTypes[6].OneofWrappers = []any{ + file_aptos_proto_msgTypes[4].OneofWrappers = []any{} + file_aptos_proto_msgTypes[8].OneofWrappers = []any{ (*TypeTag_Vector)(nil), (*TypeTag_Struct)(nil), (*TypeTag_Generic)(nil), } - file_aptos_proto_msgTypes[11].OneofWrappers = []any{} - file_aptos_proto_msgTypes[12].OneofWrappers = []any{} file_aptos_proto_msgTypes[13].OneofWrappers = []any{} + file_aptos_proto_msgTypes[14].OneofWrappers = []any{} file_aptos_proto_msgTypes[15].OneofWrappers = []any{} + file_aptos_proto_msgTypes[17].OneofWrappers = []any{} + file_aptos_proto_msgTypes[18].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_aptos_proto_rawDesc), len(file_aptos_proto_rawDesc)), NumEnums: 3, - NumMessages: 18, + NumMessages: 20, NumExtensions: 0, NumServices: 1, }, diff --git a/pkg/chains/aptos/aptos.proto b/pkg/chains/aptos/aptos.proto index da9be7b34..914f37b42 100644 --- a/pkg/chains/aptos/aptos.proto +++ b/pkg/chains/aptos/aptos.proto @@ -4,6 +4,7 @@ option go_package = "github.com/smartcontractkit/chainlink-common/pkg/chains/apt package loop.aptos; service Aptos { + rpc LedgerVersion(LedgerVersionRequest) returns (LedgerVersionReply); rpc AccountAPTBalance(AccountAPTBalanceRequest) returns (AccountAPTBalanceReply); rpc View(ViewRequest) returns (ViewReply); rpc TransactionByHash(TransactionByHashRequest) returns (TransactionByHashReply); @@ -11,6 +12,14 @@ service Aptos { rpc SubmitTransaction(SubmitTransactionRequest) returns (SubmitTransactionReply); } +// ========== LedgerVersion ========== + +message LedgerVersionRequest {} + +message LedgerVersionReply { + uint64 ledger_version = 1; +} + // ========== AccountAPTBalance ========== message AccountAPTBalanceRequest { @@ -25,6 +34,7 @@ message AccountAPTBalanceReply { message ViewRequest { ViewPayload payload = 1; + optional uint64 ledger_version = 2; } message ViewReply { @@ -142,10 +152,10 @@ message SubmitTransactionReply { TxStatus tx_status = 1; string tx_hash = 2; string tx_idempotency_key = 3; + optional uint64 transaction_fee = 4; } message GasConfig { uint64 max_gas_amount = 1; // Maximum gas units willing to pay uint64 gas_unit_price = 2; // Price per gas unit in octas } - diff --git a/pkg/chains/aptos/aptos_grpc.pb.go b/pkg/chains/aptos/aptos_grpc.pb.go index 2fc0f2d90..1833254df 100644 --- a/pkg/chains/aptos/aptos_grpc.pb.go +++ b/pkg/chains/aptos/aptos_grpc.pb.go @@ -19,6 +19,7 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( + Aptos_LedgerVersion_FullMethodName = "/loop.aptos.Aptos/LedgerVersion" Aptos_AccountAPTBalance_FullMethodName = "/loop.aptos.Aptos/AccountAPTBalance" Aptos_View_FullMethodName = "/loop.aptos.Aptos/View" Aptos_TransactionByHash_FullMethodName = "/loop.aptos.Aptos/TransactionByHash" @@ -30,6 +31,7 @@ const ( // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type AptosClient interface { + LedgerVersion(ctx context.Context, in *LedgerVersionRequest, opts ...grpc.CallOption) (*LedgerVersionReply, error) AccountAPTBalance(ctx context.Context, in *AccountAPTBalanceRequest, opts ...grpc.CallOption) (*AccountAPTBalanceReply, error) View(ctx context.Context, in *ViewRequest, opts ...grpc.CallOption) (*ViewReply, error) TransactionByHash(ctx context.Context, in *TransactionByHashRequest, opts ...grpc.CallOption) (*TransactionByHashReply, error) @@ -45,6 +47,16 @@ func NewAptosClient(cc grpc.ClientConnInterface) AptosClient { return &aptosClient{cc} } +func (c *aptosClient) LedgerVersion(ctx context.Context, in *LedgerVersionRequest, opts ...grpc.CallOption) (*LedgerVersionReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(LedgerVersionReply) + err := c.cc.Invoke(ctx, Aptos_LedgerVersion_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *aptosClient) AccountAPTBalance(ctx context.Context, in *AccountAPTBalanceRequest, opts ...grpc.CallOption) (*AccountAPTBalanceReply, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(AccountAPTBalanceReply) @@ -99,6 +111,7 @@ func (c *aptosClient) SubmitTransaction(ctx context.Context, in *SubmitTransacti // All implementations must embed UnimplementedAptosServer // for forward compatibility. type AptosServer interface { + LedgerVersion(context.Context, *LedgerVersionRequest) (*LedgerVersionReply, error) AccountAPTBalance(context.Context, *AccountAPTBalanceRequest) (*AccountAPTBalanceReply, error) View(context.Context, *ViewRequest) (*ViewReply, error) TransactionByHash(context.Context, *TransactionByHashRequest) (*TransactionByHashReply, error) @@ -114,6 +127,9 @@ type AptosServer interface { // pointer dereference when methods are called. type UnimplementedAptosServer struct{} +func (UnimplementedAptosServer) LedgerVersion(context.Context, *LedgerVersionRequest) (*LedgerVersionReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method LedgerVersion not implemented") +} func (UnimplementedAptosServer) AccountAPTBalance(context.Context, *AccountAPTBalanceRequest) (*AccountAPTBalanceReply, error) { return nil, status.Errorf(codes.Unimplemented, "method AccountAPTBalance not implemented") } @@ -150,6 +166,24 @@ func RegisterAptosServer(s grpc.ServiceRegistrar, srv AptosServer) { s.RegisterService(&Aptos_ServiceDesc, srv) } +func _Aptos_LedgerVersion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LedgerVersionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AptosServer).LedgerVersion(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Aptos_LedgerVersion_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AptosServer).LedgerVersion(ctx, req.(*LedgerVersionRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Aptos_AccountAPTBalance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(AccountAPTBalanceRequest) if err := dec(in); err != nil { @@ -247,6 +281,10 @@ var Aptos_ServiceDesc = grpc.ServiceDesc{ ServiceName: "loop.aptos.Aptos", HandlerType: (*AptosServer)(nil), Methods: []grpc.MethodDesc{ + { + MethodName: "LedgerVersion", + Handler: _Aptos_LedgerVersion_Handler, + }, { MethodName: "AccountAPTBalance", Handler: _Aptos_AccountAPTBalance_Handler, diff --git a/pkg/chains/aptos/proto_helpers.go b/pkg/chains/aptos/proto_helpers.go index ce1573a0f..f752e9109 100644 --- a/pkg/chains/aptos/proto_helpers.go +++ b/pkg/chains/aptos/proto_helpers.go @@ -480,6 +480,7 @@ func ConvertSubmitTransactionReplyToProto(reply *typeaptos.SubmitTransactionRepl TxStatus: TxStatus(reply.TxStatus), TxHash: reply.TxHash, TxIdempotencyKey: reply.TxIdempotencyKey, + TransactionFee: reply.TransactionFee, }, nil } @@ -492,5 +493,6 @@ func ConvertSubmitTransactionReplyFromProto(proto *SubmitTransactionReply) (*typ TxStatus: typeaptos.TransactionStatus(proto.TxStatus), TxHash: proto.TxHash, TxIdempotencyKey: proto.TxIdempotencyKey, + TransactionFee: proto.TransactionFee, }, nil } diff --git a/pkg/chains/aptos/proto_helpers_test.go b/pkg/chains/aptos/proto_helpers_test.go index 7dc916b9a..dbc4180f2 100644 --- a/pkg/chains/aptos/proto_helpers_test.go +++ b/pkg/chains/aptos/proto_helpers_test.go @@ -304,10 +304,12 @@ func TestSubmitTransactionConverters(t *testing.T) { }) t.Run("SubmitTransactionReply roundtrip", func(t *testing.T) { + fee := uint64(1234) reply := &typeaptos.SubmitTransactionReply{ TxStatus: typeaptos.TxSuccess, TxHash: "0xabc123", TxIdempotencyKey: "key-456", + TransactionFee: &fee, } protoReply, err := conv.ConvertSubmitTransactionReplyToProto(reply) @@ -315,12 +317,15 @@ func TestSubmitTransactionConverters(t *testing.T) { require.Equal(t, conv.TxStatus(typeaptos.TxSuccess), protoReply.TxStatus) require.Equal(t, "0xabc123", protoReply.TxHash) require.Equal(t, "key-456", protoReply.TxIdempotencyKey) + require.Equal(t, fee, protoReply.GetTransactionFee()) roundtrip, err := conv.ConvertSubmitTransactionReplyFromProto(protoReply) require.NoError(t, err) require.Equal(t, reply.TxStatus, roundtrip.TxStatus) require.Equal(t, reply.TxHash, roundtrip.TxHash) require.Equal(t, reply.TxIdempotencyKey, roundtrip.TxIdempotencyKey) + require.NotNil(t, roundtrip.TransactionFee) + require.Equal(t, fee, *roundtrip.TransactionFee) }) t.Run("Invalid request errors", func(t *testing.T) { diff --git a/pkg/loop/internal/core/services/capability/capabilities_registry.go b/pkg/loop/internal/core/services/capability/capabilities_registry.go index b398ea8c9..6db7d3e3f 100644 --- a/pkg/loop/internal/core/services/capability/capabilities_registry.go +++ b/pkg/loop/internal/core/services/capability/capabilities_registry.go @@ -4,6 +4,7 @@ import ( "context" "encoding/hex" "fmt" + "strings" "time" "google.golang.org/grpc" @@ -259,6 +260,52 @@ func decodeOcr3Config(pbCfg *capabilitiespb.OCR3Config) ocrtypes.ContractConfig } } +func transmitterAccountToBytes(account ocrtypes.Account) ([]byte, error) { + raw := []byte(account) + s := strings.TrimSpace(string(account)) + if s == "" { + return raw, nil + } + + if strings.HasPrefix(s, "0x") || strings.HasPrefix(s, "0X") { + trimmed := s[2:] + if !looksHexAccount(trimmed) { + return nil, fmt.Errorf("failed to decode transmitter: invalid hex account %q", s) + } + decoded, err := hex.DecodeString(trimmed) + if err != nil { + return nil, fmt.Errorf("failed to decode transmitter: %w", err) + } + return decoded, nil + } + + if looksHexAccount(s) { + decoded, err := hex.DecodeString(s) + if err != nil { + return nil, fmt.Errorf("failed to decode transmitter: %w", err) + } + return decoded, nil + } + + // Backward compatibility: some registry paths provide raw bytes directly. + return raw, nil +} + +func looksHexAccount(s string) bool { + if s == "" || len(s)%2 != 0 { + return false + } + for _, c := range s { + isDigit := c >= '0' && c <= '9' + isLower := c >= 'a' && c <= 'f' + isUpper := c >= 'A' && c <= 'F' + if !isDigit && !isLower && !isUpper { + return false + } + } + return true +} + func (cr *capabilitiesRegistryClient) Get(ctx context.Context, ID string) (capabilities.BaseCapability, error) { req := &pb.GetRequest{ Id: ID, @@ -512,9 +559,9 @@ func (c *capabilitiesRegistryServer) ConfigForCapability(ctx context.Context, re } transmitters := make([][]byte, len(cfg.Transmitters)) for i, t := range cfg.Transmitters { - transmitters[i], err = hex.DecodeString(string(t)) + transmitters[i], err = transmitterAccountToBytes(t) if err != nil { - return nil, fmt.Errorf("failed to decode transmitter: %w", err) + return nil, err } } ccp.Ocr3Configs[key] = &capabilitiespb.OCR3Config{ diff --git a/pkg/loop/internal/core/services/capability/capabilities_registry_test.go b/pkg/loop/internal/core/services/capability/capabilities_registry_test.go index b945230eb..790c92021 100644 --- a/pkg/loop/internal/core/services/capability/capabilities_registry_test.go +++ b/pkg/loop/internal/core/services/capability/capabilities_registry_test.go @@ -586,6 +586,31 @@ func TestCapabilitiesRegistry_ConfigForCapability_WithOcr3AndOracleFactoryConfig assert.Equal(t, expectedCapConfig, capConf) } +func TestTransmitterAccountToBytes(t *testing.T) { + t.Run("decodes_0x_and_0X_prefixed_hex", func(t *testing.T) { + gotLower, err := transmitterAccountToBytes(ocrtypes.Account("0xABcd")) + require.NoError(t, err) + require.Equal(t, []byte{0xab, 0xcd}, gotLower) + + gotUpper, err := transmitterAccountToBytes(ocrtypes.Account("0X00ff")) + require.NoError(t, err) + require.Equal(t, []byte{0x00, 0xff}, gotUpper) + }) + + t.Run("returns_error_for_invalid_prefixed_hex", func(t *testing.T) { + _, err := transmitterAccountToBytes(ocrtypes.Account("0x123")) + require.Error(t, err) + require.Contains(t, err.Error(), "failed to decode transmitter") + }) + + t.Run("falls_back_to_raw_bytes_for_non_hex_account", func(t *testing.T) { + raw := []byte{0x00, 0x7f, 0xff, 0x41} + got, err := transmitterAccountToBytes(ocrtypes.Account(string(raw))) + require.NoError(t, err) + require.Equal(t, raw, got) + }) +} + func TestCapabilitiesRegistry_DONsForCapability(t *testing.T) { stopCh := make(chan struct{}) logger := logger.Test(t) diff --git a/pkg/loop/internal/relayer/aptos.go b/pkg/loop/internal/relayer/aptos.go index 2667c2de3..6cd0ca731 100644 --- a/pkg/loop/internal/relayer/aptos.go +++ b/pkg/loop/internal/relayer/aptos.go @@ -22,6 +22,14 @@ func NewAptosClient(client aptospb.AptosClient) *AptosClient { } } +func (ac *AptosClient) LedgerVersion(ctx context.Context) (uint64, error) { + reply, err := ac.grpcClient.LedgerVersion(ctx, &aptospb.LedgerVersionRequest{}) + if err != nil { + return 0, net.WrapRPCErr(err) + } + return reply.LedgerVersion, nil +} + func (ac *AptosClient) AccountAPTBalance(ctx context.Context, req aptos.AccountAPTBalanceRequest) (*aptos.AccountAPTBalanceReply, error) { reply, err := ac.grpcClient.AccountAPTBalance(ctx, &aptospb.AccountAPTBalanceRequest{ Address: req.Address[:], @@ -44,6 +52,9 @@ func (ac *AptosClient) View(ctx context.Context, req aptos.ViewRequest) (*aptos. protoReq := &aptospb.ViewRequest{ Payload: protoPayload, } + if req.LedgerVersion != nil { + protoReq.LedgerVersion = req.LedgerVersion + } reply, err := ac.grpcClient.View(ctx, protoReq) if err != nil { @@ -112,6 +123,14 @@ func (s *aptosServer) AccountAPTBalance(ctx context.Context, req *aptospb.Accoun }, nil } +func (s *aptosServer) LedgerVersion(ctx context.Context, _ *aptospb.LedgerVersionRequest) (*aptospb.LedgerVersionReply, error) { + ledgerVersion, err := s.impl.LedgerVersion(ctx) + if err != nil { + return nil, err + } + return &aptospb.LedgerVersionReply{LedgerVersion: ledgerVersion}, nil +} + func (s *aptosServer) View(ctx context.Context, req *aptospb.ViewRequest) (*aptospb.ViewReply, error) { // Convert proto types to Go types goPayload, err := aptospb.ConvertViewPayloadFromProto(req.Payload) @@ -122,6 +141,10 @@ func (s *aptosServer) View(ctx context.Context, req *aptospb.ViewRequest) (*apto goReq := aptos.ViewRequest{ Payload: goPayload, } + if req.LedgerVersion != nil { + ledgerVersion := req.GetLedgerVersion() + goReq.LedgerVersion = &ledgerVersion + } reply, err := s.impl.View(ctx, goReq) if err != nil { diff --git a/pkg/loop/internal/relayer/aptos_test.go b/pkg/loop/internal/relayer/aptos_test.go new file mode 100644 index 000000000..cf9e69283 --- /dev/null +++ b/pkg/loop/internal/relayer/aptos_test.go @@ -0,0 +1,127 @@ +package relayer + +import ( + "context" + "net" + "testing" + + "github.com/stretchr/testify/require" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/test/bufconn" + + aptospb "github.com/smartcontractkit/chainlink-common/pkg/chains/aptos" + "github.com/smartcontractkit/chainlink-common/pkg/logger" + loopnet "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/net" + "github.com/smartcontractkit/chainlink-common/pkg/types" + aptostypes "github.com/smartcontractkit/chainlink-common/pkg/types/chains/aptos" +) + +func Test_AptosDomainRoundTripThroughGRPC(t *testing.T) { + t.Parallel() + + lis := bufconn.Listen(1024 * 1024) + s := grpc.NewServer() + + aptosService := &staticAptosService{} + aptospb.RegisterAptosServer(s, newAptosServer(aptosService, &loopnet.BrokerExt{ + BrokerConfig: loopnet.BrokerConfig{ + Logger: logger.Test(t), + }, + })) + + go func() { _ = s.Serve(lis) }() + defer s.Stop() + + ctx := t.Context() + conn, err := grpc.DialContext(ctx, "bufnet", + grpc.WithTransportCredentials(insecure.NewCredentials()), + grpc.WithContextDialer(func(ctx context.Context, s string) (net.Conn, error) { + return lis.Dial() + }), + ) + require.NoError(t, err) + defer conn.Close() + + client := &AptosClient{grpcClient: aptospb.NewAptosClient(conn)} + + t.Run("LedgerVersion", func(t *testing.T) { + const expectedLedgerVersion = uint64(12345) + aptosService.ledgerVersion = func(context.Context) (uint64, error) { + return expectedLedgerVersion, nil + } + + got, err := client.LedgerVersion(ctx) + require.NoError(t, err) + require.Equal(t, expectedLedgerVersion, got) + }) + + t.Run("View_WithLedgerVersion", func(t *testing.T) { + ledgerVersion := uint64(77) + expectedPayload := &aptostypes.ViewPayload{ + Module: aptostypes.ModuleID{ + Address: aptostypes.AccountAddress{}, + Name: "module_name", + }, + Function: "function_name", + Args: [][]byte{[]byte{0x01, 0x02}}, + } + expectedData := []byte(`{"value":"ok"}`) + + aptosService.view = func(_ context.Context, req aptostypes.ViewRequest) (*aptostypes.ViewReply, error) { + require.NotNil(t, req.Payload) + require.Equal(t, expectedPayload.Function, req.Payload.Function) + require.Equal(t, expectedPayload.Module.Name, req.Payload.Module.Name) + require.Equal(t, expectedPayload.Args, req.Payload.Args) + require.NotNil(t, req.LedgerVersion) + require.Equal(t, ledgerVersion, *req.LedgerVersion) + return &aptostypes.ViewReply{Data: expectedData}, nil + } + + got, err := client.View(ctx, aptostypes.ViewRequest{ + Payload: expectedPayload, + LedgerVersion: &ledgerVersion, + }) + require.NoError(t, err) + require.Equal(t, expectedData, got.Data) + }) + + t.Run("View_WithoutLedgerVersion", func(t *testing.T) { + expectedPayload := &aptostypes.ViewPayload{ + Module: aptostypes.ModuleID{ + Address: aptostypes.AccountAddress{}, + Name: "module_name", + }, + Function: "function_name", + } + expectedData := []byte(`{"value":"latest"}`) + + aptosService.view = func(_ context.Context, req aptostypes.ViewRequest) (*aptostypes.ViewReply, error) { + require.NotNil(t, req.Payload) + require.Equal(t, expectedPayload.Function, req.Payload.Function) + require.Equal(t, expectedPayload.Module.Name, req.Payload.Module.Name) + require.Nil(t, req.LedgerVersion) + return &aptostypes.ViewReply{Data: expectedData}, nil + } + + got, err := client.View(ctx, aptostypes.ViewRequest{ + Payload: expectedPayload, + }) + require.NoError(t, err) + require.Equal(t, expectedData, got.Data) + }) +} + +type staticAptosService struct { + types.UnimplementedAptosService + ledgerVersion func(ctx context.Context) (uint64, error) + view func(ctx context.Context, req aptostypes.ViewRequest) (*aptostypes.ViewReply, error) +} + +func (s *staticAptosService) LedgerVersion(ctx context.Context) (uint64, error) { + return s.ledgerVersion(ctx) +} + +func (s *staticAptosService) View(ctx context.Context, req aptostypes.ViewRequest) (*aptostypes.ViewReply, error) { + return s.view(ctx, req) +} diff --git a/pkg/loop/internal/relayerset/aptos.go b/pkg/loop/internal/relayerset/aptos.go index daba3c3d6..ad65db60b 100644 --- a/pkg/loop/internal/relayerset/aptos.go +++ b/pkg/loop/internal/relayerset/aptos.go @@ -21,6 +21,10 @@ type aptosClient struct { var _ aptospb.AptosClient = (*aptosClient)(nil) +func (ac *aptosClient) LedgerVersion(ctx context.Context, in *aptospb.LedgerVersionRequest, opts ...grpc.CallOption) (*aptospb.LedgerVersionReply, error) { + return ac.client.LedgerVersion(appendRelayID(ctx, ac.relayID), in, opts...) +} + func (ac *aptosClient) AccountAPTBalance(ctx context.Context, in *aptospb.AccountAPTBalanceRequest, opts ...grpc.CallOption) (*aptospb.AccountAPTBalanceReply, error) { return ac.client.AccountAPTBalance(appendRelayID(ctx, ac.relayID), in, opts...) } @@ -48,6 +52,19 @@ type aptosServer struct { var _ aptospb.AptosServer = (*aptosServer)(nil) +func (as *aptosServer) LedgerVersion(ctx context.Context, _ *aptospb.LedgerVersionRequest) (*aptospb.LedgerVersionReply, error) { + aptosService, err := as.parent.getAptosService(ctx) + if err != nil { + return nil, err + } + + ledgerVersion, err := aptosService.LedgerVersion(ctx) + if err != nil { + return nil, err + } + return &aptospb.LedgerVersionReply{LedgerVersion: ledgerVersion}, nil +} + func (as *aptosServer) AccountAPTBalance(ctx context.Context, req *aptospb.AccountAPTBalanceRequest) (*aptospb.AccountAPTBalanceReply, error) { aptosService, err := as.parent.getAptosService(ctx) if err != nil { @@ -80,6 +97,10 @@ func (as *aptosServer) View(ctx context.Context, req *aptospb.ViewRequest) (*apt goReq := aptos.ViewRequest{ Payload: goPayload, } + if req.LedgerVersion != nil { + ledgerVersion := req.GetLedgerVersion() + goReq.LedgerVersion = &ledgerVersion + } reply, err := aptosService.View(ctx, goReq) if err != nil { diff --git a/pkg/loop/internal/relayerset/relayerset_test.go b/pkg/loop/internal/relayerset/relayerset_test.go index d1d8198e5..9828d67c9 100644 --- a/pkg/loop/internal/relayerset/relayerset_test.go +++ b/pkg/loop/internal/relayerset/relayerset_test.go @@ -961,6 +961,17 @@ func Test_RelayerSet_AptosService(t *testing.T) { name string run func(t *testing.T, apt types.AptosService, mockApt *mocks2.AptosService) }{ + { + name: "LedgerVersion", + run: func(t *testing.T, apt types.AptosService, mockApt *mocks2.AptosService) { + expected := uint64(12345) + mockApt.EXPECT().LedgerVersion(mock.Anything).Return(expected, nil) + + version, err := apt.LedgerVersion(ctx) + require.NoError(t, err) + require.Equal(t, expected, version) + }, + }, { name: "AccountAPTBalance", run: func(t *testing.T, apt types.AptosService, mockApt *mocks2.AptosService) { @@ -1011,6 +1022,39 @@ func Test_RelayerSet_AptosService(t *testing.T) { require.Equal(t, expectedData, reply.Data) }, }, + { + name: "View with LedgerVersion", + run: func(t *testing.T, apt types.AptosService, mockApt *mocks2.AptosService) { + moduleAddr := aptos.AccountAddress{ + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + } + ledgerVersion := uint64(987654) + req := aptos.ViewRequest{ + Payload: &aptos.ViewPayload{ + Module: aptos.ModuleID{ + Address: moduleAddr, + Name: "coin", + }, + Function: "balance", + ArgTypes: []aptos.TypeTag{ + {Value: aptos.AddressTag{}}, + }, + Args: [][]byte{{0x01, 0x02}}, + }, + LedgerVersion: &ledgerVersion, + } + expectedData := []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64} + mockApt.EXPECT().View(mock.Anything, req). + Return(&aptos.ViewReply{Data: expectedData}, nil) + + reply, err := apt.View(ctx, req) + require.NoError(t, err) + require.Equal(t, expectedData, reply.Data) + }, + }, { name: "TransactionByHash", run: func(t *testing.T, apt types.AptosService, mockApt *mocks2.AptosService) { diff --git a/pkg/types/chains/aptos/aptos.go b/pkg/types/chains/aptos/aptos.go index 81b94af7b..5dc6f3bb6 100644 --- a/pkg/types/chains/aptos/aptos.go +++ b/pkg/types/chains/aptos/aptos.go @@ -10,6 +10,8 @@ type AccountAddress [AccountAddressLength]byte // Client wraps the Aptos RPC client methods used for reading on-chain state. type Client interface { + // LedgerVersion returns the latest committed ledger (transaction) version. + LedgerVersion(ctx context.Context) (uint64, error) // AccountAPTBalance returns the native APT coin balance (in octas) for the given account address. AccountAPTBalance(ctx context.Context, req AccountAPTBalanceRequest) (*AccountAPTBalanceReply, error) // View executes a Move view function (read-only) and returns the raw result. @@ -33,7 +35,8 @@ type AccountAPTBalanceReply struct { // ========== View ========== type ViewRequest struct { - Payload *ViewPayload + Payload *ViewPayload + LedgerVersion *uint64 // optional, nil uses latest ledger version on the node } type ViewReply struct { @@ -224,6 +227,7 @@ type SubmitTransactionReply struct { TxStatus TransactionStatus TxHash string TxIdempotencyKey string + TransactionFee *uint64 } // GasConfig represents gas configuration for a transaction diff --git a/pkg/types/chains/aptos/capability_convert.go b/pkg/types/chains/aptos/capability_convert.go new file mode 100644 index 000000000..a3edfd7bc --- /dev/null +++ b/pkg/types/chains/aptos/capability_convert.go @@ -0,0 +1,121 @@ +package aptos + +import ( + "fmt" + + aptoscap "github.com/smartcontractkit/chainlink-common/pkg/capabilities/v2/chain-capabilities/aptos" +) + +// ViewPayloadFromCapability converts Aptos capability request payloads to Aptos relayer payloads. +func ViewPayloadFromCapability(payload *aptoscap.ViewPayload) (*ViewPayload, error) { + if payload == nil { + return nil, fmt.Errorf("ViewRequest.Payload is required") + } + if payload.Module == nil { + return nil, fmt.Errorf("ViewRequest.Payload.Module is required") + } + if payload.Function == "" { + return nil, fmt.Errorf("ViewRequest.Payload.Function is required") + } + if len(payload.Module.Address) > AccountAddressLength { + return nil, fmt.Errorf("module address too long: %d", len(payload.Module.Address)) + } + + var moduleAddress AccountAddress + copy(moduleAddress[AccountAddressLength-len(payload.Module.Address):], payload.Module.Address) + + argTypes := make([]TypeTag, 0, len(payload.ArgTypes)) + for i, tag := range payload.ArgTypes { + converted, err := typeTagFromCapability(tag) + if err != nil { + return nil, fmt.Errorf("invalid arg type at index %d: %w", i, err) + } + argTypes = append(argTypes, converted) + } + + return &ViewPayload{ + Module: ModuleID{ + Address: moduleAddress, + Name: payload.Module.Name, + }, + Function: payload.Function, + ArgTypes: argTypes, + Args: payload.Args, + }, nil +} + +func typeTagFromCapability(tag *aptoscap.TypeTag) (TypeTag, error) { + if tag == nil { + return TypeTag{}, fmt.Errorf("type tag is nil") + } + + switch tag.Kind { + case aptoscap.TypeTagKind_TYPE_TAG_KIND_BOOL: + return TypeTag{Value: BoolTag{}}, nil + case aptoscap.TypeTagKind_TYPE_TAG_KIND_U8: + return TypeTag{Value: U8Tag{}}, nil + case aptoscap.TypeTagKind_TYPE_TAG_KIND_U16: + return TypeTag{Value: U16Tag{}}, nil + case aptoscap.TypeTagKind_TYPE_TAG_KIND_U32: + return TypeTag{Value: U32Tag{}}, nil + case aptoscap.TypeTagKind_TYPE_TAG_KIND_U64: + return TypeTag{Value: U64Tag{}}, nil + case aptoscap.TypeTagKind_TYPE_TAG_KIND_U128: + return TypeTag{Value: U128Tag{}}, nil + case aptoscap.TypeTagKind_TYPE_TAG_KIND_U256: + return TypeTag{Value: U256Tag{}}, nil + case aptoscap.TypeTagKind_TYPE_TAG_KIND_ADDRESS: + return TypeTag{Value: AddressTag{}}, nil + case aptoscap.TypeTagKind_TYPE_TAG_KIND_SIGNER: + return TypeTag{Value: SignerTag{}}, nil + case aptoscap.TypeTagKind_TYPE_TAG_KIND_VECTOR: + vector := tag.GetVector() + if vector == nil { + return TypeTag{}, fmt.Errorf("vector tag missing vector value") + } + elementType, err := typeTagFromCapability(vector.ElementType) + if err != nil { + return TypeTag{}, err + } + return TypeTag{Value: VectorTag{ElementType: elementType}}, nil + case aptoscap.TypeTagKind_TYPE_TAG_KIND_STRUCT: + structTag := tag.GetStruct() + if structTag == nil { + return TypeTag{}, fmt.Errorf("struct tag missing struct value") + } + if len(structTag.Address) > AccountAddressLength { + return TypeTag{}, fmt.Errorf("struct address too long: %d", len(structTag.Address)) + } + var structAddress AccountAddress + copy(structAddress[AccountAddressLength-len(structTag.Address):], structTag.Address) + + typeParams := make([]TypeTag, 0, len(structTag.TypeParams)) + for i, tp := range structTag.TypeParams { + converted, err := typeTagFromCapability(tp) + if err != nil { + return TypeTag{}, fmt.Errorf("invalid struct type param at index %d: %w", i, err) + } + typeParams = append(typeParams, converted) + } + + return TypeTag{ + Value: StructTag{ + Address: structAddress, + Module: structTag.Module, + Name: structTag.Name, + TypeParams: typeParams, + }, + }, nil + case aptoscap.TypeTagKind_TYPE_TAG_KIND_GENERIC: + generic := tag.GetGeneric() + if generic == nil { + return TypeTag{}, fmt.Errorf("generic tag missing generic value") + } + if generic.Index > 0xFFFF { + return TypeTag{}, fmt.Errorf("generic type index out of range: %d", generic.Index) + } + return TypeTag{Value: GenericTag{Index: uint16(generic.Index)}}, nil + default: + return TypeTag{}, fmt.Errorf("unsupported type tag kind: %v", tag.Kind) + } +} diff --git a/pkg/types/chains/aptos/capability_convert_test.go b/pkg/types/chains/aptos/capability_convert_test.go new file mode 100644 index 000000000..7145d4d27 --- /dev/null +++ b/pkg/types/chains/aptos/capability_convert_test.go @@ -0,0 +1,108 @@ +package aptos + +import ( + "testing" + + "github.com/stretchr/testify/require" + + aptoscap "github.com/smartcontractkit/chainlink-common/pkg/capabilities/v2/chain-capabilities/aptos" +) + +func TestViewPayloadFromCapability_Success(t *testing.T) { + t.Parallel() + + payload, err := ViewPayloadFromCapability(&aptoscap.ViewPayload{ + Module: &aptoscap.ModuleID{ + Address: []byte{0x01}, + Name: "coin", + }, + Function: "name", + ArgTypes: []*aptoscap.TypeTag{ + { + Kind: aptoscap.TypeTagKind_TYPE_TAG_KIND_VECTOR, + Value: &aptoscap.TypeTag_Vector{ + Vector: &aptoscap.VectorTag{ + ElementType: &aptoscap.TypeTag{ + Kind: aptoscap.TypeTagKind_TYPE_TAG_KIND_U8, + }, + }, + }, + }, + { + Kind: aptoscap.TypeTagKind_TYPE_TAG_KIND_STRUCT, + Value: &aptoscap.TypeTag_Struct{ + Struct: &aptoscap.StructTag{ + Address: []byte{0x02}, + Module: "m", + Name: "n", + TypeParams: []*aptoscap.TypeTag{ + { + Kind: aptoscap.TypeTagKind_TYPE_TAG_KIND_GENERIC, + Value: &aptoscap.TypeTag_Generic{ + Generic: &aptoscap.GenericTag{Index: 7}, + }, + }, + }, + }, + }, + }, + }, + Args: [][]byte{{0xAA, 0xBB}}, + }) + require.NoError(t, err) + require.NotNil(t, payload) + require.Equal(t, "coin", payload.Module.Name) + require.Equal(t, "name", payload.Function) + require.Len(t, payload.ArgTypes, 2) + require.Equal(t, [][]byte{{0xAA, 0xBB}}, payload.Args) +} + +func TestViewPayloadFromCapability_RejectsInvalidInput(t *testing.T) { + t.Parallel() + + _, err := ViewPayloadFromCapability(nil) + require.ErrorContains(t, err, "ViewRequest.Payload is required") + + _, err = ViewPayloadFromCapability(&aptoscap.ViewPayload{}) + require.ErrorContains(t, err, "ViewRequest.Payload.Module is required") + + _, err = ViewPayloadFromCapability(&aptoscap.ViewPayload{ + Module: &aptoscap.ModuleID{Address: []byte{1}, Name: "coin"}, + }) + require.ErrorContains(t, err, "ViewRequest.Payload.Function is required") + + _, err = ViewPayloadFromCapability(&aptoscap.ViewPayload{ + Module: &aptoscap.ModuleID{ + Address: make([]byte, AccountAddressLength+1), + Name: "coin", + }, + Function: "name", + }) + require.ErrorContains(t, err, "module address too long") +} + +func TestViewPayloadFromCapability_RejectsBadTypeTags(t *testing.T) { + t.Parallel() + + _, err := ViewPayloadFromCapability(&aptoscap.ViewPayload{ + Module: &aptoscap.ModuleID{Address: []byte{1}, Name: "coin"}, + Function: "name", + ArgTypes: []*aptoscap.TypeTag{nil}, + }) + require.ErrorContains(t, err, "invalid arg type at index 0") + require.ErrorContains(t, err, "type tag is nil") + + _, err = ViewPayloadFromCapability(&aptoscap.ViewPayload{ + Module: &aptoscap.ModuleID{Address: []byte{1}, Name: "coin"}, + Function: "name", + ArgTypes: []*aptoscap.TypeTag{ + { + Kind: aptoscap.TypeTagKind_TYPE_TAG_KIND_GENERIC, + Value: &aptoscap.TypeTag_Generic{ + Generic: &aptoscap.GenericTag{Index: 1 << 20}, + }, + }, + }, + }) + require.ErrorContains(t, err, "generic type index out of range") +} diff --git a/pkg/types/chains/aptos/write_status.go b/pkg/types/chains/aptos/write_status.go new file mode 100644 index 000000000..75475fb62 --- /dev/null +++ b/pkg/types/chains/aptos/write_status.go @@ -0,0 +1,250 @@ +package aptos + +import ( + "fmt" + "regexp" + "strconv" + "strings" +) + +type ReceiverExecutionStatus uint8 + +const ( + ReceiverExecutionStatusUnknown ReceiverExecutionStatus = iota + ReceiverExecutionStatusSuccess + ReceiverExecutionStatusReverted +) + +type WriteFailureDecision uint8 + +const ( + WriteFailureDecisionRetryable WriteFailureDecision = iota + WriteFailureDecisionTerminal + WriteFailureDecisionAlreadyProcessed +) + +type WriteFailureKind uint8 + +const ( + WriteFailureKindUnknown WriteFailureKind = iota + WriteFailureKindForwarderRejected + WriteFailureKindReceiverReverted + WriteFailureKindAlreadyProcessed +) + +type WriteFailureClassification struct { + Decision WriteFailureDecision + Kind WriteFailureKind + ReceiverExecutionStatus ReceiverExecutionStatus + Reason string + Message string +} + +func (c WriteFailureClassification) Retryable() bool { + return c.Decision == WriteFailureDecisionRetryable +} + +func (c WriteFailureClassification) AlreadyProcessed() bool { + return c.Decision == WriteFailureDecisionAlreadyProcessed +} + +func (c WriteFailureClassification) Terminal() bool { + return c.Decision != WriteFailureDecisionRetryable +} + +func (c WriteFailureClassification) MessagePtr() *string { + if c.Message == "" { + return nil + } + return &c.Message +} + +var ( + moveAbortLocationRE = regexp.MustCompile(`(?i)move abort(?:ed)?(?: in)? ([^:]+(?:::[^:]+)+):?\s*(.*)$`) + forwarderAbortNames = map[string]string{ + "E_INVALID_DATA_LENGTH": "forwarder rejected the report because the report data was malformed", + "E_INVALID_SIGNER": "forwarder rejected the report because a signer was not part of the DON config", + "E_DUPLICATE_SIGNER": "forwarder rejected the report because the signer set contained duplicates", + "E_INVALID_SIGNATURE_COUNT": "forwarder rejected the report because the signature count was invalid", + "E_INVALID_SIGNATURE": "forwarder rejected the report because a signature was invalid", + "E_ALREADY_PROCESSED": "report was already processed by another node", + "E_MALFORMED_SIGNATURE": "forwarder rejected the report because a signature was malformed", + "E_CALLBACK_DATA_NOT_CONSUMED": "forwarder callback data was not consumed by the receiver", + "E_CONFIG_ID_NOT_FOUND": "forwarder rejected the report because the DON config was not found", + "E_INVALID_REPORT_VERSION": "forwarder rejected the report because the report version was invalid", + } + forwarderAbortCodes = map[uint64]string{ + 1: "forwarder rejected the report because the report data was malformed", + 6: "report was already processed by another node", + 12: "forwarder callback data was not consumed by the receiver", + 15: "forwarder rejected the report because the DON config was not found", + 16: "forwarder rejected the report because the report version was invalid", + 65538: "forwarder rejected the report because a signer was not part of the DON config", + 65539: "forwarder rejected the report because the signer set contained duplicates", + 65540: "forwarder rejected the report because the signature count was invalid", + 65541: "forwarder rejected the report because a signature was invalid", + 65544: "forwarder rejected the report because a signature was malformed", + } +) + +func ClassifyWriteVmStatus(vmStatus string) WriteFailureClassification { + vmStatus = normalizeVmStatus(vmStatus) + if vmStatus == "" || strings.EqualFold(vmStatus, "Executed successfully") { + return WriteFailureClassification{ + Decision: WriteFailureDecisionRetryable, + Kind: WriteFailureKindUnknown, + Reason: "no vm status available", + } + } + + if strings.EqualFold(vmStatus, "Out of gas") { + return WriteFailureClassification{ + Decision: WriteFailureDecisionRetryable, + Kind: WriteFailureKindUnknown, + Reason: "transaction ran out of gas", + Message: vmStatus, + } + } + + // Explicit handling for known non-Move-abort Aptos VM statuses (retryable). + if reason := knownNonMoveVmStatusReason(vmStatus); reason != "" { + return WriteFailureClassification{ + Decision: WriteFailureDecisionRetryable, + Kind: WriteFailureKindUnknown, + Reason: reason, + Message: vmStatus, + } + } + + location, details, ok := splitMoveAbort(vmStatus) + if !ok { + return WriteFailureClassification{ + Decision: WriteFailureDecisionRetryable, + Kind: WriteFailureKindUnknown, + Reason: "vm failure was not a parsed move abort", + Message: vmStatus, + } + } + + if !isForwarderLocation(location) { + return WriteFailureClassification{ + Decision: WriteFailureDecisionTerminal, + Kind: WriteFailureKindReceiverReverted, + ReceiverExecutionStatus: ReceiverExecutionStatusReverted, + Reason: "receiver or user module aborted", + Message: fmt.Sprintf("receiver execution failed: %s", vmStatus), + } + } + + if name := extractAbortName(details); name != "" { + if name == "E_ALREADY_PROCESSED" { + return WriteFailureClassification{ + Decision: WriteFailureDecisionAlreadyProcessed, + Kind: WriteFailureKindAlreadyProcessed, + Reason: "forwarder reported the report was already processed", + Message: fmt.Sprintf("%s: %s", forwarderAbortNames[name], vmStatus), + } + } + if msg, ok := forwarderAbortNames[name]; ok { + return WriteFailureClassification{ + Decision: WriteFailureDecisionTerminal, + Kind: WriteFailureKindForwarderRejected, + Reason: "forwarder reported a terminal validation failure", + Message: fmt.Sprintf("%s: %s", msg, vmStatus), + } + } + } + + if code, ok := extractAbortCode(details); ok { + if code == 6 { + return WriteFailureClassification{ + Decision: WriteFailureDecisionAlreadyProcessed, + Kind: WriteFailureKindAlreadyProcessed, + Reason: "forwarder reported the report was already processed", + Message: fmt.Sprintf("%s: %s", forwarderAbortCodes[code], vmStatus), + } + } + if msg, found := forwarderAbortCodes[code]; found { + return WriteFailureClassification{ + Decision: WriteFailureDecisionTerminal, + Kind: WriteFailureKindForwarderRejected, + Reason: "forwarder reported a terminal validation failure", + Message: fmt.Sprintf("%s: %s", msg, vmStatus), + } + } + } + + return WriteFailureClassification{ + Decision: WriteFailureDecisionRetryable, + Kind: WriteFailureKindUnknown, + Reason: "forwarder abort was not a known terminal code", + Message: vmStatus, + } +} + +func normalizeVmStatus(vmStatus string) string { + vmStatus = strings.TrimSpace(vmStatus) + vmStatus = strings.TrimPrefix(vmStatus, "simulated tx unexpected status: ") + vmStatus = strings.TrimPrefix(vmStatus, "simulate bad status: ") + return strings.TrimSpace(vmStatus) +} + +// knownNonMoveVmStatusReason returns a reason string for known non-Move-abort Aptos VM +// statuses (e.g. transaction expired, sequence errors). Returns "" if not a known status. +func knownNonMoveVmStatusReason(vmStatus string) string { + lower := strings.ToLower(vmStatus) + switch { + case strings.Contains(lower, "transaction expired"): + return "transaction expired before inclusion" + case strings.Contains(lower, "sequence_number_too_old"), strings.Contains(lower, "sequence_number_too_new"): + return "sequence number conflict; may need nonce resync" + case strings.Contains(lower, "miscellaneous error"): + return "vm miscellaneous error" + case strings.Contains(lower, "insufficient_balance_for_transaction_fee"): + return "insufficient balance for transaction fee" + default: + return "" + } +} + +func splitMoveAbort(vmStatus string) (location string, details string, ok bool) { + matches := moveAbortLocationRE.FindStringSubmatch(vmStatus) + if len(matches) == 3 { + return strings.TrimSpace(matches[1]), strings.TrimSpace(matches[2]), true + } + if strings.Contains(strings.ToLower(vmStatus), "move abort") { + return "", strings.TrimSpace(vmStatus), true + } + return "", "", false +} + +func isForwarderLocation(location string) bool { + location = strings.ToLower(strings.TrimSpace(location)) + return strings.HasSuffix(location, "::forwarder") || strings.Contains(location, "platform::forwarder") +} + +func extractAbortName(details string) string { + for _, token := range strings.FieldsFunc(details, func(r rune) bool { + return !(r == '_' || ('A' <= r && r <= 'Z') || ('0' <= r && r <= '9')) + }) { + if strings.HasPrefix(token, "E_") { + return token + } + } + return "" +} + +func extractAbortCode(details string) (uint64, bool) { + for _, token := range strings.Fields(details) { + token = strings.Trim(token, "(),.;") + if strings.HasPrefix(strings.ToLower(token), "0x") { + if value, err := strconv.ParseUint(token[2:], 16, 64); err == nil { + return value, true + } + } + if value, err := strconv.ParseUint(token, 10, 64); err == nil { + return value, true + } + } + return 0, false +} diff --git a/pkg/types/chains/aptos/write_status_test.go b/pkg/types/chains/aptos/write_status_test.go new file mode 100644 index 000000000..09dc7668f --- /dev/null +++ b/pkg/types/chains/aptos/write_status_test.go @@ -0,0 +1,132 @@ +package aptos + +import ( + "strings" + "testing" +) + +func TestClassifyWriteVmStatus(t *testing.T) { + t.Run("receiver revert is terminal and marks receiver reverted", func(t *testing.T) { + classification := ClassifyWriteVmStatus("Move abort in 0xabc::receiver::module: 42") + if classification.Decision != WriteFailureDecisionTerminal { + t.Fatalf("expected terminal, got %v", classification.Decision) + } + if classification.Kind != WriteFailureKindReceiverReverted { + t.Fatalf("expected receiver reverted kind, got %v", classification.Kind) + } + if classification.ReceiverExecutionStatus != ReceiverExecutionStatusReverted { + t.Fatalf("expected receiver reverted status, got %v", classification.ReceiverExecutionStatus) + } + }) + + t.Run("known forwarder abort is terminal", func(t *testing.T) { + classification := ClassifyWriteVmStatus("Move abort in 0x1::platform::forwarder: E_INVALID_SIGNATURE") + if classification.Decision != WriteFailureDecisionTerminal { + t.Fatalf("expected terminal, got %v", classification.Decision) + } + if classification.Kind != WriteFailureKindForwarderRejected { + t.Fatalf("expected forwarder rejected kind, got %v", classification.Kind) + } + }) + + t.Run("already processed is explicit decision", func(t *testing.T) { + classification := ClassifyWriteVmStatus("Move abort in 0x1::platform::forwarder: E_ALREADY_PROCESSED") + if classification.Decision != WriteFailureDecisionAlreadyProcessed { + t.Fatalf("expected already processed, got %v", classification.Decision) + } + if classification.Kind != WriteFailureKindAlreadyProcessed { + t.Fatalf("expected already processed kind, got %v", classification.Kind) + } + }) + + t.Run("unknown forwarder abort remains retryable", func(t *testing.T) { + classification := ClassifyWriteVmStatus("Move abort in 0x1::platform::forwarder: 99999") + if classification.Decision != WriteFailureDecisionRetryable { + t.Fatalf("expected retryable, got %v", classification.Decision) + } + if classification.Kind != WriteFailureKindUnknown { + t.Fatalf("expected unknown kind, got %v", classification.Kind) + } + }) + + t.Run("out of gas remains retryable", func(t *testing.T) { + classification := ClassifyWriteVmStatus("Out of gas") + if classification.Decision != WriteFailureDecisionRetryable { + t.Fatalf("expected retryable, got %v", classification.Decision) + } + if classification.Message == "" { + t.Fatal("expected out of gas message") + } + }) + + t.Run("normalizeVmStatus strips simulated tx unexpected status prefix", func(t *testing.T) { + // Prefix is stripped so the inner status is classified as forwarder terminal + classification := ClassifyWriteVmStatus("simulated tx unexpected status: Move abort in 0x1::platform::forwarder: E_INVALID_SIGNATURE") + if classification.Decision != WriteFailureDecisionTerminal { + t.Fatalf("expected terminal after prefix strip, got %v", classification.Decision) + } + if classification.Kind != WriteFailureKindForwarderRejected { + t.Fatalf("expected forwarder rejected, got %v", classification.Kind) + } + }) + + t.Run("normalizeVmStatus strips simulate bad status prefix", func(t *testing.T) { + classification := ClassifyWriteVmStatus("simulate bad status: Out of gas") + if classification.Decision != WriteFailureDecisionRetryable { + t.Fatalf("expected retryable after prefix strip, got %v", classification.Decision) + } + if classification.Reason != "transaction ran out of gas" { + t.Fatalf("expected out of gas reason, got %q", classification.Reason) + } + }) + + t.Run("forwarder location with ::forwarder suffix is forwarder", func(t *testing.T) { + classification := ClassifyWriteVmStatus("Move abort in 0xaa::forwarder: E_INVALID_SIGNATURE") + if classification.Decision != WriteFailureDecisionTerminal { + t.Fatalf("expected terminal for ::forwarder location, got %v", classification.Decision) + } + if classification.Kind != WriteFailureKindForwarderRejected { + t.Fatalf("expected forwarder rejected, got %v", classification.Kind) + } + }) + + t.Run("known non-Move status transaction expired is retryable", func(t *testing.T) { + classification := ClassifyWriteVmStatus("Transaction expired") + if classification.Decision != WriteFailureDecisionRetryable { + t.Fatalf("expected retryable, got %v", classification.Decision) + } + if classification.Reason != "transaction expired before inclusion" { + t.Fatalf("expected expired reason, got %q", classification.Reason) + } + }) + + t.Run("known non-Move status SEQUENCE_NUMBER_TOO_OLD is retryable", func(t *testing.T) { + classification := ClassifyWriteVmStatus("SEQUENCE_NUMBER_TOO_OLD") + if classification.Decision != WriteFailureDecisionRetryable { + t.Fatalf("expected retryable, got %v", classification.Decision) + } + if !strings.Contains(strings.ToLower(classification.Reason), "sequence") { + t.Fatalf("expected sequence in reason, got %q", classification.Reason) + } + }) + + t.Run("known non-Move status Miscellaneous error is retryable", func(t *testing.T) { + classification := ClassifyWriteVmStatus("Miscellaneous error") + if classification.Decision != WriteFailureDecisionRetryable { + t.Fatalf("expected retryable, got %v", classification.Decision) + } + if classification.Reason != "vm miscellaneous error" { + t.Fatalf("expected miscellaneous reason, got %q", classification.Reason) + } + }) + + t.Run("known non-Move status insufficient balance is retryable", func(t *testing.T) { + classification := ClassifyWriteVmStatus("INSUFFICIENT_BALANCE_FOR_TRANSACTION_FEE") + if classification.Decision != WriteFailureDecisionRetryable { + t.Fatalf("expected retryable, got %v", classification.Decision) + } + if classification.Reason != "insufficient balance for transaction fee" { + t.Fatalf("expected balance reason, got %q", classification.Reason) + } + }) +} diff --git a/pkg/types/mocks/aptos_service.go b/pkg/types/mocks/aptos_service.go index 5ab7f4a9a..d8319ad26 100644 --- a/pkg/types/mocks/aptos_service.go +++ b/pkg/types/mocks/aptos_service.go @@ -141,6 +141,62 @@ func (_c *AptosService_AccountTransactions_Call) RunAndReturn(run func(context.C return _c } +// LedgerVersion provides a mock function with given fields: ctx +func (_m *AptosService) LedgerVersion(ctx context.Context) (uint64, error) { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for LedgerVersion") + } + + var r0 uint64 + var r1 error + if rf, ok := ret.Get(0).(func(context.Context) (uint64, error)); ok { + return rf(ctx) + } + if rf, ok := ret.Get(0).(func(context.Context) uint64); ok { + r0 = rf(ctx) + } else { + r0 = ret.Get(0).(uint64) + } + + if rf, ok := ret.Get(1).(func(context.Context) error); ok { + r1 = rf(ctx) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// AptosService_LedgerVersion_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LedgerVersion' +type AptosService_LedgerVersion_Call struct { + *mock.Call +} + +// LedgerVersion is a helper method to define mock.On call +// - ctx context.Context +func (_e *AptosService_Expecter) LedgerVersion(ctx interface{}) *AptosService_LedgerVersion_Call { + return &AptosService_LedgerVersion_Call{Call: _e.mock.On("LedgerVersion", ctx)} +} + +func (_c *AptosService_LedgerVersion_Call) Run(run func(ctx context.Context)) *AptosService_LedgerVersion_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *AptosService_LedgerVersion_Call) Return(_a0 uint64, _a1 error) *AptosService_LedgerVersion_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *AptosService_LedgerVersion_Call) RunAndReturn(run func(context.Context) (uint64, error)) *AptosService_LedgerVersion_Call { + _c.Call.Return(run) + return _c +} + // SubmitTransaction provides a mock function with given fields: ctx, req func (_m *AptosService) SubmitTransaction(ctx context.Context, req aptos.SubmitTransactionRequest) (*aptos.SubmitTransactionReply, error) { ret := _m.Called(ctx, req) diff --git a/pkg/types/relayer.go b/pkg/types/relayer.go index 47c4628ab..dea0d7a5a 100644 --- a/pkg/types/relayer.go +++ b/pkg/types/relayer.go @@ -564,6 +564,10 @@ var _ AptosService = &UnimplementedAptosService{} // In the future, embedding this type may be required to implement AptosService (through use of an unexported method). type UnimplementedAptosService struct{} +func (ua *UnimplementedAptosService) LedgerVersion(ctx context.Context) (uint64, error) { + return 0, status.Errorf(codes.Unimplemented, "method LedgerVersion not implemented") +} + func (ua *UnimplementedAptosService) AccountAPTBalance(ctx context.Context, req aptos.AccountAPTBalanceRequest) (*aptos.AccountAPTBalanceReply, error) { return nil, status.Errorf(codes.Unimplemented, "method AccountAPTBalance not implemented") }