Skip to content

Commit d16d631

Browse files
Extend Local CRE Environment with DON Time (#18667)
* Hook donTimeStore * Update time_provider.go * Bump chainlink-common * Update time_provider.go * Update comments * Update time_provider.go * Add ctx to GetDONTime * Error on failed DON Time call * Initialize dontimeStore * Bump common * Bump common * Fix ambiguous selector * Add provider * Bump * lint * Bump common * Bump common * Add dontime store * Add dontime store * Bump common * Bump common * Bump common * Initialize TimeProvider * Bump common * tidy * lint * Pass dontime store * Bump common * Update standalone_engine.go * Create local time provider * lint * lint * Bump common * modgraph * Remove dontime from v1 Engine * Remove dontime store from v1 * Update standalone_engine.go * Update engine_test.go * Add DonTime job spec * Update dontime job spec * Update definitions.go * Update time_provider.go * Add dontime capability * Trigger CI * Bump common * Bump common * Add dontime plugin cmd * Add ocrKeys and transmitterID * Add DONTime to workflow * Try Initializing plugin in relay * Add plugin delegate * Integrate DON Time with Local Env * Update delegate.go * Bump common * Fix duplicates * Bump common * Create DON Time Contract * Use common addr * Remove comments * Use DON Time Provider * Fix limits * Fix deployment sequence * lint * Secondary time hook * Bump common * Bump common * Revert defaults * Bump common * Bump common * Remove context * Add smoke test TODO * Use LocalTimeProvider for tests
1 parent 1a36e04 commit d16d631

36 files changed

Lines changed: 289 additions & 58 deletions

File tree

.changeset/sweet-lizards-talk.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"chainlink": patch
3+
---
4+
5+
Integrate DON Time with Local CRE Environment #updated

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,4 @@ contracts/out/
123123
core/scripts/cre/environment/*.yaml
124124
core/scripts/cre/environment/*.yml
125125
core/scripts/cre/environment/logs/
126+
core/scripts/cre/environment/cron

core/scripts/cre/environment/examples/workflows/v2/cron/main.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package main
55
import (
66
"github.com/smartcontractkit/cre-sdk-go/capabilities/scheduler/cron"
77
sdk "github.com/smartcontractkit/cre-sdk-go/cre"
8-
98
"github.com/smartcontractkit/cre-sdk-go/cre/wasm"
109
)
1110

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module main
2+
3+
go 1.24.4
4+
5+
require (
6+
github.com/smartcontractkit/cre-sdk-go v0.2.1-0.20250729191525-ac1867f3ff34
7+
github.com/smartcontractkit/cre-sdk-go/capabilities/scheduler/cron v0.2.1-0.20250729191525-ac1867f3ff34
8+
)
9+
10+
require (
11+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
12+
github.com/go-viper/mapstructure/v2 v2.3.0 // indirect
13+
github.com/kr/pretty v0.3.1 // indirect
14+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
15+
github.com/rogpeppe/go-internal v1.12.0 // indirect
16+
github.com/shopspring/decimal v1.4.0 // indirect
17+
github.com/smartcontractkit/chainlink-common/pkg/values v0.0.0-20250718143957-41236f9ef8b4 // indirect
18+
github.com/smartcontractkit/chainlink-common/pkg/workflows/sdk/v2/pb v0.0.0-20250718162715-0c70aa0d3a06 // indirect
19+
github.com/stretchr/testify v1.10.0 // indirect
20+
google.golang.org/protobuf v1.36.6 // indirect
21+
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
22+
gopkg.in/yaml.v3 v3.0.1 // indirect
23+
)
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
2+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
3+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
4+
github.com/go-viper/mapstructure/v2 v2.3.0 h1:27XbWsHIqhbdR5TIC911OfYvgSaW93HM+dX7970Q7jk=
5+
github.com/go-viper/mapstructure/v2 v2.3.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
6+
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
7+
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
8+
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
9+
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
10+
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
11+
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
12+
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
13+
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
14+
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
15+
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
16+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
17+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
18+
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
19+
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
20+
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
21+
github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k=
22+
github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME=
23+
github.com/smartcontractkit/chainlink-common/pkg/values v0.0.0-20250718143957-41236f9ef8b4 h1:hPKEslzkVA2HUuqwGc6w594EWYnJFp5jXmAoBu3VryE=
24+
github.com/smartcontractkit/chainlink-common/pkg/values v0.0.0-20250718143957-41236f9ef8b4/go.mod h1:U1UAbPhy6D7Qz0wHKGPoQO+dpR0hsYjgUz8xwRrmKwI=
25+
github.com/smartcontractkit/chainlink-common/pkg/workflows/sdk/v2/pb v0.0.0-20250718162715-0c70aa0d3a06 h1:7BTF+QDqmXzL1JIvtMJx665Hg9ixr/gEAzvWiJNmxeo=
26+
github.com/smartcontractkit/chainlink-common/pkg/workflows/sdk/v2/pb v0.0.0-20250718162715-0c70aa0d3a06/go.mod h1:LEZQ/SbFHseQJrLKVm6ELB8gyI4G8rVEH3SQzzZqFDk=
27+
github.com/smartcontractkit/cre-sdk-go v0.2.1-0.20250729191525-ac1867f3ff34 h1:VoT3Vo8U6BcA6CZgvfzx5XjF47flLqPhQi7H4xXDr+8=
28+
github.com/smartcontractkit/cre-sdk-go v0.2.1-0.20250729191525-ac1867f3ff34/go.mod h1:HqCmnnjRZ0B3uAMify4/Wahaz6kvwoZ6SvD1989M9QQ=
29+
github.com/smartcontractkit/cre-sdk-go/capabilities/scheduler/cron v0.2.1-0.20250729191525-ac1867f3ff34 h1:zIKBDVs/NtKEyhfzuqZUCG1b/5up6s6ZAvj0ktWS1lo=
30+
github.com/smartcontractkit/cre-sdk-go/capabilities/scheduler/cron v0.2.1-0.20250729191525-ac1867f3ff34/go.mod h1:WzBKJEsPkSF4ZWh0fpExImz7MHWit35nSkPgs/Z0RJo=
31+
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
32+
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
33+
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
34+
google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
35+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
36+
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
37+
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
38+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
39+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
//go:build wasip1
2+
3+
package main
4+
5+
import (
6+
"time"
7+
8+
"github.com/smartcontractkit/cre-sdk-go/capabilities/scheduler/cron"
9+
sdk "github.com/smartcontractkit/cre-sdk-go/cre"
10+
"github.com/smartcontractkit/cre-sdk-go/cre/wasm"
11+
)
12+
13+
type None struct{}
14+
15+
func main() {
16+
wasm.NewRunner(func(configBytes []byte) (None, error) {
17+
return None{}, nil
18+
}).Run(RunSimpleCronWorkflow)
19+
}
20+
21+
func RunSimpleCronWorkflow(wcx *sdk.Environment[None]) (sdk.Workflow[None], error) {
22+
workflows := sdk.Workflow[None]{
23+
sdk.Handler(
24+
cron.Trigger(&cron.Config{Schedule: "*/30 * * * * *"}),
25+
onTrigger,
26+
),
27+
}
28+
return workflows, nil
29+
}
30+
31+
func onTrigger(wcx *sdk.Environment[None], runtime sdk.Runtime, trigger *cron.Payload) (string, error) {
32+
donTime := time.Now()
33+
wcx.Logger.Info("Requested DON Time", "donTime", donTime)
34+
return "Requested DON Time", nil
35+
}

core/scripts/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ require (
4747
github.com/shopspring/decimal v1.4.0
4848
github.com/smartcontractkit/chainlink-automation v0.8.1
4949
github.com/smartcontractkit/chainlink-ccip v0.1.1-solana.0.20250814153237-9a6c5a35e950
50-
github.com/smartcontractkit/chainlink-common v0.9.1-0.20250814111752-91ec077f29f5
50+
github.com/smartcontractkit/chainlink-common v0.9.1-0.20250815142532-64e0a7965958
5151
github.com/smartcontractkit/chainlink-common/pkg/values v0.0.0-20250806152407-159881c7589c
5252
github.com/smartcontractkit/chainlink-data-streams v0.1.2
5353
github.com/smartcontractkit/chainlink-deployments-framework v0.25.0

core/scripts/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1526,8 +1526,8 @@ github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250805210128-7
15261526
github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250805210128-7f8a0f403c3a/go.mod h1:Ve1xD71bl193YIZQEoJMmBqLGQJdNs29bwbuObwvbhQ=
15271527
github.com/smartcontractkit/chainlink-ccip/chains/solana/gobindings v0.0.0-20250805210128-7f8a0f403c3a h1:38dAlTPRUQHZus5dCnBnQyf/V4oYn0p2svWlbPgHDQ4=
15281528
github.com/smartcontractkit/chainlink-ccip/chains/solana/gobindings v0.0.0-20250805210128-7f8a0f403c3a/go.mod h1:xtZNi6pOKdC3sLvokDvXOhgHzT+cyBqH/gWwvxTxqrg=
1529-
github.com/smartcontractkit/chainlink-common v0.9.1-0.20250814111752-91ec077f29f5 h1:pv0rFs6OUYmGo97KrBmcECZ+BX5DNdJxqUY2j+fApas=
1530-
github.com/smartcontractkit/chainlink-common v0.9.1-0.20250814111752-91ec077f29f5/go.mod h1:OYfK10oQCJVQEdBmA2J1FC9gq+bp9497LcD88T0q+lw=
1529+
github.com/smartcontractkit/chainlink-common v0.9.1-0.20250815142532-64e0a7965958 h1:pfzvL8n8f4ygUe4pIBjHgM2Tzct6qG8Q/jxJjfHThMY=
1530+
github.com/smartcontractkit/chainlink-common v0.9.1-0.20250815142532-64e0a7965958/go.mod h1:OYfK10oQCJVQEdBmA2J1FC9gq+bp9497LcD88T0q+lw=
15311531
github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.1 h1:ca2z5OXgnbBPQRxpwXwBLJsUA1+cAp5ncfW4Ssvd6eY=
15321532
github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.1/go.mod h1:NZv/qKYGFRnkjOYBouajnDfFoZ+WDa6H2KNmSf1dnKc=
15331533
github.com/smartcontractkit/chainlink-common/pkg/monitoring v0.0.0-20250415235644-8703639403c7 h1:9wh1G+WbXwPVqf0cfSRSgwIcaXTQgvYezylEAfwmrbw=

core/services/chainlink/application.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ func NewApplication(ctx context.Context, opts ApplicationOpts) (Application, err
636636

637637
ocr2DelegateConfig := ocr2.NewDelegateConfig(cfg.OCR2(), cfg.Mercury(), cfg.Threshold(), cfg.Insecure(), cfg.JobPipeline(), loopRegistrarConfig)
638638

639-
delegates[job.OffchainReporting2] = ocr2.NewDelegate(
639+
ocr2Delegate := ocr2.NewDelegate(
640640
ocr2.DelegateOpts{
641641
Ds: opts.DS,
642642
JobORM: jobORM,
@@ -660,6 +660,7 @@ func NewApplication(ctx context.Context, opts ApplicationOpts) (Application, err
660660
},
661661
ocr2DelegateConfig,
662662
)
663+
delegates[job.OffchainReporting2] = ocr2Delegate
663664
delegates[job.Bootstrap] = ocrbootstrap.NewDelegateBootstrap(
664665
opts.DS,
665666
jobORM,

core/services/ocr2/delegate.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,7 @@ func (d *Delegate) newServicesVaultPlugin(
804804

805805
return srvs, nil
806806
}
807+
807808
func (d *Delegate) newDonTimePlugin(
808809
ctx context.Context,
809810
lggr logger.SugaredLogger,

0 commit comments

Comments
 (0)