Skip to content

Commit

Permalink
web: Add onchainSigningStrategy to job spec
Browse files Browse the repository at this point in the history
  • Loading branch information
archseer committed Dec 10, 2024
1 parent b0ea0ca commit 972b062
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/web/presenters/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ type OffChainReporting2Spec struct {
BlockchainTimeout models.Interval `json:"blockchainTimeout"`
ContractConfigTrackerPollInterval models.Interval `json:"contractConfigTrackerPollInterval"`
ContractConfigConfirmations uint16 `json:"contractConfigConfirmations"`
OnchainSigningStrategy map[string]interface{} `json:"onchainSigningStrategy"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
CollectTelemetry bool `json:"collectTelemetry"`
Expand All @@ -194,6 +195,7 @@ func NewOffChainReporting2Spec(spec *job.OCR2OracleSpec) *OffChainReporting2Spec
BlockchainTimeout: spec.BlockchainTimeout,
ContractConfigTrackerPollInterval: spec.ContractConfigTrackerPollInterval,
ContractConfigConfirmations: spec.ContractConfigConfirmations,
OnchainSigningStrategy: spec.OnchainSigningStrategy,
CreatedAt: spec.CreatedAt,
UpdatedAt: spec.UpdatedAt,
CollectTelemetry: spec.CaptureEATelemetry,
Expand Down
5 changes: 5 additions & 0 deletions core/web/resolver/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -987,6 +987,11 @@ func (r *BootstrapSpecResolver) ContractConfigConfirmations() *int32 {
return &confirmations
}

// RelayConfig resolves the spec's onchain signing strategy config
func (r *OCR2SpecResolver) OnchainSigningStrategy() gqlscalar.Map {
return gqlscalar.Map(r.spec.OnchainSigningStrategy)
}

// CreatedAt resolves the spec's created at timestamp.
func (r *BootstrapSpecResolver) CreatedAt() graphql.Time {
return graphql.Time{Time: r.spec.CreatedAt}
Expand Down
14 changes: 14 additions & 0 deletions core/web/resolver/spec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,12 @@ func TestResolver_OCR2Spec(t *testing.T) {
pluginConfig := map[string]interface{}{
"juelsPerFeeCoinSource": 100000000,
}
onchainSigningStrategy := map[string]interface{}{
"strategyName": "multi-chain",
"config": map[string]any{
"evm": "b3df4d8748b67731a1112e8b45a764941974f5590c93672eebbc4f3504dd10ed",
},
}
require.NoError(t, err)

testCases := []GQLTestCase{
Expand All @@ -486,6 +492,7 @@ func TestResolver_OCR2Spec(t *testing.T) {
ContractID: contractAddress.String(),
ContractConfigConfirmations: 1,
ContractConfigTrackerPollInterval: models.Interval(1 * time.Minute),
OnchainSigningStrategy: onchainSigningStrategy,
CreatedAt: f.Timestamp(),
OCRKeyBundleID: null.StringFrom(keyBundleID.String()),
MonitoringEndpoint: null.StringFrom("https://monitor.endpoint"),
Expand All @@ -509,6 +516,7 @@ func TestResolver_OCR2Spec(t *testing.T) {
contractID
contractConfigConfirmations
contractConfigTrackerPollInterval
onchainSigningStrategy
createdAt
ocrKeyBundleID
monitoringEndpoint
Expand All @@ -533,6 +541,12 @@ func TestResolver_OCR2Spec(t *testing.T) {
"contractID": "0x613a38AC1659769640aaE063C651F48E0250454C",
"contractConfigConfirmations": 1,
"contractConfigTrackerPollInterval": "1m0s",
"onchainSigningStrategy": {
"strategyName": "multi-chain",
"config": {
"evm": "b3df4d8748b67731a1112e8b45a764941974f5590c93672eebbc4f3504dd10ed"
}
},
"createdAt": "2021-01-01T00:00:00Z",
"ocrKeyBundleID": "f5bf259689b26f1374efb3c9a9868796953a0f814bb2d39b968d0e61b58620a5",
"monitoringEndpoint": "https://monitor.endpoint",
Expand Down
1 change: 1 addition & 0 deletions core/web/schema/type/spec.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ type OCR2Spec {
p2pv2Bootstrappers: [String!]
relay: String!
relayConfig: Map!
onchainSigningStrategy: Map!
transmitterID: String
pluginType: String!
pluginConfig: Map!
Expand Down

0 comments on commit 972b062

Please sign in to comment.