diff --git a/workflows/chip-cre.json b/workflows/chip-cre.json index 08860f57..e41795d3 100644 --- a/workflows/chip-cre.json +++ b/workflows/chip-cre.json @@ -189,6 +189,10 @@ } ] }, + { + "entity": "workflows.v2.ChainTransactionObserved", + "path": "workflows/v2/chain_transaction_observed.proto" + }, { "entity": "workflows.v2.WorkflowExecutionFinished", "path": "workflows/v2/workflow_execution_finished.proto", diff --git a/workflows/go/generate.go b/workflows/go/generate.go index 30745ffe..9a8c36a8 100644 --- a/workflows/go/generate.go +++ b/workflows/go/generate.go @@ -17,6 +17,7 @@ package workflows //go:generate protoc --proto_path=../ --go_out=./ --go_opt=module=github.com/smartcontractkit/chainlink-protos/workflows/go ../workflows/v2/cre_info.proto //go:generate protoc --proto_path=../ --go_out=./ --go_opt=module=github.com/smartcontractkit/chainlink-protos/workflows/go ../workflows/v2/workflow_key.proto //go:generate protoc --proto_path=../ --go_out=./ --go_opt=module=github.com/smartcontractkit/chainlink-protos/workflows/go ../workflows/v2/transaction_info.proto +//go:generate protoc --proto_path=../ --go_out=./ --go_opt=module=github.com/smartcontractkit/chainlink-protos/workflows/go ../workflows/v2/chain_transaction_observed.proto //go:generate protoc --proto_path=../ --go_out=./ --go_opt=module=github.com/smartcontractkit/chainlink-protos/workflows/go ../workflows/v2/workflow.proto //go:generate protoc --proto_path=../ --go_out=./ --go_opt=module=github.com/smartcontractkit/chainlink-protos/workflows/go ../workflows/v2/workflow_deployed.proto //go:generate protoc --proto_path=../ --go_out=./ --go_opt=module=github.com/smartcontractkit/chainlink-protos/workflows/go ../workflows/v2/workflow_updated.proto diff --git a/workflows/go/v2/chain_transaction_observed.pb.go b/workflows/go/v2/chain_transaction_observed.pb.go new file mode 100644 index 00000000..7e69bb88 --- /dev/null +++ b/workflows/go/v2/chain_transaction_observed.pb.go @@ -0,0 +1,334 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.6 +// protoc v5.29.3 +// source: workflows/v2/chain_transaction_observed.proto + +package v2 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// TxStatus is the on-chain outcome of the billed transaction, as known when the capability +// reports its fee. Consumers fetch the receipt for anything beyond that. +type TxStatus int32 + +const ( + TxStatus_TX_STATUS_UNSPECIFIED TxStatus = 0 + TxStatus_TX_STATUS_SUCCESS TxStatus = 1 + TxStatus_TX_STATUS_REVERTED TxStatus = 2 + TxStatus_TX_STATUS_FAILED TxStatus = 3 +) + +// Enum value maps for TxStatus. +var ( + TxStatus_name = map[int32]string{ + 0: "TX_STATUS_UNSPECIFIED", + 1: "TX_STATUS_SUCCESS", + 2: "TX_STATUS_REVERTED", + 3: "TX_STATUS_FAILED", + } + TxStatus_value = map[string]int32{ + "TX_STATUS_UNSPECIFIED": 0, + "TX_STATUS_SUCCESS": 1, + "TX_STATUS_REVERTED": 2, + "TX_STATUS_FAILED": 3, + } +) + +func (x TxStatus) Enum() *TxStatus { + p := new(TxStatus) + *p = x + return p +} + +func (x TxStatus) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (TxStatus) Descriptor() protoreflect.EnumDescriptor { + return file_workflows_v2_chain_transaction_observed_proto_enumTypes[0].Descriptor() +} + +func (TxStatus) Type() protoreflect.EnumType { + return &file_workflows_v2_chain_transaction_observed_proto_enumTypes[0] +} + +func (x TxStatus) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use TxStatus.Descriptor instead. +func (TxStatus) EnumDescriptor() ([]byte, []int) { + return file_workflows_v2_chain_transaction_observed_proto_rawDescGZIP(), []int{0} +} + +// TransmissionOutcome is what happened to the report once it reached the receiver, as seen by +// the forwarder. It is independent of TxStatus: a transaction can succeed on chain while the +// receiver rejects or reverts the report. +type TransmissionOutcome int32 + +const ( + TransmissionOutcome_TRANSMISSION_OUTCOME_UNSPECIFIED TransmissionOutcome = 0 + // The forwarder delivered the report and the receiver accepted it. + TransmissionOutcome_TRANSMISSION_OUTCOME_SUCCEEDED TransmissionOutcome = 1 + // The forwarder delivered the report but the receiver call reverted (an internal revert). + TransmissionOutcome_TRANSMISSION_OUTCOME_RECEIVER_REVERTED TransmissionOutcome = 2 + // The receiver is not a valid report receiver, so the forwarder did not deliver the report. + TransmissionOutcome_TRANSMISSION_OUTCOME_INVALID_RECEIVER TransmissionOutcome = 3 + // The transmission failed for another reason. + TransmissionOutcome_TRANSMISSION_OUTCOME_FAILED TransmissionOutcome = 4 + // The forwarder has no record of a delivery attempt for this report. + TransmissionOutcome_TRANSMISSION_OUTCOME_NOT_ATTEMPTED TransmissionOutcome = 5 +) + +// Enum value maps for TransmissionOutcome. +var ( + TransmissionOutcome_name = map[int32]string{ + 0: "TRANSMISSION_OUTCOME_UNSPECIFIED", + 1: "TRANSMISSION_OUTCOME_SUCCEEDED", + 2: "TRANSMISSION_OUTCOME_RECEIVER_REVERTED", + 3: "TRANSMISSION_OUTCOME_INVALID_RECEIVER", + 4: "TRANSMISSION_OUTCOME_FAILED", + 5: "TRANSMISSION_OUTCOME_NOT_ATTEMPTED", + } + TransmissionOutcome_value = map[string]int32{ + "TRANSMISSION_OUTCOME_UNSPECIFIED": 0, + "TRANSMISSION_OUTCOME_SUCCEEDED": 1, + "TRANSMISSION_OUTCOME_RECEIVER_REVERTED": 2, + "TRANSMISSION_OUTCOME_INVALID_RECEIVER": 3, + "TRANSMISSION_OUTCOME_FAILED": 4, + "TRANSMISSION_OUTCOME_NOT_ATTEMPTED": 5, + } +) + +func (x TransmissionOutcome) Enum() *TransmissionOutcome { + p := new(TransmissionOutcome) + *p = x + return p +} + +func (x TransmissionOutcome) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (TransmissionOutcome) Descriptor() protoreflect.EnumDescriptor { + return file_workflows_v2_chain_transaction_observed_proto_enumTypes[1].Descriptor() +} + +func (TransmissionOutcome) Type() protoreflect.EnumType { + return &file_workflows_v2_chain_transaction_observed_proto_enumTypes[1] +} + +func (x TransmissionOutcome) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use TransmissionOutcome.Descriptor instead. +func (TransmissionOutcome) EnumDescriptor() ([]byte, []int) { + return file_workflows_v2_chain_transaction_observed_proto_rawDescGZIP(), []int{1} +} + +// ChainTransactionObserved is emitted once per write, for the transaction whose fee the +// capability puts in its billing metadata. That is the first successful transmission when +// the report landed, or the failed transmission the capability still charges for. It carries +// only what is needed to attribute that transaction to the execution; the Blockchain Finality +// Service dedups events by (chain_selector, tx_hash) and resolves the receipt, fee and +// finality itself. +type ChainTransactionObserved struct { + state protoimpl.MessageState `protogen:"open.v1"` + WorkflowExecutionId string `protobuf:"bytes,1,opt,name=workflow_execution_id,json=workflowExecutionId,proto3" json:"workflow_execution_id,omitempty"` + WorkflowId string `protobuf:"bytes,2,opt,name=workflow_id,json=workflowId,proto3" json:"workflow_id,omitempty"` + ChainSelector uint64 `protobuf:"varint,3,opt,name=chain_selector,json=chainSelector,proto3" json:"chain_selector,omitempty"` + // Chain-native encoding. EVM: 0x-prefixed lowercase hex. Solana: base58 signature. + TxHash string `protobuf:"bytes,4,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"` + TxStatus TxStatus `protobuf:"varint,5,opt,name=tx_status,json=txStatus,proto3,enum=workflows.v2.TxStatus" json:"tx_status,omitempty"` + // Unix milliseconds at which the node observed the transaction. + ObservedAtMs int64 `protobuf:"varint,6,opt,name=observed_at_ms,json=observedAtMs,proto3" json:"observed_at_ms,omitempty"` + // Outcome of the report transmission as seen by the forwarder, when the chain reports one. + TransmissionOutcome TransmissionOutcome `protobuf:"varint,7,opt,name=transmission_outcome,json=transmissionOutcome,proto3,enum=workflows.v2.TransmissionOutcome" json:"transmission_outcome,omitempty"` + // IsBilled indicates whether the customer was build for this tx. + IsBilled bool `protobuf:"varint,8,opt,name=is_billed,json=isBilled,proto3" json:"is_billed,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ChainTransactionObserved) Reset() { + *x = ChainTransactionObserved{} + mi := &file_workflows_v2_chain_transaction_observed_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ChainTransactionObserved) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ChainTransactionObserved) ProtoMessage() {} + +func (x *ChainTransactionObserved) ProtoReflect() protoreflect.Message { + mi := &file_workflows_v2_chain_transaction_observed_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 ChainTransactionObserved.ProtoReflect.Descriptor instead. +func (*ChainTransactionObserved) Descriptor() ([]byte, []int) { + return file_workflows_v2_chain_transaction_observed_proto_rawDescGZIP(), []int{0} +} + +func (x *ChainTransactionObserved) GetWorkflowExecutionId() string { + if x != nil { + return x.WorkflowExecutionId + } + return "" +} + +func (x *ChainTransactionObserved) GetWorkflowId() string { + if x != nil { + return x.WorkflowId + } + return "" +} + +func (x *ChainTransactionObserved) GetChainSelector() uint64 { + if x != nil { + return x.ChainSelector + } + return 0 +} + +func (x *ChainTransactionObserved) GetTxHash() string { + if x != nil { + return x.TxHash + } + return "" +} + +func (x *ChainTransactionObserved) GetTxStatus() TxStatus { + if x != nil { + return x.TxStatus + } + return TxStatus_TX_STATUS_UNSPECIFIED +} + +func (x *ChainTransactionObserved) GetObservedAtMs() int64 { + if x != nil { + return x.ObservedAtMs + } + return 0 +} + +func (x *ChainTransactionObserved) GetTransmissionOutcome() TransmissionOutcome { + if x != nil { + return x.TransmissionOutcome + } + return TransmissionOutcome_TRANSMISSION_OUTCOME_UNSPECIFIED +} + +func (x *ChainTransactionObserved) GetIsBilled() bool { + if x != nil { + return x.IsBilled + } + return false +} + +var File_workflows_v2_chain_transaction_observed_proto protoreflect.FileDescriptor + +const file_workflows_v2_chain_transaction_observed_proto_rawDesc = "" + + "\n" + + "-workflows/v2/chain_transaction_observed.proto\x12\fworkflows.v2\"\xfd\x02\n" + + "\x18ChainTransactionObserved\x122\n" + + "\x15workflow_execution_id\x18\x01 \x01(\tR\x13workflowExecutionId\x12\x1f\n" + + "\vworkflow_id\x18\x02 \x01(\tR\n" + + "workflowId\x12%\n" + + "\x0echain_selector\x18\x03 \x01(\x04R\rchainSelector\x12\x17\n" + + "\atx_hash\x18\x04 \x01(\tR\x06txHash\x123\n" + + "\ttx_status\x18\x05 \x01(\x0e2\x16.workflows.v2.TxStatusR\btxStatus\x12$\n" + + "\x0eobserved_at_ms\x18\x06 \x01(\x03R\fobservedAtMs\x12T\n" + + "\x14transmission_outcome\x18\a \x01(\x0e2!.workflows.v2.TransmissionOutcomeR\x13transmissionOutcome\x12\x1b\n" + + "\tis_billed\x18\b \x01(\bR\bisBilled*j\n" + + "\bTxStatus\x12\x19\n" + + "\x15TX_STATUS_UNSPECIFIED\x10\x00\x12\x15\n" + + "\x11TX_STATUS_SUCCESS\x10\x01\x12\x16\n" + + "\x12TX_STATUS_REVERTED\x10\x02\x12\x14\n" + + "\x10TX_STATUS_FAILED\x10\x03*\xff\x01\n" + + "\x13TransmissionOutcome\x12$\n" + + " TRANSMISSION_OUTCOME_UNSPECIFIED\x10\x00\x12\"\n" + + "\x1eTRANSMISSION_OUTCOME_SUCCEEDED\x10\x01\x12*\n" + + "&TRANSMISSION_OUTCOME_RECEIVER_REVERTED\x10\x02\x12)\n" + + "%TRANSMISSION_OUTCOME_INVALID_RECEIVER\x10\x03\x12\x1f\n" + + "\x1bTRANSMISSION_OUTCOME_FAILED\x10\x04\x12&\n" + + "\"TRANSMISSION_OUTCOME_NOT_ATTEMPTED\x10\x05B>Z workflows.v2.TxStatus + 1, // 1: workflows.v2.ChainTransactionObserved.transmission_outcome:type_name -> workflows.v2.TransmissionOutcome + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_workflows_v2_chain_transaction_observed_proto_init() } +func file_workflows_v2_chain_transaction_observed_proto_init() { + if File_workflows_v2_chain_transaction_observed_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_workflows_v2_chain_transaction_observed_proto_rawDesc), len(file_workflows_v2_chain_transaction_observed_proto_rawDesc)), + NumEnums: 2, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_workflows_v2_chain_transaction_observed_proto_goTypes, + DependencyIndexes: file_workflows_v2_chain_transaction_observed_proto_depIdxs, + EnumInfos: file_workflows_v2_chain_transaction_observed_proto_enumTypes, + MessageInfos: file_workflows_v2_chain_transaction_observed_proto_msgTypes, + }.Build() + File_workflows_v2_chain_transaction_observed_proto = out.File + file_workflows_v2_chain_transaction_observed_proto_goTypes = nil + file_workflows_v2_chain_transaction_observed_proto_depIdxs = nil +} diff --git a/workflows/iron-flask-cre.yaml b/workflows/iron-flask-cre.yaml index abfca1e3..fb660781 100644 --- a/workflows/iron-flask-cre.yaml +++ b/workflows/iron-flask-cre.yaml @@ -87,6 +87,9 @@ beholder: - entity: TransactionInfo schema: "workflows/v2/transaction_info.proto" + - entity: ChainTransactionObserved + schema: "workflows/v2/chain_transaction_observed.proto" + - entity: Workflow schema: "workflows/v2/workflow.proto" references: diff --git a/workflows/workflows/v2/chain_transaction_observed.proto b/workflows/workflows/v2/chain_transaction_observed.proto new file mode 100644 index 00000000..3253fb9e --- /dev/null +++ b/workflows/workflows/v2/chain_transaction_observed.proto @@ -0,0 +1,52 @@ +syntax = "proto3"; + +package workflows.v2; + +option go_package = "github.com/smartcontractkit/chainlink-protos/workflows/go/v2"; + +// TxStatus is the on-chain outcome of the billed transaction, as known when the capability +// reports its fee. Consumers fetch the receipt for anything beyond that. +enum TxStatus { + TX_STATUS_UNSPECIFIED = 0; + TX_STATUS_SUCCESS = 1; + TX_STATUS_REVERTED = 2; + TX_STATUS_FAILED = 3; +} + +// TransmissionOutcome is what happened to the report once it reached the receiver, as seen by +// the forwarder. It is independent of TxStatus: a transaction can succeed on chain while the +// receiver rejects or reverts the report. +enum TransmissionOutcome { + TRANSMISSION_OUTCOME_UNSPECIFIED = 0; + // The forwarder delivered the report and the receiver accepted it. + TRANSMISSION_OUTCOME_SUCCEEDED = 1; + // The forwarder delivered the report but the receiver call reverted (an internal revert). + TRANSMISSION_OUTCOME_RECEIVER_REVERTED = 2; + // The receiver is not a valid report receiver, so the forwarder did not deliver the report. + TRANSMISSION_OUTCOME_INVALID_RECEIVER = 3; + // The transmission failed for another reason. + TRANSMISSION_OUTCOME_FAILED = 4; + // The forwarder has no record of a delivery attempt for this report. + TRANSMISSION_OUTCOME_NOT_ATTEMPTED = 5; +} + +// ChainTransactionObserved is emitted once per write, for the transaction whose fee the +// capability puts in its billing metadata. That is the first successful transmission when +// the report landed, or the failed transmission the capability still charges for. It carries +// only what is needed to attribute that transaction to the execution; the Blockchain Finality +// Service dedups events by (chain_selector, tx_hash) and resolves the receipt, fee and +// finality itself. +message ChainTransactionObserved { + string workflow_execution_id = 1; + string workflow_id = 2; + uint64 chain_selector = 3; + // Chain-native encoding. EVM: 0x-prefixed lowercase hex. Solana: base58 signature. + string tx_hash = 4; + TxStatus tx_status = 5; + // Unix milliseconds at which the node observed the transaction. + int64 observed_at_ms = 6; + // Outcome of the report transmission as seen by the forwarder, when the chain reports one. + TransmissionOutcome transmission_outcome = 7; + // IsBilled indicates whether the customer was build for this tx. + bool is_billed = 8; +}