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(sequencer, core, conductor): pass oracle data to rollup via execution API #1840

Merged
merged 19 commits into from
Dec 4, 2024

Conversation

noot
Copy link
Collaborator

@noot noot commented Dec 2, 2024

Summary

update conductor to pass oracle data to rollup via execution API.

Background

this is the final change needed within the astria monorepo for the oracle integration, as the oracle data is now fully passed up the stack. handling the oracle data is now left up to each rollup.

Changes

  • add a new OracleData variant to the RollupData enum, which contains a Vec<Price>, where each Price contains the relevant oracle data for a currency pair for that block
  • update the injected tx type ExtendedCommitInfoWithCurrencyPairMapping such that the id->currency pair mapping also contains the decimals for that currency pair's price; this is necessary information that I overlooked in the previous PR creating that type
  • add the extended commit info + proof to FilteredSequencerBlock
  • update SequencerBlock, FilteredSequencerBlock and SubmittedMetadata constructors such that the extended commit info bytes must be a valid encoded protobuf ExtendedCommitInfoWithCurrencyPairMapping
  • move functionality for calculating the aggregated prices from the extended commit info from sequencer to core so that conductor can also use it
  • update conductor's executor to calculate the aggregated price data and pass it as RollupData::OracleData to the rollup via the execution API

Testing

unit tests

Related Issues

closes #1818

@noot noot requested review from a team as code owners December 2, 2024 15:01
@noot noot requested a review from SuperFluffy December 2, 2024 15:01
@github-actions github-actions bot added conductor pertaining to the astria-conductor crate proto pertaining to the Astria Protobuf spec sequencer pertaining to the astria-sequencer crate labels Dec 2, 2024
@@ -458,7 +461,8 @@ impl Executor {
))]
async fn execute_firm(&mut self, block: ReconstructedBlock) -> eyre::Result<()> {
let celestia_height = block.celestia_height;
let executable_block = ExecutableBlock::from_reconstructed(block);
let executable_block = ExecutableBlock::from_reconstructed(block)
.wrap_err("failed to construct executable block")?;
Copy link
Member

Choose a reason for hiding this comment

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

This should not fail. Reconstructed blocks should be completely valid blocks. Nothing that reaches the execution task should be invalid.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated to be infallible - no oracle data is added to the txs if it can't be constructed.

@@ -697,23 +701,44 @@ struct ExecutableBlock {
}

impl ExecutableBlock {
fn from_reconstructed(block: ReconstructedBlock) -> Self {
fn from_reconstructed(block: ReconstructedBlock) -> eyre::Result<Self> {
Copy link
Member

Choose a reason for hiding this comment

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

This should not be fallible.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

same as above

Copy link
Contributor

@Fraser999 Fraser999 left a comment

Choose a reason for hiding this comment

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

One tiny nitpick, otherwise LGTM.

votes: vec![],
}
.into();
let extended_commit_info_with_mapping = astria_core::generated::protocol::connect::v1::ExtendedCommitInfoWithCurrencyPairMapping {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the formatting is off here due to the line length. Maybe you could import astria_core::generated::protocol::connect::v1::ExtendedCommitInfoWithCurrencyPairMapping to fix this?

@noot noot merged commit 921fc70 into feat/oracle Dec 4, 2024
45 checks passed
@noot noot deleted the noot/oracle-data-conductor branch December 4, 2024 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conductor pertaining to the astria-conductor crate proto pertaining to the Astria Protobuf spec sequencer pertaining to the astria-sequencer crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants