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

feat: implement handling and execution of oracle data #62

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

noot
Copy link
Contributor

@noot noot commented Dec 13, 2024

implement handling of oracle data received via the execution API.

see relevant contract for context: https://github.com/astriaorg/astria-oracle-contracts/blob/main/src/AstriaOracle.sol

flow is as follows:

  • the AstriaOracle contract is deployed on the rollup and the address is set in genesis
  • when the rollup receives RollupData.OracleData via the execution API, which consists of a vector of price updates, it converts these into contract calls to AstriaOracle.
  • if the currency pair in the update is not initialized in the contract, it calls initializeCurrencyPair before calling updatePriceData. this is needed to set the decimals for that pair, which is not updated once the pair has been initialized.
  • if a block does not contain any oracle data, then no price updates happen for that block, but everything else gets executed as normal.

other changes:

  • renamed DepositTx to InjectedTx, as the same type is now being used for deposits and oracle updates. it was not necessary to create a new type, as the previous erc20 calls being done by the DepositTx were generic to what they were calling.
  • split out the grpc/execution/validation.go validation and conversion function into separate functions for each RollupData type, no logic was changed for Deposit/SequencedData.

testing:

  • this has been tested end-to-end with dev cluster using sequencer and conductor images pr-1866 and the geth image on this PR. prices are updated in the contract state correctly.

noot added a commit to astriaorg/astria that referenced this pull request Jan 20, 2025
## Summary
update geth charts for oracle genesis values.

## Background
geth charts needed to be updated for the oracle integration; see
astriaorg/astria-geth#62

## Changes
- add `astriaOracleCallerAddress` and `astriaOracleContractAddress`
config values
- add oracle contract bytecode to genesis alloc at
`astriaOracleContractAddress`
- update dev tags for geth and sequencer

## Testing
ran it end-to-end with the usual dev cluster instructions and queried
the oracle contract for price updates via the instructions here:
https://github.com/astriaorg/astria-oracle-contracts/tree/main?tab=readme-ov-file#query-contract
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.

1 participant