Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/smartcontractkit/chainlink-data-streams

go 1.27.1
go 1.27.3

require (
github.com/cespare/xxhash/v2 v2.3.0
Expand All @@ -20,7 +20,7 @@ require (
github.com/prometheus/client_golang v1.23.2
github.com/prometheus/client_model v0.6.2
github.com/shopspring/decimal v1.4.0
github.com/smartcontractkit/chainlink-common v0.11.2-0.20260918171610-2b348aaadc86
github.com/smartcontractkit/chainlink-common v0.11.2-0.20261105185100-6359ed4cf932
github.com/smartcontractkit/chainlink-common/keystore v1.1.0
github.com/smartcontractkit/chainlink-evm/gethwrappers v0.0.0-20260512150409-b4068bf735e6
github.com/smartcontractkit/libocr v0.0.0-20260810200708-618b5bf7f342
Expand All @@ -34,9 +34,12 @@ require (
)

require (
filippo.io/edwards25519 v1.1.1 // indirect
github.com/DataDog/zstd v1.5.6 // indirect
github.com/Masterminds/semver/v3 v3.5.0 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/NethermindEth/juno v0.12.5 // indirect
github.com/NethermindEth/starknet.go v0.8.0 // indirect
github.com/ProjectZKM/Ziren/crates/go-runtime/zkvm_runtime v0.0.0-20260416073033-7c2071eaa8d4 // indirect
github.com/VictoriaMetrics/fastcache v1.13.0 // indirect
github.com/XSAM/otelsql v0.42.0 // indirect
Expand Down Expand Up @@ -98,6 +101,7 @@ require (
github.com/hashicorp/go-bexpr v0.1.10 // indirect
github.com/hashicorp/go-hclog v1.6.3 // indirect
github.com/hashicorp/yamux v0.1.2 // indirect
github.com/hdevalence/ed25519consensus v0.2.0 // indirect
github.com/holiman/billy v0.0.0-20250707135307-f2f9b9aae7db // indirect
github.com/holiman/bloomfilter/v2 v2.0.3 // indirect
github.com/holiman/uint256 v1.3.2 // indirect
Expand Down Expand Up @@ -141,9 +145,10 @@ require (
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 // indirect
github.com/scylladb/go-reflectx v1.0.1 // indirect
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
github.com/sigurn/crc16 v0.0.0-20211026045750-20ab5afb07e3 // indirect
github.com/smartcontractkit/chain-selectors v1.0.104 // indirect
github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.11-0.20260915184316-2730f1867c92 // indirect
github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260804191526-b7a850ae7648 // indirect
github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.11-0.20261005132539-b7d63d5fd549 // indirect
github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20261013212015-e622e8b83b6b // indirect
github.com/smartcontractkit/chainlink-protos/linking-service/go v0.0.0-20260512230622-65f10f4cd305 // indirect
github.com/smartcontractkit/chainlink-protos/metering/go v0.0.0-20260710151514-27b5a126dabe // indirect
github.com/smartcontractkit/chainlink-protos/node-platform v0.0.0-20260709145319-7782fb89eb16 // indirect
Expand All @@ -160,6 +165,7 @@ require (
github.com/wlynxg/anet v0.0.5 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect
github.com/xssnick/tonutils-go v1.14.1 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
github.com/zeebo/xxh3 v1.1.0 // indirect
go.mongodb.org/mongo-driver v1.17.9 // indirect
Expand Down
18 changes: 18 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ github.com/Masterminds/semver/v3 v3.5.0 h1:kQceYJfbupGfZOKZQg0kou0DgAKhzDg2NZPAw
github.com/Masterminds/semver/v3 v3.5.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
github.com/NethermindEth/juno v0.12.5 h1:a+KYQg8MxzNJIbbqGHq+vU9nTyuWu3acbyXxcUPUDOY=
github.com/NethermindEth/juno v0.12.5/go.mod h1:XonWmZVRwCVHv1gjoVCoTFiZnYObwdukpd3NCsl04bA=
github.com/NethermindEth/starknet.go v0.8.0 h1:mGh7qDWrvuXJPcgGJP31DpifzP6+Ef2gt/BQhaqsV40=
github.com/NethermindEth/starknet.go v0.8.0/go.mod h1:slNA8PxtxA/0LQv0FwHnL3lHFDNhVZfTK6U2gjVb7l8=
github.com/ProjectZKM/Ziren/crates/go-runtime/zkvm_runtime v0.0.0-20260416073033-7c2071eaa8d4 h1:/97whAzwYxMNHXeTfhAtCRzNCpyblmxCtSYpsfzCszM=
github.com/ProjectZKM/Ziren/crates/go-runtime/zkvm_runtime v0.0.0-20260416073033-7c2071eaa8d4/go.mod h1:ioLG6R+5bUSO1oeGSDxOV3FADARuMoytZCSX6MEMQkI=
github.com/VictoriaMetrics/fastcache v1.13.0 h1:AW4mheMR5Vd9FkAPUv+NH6Nhw+fmbTMGMsNAoA/+4G0=
Expand Down Expand Up @@ -342,6 +346,8 @@ github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2p
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
github.com/hashicorp/yamux v0.1.2 h1:XtB8kyFOyHXYVFnwT5C3+Bdo8gArse7j2AQ0DA0Uey8=
github.com/hashicorp/yamux v0.1.2/go.mod h1:C+zze2n6e/7wshOZep2A70/aQU6QBRWJO/G6FT1wIns=
github.com/hdevalence/ed25519consensus v0.2.0 h1:37ICyZqdyj0lAZ8P4D1d1id3HqbbG1N3iBb1Tb4rdcU=
github.com/hdevalence/ed25519consensus v0.2.0/go.mod h1:w3BHWjwJbFU29IRHL1Iqkw3sus+7FctEyM4RqDxYNzo=
github.com/holiman/billy v0.0.0-20250707135307-f2f9b9aae7db h1:IZUYC/xb3giYwBLMnr8d0TGTzPKFGNTCGgGLoyeX330=
github.com/holiman/billy v0.0.0-20250707135307-f2f9b9aae7db/go.mod h1:xTEYN9KCHxuYHs+NmrmzFcnvHMzLLNiGFafCb1n3Mfg=
github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao=
Expand Down Expand Up @@ -539,19 +545,27 @@ github.com/shurcooL/go v0.0.0-20200502201357-93f07166e636/go.mod h1:TDJrrUr11Vxr
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw=
github.com/sigurn/crc16 v0.0.0-20211026045750-20ab5afb07e3 h1:aQKxg3+2p+IFXXg97McgDGT5zcMrQoi0EICZs8Pgchs=
github.com/sigurn/crc16 v0.0.0-20211026045750-20ab5afb07e3/go.mod h1:9/etS5gpQq9BJsJMWg1wpLbfuSnkm8dPF6FdW2JXVhA=
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/smartcontractkit/chain-selectors v1.0.104 h1:/n9pPGM5W/+r1eHoWZv4VwX9LNS1af4+ICyhM8zKRNM=
github.com/smartcontractkit/chain-selectors v1.0.104/go.mod h1:qy7whtgG5g+7z0jt0nRyii9bLND9m15NZTzuQPkMZ5w=
github.com/smartcontractkit/chainlink-common v0.11.2-0.20260918171610-2b348aaadc86 h1:Ncg9P2qAjLTia4gc3QpqhaHL+kNX2dPxJxS4O8jRgbA=
github.com/smartcontractkit/chainlink-common v0.11.2-0.20260918171610-2b348aaadc86/go.mod h1:BniOJQOh52lgDDNyfOQJEmQUVQ68txTSeT0Qxwt0zQI=
github.com/smartcontractkit/chainlink-common v0.11.2-0.20261105185100-6359ed4cf932 h1:zH6F01xyIFMaGKBx2FNrrWuN0JY9wgNz5xz295lAu8s=
github.com/smartcontractkit/chainlink-common v0.11.2-0.20261105185100-6359ed4cf932/go.mod h1:GQPosLRkCllnWENEHTetu6W5/xuFC24QMqXm35mYmt4=
github.com/smartcontractkit/chainlink-common/keystore v1.1.0 h1:2wzySccgk2fpWusPKO0bpeAZzfSU9eq6CS5U+JwYaVo=
github.com/smartcontractkit/chainlink-common/keystore v1.1.0/go.mod h1:6JexOOhPhknQ0QMuppFIlOpm6wCp54yZMxai+tWugwY=
github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.11-0.20260915184316-2730f1867c92 h1:Z1OIGukDhJD+Gknr5G07Vtml24E7BwKaIQoWzV/SdqA=
github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.11-0.20260915184316-2730f1867c92/go.mod h1:Scyk7O80fde5rJF3Ty3fEE3xiS6j84eWbu8/2gl3pIY=
github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.11-0.20261005132539-b7d63d5fd549 h1:J4vYRJxkBO8Yf//17wScKjYWmS45VZaFWx0zt+4ETEU=
github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.11-0.20261005132539-b7d63d5fd549/go.mod h1:Scyk7O80fde5rJF3Ty3fEE3xiS6j84eWbu8/2gl3pIY=
github.com/smartcontractkit/chainlink-evm/gethwrappers v0.0.0-20260512150409-b4068bf735e6 h1:JFo7C3FilwhfwGBLAyj2umbL+P4QxGmVi/b8yt9kqvI=
github.com/smartcontractkit/chainlink-evm/gethwrappers v0.0.0-20260512150409-b4068bf735e6/go.mod h1:a260YnLyWq2NHLUN5cSVyMGk9nhO6RguCaTI2rsVqyA=
github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260804191526-b7a850ae7648 h1:WEUMkKQPAgcNMRgES6CBWrRUiII+HKEWQjulKQBSuMA=
github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260804191526-b7a850ae7648/go.mod h1:/i8hjTPFdVWHiY+QjeSiVS2Z3GB3WAZznGgXHstC02E=
github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20261013212015-e622e8b83b6b h1:tlxPkVQ6ZpJIElqUWc4lU5VH4BB6OzhckG/gHwpaaa0=
github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20261013212015-e622e8b83b6b/go.mod h1:/i8hjTPFdVWHiY+QjeSiVS2Z3GB3WAZznGgXHstC02E=
github.com/smartcontractkit/chainlink-protos/linking-service/go v0.0.0-20260512230622-65f10f4cd305 h1:NJdGFhzT6zMaTod4QkBqVD2sg0I25iw1boOYtTpEwRo=
github.com/smartcontractkit/chainlink-protos/linking-service/go v0.0.0-20260512230622-65f10f4cd305/go.mod h1:qSTSwX3cBP3FKQwQacdjArqv0g6QnukjV4XuzO6UyoY=
github.com/smartcontractkit/chainlink-protos/metering/go v0.0.0-20260710151514-27b5a126dabe h1:MDnY5wQbWTpFdDnMRicEnoMfSP5nM/KncARr4skP1ug=
Expand All @@ -575,6 +589,8 @@ github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkU
github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk=
github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns=
github.com/stellar/go-stellar-sdk v0.5.0 h1:xpOO+ZTyvGz54wTm7pwl2Gf1e6lZl0ExrJ/tKb+Roj4=
github.com/stellar/go-stellar-sdk v0.5.0/go.mod h1:tLKAQPxa2I5UvGMabBbUXcY3fmgYnfDudrMeK7CDX4w=
Expand Down Expand Up @@ -618,6 +634,8 @@ github.com/xdrpp/goxdr v0.1.1 h1:E1B2c6E8eYhOVyd7yEpOyopzTPirUeF6mVOfXfGyJyc=
github.com/xdrpp/goxdr v0.1.1/go.mod h1:dXo1scL/l6s7iME1gxHWo2XCppbHEKZS7m/KyYWkNzA=
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4=
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM=
github.com/xssnick/tonutils-go v1.14.1 h1:zV/iVYl/h3hArS+tPsd9XrSFfGert3r21caMltPSeHg=
github.com/xssnick/tonutils-go v1.14.1/go.mod h1:68xwWjpoGGqiTbLJ0gT63sKu1Z1moCnDLLzA+DKanIg=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
Expand Down
35 changes: 35 additions & 0 deletions llo/dev/v31/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,41 @@
// EffectiveStreams drops any such inline entries before appending the declared
// ones, so it reads definitions written by either version identically.
//
// # Merkle batched report signing
//
// A channel with SigningScheme "merkle" is not signed one report at a time.
// Reports puts the reports of all such channels into one bundle per signing
// family (merkle.go), after the per report channels and before the staging
// marker, split by size to fit MaxReportBytes. The keyring signs the bundle's
// Merkle root once, and the transmitter expands the attested bundle into one
// report per channel with its proof. See protocol/merkle.go for the tree and
// the signed message.
//
// The EVM family, llotypes.ReportFormatEVMMerkle in ReportInfo, covers every
// format in llo/reportcodec/evm. An EVMStreamlined channel needs a feed ID to
// join. Backfill reports follow the scheme of their target channel.
//
// A family is not tied to a destination chain. It fixes one signing key, one
// hash and signature scheme, and one report packer. The root is signed once
// with keys[family], so every member format must accept that signer. The EVM
// family hashes with keccak256, signs with SignBlob over secp256k1 for
// ecrecover, and packs reports with ReportCodecEVMMerkle. A format on
// another key type needs its own family, since one signature cannot cover two
// keys. Adding a family is a family constant, a protocol.MerkleFamily mapping,
// a keyring case and a packer. Leaves commit to their member format and the
// signed message to its family, so the bundle, tree and proof formats do not
// change.
//
// The family is a report format rather than a signing scheme field on
// ReportInfo so that a bundle of mixed codecs has a single format to select its
// key, and so the transmit queue and TransmitRequest recognise reports by
// report_format without a schema or wire change.
//
// There is no protocol version gate. A build that predates the field drops it
// and votes a different channel hash, so set the scheme only once every oracle
// runs a build that knows it. v3.0 does not support the scheme and never votes
// for a channel that sets it.
//
// # Stream history
//
// Expressions can read a window of a stream's past agreed values with
Expand Down
6 changes: 5 additions & 1 deletion llo/dev/v31/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ func (f *PluginFactory) NewReportingPlugin(ctx context.Context, cfg ocr3types.Re
MaxQueryBytes: MaxMaxQueryBytesUnused,
MaxObservationBytes: ocr3_1types.MaxMaxObservationBytes,
MaxReportsPlusPrecursorBytes: ocr3_1types.MaxMaxReportsPlusPrecursorBytes,
MaxReportBytes: ocr3_1types.MaxMaxReportBytes,
MaxReportBytes: MaxReportBytes,
MaxReportCount: protocol.MaxReportCount,

MaxKeyValueModifiedKeys: ocr3_1types.MaxMaxKeyValueModifiedKeys,
Expand Down Expand Up @@ -257,3 +257,7 @@ func (f *PluginFactory) NewReportingPlugin(ctx context.Context, cfg ocr3types.Re

// MaxMaxQueryBytesUnused documents that LLO uses an empty query.
const MaxMaxQueryBytesUnused = 0

// MaxReportBytes is the largest report the plugin emits. A Merkle bundle is one
// report, so the bundler splits by it.
const MaxReportBytes = ocr3_1types.MaxMaxReportBytes
92 changes: 92 additions & 0 deletions llo/dev/v31/merkle.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
package llo

import (
"slices"

llotypes "github.com/smartcontractkit/chainlink-common/pkg/types/llo"

protocol "github.com/smartcontractkit/chainlink-data-streams/llo/protocol"

"github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3types"
)

// merkleBundler collects the channel reports of a round that are signed as
// leaves, per signing family.
type merkleBundler struct {
leaves map[llotypes.ReportFormat][]bundlerLeaf
}

type bundlerLeaf struct {
leaf *protocol.LLOMerkleLeafProto
// source is the reportable channel the leaf was emitted for. It differs
// from the leaf channel ID for backfill reports.
source llotypes.ChannelID
// emitted captures the report telemetry once the leaf is in a bundle.
emitted func()
}

// add records the report encoded for channelID in format as a leaf of family.
func (b *merkleBundler) add(family llotypes.ReportFormat, source, channelID llotypes.ChannelID, format llotypes.ReportFormat, report []byte, emitted func()) {
if b.leaves == nil {
b.leaves = map[llotypes.ReportFormat][]bundlerLeaf{}
}
b.leaves[family] = append(b.leaves[family], bundlerLeaf{
leaf: &protocol.LLOMerkleLeafProto{
ChannelID: channelID,
ReportFormat: uint32(format),
Report: report,
},
source: source,
emitted: emitted,
})
}

// bundles returns one bundle report per family, split by size, in family
// order. Leaves are in the order they were added, which is ascending
// reportable channel ID. A family that fails to encode emits none of its
// leaves, and the other families are unaffected.
func (b *merkleBundler) bundles(p *Plugin, seqNr uint64, stage llotypes.LifeCycleStage) []ocr3types.ReportPlus[llotypes.ReportInfo] {
families := make([]llotypes.ReportFormat, 0, len(b.leaves))
for family := range b.leaves {
families = append(families, family)
}
slices.Sort(families)

var rwis []ocr3types.ReportPlus[llotypes.ReportInfo]
for _, family := range families {
pending := b.leaves[family]
leaves := make([]*protocol.LLOMerkleLeafProto, len(pending))
for i, l := range pending {
leaves[i] = l.leaf
}
encoded, oversized, err := protocol.SplitMerkleBundle(family, leaves, MaxReportBytes)
if err != nil {
for _, l := range pending {
p.reportNotEmitted(seqNr, l.source, llotypes.ReportFormat(l.leaf.ReportFormat), "merkle_bundle_encode_failed", "family", family, "err", err)
}
continue
}
for _, i := range oversized {
l := pending[i]
p.reportNotEmitted(seqNr, l.source, llotypes.ReportFormat(l.leaf.ReportFormat), "merkle_leaf_too_large", "reportBytes", len(l.leaf.Report))
pending[i].emitted = nil
}
for _, l := range pending {
if l.emitted != nil {
l.emitted()
}
}
for _, bundle := range encoded {
rwis = append(rwis, ocr3types.ReportPlus[llotypes.ReportInfo]{
ReportWithInfo: ocr3types.ReportWithInfo[llotypes.ReportInfo]{
Report: bundle,
Info: llotypes.ReportInfo{
LifeCycleStage: stage,
ReportFormat: family,
},
},
})
}
}
return rwis
}
Loading
Loading