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)!: update to ABCI v0.38 #831

Merged
merged 55 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from 51 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
4b06f2c
pull proto and crate changes from noot/abci-0.38
noot Mar 18, 2024
4474b8d
update sequencer for proto updates
noot Mar 18, 2024
278fc58
cleanup conductor
noot Mar 18, 2024
d7f9c9c
make block proto not breaking
noot Mar 18, 2024
95c5484
make celestia proto non breaking
noot Mar 18, 2024
62e5b3b
clippy
noot Mar 18, 2024
3ab43e1
fix tests
noot Mar 18, 2024
ddf237f
fix unit tests and cleanup for v0.38
noot Mar 18, 2024
b7c7968
cleanup
noot Mar 18, 2024
cc7cfb5
cleanup
noot Mar 18, 2024
d1e0c24
clippy
noot Mar 18, 2024
48131f9
cleanup
noot Mar 18, 2024
67ba364
merge w main
noot Mar 22, 2024
b41eb87
Merge branch 'noot/proto-updates-for-038' of github.com:astriaorg/ast…
noot Mar 22, 2024
9ff099d
merge with main
noot Mar 26, 2024
dc2d9af
address comments
noot Mar 29, 2024
a474d6a
generate protos
noot Apr 2, 2024
0188499
Merge branch 'main' of github.com:astriaorg/astria into noot/proto-up…
noot Apr 4, 2024
4dbc17d
move block and celestia protos to v2, update sequencer and core
noot Apr 5, 2024
9967433
update conductor and relayer
noot Apr 5, 2024
d605182
generate serde for required types
noot Apr 5, 2024
3cd2167
Merge branch 'main' of github.com:astriaorg/astria into noot/proto-up…
noot Apr 5, 2024
0ff12ba
name v2alpha1
noot Apr 5, 2024
abc74ce
fix sequencer tests
noot Apr 5, 2024
1d03e06
merge w proto branch
noot Apr 5, 2024
2ca170b
Merge branch 'main' of github.com:astriaorg/astria into noot/proto-up…
noot Apr 9, 2024
dab4ef8
create sequencerblockapis v1alpha1
noot Apr 10, 2024
950b134
lint protos
noot Apr 10, 2024
30f0e2d
Merge branch 'main' of github.com:astriaorg/astria into noot/split-pr…
noot Apr 10, 2024
438c6b2
update release workflow
noot Apr 10, 2024
91a43a2
add astria/astria dep
noot Apr 10, 2024
875922f
address comments, serde for sequencerblock types
noot Apr 11, 2024
8e923b3
Merge branch 'main' of github.com:astriaorg/astria into noot/split-pr…
noot Apr 11, 2024
4621ac7
wip
noot Apr 11, 2024
59b7669
merge and update core
noot Apr 11, 2024
add826b
merge
noot Apr 11, 2024
2345d44
merge w main
noot Apr 11, 2024
692e2da
cleanup
noot Apr 11, 2024
0834919
cleanup
noot Apr 11, 2024
380e8d5
move protobuf trait into sequencer/sequencerblock
noot Apr 11, 2024
233fd12
clippy
noot Apr 11, 2024
7724dae
test fix
noot Apr 11, 2024
38a3baa
fix tests
noot Apr 11, 2024
e1f993f
clippy
noot Apr 11, 2024
c9fed7e
merge and update penumbra dep
noot Apr 11, 2024
8a5d6c0
update app to use staged write batch
noot Apr 11, 2024
2b555cf
cleanup
noot Apr 11, 2024
e515fd7
Merge branch 'main' of github.com:astriaorg/astria into noot/proto-up…
noot Apr 11, 2024
4f8dd0d
Merge branch 'noot/proto-updates-for-038' of github.com:astriaorg/ast…
noot Apr 11, 2024
5ace514
minor fixes for running w 0.38
noot Apr 11, 2024
fd87d7f
clippy
noot Apr 11, 2024
1efc3c7
address comments
noot Apr 12, 2024
b018c7c
merge with main
noot Apr 17, 2024
9116cdb
address comments
noot Apr 17, 2024
d9e5dae
update charts to use cometbft v0.38.6
noot Apr 17, 2024
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
235 changes: 90 additions & 145 deletions Cargo.lock

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,10 @@ serde_json = "1"
metrics = "0.22.1"
pbjson-types = "0.6"
# Note that when updating the penumbra versions, vendored types in `proto/sequencerapis/astria_vendored` may need to be updated as well.
penumbra-ibc = { git = "https://github.com/penumbra-zone/penumbra.git", tag = "v0.69.1", default-features = false }
penumbra-proto = { git = "https://github.com/penumbra-zone/penumbra.git", tag = "v0.69.1" }
penumbra-tower-trace = { git = "https://github.com/penumbra-zone/penumbra.git", tag = "v0.69.1" }
# update once https://github.com/penumbra-zone/penumbra/commit/8b06546af43bf073fd99f3f9d82b8afb51872489 makes it into a release
Copy link
Member

Choose a reason for hiding this comment

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

Let's have a tracking issue for this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

penumbra-ibc = { git = "https://github.com/penumbra-zone/penumbra.git", rev = "8b06546af43bf073fd99f3f9d82b8afb51872489", default-features = false }
penumbra-proto = { git = "https://github.com/penumbra-zone/penumbra.git", rev = "8b06546af43bf073fd99f3f9d82b8afb51872489" }
penumbra-tower-trace = { git = "https://github.com/penumbra-zone/penumbra.git", rev = "8b06546af43bf073fd99f3f9d82b8afb51872489" }
prost = "0.12"
rand = "0.8.5"
regex = "1.9"
Expand Down
10 changes: 6 additions & 4 deletions crates/astria-celestia-client/src/client.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use astria_core::sequencer::v1::{
use astria_core::sequencerblock::v1alpha1::{
celestia::CelestiaSequencerBlobError,
CelestiaRollupBlob,
CelestiaSequencerBlob,
Expand Down Expand Up @@ -103,7 +103,7 @@ pub trait CelestiaClientExt: BlobClient {
}
'blob: {
let raw_blob =
match astria_core::generated::sequencer::v1::CelestiaSequencerBlob::decode(
match astria_core::generated::sequencerblock::v1alpha1::CelestiaSequencerBlob::decode(
&*blob.data,
) {
Ok(blob) => blob,
Expand Down Expand Up @@ -254,7 +254,9 @@ fn convert_and_filter_rollup_blobs(
continue;
}
let proto_blob =
match astria_core::generated::sequencer::v1::CelestiaRollupBlob::decode(&*blob.data) {
match astria_core::generated::sequencerblock::v1alpha1::CelestiaRollupBlob::decode(
&*blob.data,
) {
Err(e) => {
debug!(
error = &e as &dyn std::error::Error,
Expand Down Expand Up @@ -305,7 +307,7 @@ fn does_rollup_blob_verify_against_sequencer_blob(
rollup_blob
.proof()
.audit()
.with_root(sequencer_blob.rollup_transactions_root())
.with_root(sequencer_blob.header().rollup_transactions_root())
.with_leaf_builder()
.write(&rollup_blob.rollup_id().get())
.write(&merkle::Tree::from_leaves(rollup_blob.transactions()).root())
Expand Down
6 changes: 3 additions & 3 deletions crates/astria-celestia-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pub mod client;
pub mod metrics_init;
pub mod submission;

pub use astria_core::sequencer::v1::{
pub use astria_core::sequencerblock::v1alpha1::{
CelestiaRollupBlob,
CelestiaSequencerBlob,
};
Expand Down Expand Up @@ -55,10 +55,10 @@ pub const fn celestia_namespace_v0_from_rollup_id(
}

#[must_use = "a celestia namespace must be used in order to be useful"]
pub fn celestia_namespace_v0_from_cometbft_header(header: &tendermint::block::Header) -> Namespace {
pub fn celestia_namespace_v0_from_cometbft_str(chain_id: &str) -> Namespace {
use sha2::{
Digest as _,
Sha256,
};
celestia_namespace_v0_from_array(Sha256::digest(header.chain_id.as_bytes()).into())
celestia_namespace_v0_from_array(Sha256::digest(chain_id.as_bytes()).into())
}
8 changes: 4 additions & 4 deletions crates/astria-celestia-client/src/submission.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! Logic to convert sequencer blocks to celestia blobs before submission.

use astria_core::sequencer::v1::{
RollupId,
SequencerBlock,
use astria_core::{
sequencer::v1::RollupId,
sequencerblock::v1alpha1::SequencerBlock,
};
use celestia_types::Blob;
use prost::Message as _;
Expand Down Expand Up @@ -67,7 +67,7 @@ fn convert(block: SequencerBlock, blobs: &mut Vec<Blob>) -> Result<(), ToBlobsEr
// the rest for the rollup blobs.
blobs.reserve(rollup_blobs.len() + 1);
let sequencer_namespace =
crate::celestia_namespace_v0_from_cometbft_header(sequencer_blob.header());
crate::celestia_namespace_v0_from_cometbft_str(sequencer_blob.header().chain_id().as_str());

let header_blob = Blob::new(
sequencer_namespace,
Expand Down
2 changes: 1 addition & 1 deletion crates/astria-cli/src/commands/rollup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ pub(crate) async fn create_config(args: &ConfigCreateArgs) -> eyre::Result<()> {
.await
.wrap_err("failed to get sequencer block for initial sequencer height")?;

let new_height: u64 = res.header().cometbft_header().height.into();
let new_height: u64 = res.height().into();
conf.sequencer_initial_block_height = Some(new_height);
}

Expand Down
2 changes: 1 addition & 1 deletion crates/astria-cli/src/commands/sequencer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ pub(crate) async fn get_block_height(args: &BlockHeightGetArgs) -> eyre::Result<
.wrap_err("failed to get sequencer block")?;

println!("Block Height:");
println!(" {}", res.header().cometbft_header().height);
println!(" {}", res.height());

Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion crates/astria-conductor/src/block_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::{
future::Future,
};

use astria_core::sequencer::v1::{
use astria_core::sequencerblock::v1alpha1::{
block::FilteredSequencerBlock,
CelestiaSequencerBlob,
};
Expand Down
60 changes: 40 additions & 20 deletions crates/astria-conductor/src/celestia/block_verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,13 @@ fn verify_vote_signature(
mod test {
use std::collections::BTreeMap;

use astria_core::sequencer::v1::{
celestia::UncheckedCelestiaSequencerBlob,
test_utils::make_cometbft_block,
RollupId,
use astria_core::{
generated::sequencerblock::v1alpha1::SequencerBlockHeader as RawSequencerBlockHeader,
sequencer::v1::RollupId,
sequencerblock::v1alpha1::{
block::SequencerBlockHeader,
celestia::UncheckedCelestiaSequencerBlob,
},
};
use prost::Message as _;
use sequencer_client::{
Expand Down Expand Up @@ -371,24 +374,33 @@ mod test {
#[test]
fn validate_sequencer_blob_last_commit_none_ok() {
let rollup_transactions_root = merkle::Tree::from_leaves([[1, 2, 3], [4, 5, 6]]).root();
let chain_ids_commitment = merkle::Tree::new().root();
let rollup_ids_root = merkle::Tree::new().root();

let tree = merkle_tree_from_transactions([rollup_transactions_root, chain_ids_commitment]);
let tree = merkle_tree_from_transactions([rollup_transactions_root, rollup_ids_root]);
let data_hash = tree.root();
let rollup_transactions_proof = tree.construct_proof(0).unwrap();
let rollup_ids_proof = tree.construct_proof(1).unwrap();

let mut header = make_cometbft_block().header;
let height = header.height.value().try_into().unwrap();
header.data_hash = Some(Hash::try_from(data_hash.to_vec()).unwrap());

let (validator_set, proposer_address, commit) =
make_test_validator_set_and_commit(height, header.chain_id.clone());
header.proposer_address = proposer_address;
make_test_validator_set_and_commit(1, "test-chain".try_into().unwrap());

let header = RawSequencerBlockHeader {
chain_id: "test-chain".to_string(),
height: 1,
time: Some(pbjson_types::Timestamp {
seconds: 1,
nanos: 0,
}),
data_hash: data_hash.to_vec(),
rollup_transactions_root: rollup_transactions_root.to_vec(),
proposer_address: proposer_address.as_bytes().to_vec(),
};
let header = SequencerBlockHeader::try_from_raw(header).unwrap();

let sequencer_blob = UncheckedCelestiaSequencerBlob {
block_hash: [0u8; 32],
header,
rollup_ids: vec![],
rollup_transactions_root,
rollup_transactions_proof,
rollup_ids_proof,
}
Expand All @@ -414,18 +426,26 @@ mod test {
let rollup_transactions_proof = tree.construct_proof(0).unwrap();
let rollup_ids_proof = tree.construct_proof(1).unwrap();

let mut header = make_cometbft_block().header;
let height = header.height.value().try_into().unwrap();
header.data_hash = Some(Hash::try_from(data_hash.to_vec()).unwrap());

let (validator_set, proposer_address, commit) =
make_test_validator_set_and_commit(height, header.chain_id.clone());
header.proposer_address = proposer_address;
make_test_validator_set_and_commit(1, "test-chain".try_into().unwrap());

let header = RawSequencerBlockHeader {
chain_id: "test-chain".to_string(),
height: 1,
time: Some(pbjson_types::Timestamp {
seconds: 1,
nanos: 0,
}),
data_hash: data_hash.to_vec(),
rollup_transactions_root: rollup_transactions_root.to_vec(),
proposer_address: proposer_address.as_bytes().to_vec(),
};
let header = SequencerBlockHeader::try_from_raw(header).unwrap();

let sequencer_blob = UncheckedCelestiaSequencerBlob {
block_hash: [0u8; 32],
header,
rollup_ids: vec![rollup_id],
rollup_transactions_root,
rollup_transactions_proof,
rollup_ids_proof,
}
Expand Down
10 changes: 4 additions & 6 deletions crates/astria-conductor/src/celestia/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use std::{
},
};

use astria_core::sequencerblock::v1alpha1::block::SequencerBlockHeader;
use astria_eyre::eyre::{
self,
bail,
Expand All @@ -33,10 +34,7 @@ use futures::{
};
use futures_bounded::FuturesMap;
use pin_project_lite::pin_project;
use sequencer_client::tendermint::{
self,
block::Height as SequencerHeight,
};
use sequencer_client::tendermint::block::Height as SequencerHeight;
use telemetry::display::{
base64,
json,
Expand Down Expand Up @@ -93,14 +91,14 @@ struct ReconstructedBlocks {
#[derive(Clone, Debug)]
pub(crate) struct ReconstructedBlock {
pub(crate) block_hash: [u8; 32],
pub(crate) header: tendermint::block::Header,
pub(crate) header: SequencerBlockHeader,
pub(crate) transactions: Vec<Vec<u8>>,
pub(crate) celestia_height: u64,
}

impl ReconstructedBlock {
pub(crate) fn sequencer_height(&self) -> SequencerHeight {
self.header.height
self.header.height()
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/astria-conductor/src/celestia/reporting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ where
{
let mut seq = serializer.serialize_seq(Some(self.0.len()))?;
for elem in self.0 {
seq.serialize_element(&elem.get_height().value())?;
seq.serialize_element(&elem.get_height())?;
}
seq.end()
}
Expand Down
4 changes: 2 additions & 2 deletions crates/astria-conductor/src/conductor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ async fn get_sequencer_namespace(client: HttpClient) -> eyre::Result<Namespace>
.await
.wrap_err("failed to get block from sequencer after 10 attempts")?;

Ok(celestia_client::celestia_namespace_v0_from_cometbft_header(
block.header().cometbft_header(),
Ok(celestia_client::celestia_namespace_v0_from_cometbft_str(
block.header().chain_id().as_str(),
))
}
2 changes: 1 addition & 1 deletion crates/astria-conductor/src/executor/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use astria_core::{
},
sequencer::v1::RollupData,
},
Protobuf as _,
sequencerblock::Protobuf as _,
};
use astria_eyre::eyre::{
self,
Expand Down
16 changes: 7 additions & 9 deletions crates/astria-conductor/src/executor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ use astria_core::{
Block,
CommitmentState,
},
sequencer::v1::{
block::{
FilteredSequencerBlock,
FilteredSequencerBlockParts,
},
RollupId,
sequencer::v1::RollupId,
sequencerblock::v1alpha1::block::{
FilteredSequencerBlock,
FilteredSequencerBlockParts,
},
};
use astria_eyre::eyre::{
Expand Down Expand Up @@ -530,10 +528,10 @@ impl ExecutableBlock {
transactions,
..
} = block;
let timestamp = convert_tendermint_time_to_protobuf_timestamp(header.time);
let timestamp = convert_tendermint_time_to_protobuf_timestamp(header.time());
Self {
hash: block_hash,
height: header.height,
height: header.height(),
timestamp,
transactions,
}
Expand All @@ -542,7 +540,7 @@ impl ExecutableBlock {
fn from_sequencer(block: FilteredSequencerBlock, id: RollupId) -> Self {
let hash = block.block_hash();
let height = block.height();
let timestamp = convert_tendermint_time_to_protobuf_timestamp(block.cometbft_header().time);
let timestamp = convert_tendermint_time_to_protobuf_timestamp(block.header().time());
let FilteredSequencerBlockParts {
mut rollup_transactions,
..
Expand Down
2 changes: 1 addition & 1 deletion crates/astria-conductor/src/executor/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ fn map_rollup_height_to_sequencer_height(
mod tests {
use astria_core::{
generated::execution::v1alpha2 as raw,
Protobuf as _,
sequencerblock::Protobuf as _,
};
use pbjson_types::Timestamp;

Expand Down
Loading
Loading