diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index c838ca50..7f1f8733 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -33,5 +33,8 @@ # Node Platform /node-platform/ @smartcontractkit/infra-nodes @smartcontractkit/op-tooling @smartcontractkit/rane +# Chain Capabilities +/chain-capabilities/ @smartcontractkit/keystone @smartcontractkit/bix-framework @smartcontractkit/op-tooling + # Release changesets do not have owners /.changeset/** diff --git a/.github/workflows/register-chain-capabilities-schemas.yaml b/.github/workflows/register-chain-capabilities-schemas.yaml new file mode 100644 index 00000000..46c2d9b0 --- /dev/null +++ b/.github/workflows/register-chain-capabilities-schemas.yaml @@ -0,0 +1,56 @@ +name: register-chain-capabilities-schemas + +on: + workflow_dispatch: + push: + branches: + - main + paths: + - ".github/workflows/register-chain-capabilities-schemas.yaml" + - "chain-capabilities/**/*.proto" + - "chain-capabilities/chip-schemas.json" + - "chain-capabilities/beholder-schemas.json" + pull_request: + paths: + - ".github/workflows/register-chain-capabilities-schemas.yaml" + - "chain-capabilities/**/*.proto" + - "chain-capabilities/chip-schemas.json" + - "chain-capabilities/beholder-schemas.json" + +jobs: + register-schemas: + runs-on: ubuntu-latest + environment: publish + permissions: + id-token: write + contents: read + + strategy: + fail-fast: false + matrix: + config: + - { name: chain-capabilities, file: chip-schemas.json } + - { name: beholder, file: beholder-schemas.json } + + steps: + - uses: actions/checkout@v5 + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2 + with: + mask-aws-account-id: true + role-to-assume: ${{ secrets.AWS_IAM_ROLE_PUBLISH_ARN }} + aws-region: ${{ secrets.AWS_REGION }} + + - name: Register Chain Capabilities Schemas for ${{ matrix.config.name }} domain + uses: smartcontractkit/.github/actions/chip-schema-registration@b1bec0ae729606681897cbf7fad5d7c1d572173e # v1.1.0 + with: + aws-account-id: ${{ secrets.AWS_ACCOUNT_ID_ROOT }} + aws-region: us-west-2 + chip-schema-dir: "chain-capabilities" + chip-config-file-path: "chain-capabilities/${{ matrix.config.file }}" + chip-config-host: ${{ github.ref_name == 'main' && secrets.chip_config_host_prod || secrets.chip_config_host_staging }} + chip-config-user: ${{ secrets.chip_config_user }} + chip-config-password: ${{ github.ref_name == 'main' && secrets.chip_config_password_prod || secrets.chip_config_password_staging }} + ts-ouath-client-id: ${{ secrets.chip_config_ts_oauth_client_id }} + ts-ouath-secret: ${{ secrets.chip_config_ts_oauth_secret }} diff --git a/.github/workflows/register-data-feeds-schemas.yaml b/.github/workflows/register-data-feeds-schemas.yaml index 286b02ad..d0b3a1ff 100644 --- a/.github/workflows/register-data-feeds-schemas.yaml +++ b/.github/workflows/register-data-feeds-schemas.yaml @@ -11,6 +11,7 @@ on: - "data-feeds/chip-schemas.json" - "data-feeds/chip-job-spec-schemas.json" - "data-feeds/beholder-job-spec-schemas.json" + - "data-feeds/beholder-schemas.json" pull_request: paths: - ".github/workflows/register-data-feeds-schemas.yaml" @@ -18,6 +19,7 @@ on: - "data-feeds/chip-schemas.json" - "data-feeds/chip-job-spec-schemas.json" - "data-feeds/beholder-job-spec-schemas.json" + - "data-feeds/beholder-schemas.json" jobs: register-schemas: @@ -34,6 +36,7 @@ jobs: - { name: data-feeds, file: chip-schemas.json } - { name: job-spec, file: chip-job-spec-schemas.json } - { name: job-spec-beholder, file: beholder-job-spec-schemas.json } + - { name: beholder, file: beholder-schemas.json } steps: - uses: actions/checkout@v5 diff --git a/buf.yaml b/buf.yaml index 04139df6..d4eec14a 100644 --- a/buf.yaml +++ b/buf.yaml @@ -61,6 +61,7 @@ modules: - ENUM_VALUE_PREFIX - ENUM_ZERO_VALUE_SUFFIX - path: node-platform + - path: chain-capabilities lint: use: diff --git a/chain-capabilities/beholder-schemas.json b/chain-capabilities/beholder-schemas.json new file mode 100644 index 00000000..8b0b315c --- /dev/null +++ b/chain-capabilities/beholder-schemas.json @@ -0,0 +1,38 @@ +{ + "domain": "beholder__chain_capabilities__messages", + "schemas": [ + { + "entity": "WriteReportInitiated", + "path": "evm/monitoring/write_report.proto", + "references": [ + { + "name": "libs/monitoring/execution_context.proto", + "entity": "monitoring.ExecutionContext", + "path": "libs/monitoring/execution_context.proto" + } + ] + }, + { + "entity": "WriteReportSuccess", + "path": "evm/monitoring/write_report.proto", + "references": [ + { + "name": "libs/monitoring/execution_context.proto", + "entity": "monitoring.ExecutionContext", + "path": "libs/monitoring/execution_context.proto" + } + ] + }, + { + "entity": "WriteReportError", + "path": "evm/monitoring/write_report.proto", + "references": [ + { + "name": "libs/monitoring/execution_context.proto", + "entity": "monitoring.ExecutionContext", + "path": "libs/monitoring/execution_context.proto" + } + ] + } + ] +} diff --git a/chain-capabilities/chip-schemas.json b/chain-capabilities/chip-schemas.json new file mode 100644 index 00000000..2afb6022 --- /dev/null +++ b/chain-capabilities/chip-schemas.json @@ -0,0 +1,38 @@ +{ + "domain": "chain-capabilities", + "schemas": [ + { + "entity": "WriteReportInitiated", + "path": "evm/monitoring/write_report.proto", + "references": [ + { + "name": "libs/monitoring/execution_context.proto", + "entity": "monitoring.ExecutionContext", + "path": "libs/monitoring/execution_context.proto" + } + ] + }, + { + "entity": "WriteReportSuccess", + "path": "evm/monitoring/write_report.proto", + "references": [ + { + "name": "libs/monitoring/execution_context.proto", + "entity": "monitoring.ExecutionContext", + "path": "libs/monitoring/execution_context.proto" + } + ] + }, + { + "entity": "WriteReportError", + "path": "evm/monitoring/write_report.proto", + "references": [ + { + "name": "libs/monitoring/execution_context.proto", + "entity": "monitoring.ExecutionContext", + "path": "libs/monitoring/execution_context.proto" + } + ] + } + ] +} diff --git a/chain-capabilities/evm/monitoring/write_report.proto b/chain-capabilities/evm/monitoring/write_report.proto new file mode 100644 index 00000000..b1b04e55 --- /dev/null +++ b/chain-capabilities/evm/monitoring/write_report.proto @@ -0,0 +1,57 @@ +// Copied from https://github.com/smartcontractkit/capabilities/blob/main/chain_capabilities/evm/monitoring/write_report.proto +syntax = "proto3"; + +package chain_capabilities.evm; + +option go_package = "github.com/smartcontractkit/chainlink-protos/chain-capabilities/evm/monitoring"; + +import "libs/monitoring/execution_context.proto"; + +message WriteReportInitiated { + WriteReportRequest req = 1; + monitoring.ExecutionContext execution_context = 20; +} + +message WriteReportSuccess { + WriteReportRequest req = 1; + int32 log_count = 2; + monitoring.ExecutionContext execution_context = 20; +} + +message WriteReportError { + WriteReportRequest req = 1; + string summary = 2; + string cause = 3; + monitoring.ExecutionContext execution_context = 20; +} + +message WriteReportTxFeeCalculationError { + WriteReportRequest req = 1; + string summary = 2; + string cause = 3; + string tx_idempotency_key = 4; + monitoring.ExecutionContext execution_context = 20; +} + +message WriteReportRequest { + bytes receiver = 1; + ReportResponse report = 2; + optional GasConfig gas_config = 3; +} + +message GasConfig { + uint64 gas_limit = 1; +} + +message ReportResponse { + bytes config_digest = 1; + uint64 seq_nr = 2; + bytes report_context = 3; // combination of seq_nr and config_digest + bytes raw_report = 4; + repeated AttributedSignature sigs = 5; +} + +message AttributedSignature { + bytes signature = 1; + uint32 signer_id = 2; +} diff --git a/chain-capabilities/libs/monitoring/execution_context.proto b/chain-capabilities/libs/monitoring/execution_context.proto new file mode 100644 index 00000000..35eed5b3 --- /dev/null +++ b/chain-capabilities/libs/monitoring/execution_context.proto @@ -0,0 +1,33 @@ +// Copied from https://github.com/smartcontractkit/capabilities/blob/main/libs/monitoring/execution_context.proto +syntax = "proto3"; + +package monitoring; + +option go_package = "github.com/smartcontractkit/chainlink-protos/chain-capabilities/libs/monitoring"; + +// [Execution Context] +message ExecutionContext { + // Execution Context - Source + string meta_source_id = 1; + + // Execution Context - Chain + string meta_chain_family_name = 2; + string meta_chain_id = 3; + string meta_network_name = 4; + string meta_network_name_full = 5; + + // Execution Context - Workflow (capabilities.RequestMetadata) + string meta_workflow_id = 6; + string meta_workflow_owner = 7; + string meta_workflow_execution_id = 8; + string meta_workflow_name = 9; + uint32 meta_workflow_don_id = 10; + uint32 meta_workflow_don_config_version = 11; + string meta_reference_id = 12; + + // Execution Context - Capability + string meta_capability_type = 13; + string meta_capability_id = 14; + uint64 meta_capability_timestamp_start = 15; + uint64 meta_capability_timestamp_emit = 16; +} diff --git a/data-feeds/beholder-schemas.json b/data-feeds/beholder-schemas.json new file mode 100644 index 00000000..f61459d4 --- /dev/null +++ b/data-feeds/beholder-schemas.json @@ -0,0 +1,9 @@ +{ + "domain": "beholder__data_feeds__messages", + "schemas": [ + { + "entity": "data_feeds.on_chain.registry.FeedUpdated", + "path": "on_chain/registry/feed_updated.proto" + } + ] +} diff --git a/data-feeds/chip-schemas.json b/data-feeds/chip-schemas.json index 14e26bf1..80a8f16f 100644 --- a/data-feeds/chip-schemas.json +++ b/data-feeds/chip-schemas.json @@ -51,6 +51,10 @@ "path": "bridge_status/v1/configuration_item.proto" } ] + }, + { + "entity": "data_feeds.on_chain.registry.FeedUpdated", + "path": "on_chain/registry/feed_updated.proto" } ] } diff --git a/data-feeds/on_chain/registry/feed_updated.proto b/data-feeds/on_chain/registry/feed_updated.proto new file mode 100644 index 00000000..29698ea0 --- /dev/null +++ b/data-feeds/on_chain/registry/feed_updated.proto @@ -0,0 +1,61 @@ +// Copied from https://github.com/smartcontractkit/atlas/blob/main/schemas/atlas/proto/beholder/data-feeds/feed_updated.proto +syntax = "proto3"; + +package data_feeds.on_chain.registry; + +option go_package = "github.com/smartcontractkit/chainlink-protos/data-feeds/on_chain/registry"; + +// The on-chain FeedUpdated event which is extracted from the tx/event data or +// the write-target WriteConfirmed event, after a write was confirmed (@see message: write-target.WriteConfirmed). +message FeedUpdated { + // Event data + string feed_id = 1; // bytes as hex string for readability + uint32 observations_timestamp = 2; + bytes benchmark = 3; + bytes report = 4; + + // Notice: benchmark_val is the benchmark i192 on-chain value decoded as an double (float64), scaled by number of decimals (e.g., 1e-18) + // This is the largest type Prometheus supports, and this conversion can overflow but so far was sufficient + // for most use-cases. For big numbers, benchmark bytes should be used instead. + // + // Set as `math.NaN()` if report data type not a number, or `+/-Inf` if number doesn't fit in double. + double benchmark_val = 5; + + // Head data - when was the event produced on-chain + string block_hash = 6; + string block_height = 7; + uint64 block_timestamp = 8; + + // Transaction data - info about the tx that mained the event (optional) + string tx_id = 10; // TXM ref + string tx_hash = 11; + string tx_sender = 12; + string tx_receiver = 13; + string tx_status = 14; + + // [Execution Context] + // TODO: replace with a proto reference once supported + // Execution Context - Source + string meta_source_id = 20; + + // Execution Context - Chain + string meta_chain_family_name = 21; + string meta_chain_id = 22; + string meta_network_name = 23; + string meta_network_name_full = 24; + + // Execution Context - Workflow (capabilities.RequestMetadata) + string meta_workflow_id = 25; + string meta_workflow_owner = 26; + string meta_workflow_execution_id = 27; + string meta_workflow_name = 28; + uint32 meta_workflow_don_id = 29; + uint32 meta_workflow_don_config_version = 30; + string meta_reference_id = 31; + + // Execution Context - Capability + string meta_capability_type = 32; + string meta_capability_id = 33; + uint64 meta_capability_timestamp_start = 34; + uint64 meta_capability_timestamp_emit = 35; +}