Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/evm-rollup/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.18.4
version: 0.18.5

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
2 changes: 1 addition & 1 deletion charts/evm-rollup/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ images:
geth:
repo: ghcr.io/astriaorg/astria-geth
tag: 0.10.1
devTag: latest
devTag: pr-22 # Reset to latest once this PR has been merged
conductor:
repo: ghcr.io/astriaorg/conductor
tag: "0.16.0"
Expand Down
6 changes: 3 additions & 3 deletions crates/astria-conductor/src/celestia/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,9 @@ impl RunningReader {
let sequencer_namespace =
astria_core::celestia::namespace_v0_from_sha256_of_bytes(sequencer_chain_id.as_bytes());

let celestia_next_height = executor.celestia_base_block_height().value();
let celestia_reference_height = executor.celestia_base_block_height().value();
let celestia_variance = executor.celestia_block_variance().into();
let celestia_next_height = executor.celestia_base_block_height();
let celestia_reference_height = executor.celestia_base_block_height();
let celestia_variance = executor.celestia_block_variance();

Ok(Self {
block_cache,
Expand Down
29 changes: 18 additions & 11 deletions crates/astria-conductor/src/executor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ use astria_eyre::eyre::{
WrapErr as _,
};
use bytes::Bytes;
use celestia_types::Height as CelestiaHeight;
use sequencer_client::tendermint::{
block::Height as SequencerHeight,
Time as TendermintTime,
Expand Down Expand Up @@ -59,6 +58,8 @@ use state::StateReceiver;

use self::state::StateSender;

type CelestiaHeight = u64;
Copy link
Member Author

Choose a reason for hiding this comment

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

note: doing this because it makes the update enums much more clear or what is being passed in.


#[derive(Clone, Debug)]
pub(crate) struct StateNotInit;
#[derive(Clone, Debug)]
Expand Down Expand Up @@ -209,7 +210,7 @@ impl Handle<StateIsInit> {
self.state.celestia_base_block_height()
}

pub(crate) fn celestia_block_variance(&mut self) -> u32 {
pub(crate) fn celestia_block_variance(&mut self) -> u64 {
self.state.celestia_block_variance()
}
}
Expand Down Expand Up @@ -456,6 +457,7 @@ impl Executor {
block.height = block.sequencer_height().value(),
))]
async fn execute_firm(&mut self, block: ReconstructedBlock) -> eyre::Result<()> {
let celestia_height = block.celestia_height;
let executable_block = ExecutableBlock::from_reconstructed(block);
let expected_height = self.state.next_expected_firm_sequencer_height();
let block_height = executable_block.height;
Expand Down Expand Up @@ -484,21 +486,21 @@ impl Executor {
.wrap_err("failed to execute block")?;
self.does_block_response_fulfill_contract(ExecutionKind::Firm, &executed_block)
.wrap_err("execution API server violated contract")?;
Update::ToSame(executed_block)
Update::ToSame(executed_block, celestia_height)
} else if let Some(block) = self.blocks_pending_finalization.remove(&block_number) {
debug!(
block_number,
"found pending block in cache; updating state but not not re-executing it"
);
Update::OnlyFirm(block)
Update::OnlyFirm(block, celestia_height)
} else {
debug!(
block_number,
"pending block not found for block number in cache. THIS SHOULD NOT HAPPEN. \
Trying to fetch the already-executed block from the rollup before giving up."
);
match self.client.get_block_with_retry(block_number).await {
Ok(block) => Update::OnlyFirm(block),
Ok(block) => Update::OnlyFirm(block, celestia_height),
Err(error) => {
error!(
block_number,
Expand Down Expand Up @@ -594,14 +596,19 @@ impl Executor {
OnlySoft,
ToSame,
};
let (firm, soft) = match update {
OnlyFirm(firm) => (firm, self.state.soft()),
OnlySoft(soft) => (self.state.firm(), soft),
ToSame(block) => (block.clone(), block),
let (firm, soft, celestia_height) = match update {
OnlyFirm(firm, celestia_height) => (firm, self.state.soft(), celestia_height),
OnlySoft(soft) => (
self.state.firm(),
soft,
self.state.celestia_base_block_height(),
),
ToSame(block, celestia_height) => (block.clone(), block, celestia_height),
};
let commitment_state = CommitmentState::builder()
.firm(firm)
.soft(soft)
.base_celestia_height(celestia_height)
.build()
.wrap_err("failed constructing commitment state")?;
let new_state = self
Expand Down Expand Up @@ -645,9 +652,9 @@ impl Executor {
}

enum Update {
OnlyFirm(Block),
OnlyFirm(Block, CelestiaHeight),
OnlySoft(Block),
ToSame(Block),
ToSame(Block, CelestiaHeight),
}

#[derive(Debug)]
Expand Down
16 changes: 8 additions & 8 deletions crates/astria-conductor/src/executor/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ use astria_eyre::{
eyre::WrapErr as _,
};
use bytes::Bytes;
use celestia_types::Height as CelestiaHeight;
use sequencer_client::tendermint::block::Height as SequencerHeight;
use tokio::sync::watch::{
self,
Expand Down Expand Up @@ -218,15 +217,16 @@ forward_impls!(
[soft_number -> u32],
[firm_hash -> Bytes],
[soft_hash -> Bytes],
[celestia_block_variance -> u32],
[celestia_block_variance -> u64],
[rollup_id -> RollupId],
[sequencer_genesis_block_height -> SequencerHeight],
[celestia_base_block_height -> u64],
);

forward_impls!(
StateReceiver:
[celestia_base_block_height -> CelestiaHeight],
[celestia_block_variance -> u32],
[celestia_base_block_height -> u64],
[celestia_block_variance -> u64],
[rollup_id -> RollupId],
);

Expand Down Expand Up @@ -278,11 +278,11 @@ impl State {
self.soft().hash().clone()
}

fn celestia_base_block_height(&self) -> CelestiaHeight {
self.genesis_info.celestia_base_block_height()
fn celestia_base_block_height(&self) -> u64 {
self.commitment_state.base_celestia_height()
}

fn celestia_block_variance(&self) -> u32 {
fn celestia_block_variance(&self) -> u64 {
self.genesis_info.celestia_block_variance()
}

Expand Down Expand Up @@ -372,6 +372,7 @@ mod tests {
CommitmentState::builder()
.firm(firm)
.soft(soft)
.base_celestia_height(1u64)
.build()
.unwrap()
}
Expand All @@ -380,7 +381,6 @@ mod tests {
GenesisInfo::try_from_raw(raw::GenesisInfo {
rollup_id: vec![24; 32].into(),
sequencer_genesis_block_height: 10,
celestia_base_block_height: 1,
celestia_block_variance: 0,
})
.unwrap()
Expand Down
2 changes: 1 addition & 1 deletion crates/astria-conductor/src/executor/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ fn make_state(
let genesis_info = GenesisInfo::try_from_raw(raw::GenesisInfo {
rollup_id: Bytes::copy_from_slice(ROLLUP_ID.as_ref()),
sequencer_genesis_block_height: 1,
celestia_base_block_height: 1,
celestia_block_variance: 1,
})
.unwrap();
let commitment_state = CommitmentState::try_from_raw(raw::CommitmentState {
firm: Some(make_block(firm)),
soft: Some(make_block(soft)),
base_celestia_height: 1,
})
.unwrap();
let (mut tx, rx) = super::state::channel();
Expand Down
13 changes: 9 additions & 4 deletions crates/astria-conductor/tests/blackbox/firm_only.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ async fn simple() {
mount_get_genesis_info!(
test_conductor,
sequencer_genesis_block_height: 1,
celestia_base_block_height: 1,
celestia_block_variance: 10,
);

Expand All @@ -43,6 +42,7 @@ async fn simple() {
hash: [1; 64],
parent: [0; 64],
),
base_celestia_height: 1,
);

mount_sequencer_genesis!(test_conductor);
Expand Down Expand Up @@ -84,6 +84,7 @@ async fn simple() {
hash: [2; 64],
parent: [1; 64],
),
base_celestia_height: 1,
);

timeout(
Expand All @@ -107,7 +108,6 @@ async fn submits_two_heights_in_succession() {
mount_get_genesis_info!(
test_conductor,
sequencer_genesis_block_height: 1,
celestia_base_block_height: 1,
celestia_block_variance: 10,
);

Expand All @@ -123,6 +123,7 @@ async fn submits_two_heights_in_succession() {
hash: [1; 64],
parent: [0; 64],
),
base_celestia_height: 1,
);

mount_sequencer_genesis!(test_conductor);
Expand Down Expand Up @@ -177,6 +178,7 @@ async fn submits_two_heights_in_succession() {
hash: [2; 64],
parent: [1; 64],
),
base_celestia_height: 1,
);

let execute_block_number_3 = mount_executed_block!(
Expand All @@ -198,6 +200,7 @@ async fn submits_two_heights_in_succession() {
hash: [3; 64],
parent: [2; 64],
),
base_celestia_height: 2,
);

timeout(
Expand All @@ -223,7 +226,6 @@ async fn skips_already_executed_heights() {
mount_get_genesis_info!(
test_conductor,
sequencer_genesis_block_height: 1,
celestia_base_block_height: 1,
celestia_block_variance: 10,
);

Expand All @@ -239,6 +241,7 @@ async fn skips_already_executed_heights() {
hash: [1; 64],
parent: [0; 64],
),
base_celestia_height: 1,
);
mount_sequencer_genesis!(test_conductor);

Expand Down Expand Up @@ -293,6 +296,7 @@ async fn skips_already_executed_heights() {
hash: [2; 64],
parent: [1; 64],
),
base_celestia_height: 2,
);

timeout(
Expand All @@ -316,7 +320,6 @@ async fn fetch_from_later_celestia_height() {
mount_get_genesis_info!(
test_conductor,
sequencer_genesis_block_height: 1,
celestia_base_block_height: 4,
celestia_block_variance: 10,
);

Expand All @@ -332,6 +335,7 @@ async fn fetch_from_later_celestia_height() {
hash: [1; 64],
parent: [0; 64],
),
base_celestia_height: 4,
);

mount_sequencer_genesis!(test_conductor);
Expand Down Expand Up @@ -373,6 +377,7 @@ async fn fetch_from_later_celestia_height() {
hash: [2; 64],
parent: [1; 64],
),
base_celestia_height: 4,
);

timeout(
Expand Down
Loading