From 66704f2e054c9368833452541f0d98c0ab12e03a Mon Sep 17 00:00:00 2001 From: Richard Janis Goldschmidt Date: Tue, 19 Nov 2024 17:51:09 +0100 Subject: [PATCH] fix(ci, core): delete unused generated code, generate overlooked code --- .../src/bridge_withdrawer/mod.rs | 2 +- .../src/bridge_withdrawer/startup.rs | 19 +- .../bridge_withdrawer/submitter/builder.rs | 2 +- .../src/bridge_withdrawer/submitter/mod.rs | 2 +- .../tests/blackbox/helpers/mock_cometbft.rs | 2 +- .../tests/blackbox/helpers/mock_sequencer.rs | 2 +- .../src/sequencer/threshold/sign.rs | 2 +- .../src/sequencer/threshold/verify.rs | 2 +- crates/astria-composer/src/collectors/grpc.rs | 2 +- .../astria-composer/src/executor/builder.rs | 2 +- crates/astria-composer/src/executor/mod.rs | 2 +- crates/astria-composer/src/grpc.rs | 2 +- .../tests/blackbox/grpc_collector.rs | 2 +- .../blackbox/helper/mock_grpc_sequencer.rs | 2 +- .../tests/blackbox/helper/mod.rs | 2 +- .../src/celestia/block_verifier.rs | 2 +- .../astria-conductor/src/celestia/convert.rs | 2 +- .../astria-conductor/src/executor/client.rs | 2 +- crates/astria-conductor/src/executor/state.rs | 2 +- crates/astria-conductor/src/executor/tests.rs | 2 +- .../astria-conductor/src/sequencer/client.rs | 2 +- .../tests/blackbox/firm_only.rs | 2 +- .../tests/blackbox/helpers/macros.rs | 14 +- .../tests/blackbox/helpers/mock_grpc.rs | 2 +- .../tests/blackbox/helpers/mod.rs | 12 +- .../tests/blackbox/soft_only.rs | 2 +- crates/astria-core/CHANGELOG.md | 6 + crates/astria-core/src/execution/v1/mod.rs | 8 +- .../astria.protocol.transaction.v1.rs | 2 +- .../astria.protocol.transaction.v1alpha1.rs | 2 +- ...sequencerblock.optimisticblock.v1alpha1.rs | 516 ------------------ ...cerblock.optimisticblock.v1alpha1.serde.rs | 460 ---------------- crates/astria-core/src/generated/mod.rs | 206 +++---- crates/astria-core/src/primitive/v1/mod.rs | 2 +- crates/astria-core/src/primitive/v1/u128.rs | 5 +- .../astria-core/src/protocol/account/mod.rs | 2 - .../src/protocol/account/v1/mod.rs | 10 +- crates/astria-core/src/protocol/asset/mod.rs | 2 - .../astria-core/src/protocol/asset/v1/mod.rs | 12 +- crates/astria-core/src/protocol/bridge/mod.rs | 2 +- crates/astria-core/src/protocol/fees/v1.rs | 2 +- crates/astria-core/src/protocol/genesis/v1.rs | 2 +- crates/astria-core/src/protocol/memos/v1.rs | 2 +- .../src/protocol/transaction/v1/mod.rs | 2 +- .../src/sequencerblock/v1/block.rs | 7 +- .../astria-core/src/sequencerblock/v1/mod.rs | 2 +- .../src/extension_trait.rs | 24 +- .../astria-sequencer-client/src/tests/http.rs | 12 +- .../src/relayer/builder.rs | 2 +- .../src/relayer/mod.rs | 2 +- .../src/relayer/read.rs | 2 +- .../src/relayer/write/conversion.rs | 2 +- .../blackbox/helpers/mock_sequencer_server.rs | 2 +- .../astria-sequencer-utils/src/blob_parser.rs | 2 +- .../src/genesis_example.rs | 6 +- .../src/app/benchmark_and_test_utils.rs | 8 +- crates/astria-sequencer/src/app/benchmarks.rs | 2 +- crates/astria-sequencer/src/app/mod.rs | 2 +- .../astria-sequencer/src/app/tests_app/mod.rs | 2 +- .../src/app/tests_breaking_changes.rs | 2 +- .../src/app/tests_execute_transaction.rs | 4 +- crates/astria-sequencer/src/bridge/query.rs | 2 +- crates/astria-sequencer/src/fees/query.rs | 2 +- crates/astria-sequencer/src/fees/tests.rs | 2 +- crates/astria-sequencer/src/grpc/sequencer.rs | 2 +- crates/astria-sequencer/src/sequencer.rs | 2 +- .../astria-sequencer/src/service/consensus.rs | 16 +- .../astria-sequencer/src/service/info/mod.rs | 6 +- .../src/service/mempool/mod.rs | 2 +- tools/protobuf-compiler/CHANGELOG.md | 15 + tools/protobuf-compiler/src/main.rs | 43 +- 71 files changed, 291 insertions(+), 1218 deletions(-) delete mode 100644 crates/astria-core/src/generated/astria.sequencerblock.optimisticblock.v1alpha1.rs delete mode 100644 crates/astria-core/src/generated/astria.sequencerblock.optimisticblock.v1alpha1.serde.rs create mode 100644 tools/protobuf-compiler/CHANGELOG.md diff --git a/crates/astria-bridge-withdrawer/src/bridge_withdrawer/mod.rs b/crates/astria-bridge-withdrawer/src/bridge_withdrawer/mod.rs index b1aa923f72..aeb0f1a721 100644 --- a/crates/astria-bridge-withdrawer/src/bridge_withdrawer/mod.rs +++ b/crates/astria-bridge-withdrawer/src/bridge_withdrawer/mod.rs @@ -4,7 +4,7 @@ use std::{ time::Duration, }; -use astria_core::generated::sequencerblock::v1::sequencer_service_client::SequencerServiceClient; +use astria_core::generated::astria::sequencerblock::v1::sequencer_service_client::SequencerServiceClient; use astria_eyre::eyre::{ self, WrapErr as _, diff --git a/crates/astria-bridge-withdrawer/src/bridge_withdrawer/startup.rs b/crates/astria-bridge-withdrawer/src/bridge_withdrawer/startup.rs index 033b53f0a2..c80c170cab 100644 --- a/crates/astria-bridge-withdrawer/src/bridge_withdrawer/startup.rs +++ b/crates/astria-bridge-withdrawer/src/bridge_withdrawer/startup.rs @@ -4,7 +4,7 @@ use std::{ }; use astria_core::{ - generated::sequencerblock::v1::sequencer_service_client::{ + generated::astria::sequencerblock::v1::sequencer_service_client::{ self, SequencerServiceClient, }, @@ -270,20 +270,21 @@ impl Startup { the sequencer logic." ); - let proto_tx = astria_core::generated::protocol::transaction::v1::Transaction::decode( - &*last_transaction.tx, - ) - .wrap_err_with(|| { - format!( + let proto_tx = + astria_core::generated::astria::protocol::transaction::v1::Transaction::decode( + &*last_transaction.tx, + ) + .wrap_err_with(|| { + format!( "failed to decode data in Sequencer CometBFT transaction as `{}`", - astria_core::generated::protocol::transaction::v1::Transaction::full_name(), + astria_core::generated::astria::protocol::transaction::v1::Transaction::full_name(), ) - })?; + })?; let tx = Transaction::try_from_raw(proto_tx).wrap_err_with(|| { format!( "failed to verify {}", - astria_core::generated::protocol::transaction::v1::Transaction::full_name() + astria_core::generated::astria::protocol::transaction::v1::Transaction::full_name() ) })?; diff --git a/crates/astria-bridge-withdrawer/src/bridge_withdrawer/submitter/builder.rs b/crates/astria-bridge-withdrawer/src/bridge_withdrawer/submitter/builder.rs index 7b5593a0aa..62308d1572 100644 --- a/crates/astria-bridge-withdrawer/src/bridge_withdrawer/submitter/builder.rs +++ b/crates/astria-bridge-withdrawer/src/bridge_withdrawer/submitter/builder.rs @@ -1,6 +1,6 @@ use std::sync::Arc; -use astria_core::generated::sequencerblock::v1::sequencer_service_client::SequencerServiceClient; +use astria_core::generated::astria::sequencerblock::v1::sequencer_service_client::SequencerServiceClient; use astria_eyre::eyre::{ self, Context as _, diff --git a/crates/astria-bridge-withdrawer/src/bridge_withdrawer/submitter/mod.rs b/crates/astria-bridge-withdrawer/src/bridge_withdrawer/submitter/mod.rs index 0bd72886a5..a7c195c862 100644 --- a/crates/astria-bridge-withdrawer/src/bridge_withdrawer/submitter/mod.rs +++ b/crates/astria-bridge-withdrawer/src/bridge_withdrawer/submitter/mod.rs @@ -4,7 +4,7 @@ use std::{ }; use astria_core::{ - generated::sequencerblock::v1::{ + generated::astria::sequencerblock::v1::{ sequencer_service_client::{ self, SequencerServiceClient, diff --git a/crates/astria-bridge-withdrawer/tests/blackbox/helpers/mock_cometbft.rs b/crates/astria-bridge-withdrawer/tests/blackbox/helpers/mock_cometbft.rs index c3f23d53fc..f0e4d0cef4 100644 --- a/crates/astria-bridge-withdrawer/tests/blackbox/helpers/mock_cometbft.rs +++ b/crates/astria-bridge-withdrawer/tests/blackbox/helpers/mock_cometbft.rs @@ -332,7 +332,7 @@ fn prepare_broadcast_tx_sync_response(response: tx_sync::Response) -> Mock { /// Convert a wiremock request to an astria transaction pub fn tx_from_request(request: &wiremock::Request) -> Transaction { - use astria_core::generated::protocol::transaction::v1::Transaction as RawTransaction; + use astria_core::generated::astria::protocol::transaction::v1::Transaction as RawTransaction; use prost::Message as _; let wrapped_tx_sync_req: tendermint_rpc::request::Wrapper = diff --git a/crates/astria-bridge-withdrawer/tests/blackbox/helpers/mock_sequencer.rs b/crates/astria-bridge-withdrawer/tests/blackbox/helpers/mock_sequencer.rs index 66dc282e31..9a2971b790 100644 --- a/crates/astria-bridge-withdrawer/tests/blackbox/helpers/mock_sequencer.rs +++ b/crates/astria-bridge-withdrawer/tests/blackbox/helpers/mock_sequencer.rs @@ -5,7 +5,7 @@ use std::{ use astria_core::{ self, - generated::sequencerblock::v1::{ + generated::astria::sequencerblock::v1::{ sequencer_service_server::{ SequencerService, SequencerServiceServer, diff --git a/crates/astria-cli/src/sequencer/threshold/sign.rs b/crates/astria-cli/src/sequencer/threshold/sign.rs index 93e65987fc..b5a3830f24 100644 --- a/crates/astria-cli/src/sequencer/threshold/sign.rs +++ b/crates/astria-cli/src/sequencer/threshold/sign.rs @@ -1,6 +1,6 @@ use std::collections::BTreeMap; -use astria_core::generated::protocol::transaction::v1::{ +use astria_core::generated::astria::protocol::transaction::v1::{ Transaction, TransactionBody, }; diff --git a/crates/astria-cli/src/sequencer/threshold/verify.rs b/crates/astria-cli/src/sequencer/threshold/verify.rs index f616cb4475..ec4d027b46 100644 --- a/crates/astria-cli/src/sequencer/threshold/verify.rs +++ b/crates/astria-cli/src/sequencer/threshold/verify.rs @@ -1,4 +1,4 @@ -use astria_core::generated::protocol::transaction::v1::TransactionBody; +use astria_core::generated::astria::protocol::transaction::v1::TransactionBody; use color_eyre::eyre::{ self, WrapErr as _, diff --git a/crates/astria-composer/src/collectors/grpc.rs b/crates/astria-composer/src/collectors/grpc.rs index 18d95adb93..deeb580546 100644 --- a/crates/astria-composer/src/collectors/grpc.rs +++ b/crates/astria-composer/src/collectors/grpc.rs @@ -3,7 +3,7 @@ use std::sync::Arc; use astria_core::{ - generated::composer::v1::{ + generated::astria::composer::v1::{ grpc_collector_service_server::GrpcCollectorService, SubmitRollupTransactionRequest, SubmitRollupTransactionResponse, diff --git a/crates/astria-composer/src/executor/builder.rs b/crates/astria-composer/src/executor/builder.rs index c388a63121..31a8ee04fa 100644 --- a/crates/astria-composer/src/executor/builder.rs +++ b/crates/astria-composer/src/executor/builder.rs @@ -6,7 +6,7 @@ use std::{ use astria_core::{ crypto::SigningKey, - generated::sequencerblock::v1::sequencer_service_client::SequencerServiceClient, + generated::astria::sequencerblock::v1::sequencer_service_client::SequencerServiceClient, primitive::v1::Address, protocol::transaction::v1::action::RollupDataSubmission, }; diff --git a/crates/astria-composer/src/executor/mod.rs b/crates/astria-composer/src/executor/mod.rs index a07b2e4fe6..62ed88e966 100644 --- a/crates/astria-composer/src/executor/mod.rs +++ b/crates/astria-composer/src/executor/mod.rs @@ -12,7 +12,7 @@ use std::{ use astria_core::{ crypto::SigningKey, - generated::sequencerblock::v1::{ + generated::astria::sequencerblock::v1::{ sequencer_service_client::{ self, SequencerServiceClient, diff --git a/crates/astria-composer/src/grpc.rs b/crates/astria-composer/src/grpc.rs index f9453b36ef..7c1d3b8ef1 100644 --- a/crates/astria-composer/src/grpc.rs +++ b/crates/astria-composer/src/grpc.rs @@ -9,7 +9,7 @@ use std::net::SocketAddr; use astria_core::{ - generated::composer::v1::grpc_collector_service_server::GrpcCollectorServiceServer, + generated::astria::composer::v1::grpc_collector_service_server::GrpcCollectorServiceServer, primitive::v1::asset, }; use astria_eyre::{ diff --git a/crates/astria-composer/tests/blackbox/grpc_collector.rs b/crates/astria-composer/tests/blackbox/grpc_collector.rs index f8286a25d8..18767ab0ab 100644 --- a/crates/astria-composer/tests/blackbox/grpc_collector.rs +++ b/crates/astria-composer/tests/blackbox/grpc_collector.rs @@ -1,7 +1,7 @@ use std::time::Duration; use astria_core::{ - generated::composer::v1::{ + generated::astria::composer::v1::{ grpc_collector_service_client::GrpcCollectorServiceClient, SubmitRollupTransactionRequest, }, diff --git a/crates/astria-composer/tests/blackbox/helper/mock_grpc_sequencer.rs b/crates/astria-composer/tests/blackbox/helper/mock_grpc_sequencer.rs index 23be34c31a..0897610967 100644 --- a/crates/astria-composer/tests/blackbox/helper/mock_grpc_sequencer.rs +++ b/crates/astria-composer/tests/blackbox/helper/mock_grpc_sequencer.rs @@ -5,7 +5,7 @@ use std::{ use astria_core::{ self, - generated::sequencerblock::v1::{ + generated::astria::sequencerblock::v1::{ sequencer_service_server::{ SequencerService, SequencerServiceServer, diff --git a/crates/astria-composer/tests/blackbox/helper/mod.rs b/crates/astria-composer/tests/blackbox/helper/mod.rs index 93f7f6a1a7..fca7da0f41 100644 --- a/crates/astria-composer/tests/blackbox/helper/mod.rs +++ b/crates/astria-composer/tests/blackbox/helper/mod.rs @@ -207,7 +207,7 @@ pub async fn loop_until_composer_is_ready(addr: SocketAddr) { } fn signed_tx_from_request(request: &Request) -> Transaction { - use astria_core::generated::protocol::transaction::v1::Transaction as RawTransaction; + use astria_core::generated::astria::protocol::transaction::v1::Transaction as RawTransaction; use prost::Message as _; let wrapped_tx_sync_req: request::Wrapper = diff --git a/crates/astria-conductor/src/celestia/block_verifier.rs b/crates/astria-conductor/src/celestia/block_verifier.rs index ff72aa8a7c..7b580b954e 100644 --- a/crates/astria-conductor/src/celestia/block_verifier.rs +++ b/crates/astria-conductor/src/celestia/block_verifier.rs @@ -221,7 +221,7 @@ mod tests { use std::collections::BTreeMap; use astria_core::{ - generated::sequencerblock::v1::SequencerBlockHeader as RawSequencerBlockHeader, + generated::astria::sequencerblock::v1::SequencerBlockHeader as RawSequencerBlockHeader, primitive::v1::RollupId, sequencerblock::v1::{ block::SequencerBlockHeader, diff --git a/crates/astria-conductor/src/celestia/convert.rs b/crates/astria-conductor/src/celestia/convert.rs index c2772d4f15..02861136d1 100644 --- a/crates/astria-conductor/src/celestia/convert.rs +++ b/crates/astria-conductor/src/celestia/convert.rs @@ -1,6 +1,6 @@ use astria_core::{ brotli::decompress_bytes, - generated::sequencerblock::v1::{ + generated::astria::sequencerblock::v1::{ SubmittedMetadataList, SubmittedRollupDataList, }, diff --git a/crates/astria-conductor/src/executor/client.rs b/crates/astria-conductor/src/executor/client.rs index bbd0b550cf..1bab377d97 100644 --- a/crates/astria-conductor/src/executor/client.rs +++ b/crates/astria-conductor/src/executor/client.rs @@ -6,7 +6,7 @@ use astria_core::{ CommitmentState, GenesisInfo, }, - generated::{ + generated::astria::{ execution::{ v1 as raw, v1::execution_service_client::ExecutionServiceClient, diff --git a/crates/astria-conductor/src/executor/state.rs b/crates/astria-conductor/src/executor/state.rs index bfe794e6c1..2ae4e2c4b2 100644 --- a/crates/astria-conductor/src/executor/state.rs +++ b/crates/astria-conductor/src/executor/state.rs @@ -344,7 +344,7 @@ pub(super) fn map_sequencer_height_to_rollup_height( #[cfg(test)] mod tests { use astria_core::{ - generated::execution::v1 as raw, + generated::astria::execution::v1 as raw, Protobuf as _, }; use pbjson_types::Timestamp; diff --git a/crates/astria-conductor/src/executor/tests.rs b/crates/astria-conductor/src/executor/tests.rs index 164d8b0a20..e8ead9dc71 100644 --- a/crates/astria-conductor/src/executor/tests.rs +++ b/crates/astria-conductor/src/executor/tests.rs @@ -5,7 +5,7 @@ use astria_core::{ CommitmentState, GenesisInfo, }, - generated::execution::v1 as raw, + generated::astria::execution::v1 as raw, Protobuf as _, }; use bytes::Bytes; diff --git a/crates/astria-conductor/src/sequencer/client.rs b/crates/astria-conductor/src/sequencer/client.rs index 760a5ede27..e0e61d2229 100644 --- a/crates/astria-conductor/src/sequencer/client.rs +++ b/crates/astria-conductor/src/sequencer/client.rs @@ -3,7 +3,7 @@ use std::time::Duration; use astria_core::{ - generated::sequencerblock::v1::{ + generated::astria::sequencerblock::v1::{ sequencer_service_client::SequencerServiceClient, GetFilteredSequencerBlockRequest, }, diff --git a/crates/astria-conductor/tests/blackbox/firm_only.rs b/crates/astria-conductor/tests/blackbox/firm_only.rs index 2fb2c43148..e634292a1c 100644 --- a/crates/astria-conductor/tests/blackbox/firm_only.rs +++ b/crates/astria-conductor/tests/blackbox/firm_only.rs @@ -5,7 +5,7 @@ use astria_conductor::{ Conductor, Config, }; -use astria_core::generated::execution::v1::{ +use astria_core::generated::astria::execution::v1::{ GetCommitmentStateRequest, GetGenesisInfoRequest, }; diff --git a/crates/astria-conductor/tests/blackbox/helpers/macros.rs b/crates/astria-conductor/tests/blackbox/helpers/macros.rs index 4119fe1bf6..981f4c31dc 100644 --- a/crates/astria-conductor/tests/blackbox/helpers/macros.rs +++ b/crates/astria-conductor/tests/blackbox/helpers/macros.rs @@ -1,7 +1,7 @@ #[macro_export] macro_rules! block { (number: $number:expr,hash: $hash:expr,parent: $parent:expr $(,)?) => { - ::astria_core::generated::execution::v1::Block { + ::astria_core::generated::astria::execution::v1::Block { number: $number, hash: ::bytes::Bytes::from(Vec::from($hash)), parent_block_hash: ::bytes::Bytes::from(Vec::from($parent)), @@ -59,7 +59,7 @@ macro_rules! commitment_state { soft: (number: $soft_number:expr,hash: $soft_hash:expr,parent: $soft_parent:expr $(,)?), base_celestia_height: $base_celestia_height:expr $(,)? ) => { - ::astria_core::generated::execution::v1::CommitmentState { + ::astria_core::generated::astria::execution::v1::CommitmentState { firm: Some($crate::block!( number: $firm_number, hash: $firm_hash, @@ -98,7 +98,7 @@ macro_rules! genesis_info { $sequencer_height:expr,celestia_block_variance: $variance:expr $(,)? ) => { - ::astria_core::generated::execution::v1::GenesisInfo { + ::astria_core::generated::astria::execution::v1::GenesisInfo { rollup_id: Some($crate::ROLLUP_ID.to_raw()), sequencer_genesis_block_height: $sequencer_height, celestia_block_variance: $variance, @@ -312,7 +312,7 @@ macro_rules! mount_get_filtered_sequencer_block { ($test_env:ident, sequencer_height: $height:expr, delay: $delay:expr $(,)?) => { $test_env .mount_get_filtered_sequencer_block( - ::astria_core::generated::sequencerblock::v1::GetFilteredSequencerBlockRequest { + ::astria_core::generated::astria::sequencerblock::v1::GetFilteredSequencerBlockRequest { height: $height, rollup_ids: vec![$crate::ROLLUP_ID.to_raw()], }, @@ -385,12 +385,12 @@ macro_rules! mount_get_block { hash: $hash, parent: $parent, ); - let identifier = ::astria_core::generated::execution::v1::BlockIdentifier { + let identifier = ::astria_core::generated::astria::execution::v1::BlockIdentifier { identifier: Some( - ::astria_core::generated::execution::v1::block_identifier::Identifier::BlockNumber(block.number) + ::astria_core::generated::astria::execution::v1::block_identifier::Identifier::BlockNumber(block.number) )}; $test_env.mount_get_block( - ::astria_core::generated::execution::v1::GetBlockRequest { + ::astria_core::generated::astria::execution::v1::GetBlockRequest { identifier: Some(identifier), }, block, diff --git a/crates/astria-conductor/tests/blackbox/helpers/mock_grpc.rs b/crates/astria-conductor/tests/blackbox/helpers/mock_grpc.rs index c0b8b7ff2f..457ef04e3d 100644 --- a/crates/astria-conductor/tests/blackbox/helpers/mock_grpc.rs +++ b/crates/astria-conductor/tests/blackbox/helpers/mock_grpc.rs @@ -3,7 +3,7 @@ use std::{ sync::Arc, }; -use astria_core::generated::{ +use astria_core::generated::astria::{ execution::v1::{ execution_service_server::{ ExecutionService, diff --git a/crates/astria-conductor/tests/blackbox/helpers/mod.rs b/crates/astria-conductor/tests/blackbox/helpers/mod.rs index da7dad5061..8890bc3f20 100644 --- a/crates/astria-conductor/tests/blackbox/helpers/mod.rs +++ b/crates/astria-conductor/tests/blackbox/helpers/mod.rs @@ -12,7 +12,7 @@ use astria_conductor::{ }; use astria_core::{ brotli::compress_bytes, - generated::{ + generated::astria::{ execution::v1::{ Block, CommitmentState, @@ -179,7 +179,7 @@ impl TestConductor { pub async fn mount_get_block( &self, expected_pbjson: S, - block: astria_core::generated::execution::v1::Block, + block: astria_core::generated::astria::execution::v1::Block, ) { use astria_grpc_mock::{ matcher::message_partial_pbjson, @@ -306,7 +306,7 @@ impl TestConductor { } pub async fn mount_get_genesis_info(&self, genesis_info: GenesisInfo) { - use astria_core::generated::execution::v1::GetGenesisInfoRequest; + use astria_core::generated::astria::execution::v1::GetGenesisInfoRequest; astria_grpc_mock::Mock::for_rpc_given( "get_genesis_info", astria_grpc_mock::matcher::message_type::(), @@ -318,7 +318,7 @@ impl TestConductor { } pub async fn mount_get_commitment_state(&self, commitment_state: CommitmentState) { - use astria_core::generated::execution::v1::GetCommitmentStateRequest; + use astria_core::generated::astria::execution::v1::GetCommitmentStateRequest; astria_grpc_mock::Mock::for_rpc_given( "get_commitment_state", @@ -381,7 +381,7 @@ impl TestConductor { commitment_state: CommitmentState, expected_calls: u64, ) -> astria_grpc_mock::MockGuard { - use astria_core::generated::execution::v1::UpdateCommitmentStateRequest; + use astria_core::generated::astria::execution::v1::UpdateCommitmentStateRequest; use astria_grpc_mock::{ matcher::message_partial_pbjson, response::constant_response, @@ -567,7 +567,7 @@ pub struct Blobs { #[must_use] pub fn make_blobs(heights: &[u32]) -> Blobs { - use astria_core::generated::sequencerblock::v1::{ + use astria_core::generated::astria::sequencerblock::v1::{ SubmittedMetadataList, SubmittedRollupDataList, }; diff --git a/crates/astria-conductor/tests/blackbox/soft_only.rs b/crates/astria-conductor/tests/blackbox/soft_only.rs index e82793c638..8fff4e8c1c 100644 --- a/crates/astria-conductor/tests/blackbox/soft_only.rs +++ b/crates/astria-conductor/tests/blackbox/soft_only.rs @@ -5,7 +5,7 @@ use astria_conductor::{ Conductor, Config, }; -use astria_core::generated::execution::v1::{ +use astria_core::generated::astria::execution::v1::{ GetCommitmentStateRequest, GetGenesisInfoRequest, }; diff --git a/crates/astria-core/CHANGELOG.md b/crates/astria-core/CHANGELOG.md index dd487eeab3..7a812add6d 100644 --- a/crates/astria-core/CHANGELOG.md +++ b/crates/astria-core/CHANGELOG.md @@ -15,6 +15,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added method `TracePrefixed::leading_channel` to read the left-most channel of a trace prefixed ICS20 asset [#1768](https://github.com/astriaorg/astria/pull/1768) +### Changed + +- Move all Astria APIs generated from the Protobuf spec from `astria_core::generated` + to `astria_core::generated::astria` + [#1825](https://github.com/astriaorg/astria/pull/1825) + ### Removed - Removed method `TracePrefixed::last_channel` [#1768](https://github.com/astriaorg/astria/pull/1768) diff --git a/crates/astria-core/src/execution/v1/mod.rs b/crates/astria-core/src/execution/v1/mod.rs index 6daca96a42..3327cd0edc 100644 --- a/crates/astria-core/src/execution/v1/mod.rs +++ b/crates/astria-core/src/execution/v1/mod.rs @@ -2,7 +2,7 @@ use bytes::Bytes; use pbjson_types::Timestamp; use crate::{ - generated::execution::v1 as raw, + generated::astria::execution::v1 as raw, primitive::v1::{ IncorrectRollupIdLength, RollupId, @@ -43,7 +43,7 @@ enum GenesisInfoErrorKind { #[cfg_attr(feature = "serde", derive(serde::Serialize))] #[cfg_attr( feature = "serde", - serde(into = "crate::generated::execution::v1::GenesisInfo") + serde(into = "crate::generated::astria::execution::v1::GenesisInfo") )] pub struct GenesisInfo { /// The rollup id which is used to identify the rollup txs. @@ -148,7 +148,7 @@ enum BlockErrorKind { #[cfg_attr(feature = "serde", derive(serde::Serialize))] #[cfg_attr( feature = "serde", - serde(into = "crate::generated::execution::v1::Block") + serde(into = "crate::generated::astria::execution::v1::Block") )] pub struct Block { /// The block number @@ -380,7 +380,7 @@ impl CommitmentStateBuilder { #[cfg_attr(feature = "serde", derive(serde::Serialize))] #[cfg_attr( feature = "serde", - serde(into = "crate::generated::execution::v1::CommitmentState") + serde(into = "crate::generated::astria::execution::v1::CommitmentState") )] pub struct CommitmentState { /// Soft commitment is the rollup block matching latest sequencer block. diff --git a/crates/astria-core/src/generated/astria.protocol.transaction.v1.rs b/crates/astria-core/src/generated/astria.protocol.transaction.v1.rs index 6bd2ba2fdc..0b38628394 100644 --- a/crates/astria-core/src/generated/astria.protocol.transaction.v1.rs +++ b/crates/astria-core/src/generated/astria.protocol.transaction.v1.rs @@ -36,7 +36,7 @@ pub mod action { SudoAddressChange(super::SudoAddressChange), #[prost(message, tag = "51")] ValidatorUpdate( - crate::generated::astria_vendored::tendermint::abci::ValidatorUpdate, + super::super::super::super::super::astria_vendored::tendermint::abci::ValidatorUpdate, ), #[prost(message, tag = "52")] IbcRelayerChange(super::IbcRelayerChange), diff --git a/crates/astria-core/src/generated/astria.protocol.transaction.v1alpha1.rs b/crates/astria-core/src/generated/astria.protocol.transaction.v1alpha1.rs index 75c1bf44b4..a310970f2b 100644 --- a/crates/astria-core/src/generated/astria.protocol.transaction.v1alpha1.rs +++ b/crates/astria-core/src/generated/astria.protocol.transaction.v1alpha1.rs @@ -36,7 +36,7 @@ pub mod action { SudoAddressChange(super::SudoAddressChange), #[prost(message, tag = "51")] ValidatorUpdate( - crate::generated::astria_vendored::tendermint::abci::ValidatorUpdate, + super::super::super::super::super::astria_vendored::tendermint::abci::ValidatorUpdate, ), #[prost(message, tag = "52")] IbcRelayerChange(super::IbcRelayerChange), diff --git a/crates/astria-core/src/generated/astria.sequencerblock.optimisticblock.v1alpha1.rs b/crates/astria-core/src/generated/astria.sequencerblock.optimisticblock.v1alpha1.rs deleted file mode 100644 index 612e5c9fcf..0000000000 --- a/crates/astria-core/src/generated/astria.sequencerblock.optimisticblock.v1alpha1.rs +++ /dev/null @@ -1,516 +0,0 @@ -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetBlockCommitmentStreamRequest {} -impl ::prost::Name for GetBlockCommitmentStreamRequest { - const NAME: &'static str = "GetBlockCommitmentStreamRequest"; - const PACKAGE: &'static str = "astria.sequencerblock.optimisticblock.v1alpha1"; - fn full_name() -> ::prost::alloc::string::String { - ::prost::alloc::format!( - "astria.sequencerblock.optimisticblock.v1alpha1.{}", Self::NAME - ) - } -} -/// Identifying metadata for blocks that have been successfully committed in the Sequencer. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct SequencerBlockCommit { - /// Height of the sequencer block that was committed. - #[prost(uint64, tag = "1")] - pub height: u64, - /// Hash of the sequencer block that was committed. - #[prost(bytes = "bytes", tag = "2")] - pub block_hash: ::prost::bytes::Bytes, -} -impl ::prost::Name for SequencerBlockCommit { - const NAME: &'static str = "SequencerBlockCommit"; - const PACKAGE: &'static str = "astria.sequencerblock.optimisticblock.v1alpha1"; - fn full_name() -> ::prost::alloc::string::String { - ::prost::alloc::format!( - "astria.sequencerblock.optimisticblock.v1alpha1.{}", Self::NAME - ) - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetBlockCommitmentStreamResponse { - #[prost(message, optional, tag = "1")] - pub commitment: ::core::option::Option, -} -impl ::prost::Name for GetBlockCommitmentStreamResponse { - const NAME: &'static str = "GetBlockCommitmentStreamResponse"; - const PACKAGE: &'static str = "astria.sequencerblock.optimisticblock.v1alpha1"; - fn full_name() -> ::prost::alloc::string::String { - ::prost::alloc::format!( - "astria.sequencerblock.optimisticblock.v1alpha1.{}", Self::NAME - ) - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetOptimisticBlockStreamRequest { - /// The rollup id for which the Sequencer block is being streamed. - #[prost(message, optional, tag = "1")] - pub rollup_id: ::core::option::Option, -} -impl ::prost::Name for GetOptimisticBlockStreamRequest { - const NAME: &'static str = "GetOptimisticBlockStreamRequest"; - const PACKAGE: &'static str = "astria.sequencerblock.optimisticblock.v1alpha1"; - fn full_name() -> ::prost::alloc::string::String { - ::prost::alloc::format!( - "astria.sequencerblock.optimisticblock.v1alpha1.{}", Self::NAME - ) - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GetOptimisticBlockStreamResponse { - /// The optimistic Sequencer block that is being streamed, filtered for the provided rollup id. - #[prost(message, optional, tag = "1")] - pub block: ::core::option::Option, -} -impl ::prost::Name for GetOptimisticBlockStreamResponse { - const NAME: &'static str = "GetOptimisticBlockStreamResponse"; - const PACKAGE: &'static str = "astria.sequencerblock.optimisticblock.v1alpha1"; - fn full_name() -> ::prost::alloc::string::String { - ::prost::alloc::format!( - "astria.sequencerblock.optimisticblock.v1alpha1.{}", Self::NAME - ) - } -} -/// Generated client implementations. -#[cfg(feature = "client")] -pub mod optimistic_block_service_client { - #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] - use tonic::codegen::*; - use tonic::codegen::http::Uri; - /// The Sequencer will serve this to the aucitoneer - #[derive(Debug, Clone)] - pub struct OptimisticBlockServiceClient { - inner: tonic::client::Grpc, - } - impl OptimisticBlockServiceClient { - /// Attempt to create a new client by connecting to a given endpoint. - pub async fn connect(dst: D) -> Result - where - D: TryInto, - D::Error: Into, - { - let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; - Ok(Self::new(conn)) - } - } - impl OptimisticBlockServiceClient - where - T: tonic::client::GrpcService, - T::Error: Into, - T::ResponseBody: Body + Send + 'static, - ::Error: Into + Send, - { - pub fn new(inner: T) -> Self { - let inner = tonic::client::Grpc::new(inner); - Self { inner } - } - pub fn with_origin(inner: T, origin: Uri) -> Self { - let inner = tonic::client::Grpc::with_origin(inner, origin); - Self { inner } - } - pub fn with_interceptor( - inner: T, - interceptor: F, - ) -> OptimisticBlockServiceClient> - where - F: tonic::service::Interceptor, - T::ResponseBody: Default, - T: tonic::codegen::Service< - http::Request, - Response = http::Response< - >::ResponseBody, - >, - >, - , - >>::Error: Into + Send + Sync, - { - OptimisticBlockServiceClient::new( - InterceptedService::new(inner, interceptor), - ) - } - /// Compress requests with the given encoding. - /// - /// This requires the server to support it otherwise it might respond with an - /// error. - #[must_use] - pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { - self.inner = self.inner.send_compressed(encoding); - self - } - /// Enable decompressing responses. - #[must_use] - pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { - self.inner = self.inner.accept_compressed(encoding); - self - } - /// Limits the maximum size of a decoded message. - /// - /// Default: `4MB` - #[must_use] - pub fn max_decoding_message_size(mut self, limit: usize) -> Self { - self.inner = self.inner.max_decoding_message_size(limit); - self - } - /// Limits the maximum size of an encoded message. - /// - /// Default: `usize::MAX` - #[must_use] - pub fn max_encoding_message_size(mut self, limit: usize) -> Self { - self.inner = self.inner.max_encoding_message_size(limit); - self - } - /// The Sequencer will stream the optimistic Sequencer block (filtered for the provided - /// rollup id) to the Auctioneer. - pub async fn get_optimistic_block_stream( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response< - tonic::codec::Streaming, - >, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/astria.sequencerblock.optimisticblock.v1alpha1.OptimisticBlockService/GetOptimisticBlockStream", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "astria.sequencerblock.optimisticblock.v1alpha1.OptimisticBlockService", - "GetOptimisticBlockStream", - ), - ); - self.inner.server_streaming(req, path, codec).await - } - /// The Sequencer will stream the block commits to the Auctioneer. - pub async fn get_block_commitment_stream( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response< - tonic::codec::Streaming, - >, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/astria.sequencerblock.optimisticblock.v1alpha1.OptimisticBlockService/GetBlockCommitmentStream", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "astria.sequencerblock.optimisticblock.v1alpha1.OptimisticBlockService", - "GetBlockCommitmentStream", - ), - ); - self.inner.server_streaming(req, path, codec).await - } - } -} -/// Generated server implementations. -#[cfg(feature = "server")] -pub mod optimistic_block_service_server { - #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] - use tonic::codegen::*; - /// Generated trait containing gRPC methods that should be implemented for use with OptimisticBlockServiceServer. - #[async_trait] - pub trait OptimisticBlockService: Send + Sync + 'static { - /// Server streaming response type for the GetOptimisticBlockStream method. - type GetOptimisticBlockStreamStream: tonic::codegen::tokio_stream::Stream< - Item = std::result::Result< - super::GetOptimisticBlockStreamResponse, - tonic::Status, - >, - > - + Send - + 'static; - /// The Sequencer will stream the optimistic Sequencer block (filtered for the provided - /// rollup id) to the Auctioneer. - async fn get_optimistic_block_stream( - self: std::sync::Arc, - request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; - /// Server streaming response type for the GetBlockCommitmentStream method. - type GetBlockCommitmentStreamStream: tonic::codegen::tokio_stream::Stream< - Item = std::result::Result< - super::GetBlockCommitmentStreamResponse, - tonic::Status, - >, - > - + Send - + 'static; - /// The Sequencer will stream the block commits to the Auctioneer. - async fn get_block_commitment_stream( - self: std::sync::Arc, - request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; - } - /// The Sequencer will serve this to the aucitoneer - #[derive(Debug)] - pub struct OptimisticBlockServiceServer { - inner: _Inner, - accept_compression_encodings: EnabledCompressionEncodings, - send_compression_encodings: EnabledCompressionEncodings, - max_decoding_message_size: Option, - max_encoding_message_size: Option, - } - struct _Inner(Arc); - impl OptimisticBlockServiceServer { - pub fn new(inner: T) -> Self { - Self::from_arc(Arc::new(inner)) - } - pub fn from_arc(inner: Arc) -> Self { - let inner = _Inner(inner); - Self { - inner, - accept_compression_encodings: Default::default(), - send_compression_encodings: Default::default(), - max_decoding_message_size: None, - max_encoding_message_size: None, - } - } - pub fn with_interceptor( - inner: T, - interceptor: F, - ) -> InterceptedService - where - F: tonic::service::Interceptor, - { - InterceptedService::new(Self::new(inner), interceptor) - } - /// Enable decompressing requests with the given encoding. - #[must_use] - pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { - self.accept_compression_encodings.enable(encoding); - self - } - /// Compress responses with the given encoding, if the client supports it. - #[must_use] - pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { - self.send_compression_encodings.enable(encoding); - self - } - /// Limits the maximum size of a decoded message. - /// - /// Default: `4MB` - #[must_use] - pub fn max_decoding_message_size(mut self, limit: usize) -> Self { - self.max_decoding_message_size = Some(limit); - self - } - /// Limits the maximum size of an encoded message. - /// - /// Default: `usize::MAX` - #[must_use] - pub fn max_encoding_message_size(mut self, limit: usize) -> Self { - self.max_encoding_message_size = Some(limit); - self - } - } - impl tonic::codegen::Service> - for OptimisticBlockServiceServer - where - T: OptimisticBlockService, - B: Body + Send + 'static, - B::Error: Into + Send + 'static, - { - type Response = http::Response; - type Error = std::convert::Infallible; - type Future = BoxFuture; - fn poll_ready( - &mut self, - _cx: &mut Context<'_>, - ) -> Poll> { - Poll::Ready(Ok(())) - } - fn call(&mut self, req: http::Request) -> Self::Future { - let inner = self.inner.clone(); - match req.uri().path() { - "/astria.sequencerblock.optimisticblock.v1alpha1.OptimisticBlockService/GetOptimisticBlockStream" => { - #[allow(non_camel_case_types)] - struct GetOptimisticBlockStreamSvc( - pub Arc, - ); - impl< - T: OptimisticBlockService, - > tonic::server::ServerStreamingService< - super::GetOptimisticBlockStreamRequest, - > for GetOptimisticBlockStreamSvc { - type Response = super::GetOptimisticBlockStreamResponse; - type ResponseStream = T::GetOptimisticBlockStreamStream; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request< - super::GetOptimisticBlockStreamRequest, - >, - ) -> Self::Future { - let inner = Arc::clone(&self.0); - let fut = async move { - ::get_optimistic_block_stream( - inner, - request, - ) - .await - }; - Box::pin(fut) - } - } - let accept_compression_encodings = self.accept_compression_encodings; - let send_compression_encodings = self.send_compression_encodings; - let max_decoding_message_size = self.max_decoding_message_size; - let max_encoding_message_size = self.max_encoding_message_size; - let inner = self.inner.clone(); - let fut = async move { - let inner = inner.0; - let method = GetOptimisticBlockStreamSvc(inner); - let codec = tonic::codec::ProstCodec::default(); - let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); - let res = grpc.server_streaming(method, req).await; - Ok(res) - }; - Box::pin(fut) - } - "/astria.sequencerblock.optimisticblock.v1alpha1.OptimisticBlockService/GetBlockCommitmentStream" => { - #[allow(non_camel_case_types)] - struct GetBlockCommitmentStreamSvc( - pub Arc, - ); - impl< - T: OptimisticBlockService, - > tonic::server::ServerStreamingService< - super::GetBlockCommitmentStreamRequest, - > for GetBlockCommitmentStreamSvc { - type Response = super::GetBlockCommitmentStreamResponse; - type ResponseStream = T::GetBlockCommitmentStreamStream; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request< - super::GetBlockCommitmentStreamRequest, - >, - ) -> Self::Future { - let inner = Arc::clone(&self.0); - let fut = async move { - ::get_block_commitment_stream( - inner, - request, - ) - .await - }; - Box::pin(fut) - } - } - let accept_compression_encodings = self.accept_compression_encodings; - let send_compression_encodings = self.send_compression_encodings; - let max_decoding_message_size = self.max_decoding_message_size; - let max_encoding_message_size = self.max_encoding_message_size; - let inner = self.inner.clone(); - let fut = async move { - let inner = inner.0; - let method = GetBlockCommitmentStreamSvc(inner); - let codec = tonic::codec::ProstCodec::default(); - let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); - let res = grpc.server_streaming(method, req).await; - Ok(res) - }; - Box::pin(fut) - } - _ => { - Box::pin(async move { - Ok( - http::Response::builder() - .status(200) - .header("grpc-status", "12") - .header("content-type", "application/grpc") - .body(empty_body()) - .unwrap(), - ) - }) - } - } - } - } - impl Clone for OptimisticBlockServiceServer { - fn clone(&self) -> Self { - let inner = self.inner.clone(); - Self { - inner, - accept_compression_encodings: self.accept_compression_encodings, - send_compression_encodings: self.send_compression_encodings, - max_decoding_message_size: self.max_decoding_message_size, - max_encoding_message_size: self.max_encoding_message_size, - } - } - } - impl Clone for _Inner { - fn clone(&self) -> Self { - Self(Arc::clone(&self.0)) - } - } - impl std::fmt::Debug for _Inner { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{:?}", self.0) - } - } - impl tonic::server::NamedService - for OptimisticBlockServiceServer { - const NAME: &'static str = "astria.sequencerblock.optimisticblock.v1alpha1.OptimisticBlockService"; - } -} diff --git a/crates/astria-core/src/generated/astria.sequencerblock.optimisticblock.v1alpha1.serde.rs b/crates/astria-core/src/generated/astria.sequencerblock.optimisticblock.v1alpha1.serde.rs deleted file mode 100644 index bc159c576f..0000000000 --- a/crates/astria-core/src/generated/astria.sequencerblock.optimisticblock.v1alpha1.serde.rs +++ /dev/null @@ -1,460 +0,0 @@ -impl serde::Serialize for GetBlockCommitmentStreamRequest { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let len = 0; - let struct_ser = serializer.serialize_struct("astria.sequencerblock.optimisticblock.v1alpha1.GetBlockCommitmentStreamRequest", len)?; - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for GetBlockCommitmentStreamRequest { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - Err(serde::de::Error::unknown_field(value, FIELDS)) - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GetBlockCommitmentStreamRequest; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct astria.sequencerblock.optimisticblock.v1alpha1.GetBlockCommitmentStreamRequest") - } - - fn visit_map(self, mut map_: V) -> std::result::Result - where - V: serde::de::MapAccess<'de>, - { - while map_.next_key::()?.is_some() { - let _ = map_.next_value::()?; - } - Ok(GetBlockCommitmentStreamRequest { - }) - } - } - deserializer.deserialize_struct("astria.sequencerblock.optimisticblock.v1alpha1.GetBlockCommitmentStreamRequest", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for GetBlockCommitmentStreamResponse { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if self.commitment.is_some() { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("astria.sequencerblock.optimisticblock.v1alpha1.GetBlockCommitmentStreamResponse", len)?; - if let Some(v) = self.commitment.as_ref() { - struct_ser.serialize_field("commitment", v)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for GetBlockCommitmentStreamResponse { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "commitment", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Commitment, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "commitment" => Ok(GeneratedField::Commitment), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GetBlockCommitmentStreamResponse; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct astria.sequencerblock.optimisticblock.v1alpha1.GetBlockCommitmentStreamResponse") - } - - fn visit_map(self, mut map_: V) -> std::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut commitment__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Commitment => { - if commitment__.is_some() { - return Err(serde::de::Error::duplicate_field("commitment")); - } - commitment__ = map_.next_value()?; - } - } - } - Ok(GetBlockCommitmentStreamResponse { - commitment: commitment__, - }) - } - } - deserializer.deserialize_struct("astria.sequencerblock.optimisticblock.v1alpha1.GetBlockCommitmentStreamResponse", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for GetOptimisticBlockStreamRequest { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if self.rollup_id.is_some() { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("astria.sequencerblock.optimisticblock.v1alpha1.GetOptimisticBlockStreamRequest", len)?; - if let Some(v) = self.rollup_id.as_ref() { - struct_ser.serialize_field("rollupId", v)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for GetOptimisticBlockStreamRequest { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "rollup_id", - "rollupId", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - RollupId, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "rollupId" | "rollup_id" => Ok(GeneratedField::RollupId), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GetOptimisticBlockStreamRequest; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct astria.sequencerblock.optimisticblock.v1alpha1.GetOptimisticBlockStreamRequest") - } - - fn visit_map(self, mut map_: V) -> std::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut rollup_id__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::RollupId => { - if rollup_id__.is_some() { - return Err(serde::de::Error::duplicate_field("rollupId")); - } - rollup_id__ = map_.next_value()?; - } - } - } - Ok(GetOptimisticBlockStreamRequest { - rollup_id: rollup_id__, - }) - } - } - deserializer.deserialize_struct("astria.sequencerblock.optimisticblock.v1alpha1.GetOptimisticBlockStreamRequest", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for GetOptimisticBlockStreamResponse { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if self.block.is_some() { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("astria.sequencerblock.optimisticblock.v1alpha1.GetOptimisticBlockStreamResponse", len)?; - if let Some(v) = self.block.as_ref() { - struct_ser.serialize_field("block", v)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for GetOptimisticBlockStreamResponse { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "block", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Block, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "block" => Ok(GeneratedField::Block), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GetOptimisticBlockStreamResponse; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct astria.sequencerblock.optimisticblock.v1alpha1.GetOptimisticBlockStreamResponse") - } - - fn visit_map(self, mut map_: V) -> std::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut block__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Block => { - if block__.is_some() { - return Err(serde::de::Error::duplicate_field("block")); - } - block__ = map_.next_value()?; - } - } - } - Ok(GetOptimisticBlockStreamResponse { - block: block__, - }) - } - } - deserializer.deserialize_struct("astria.sequencerblock.optimisticblock.v1alpha1.GetOptimisticBlockStreamResponse", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for SequencerBlockCommit { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if self.height != 0 { - len += 1; - } - if !self.block_hash.is_empty() { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("astria.sequencerblock.optimisticblock.v1alpha1.SequencerBlockCommit", len)?; - if self.height != 0 { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("height", ToString::to_string(&self.height).as_str())?; - } - if !self.block_hash.is_empty() { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("blockHash", pbjson::private::base64::encode(&self.block_hash).as_str())?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for SequencerBlockCommit { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "height", - "block_hash", - "blockHash", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Height, - BlockHash, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "height" => Ok(GeneratedField::Height), - "blockHash" | "block_hash" => Ok(GeneratedField::BlockHash), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = SequencerBlockCommit; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct astria.sequencerblock.optimisticblock.v1alpha1.SequencerBlockCommit") - } - - fn visit_map(self, mut map_: V) -> std::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut height__ = None; - let mut block_hash__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Height => { - if height__.is_some() { - return Err(serde::de::Error::duplicate_field("height")); - } - height__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::BlockHash => { - if block_hash__.is_some() { - return Err(serde::de::Error::duplicate_field("blockHash")); - } - block_hash__ = - Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0) - ; - } - } - } - Ok(SequencerBlockCommit { - height: height__.unwrap_or_default(), - block_hash: block_hash__.unwrap_or_default(), - }) - } - } - deserializer.deserialize_struct("astria.sequencerblock.optimisticblock.v1alpha1.SequencerBlockCommit", FIELDS, GeneratedVisitor) - } -} diff --git a/crates/astria-core/src/generated/mod.rs b/crates/astria-core/src/generated/mod.rs index 963dd5bbe3..41e186e2d7 100644 --- a/crates/astria-core/src/generated/mod.rs +++ b/crates/astria-core/src/generated/mod.rs @@ -38,151 +38,155 @@ pub mod astria_vendored { } #[path = ""] -pub mod bundle { - pub mod v1alpha1 { - include!("astria.bundle.v1alpha1.rs"); - - #[cfg(feature = "serde")] - mod _serde_impl { - use super::*; - include!("astria.bundle.v1alpha1.serde.rs"); - } - } -} - -#[path = ""] -pub mod execution { - pub mod v1 { - include!("astria.execution.v1.rs"); - - #[cfg(feature = "serde")] - mod _serde_impl { - use super::*; - include!("astria.execution.v1.serde.rs"); - } - } -} - -#[path = ""] -pub mod primitive { - pub mod v1 { - include!("astria.primitive.v1.rs"); - - #[cfg(feature = "serde")] - mod _serde_impl { - use super::*; - include!("astria.primitive.v1.serde.rs"); - } - } -} - -#[path = ""] -pub mod protocol { +pub mod astria { #[path = ""] - pub mod accounts { - #[path = "astria.protocol.accounts.v1.rs"] - pub mod v1; - } - #[path = ""] - pub mod asset { - #[path = "astria.protocol.asset.v1.rs"] - pub mod v1; - } - #[path = ""] - pub mod bridge { - #[path = "astria.protocol.bridge.v1.rs"] - pub mod v1; - } - #[path = ""] - pub mod fees { - #[path = "astria.protocol.fees.v1.rs"] - pub mod v1 { - include!("astria.protocol.fees.v1.rs"); + pub mod bundle { + pub mod v1alpha1 { + include!("astria.bundle.v1alpha1.rs"); #[cfg(feature = "serde")] - mod _serde_impls { + mod _serde_impl { use super::*; - include!("astria.protocol.fees.v1.serde.rs"); + include!("astria.bundle.v1alpha1.serde.rs"); } } } + #[path = ""] - pub mod genesis { + pub mod execution { pub mod v1 { - include!("astria.protocol.genesis.v1.rs"); + include!("astria.execution.v1.rs"); #[cfg(feature = "serde")] - mod _serde_impls { + mod _serde_impl { use super::*; - include!("astria.protocol.genesis.v1.serde.rs"); + include!("astria.execution.v1.serde.rs"); } } } + #[path = ""] - pub mod memos { + pub mod primitive { pub mod v1 { - include!("astria.protocol.memos.v1.rs"); + include!("astria.primitive.v1.rs"); #[cfg(feature = "serde")] - mod _serde_impls { + mod _serde_impl { use super::*; - include!("astria.protocol.memos.v1.serde.rs"); + include!("astria.primitive.v1.serde.rs"); } } } + #[path = ""] - pub mod transaction { - pub mod v1 { - include!("astria.protocol.transaction.v1.rs"); + pub mod protocol { + #[path = ""] + pub mod accounts { + #[path = "astria.protocol.accounts.v1.rs"] + pub mod v1; + } + #[path = ""] + pub mod asset { + #[path = "astria.protocol.asset.v1.rs"] + pub mod v1; + } + #[path = ""] + pub mod bridge { + #[path = "astria.protocol.bridge.v1.rs"] + pub mod v1; + } + #[path = ""] + pub mod fees { + #[path = "astria.protocol.fees.v1.rs"] + pub mod v1 { + include!("astria.protocol.fees.v1.rs"); - #[cfg(feature = "serde")] - mod _serde_impl { - use super::*; - include!("astria.protocol.transaction.v1.serde.rs"); + #[cfg(feature = "serde")] + mod _serde_impls { + use super::*; + include!("astria.protocol.fees.v1.serde.rs"); + } } } - } -} + #[path = ""] + pub mod genesis { + pub mod v1 { + include!("astria.protocol.genesis.v1.rs"); -#[path = ""] -pub mod sequencerblock { - pub mod v1alpha1 { - include!("astria.sequencerblock.v1alpha1.rs"); + #[cfg(feature = "serde")] + mod _serde_impls { + use super::*; + include!("astria.protocol.genesis.v1.serde.rs"); + } + } + } + #[path = ""] + pub mod memos { + pub mod v1 { + include!("astria.protocol.memos.v1.rs"); - #[cfg(feature = "serde")] - mod _serde_impl { - use super::*; - include!("astria.sequencerblock.v1alpha1.serde.rs"); + #[cfg(feature = "serde")] + mod _serde_impls { + use super::*; + include!("astria.protocol.memos.v1.serde.rs"); + } + } } - } - pub mod v1 { - include!("astria.sequencerblock.v1.rs"); + #[path = ""] + pub mod transaction { + pub mod v1 { + include!("astria.protocol.transaction.v1.rs"); - #[cfg(feature = "serde")] - mod _serde_impl { - use super::*; - include!("astria.sequencerblock.v1.serde.rs"); + #[cfg(feature = "serde")] + mod _serde_impl { + use super::*; + include!("astria.protocol.transaction.v1.serde.rs"); + } + } } } - pub mod optimisticblock { + #[path = ""] + pub mod sequencerblock { pub mod v1alpha1 { - include!("astria.sequencerblock.optimisticblock.v1alpha1.rs"); + include!("astria.sequencerblock.v1alpha1.rs"); #[cfg(feature = "serde")] mod _serde_impl { use super::*; - include!("astria.sequencerblock.optimisticblock.v1alpha1.serde.rs"); + include!("astria.sequencerblock.v1alpha1.serde.rs"); + } + } + + pub mod v1 { + include!("astria.sequencerblock.v1.rs"); + + #[cfg(feature = "serde")] + mod _serde_impl { + use super::*; + include!("astria.sequencerblock.v1.serde.rs"); + } + } + + pub mod optimistic { + pub mod v1alpha1 { + include!("astria.sequencerblock.optimistic.v1alpha1.rs"); + + #[cfg(feature = "serde")] + mod _serde_impl { + use super::*; + include!("astria.sequencerblock.optimistic.v1alpha1.serde.rs"); + } } } } -} -#[path = ""] -pub mod composer { - #[path = "astria.composer.v1.rs"] - pub mod v1; + #[path = ""] + pub mod composer { + #[path = "astria.composer.v1.rs"] + pub mod v1; + } } #[path = ""] diff --git a/crates/astria-core/src/primitive/v1/mod.rs b/crates/astria-core/src/primitive/v1/mod.rs index 56cb6922b5..f433b623fe 100644 --- a/crates/astria-core/src/primitive/v1/mod.rs +++ b/crates/astria-core/src/primitive/v1/mod.rs @@ -17,7 +17,7 @@ use sha2::{ }; use crate::{ - generated::primitive::v1 as raw, + generated::astria::primitive::v1 as raw, Protobuf, }; diff --git a/crates/astria-core/src/primitive/v1/u128.rs b/crates/astria-core/src/primitive/v1/u128.rs index ee77646a27..581f5b5ecc 100644 --- a/crates/astria-core/src/primitive/v1/u128.rs +++ b/crates/astria-core/src/primitive/v1/u128.rs @@ -1,6 +1,6 @@ //! Transformations of compiled protobuf types to other types. -use crate::generated::primitive::v1::Uint128; +use crate::generated::astria::primitive::v1::Uint128; impl From for Uint128 { fn from(primitive: u128) -> Self { let [ @@ -48,7 +48,8 @@ impl<'a> From<&'a u128> for Uint128 { #[cfg(test)] mod tests { - use crate::generated::primitive::v1::Uint128; + use super::Uint128; + #[track_caller] fn u128_roundtrip_check(expected: u128) { let pb: Uint128 = expected.into(); diff --git a/crates/astria-core/src/protocol/account/mod.rs b/crates/astria-core/src/protocol/account/mod.rs index 423eaae929..a3a6d96c3f 100644 --- a/crates/astria-core/src/protocol/account/mod.rs +++ b/crates/astria-core/src/protocol/account/mod.rs @@ -1,3 +1 @@ pub mod v1; - -use crate::generated::protocol::accounts::v1 as raw; diff --git a/crates/astria-core/src/protocol/account/v1/mod.rs b/crates/astria-core/src/protocol/account/v1/mod.rs index 697696ad66..1b16953fdc 100644 --- a/crates/astria-core/src/protocol/account/v1/mod.rs +++ b/crates/astria-core/src/protocol/account/v1/mod.rs @@ -1,7 +1,9 @@ -use super::raw; -use crate::primitive::v1::asset::{ - Denom, - ParseDenomError, +use crate::{ + generated::astria::protocol::accounts::v1 as raw, + primitive::v1::asset::{ + Denom, + ParseDenomError, + }, }; #[derive(Debug, thiserror::Error)] diff --git a/crates/astria-core/src/protocol/asset/mod.rs b/crates/astria-core/src/protocol/asset/mod.rs index bd31b9c85b..a3a6d96c3f 100644 --- a/crates/astria-core/src/protocol/asset/mod.rs +++ b/crates/astria-core/src/protocol/asset/mod.rs @@ -1,3 +1 @@ pub mod v1; - -use crate::generated::protocol::asset::v1 as raw; diff --git a/crates/astria-core/src/protocol/asset/v1/mod.rs b/crates/astria-core/src/protocol/asset/v1/mod.rs index c9330e32bf..9d8ec55c28 100644 --- a/crates/astria-core/src/protocol/asset/v1/mod.rs +++ b/crates/astria-core/src/protocol/asset/v1/mod.rs @@ -1,8 +1,10 @@ -use super::raw; -use crate::primitive::v1::asset::{ - self, - Denom, - ParseDenomError, +use crate::{ + generated::astria::protocol::asset::v1 as raw, + primitive::v1::asset::{ + self, + Denom, + ParseDenomError, + }, }; #[derive(Debug, thiserror::Error)] diff --git a/crates/astria-core/src/protocol/bridge/mod.rs b/crates/astria-core/src/protocol/bridge/mod.rs index f8b278c8f1..cab4a9fd57 100644 --- a/crates/astria-core/src/protocol/bridge/mod.rs +++ b/crates/astria-core/src/protocol/bridge/mod.rs @@ -1,3 +1,3 @@ pub mod v1; -use crate::generated::protocol::bridge::v1 as raw; +use crate::generated::astria::protocol::bridge::v1 as raw; diff --git a/crates/astria-core/src/protocol/fees/v1.rs b/crates/astria-core/src/protocol/fees/v1.rs index 400a63651d..f77441a90c 100644 --- a/crates/astria-core/src/protocol/fees/v1.rs +++ b/crates/astria-core/src/protocol/fees/v1.rs @@ -1,7 +1,7 @@ use prost::Name as _; use crate::{ - generated::protocol::fees::v1 as raw, + generated::astria::protocol::fees::v1 as raw, primitive::v1::asset, Protobuf, }; diff --git a/crates/astria-core/src/protocol/genesis/v1.rs b/crates/astria-core/src/protocol/genesis/v1.rs index 69bb2269bd..b03fb3cf8b 100644 --- a/crates/astria-core/src/protocol/genesis/v1.rs +++ b/crates/astria-core/src/protocol/genesis/v1.rs @@ -3,7 +3,7 @@ use std::convert::Infallible; pub use penumbra_ibc::params::IBCParameters; use crate::{ - generated::protocol::genesis::v1 as raw, + generated::astria::protocol::genesis::v1 as raw, primitive::v1::{ asset::{ self, diff --git a/crates/astria-core/src/protocol/memos/v1.rs b/crates/astria-core/src/protocol/memos/v1.rs index 796eea7f7b..9e9aa76cf2 100644 --- a/crates/astria-core/src/protocol/memos/v1.rs +++ b/crates/astria-core/src/protocol/memos/v1.rs @@ -1,4 +1,4 @@ -pub use crate::generated::protocol::memos::v1::{ +pub use crate::generated::astria::protocol::memos::v1::{ Ics20TransferDeposit, Ics20WithdrawalFromRollup, }; diff --git a/crates/astria-core/src/protocol/transaction/v1/mod.rs b/crates/astria-core/src/protocol/transaction/v1/mod.rs index 6bfbd5b22c..59616514d8 100644 --- a/crates/astria-core/src/protocol/transaction/v1/mod.rs +++ b/crates/astria-core/src/protocol/transaction/v1/mod.rs @@ -11,7 +11,7 @@ use crate::{ SigningKey, VerificationKey, }, - generated::protocol::transaction::v1 as raw, + generated::astria::protocol::transaction::v1 as raw, primitive::v1::{ TransactionId, ADDRESS_LEN, diff --git a/crates/astria-core/src/sequencerblock/v1/block.rs b/crates/astria-core/src/sequencerblock/v1/block.rs index 48f8907fac..44b6eb98c7 100644 --- a/crates/astria-core/src/sequencerblock/v1/block.rs +++ b/crates/astria-core/src/sequencerblock/v1/block.rs @@ -784,8 +784,9 @@ impl SequencerBlock { let mut rollup_datas = IndexMap::new(); for elem in data_list { - let raw_tx = crate::generated::protocol::transaction::v1::Transaction::decode(&*elem) - .map_err(SequencerBlockError::transaction_protobuf_decode)?; + let raw_tx = + crate::generated::astria::protocol::transaction::v1::Transaction::decode(&*elem) + .map_err(SequencerBlockError::transaction_protobuf_decode)?; let tx = Transaction::try_from_raw(raw_tx) .map_err(SequencerBlockError::raw_signed_transaction_conversion)?; for action in tx.into_unsigned().into_actions() { @@ -1363,7 +1364,7 @@ impl FilteredSequencerBlockError { #[cfg_attr(feature = "serde", derive(serde::Serialize))] #[cfg_attr( feature = "serde", - serde(into = "crate::generated::sequencerblock::v1::Deposit") + serde(into = "crate::generated::astria::sequencerblock::v1::Deposit") )] pub struct Deposit { // the address on the sequencer to which the funds were sent to. diff --git a/crates/astria-core/src/sequencerblock/v1/mod.rs b/crates/astria-core/src/sequencerblock/v1/mod.rs index 966696c9ff..9685f452f6 100644 --- a/crates/astria-core/src/sequencerblock/v1/mod.rs +++ b/crates/astria-core/src/sequencerblock/v1/mod.rs @@ -16,7 +16,7 @@ use sha2::{ }; use crate::{ - generated::sequencerblock::v1 as raw, + generated::astria::sequencerblock::v1 as raw, primitive::v1::{ derive_merkle_tree_from_rollup_txs, IncorrectRollupIdLength, diff --git a/crates/astria-sequencer-client/src/extension_trait.rs b/crates/astria-sequencer-client/src/extension_trait.rs index 59cab0f7e5..96eed49ef8 100644 --- a/crates/astria-sequencer-client/src/extension_trait.rs +++ b/crates/astria-sequencer-client/src/extension_trait.rs @@ -450,7 +450,7 @@ pub trait SequencerClientExt: Client { .map_err(|e| Error::tendermint_rpc("abci_query", e))?; let proto_response = - astria_core::generated::protocol::accounts::v1::BalanceResponse::decode( + astria_core::generated::astria::protocol::accounts::v1::BalanceResponse::decode( &*response.value, ) .map_err(|e| { @@ -492,7 +492,7 @@ pub trait SequencerClientExt: Client { .map_err(|e| Error::tendermint_rpc("abci_query", e))?; let proto_response = - astria_core::generated::protocol::asset::v1::AllowedFeeAssetsResponse::decode( + astria_core::generated::astria::protocol::asset::v1::AllowedFeeAssetsResponse::decode( &*response.value, ) .map_err(|e| { @@ -532,14 +532,12 @@ pub trait SequencerClientExt: Client { .map_err(|e| Error::tendermint_rpc("abci_query", e))?; let proto_response = - astria_core::generated::protocol::accounts::v1::NonceResponse::decode(&*response.value) - .map_err(|e| { - Error::abci_query_deserialization( - "astria.sequencer.v1.NonceResponse", - response, - e, - ) - })?; + astria_core::generated::astria::protocol::accounts::v1::NonceResponse::decode( + &*response.value, + ) + .map_err(|e| { + Error::abci_query_deserialization("astria.sequencer.v1.NonceResponse", response, e) + })?; Ok(proto_response.to_native()) } @@ -567,7 +565,7 @@ pub trait SequencerClientExt: Client { .map_err(|e| Error::tendermint_rpc("abci_query", e))?; let proto_response = - astria_core::generated::protocol::bridge::v1::BridgeAccountInfoResponse::decode( + astria_core::generated::astria::protocol::bridge::v1::BridgeAccountInfoResponse::decode( &*response.value, ) .map_err(|e| { @@ -599,7 +597,7 @@ pub trait SequencerClientExt: Client { .map_err(|e| Error::tendermint_rpc("abci_query", e))?; let proto_response = - astria_core::generated::protocol::bridge::v1::BridgeAccountLastTxHashResponse::decode( + astria_core::generated::astria::protocol::bridge::v1::BridgeAccountLastTxHashResponse::decode( &*response.value, ) .map_err(|e| { @@ -631,7 +629,7 @@ pub trait SequencerClientExt: Client { .map_err(|e| Error::tendermint_rpc("abci_query", e))?; let proto_response = - astria_core::generated::protocol::fees::v1::TransactionFeeResponse::decode( + astria_core::generated::astria::protocol::fees::v1::TransactionFeeResponse::decode( &*response.value, ) .map_err(|e| { diff --git a/crates/astria-sequencer-client/src/tests/http.rs b/crates/astria-sequencer-client/src/tests/http.rs index 23f1ee481c..3923c6178a 100644 --- a/crates/astria-sequencer-client/src/tests/http.rs +++ b/crates/astria-sequencer-client/src/tests/http.rs @@ -2,7 +2,7 @@ use std::time::Duration; use astria_core::{ crypto::SigningKey, - generated::protocol::{ + generated::astria::protocol::{ asset::v1::AllowedFeeAssetsResponse, fees::v1::TransactionFee, }, @@ -170,7 +170,7 @@ fn create_signed_transaction() -> Transaction { #[tokio::test] async fn get_latest_nonce() { - use astria_core::generated::protocol::accounts::v1::NonceResponse; + use astria_core::generated::astria::protocol::accounts::v1::NonceResponse; let MockSequencer { server, client, @@ -197,7 +197,7 @@ async fn get_latest_nonce() { #[tokio::test] async fn get_latest_balance() { - use astria_core::generated::protocol::accounts::v1::{ + use astria_core::generated::astria::protocol::accounts::v1::{ AssetBalance, BalanceResponse, }; @@ -262,7 +262,7 @@ async fn get_allowed_fee_assets() { #[tokio::test] async fn get_bridge_account_info() { use astria_core::{ - generated::protocol::bridge::v1::BridgeAccountInfoResponse, + generated::astria::protocol::bridge::v1::BridgeAccountInfoResponse, primitive::v1::RollupId, }; @@ -294,7 +294,7 @@ async fn get_bridge_account_info() { #[tokio::test] async fn get_bridge_account_last_transaction_hash() { - use astria_core::generated::protocol::bridge::v1::BridgeAccountLastTxHashResponse; + use astria_core::generated::astria::protocol::bridge::v1::BridgeAccountLastTxHashResponse; let MockSequencer { server, @@ -324,7 +324,7 @@ async fn get_bridge_account_last_transaction_hash() { #[tokio::test] async fn get_transaction_fee() { - use astria_core::generated::protocol::fees::v1::TransactionFeeResponse; + use astria_core::generated::astria::protocol::fees::v1::TransactionFeeResponse; let MockSequencer { server, diff --git a/crates/astria-sequencer-relayer/src/relayer/builder.rs b/crates/astria-sequencer-relayer/src/relayer/builder.rs index 0609af19ce..fd4d3fbf17 100644 --- a/crates/astria-sequencer-relayer/src/relayer/builder.rs +++ b/crates/astria-sequencer-relayer/src/relayer/builder.rs @@ -4,7 +4,7 @@ use std::{ time::Duration, }; -use astria_core::generated::sequencerblock::v1::sequencer_service_client::SequencerServiceClient; +use astria_core::generated::astria::sequencerblock::v1::sequencer_service_client::SequencerServiceClient; use astria_eyre::eyre::{ self, WrapErr as _, diff --git a/crates/astria-sequencer-relayer/src/relayer/mod.rs b/crates/astria-sequencer-relayer/src/relayer/mod.rs index 54c613ee81..e4e58e0cb7 100644 --- a/crates/astria-sequencer-relayer/src/relayer/mod.rs +++ b/crates/astria-sequencer-relayer/src/relayer/mod.rs @@ -5,7 +5,7 @@ use std::{ }; use astria_core::{ - generated::sequencerblock::v1::sequencer_service_client::SequencerServiceClient, + generated::astria::sequencerblock::v1::sequencer_service_client::SequencerServiceClient, sequencerblock::v1::SequencerBlock, }; use astria_eyre::eyre::{ diff --git a/crates/astria-sequencer-relayer/src/relayer/read.rs b/crates/astria-sequencer-relayer/src/relayer/read.rs index 58147fdfd2..6525f3e528 100644 --- a/crates/astria-sequencer-relayer/src/relayer/read.rs +++ b/crates/astria-sequencer-relayer/src/relayer/read.rs @@ -8,7 +8,7 @@ use std::{ }; use astria_core::{ - generated::sequencerblock::v1::{ + generated::astria::sequencerblock::v1::{ sequencer_service_client::SequencerServiceClient, GetSequencerBlockRequest, }, diff --git a/crates/astria-sequencer-relayer/src/relayer/write/conversion.rs b/crates/astria-sequencer-relayer/src/relayer/write/conversion.rs index 38733634d2..82d425ff89 100644 --- a/crates/astria-sequencer-relayer/src/relayer/write/conversion.rs +++ b/crates/astria-sequencer-relayer/src/relayer/write/conversion.rs @@ -10,7 +10,7 @@ use std::{ use astria_core::{ brotli::compress_bytes, - generated::sequencerblock::v1::{ + generated::astria::sequencerblock::v1::{ SubmittedMetadata, SubmittedMetadataList, SubmittedRollupData, diff --git a/crates/astria-sequencer-relayer/tests/blackbox/helpers/mock_sequencer_server.rs b/crates/astria-sequencer-relayer/tests/blackbox/helpers/mock_sequencer_server.rs index 82534b292a..33ff34d989 100644 --- a/crates/astria-sequencer-relayer/tests/blackbox/helpers/mock_sequencer_server.rs +++ b/crates/astria-sequencer-relayer/tests/blackbox/helpers/mock_sequencer_server.rs @@ -4,7 +4,7 @@ use std::{ }; use astria_core::{ - generated::sequencerblock::v1::{ + generated::astria::sequencerblock::v1::{ sequencer_service_server::{ SequencerService, SequencerServiceServer, diff --git a/crates/astria-sequencer-utils/src/blob_parser.rs b/crates/astria-sequencer-utils/src/blob_parser.rs index c729751c96..6fb450ff90 100644 --- a/crates/astria-sequencer-utils/src/blob_parser.rs +++ b/crates/astria-sequencer-utils/src/blob_parser.rs @@ -13,7 +13,7 @@ use std::{ use astria_core::{ brotli::decompress_bytes, - generated::sequencerblock::v1::{ + generated::astria::sequencerblock::v1::{ rollup_data::Value as RawRollupDataValue, Deposit as RawDeposit, RollupData as RawRollupData, diff --git a/crates/astria-sequencer-utils/src/genesis_example.rs b/crates/astria-sequencer-utils/src/genesis_example.rs index a464fd26c2..6d7d277719 100644 --- a/crates/astria-sequencer-utils/src/genesis_example.rs +++ b/crates/astria-sequencer-utils/src/genesis_example.rs @@ -5,7 +5,7 @@ use std::{ }; use astria_core::{ - generated::protocol::genesis::v1::{ + generated::astria::protocol::genesis::v1::{ AddressPrefixes, GenesisFees, IbcParameters, @@ -91,8 +91,8 @@ fn address_prefixes() -> AddressPrefixes { } #[expect(clippy::too_many_lines, reason = "all lines reasonably necessary")] -fn proto_genesis_state() -> astria_core::generated::protocol::genesis::v1::GenesisAppState { - astria_core::generated::protocol::genesis::v1::GenesisAppState { +fn proto_genesis_state() -> astria_core::generated::astria::protocol::genesis::v1::GenesisAppState { + astria_core::generated::astria::protocol::genesis::v1::GenesisAppState { accounts: accounts().into_iter().map(Protobuf::into_raw).collect(), address_prefixes: Some(address_prefixes()), authority_sudo_address: Some(alice().to_raw()), diff --git a/crates/astria-sequencer/src/app/benchmark_and_test_utils.rs b/crates/astria-sequencer/src/app/benchmark_and_test_utils.rs index 6c46e5c6e9..e2852fd225 100644 --- a/crates/astria-sequencer/src/app/benchmark_and_test_utils.rs +++ b/crates/astria-sequencer/src/app/benchmark_and_test_utils.rs @@ -60,7 +60,7 @@ pub(crate) const TED_ADDRESS: &str = "4c4f91d8a918357ab5f6f19c1e179968fc39bb44"; pub(crate) fn address_prefixes() -> AddressPrefixes { AddressPrefixes::try_from_raw( - astria_core::generated::protocol::genesis::v1::AddressPrefixes { + astria_core::generated::astria::protocol::genesis::v1::AddressPrefixes { base: crate::benchmark_and_test_utils::ASTRIA_PREFIX.into(), ibc_compat: crate::benchmark_and_test_utils::ASTRIA_COMPAT_PREFIX.into(), }, @@ -129,9 +129,9 @@ pub(crate) fn default_fees() -> astria_core::protocol::genesis::v1::GenesisFees } } -pub(crate) fn proto_genesis_state() -> astria_core::generated::protocol::genesis::v1::GenesisAppState -{ - use astria_core::generated::protocol::genesis::v1::{ +pub(crate) fn proto_genesis_state() +-> astria_core::generated::astria::protocol::genesis::v1::GenesisAppState { + use astria_core::generated::astria::protocol::genesis::v1::{ GenesisAppState, IbcParameters, }; diff --git a/crates/astria-sequencer/src/app/benchmarks.rs b/crates/astria-sequencer/src/app/benchmarks.rs index 0b6aa3ef2b..390f650de1 100644 --- a/crates/astria-sequencer/src/app/benchmarks.rs +++ b/crates/astria-sequencer/src/app/benchmarks.rs @@ -61,7 +61,7 @@ impl Fixture { .collect::>(); let first_address = accounts.first().cloned().unwrap().address; let genesis_state = GenesisAppState::try_from_raw( - astria_core::generated::protocol::genesis::v1::GenesisAppState { + astria_core::generated::astria::protocol::genesis::v1::GenesisAppState { accounts, authority_sudo_address: first_address.clone(), ibc_sudo_address: first_address.clone(), diff --git a/crates/astria-sequencer/src/app/mod.rs b/crates/astria-sequencer/src/app/mod.rs index e116664a79..d2e0ca7b48 100644 --- a/crates/astria-sequencer/src/app/mod.rs +++ b/crates/astria-sequencer/src/app/mod.rs @@ -22,7 +22,7 @@ use std::{ }; use astria_core::{ - generated::protocol::transaction::v1 as raw, + generated::astria::protocol::transaction::v1 as raw, protocol::{ abci::AbciErrorCode, genesis::v1::GenesisAppState, diff --git a/crates/astria-sequencer/src/app/tests_app/mod.rs b/crates/astria-sequencer/src/app/tests_app/mod.rs index 1ca46cec4d..b91e107105 100644 --- a/crates/astria-sequencer/src/app/tests_app/mod.rs +++ b/crates/astria-sequencer/src/app/tests_app/mod.rs @@ -302,7 +302,7 @@ async fn app_transfer_block_fees_to_sudo() { #[tokio::test] async fn app_create_sequencer_block_with_sequenced_data_and_deposits() { use astria_core::{ - generated::sequencerblock::v1::RollupData as RawRollupData, + generated::astria::sequencerblock::v1::RollupData as RawRollupData, sequencerblock::v1::block::RollupData, }; diff --git a/crates/astria-sequencer/src/app/tests_breaking_changes.rs b/crates/astria-sequencer/src/app/tests_breaking_changes.rs index 031538a057..6a7d922e1c 100644 --- a/crates/astria-sequencer/src/app/tests_breaking_changes.rs +++ b/crates/astria-sequencer/src/app/tests_breaking_changes.rs @@ -188,7 +188,7 @@ async fn app_execute_transaction_with_every_action_snapshot() { }); acc.into_iter().map(Protobuf::into_raw).collect() }; - let genesis_state = astria_core::generated::protocol::genesis::v1::GenesisAppState { + let genesis_state = astria_core::generated::astria::protocol::genesis::v1::GenesisAppState { accounts, authority_sudo_address: Some(alice.try_address(ASTRIA_PREFIX).unwrap().to_raw()), ibc_sudo_address: Some(alice.try_address(ASTRIA_PREFIX).unwrap().to_raw()), diff --git a/crates/astria-sequencer/src/app/tests_execute_transaction.rs b/crates/astria-sequencer/src/app/tests_execute_transaction.rs index 76b1a1ae8e..ecc7111601 100644 --- a/crates/astria-sequencer/src/app/tests_execute_transaction.rs +++ b/crates/astria-sequencer/src/app/tests_execute_transaction.rs @@ -75,8 +75,8 @@ use crate::{ utils::create_deposit_event, }; -fn proto_genesis_state() -> astria_core::generated::protocol::genesis::v1::GenesisAppState { - astria_core::generated::protocol::genesis::v1::GenesisAppState { +fn proto_genesis_state() -> astria_core::generated::astria::protocol::genesis::v1::GenesisAppState { + astria_core::generated::astria::protocol::genesis::v1::GenesisAppState { authority_sudo_address: Some( get_alice_signing_key() .try_address(ASTRIA_PREFIX) diff --git a/crates/astria-sequencer/src/bridge/query.rs b/crates/astria-sequencer/src/bridge/query.rs index 2e3ff25ba2..ed5d1c5177 100644 --- a/crates/astria-sequencer/src/bridge/query.rs +++ b/crates/astria-sequencer/src/bridge/query.rs @@ -293,7 +293,7 @@ fn preprocess_request(params: &[(String, String)]) -> Result) -> (Consensus, Mempool) { let accounts = if let Some(funded_key) = funded_key { - vec![astria_core::generated::protocol::genesis::v1::Account { - address: Some( - crate::benchmark_and_test_utils::astria_address(funded_key.address_bytes()) - .to_raw(), - ), - balance: Some(10u128.pow(19).into()), - }] + vec![ + astria_core::generated::astria::protocol::genesis::v1::Account { + address: Some( + crate::benchmark_and_test_utils::astria_address(funded_key.address_bytes()) + .to_raw(), + ), + balance: Some(10u128.pow(19).into()), + }, + ] } else { vec![] }; diff --git a/crates/astria-sequencer/src/service/info/mod.rs b/crates/astria-sequencer/src/service/info/mod.rs index 23b863aebc..a233359274 100644 --- a/crates/astria-sequencer/src/service/info/mod.rs +++ b/crates/astria-sequencer/src/service/info/mod.rs @@ -212,7 +212,7 @@ mod tests { #[tokio::test] async fn handle_balance_query() { use astria_core::{ - generated::protocol::accounts::v1 as raw, + generated::astria::protocol::accounts::v1 as raw, protocol::account::v1::AssetBalance, }; @@ -279,7 +279,7 @@ mod tests { #[tokio::test] async fn handle_denom_query() { - use astria_core::generated::protocol::asset::v1 as raw; + use astria_core::generated::astria::protocol::asset::v1 as raw; let storage = cnidarium::TempStorage::new().await.unwrap(); let mut state = StateDelta::new(storage.latest_snapshot()); @@ -323,7 +323,7 @@ mod tests { #[tokio::test] async fn handle_allowed_fee_assets_query() { - use astria_core::generated::protocol::asset::v1 as raw; + use astria_core::generated::astria::protocol::asset::v1 as raw; let storage = cnidarium::TempStorage::new().await.unwrap(); let mut state = StateDelta::new(storage.latest_snapshot()); diff --git a/crates/astria-sequencer/src/service/mempool/mod.rs b/crates/astria-sequencer/src/service/mempool/mod.rs index 88b59a5b77..67cfa9a48d 100644 --- a/crates/astria-sequencer/src/service/mempool/mod.rs +++ b/crates/astria-sequencer/src/service/mempool/mod.rs @@ -10,7 +10,7 @@ use std::{ }; use astria_core::{ - generated::protocol::transaction::v1 as raw, + generated::astria::protocol::transaction::v1 as raw, primitive::v1::asset::IbcPrefixed, protocol::{ abci::AbciErrorCode, diff --git a/tools/protobuf-compiler/CHANGELOG.md b/tools/protobuf-compiler/CHANGELOG.md new file mode 100644 index 0000000000..a017ade42d --- /dev/null +++ b/tools/protobuf-compiler/CHANGELOG.md @@ -0,0 +1,15 @@ + + +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## Unreleased + +### Added + +- Clears target directory before generating new code. + [#1825](https://github.com/astriaorg/astria/pull/1825) diff --git a/tools/protobuf-compiler/src/main.rs b/tools/protobuf-compiler/src/main.rs index 1034672e90..20cf898353 100644 --- a/tools/protobuf-compiler/src/main.rs +++ b/tools/protobuf-compiler/src/main.rs @@ -1,3 +1,8 @@ +//! Generates Rust code of protobuf specs located in proto/ and writes +//! the result to crates/astria-core/src/generated. +//! +//! This tool will delete everything in crates/astria-core/src/generated (except +//! mod.rs). use std::{ collections::{ HashMap, @@ -59,23 +64,16 @@ fn main() { let files = find_protos(src_dir); + purge_out_dir(&out_dir); + tonic_build::configure() .build_client(true) .build_server(true) .emit_rerun_if_changed(false) - .bytes([ - ".astria", - ".celestia", - ".cosmos", - ".tendermint", - ]) + .bytes([".astria", ".celestia", ".cosmos", ".tendermint"]) .client_mod_attribute(".", "#[cfg(feature=\"client\")]") .server_mod_attribute(".", "#[cfg(feature=\"server\")]") .extern_path(".astria_vendored.penumbra", "::penumbra-proto") - .extern_path( - ".astria_vendored.tendermint.abci.ValidatorUpdate", - "crate::generated::astria_vendored::tendermint::abci::ValidatorUpdate", - ) .type_attribute(".astria.primitive.v1.Uint128", "#[derive(Copy)]") .type_attribute( ".astria.protocol.genesis.v1.IbcParameters", @@ -206,7 +204,8 @@ fn get_buf_from_env() -> PathBuf { "linux" => "You can download it from https://github.com/bufbuild/buf/releases; if you are on Arch Linux, install it from the AUR with `rua install buf` or another helper", _other => "Check if there is a precompiled version for your OS at https://github.com/bufbuild/buf/releases" }; - let error_msg = "Could not find `buf` installation and this build crate cannot proceed without + let error_msg = "Could not find `buf` installation and this build crate cannot proceed \ + without this knowledge. If `buf` is installed and this crate had trouble finding it, you can set the `BUF` environment variable with the specific path to your installed `buf` binary."; @@ -217,3 +216,25 @@ fn get_buf_from_env() -> PathBuf { .or_else(|| which::which("buf").ok()) .expect(&msg) } + +fn purge_out_dir(path: impl AsRef) { + for entry in read_dir(path) + .expect("should be able to read target folder for generated files") + .flatten() + { + // skip mod.rs as it's assumed to be the only non-generated file in the out dir. + if entry + .path() + .file_name() + .expect("every entry in the generated file out dir should have a name") + == "mod.rs" + { + continue; + } + + std::fs::remove_file(entry.path()).expect( + "all entries in the out dir should be generated files, and the out dir is expected to \ + have read, write, execute permissions set", + ); + } +}