Skip to content

improve(cross-chain-oracle): [L04] Stamp ancillary data in hasPrice and getPrice#3668

Merged
nicholaspai merged 2 commits intomasterfrom
npai/oracle-spoke
Dec 9, 2021
Merged

improve(cross-chain-oracle): [L04] Stamp ancillary data in hasPrice and getPrice#3668
nicholaspai merged 2 commits intomasterfrom
npai/oracle-spoke

Conversation

@nicholaspai
Copy link
Copy Markdown
Member

Motivation

I believe we should stamp ancillary data in these public methods. I originally removed this stamping logic in this PR because the previous stampAncillaryData implementation stamped the msg.sender address, which means that only the original requester could call has/getPrice, but now that we removed it we can add stamping for the caller’s convenience.

This improves the caller's experience as they only need to pass the original ancillary data that was passed into requestPrice.

This PR is possible because stampAncillaryData now only stamps the block.chainId which is not affected by who the msg.sender is.

Testing

Check a box to describe how you tested these changes and list the steps for reviewers to test.

  • Ran end-to-end test, running the code as in production
  • New unit tests created
  • Existing tests adequate, no new tests required
  • All existing tests pass
  • Untested

@nicholaspai nicholaspai added the cross-chain-oracle Contracts enabling cross-chain price resolution and governance label Dec 7, 2021
@nicholaspai nicholaspai requested a review from mrice32 as a code owner December 7, 2021 13:50
@nicholaspai nicholaspai removed the request for review from mrice32 December 7, 2021 13:50
Copy link
Copy Markdown
Member

@chrismaree chrismaree left a comment

Choose a reason for hiding this comment

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

This is interesting. it definitely makes interacting with the spoke directly easier. importantly, the stamping only includes the chainId so this is forward compatible with upgrades to the spoke, keeping previous requests still functional.

also, this change now makes the has/get price methods consistent with the inputs you would put into requestPrice. previously you would put in one ancillary data, which would then be stamped and would need separate ancillary data when fetching data from the contracts. this would have made implementation integrating with this contract more difficult as they would need to pre-stamp their ancillary data when calling hasPrice and getPrice

@nicholaspai
Copy link
Copy Markdown
Member Author

This is interesting. it definitely makes interacting with the spoke directly easier. importantly, the stamping only includes the chainId so this is forward compatible with upgrades to the spoke, keeping previous requests still functional.

also, this change now makes the has/get price methods consistent with the inputs you would put into requestPrice. previously you would put in one ancillary data, which would then be stamped and would need separate ancillary data when fetching data from the contracts. this would have made implementation integrating with this contract more difficult as they would need to pre-stamp their ancillary data when calling hasPrice and getPrice

Totally agreed. We originally removed the stamping in the previous PR because the stamping logic added msg.sender, but then we also removed the msg.sender from the stamping logic. I rate it an oversight that we forgot to re-add stamping in has/getPrice

@nicholaspai nicholaspai merged commit f48d700 into master Dec 9, 2021
@nicholaspai nicholaspai added the audit-fix-phase6 Fixes for Phase 6 (Cross-chain oracle, optimistic rewarder, decentralized proposer) label Dec 10, 2021
@nicholaspai nicholaspai changed the title improve(cross-chain-oracle): Stamp ancillary data in hasPrice and getPrice improve(cross-chain-oracle): [L04] Stamp ancillary data in hasPrice and getPrice Dec 10, 2021
@chrismaree chrismaree deleted the npai/oracle-spoke branch December 19, 2022 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

audit-fix-phase6 Fixes for Phase 6 (Cross-chain oracle, optimistic rewarder, decentralized proposer) cross-chain-oracle Contracts enabling cross-chain price resolution and governance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants