-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
"chainlink": major | ||
--- | ||
|
||
Upgrade LLO protocol to support sub-seconds reports. #breaking_change | ||
|
||
CAUTION: This release needs a careful rollout. It _must_ be tested on a staging DON first by setting half of the nodes to this version, while leaving half at the previous version, to verify inter-version interoperability before node-by-node rollout in production. | ||
|
||
NOTE: Protocol version 0 does NOT support gapless handover on sub-second reports. You must upgrade to version 1 for that. | ||
|
||
Rollout plan is here: https://smartcontract-it.atlassian.net/browse/MERC-6852 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package evm | ||
|
||
import ( | ||
"fmt" | ||
"math" | ||
|
||
"github.com/smartcontractkit/chainlink-data-streams/llo" | ||
) | ||
|
||
// Extracts nanosecond timestamps as uint32 number of seconds | ||
func ExtractTimestamps(report llo.Report) (validAfterSeconds, observationTimestampSeconds uint32, err error) { | ||
vas := report.ValidAfterNanoseconds / 1e9 | ||
Check failure on line 12 in core/services/llo/evm/report_codec_common.go
|
||
ots := report.ObservationTimestampNanoseconds / 1e9 | ||
Check failure on line 13 in core/services/llo/evm/report_codec_common.go
|
||
if vas > math.MaxUint32 { | ||
err = fmt.Errorf("validAfterSeconds too large: %d", vas) | ||
return | ||
} | ||
if ots > math.MaxUint32 { | ||
err = fmt.Errorf("observationTimestampSeconds too large: %d", ots) | ||
return | ||
} | ||
return uint32(vas), uint32(ots), nil | ||
} |