Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[VRF-567] Mercury price feed registry #10348

Merged
merged 37 commits into from
Sep 20, 2023
Merged

Conversation

vreff
Copy link
Contributor

@vreff vreff commented Aug 24, 2023

This implementation allows for an on-chain registry of price feed data to be maintained and updated by Automation nodes.

The upkeep provides the following advantages:

  • Node operator savings. The single committee of automation nodes is able to update all necessary feeds using
    off-chain feed data.
  • Fetch batches of price data. All price feed data is held on the same contract, so a contract that needs
    multiple sets of feed data can fetch them while paying for only one external call.
  • Scalability. Feeds can be added or removed from the contract with a single contract call, and the number of
    feeds that the registry can store is unbounded.

Key Contracts:

  • MercuryRegistry.sol - stores price feed data and implements core logic.
  • MercuryRegistryBatchUpkeep.sol - enables batching for the registry.
  • MercuryRegistry.t.sol - contains foundry tests to demonstrate various flows.

Example deployment to Arbitrum Goerli: https://goerli.arbiscan.io/address/0xf3219b8b80f3cce2b900abe0a88330fccd785f4b

@github-actions
Copy link
Contributor

I see that you haven't updated any CHANGELOG files. Would it make sense to do so?

@github-actions
Copy link
Contributor

Go solidity wrappers are out-of-date, regenerate them via the make wrappers-all command

2 similar comments
@github-actions
Copy link
Contributor

Go solidity wrappers are out-of-date, regenerate them via the make wrappers-all command

@github-actions
Copy link
Contributor

Go solidity wrappers are out-of-date, regenerate them via the make wrappers-all command

@vreff vreff force-pushed the feature/VRF-567-mercury-registry branch from 1374829 to 71e87f8 Compare August 25, 2023 13:23
@github-actions
Copy link
Contributor

Go solidity wrappers are out-of-date, regenerate them via the make wrappers-all command

| Key Contracts: |
| - `MercuryRegistry.sol` - stores price feed data and implements core logic. |
| - `MercuryRegistryBatchUpkeep.sol` - enables batching for the registry. |
| - `MercuryRegistry.t.soll` - contains foundry tests to demonstrate various flows. |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo soll

| off-chain feed data. |
| - Fetch batches of price data. All price feed data is held on the same contract, so a contract that needs |
| multiple sets of feed data can fetch them while paying for only one external call. |
| - Scalabiliy. Feeds can be added or removed from the contract with a single contract call, and the number of |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo scalability

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this lib is great for arb!

(bytes[] memory values /* bytes memory lookupData */, ) = abi.decode(performData, (bytes[], bytes));
for (uint256 i = 0; i < values.length; i++) {
// Verify and decode report.
i_verifier.verify(values[i]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use the response from verify function

// Helper function to reconcile a difference in formatting:
// - Automation passes feedId into their off-chain lookup function as a string.
// - Mercury stores feedId in their reports as a bytes32.
function bytes32ToHextString(bytes memory buffer) internal pure returns (string memory) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo Hext

@vreff vreff force-pushed the feature/VRF-567-mercury-registry branch from a6d3ddd to c8a56ca Compare August 28, 2023 21:06
@github-actions
Copy link
Contributor

Go solidity wrappers are out-of-date, regenerate them via the make wrappers-all command

@github-actions
Copy link
Contributor

Go solidity wrappers are out-of-date, regenerate them via the make wrappers-all command

@github-actions
Copy link
Contributor

Go solidity wrappers are out-of-date, regenerate them via the make wrappers-all command

2 similar comments
@github-actions
Copy link
Contributor

Go solidity wrappers are out-of-date, regenerate them via the make wrappers-all command

@github-actions
Copy link
Contributor

Go solidity wrappers are out-of-date, regenerate them via the make wrappers-all command

@vreff vreff force-pushed the feature/VRF-567-mercury-registry branch 4 times, most recently from 485520f to c132210 Compare August 30, 2023 16:31
@vreff vreff force-pushed the feature/VRF-567-mercury-registry branch 3 times, most recently from b7063d1 to 60f51e0 Compare September 13, 2023 18:42
@github-actions
Copy link
Contributor

Go solidity wrappers are out-of-date, regenerate them via the make wrappers-all command

| TODO: |
| - Optimize gas consumption. |
-+---------------------------------------------------------------------------------------------------------------------*/
contract MercuryRegistry is ConfirmedOwner, AutomationCompatibleInterface, StreamsLookupCompatibleInterface {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add a comment somewhere to indicate that this only works with mercury v0.2?

for mercury v0.3, certain feeds still have the same report schema but some are different (timestamp feeds)
and verify function will take different params..

@vreff vreff enabled auto-merge September 20, 2023 13:46
@vreff vreff added this pull request to the merge queue Sep 20, 2023
@cl-sonarqube-production
Copy link

SonarQube Quality Gate

Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Merged via the queue into develop with commit 65271fd Sep 20, 2023
122 checks passed
@vreff vreff deleted the feature/VRF-567-mercury-registry branch September 20, 2023 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants