-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[KS-250] Use report context to validate signatures (#13366)
1. Parse report context in write target. 2. Fix 'v' value when validating signatures. 3. Add a stub of KeystoneFeedsConsumer contract. 4. Fix owner length in Encoder.
- Loading branch information
Showing
18 changed files
with
90 additions
and
45 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,5 @@ | ||
--- | ||
"chainlink": patch | ||
--- | ||
|
||
#internal keystone report context |
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,5 @@ | ||
--- | ||
'@chainlink/contracts': patch | ||
--- | ||
|
||
#internal stub of keystone feed consumer contract |
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,28 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.19; | ||
|
||
import {IReceiver} from "./interfaces/IReceiver.sol"; | ||
|
||
contract KeystoneFeedsConsumer is IReceiver { | ||
event MessageReceived(bytes32 indexed workflowId, address indexed workflowOwner, uint256 nReports); | ||
event FeedReceived(bytes32 indexed feedId, uint256 price, uint64 timestamp); | ||
|
||
constructor() {} | ||
|
||
struct FeedReport { | ||
bytes32 FeedID; | ||
uint256 Price; | ||
uint64 Timestamp; | ||
} | ||
|
||
function onReport(bytes32 workflowId, address workflowOwner, bytes calldata rawReport) external { | ||
// TODO: validate sender and workflowOwner | ||
|
||
FeedReport[] memory feeds = abi.decode(rawReport, (FeedReport[])); | ||
for (uint32 i = 0; i < feeds.length; i++) { | ||
emit FeedReceived(feeds[i].FeedID, feeds[i].Price, feeds[i].Timestamp); | ||
} | ||
|
||
emit MessageReceived(workflowId, workflowOwner, feeds.length); | ||
} | ||
} |
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.