-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
586 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
"chainlink": major | ||
--- | ||
|
||
Upgrade LLO protocol to support sub-seconds reports. | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
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 | ||
ots := report.ObservationTimestampNanoseconds / 1e9 | ||
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 | ||
} | ||
if vas >= ots { | ||
// This should never happen, should have been prevented by the plugin, | ||
// but we check anyway | ||
err = fmt.Errorf("invariant violation: validAfterSeconds >= observationTimestampSeconds; got: %d >= %d", validAfterSeconds, observationTimestampSeconds) | ||
return | ||
} | ||
return uint32(vas), uint32(ots), nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.