Skip to content

Commit

Permalink
Add unique stream ids
Browse files Browse the repository at this point in the history
  • Loading branch information
cawthorne committed Feb 26, 2025
1 parent 52b8df6 commit 7296c32
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 4 deletions.
69 changes: 69 additions & 0 deletions core/services/ocr2/plugins/llo/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,75 @@ func createBridge(t *testing.T, bridgeName string, resultJSON string, borm bridg
}))
}

func addOCRJobsEVMABIEncode(
t *testing.T,
streams []Stream,
serverPubKey ed25519.PublicKey,
serverURL string,
configuratorAddress common.Address,
bootstrapPeerID string,
bootstrapNodePort int,
nodes []Node,
configStoreAddress common.Address,
clientPubKeys []ed25519.PublicKey,
pluginConfig,
relayType,
relayConfig string) (jobIDs map[int]map[uint32]int32) {
// node idx => stream id => job id
jobIDs = make(map[int]map[uint32]int32)
// Add OCR jobs - one per feed on each node
for i, node := range nodes {
if jobIDs[i] == nil {
jobIDs[i] = make(map[uint32]int32)
}
for j, strm := range streams {
// assume that streams are native, link and additionals are quote
if j < 2 {
var name string
if j == 0 {
name = "nativeprice"
} else {
name = "linkprice"
}
name = fmt.Sprintf("%s-%d-%d", name, strm.id, j)
bmBridge := createSingleDecimalBridge(t, name, i, strm.baseBenchmarkPrice, node.App.BridgeORM())
jobID := addSingleDecimalStreamJob(
t,
node,
strm.id,
bmBridge,
)
jobIDs[i][strm.id] = jobID
} else {
name := "medianprice"

name = fmt.Sprintf("%s-%d-%d", name, strm.id, j)
bmBridge := createSingleDecimalBridge(t, name, i, strm.baseBenchmarkPrice, node.App.BridgeORM())
jobID := addSingleDecimalStreamJob(
t,
node,
strm.id,
bmBridge,
)
jobIDs[i][strm.id] = jobID
}
}
addLLOJob(
t,
node,
configuratorAddress,
bootstrapPeerID,
bootstrapNodePort,
clientPubKeys[i],
"feed-1",
pluginConfig,
relayType,
relayConfig,
)
}
return jobIDs
}

func addOCRJobsEVMPremiumLegacy(
t *testing.T,
streams []Stream,
Expand Down
18 changes: 14 additions & 4 deletions core/services/ocr2/plugins/llo/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1069,9 +1069,9 @@ func TestIntegration_LLO_stress_test_with_wide_channels_and_transmit_errors(t *t
// LESS STRESSFUL
const nChannels = 2
const maxQueueSize = 4
const nReports = 100
const nReports = 10

const nStreamsPerChannel = 10_000
const nStreamsPerChannel = 3000

clientCSAKeys := make([]csakey.KeyV2, nNodes)
clientPubKeys := make([]ed25519.PublicKey, nNodes)
Expand Down Expand Up @@ -1103,7 +1103,12 @@ func TestIntegration_LLO_stress_test_with_wide_channels_and_transmit_errors(t *t
serverURL := startMercuryServer(t, srv, clientPubKeys)

donID := uint32(888333)
streams := []Stream{ethStream, linkStream}

streams := make([]Stream, nStreamsPerChannel+2)

streams[0] = ethStream
streams[1] = linkStream

streamMap := make(map[uint32]Stream)
for _, strm := range streams {
streamMap[strm.id] = strm
Expand Down Expand Up @@ -1152,6 +1157,11 @@ lloConfigMode = "bluegreen"
}

for j := uint32(0); j < nStreamsPerChannel; j++ {
newStreamID := ethStreamID + 2 + j
streams[j+2] = Stream{
id: newStreamID,
baseBenchmarkPrice: decimal.NewFromFloat32(2_976.39),
}
streamDefinitions[j+2] = llotypes.Stream{
StreamID: ethStreamID,
Aggregator: llotypes.AggregatorMedian,
Expand Down Expand Up @@ -1188,7 +1198,7 @@ lloConfigMode = "bluegreen"
donID = %d
channelDefinitionsContractAddress = "0x%x"
channelDefinitionsContractFromBlock = %d`, serverURL, serverPubKey, serverPubKey, donID, configStoreAddress, fromBlock)
addOCRJobsEVMPremiumLegacy(t, streams, serverPubKey, serverURL, configuratorAddress, bootstrapPeerID, bootstrapNodePort, nodes, configStoreAddress, clientPubKeys, pluginConfig, relayType, relayConfig)
addOCRJobsEVMABIEncode(t, streams, serverPubKey, serverURL, configuratorAddress, bootstrapPeerID, bootstrapNodePort, nodes, configStoreAddress, clientPubKeys, pluginConfig, relayType, relayConfig)

var blueDigest ocr2types.ConfigDigest

Expand Down

0 comments on commit 7296c32

Please sign in to comment.