From 4c5479e61444ba3868f2880bca23f658996efd8b Mon Sep 17 00:00:00 2001 From: pls148 <184445976+pls148@users.noreply.github.com> Date: Thu, 27 Feb 2025 22:12:43 -0800 Subject: [PATCH] Pull in nightly rust-fmt, use vid rustfmt --- builder/src/bin/permissionless-builder.rs | 4 +- builder/src/lib.rs | 8 +- builder/src/non_permissioned.rs | 3 +- client/src/lib.rs | 2 +- contract-bindings-alloy/src/erc1967proxy.rs | 38 +- contract-bindings-alloy/src/feecontract.rs | 252 +++++++------- contract-bindings-alloy/src/iplonkverifier.rs | 14 +- contract-bindings-alloy/src/lightclient.rs | 296 ++++++++-------- .../src/lightclientarbitrum.rs | 294 ++++++++-------- .../src/lightclientmock.rs | 328 +++++++++--------- .../src/permissionedstaketable.rs | 142 ++++---- contract-bindings-alloy/src/plonkverifier.rs | 36 +- contract-bindings-alloy/src/plonkverifier2.rs | 38 +- contract-bindings-ethers/src/erc1967_proxy.rs | 12 +- contract-bindings-ethers/src/fee_contract.rs | 52 +-- contract-bindings-ethers/src/light_client.rs | 64 ++-- .../src/light_client_arbitrum.rs | 64 ++-- .../src/light_client_mock.rs | 66 ++-- .../src/permissioned_stake_table.rs | 22 +- .../src/plonk_verifier.rs | 4 +- contracts/rust/adapter/src/jellyfish.rs | 10 +- contracts/rust/adapter/src/light_client.rs | 4 +- contracts/rust/diff-test/src/main.rs | 61 ++-- flake.nix | 5 +- hotshot-builder-api/src/api.rs | 2 +- .../src/block_store.rs | 5 +- .../src/service.rs | 69 ++-- .../src/testing/basic.rs | 44 ++- .../src/testing/block_size.rs | 32 +- .../src/testing/finalization.rs | 15 +- .../src/testing/integration.rs | 3 +- .../src/testing/mod.rs | 36 +- hotshot-builder-core/src/builder_state.rs | 47 ++- hotshot-builder-core/src/service.rs | 288 +++++++-------- .../src/testing/basic_test.rs | 46 +-- .../src/testing/finalization_test.rs | 21 +- hotshot-builder-core/src/testing/mod.rs | 8 +- hotshot-events-service/src/api.rs | 2 +- hotshot-events-service/src/events_source.rs | 2 +- hotshot-events-service/src/test.rs | 6 +- hotshot-example-types/src/block_types.rs | 3 +- hotshot-example-types/src/testable_delay.rs | 8 +- hotshot-examples/infra/mod.rs | 22 +- hotshot-fakeapi/src/fake_solver.rs | 4 +- .../src/network/behaviours/dht/bootstrap.rs | 16 +- .../src/network/behaviours/dht/mod.rs | 40 +-- .../behaviours/dht/store/persistent.rs | 8 +- .../src/network/behaviours/direct_message.rs | 10 +- hotshot-libp2p-networking/src/network/cbor.rs | 10 +- hotshot-libp2p-networking/src/network/node.rs | 80 ++--- .../src/network/transport.rs | 4 +- hotshot-macros/src/lib.rs | 8 +- hotshot-orchestrator/src/client.rs | 2 +- hotshot-query-service/src/api.rs | 5 +- hotshot-query-service/src/availability.rs | 12 +- .../src/availability/query_data.rs | 3 +- hotshot-query-service/src/data_source.rs | 16 +- .../src/data_source/extension.rs | 2 +- .../src/data_source/fetching.rs | 53 ++- .../src/data_source/fetching/header.rs | 31 +- .../src/data_source/fetching/leaf.rs | 21 +- .../src/data_source/fetching/vid.rs | 3 +- .../src/data_source/metrics.rs | 3 +- .../src/data_source/notifier.rs | 12 +- .../src/data_source/storage/fail_storage.rs | 7 +- .../src/data_source/storage/fs.rs | 28 +- .../src/data_source/storage/ledger_log.rs | 3 +- .../src/data_source/storage/sql.rs | 9 +- .../src/data_source/storage/sql/queries.rs | 12 +- .../storage/sql/queries/availability.rs | 5 +- .../storage/sql/queries/explorer.rs | 14 +- .../data_source/storage/sql/queries/node.rs | 12 +- .../data_source/storage/sql/queries/state.rs | 31 +- .../data_source/storage/sql/transaction.rs | 19 +- .../src/data_source/update.rs | 13 +- hotshot-query-service/src/explorer.rs | 18 +- .../src/explorer/currency.rs | 3 +- hotshot-query-service/src/explorer/errors.rs | 5 +- .../src/explorer/monetary_value.rs | 13 +- .../src/explorer/query_data.rs | 5 +- hotshot-query-service/src/fetching.rs | 7 +- .../src/fetching/provider/any.rs | 5 +- .../src/fetching/provider/query_service.rs | 28 +- .../src/fetching/provider/testing.rs | 6 +- hotshot-query-service/src/fetching/request.rs | 3 +- hotshot-query-service/src/lib.rs | 9 +- hotshot-query-service/src/metrics.rs | 6 +- hotshot-query-service/src/status.rs | 7 +- hotshot-query-service/src/task.rs | 3 +- .../src/testing/consensus.rs | 5 +- hotshot-query-service/src/testing/mocks.rs | 7 +- hotshot-stake-table/src/mt_based.rs | 8 +- hotshot-stake-table/src/mt_based/internal.rs | 18 +- hotshot-stake-table/src/vec_based.rs | 4 +- hotshot-stake-table/src/vec_based/config.rs | 2 +- hotshot-state-prover/src/circuit.rs | 6 +- hotshot-state-prover/src/service.rs | 25 +- hotshot-task-impls/src/builder.rs | 4 +- hotshot-task-impls/src/consensus/mod.rs | 21 +- hotshot-task-impls/src/da.rs | 12 +- hotshot-task-impls/src/events.rs | 115 +++--- hotshot-task-impls/src/helpers.rs | 8 +- hotshot-task-impls/src/network.rs | 150 ++++---- .../src/quorum_proposal/handlers.rs | 12 +- hotshot-task-impls/src/quorum_proposal/mod.rs | 54 +-- .../src/quorum_proposal_recv/handlers.rs | 2 +- .../src/quorum_proposal_recv/mod.rs | 8 +- .../src/quorum_vote/handlers.rs | 10 +- hotshot-task-impls/src/quorum_vote/mod.rs | 28 +- hotshot-task-impls/src/request.rs | 4 +- hotshot-task-impls/src/response.rs | 12 +- hotshot-task-impls/src/rewind.rs | 2 +- hotshot-task-impls/src/transactions.rs | 45 ++- hotshot-task-impls/src/upgrade.rs | 8 +- hotshot-task-impls/src/vid.rs | 10 +- hotshot-task-impls/src/view_sync.rs | 36 +- hotshot-task-impls/src/vote_collection.rs | 20 +- hotshot-task/src/dependency.rs | 6 +- hotshot-task/src/task.rs | 6 +- hotshot-testing/src/block_builder/mod.rs | 12 +- hotshot-testing/src/block_builder/random.rs | 10 +- hotshot-testing/src/block_builder/simple.rs | 16 +- .../src/byzantine/byzantine_behaviour.rs | 20 +- hotshot-testing/src/consistency_task.rs | 12 +- hotshot-testing/src/predicates/event.rs | 2 +- hotshot-testing/src/script.rs | 2 +- hotshot-testing/src/spinning_task.rs | 16 +- hotshot-testing/src/test_builder.rs | 6 +- hotshot-testing/src/test_runner.rs | 10 +- hotshot-testing/src/test_task.rs | 10 +- hotshot-testing/src/txn_task.rs | 4 +- hotshot-testing/src/view_generator.rs | 2 +- hotshot-testing/src/view_sync_task.rs | 12 +- .../tests/tests_1/quorum_proposal_task.rs | 4 +- .../tests/tests_1/transaction_task.rs | 4 +- hotshot-testing/tests/tests_6/test_epochs.rs | 2 +- hotshot-types/src/consensus.rs | 2 +- hotshot-types/src/data.rs | 24 +- hotshot-types/src/lib.rs | 4 +- hotshot-types/src/message.rs | 68 ++-- hotshot-types/src/network.rs | 4 +- hotshot-types/src/simple_vote.rs | 3 +- hotshot-types/src/traits/storage.rs | 7 +- hotshot-types/src/vote.rs | 2 +- hotshot-utils/src/anytrace.rs | 26 +- hotshot-utils/src/anytrace/macros.rs | 12 +- hotshot/src/lib.rs | 8 +- hotshot/src/tasks/mod.rs | 6 +- .../src/traits/networking/combined_network.rs | 8 +- .../src/traits/networking/libp2p_network.rs | 20 +- .../src/traits/networking/memory_network.rs | 10 +- .../src/traits/networking/push_cdn_network.rs | 2 +- hotshot/src/types/handle.rs | 6 +- marketplace-builder-core/src/service.rs | 29 +- .../src/testing/basic_test.rs | 9 +- .../src/testing/integration.rs | 3 +- .../src/testing/order_test.rs | 8 +- marketplace-builder-shared/src/block.rs | 9 +- .../src/coordinator/mod.rs | 14 +- .../src/coordinator/tiered_view_map.rs | 4 +- marketplace-builder-shared/src/error.rs | 6 +- marketplace-builder-shared/src/state.rs | 6 +- .../src/testing/consensus.rs | 11 +- .../src/testing/generation.rs | 14 +- .../src/testing/mock.rs | 36 +- .../src/utils/event_service_wrapper.rs | 22 +- .../src/bin/marketplace-builder.rs | 4 +- marketplace-builder/src/builder.rs | 35 +- marketplace-builder/src/hooks.rs | 23 +- marketplace-solver/src/api.rs | 2 +- marketplace-solver/src/database.rs | 2 +- marketplace-solver/src/events.rs | 5 +- marketplace-solver/src/testing.rs | 12 +- .../src/api/node_validator/v0/cdn/mod.rs | 44 +-- .../v0/create_node_validator_api.rs | 26 +- node-metrics/src/api/node_validator/v0/mod.rs | 61 ++-- node-metrics/src/lib.rs | 8 +- node-metrics/src/service/client_id/mod.rs | 6 +- .../src/service/client_message/mod.rs | 5 +- node-metrics/src/service/client_state/mod.rs | 38 +- node-metrics/src/service/data_state/mod.rs | 18 +- .../src/service/data_state/node_identity.rs | 6 +- request-response/src/lib.rs | 10 +- request-response/src/message.rs | 14 +- rust-toolchain.toml | 2 +- vid/rustfmt.toml => rustfmt.toml | 4 +- sequencer/src/api.rs | 36 +- sequencer/src/api/data_source.rs | 13 +- sequencer/src/api/endpoints.rs | 7 +- sequencer/src/api/sql.rs | 10 +- sequencer/src/api/update.rs | 3 +- sequencer/src/bin/cdn-whitelist.rs | 6 +- sequencer/src/bin/espresso-bridge.rs | 2 +- sequencer/src/bin/keygen.rs | 6 +- sequencer/src/bin/nasty-client.rs | 34 +- sequencer/src/bin/pub-key.rs | 6 +- sequencer/src/bin/reset-storage.rs | 4 +- sequencer/src/bin/submit-transactions.rs | 2 +- sequencer/src/bin/utils/keygen.rs | 6 +- sequencer/src/bin/utils/main.rs | 2 +- sequencer/src/bin/utils/pubkey.rs | 15 +- sequencer/src/bin/utils/reset_storage.rs | 6 +- sequencer/src/bin/verify-headers.rs | 6 +- sequencer/src/catchup.rs | 17 +- sequencer/src/context.rs | 6 +- sequencer/src/external_event_handler.rs | 11 +- sequencer/src/genesis.rs | 22 +- sequencer/src/lib.rs | 38 +- sequencer/src/options.rs | 14 +- sequencer/src/persistence.rs | 6 +- sequencer/src/persistence/fs.rs | 8 +- sequencer/src/persistence/no_storage.rs | 3 +- sequencer/src/persistence/sql.rs | 23 +- sequencer/src/proposal_fetcher.rs | 4 +- sequencer/src/restart_tests.rs | 7 +- sequencer/src/run.rs | 10 +- sequencer/src/state.rs | 7 +- sequencer/src/state_signature.rs | 4 +- sequencer/src/state_signature/relay_server.rs | 6 +- types/src/eth_signature_key.rs | 3 +- .../v0/impls/block/full_payload/ns_proof.rs | 10 +- .../impls/block/full_payload/ns_proof/test.rs | 3 +- .../v0/impls/block/full_payload/payload.rs | 7 +- .../impls/block/namespace_payload/tx_proof.rs | 8 +- types/src/v0/impls/fee_info.rs | 14 +- types/src/v0/impls/header.rs | 6 +- types/src/v0/impls/instance_state.rs | 7 +- types/src/v0/impls/l1.rs | 12 +- types/src/v0/impls/solver.rs | 2 +- types/src/v0/impls/state.rs | 4 +- types/src/v0/traits.rs | 14 +- types/src/v0/utils.rs | 4 +- utils/src/lib.rs | 20 +- utils/src/stake_table.rs | 6 +- 234 files changed, 2518 insertions(+), 2544 deletions(-) rename vid/rustfmt.toml => rustfmt.toml (73%) diff --git a/builder/src/bin/permissionless-builder.rs b/builder/src/bin/permissionless-builder.rs index 1ff329399e..4df79fb223 100644 --- a/builder/src/bin/permissionless-builder.rs +++ b/builder/src/bin/permissionless-builder.rs @@ -122,11 +122,11 @@ async fn main() -> anyhow::Result<()> { match (base, upgrade) { (FeeVersion::VERSION, MarketplaceVersion::VERSION) => { run::>(genesis, opt).await - } + }, (FeeVersion::VERSION, _) => run::>(genesis, opt).await, (MarketplaceVersion::VERSION, _) => { run::>(genesis, opt).await - } + }, _ => panic!( "Invalid base ({base}) and upgrade ({upgrade}) versions specified in the toml file." ), diff --git a/builder/src/lib.rs b/builder/src/lib.rs index 534773df39..d3ea28dba3 100755 --- a/builder/src/lib.rs +++ b/builder/src/lib.rs @@ -413,10 +413,10 @@ pub mod testing { { Ok(response) => { tracing::info!("Received txn submitted response : {:?}", response); - } + }, Err(e) => { panic!("Error submitting private transaction {:?}", e); - } + }, } let seed = [207_u8; 32]; @@ -513,10 +513,10 @@ pub mod testing { Ok(response) => { tracing::info!("Received Builder Key : {:?}", response); assert_eq!(response, builder_pub_key); - } + }, Err(e) => { panic!("Error getting builder key {:?}", e); - } + }, } } } diff --git a/builder/src/non_permissioned.rs b/builder/src/non_permissioned.rs index fd8d3bada1..e17c726109 100644 --- a/builder/src/non_permissioned.rs +++ b/builder/src/non_permissioned.rs @@ -22,8 +22,7 @@ use hotshot_types::{ node_implementation::Versions, EncodeBytes, }, }; -use marketplace_builder_shared::block::ParentBlockReferences; -use marketplace_builder_shared::utils::EventServiceStream; +use marketplace_builder_shared::{block::ParentBlockReferences, utils::EventServiceStream}; use sequencer::{catchup::StatePeers, L1Params, SequencerApiVersion}; use std::sync::Arc; use tide_disco::Url; diff --git a/client/src/lib.rs b/client/src/lib.rs index a9d5cc995f..54b589dcdc 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -110,7 +110,7 @@ impl SequencerClient { } else { sleep(Duration::from_millis(200)).await; } - } + }, } }; diff --git a/contract-bindings-alloy/src/erc1967proxy.rs b/contract-bindings-alloy/src/erc1967proxy.rs index 2f9998b31e..b6531e512e 100644 --- a/contract-bindings-alloy/src/erc1967proxy.rs +++ b/contract-bindings-alloy/src/erc1967proxy.rs @@ -143,7 +143,7 @@ pub mod ERC1967Proxy { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -209,7 +209,7 @@ pub mod ERC1967Proxy { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -275,7 +275,7 @@ pub mod ERC1967Proxy { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -335,7 +335,7 @@ pub mod ERC1967Proxy { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -501,7 +501,7 @@ pub mod ERC1967Proxy { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -580,16 +580,16 @@ pub mod ERC1967Proxy { match self { Self::AddressEmptyCode(_) => { ::SELECTOR - } + }, Self::ERC1967InvalidImplementation(_) => { ::SELECTOR - } + }, Self::ERC1967NonPayable(_) => { ::SELECTOR - } + }, Self::FailedInnerCall(_) => { ::SELECTOR - } + }, } } #[inline] @@ -674,18 +674,18 @@ pub mod ERC1967Proxy { match self { Self::AddressEmptyCode(inner) => { ::abi_encoded_size(inner) - } + }, Self::ERC1967InvalidImplementation(inner) => { ::abi_encoded_size( inner, ) - } + }, Self::ERC1967NonPayable(inner) => { ::abi_encoded_size(inner) - } + }, Self::FailedInnerCall(inner) => { ::abi_encoded_size(inner) - } + }, } } #[inline] @@ -693,18 +693,18 @@ pub mod ERC1967Proxy { match self { Self::AddressEmptyCode(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::ERC1967InvalidImplementation(inner) => { ::abi_encode_raw( inner, out, ) - } + }, Self::ERC1967NonPayable(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::FailedInnerCall(inner) => { ::abi_encode_raw(inner, out) - } + }, } } } @@ -739,7 +739,7 @@ pub mod ERC1967Proxy { Some(::SIGNATURE_HASH) => { ::decode_raw_log(topics, data, validate) .map(Self::Upgraded) - } + }, _ => alloy_sol_types::private::Err(alloy_sol_types::Error::InvalidLog { name: ::NAME, log: alloy_sol_types::private::Box::new( @@ -763,7 +763,7 @@ pub mod ERC1967Proxy { match self { Self::Upgraded(inner) => { alloy_sol_types::private::IntoLogData::into_log_data(inner) - } + }, } } } diff --git a/contract-bindings-alloy/src/feecontract.rs b/contract-bindings-alloy/src/feecontract.rs index 0eedfa5680..8fb181188b 100644 --- a/contract-bindings-alloy/src/feecontract.rs +++ b/contract-bindings-alloy/src/feecontract.rs @@ -494,7 +494,7 @@ pub mod FeeContract { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -558,7 +558,7 @@ pub mod FeeContract { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -618,7 +618,7 @@ pub mod FeeContract { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -680,7 +680,7 @@ pub mod FeeContract { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -746,7 +746,7 @@ pub mod FeeContract { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -806,7 +806,7 @@ pub mod FeeContract { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -866,7 +866,7 @@ pub mod FeeContract { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -926,7 +926,7 @@ pub mod FeeContract { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -986,7 +986,7 @@ pub mod FeeContract { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -1046,7 +1046,7 @@ pub mod FeeContract { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -1106,7 +1106,7 @@ pub mod FeeContract { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -1168,7 +1168,7 @@ pub mod FeeContract { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -1234,7 +1234,7 @@ pub mod FeeContract { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -1298,7 +1298,7 @@ pub mod FeeContract { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -1360,7 +1360,7 @@ pub mod FeeContract { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2050,7 +2050,7 @@ pub mod FeeContract { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2116,7 +2116,7 @@ pub mod FeeContract { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2145,7 +2145,7 @@ pub mod FeeContract { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2228,7 +2228,7 @@ pub mod FeeContract { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2257,7 +2257,7 @@ pub mod FeeContract { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2342,7 +2342,7 @@ pub mod FeeContract { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2371,7 +2371,7 @@ pub mod FeeContract { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2458,7 +2458,7 @@ pub mod FeeContract { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2491,7 +2491,7 @@ pub mod FeeContract { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2580,7 +2580,7 @@ pub mod FeeContract { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2609,7 +2609,7 @@ pub mod FeeContract { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2694,7 +2694,7 @@ pub mod FeeContract { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2723,7 +2723,7 @@ pub mod FeeContract { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2804,7 +2804,7 @@ pub mod FeeContract { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2833,7 +2833,7 @@ pub mod FeeContract { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2914,7 +2914,7 @@ pub mod FeeContract { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2943,7 +2943,7 @@ pub mod FeeContract { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3024,7 +3024,7 @@ pub mod FeeContract { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3053,7 +3053,7 @@ pub mod FeeContract { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3132,7 +3132,7 @@ pub mod FeeContract { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3161,7 +3161,7 @@ pub mod FeeContract { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3242,7 +3242,7 @@ pub mod FeeContract { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3271,7 +3271,7 @@ pub mod FeeContract { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3363,7 +3363,7 @@ pub mod FeeContract { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3395,7 +3395,7 @@ pub mod FeeContract { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3502,28 +3502,28 @@ pub mod FeeContract { match self { Self::UPGRADE_INTERFACE_VERSION(_) => { ::SELECTOR - } + }, Self::balances(_) => ::SELECTOR, Self::deposit(_) => ::SELECTOR, Self::getVersion(_) => ::SELECTOR, Self::initialize(_) => ::SELECTOR, Self::maxDepositAmount(_) => { ::SELECTOR - } + }, Self::minDepositAmount(_) => { ::SELECTOR - } + }, Self::owner(_) => ::SELECTOR, Self::proxiableUUID(_) => ::SELECTOR, Self::renounceOwnership(_) => { ::SELECTOR - } + }, Self::transferOwnership(_) => { ::SELECTOR - } + }, Self::upgradeToAndCall(_) => { ::SELECTOR - } + }, } } #[inline] @@ -3702,40 +3702,40 @@ pub mod FeeContract { ::abi_encoded_size( inner, ) - } + }, Self::balances(inner) => { ::abi_encoded_size(inner) - } + }, Self::deposit(inner) => { ::abi_encoded_size(inner) - } + }, Self::getVersion(inner) => { ::abi_encoded_size(inner) - } + }, Self::initialize(inner) => { ::abi_encoded_size(inner) - } + }, Self::maxDepositAmount(inner) => { ::abi_encoded_size(inner) - } + }, Self::minDepositAmount(inner) => { ::abi_encoded_size(inner) - } + }, Self::owner(inner) => { ::abi_encoded_size(inner) - } + }, Self::proxiableUUID(inner) => { ::abi_encoded_size(inner) - } + }, Self::renounceOwnership(inner) => { ::abi_encoded_size(inner) - } + }, Self::transferOwnership(inner) => { ::abi_encoded_size(inner) - } + }, Self::upgradeToAndCall(inner) => { ::abi_encoded_size(inner) - } + }, } } #[inline] @@ -3745,40 +3745,40 @@ pub mod FeeContract { ::abi_encode_raw( inner, out, ) - } + }, Self::balances(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::deposit(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::getVersion(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::initialize(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::maxDepositAmount(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::minDepositAmount(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::owner(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::proxiableUUID(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::renounceOwnership(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::transferOwnership(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::upgradeToAndCall(inner) => { ::abi_encode_raw(inner, out) - } + }, } } } @@ -3836,49 +3836,49 @@ pub mod FeeContract { match self { Self::AddressEmptyCode(_) => { ::SELECTOR - } + }, Self::DepositTooLarge(_) => { ::SELECTOR - } + }, Self::DepositTooSmall(_) => { ::SELECTOR - } + }, Self::ERC1967InvalidImplementation(_) => { ::SELECTOR - } + }, Self::ERC1967NonPayable(_) => { ::SELECTOR - } + }, Self::FailedInnerCall(_) => { ::SELECTOR - } + }, Self::FunctionDoesNotExist(_) => { ::SELECTOR - } + }, Self::InvalidInitialization(_) => { ::SELECTOR - } + }, Self::InvalidUserAddress(_) => { ::SELECTOR - } + }, Self::NoFunctionCalled(_) => { ::SELECTOR - } + }, Self::NotInitializing(_) => { ::SELECTOR - } + }, Self::OwnableInvalidOwner(_) => { ::SELECTOR - } + }, Self::OwnableUnauthorizedAccount(_) => { ::SELECTOR - } + }, Self::UUPSUnauthorizedCallContext(_) => { ::SELECTOR - } + }, Self::UUPSUnsupportedProxiableUUID(_) => { ::SELECTOR - } + }, } } #[inline] @@ -4095,57 +4095,57 @@ pub mod FeeContract { match self { Self::AddressEmptyCode(inner) => { ::abi_encoded_size(inner) - } + }, Self::DepositTooLarge(inner) => { ::abi_encoded_size(inner) - } + }, Self::DepositTooSmall(inner) => { ::abi_encoded_size(inner) - } + }, Self::ERC1967InvalidImplementation(inner) => { ::abi_encoded_size( inner, ) - } + }, Self::ERC1967NonPayable(inner) => { ::abi_encoded_size(inner) - } + }, Self::FailedInnerCall(inner) => { ::abi_encoded_size(inner) - } + }, Self::FunctionDoesNotExist(inner) => { ::abi_encoded_size(inner) - } + }, Self::InvalidInitialization(inner) => { ::abi_encoded_size(inner) - } + }, Self::InvalidUserAddress(inner) => { ::abi_encoded_size(inner) - } + }, Self::NoFunctionCalled(inner) => { ::abi_encoded_size(inner) - } + }, Self::NotInitializing(inner) => { ::abi_encoded_size(inner) - } + }, Self::OwnableInvalidOwner(inner) => { ::abi_encoded_size(inner) - } + }, Self::OwnableUnauthorizedAccount(inner) => { ::abi_encoded_size( inner, ) - } + }, Self::UUPSUnauthorizedCallContext(inner) => { ::abi_encoded_size( inner, ) - } + }, Self::UUPSUnsupportedProxiableUUID(inner) => { ::abi_encoded_size( inner, ) - } + }, } } #[inline] @@ -4153,57 +4153,57 @@ pub mod FeeContract { match self { Self::AddressEmptyCode(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::DepositTooLarge(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::DepositTooSmall(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::ERC1967InvalidImplementation(inner) => { ::abi_encode_raw( inner, out, ) - } + }, Self::ERC1967NonPayable(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::FailedInnerCall(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::FunctionDoesNotExist(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::InvalidInitialization(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::InvalidUserAddress(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::NoFunctionCalled(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::NotInitializing(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::OwnableInvalidOwner(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::OwnableUnauthorizedAccount(inner) => { ::abi_encode_raw( inner, out, ) - } + }, Self::UUPSUnauthorizedCallContext(inner) => { ::abi_encode_raw( inner, out, ) - } + }, Self::UUPSUnsupportedProxiableUUID(inner) => { ::abi_encode_raw( inner, out, ) - } + }, } } } @@ -4270,31 +4270,31 @@ pub mod FeeContract { Some(::SIGNATURE_HASH) => { ::decode_raw_log(topics, data, validate) .map(Self::Deposit) - } + }, Some(::SIGNATURE_HASH) => { ::decode_raw_log( topics, data, validate, ) .map(Self::Initialized) - } + }, Some(::SIGNATURE_HASH) => { ::decode_raw_log(topics, data, validate) .map(Self::Log) - } + }, Some(::SIGNATURE_HASH) => { ::decode_raw_log( topics, data, validate, ) .map(Self::OwnershipTransferred) - } + }, Some(::SIGNATURE_HASH) => { ::decode_raw_log(topics, data, validate) .map(Self::Upgrade) - } + }, Some(::SIGNATURE_HASH) => { ::decode_raw_log(topics, data, validate) .map(Self::Upgraded) - } + }, _ => alloy_sol_types::private::Err(alloy_sol_types::Error::InvalidLog { name: ::NAME, log: alloy_sol_types::private::Box::new( @@ -4314,11 +4314,11 @@ pub mod FeeContract { Self::Deposit(inner) => alloy_sol_types::private::IntoLogData::to_log_data(inner), Self::Initialized(inner) => { alloy_sol_types::private::IntoLogData::to_log_data(inner) - } + }, Self::Log(inner) => alloy_sol_types::private::IntoLogData::to_log_data(inner), Self::OwnershipTransferred(inner) => { alloy_sol_types::private::IntoLogData::to_log_data(inner) - } + }, Self::Upgrade(inner) => alloy_sol_types::private::IntoLogData::to_log_data(inner), Self::Upgraded(inner) => alloy_sol_types::private::IntoLogData::to_log_data(inner), } @@ -4328,15 +4328,15 @@ pub mod FeeContract { Self::Deposit(inner) => alloy_sol_types::private::IntoLogData::into_log_data(inner), Self::Initialized(inner) => { alloy_sol_types::private::IntoLogData::into_log_data(inner) - } + }, Self::Log(inner) => alloy_sol_types::private::IntoLogData::into_log_data(inner), Self::OwnershipTransferred(inner) => { alloy_sol_types::private::IntoLogData::into_log_data(inner) - } + }, Self::Upgrade(inner) => alloy_sol_types::private::IntoLogData::into_log_data(inner), Self::Upgraded(inner) => { alloy_sol_types::private::IntoLogData::into_log_data(inner) - } + }, } } } diff --git a/contract-bindings-alloy/src/iplonkverifier.rs b/contract-bindings-alloy/src/iplonkverifier.rs index d4af84cd19..6bb2d8068c 100644 --- a/contract-bindings-alloy/src/iplonkverifier.rs +++ b/contract-bindings-alloy/src/iplonkverifier.rs @@ -280,7 +280,7 @@ pub mod BN254 { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -1373,7 +1373,7 @@ pub mod IPlonkVerifier { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -1917,7 +1917,7 @@ pub mod IPlonkVerifier { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2459,7 +2459,7 @@ pub mod IPlonkVerifier { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2492,7 +2492,7 @@ pub mod IPlonkVerifier { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2622,7 +2622,7 @@ pub mod IPlonkVerifier { match self { Self::verify(inner) => { ::abi_encoded_size(inner) - } + }, } } #[inline] @@ -2630,7 +2630,7 @@ pub mod IPlonkVerifier { match self { Self::verify(inner) => { ::abi_encode_raw(inner, out) - } + }, } } } diff --git a/contract-bindings-alloy/src/lightclient.rs b/contract-bindings-alloy/src/lightclient.rs index a2e27b0672..9594063b1e 100644 --- a/contract-bindings-alloy/src/lightclient.rs +++ b/contract-bindings-alloy/src/lightclient.rs @@ -280,7 +280,7 @@ pub mod BN254 { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -658,7 +658,7 @@ pub mod IPlonkVerifier { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2401,7 +2401,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2619,7 +2619,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2839,7 +2839,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2905,7 +2905,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2971,7 +2971,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3031,7 +3031,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3091,7 +3091,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3151,7 +3151,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3211,7 +3211,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3271,7 +3271,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3331,7 +3331,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3391,7 +3391,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3451,7 +3451,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3511,7 +3511,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3571,7 +3571,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3631,7 +3631,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3693,7 +3693,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3759,7 +3759,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3823,7 +3823,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3883,7 +3883,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3945,7 +3945,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -4009,7 +4009,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -4786,7 +4786,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -4852,7 +4852,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -4881,7 +4881,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -4962,7 +4962,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -4991,7 +4991,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5070,7 +5070,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5099,7 +5099,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5182,7 +5182,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5219,7 +5219,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5311,7 +5311,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5350,7 +5350,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5448,7 +5448,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5485,7 +5485,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5577,7 +5577,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5612,7 +5612,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5700,7 +5700,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5729,7 +5729,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5812,7 +5812,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5845,7 +5845,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5947,7 +5947,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5986,7 +5986,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6083,7 +6083,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6112,7 +6112,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6202,7 +6202,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6234,7 +6234,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6329,7 +6329,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6361,7 +6361,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6445,7 +6445,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6474,7 +6474,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6555,7 +6555,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6584,7 +6584,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6665,7 +6665,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6694,7 +6694,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6773,7 +6773,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6802,7 +6802,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6883,7 +6883,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6912,7 +6912,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6997,7 +6997,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7028,7 +7028,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7118,7 +7118,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7157,7 +7157,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7257,7 +7257,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7286,7 +7286,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7367,7 +7367,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7396,7 +7396,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7477,7 +7477,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7506,7 +7506,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7598,7 +7598,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7630,7 +7630,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7761,66 +7761,66 @@ pub mod LightClient { match self { Self::UPGRADE_INTERFACE_VERSION(_) => { ::SELECTOR - } + }, Self::currentBlockNumber(_) => { ::SELECTOR - } + }, Self::disablePermissionedProverMode(_) => { ::SELECTOR - } + }, Self::finalizedState(_) => { ::SELECTOR - } + }, Self::genesisStakeTableState(_) => { ::SELECTOR - } + }, Self::genesisState(_) => ::SELECTOR, Self::getHotShotCommitment(_) => { ::SELECTOR - } + }, Self::getStateHistoryCount(_) => { ::SELECTOR - } + }, Self::getVersion(_) => ::SELECTOR, Self::initialize(_) => ::SELECTOR, Self::isPermissionedProverEnabled(_) => { ::SELECTOR - } + }, Self::lagOverEscapeHatchThreshold(_) => { ::SELECTOR - } + }, Self::newFinalizedState(_) => { ::SELECTOR - } + }, Self::owner(_) => ::SELECTOR, Self::permissionedProver(_) => { ::SELECTOR - } + }, Self::proxiableUUID(_) => ::SELECTOR, Self::renounceOwnership(_) => { ::SELECTOR - } + }, Self::setPermissionedProver(_) => { ::SELECTOR - } + }, Self::setstateHistoryRetentionPeriod(_) => { ::SELECTOR - } + }, Self::stateHistoryCommitments(_) => { ::SELECTOR - } + }, Self::stateHistoryFirstIndex(_) => { ::SELECTOR - } + }, Self::stateHistoryRetentionPeriod(_) => { ::SELECTOR - } + }, Self::transferOwnership(_) => { ::SELECTOR - } + }, Self::upgradeToAndCall(_) => { ::SELECTOR - } + }, } } #[inline] @@ -8270,98 +8270,98 @@ pub mod LightClient { ::abi_encode_raw( inner, out, ) - } + }, Self::currentBlockNumber(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::disablePermissionedProverMode(inner) => { ::abi_encode_raw( inner, out, ) - } + }, Self::finalizedState(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::genesisStakeTableState(inner) => { ::abi_encode_raw( inner, out, ) - } + }, Self::genesisState(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::getHotShotCommitment(inner) => { ::abi_encode_raw( inner, out, ) - } + }, Self::getStateHistoryCount(inner) => { ::abi_encode_raw( inner, out, ) - } + }, Self::getVersion(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::initialize(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::isPermissionedProverEnabled(inner) => { ::abi_encode_raw( inner, out, ) - } + }, Self::lagOverEscapeHatchThreshold(inner) => { ::abi_encode_raw( inner, out, ) - } + }, Self::newFinalizedState(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::owner(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::permissionedProver(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::proxiableUUID(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::renounceOwnership(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::setPermissionedProver(inner) => { ::abi_encode_raw( inner, out, ) - } + }, Self::setstateHistoryRetentionPeriod(inner) => { ::abi_encode_raw( inner, out, ) - } + }, Self::stateHistoryCommitments(inner) => { ::abi_encode_raw( inner, out, ) - } + }, Self::stateHistoryFirstIndex(inner) => { ::abi_encode_raw( inner, out, ) - } + }, Self::stateHistoryRetentionPeriod(inner) => { ::abi_encode_raw( inner, out, ) - } + }, Self::transferOwnership(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::upgradeToAndCall(inner) => { ::abi_encode_raw(inner, out) - } + }, } } } @@ -8429,56 +8429,56 @@ pub mod LightClient { match self { Self::AddressEmptyCode(_) => { ::SELECTOR - } + }, Self::ERC1967InvalidImplementation(_) => { ::SELECTOR - } + }, Self::ERC1967NonPayable(_) => { ::SELECTOR - } + }, Self::FailedInnerCall(_) => { ::SELECTOR - } + }, Self::InsufficientSnapshotHistory(_) => { ::SELECTOR - } + }, Self::InvalidAddress(_) => ::SELECTOR, Self::InvalidArgs(_) => ::SELECTOR, Self::InvalidHotShotBlockForCommitmentCheck(_) => { ::SELECTOR - } + }, Self::InvalidInitialization(_) => { ::SELECTOR - } + }, Self::InvalidMaxStateHistory(_) => { ::SELECTOR - } + }, Self::InvalidProof(_) => ::SELECTOR, Self::NoChangeRequired(_) => { ::SELECTOR - } + }, Self::NotInitializing(_) => { ::SELECTOR - } + }, Self::OutdatedState(_) => ::SELECTOR, Self::OwnableInvalidOwner(_) => { ::SELECTOR - } + }, Self::OwnableUnauthorizedAccount(_) => { ::SELECTOR - } + }, Self::ProverNotPermissioned(_) => { ::SELECTOR - } + }, Self::UUPSUnauthorizedCallContext(_) => { ::SELECTOR - } + }, Self::UUPSUnsupportedProxiableUUID(_) => { ::SELECTOR - } + }, Self::WrongStakeTableUsed(_) => { ::SELECTOR - } + }, } } #[inline] @@ -9043,17 +9043,17 @@ pub mod LightClient { topics, data, validate, ) .map(Self::Initialized) - } + }, Some(::SIGNATURE_HASH) => { ::decode_raw_log(topics, data, validate) .map(Self::NewState) - } + }, Some(::SIGNATURE_HASH) => { ::decode_raw_log( topics, data, validate, ) .map(Self::OwnershipTransferred) - } + }, Some( ::SIGNATURE_HASH, ) => ::decode_raw_log( @@ -9065,15 +9065,15 @@ pub mod LightClient { topics, data, validate, ) .map(Self::PermissionedProverRequired) - } + }, Some(::SIGNATURE_HASH) => { ::decode_raw_log(topics, data, validate) .map(Self::Upgrade) - } + }, Some(::SIGNATURE_HASH) => { ::decode_raw_log(topics, data, validate) .map(Self::Upgraded) - } + }, _ => alloy_sol_types::private::Err(alloy_sol_types::Error::InvalidLog { name: ::NAME, log: alloy_sol_types::private::Box::new( @@ -9092,17 +9092,17 @@ pub mod LightClient { match self { Self::Initialized(inner) => { alloy_sol_types::private::IntoLogData::to_log_data(inner) - } + }, Self::NewState(inner) => alloy_sol_types::private::IntoLogData::to_log_data(inner), Self::OwnershipTransferred(inner) => { alloy_sol_types::private::IntoLogData::to_log_data(inner) - } + }, Self::PermissionedProverNotRequired(inner) => { alloy_sol_types::private::IntoLogData::to_log_data(inner) - } + }, Self::PermissionedProverRequired(inner) => { alloy_sol_types::private::IntoLogData::to_log_data(inner) - } + }, Self::Upgrade(inner) => alloy_sol_types::private::IntoLogData::to_log_data(inner), Self::Upgraded(inner) => alloy_sol_types::private::IntoLogData::to_log_data(inner), } @@ -9111,23 +9111,23 @@ pub mod LightClient { match self { Self::Initialized(inner) => { alloy_sol_types::private::IntoLogData::into_log_data(inner) - } + }, Self::NewState(inner) => { alloy_sol_types::private::IntoLogData::into_log_data(inner) - } + }, Self::OwnershipTransferred(inner) => { alloy_sol_types::private::IntoLogData::into_log_data(inner) - } + }, Self::PermissionedProverNotRequired(inner) => { alloy_sol_types::private::IntoLogData::into_log_data(inner) - } + }, Self::PermissionedProverRequired(inner) => { alloy_sol_types::private::IntoLogData::into_log_data(inner) - } + }, Self::Upgrade(inner) => alloy_sol_types::private::IntoLogData::into_log_data(inner), Self::Upgraded(inner) => { alloy_sol_types::private::IntoLogData::into_log_data(inner) - } + }, } } } diff --git a/contract-bindings-alloy/src/lightclientarbitrum.rs b/contract-bindings-alloy/src/lightclientarbitrum.rs index 1edab7451d..b679250de0 100644 --- a/contract-bindings-alloy/src/lightclientarbitrum.rs +++ b/contract-bindings-alloy/src/lightclientarbitrum.rs @@ -280,7 +280,7 @@ pub mod BN254 { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -658,7 +658,7 @@ pub mod IPlonkVerifier { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -1294,7 +1294,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -1512,7 +1512,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2983,7 +2983,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3049,7 +3049,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3115,7 +3115,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3175,7 +3175,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3235,7 +3235,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3295,7 +3295,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3355,7 +3355,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3415,7 +3415,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3475,7 +3475,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3535,7 +3535,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3595,7 +3595,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3655,7 +3655,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3715,7 +3715,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3775,7 +3775,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3837,7 +3837,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3903,7 +3903,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3967,7 +3967,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -4027,7 +4027,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -4089,7 +4089,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -4153,7 +4153,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -4942,7 +4942,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -4971,7 +4971,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5052,7 +5052,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5081,7 +5081,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5160,7 +5160,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5189,7 +5189,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5272,7 +5272,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5309,7 +5309,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5401,7 +5401,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5440,7 +5440,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5538,7 +5538,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5575,7 +5575,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5667,7 +5667,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5702,7 +5702,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5790,7 +5790,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5819,7 +5819,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5902,7 +5902,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5935,7 +5935,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6038,7 +6038,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6077,7 +6077,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6176,7 +6176,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6205,7 +6205,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6295,7 +6295,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6327,7 +6327,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6423,7 +6423,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6455,7 +6455,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6541,7 +6541,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6570,7 +6570,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6651,7 +6651,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6680,7 +6680,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6761,7 +6761,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6790,7 +6790,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6869,7 +6869,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6898,7 +6898,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6979,7 +6979,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7008,7 +7008,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7093,7 +7093,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7124,7 +7124,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7214,7 +7214,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7253,7 +7253,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7353,7 +7353,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7382,7 +7382,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7463,7 +7463,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7492,7 +7492,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7573,7 +7573,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7602,7 +7602,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7694,7 +7694,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7726,7 +7726,7 @@ pub mod LightClientArbitrum { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7857,66 +7857,66 @@ pub mod LightClientArbitrum { match self { Self::UPGRADE_INTERFACE_VERSION(_) => { ::SELECTOR - } + }, Self::currentBlockNumber(_) => { ::SELECTOR - } + }, Self::disablePermissionedProverMode(_) => { ::SELECTOR - } + }, Self::finalizedState(_) => { ::SELECTOR - } + }, Self::genesisStakeTableState(_) => { ::SELECTOR - } + }, Self::genesisState(_) => ::SELECTOR, Self::getHotShotCommitment(_) => { ::SELECTOR - } + }, Self::getStateHistoryCount(_) => { ::SELECTOR - } + }, Self::getVersion(_) => ::SELECTOR, Self::initialize(_) => ::SELECTOR, Self::isPermissionedProverEnabled(_) => { ::SELECTOR - } + }, Self::lagOverEscapeHatchThreshold(_) => { ::SELECTOR - } + }, Self::newFinalizedState(_) => { ::SELECTOR - } + }, Self::owner(_) => ::SELECTOR, Self::permissionedProver(_) => { ::SELECTOR - } + }, Self::proxiableUUID(_) => ::SELECTOR, Self::renounceOwnership(_) => { ::SELECTOR - } + }, Self::setPermissionedProver(_) => { ::SELECTOR - } + }, Self::setstateHistoryRetentionPeriod(_) => { ::SELECTOR - } + }, Self::stateHistoryCommitments(_) => { ::SELECTOR - } + }, Self::stateHistoryFirstIndex(_) => { ::SELECTOR - } + }, Self::stateHistoryRetentionPeriod(_) => { ::SELECTOR - } + }, Self::transferOwnership(_) => { ::SELECTOR - } + }, Self::upgradeToAndCall(_) => { ::SELECTOR - } + }, } } #[inline] @@ -8363,98 +8363,98 @@ pub mod LightClientArbitrum { ::abi_encode_raw( inner, out, ) - } + }, Self::currentBlockNumber(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::disablePermissionedProverMode(inner) => { ::abi_encode_raw( inner, out, ) - } + }, Self::finalizedState(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::genesisStakeTableState(inner) => { ::abi_encode_raw( inner, out, ) - } + }, Self::genesisState(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::getHotShotCommitment(inner) => { ::abi_encode_raw( inner, out, ) - } + }, Self::getStateHistoryCount(inner) => { ::abi_encode_raw( inner, out, ) - } + }, Self::getVersion(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::initialize(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::isPermissionedProverEnabled(inner) => { ::abi_encode_raw( inner, out, ) - } + }, Self::lagOverEscapeHatchThreshold(inner) => { ::abi_encode_raw( inner, out, ) - } + }, Self::newFinalizedState(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::owner(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::permissionedProver(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::proxiableUUID(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::renounceOwnership(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::setPermissionedProver(inner) => { ::abi_encode_raw( inner, out, ) - } + }, Self::setstateHistoryRetentionPeriod(inner) => { ::abi_encode_raw( inner, out, ) - } + }, Self::stateHistoryCommitments(inner) => { ::abi_encode_raw( inner, out, ) - } + }, Self::stateHistoryFirstIndex(inner) => { ::abi_encode_raw( inner, out, ) - } + }, Self::stateHistoryRetentionPeriod(inner) => { ::abi_encode_raw( inner, out, ) - } + }, Self::transferOwnership(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::upgradeToAndCall(inner) => { ::abi_encode_raw(inner, out) - } + }, } } } @@ -8522,56 +8522,56 @@ pub mod LightClientArbitrum { match self { Self::AddressEmptyCode(_) => { ::SELECTOR - } + }, Self::ERC1967InvalidImplementation(_) => { ::SELECTOR - } + }, Self::ERC1967NonPayable(_) => { ::SELECTOR - } + }, Self::FailedInnerCall(_) => { ::SELECTOR - } + }, Self::InsufficientSnapshotHistory(_) => { ::SELECTOR - } + }, Self::InvalidAddress(_) => ::SELECTOR, Self::InvalidArgs(_) => ::SELECTOR, Self::InvalidHotShotBlockForCommitmentCheck(_) => { ::SELECTOR - } + }, Self::InvalidInitialization(_) => { ::SELECTOR - } + }, Self::InvalidMaxStateHistory(_) => { ::SELECTOR - } + }, Self::InvalidProof(_) => ::SELECTOR, Self::NoChangeRequired(_) => { ::SELECTOR - } + }, Self::NotInitializing(_) => { ::SELECTOR - } + }, Self::OutdatedState(_) => ::SELECTOR, Self::OwnableInvalidOwner(_) => { ::SELECTOR - } + }, Self::OwnableUnauthorizedAccount(_) => { ::SELECTOR - } + }, Self::ProverNotPermissioned(_) => { ::SELECTOR - } + }, Self::UUPSUnauthorizedCallContext(_) => { ::SELECTOR - } + }, Self::UUPSUnsupportedProxiableUUID(_) => { ::SELECTOR - } + }, Self::WrongStakeTableUsed(_) => { ::SELECTOR - } + }, } } #[inline] @@ -9136,17 +9136,17 @@ pub mod LightClientArbitrum { topics, data, validate, ) .map(Self::Initialized) - } + }, Some(::SIGNATURE_HASH) => { ::decode_raw_log(topics, data, validate) .map(Self::NewState) - } + }, Some(::SIGNATURE_HASH) => { ::decode_raw_log( topics, data, validate, ) .map(Self::OwnershipTransferred) - } + }, Some( ::SIGNATURE_HASH, ) => ::decode_raw_log( @@ -9158,15 +9158,15 @@ pub mod LightClientArbitrum { topics, data, validate, ) .map(Self::PermissionedProverRequired) - } + }, Some(::SIGNATURE_HASH) => { ::decode_raw_log(topics, data, validate) .map(Self::Upgrade) - } + }, Some(::SIGNATURE_HASH) => { ::decode_raw_log(topics, data, validate) .map(Self::Upgraded) - } + }, _ => alloy_sol_types::private::Err(alloy_sol_types::Error::InvalidLog { name: ::NAME, log: alloy_sol_types::private::Box::new( @@ -9185,17 +9185,17 @@ pub mod LightClientArbitrum { match self { Self::Initialized(inner) => { alloy_sol_types::private::IntoLogData::to_log_data(inner) - } + }, Self::NewState(inner) => alloy_sol_types::private::IntoLogData::to_log_data(inner), Self::OwnershipTransferred(inner) => { alloy_sol_types::private::IntoLogData::to_log_data(inner) - } + }, Self::PermissionedProverNotRequired(inner) => { alloy_sol_types::private::IntoLogData::to_log_data(inner) - } + }, Self::PermissionedProverRequired(inner) => { alloy_sol_types::private::IntoLogData::to_log_data(inner) - } + }, Self::Upgrade(inner) => alloy_sol_types::private::IntoLogData::to_log_data(inner), Self::Upgraded(inner) => alloy_sol_types::private::IntoLogData::to_log_data(inner), } @@ -9204,23 +9204,23 @@ pub mod LightClientArbitrum { match self { Self::Initialized(inner) => { alloy_sol_types::private::IntoLogData::into_log_data(inner) - } + }, Self::NewState(inner) => { alloy_sol_types::private::IntoLogData::into_log_data(inner) - } + }, Self::OwnershipTransferred(inner) => { alloy_sol_types::private::IntoLogData::into_log_data(inner) - } + }, Self::PermissionedProverNotRequired(inner) => { alloy_sol_types::private::IntoLogData::into_log_data(inner) - } + }, Self::PermissionedProverRequired(inner) => { alloy_sol_types::private::IntoLogData::into_log_data(inner) - } + }, Self::Upgrade(inner) => alloy_sol_types::private::IntoLogData::into_log_data(inner), Self::Upgraded(inner) => { alloy_sol_types::private::IntoLogData::into_log_data(inner) - } + }, } } } diff --git a/contract-bindings-alloy/src/lightclientmock.rs b/contract-bindings-alloy/src/lightclientmock.rs index 6d30b708d7..3aebe92346 100644 --- a/contract-bindings-alloy/src/lightclientmock.rs +++ b/contract-bindings-alloy/src/lightclientmock.rs @@ -280,7 +280,7 @@ pub mod BN254 { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -658,7 +658,7 @@ pub mod IPlonkVerifier { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -1295,7 +1295,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -1513,7 +1513,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -1745,7 +1745,7 @@ pub mod LightClient { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3389,7 +3389,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3455,7 +3455,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3521,7 +3521,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3581,7 +3581,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3641,7 +3641,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3701,7 +3701,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3761,7 +3761,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3821,7 +3821,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3881,7 +3881,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3941,7 +3941,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -4001,7 +4001,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -4061,7 +4061,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -4121,7 +4121,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -4181,7 +4181,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -4243,7 +4243,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -4309,7 +4309,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -4373,7 +4373,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -4433,7 +4433,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -4495,7 +4495,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -4559,7 +4559,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5349,7 +5349,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5437,7 +5437,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5466,7 +5466,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5547,7 +5547,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5576,7 +5576,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5655,7 +5655,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5684,7 +5684,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5767,7 +5767,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5804,7 +5804,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5896,7 +5896,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -5935,7 +5935,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6033,7 +6033,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6070,7 +6070,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6162,7 +6162,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6197,7 +6197,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6285,7 +6285,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6314,7 +6314,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6397,7 +6397,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6430,7 +6430,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6533,7 +6533,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6572,7 +6572,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6671,7 +6671,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6700,7 +6700,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6790,7 +6790,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6822,7 +6822,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6918,7 +6918,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -6950,7 +6950,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7036,7 +7036,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7065,7 +7065,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7146,7 +7146,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7175,7 +7175,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7256,7 +7256,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7285,7 +7285,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7364,7 +7364,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7393,7 +7393,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7475,7 +7475,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7504,7 +7504,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7589,7 +7589,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7618,7 +7618,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7701,7 +7701,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7730,7 +7730,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7811,7 +7811,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7840,7 +7840,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7932,7 +7932,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -7963,7 +7963,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -8049,7 +8049,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -8080,7 +8080,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -8170,7 +8170,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -8209,7 +8209,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -8309,7 +8309,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -8338,7 +8338,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -8419,7 +8419,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -8448,7 +8448,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -8529,7 +8529,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -8558,7 +8558,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -8650,7 +8650,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -8682,7 +8682,7 @@ pub mod LightClientMock { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -8821,76 +8821,76 @@ pub mod LightClientMock { match self { Self::UPGRADE_INTERFACE_VERSION(_) => { ::SELECTOR - } + }, Self::currentBlockNumber(_) => { ::SELECTOR - } + }, Self::disablePermissionedProverMode(_) => { ::SELECTOR - } + }, Self::finalizedState(_) => { ::SELECTOR - } + }, Self::genesisStakeTableState(_) => { ::SELECTOR - } + }, Self::genesisState(_) => ::SELECTOR, Self::getHotShotCommitment(_) => { ::SELECTOR - } + }, Self::getStateHistoryCount(_) => { ::SELECTOR - } + }, Self::getVersion(_) => ::SELECTOR, Self::initialize(_) => ::SELECTOR, Self::isPermissionedProverEnabled(_) => { ::SELECTOR - } + }, Self::lagOverEscapeHatchThreshold(_) => { ::SELECTOR - } + }, Self::newFinalizedState(_) => { ::SELECTOR - } + }, Self::owner(_) => ::SELECTOR, Self::permissionedProver(_) => { ::SELECTOR - } + }, Self::proxiableUUID(_) => ::SELECTOR, Self::renounceOwnership(_) => { ::SELECTOR - } + }, Self::setFinalizedState(_) => { ::SELECTOR - } + }, Self::setHotShotDownSince(_) => { ::SELECTOR - } + }, Self::setHotShotUp(_) => ::SELECTOR, Self::setPermissionedProver(_) => { ::SELECTOR - } + }, Self::setStateHistory(_) => { ::SELECTOR - } + }, Self::setstateHistoryRetentionPeriod(_) => { ::SELECTOR - } + }, Self::stateHistoryCommitments(_) => { ::SELECTOR - } + }, Self::stateHistoryFirstIndex(_) => { ::SELECTOR - } + }, Self::stateHistoryRetentionPeriod(_) => { ::SELECTOR - } + }, Self::transferOwnership(_) => { ::SELECTOR - } + }, Self::upgradeToAndCall(_) => { ::SELECTOR - } + }, } } #[inline] @@ -9403,112 +9403,112 @@ pub mod LightClientMock { ::abi_encode_raw( inner, out, ) - } + }, Self::currentBlockNumber(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::disablePermissionedProverMode(inner) => { ::abi_encode_raw( inner, out, ) - } + }, Self::finalizedState(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::genesisStakeTableState(inner) => { ::abi_encode_raw( inner, out, ) - } + }, Self::genesisState(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::getHotShotCommitment(inner) => { ::abi_encode_raw( inner, out, ) - } + }, Self::getStateHistoryCount(inner) => { ::abi_encode_raw( inner, out, ) - } + }, Self::getVersion(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::initialize(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::isPermissionedProverEnabled(inner) => { ::abi_encode_raw( inner, out, ) - } + }, Self::lagOverEscapeHatchThreshold(inner) => { ::abi_encode_raw( inner, out, ) - } + }, Self::newFinalizedState(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::owner(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::permissionedProver(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::proxiableUUID(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::renounceOwnership(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::setFinalizedState(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::setHotShotDownSince(inner) => { ::abi_encode_raw( inner, out, ) - } + }, Self::setHotShotUp(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::setPermissionedProver(inner) => { ::abi_encode_raw( inner, out, ) - } + }, Self::setStateHistory(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::setstateHistoryRetentionPeriod(inner) => { ::abi_encode_raw( inner, out, ) - } + }, Self::stateHistoryCommitments(inner) => { ::abi_encode_raw( inner, out, ) - } + }, Self::stateHistoryFirstIndex(inner) => { ::abi_encode_raw( inner, out, ) - } + }, Self::stateHistoryRetentionPeriod(inner) => { ::abi_encode_raw( inner, out, ) - } + }, Self::transferOwnership(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::upgradeToAndCall(inner) => { ::abi_encode_raw(inner, out) - } + }, } } } @@ -9576,56 +9576,56 @@ pub mod LightClientMock { match self { Self::AddressEmptyCode(_) => { ::SELECTOR - } + }, Self::ERC1967InvalidImplementation(_) => { ::SELECTOR - } + }, Self::ERC1967NonPayable(_) => { ::SELECTOR - } + }, Self::FailedInnerCall(_) => { ::SELECTOR - } + }, Self::InsufficientSnapshotHistory(_) => { ::SELECTOR - } + }, Self::InvalidAddress(_) => ::SELECTOR, Self::InvalidArgs(_) => ::SELECTOR, Self::InvalidHotShotBlockForCommitmentCheck(_) => { ::SELECTOR - } + }, Self::InvalidInitialization(_) => { ::SELECTOR - } + }, Self::InvalidMaxStateHistory(_) => { ::SELECTOR - } + }, Self::InvalidProof(_) => ::SELECTOR, Self::NoChangeRequired(_) => { ::SELECTOR - } + }, Self::NotInitializing(_) => { ::SELECTOR - } + }, Self::OutdatedState(_) => ::SELECTOR, Self::OwnableInvalidOwner(_) => { ::SELECTOR - } + }, Self::OwnableUnauthorizedAccount(_) => { ::SELECTOR - } + }, Self::ProverNotPermissioned(_) => { ::SELECTOR - } + }, Self::UUPSUnauthorizedCallContext(_) => { ::SELECTOR - } + }, Self::UUPSUnsupportedProxiableUUID(_) => { ::SELECTOR - } + }, Self::WrongStakeTableUsed(_) => { ::SELECTOR - } + }, } } #[inline] @@ -10190,17 +10190,17 @@ pub mod LightClientMock { topics, data, validate, ) .map(Self::Initialized) - } + }, Some(::SIGNATURE_HASH) => { ::decode_raw_log(topics, data, validate) .map(Self::NewState) - } + }, Some(::SIGNATURE_HASH) => { ::decode_raw_log( topics, data, validate, ) .map(Self::OwnershipTransferred) - } + }, Some( ::SIGNATURE_HASH, ) => ::decode_raw_log( @@ -10212,15 +10212,15 @@ pub mod LightClientMock { topics, data, validate, ) .map(Self::PermissionedProverRequired) - } + }, Some(::SIGNATURE_HASH) => { ::decode_raw_log(topics, data, validate) .map(Self::Upgrade) - } + }, Some(::SIGNATURE_HASH) => { ::decode_raw_log(topics, data, validate) .map(Self::Upgraded) - } + }, _ => alloy_sol_types::private::Err(alloy_sol_types::Error::InvalidLog { name: ::NAME, log: alloy_sol_types::private::Box::new( @@ -10239,17 +10239,17 @@ pub mod LightClientMock { match self { Self::Initialized(inner) => { alloy_sol_types::private::IntoLogData::to_log_data(inner) - } + }, Self::NewState(inner) => alloy_sol_types::private::IntoLogData::to_log_data(inner), Self::OwnershipTransferred(inner) => { alloy_sol_types::private::IntoLogData::to_log_data(inner) - } + }, Self::PermissionedProverNotRequired(inner) => { alloy_sol_types::private::IntoLogData::to_log_data(inner) - } + }, Self::PermissionedProverRequired(inner) => { alloy_sol_types::private::IntoLogData::to_log_data(inner) - } + }, Self::Upgrade(inner) => alloy_sol_types::private::IntoLogData::to_log_data(inner), Self::Upgraded(inner) => alloy_sol_types::private::IntoLogData::to_log_data(inner), } @@ -10258,23 +10258,23 @@ pub mod LightClientMock { match self { Self::Initialized(inner) => { alloy_sol_types::private::IntoLogData::into_log_data(inner) - } + }, Self::NewState(inner) => { alloy_sol_types::private::IntoLogData::into_log_data(inner) - } + }, Self::OwnershipTransferred(inner) => { alloy_sol_types::private::IntoLogData::into_log_data(inner) - } + }, Self::PermissionedProverNotRequired(inner) => { alloy_sol_types::private::IntoLogData::into_log_data(inner) - } + }, Self::PermissionedProverRequired(inner) => { alloy_sol_types::private::IntoLogData::into_log_data(inner) - } + }, Self::Upgrade(inner) => alloy_sol_types::private::IntoLogData::into_log_data(inner), Self::Upgraded(inner) => { alloy_sol_types::private::IntoLogData::into_log_data(inner) - } + }, } } } diff --git a/contract-bindings-alloy/src/permissionedstaketable.rs b/contract-bindings-alloy/src/permissionedstaketable.rs index fd58dff88e..790313b4c5 100644 --- a/contract-bindings-alloy/src/permissionedstaketable.rs +++ b/contract-bindings-alloy/src/permissionedstaketable.rs @@ -167,7 +167,7 @@ pub mod BN254 { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -494,7 +494,7 @@ pub mod EdOnBN254 { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -1411,7 +1411,7 @@ pub mod PermissionedStakeTable { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -1613,7 +1613,7 @@ pub mod PermissionedStakeTable { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -1673,7 +1673,7 @@ pub mod PermissionedStakeTable { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -1735,7 +1735,7 @@ pub mod PermissionedStakeTable { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -1801,7 +1801,7 @@ pub mod PermissionedStakeTable { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -1867,7 +1867,7 @@ pub mod PermissionedStakeTable { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -1932,7 +1932,7 @@ pub mod PermissionedStakeTable { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2316,7 +2316,7 @@ pub mod PermissionedStakeTable { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2391,7 +2391,7 @@ pub mod PermissionedStakeTable { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2420,7 +2420,7 @@ pub mod PermissionedStakeTable { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2501,7 +2501,7 @@ pub mod PermissionedStakeTable { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2530,7 +2530,7 @@ pub mod PermissionedStakeTable { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2611,7 +2611,7 @@ pub mod PermissionedStakeTable { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2640,7 +2640,7 @@ pub mod PermissionedStakeTable { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2724,7 +2724,7 @@ pub mod PermissionedStakeTable { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2753,7 +2753,7 @@ pub mod PermissionedStakeTable { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2836,7 +2836,7 @@ pub mod PermissionedStakeTable { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2865,7 +2865,7 @@ pub mod PermissionedStakeTable { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2944,7 +2944,7 @@ pub mod PermissionedStakeTable { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2973,7 +2973,7 @@ pub mod PermissionedStakeTable { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3054,7 +3054,7 @@ pub mod PermissionedStakeTable { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3083,7 +3083,7 @@ pub mod PermissionedStakeTable { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3179,7 +3179,7 @@ pub mod PermissionedStakeTable { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3211,7 +3211,7 @@ pub mod PermissionedStakeTable { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3312,15 +3312,15 @@ pub mod PermissionedStakeTable { Self::initialize(_) => ::SELECTOR, Self::initializedAtBlock(_) => { ::SELECTOR - } + }, Self::isStaker(_) => ::SELECTOR, Self::owner(_) => ::SELECTOR, Self::renounceOwnership(_) => { ::SELECTOR - } + }, Self::transferOwnership(_) => { ::SELECTOR - } + }, Self::update(_) => ::SELECTOR, } } @@ -3446,28 +3446,28 @@ pub mod PermissionedStakeTable { match self { Self::_hashBlsKey(inner) => { <_hashBlsKeyCall as alloy_sol_types::SolCall>::abi_encoded_size(inner) - } + }, Self::initialize(inner) => { ::abi_encoded_size(inner) - } + }, Self::initializedAtBlock(inner) => { ::abi_encoded_size(inner) - } + }, Self::isStaker(inner) => { ::abi_encoded_size(inner) - } + }, Self::owner(inner) => { ::abi_encoded_size(inner) - } + }, Self::renounceOwnership(inner) => { ::abi_encoded_size(inner) - } + }, Self::transferOwnership(inner) => { ::abi_encoded_size(inner) - } + }, Self::update(inner) => { ::abi_encoded_size(inner) - } + }, } } #[inline] @@ -3475,28 +3475,28 @@ pub mod PermissionedStakeTable { match self { Self::_hashBlsKey(inner) => { <_hashBlsKeyCall as alloy_sol_types::SolCall>::abi_encode_raw(inner, out) - } + }, Self::initialize(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::initializedAtBlock(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::isStaker(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::owner(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::renounceOwnership(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::transferOwnership(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::update(inner) => { ::abi_encode_raw(inner, out) - } + }, } } } @@ -3536,19 +3536,19 @@ pub mod PermissionedStakeTable { match self { Self::InvalidInitialization(_) => { ::SELECTOR - } + }, Self::NotInitializing(_) => { ::SELECTOR - } + }, Self::OwnableInvalidOwner(_) => { ::SELECTOR - } + }, Self::OwnableUnauthorizedAccount(_) => { ::SELECTOR - } + }, Self::StakerAlreadyExists(_) => { ::SELECTOR - } + }, Self::StakerNotFound(_) => ::SELECTOR, } } @@ -3658,24 +3658,24 @@ pub mod PermissionedStakeTable { match self { Self::InvalidInitialization(inner) => { ::abi_encoded_size(inner) - } + }, Self::NotInitializing(inner) => { ::abi_encoded_size(inner) - } + }, Self::OwnableInvalidOwner(inner) => { ::abi_encoded_size(inner) - } + }, Self::OwnableUnauthorizedAccount(inner) => { ::abi_encoded_size( inner, ) - } + }, Self::StakerAlreadyExists(inner) => { ::abi_encoded_size(inner) - } + }, Self::StakerNotFound(inner) => { ::abi_encoded_size(inner) - } + }, } } #[inline] @@ -3683,24 +3683,24 @@ pub mod PermissionedStakeTable { match self { Self::InvalidInitialization(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::NotInitializing(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::OwnableInvalidOwner(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::OwnableUnauthorizedAccount(inner) => { ::abi_encode_raw( inner, out, ) - } + }, Self::StakerAlreadyExists(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::StakerNotFound(inner) => { ::abi_encode_raw(inner, out) - } + }, } } } @@ -3751,19 +3751,19 @@ pub mod PermissionedStakeTable { topics, data, validate, ) .map(Self::Initialized) - } + }, Some(::SIGNATURE_HASH) => { ::decode_raw_log( topics, data, validate, ) .map(Self::OwnershipTransferred) - } + }, Some(::SIGNATURE_HASH) => { ::decode_raw_log( topics, data, validate, ) .map(Self::StakersUpdated) - } + }, _ => alloy_sol_types::private::Err(alloy_sol_types::Error::InvalidLog { name: ::NAME, log: alloy_sol_types::private::Box::new( @@ -3782,26 +3782,26 @@ pub mod PermissionedStakeTable { match self { Self::Initialized(inner) => { alloy_sol_types::private::IntoLogData::to_log_data(inner) - } + }, Self::OwnershipTransferred(inner) => { alloy_sol_types::private::IntoLogData::to_log_data(inner) - } + }, Self::StakersUpdated(inner) => { alloy_sol_types::private::IntoLogData::to_log_data(inner) - } + }, } } fn into_log_data(self) -> alloy_sol_types::private::LogData { match self { Self::Initialized(inner) => { alloy_sol_types::private::IntoLogData::into_log_data(inner) - } + }, Self::OwnershipTransferred(inner) => { alloy_sol_types::private::IntoLogData::into_log_data(inner) - } + }, Self::StakersUpdated(inner) => { alloy_sol_types::private::IntoLogData::into_log_data(inner) - } + }, } } } diff --git a/contract-bindings-alloy/src/plonkverifier.rs b/contract-bindings-alloy/src/plonkverifier.rs index 363d08a96a..b5a7c3c46b 100644 --- a/contract-bindings-alloy/src/plonkverifier.rs +++ b/contract-bindings-alloy/src/plonkverifier.rs @@ -280,7 +280,7 @@ pub mod BN254 { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -659,7 +659,7 @@ pub mod IPlonkVerifier { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -1203,7 +1203,7 @@ pub mod IPlonkVerifier { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2607,7 +2607,7 @@ pub mod PlonkVerifier { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2667,7 +2667,7 @@ pub mod PlonkVerifier { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2727,7 +2727,7 @@ pub mod PlonkVerifier { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2809,7 +2809,7 @@ pub mod PlonkVerifier { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2842,7 +2842,7 @@ pub mod PlonkVerifier { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2974,7 +2974,7 @@ pub mod PlonkVerifier { match self { Self::verify(inner) => { ::abi_encoded_size(inner) - } + }, } } #[inline] @@ -2982,7 +2982,7 @@ pub mod PlonkVerifier { match self { Self::verify(inner) => { ::abi_encode_raw(inner, out) - } + }, } } } @@ -3016,10 +3016,10 @@ pub mod PlonkVerifier { match self { Self::InvalidPlonkArgs(_) => { ::SELECTOR - } + }, Self::UnsupportedDegree(_) => { ::SELECTOR - } + }, Self::WrongPlonkVK(_) => ::SELECTOR, } } @@ -3091,13 +3091,13 @@ pub mod PlonkVerifier { match self { Self::InvalidPlonkArgs(inner) => { ::abi_encoded_size(inner) - } + }, Self::UnsupportedDegree(inner) => { ::abi_encoded_size(inner) - } + }, Self::WrongPlonkVK(inner) => { ::abi_encoded_size(inner) - } + }, } } #[inline] @@ -3105,13 +3105,13 @@ pub mod PlonkVerifier { match self { Self::InvalidPlonkArgs(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::UnsupportedDegree(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::WrongPlonkVK(inner) => { ::abi_encode_raw(inner, out) - } + }, } } } diff --git a/contract-bindings-alloy/src/plonkverifier2.rs b/contract-bindings-alloy/src/plonkverifier2.rs index 12cc4014ac..1961b83c7c 100644 --- a/contract-bindings-alloy/src/plonkverifier2.rs +++ b/contract-bindings-alloy/src/plonkverifier2.rs @@ -280,7 +280,7 @@ pub mod BN254 { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -659,7 +659,7 @@ pub mod IPlonkVerifier { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -1203,7 +1203,7 @@ pub mod IPlonkVerifier { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2623,7 +2623,7 @@ pub mod PlonkVerifier2 { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2690,7 +2690,7 @@ pub mod PlonkVerifier2 { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2719,7 +2719,7 @@ pub mod PlonkVerifier2 { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2800,7 +2800,7 @@ pub mod PlonkVerifier2 { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2829,7 +2829,7 @@ pub mod PlonkVerifier2 { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2925,7 +2925,7 @@ pub mod PlonkVerifier2 { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -2958,7 +2958,7 @@ pub mod PlonkVerifier2 { match _t { alloy_sol_types::private::AssertTypeEq::< ::RustType, - >(_) => {} + >(_) => {}, } } #[automatically_derived] @@ -3118,13 +3118,13 @@ pub mod PlonkVerifier2 { match self { Self::P_MOD(inner) => { ::abi_encoded_size(inner) - } + }, Self::R_MOD(inner) => { ::abi_encoded_size(inner) - } + }, Self::verify(inner) => { ::abi_encoded_size(inner) - } + }, } } #[inline] @@ -3132,13 +3132,13 @@ pub mod PlonkVerifier2 { match self { Self::P_MOD(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::R_MOD(inner) => { ::abi_encode_raw(inner, out) - } + }, Self::verify(inner) => { ::abi_encode_raw(inner, out) - } + }, } } } @@ -3166,7 +3166,7 @@ pub mod PlonkVerifier2 { match self { Self::UnsupportedDegree(_) => { ::SELECTOR - } + }, } } #[inline] @@ -3211,7 +3211,7 @@ pub mod PlonkVerifier2 { match self { Self::UnsupportedDegree(inner) => { ::abi_encoded_size(inner) - } + }, } } #[inline] @@ -3219,7 +3219,7 @@ pub mod PlonkVerifier2 { match self { Self::UnsupportedDegree(inner) => { ::abi_encode_raw(inner, out) - } + }, } } } diff --git a/contract-bindings-ethers/src/erc1967_proxy.rs b/contract-bindings-ethers/src/erc1967_proxy.rs index cff5203cba..453bf08c61 100644 --- a/contract-bindings-ethers/src/erc1967_proxy.rs +++ b/contract-bindings-ethers/src/erc1967_proxy.rs @@ -320,7 +320,7 @@ pub mod erc1967_proxy { Self::AddressEmptyCode(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::ERC1967InvalidImplementation(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::ERC1967NonPayable(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::FailedInnerCall(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::RevertString(s) => ::ethers::core::abi::AbiEncode::encode(s), @@ -333,21 +333,21 @@ pub mod erc1967_proxy { [0x08, 0xc3, 0x79, 0xa0] => true, _ if selector == ::selector() => { true - } + }, _ if selector == ::selector( ) => { true - } + }, _ if selector == ::selector() => { true - } + }, _ if selector == ::selector() => { true - } + }, _ => false, } } @@ -358,7 +358,7 @@ pub mod erc1967_proxy { Self::AddressEmptyCode(element) => ::core::fmt::Display::fmt(element, f), Self::ERC1967InvalidImplementation(element) => { ::core::fmt::Display::fmt(element, f) - } + }, Self::ERC1967NonPayable(element) => ::core::fmt::Display::fmt(element, f), Self::FailedInnerCall(element) => ::core::fmt::Display::fmt(element, f), Self::RevertString(s) => ::core::fmt::Display::fmt(s, f), diff --git a/contract-bindings-ethers/src/fee_contract.rs b/contract-bindings-ethers/src/fee_contract.rs index 06cb0aa83d..38f00a01f0 100644 --- a/contract-bindings-ethers/src/fee_contract.rs +++ b/contract-bindings-ethers/src/fee_contract.rs @@ -1071,32 +1071,32 @@ pub mod fee_contract { Self::DepositTooSmall(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::ERC1967InvalidImplementation(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::ERC1967NonPayable(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::FailedInnerCall(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::FunctionDoesNotExist(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::InvalidInitialization(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::InvalidUserAddress(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::NoFunctionCalled(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::NotInitializing(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::OwnableInvalidOwner(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::OwnableUnauthorizedAccount(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::UUPSUnauthorizedCallContext(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::UUPSUnsupportedProxiableUUID(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::RevertString(s) => ::ethers::core::abi::AbiEncode::encode(s), } } @@ -1107,70 +1107,70 @@ pub mod fee_contract { [0x08, 0xc3, 0x79, 0xa0] => true, _ if selector == ::selector() => { true - } + }, _ if selector == ::selector() => { true - } + }, _ if selector == ::selector() => { true - } + }, _ if selector == ::selector( ) => { true - } + }, _ if selector == ::selector() => { true - } + }, _ if selector == ::selector() => { true - } + }, _ if selector == ::selector() => { true - } + }, _ if selector == ::selector() => { true - } + }, _ if selector == ::selector() => { true - } + }, _ if selector == ::selector() => { true - } + }, _ if selector == ::selector() => { true - } + }, _ if selector == ::selector() => { true - } + }, _ if selector == ::selector() => { true - } + }, _ if selector == ::selector( ) => { true - } + }, _ if selector == ::selector( ) => { true - } + }, _ => false, } } @@ -1183,7 +1183,7 @@ pub mod fee_contract { Self::DepositTooSmall(element) => ::core::fmt::Display::fmt(element, f), Self::ERC1967InvalidImplementation(element) => { ::core::fmt::Display::fmt(element, f) - } + }, Self::ERC1967NonPayable(element) => ::core::fmt::Display::fmt(element, f), Self::FailedInnerCall(element) => ::core::fmt::Display::fmt(element, f), Self::FunctionDoesNotExist(element) => ::core::fmt::Display::fmt(element, f), @@ -1196,7 +1196,7 @@ pub mod fee_contract { Self::UUPSUnauthorizedCallContext(element) => ::core::fmt::Display::fmt(element, f), Self::UUPSUnsupportedProxiableUUID(element) => { ::core::fmt::Display::fmt(element, f) - } + }, Self::RevertString(s) => ::core::fmt::Display::fmt(s, f), } } @@ -1754,7 +1754,7 @@ pub mod fee_contract { match self { Self::UpgradeInterfaceVersion(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::Balances(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::Deposit(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::GetVersion(element) => ::ethers::core::abi::AbiEncode::encode(element), diff --git a/contract-bindings-ethers/src/light_client.rs b/contract-bindings-ethers/src/light_client.rs index 32daa6fc12..09aa7f02bd 100644 --- a/contract-bindings-ethers/src/light_client.rs +++ b/contract-bindings-ethers/src/light_client.rs @@ -1726,45 +1726,45 @@ pub mod light_client { Self::AddressEmptyCode(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::ERC1967InvalidImplementation(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::ERC1967NonPayable(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::FailedInnerCall(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::InsufficientSnapshotHistory(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::InvalidAddress(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::InvalidArgs(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::InvalidHotShotBlockForCommitmentCheck(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::InvalidInitialization(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::InvalidMaxStateHistory(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::InvalidProof(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::NoChangeRequired(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::NotInitializing(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::OutdatedState(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::OwnableInvalidOwner(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::OwnableUnauthorizedAccount(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::ProverNotPermissioned(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::UUPSUnauthorizedCallContext(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::UUPSUnsupportedProxiableUUID(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::WrongStakeTableUsed(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::RevertString(s) => ::ethers::core::abi::AbiEncode::encode(s), } } @@ -1859,7 +1859,7 @@ pub mod light_client { Self::AddressEmptyCode(element) => ::core::fmt::Display::fmt(element, f), Self::ERC1967InvalidImplementation(element) => { ::core::fmt::Display::fmt(element, f) - } + }, Self::ERC1967NonPayable(element) => ::core::fmt::Display::fmt(element, f), Self::FailedInnerCall(element) => ::core::fmt::Display::fmt(element, f), Self::InsufficientSnapshotHistory(element) => ::core::fmt::Display::fmt(element, f), @@ -1867,7 +1867,7 @@ pub mod light_client { Self::InvalidArgs(element) => ::core::fmt::Display::fmt(element, f), Self::InvalidHotShotBlockForCommitmentCheck(element) => { ::core::fmt::Display::fmt(element, f) - } + }, Self::InvalidInitialization(element) => ::core::fmt::Display::fmt(element, f), Self::InvalidMaxStateHistory(element) => ::core::fmt::Display::fmt(element, f), Self::InvalidProof(element) => ::core::fmt::Display::fmt(element, f), @@ -1880,7 +1880,7 @@ pub mod light_client { Self::UUPSUnauthorizedCallContext(element) => ::core::fmt::Display::fmt(element, f), Self::UUPSUnsupportedProxiableUUID(element) => { ::core::fmt::Display::fmt(element, f) - } + }, Self::WrongStakeTableUsed(element) => ::core::fmt::Display::fmt(element, f), Self::RevertString(s) => ::core::fmt::Display::fmt(s, f), } @@ -2176,10 +2176,10 @@ pub mod light_client { Self::OwnershipTransferredFilter(element) => ::core::fmt::Display::fmt(element, f), Self::PermissionedProverNotRequiredFilter(element) => { ::core::fmt::Display::fmt(element, f) - } + }, Self::PermissionedProverRequiredFilter(element) => { ::core::fmt::Display::fmt(element, f) - } + }, Self::UpgradeFilter(element) => ::core::fmt::Display::fmt(element, f), Self::UpgradedFilter(element) => ::core::fmt::Display::fmt(element, f), } @@ -2777,54 +2777,54 @@ pub mod light_client { match self { Self::UpgradeInterfaceVersion(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::CurrentBlockNumber(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::DisablePermissionedProverMode(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::FinalizedState(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::GenesisStakeTableState(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::GenesisState(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::GetHotShotCommitment(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::GetStateHistoryCount(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::GetVersion(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::Initialize(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::IsPermissionedProverEnabled(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::LagOverEscapeHatchThreshold(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::NewFinalizedState(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::Owner(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::PermissionedProver(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::ProxiableUUID(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::RenounceOwnership(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::SetPermissionedProver(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::SetstateHistoryRetentionPeriod(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::StateHistoryCommitments(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::StateHistoryFirstIndex(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::StateHistoryRetentionPeriod(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::TransferOwnership(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::UpgradeToAndCall(element) => ::ethers::core::abi::AbiEncode::encode(element), } @@ -2837,7 +2837,7 @@ pub mod light_client { Self::CurrentBlockNumber(element) => ::core::fmt::Display::fmt(element, f), Self::DisablePermissionedProverMode(element) => { ::core::fmt::Display::fmt(element, f) - } + }, Self::FinalizedState(element) => ::core::fmt::Display::fmt(element, f), Self::GenesisStakeTableState(element) => ::core::fmt::Display::fmt(element, f), Self::GenesisState(element) => ::core::fmt::Display::fmt(element, f), @@ -2855,7 +2855,7 @@ pub mod light_client { Self::SetPermissionedProver(element) => ::core::fmt::Display::fmt(element, f), Self::SetstateHistoryRetentionPeriod(element) => { ::core::fmt::Display::fmt(element, f) - } + }, Self::StateHistoryCommitments(element) => ::core::fmt::Display::fmt(element, f), Self::StateHistoryFirstIndex(element) => ::core::fmt::Display::fmt(element, f), Self::StateHistoryRetentionPeriod(element) => ::core::fmt::Display::fmt(element, f), diff --git a/contract-bindings-ethers/src/light_client_arbitrum.rs b/contract-bindings-ethers/src/light_client_arbitrum.rs index df441f0a6d..13fa3c65d5 100644 --- a/contract-bindings-ethers/src/light_client_arbitrum.rs +++ b/contract-bindings-ethers/src/light_client_arbitrum.rs @@ -1726,45 +1726,45 @@ pub mod light_client_arbitrum { Self::AddressEmptyCode(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::ERC1967InvalidImplementation(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::ERC1967NonPayable(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::FailedInnerCall(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::InsufficientSnapshotHistory(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::InvalidAddress(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::InvalidArgs(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::InvalidHotShotBlockForCommitmentCheck(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::InvalidInitialization(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::InvalidMaxStateHistory(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::InvalidProof(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::NoChangeRequired(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::NotInitializing(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::OutdatedState(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::OwnableInvalidOwner(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::OwnableUnauthorizedAccount(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::ProverNotPermissioned(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::UUPSUnauthorizedCallContext(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::UUPSUnsupportedProxiableUUID(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::WrongStakeTableUsed(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::RevertString(s) => ::ethers::core::abi::AbiEncode::encode(s), } } @@ -1859,7 +1859,7 @@ pub mod light_client_arbitrum { Self::AddressEmptyCode(element) => ::core::fmt::Display::fmt(element, f), Self::ERC1967InvalidImplementation(element) => { ::core::fmt::Display::fmt(element, f) - } + }, Self::ERC1967NonPayable(element) => ::core::fmt::Display::fmt(element, f), Self::FailedInnerCall(element) => ::core::fmt::Display::fmt(element, f), Self::InsufficientSnapshotHistory(element) => ::core::fmt::Display::fmt(element, f), @@ -1867,7 +1867,7 @@ pub mod light_client_arbitrum { Self::InvalidArgs(element) => ::core::fmt::Display::fmt(element, f), Self::InvalidHotShotBlockForCommitmentCheck(element) => { ::core::fmt::Display::fmt(element, f) - } + }, Self::InvalidInitialization(element) => ::core::fmt::Display::fmt(element, f), Self::InvalidMaxStateHistory(element) => ::core::fmt::Display::fmt(element, f), Self::InvalidProof(element) => ::core::fmt::Display::fmt(element, f), @@ -1880,7 +1880,7 @@ pub mod light_client_arbitrum { Self::UUPSUnauthorizedCallContext(element) => ::core::fmt::Display::fmt(element, f), Self::UUPSUnsupportedProxiableUUID(element) => { ::core::fmt::Display::fmt(element, f) - } + }, Self::WrongStakeTableUsed(element) => ::core::fmt::Display::fmt(element, f), Self::RevertString(s) => ::core::fmt::Display::fmt(s, f), } @@ -2178,10 +2178,10 @@ pub mod light_client_arbitrum { Self::OwnershipTransferredFilter(element) => ::core::fmt::Display::fmt(element, f), Self::PermissionedProverNotRequiredFilter(element) => { ::core::fmt::Display::fmt(element, f) - } + }, Self::PermissionedProverRequiredFilter(element) => { ::core::fmt::Display::fmt(element, f) - } + }, Self::UpgradeFilter(element) => ::core::fmt::Display::fmt(element, f), Self::UpgradedFilter(element) => ::core::fmt::Display::fmt(element, f), } @@ -2779,54 +2779,54 @@ pub mod light_client_arbitrum { match self { Self::UpgradeInterfaceVersion(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::CurrentBlockNumber(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::DisablePermissionedProverMode(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::FinalizedState(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::GenesisStakeTableState(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::GenesisState(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::GetHotShotCommitment(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::GetStateHistoryCount(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::GetVersion(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::Initialize(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::IsPermissionedProverEnabled(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::LagOverEscapeHatchThreshold(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::NewFinalizedState(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::Owner(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::PermissionedProver(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::ProxiableUUID(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::RenounceOwnership(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::SetPermissionedProver(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::SetstateHistoryRetentionPeriod(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::StateHistoryCommitments(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::StateHistoryFirstIndex(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::StateHistoryRetentionPeriod(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::TransferOwnership(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::UpgradeToAndCall(element) => ::ethers::core::abi::AbiEncode::encode(element), } @@ -2839,7 +2839,7 @@ pub mod light_client_arbitrum { Self::CurrentBlockNumber(element) => ::core::fmt::Display::fmt(element, f), Self::DisablePermissionedProverMode(element) => { ::core::fmt::Display::fmt(element, f) - } + }, Self::FinalizedState(element) => ::core::fmt::Display::fmt(element, f), Self::GenesisStakeTableState(element) => ::core::fmt::Display::fmt(element, f), Self::GenesisState(element) => ::core::fmt::Display::fmt(element, f), @@ -2857,7 +2857,7 @@ pub mod light_client_arbitrum { Self::SetPermissionedProver(element) => ::core::fmt::Display::fmt(element, f), Self::SetstateHistoryRetentionPeriod(element) => { ::core::fmt::Display::fmt(element, f) - } + }, Self::StateHistoryCommitments(element) => ::core::fmt::Display::fmt(element, f), Self::StateHistoryFirstIndex(element) => ::core::fmt::Display::fmt(element, f), Self::StateHistoryRetentionPeriod(element) => ::core::fmt::Display::fmt(element, f), diff --git a/contract-bindings-ethers/src/light_client_mock.rs b/contract-bindings-ethers/src/light_client_mock.rs index 951f036d38..3132c0d7e7 100644 --- a/contract-bindings-ethers/src/light_client_mock.rs +++ b/contract-bindings-ethers/src/light_client_mock.rs @@ -1867,45 +1867,45 @@ pub mod light_client_mock { Self::AddressEmptyCode(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::ERC1967InvalidImplementation(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::ERC1967NonPayable(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::FailedInnerCall(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::InsufficientSnapshotHistory(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::InvalidAddress(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::InvalidArgs(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::InvalidHotShotBlockForCommitmentCheck(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::InvalidInitialization(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::InvalidMaxStateHistory(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::InvalidProof(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::NoChangeRequired(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::NotInitializing(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::OutdatedState(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::OwnableInvalidOwner(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::OwnableUnauthorizedAccount(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::ProverNotPermissioned(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::UUPSUnauthorizedCallContext(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::UUPSUnsupportedProxiableUUID(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::WrongStakeTableUsed(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::RevertString(s) => ::ethers::core::abi::AbiEncode::encode(s), } } @@ -2000,7 +2000,7 @@ pub mod light_client_mock { Self::AddressEmptyCode(element) => ::core::fmt::Display::fmt(element, f), Self::ERC1967InvalidImplementation(element) => { ::core::fmt::Display::fmt(element, f) - } + }, Self::ERC1967NonPayable(element) => ::core::fmt::Display::fmt(element, f), Self::FailedInnerCall(element) => ::core::fmt::Display::fmt(element, f), Self::InsufficientSnapshotHistory(element) => ::core::fmt::Display::fmt(element, f), @@ -2008,7 +2008,7 @@ pub mod light_client_mock { Self::InvalidArgs(element) => ::core::fmt::Display::fmt(element, f), Self::InvalidHotShotBlockForCommitmentCheck(element) => { ::core::fmt::Display::fmt(element, f) - } + }, Self::InvalidInitialization(element) => ::core::fmt::Display::fmt(element, f), Self::InvalidMaxStateHistory(element) => ::core::fmt::Display::fmt(element, f), Self::InvalidProof(element) => ::core::fmt::Display::fmt(element, f), @@ -2021,7 +2021,7 @@ pub mod light_client_mock { Self::UUPSUnauthorizedCallContext(element) => ::core::fmt::Display::fmt(element, f), Self::UUPSUnsupportedProxiableUUID(element) => { ::core::fmt::Display::fmt(element, f) - } + }, Self::WrongStakeTableUsed(element) => ::core::fmt::Display::fmt(element, f), Self::RevertString(s) => ::core::fmt::Display::fmt(s, f), } @@ -2319,10 +2319,10 @@ pub mod light_client_mock { Self::OwnershipTransferredFilter(element) => ::core::fmt::Display::fmt(element, f), Self::PermissionedProverNotRequiredFilter(element) => { ::core::fmt::Display::fmt(element, f) - } + }, Self::PermissionedProverRequiredFilter(element) => { ::core::fmt::Display::fmt(element, f) - } + }, Self::UpgradeFilter(element) => ::core::fmt::Display::fmt(element, f), Self::UpgradedFilter(element) => ::core::fmt::Display::fmt(element, f), } @@ -3015,60 +3015,60 @@ pub mod light_client_mock { match self { Self::UpgradeInterfaceVersion(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::CurrentBlockNumber(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::DisablePermissionedProverMode(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::FinalizedState(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::GenesisStakeTableState(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::GenesisState(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::GetHotShotCommitment(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::GetStateHistoryCount(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::GetVersion(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::Initialize(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::IsPermissionedProverEnabled(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::LagOverEscapeHatchThreshold(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::NewFinalizedState(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::Owner(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::PermissionedProver(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::ProxiableUUID(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::RenounceOwnership(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::SetFinalizedState(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::SetHotShotDownSince(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::SetHotShotUp(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::SetPermissionedProver(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::SetStateHistory(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::SetstateHistoryRetentionPeriod(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::StateHistoryCommitments(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::StateHistoryFirstIndex(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::StateHistoryRetentionPeriod(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::TransferOwnership(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::UpgradeToAndCall(element) => ::ethers::core::abi::AbiEncode::encode(element), } @@ -3081,7 +3081,7 @@ pub mod light_client_mock { Self::CurrentBlockNumber(element) => ::core::fmt::Display::fmt(element, f), Self::DisablePermissionedProverMode(element) => { ::core::fmt::Display::fmt(element, f) - } + }, Self::FinalizedState(element) => ::core::fmt::Display::fmt(element, f), Self::GenesisStakeTableState(element) => ::core::fmt::Display::fmt(element, f), Self::GenesisState(element) => ::core::fmt::Display::fmt(element, f), @@ -3103,7 +3103,7 @@ pub mod light_client_mock { Self::SetStateHistory(element) => ::core::fmt::Display::fmt(element, f), Self::SetstateHistoryRetentionPeriod(element) => { ::core::fmt::Display::fmt(element, f) - } + }, Self::StateHistoryCommitments(element) => ::core::fmt::Display::fmt(element, f), Self::StateHistoryFirstIndex(element) => ::core::fmt::Display::fmt(element, f), Self::StateHistoryRetentionPeriod(element) => ::core::fmt::Display::fmt(element, f), diff --git a/contract-bindings-ethers/src/permissioned_stake_table.rs b/contract-bindings-ethers/src/permissioned_stake_table.rs index dfabb2739a..aa4e50abbb 100644 --- a/contract-bindings-ethers/src/permissioned_stake_table.rs +++ b/contract-bindings-ethers/src/permissioned_stake_table.rs @@ -763,17 +763,17 @@ pub mod permissioned_stake_table { match self { Self::InvalidInitialization(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::NotInitializing(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::OwnableInvalidOwner(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::OwnableUnauthorizedAccount(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::StakerAlreadyExists(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::StakerNotFound(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::RevertString(s) => ::ethers::core::abi::AbiEncode::encode(s), } @@ -787,28 +787,28 @@ pub mod permissioned_stake_table { == ::selector() => { true - } + }, _ if selector == ::selector() => { true - } + }, _ if selector == ::selector() => { true - } + }, _ if selector == ::selector() => { true - } + }, _ if selector == ::selector() => { true - } + }, _ if selector == ::selector() => { true - } + }, _ => false, } } @@ -1178,7 +1178,7 @@ pub mod permissioned_stake_table { Self::Initialize(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::InitializedAtBlock(element) => { ::ethers::core::abi::AbiEncode::encode(element) - } + }, Self::IsStaker(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::Owner(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::RenounceOwnership(element) => ::ethers::core::abi::AbiEncode::encode(element), diff --git a/contract-bindings-ethers/src/plonk_verifier.rs b/contract-bindings-ethers/src/plonk_verifier.rs index 9f5ae4cd72..48b9775bd4 100644 --- a/contract-bindings-ethers/src/plonk_verifier.rs +++ b/contract-bindings-ethers/src/plonk_verifier.rs @@ -442,12 +442,12 @@ pub mod plonk_verifier { [0x08, 0xc3, 0x79, 0xa0] => true, _ if selector == ::selector() => { true - } + }, _ if selector == ::selector() => { true - } + }, _ if selector == ::selector() => true, _ => false, } diff --git a/contracts/rust/adapter/src/jellyfish.rs b/contracts/rust/adapter/src/jellyfish.rs index afdd1a59d5..8b55b99983 100644 --- a/contracts/rust/adapter/src/jellyfish.rs +++ b/contracts/rust/adapter/src/jellyfish.rs @@ -13,10 +13,12 @@ use ethers::{ utils::hex::ToHex, }; use jf_pcs::prelude::Commitment; -use jf_plonk::constants::KECCAK256_STATE_SIZE; -use jf_plonk::proof_system::structs::{OpenKey, Proof, ProofEvaluations, VerifyingKey}; -use jf_plonk::testing_apis::Challenges; -use jf_plonk::transcript::SolidityTranscript; +use jf_plonk::{ + constants::KECCAK256_STATE_SIZE, + proof_system::structs::{OpenKey, Proof, ProofEvaluations, VerifyingKey}, + testing_apis::Challenges, + transcript::SolidityTranscript, +}; use jf_utils::to_bytes; use num_bigint::BigUint; use num_traits::Num; diff --git a/contracts/rust/adapter/src/light_client.rs b/contracts/rust/adapter/src/light_client.rs index fdf8d95a3c..4bca08f08a 100644 --- a/contracts/rust/adapter/src/light_client.rs +++ b/contracts/rust/adapter/src/light_client.rs @@ -4,9 +4,7 @@ use ark_ff::PrimeField; use ark_std::str::FromStr; use diff_test_bn254::{field_to_u256, u256_to_field}; use ethers::{ - abi::AbiDecode, - abi::Token, - abi::Tokenize, + abi::{AbiDecode, Token, Tokenize}, prelude::{AbiError, EthAbiCodec, EthAbiType}, types::U256, }; diff --git a/contracts/rust/diff-test/src/main.rs b/contracts/rust/diff-test/src/main.rs index a07382ff11..09d4ebf12b 100644 --- a/contracts/rust/diff-test/src/main.rs +++ b/contracts/rust/diff-test/src/main.rs @@ -2,8 +2,7 @@ use ark_bn254::{Bn254, Fq, Fr, G1Affine, G2Affine}; use ark_ec::{AffineRepr, CurveGroup}; use ark_ed_on_bn254::{EdwardsConfig as EdOnBn254Config, Fq as FqEd254}; use ark_ff::field_hashers::{DefaultFieldHasher, HashToField}; -use ark_poly::domain::radix2::Radix2EvaluationDomain; -use ark_poly::EvaluationDomain; +use ark_poly::{domain::radix2::Radix2EvaluationDomain, EvaluationDomain}; use ark_std::rand::{rngs::StdRng, Rng, SeedableRng}; use clap::{Parser, ValueEnum}; use diff_test_bn254::ParsedG2Point; @@ -17,15 +16,19 @@ use hotshot_state_prover::mock_ledger::{ gen_plonk_proof_for_test, MockLedger, MockSystemParam, STAKE_TABLE_CAPACITY, }; use jf_pcs::prelude::Commitment; -use jf_plonk::proof_system::structs::{Proof, VerifyingKey}; -use jf_plonk::proof_system::PlonkKzgSnark; use jf_plonk::{ + proof_system::{ + structs::{Proof, VerifyingKey}, + PlonkKzgSnark, + }, testing_apis::Verifier, transcript::{PlonkTranscript, SolidityTranscript}, }; -use jf_signature::bls_over_bn254::{hash_to_curve, KeyPair as BLSKeyPair, Signature}; -use jf_signature::constants::CS_ID_BLS_BN254; -use jf_signature::schnorr::KeyPair as SchnorrKeyPair; +use jf_signature::{ + bls_over_bn254::{hash_to_curve, KeyPair as BLSKeyPair, Signature}, + constants::CS_ID_BLS_BN254, + schnorr::KeyPair as SchnorrKeyPair, +}; use sha3::Keccak256; #[derive(Parser)] @@ -102,7 +105,7 @@ fn main() { field_to_u256(domain.group_gen), ); println!("{}", res.encode_hex()); - } + }, Action::EvalDomainElements => { if cli.args.len() != 2 { panic!("Should provide arg1=logSize, arg2=length"); @@ -117,7 +120,7 @@ fn main() { .map(field_to_u256) .collect::>(); println!("{}", res.encode_hex()); - } + }, Action::EvalDataGen => { if cli.args.len() != 3 { panic!("Should provide arg1=logSize, arg2=zeta, arg3=publicInput"); @@ -138,7 +141,7 @@ fn main() { field_to_u256(pi_eval), ); println!("{}", res.encode_hex()); - } + }, Action::TranscriptAppendMsg => { if cli.args.len() != 2 { panic!("Should provide arg1=transcript, arg2=message"); @@ -153,7 +156,7 @@ fn main() { >::append_message(&mut t, &[], &msg).unwrap(); let res: ParsedTranscript = t.into(); println!("{}", (res,).encode_hex()); - } + }, Action::TranscriptAppendField => { if cli.args.len() != 2 { panic!("Should provide arg1=transcript, arg2=fieldElement"); @@ -165,7 +168,7 @@ fn main() { t.append_field_elem::(&[], &field).unwrap(); let res: ParsedTranscript = t.into(); println!("{}", (res,).encode_hex()); - } + }, Action::TranscriptAppendGroup => { if cli.args.len() != 2 { panic!("Should provide arg1=transcript, arg2=groupElement"); @@ -179,7 +182,7 @@ fn main() { .unwrap(); let res: ParsedTranscript = t.into(); println!("{}", (res,).encode_hex()); - } + }, Action::TranscriptGetChal => { if cli.args.len() != 1 { panic!("Should provide arg1=transcript"); @@ -193,7 +196,7 @@ fn main() { let updated_t: ParsedTranscript = t.into(); let res = (updated_t, field_to_u256(chal)); println!("{}", res.encode_hex()); - } + }, Action::TranscriptAppendVkAndPi => { if cli.args.len() != 3 { panic!("Should provide arg1=transcript, arg2=verifyingKey, arg3=publicInput"); @@ -210,7 +213,7 @@ fn main() { let res: ParsedTranscript = t.into(); println!("{}", (res,).encode_hex()); - } + }, Action::TranscriptAppendProofEvals => { if cli.args.len() != 1 { panic!("Should provide arg1=transcript"); @@ -232,7 +235,7 @@ fn main() { let t_updated: ParsedTranscript = t.into(); let res = (t_updated, proof_parsed); println!("{}", res.encode_hex()); - } + }, Action::PlonkConstants => { let coset_k = coset_k(); let open_key = open_key(); @@ -250,7 +253,7 @@ fn main() { field_to_u256::(open_key.beta_h.y().unwrap().c0), ); println!("{}", res.encode_hex()); - } + }, Action::PlonkComputeChal => { if cli.args.len() != 4 { panic!("Should provide arg1=verifyingKey, arg2=publicInput, arg3=proof, arg4=extraTranscriptInitMsg"); @@ -275,9 +278,9 @@ fn main() { .unwrap() .into(); println!("{}", (chal,).encode_hex()); - } + }, Action::PlonkVerify => { - let (proof, vk, public_input, _, _): ( + let (proof, vk, public_input, ..): ( Proof, VerifyingKey, Vec, @@ -304,7 +307,7 @@ fn main() { let res = (vk_parsed, pi_parsed, proof_parsed); println!("{}", res.encode_hex()); - } + }, Action::DummyProof => { let mut rng = jf_utils::test_rng(); if !cli.args.is_empty() { @@ -313,10 +316,10 @@ fn main() { } let proof = ParsedPlonkProof::dummy(&mut rng); println!("{}", (proof,).encode_hex()); - } + }, Action::TestOnly => { println!("args: {:?}", cli.args); - } + }, Action::GenClientWallet => { if cli.args.len() != 2 { panic!("Should provide arg1=senderAddress arg2=seed"); @@ -358,7 +361,7 @@ fn main() { sender_address, ); println!("{}", res.encode_hex()); - } + }, Action::GenRandomG2Point => { if cli.args.len() != 1 { panic!("Should provide arg1=exponent"); @@ -370,7 +373,7 @@ fn main() { let point_parsed: ParsedG2Point = point.into(); let res = point_parsed; println!("{}", (res.encode_hex())); - } + }, Action::MockGenesis => { if cli.args.len() != 1 { panic!("Should provide arg1=numInitValidators"); @@ -382,7 +385,7 @@ fn main() { let res = (ledger.get_state(), ledger.get_stake_table_state()); println!("{}", res.encode_hex()); - } + }, Action::MockConsecutiveFinalizedStates => { if cli.args.len() != 1 { panic!("Should provide arg1=numInitValidators"); @@ -413,7 +416,7 @@ fn main() { let res = (new_states, proofs); println!("{}", res.encode_hex()); - } + }, Action::MockSkipBlocks => { if cli.args.is_empty() || cli.args.len() > 2 { panic!("Should provide arg1=numBlockSkipped,arg2(opt)=requireValidProof"); @@ -444,7 +447,7 @@ fn main() { (state_parsed, proof_parsed) }; println!("{}", res.encode_hex()); - } + }, Action::GenBLSHashes => { if cli.args.len() != 1 { panic!("Should provide arg1=message"); @@ -464,7 +467,7 @@ fn main() { let res = (fq_u256, hash_to_curve_elem_parsed); println!("{}", res.encode_hex()); - } + }, Action::GenBLSSig => { let mut rng = jf_utils::test_rng(); @@ -486,6 +489,6 @@ fn main() { let res = (vk_parsed, sig_parsed); println!("{}", res.encode_hex()); - } + }, }; } diff --git a/flake.nix b/flake.nix index 47b0a13bba..3ea59c72f0 100644 --- a/flake.nix +++ b/flake.nix @@ -109,7 +109,7 @@ cargo-fmt = { enable = true; description = "Enforce rustfmt"; - entry = "cargo fmt --all"; + entry = "just fmt"; types_or = [ "rust" "toml" ]; pass_filenames = false; }; @@ -185,7 +185,7 @@ let stableToolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; nightlyToolchain = pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.minimal.override { - extensions = [ "rust-analyzer" ]; + extensions = [ "rust-analyzer" "rustfmt" ]; }); solc = pkgs.solc-bin."0.8.23"; in @@ -208,6 +208,7 @@ typos just nightlyToolchain.passthru.availableComponents.rust-analyzer + nightlyToolchain.passthru.availableComponents.rustfmt # Tools nixpkgs-fmt diff --git a/hotshot-builder-api/src/api.rs b/hotshot-builder-api/src/api.rs index 04042630c1..5250d1320a 100644 --- a/hotshot-builder-api/src/api.rs +++ b/hotshot-builder-api/src/api.rs @@ -34,7 +34,7 @@ fn merge_toml(into: &mut Value, from: Value) { Entry::Occupied(mut entry) => merge_toml(entry.get_mut(), value), Entry::Vacant(entry) => { entry.insert(value); - } + }, } } } diff --git a/hotshot-builder-core-refactored/src/block_store.rs b/hotshot-builder-core-refactored/src/block_store.rs index 26e5dcaf2b..046282cf97 100644 --- a/hotshot-builder-core-refactored/src/block_store.rs +++ b/hotshot-builder-core-refactored/src/block_store.rs @@ -3,10 +3,9 @@ use std::marker::PhantomData; use hotshot::traits::BlockPayload; use hotshot_builder_api::v0_1::block_info::AvailableBlockInfo; use hotshot_types::traits::signature_key::BuilderSignatureKey; -use marketplace_builder_shared::error::Error; -use marketplace_builder_shared::utils::BuilderKeys; use marketplace_builder_shared::{ - block::BuilderStateId, coordinator::tiered_view_map::TieredViewMap, + block::BuilderStateId, coordinator::tiered_view_map::TieredViewMap, error::Error, + utils::BuilderKeys, }; use marketplace_builder_shared::block::BlockId; diff --git a/hotshot-builder-core-refactored/src/service.rs b/hotshot-builder-core-refactored/src/service.rs index d9831565d7..1ed72750f2 100644 --- a/hotshot-builder-core-refactored/src/service.rs +++ b/hotshot-builder-core-refactored/src/service.rs @@ -9,48 +9,53 @@ use hotshot_builder_api::{ }, v0_2::block_info::AvailableBlockHeaderInputV1, }; -use hotshot_types::traits::block_contents::Transaction; -use hotshot_types::traits::EncodeBytes; use hotshot_types::{ data::VidCommitment, event::EventType, traits::{ - block_contents::BlockPayload, + block_contents::{BlockPayload, Transaction}, node_implementation::{ConsensusTime, NodeType}, signature_key::{BuilderSignatureKey, SignatureKey}, + EncodeBytes, }, utils::BuilderCommitment, }; -use marketplace_builder_shared::coordinator::BuilderStateLookup; -use marketplace_builder_shared::error::Error; -use marketplace_builder_shared::state::BuilderState; -use marketplace_builder_shared::utils::BuilderKeys; use marketplace_builder_shared::{ block::{BlockId, BuilderStateId, ReceivedTransaction, TransactionSource}, - coordinator::BuilderStateCoordinator, + coordinator::{BuilderStateCoordinator, BuilderStateLookup}, + error::Error, + state::BuilderState, + utils::BuilderKeys, }; use tide_disco::app::AppError; -use tokio::spawn; -use tokio::time::{sleep, timeout}; +use tokio::{ + spawn, + time::{sleep, timeout}, +}; use tracing::{error, info, instrument, trace, warn}; use vbs::version::StaticVersion; -use crate::block_size_limits::BlockSizeLimits; -use crate::block_store::{BlockInfo, BlockStore}; +use crate::{ + block_size_limits::BlockSizeLimits, + block_store::{BlockInfo, BlockStore}, +}; pub use async_broadcast::{broadcast, RecvError, TryRecvError}; use async_lock::RwLock; use async_trait::async_trait; use committable::Commitment; -use futures::{future::BoxFuture, Stream}; use futures::{ + future::BoxFuture, stream::{FuturesOrdered, FuturesUnordered, StreamExt}, - TryStreamExt, + Stream, TryStreamExt, +}; +use std::{ + fmt::Display, + sync::{ + atomic::{AtomicUsize, Ordering}, + Arc, + }, + time::{Duration, Instant}, }; -use std::sync::atomic::AtomicUsize; -use std::sync::atomic::Ordering; -use std::sync::Arc; -use std::time::Duration; -use std::{fmt::Display, time::Instant}; use tagged_base64::TaggedBase64; use tide_disco::{method::ReadState, App}; use tokio::task::JoinHandle; @@ -201,7 +206,7 @@ where match event.event { EventType::Error { error } => { error!("Error event in HotShot: {:?}", error); - } + }, EventType::Transactions { transactions } => { let this = Arc::clone(&self); spawn(async move { @@ -217,7 +222,7 @@ where .collect::>() .await; }); - } + }, EventType::Decide { leaf_chain, .. } => { let prune_cutoff = leaf_chain[0].leaf.view_number(); @@ -226,16 +231,16 @@ where let this = Arc::clone(&self); spawn(async move { this.block_store.write().await.prune(prune_cutoff) }); - } + }, EventType::DaProposal { proposal, .. } => { let coordinator = Arc::clone(&self.coordinator); spawn(async move { coordinator.handle_da_proposal(proposal.data).await }); - } + }, EventType::QuorumProposal { proposal, .. } => { let coordinator = Arc::clone(&self.coordinator); spawn(async move { coordinator.handle_quorum_proposal(proposal.data).await }); - } - _ => {} + }, + _ => {}, } } } @@ -287,10 +292,10 @@ where BuilderStateLookup::Found(builder) => break Ok(builder), BuilderStateLookup::Decided => { return Err(Error::AlreadyDecided); - } + }, BuilderStateLookup::NotFound => { sleep(check_period).await; - } + }, }; } } @@ -374,7 +379,7 @@ where Err(error) => { warn!(?error, "Failed to build block payload"); return Err(Error::BuildBlock(error)); - } + }, }; // count the number of txns @@ -442,7 +447,7 @@ where // Timeout waiting for ideal state, get the highest view builder instead warn!("Couldn't find the ideal builder state"); self.coordinator.highest_view_builder().await - } + }, Ok(Err(e)) => { // State already decided let lowest_view = self.coordinator.lowest_view().await; @@ -451,7 +456,7 @@ where "get_available_blocks request for decided view" ); return Err(e); - } + }, }; let Some(builder) = builder else { @@ -485,7 +490,7 @@ where } Ok(vec![response]) - } + }, // Success, but no block: we don't have transactions and aren't prioritizing finalization Ok(Ok(None)) => Ok(vec![]), // Error building block, try to respond with a cached one as last-ditch attempt @@ -495,7 +500,7 @@ where } else { Err(e) } - } + }, } } diff --git a/hotshot-builder-core-refactored/src/testing/basic.rs b/hotshot-builder-core-refactored/src/testing/basic.rs index 53fb9f9055..3b1b17cc7c 100644 --- a/hotshot-builder-core-refactored/src/testing/basic.rs +++ b/hotshot-builder-core-refactored/src/testing/basic.rs @@ -2,28 +2,36 @@ use async_broadcast::broadcast; use hotshot::types::{EventType, SignatureKey}; use hotshot_builder_api::v0_1::data_source::BuilderDataSource; -use hotshot_example_types::block_types::{TestBlockHeader, TestMetadata, TestTransaction}; -use hotshot_example_types::node_types::{TestTypes, TestVersions}; -use hotshot_example_types::state_types::{TestInstanceState, TestValidatedState}; -use hotshot_types::data::VidCommitment; -use hotshot_types::data::{Leaf2, QuorumProposal2, QuorumProposalWrapper, ViewNumber}; -use hotshot_types::event::LeafInfo; -use hotshot_types::simple_certificate::QuorumCertificate; -use hotshot_types::traits::block_contents::BlockHeader; -use hotshot_types::traits::node_implementation::{ConsensusTime, NodeType}; -use hotshot_types::utils::BuilderCommitment; -use marketplace_builder_shared::error::Error; -use marketplace_builder_shared::testing::consensus::SimulatedChainState; -use marketplace_builder_shared::testing::constants::{ - TEST_NUM_NODES_IN_VID_COMPUTATION, TEST_PROTOCOL_MAX_BLOCK_SIZE, +use hotshot_example_types::{ + block_types::{TestBlockHeader, TestMetadata, TestTransaction}, + node_types::{TestTypes, TestVersions}, + state_types::{TestInstanceState, TestValidatedState}, +}; +use hotshot_types::{ + data::{Leaf2, QuorumProposal2, QuorumProposalWrapper, VidCommitment, ViewNumber}, + event::LeafInfo, + simple_certificate::QuorumCertificate, + traits::{ + block_contents::BlockHeader, + node_implementation::{ConsensusTime, NodeType}, + }, + utils::BuilderCommitment, +}; +use marketplace_builder_shared::{ + error::Error, + testing::{ + consensus::SimulatedChainState, + constants::{TEST_NUM_NODES_IN_VID_COMPUTATION, TEST_PROTOCOL_MAX_BLOCK_SIZE}, + }, }; use tokio::time::sleep; use tracing_test::traced_test; -use crate::service::{BuilderConfig, GlobalState, ProxyGlobalState}; -use crate::testing::{assert_eq_generic_err, sign, TestServiceWrapper, MOCK_LEADER_KEYS}; -use std::sync::Arc; -use std::time::Duration; +use crate::{ + service::{BuilderConfig, GlobalState, ProxyGlobalState}, + testing::{assert_eq_generic_err, sign, TestServiceWrapper, MOCK_LEADER_KEYS}, +}; +use std::{sync::Arc, time::Duration}; /// This test simulates consensus performing as expected and builder processing a number /// of transactions diff --git a/hotshot-builder-core-refactored/src/testing/block_size.rs b/hotshot-builder-core-refactored/src/testing/block_size.rs index 7ba6c672c3..b352be08ed 100644 --- a/hotshot-builder-core-refactored/src/testing/block_size.rs +++ b/hotshot-builder-core-refactored/src/testing/block_size.rs @@ -1,22 +1,26 @@ use async_broadcast::broadcast; use committable::Committable; use hotshot_builder_api::v0_1::builder::TransactionStatus; -use hotshot_example_types::block_types::TestTransaction; -use hotshot_example_types::state_types::TestInstanceState; -use hotshot_types::data::VidCommitment; -use hotshot_types::data::ViewNumber; -use hotshot_types::traits::node_implementation::ConsensusTime; -use marketplace_builder_shared::block::{BlockId, BuilderStateId}; -use marketplace_builder_shared::testing::consensus::SimulatedChainState; -use marketplace_builder_shared::testing::constants::TEST_NUM_NODES_IN_VID_COMPUTATION; +use hotshot_example_types::{block_types::TestTransaction, state_types::TestInstanceState}; +use hotshot_types::{ + data::{VidCommitment, ViewNumber}, + traits::node_implementation::ConsensusTime, +}; +use marketplace_builder_shared::{ + block::{BlockId, BuilderStateId}, + testing::{consensus::SimulatedChainState, constants::TEST_NUM_NODES_IN_VID_COMPUTATION}, +}; use tracing_test::traced_test; -use crate::block_size_limits::BlockSizeLimits; -use crate::service::{BuilderConfig, GlobalState}; -use crate::testing::TestServiceWrapper; -use std::sync::atomic::Ordering; -use std::sync::Arc; -use std::time::Duration; +use crate::{ + block_size_limits::BlockSizeLimits, + service::{BuilderConfig, GlobalState}, + testing::TestServiceWrapper, +}; +use std::{ + sync::{atomic::Ordering, Arc}, + time::Duration, +}; /// This tests simulates size limits being decreased lower than our capacity /// and then checks that size limits return to protocol maximum over time diff --git a/hotshot-builder-core-refactored/src/testing/finalization.rs b/hotshot-builder-core-refactored/src/testing/finalization.rs index 13b1d21678..1240dcef23 100644 --- a/hotshot-builder-core-refactored/src/testing/finalization.rs +++ b/hotshot-builder-core-refactored/src/testing/finalization.rs @@ -1,15 +1,16 @@ use async_broadcast::broadcast; use tracing_test::traced_test; -use hotshot_example_types::block_types::TestTransaction; -use hotshot_example_types::state_types::TestInstanceState; -use marketplace_builder_shared::testing::consensus::SimulatedChainState; -use marketplace_builder_shared::testing::constants::{ - TEST_NUM_NODES_IN_VID_COMPUTATION, TEST_PROTOCOL_MAX_BLOCK_SIZE, +use hotshot_example_types::{block_types::TestTransaction, state_types::TestInstanceState}; +use marketplace_builder_shared::testing::{ + consensus::SimulatedChainState, + constants::{TEST_NUM_NODES_IN_VID_COMPUTATION, TEST_PROTOCOL_MAX_BLOCK_SIZE}, }; -use crate::service::{BuilderConfig, GlobalState, ALLOW_EMPTY_BLOCK_PERIOD}; -use crate::testing::TestServiceWrapper; +use crate::{ + service::{BuilderConfig, GlobalState, ALLOW_EMPTY_BLOCK_PERIOD}, + testing::TestServiceWrapper, +}; use std::sync::Arc; // How many times consensus will re-try getting available blocks diff --git a/hotshot-builder-core-refactored/src/testing/integration.rs b/hotshot-builder-core-refactored/src/testing/integration.rs index f8df6e0a6a..91aa8461ba 100644 --- a/hotshot-builder-core-refactored/src/testing/integration.rs +++ b/hotshot-builder-core-refactored/src/testing/integration.rs @@ -125,8 +125,7 @@ mod tests { validation::BuilderValidationConfig, }; - use hotshot_example_types::node_types::TestVersions; - use hotshot_example_types::node_types::{MemoryImpl, TestTypes}; + use hotshot_example_types::node_types::{MemoryImpl, TestTypes, TestVersions}; use hotshot_macros::cross_tests; use hotshot_testing::{ completion_task::{CompletionTaskDescription, TimeBasedCompletionTaskDescription}, diff --git a/hotshot-builder-core-refactored/src/testing/mod.rs b/hotshot-builder-core-refactored/src/testing/mod.rs index 08207ed994..e3b8c9ecbb 100644 --- a/hotshot-builder-core-refactored/src/testing/mod.rs +++ b/hotshot-builder-core-refactored/src/testing/mod.rs @@ -2,26 +2,30 @@ #![allow(clippy::declare_interior_mutable_const)] #![allow(clippy::borrow_interior_mutable_const)] -use std::cell::LazyCell; -use std::sync::Arc; -use std::time::Duration; +use std::{cell::LazyCell, sync::Arc, time::Duration}; use async_broadcast::Sender; use committable::Commitment; -use hotshot::rand::{thread_rng, Rng}; -use hotshot::types::{BLSPubKey, Event, EventType, SignatureKey}; -use hotshot_builder_api::v0_1::block_info::AvailableBlockHeaderInputV1; -use hotshot_builder_api::v0_1::builder::BuildError; -use hotshot_builder_api::v0_1::data_source::AcceptsTxnSubmits; -use hotshot_builder_api::v0_1::{block_info::AvailableBlockInfo, data_source::BuilderDataSource}; -use hotshot_example_types::block_types::TestTransaction; -use hotshot_example_types::node_types::TestTypes; +use hotshot::{ + rand::{thread_rng, Rng}, + types::{BLSPubKey, Event, EventType, SignatureKey}, +}; +use hotshot_builder_api::v0_1::{ + block_info::{AvailableBlockHeaderInputV1, AvailableBlockInfo}, + builder::BuildError, + data_source::{AcceptsTxnSubmits, BuilderDataSource}, +}; +use hotshot_example_types::{block_types::TestTransaction, node_types::TestTypes}; use hotshot_task_impls::builder::v0_1::BuilderClient; -use hotshot_types::data::ViewNumber; -use hotshot_types::traits::node_implementation::{ConsensusTime, NodeType}; -use marketplace_builder_shared::block::{BlockId, BuilderStateId}; -use marketplace_builder_shared::error::Error; -use marketplace_builder_shared::utils::BuilderKeys; +use hotshot_types::{ + data::ViewNumber, + traits::node_implementation::{ConsensusTime, NodeType}, +}; +use marketplace_builder_shared::{ + block::{BlockId, BuilderStateId}, + error::Error, + utils::BuilderKeys, +}; use tokio::spawn; use url::Url; use vbs::version::StaticVersion; diff --git a/hotshot-builder-core/src/builder_state.rs b/hotshot-builder-core/src/builder_state.rs index 558d0d8767..83726b09c7 100644 --- a/hotshot-builder-core/src/builder_state.rs +++ b/hotshot-builder-core/src/builder_state.rs @@ -13,9 +13,7 @@ use marketplace_builder_shared::block::{BlockId, BuilderStateId, ParentBlockRefe use committable::{Commitment, Committable}; use crate::service::{GlobalState, ReceivedTransaction}; -use async_broadcast::broadcast; -use async_broadcast::Receiver as BroadcastReceiver; -use async_broadcast::Sender as BroadcastSender; +use async_broadcast::{broadcast, Receiver as BroadcastReceiver, Sender as BroadcastSender}; use async_lock::RwLock; use core::panic; use futures::StreamExt; @@ -26,12 +24,14 @@ use tokio::{ time::sleep, }; -use std::collections::{HashMap, HashSet, VecDeque}; -use std::fmt::Debug; -use std::sync::Arc; -use std::time::Instant; -use std::{cmp::PartialEq, marker::PhantomData}; -use std::{collections::hash_map::Entry, time::Duration}; +use std::{ + cmp::PartialEq, + collections::{hash_map::Entry, HashMap, HashSet, VecDeque}, + fmt::Debug, + marker::PhantomData, + sync::Arc, + time::{Duration, Instant}, +}; pub type TxTimeStamp = u128; @@ -295,7 +295,7 @@ async fn best_builder_states_to_extend( Some(parent_block_references) => { parent_block_references.leaf_commit == justify_qc.data.leaf_commit && parent_block_references.view_number == justify_qc.view_number - } + }, }, ) .map(|(builder_state_id, _)| builder_state_id.clone()) @@ -1102,15 +1102,15 @@ impl BuilderState { } self.txns_in_queue.insert(tx.commit); self.tx_queue.push_back(tx); - } + }, Err(async_broadcast::TryRecvError::Empty) | Err(async_broadcast::TryRecvError::Closed) => { break; - } + }, Err(async_broadcast::TryRecvError::Overflowed(lost)) => { tracing::warn!("Missed {lost} transactions due to backlog"); continue; - } + }, } } } @@ -1122,20 +1122,19 @@ mod test { use async_broadcast::broadcast; use committable::RawCommitmentBuilder; - use hotshot_example_types::block_types::TestTransaction; - use hotshot_example_types::node_types::TestTypes; - use hotshot_example_types::node_types::TestVersions; - use hotshot_types::data::Leaf2; - use hotshot_types::data::QuorumProposalWrapper; - use hotshot_types::data::ViewNumber; - use hotshot_types::traits::node_implementation::{ConsensusTime, NodeType}; - use hotshot_types::utils::BuilderCommitment; + use hotshot_example_types::{ + block_types::TestTransaction, + node_types::{TestTypes, TestVersions}, + }; + use hotshot_types::{ + data::{Leaf2, QuorumProposalWrapper, ViewNumber}, + traits::node_implementation::{ConsensusTime, NodeType}, + utils::BuilderCommitment, + }; use marketplace_builder_shared::testing::constants::TEST_NUM_NODES_IN_VID_COMPUTATION; use tracing_subscriber::EnvFilter; - use super::DAProposalInfo; - use super::MessageType; - use super::ParentBlockReferences; + use super::{DAProposalInfo, MessageType, ParentBlockReferences}; use crate::testing::{calc_builder_commitment, calc_proposal_msg, create_builder_state}; /// This test the function `process_da_proposal`. diff --git a/hotshot-builder-core/src/service.rs b/hotshot-builder-core/src/service.rs index ba58ba0abd..94e11cd972 100644 --- a/hotshot-builder-core/src/service.rs +++ b/hotshot-builder-core/src/service.rs @@ -8,8 +8,7 @@ use hotshot_builder_api::{ v0_2::builder::TransactionStatus, }; use hotshot_types::{ - data::VidCommitment, - data::{DaProposal2, Leaf2, QuorumProposalWrapper}, + data::{DaProposal2, Leaf2, QuorumProposalWrapper, VidCommitment}, event::EventType, message::Proposal, traits::{ @@ -23,24 +22,24 @@ use lru::LruCache; use vbs::version::StaticVersionType; use crate::builder_state::{ - BuildBlockInfo, DaProposalMessage, DecideMessage, QuorumProposalMessage, TransactionSource, - TriggerStatus, + BuildBlockInfo, DaProposalMessage, DecideMessage, MessageType, QuorumProposalMessage, + RequestMessage, ResponseMessage, TransactionSource, TriggerStatus, }; -use crate::builder_state::{MessageType, RequestMessage, ResponseMessage}; pub use async_broadcast::{broadcast, RecvError, TryRecvError}; use async_broadcast::{Sender as BroadcastSender, TrySendError}; use async_lock::RwLock; use async_trait::async_trait; use committable::{Commitment, Committable}; -use futures::stream::StreamExt; -use futures::{future::BoxFuture, Stream}; +use futures::{future::BoxFuture, stream::StreamExt, Stream}; use marketplace_builder_shared::block::{BlockId, BuilderStateId, ParentBlockReferences}; use sha2::{Digest, Sha256}; -use std::collections::HashMap; -use std::num::NonZeroUsize; -use std::sync::Arc; -use std::time::Duration; -use std::{fmt::Display, time::Instant}; +use std::{ + collections::HashMap, + fmt::Display, + num::NonZeroUsize, + sync::Arc, + time::{Duration, Instant}, +}; use tagged_base64::TaggedBase64; use tide_disco::method::ReadState; use tokio::{ @@ -409,19 +408,19 @@ impl GlobalState { match old_status { Some(TransactionStatus::Rejected { reason }) => { tracing::debug!("Changing the status of a rejected transaction to status {:?}! The reason it is previously rejected is {:?}", txn_status, reason); - } + }, Some(TransactionStatus::Sequenced { leaf }) => { let e = format!("Changing the status of a sequenced transaction to status {:?} is not allowed! The transaction is sequenced in leaf {:?}", txn_status, leaf); tracing::error!(e); return Err(BuildError::Error(e)); - } + }, _ => { tracing::debug!( "change status of transaction {txn_hash} from {:?} to {:?}", old_status, txn_status ); - } + }, } } else { tracing::debug!( @@ -540,23 +539,23 @@ impl From> for BuildError { match error { AvailableBlocksError::SignatureValidationFailed => { BuildError::Error("Signature validation failed in get_available_blocks".to_string()) - } + }, AvailableBlocksError::RequestForAvailableViewThatHasAlreadyBeenDecided => { BuildError::Error( "Request for available blocks for a view that has already been decided." .to_string(), ) - } + }, AvailableBlocksError::SigningBlockFailed(e) => { BuildError::Error(format!("Signing over block info failed: {:?}", e)) - } + }, AvailableBlocksError::GetChannelForMatchingBuilderError(e) => e.into(), AvailableBlocksError::NoBlocksAvailable => { BuildError::Error("No blocks available".to_string()) - } + }, AvailableBlocksError::ChannelUnexpectedlyClosed => { BuildError::Error("Channel unexpectedly closed".to_string()) - } + }, } } } @@ -580,13 +579,13 @@ impl From> for BuildError { match error { ClaimBlockError::SignatureValidationFailed => { BuildError::Error("Signature validation failed in claim block".to_string()) - } + }, ClaimBlockError::SigningCommitmentFailed(e) => { BuildError::Error(format!("Signing over builder commitment failed: {:?}", e)) - } + }, ClaimBlockError::BlockDataNotFound => { BuildError::Error("Block data not found".to_string()) - } + }, } } } @@ -608,10 +607,10 @@ impl From> for BuildError { ), ClaimBlockHeaderInputError::BlockHeaderNotFound => { BuildError::Error("Block header not found".to_string()) - } + }, ClaimBlockHeaderInputError::FailedToSignFeeInfo(e) => { BuildError::Error(format!("Failed to sign fee info: {:?}", e)) - } + }, } } } @@ -743,7 +742,7 @@ impl ProxyGlobalState { break Err(AvailableBlocksError::NoBlocksAvailable); } continue; - } + }, Ok(recv_attempt) => { if recv_attempt.is_none() { tracing::error!( @@ -752,7 +751,7 @@ impl ProxyGlobalState { } break recv_attempt .ok_or_else(|| AvailableBlocksError::ChannelUnexpectedlyClosed); - } + }, } }; @@ -783,13 +782,13 @@ impl ProxyGlobalState { response.builder_hash ); Ok(vec![initial_block_info]) - } + }, // We failed to get available blocks Err(e) => { tracing::debug!("Failed to get available blocks for parent {state_id}",); Err(e) - } + }, } } @@ -1111,7 +1110,7 @@ pub async fn run_non_permissioned_standalone_builder_service< match event.event { EventType::Error { error } => { tracing::error!("Error event in HotShot: {:?}", error); - } + }, // tx event EventType::Transactions { transactions } => { let max_block_size = { @@ -1151,7 +1150,7 @@ pub async fn run_non_permissioned_standalone_builder_service< .await?; } } - } + }, // decide event EventType::Decide { block_size: _, @@ -1160,19 +1159,19 @@ pub async fn run_non_permissioned_standalone_builder_service< } => { let latest_decide_view_num = leaf_chain[0].leaf.view_number(); handle_decide_event(&decide_sender, latest_decide_view_num).await; - } + }, // DA proposal event EventType::DaProposal { proposal, sender } => { handle_da_event(&da_sender, Arc::new(proposal), sender).await; - } + }, // QC proposal event EventType::QuorumProposal { proposal, sender } => { // get the leader for current view handle_quorum_event(&quorum_sender, Arc::new(proposal), sender).await; - } + }, _ => { tracing::debug!("Unhandled event from Builder"); - } + }, } } } @@ -1533,32 +1532,33 @@ mod test { use std::{sync::Arc, time::Duration}; use async_lock::RwLock; - use committable::Commitment; - use committable::Committable; + use committable::{Commitment, Committable}; use futures::StreamExt; use hotshot::{ traits::BlockPayload, types::{BLSPubKey, SignatureKey}, }; - use hotshot_builder_api::v0_1::data_source::AcceptsTxnSubmits; - use hotshot_builder_api::v0_2::block_info::AvailableBlockInfo; - use hotshot_builder_api::v0_2::builder::TransactionStatus; + use hotshot_builder_api::{ + v0_1::data_source::AcceptsTxnSubmits, + v0_2::{block_info::AvailableBlockInfo, builder::TransactionStatus}, + }; use hotshot_example_types::{ block_types::{TestBlockPayload, TestMetadata, TestTransaction}, node_types::{TestTypes, TestVersions}, state_types::{TestInstanceState, TestValidatedState}, }; - use hotshot_types::data::DaProposal2; - use hotshot_types::data::EpochNumber; - use hotshot_types::data::Leaf2; - use hotshot_types::data::{QuorumProposal2, QuorumProposalWrapper}; - use hotshot_types::traits::block_contents::Transaction; - use hotshot_types::traits::node_implementation::Versions; use hotshot_types::{ - data::{vid_commitment, Leaf, ViewNumber}, + data::{ + vid_commitment, DaProposal2, EpochNumber, Leaf, Leaf2, QuorumProposal2, + QuorumProposalWrapper, ViewNumber, + }, message::Proposal, simple_certificate::QuorumCertificate, - traits::{node_implementation::ConsensusTime, signature_key::BuilderSignatureKey}, + traits::{ + block_contents::Transaction, + node_implementation::{ConsensusTime, Versions}, + signature_key::BuilderSignatureKey, + }, utils::BuilderCommitment, }; use marketplace_builder_shared::{ @@ -2141,10 +2141,10 @@ mod test { match vid_trigger_receiver.await { Ok(TriggerStatus::Start) => { // This is expected - } + }, _ => { panic!("did not receive TriggerStatus::Start from vid_trigger_receiver as expected"); - } + }, } } @@ -2366,10 +2366,10 @@ mod test { match vid_trigger_receiver_2.await { Ok(TriggerStatus::Start) => { // This is expected - } + }, _ => { panic!("did not receive TriggerStatus::Start from vid_trigger_receiver as expected"); - } + }, } assert!( @@ -2960,13 +2960,13 @@ mod test { Err(AvailableBlocksError::NoBlocksAvailable) => { // This is what we expect. // This message *should* indicate that no blocks were available. - } + }, Err(err) => { panic!("Unexpected error: {:?}", err); - } + }, Ok(_) => { panic!("Expected an error, but got a result"); - } + }, } } @@ -3032,13 +3032,13 @@ mod test { // This is what we expect. // This message *should* indicate that the signature passed // did not match the given public key. - } + }, Err(err) => { panic!("Unexpected error: {:?}", err); - } + }, Ok(_) => { panic!("Expected an error, but got a result"); - } + }, } } @@ -3103,13 +3103,13 @@ mod test { // This is what we expect. // This message *should* indicate that the signature passed // did not match the given public key. - } + }, Err(err) => { panic!("Unexpected error: {:?}", err); - } + }, Ok(_) => { panic!("Expected an error, but got a result"); - } + }, } } @@ -3172,13 +3172,13 @@ mod test { Err(AvailableBlocksError::GetChannelForMatchingBuilderError(_)) => { // This is what we expect. // This message *should* indicate that the response channel was closed. - } + }, Err(err) => { panic!("Unexpected error: {:?}", err); - } + }, Ok(_) => { panic!("Expected an error, but got a result"); - } + }, } } @@ -3285,17 +3285,17 @@ mod test { let response_channel = match response_receiver.next().await { None => { panic!("Expected a request for available blocks, but didn't get one"); - } + }, Some(MessageType::RequestMessage(req_msg)) => { assert_eq!(req_msg.state_id, expected_builder_state_id); req_msg.response_channel - } + }, Some(message) => { panic!( "Expected a request for available blocks, but got a different message: {:?}", message ); - } + }, }; // We want to send a ResponseMessage to the channel @@ -3316,7 +3316,7 @@ mod test { match result { Err(err) => { panic!("Unexpected error: {:?}", err); - } + }, Ok(result) => { assert_eq!( result, @@ -3336,7 +3336,7 @@ mod test { }], "get_available_blocks response matches expectation" ); - } + }, } } @@ -3431,17 +3431,17 @@ mod test { let response_channel = match response_receiver.next().await { None => { panic!("Expected a request for available blocks, but didn't get one"); - } + }, Some(MessageType::RequestMessage(req_msg)) => { assert_eq!(req_msg.state_id, expected_builder_state_id); req_msg.response_channel - } + }, Some(message) => { panic!( "Expected a request for available blocks, but got a different message: {:?}", message ); - } + }, }; // We want to send a ResponseMessage to the channel @@ -3462,7 +3462,7 @@ mod test { match result { Err(err) => { panic!("Unexpected error: {:?}", err); - } + }, Ok(result) => { assert_eq!( result, @@ -3482,7 +3482,7 @@ mod test { }], "get_available_blocks response matches expectation" ); - } + }, } } @@ -3539,13 +3539,13 @@ mod test { // This is what we expect. // This message *should* indicate that the signature passed // did not match the given public key. - } + }, Err(err) => { panic!("Unexpected error: {:?}", err); - } + }, Ok(_) => { panic!("Expected an error, but got a result"); - } + }, } } @@ -3600,13 +3600,13 @@ mod test { // This is what we expect. // This message *should* indicate that the signature passed // did not match the given public key. - } + }, Err(err) => { panic!("Unexpected error: {:?}", err); - } + }, Ok(_) => { panic!("Expected an error, but got a result"); - } + }, } } @@ -3687,10 +3687,10 @@ mod test { match vid_trigger_receiver.await { Ok(TriggerStatus::Start) => { // This is what we expect. - } + }, _ => { panic!("Expected a TriggerStatus::Start event"); - } + }, } let result = claim_block_join_handle.await; @@ -3698,10 +3698,10 @@ mod test { match result { Err(err) => { panic!("Unexpected error: {:?}", err); - } + }, Ok(_) => { // This is expected - } + }, } } @@ -3759,13 +3759,13 @@ mod test { // This is what we expect. // This message *should* indicate that the signature passed // did not match the given public key. - } + }, Err(err) => { panic!("Unexpected error: {:?}", err); - } + }, Ok(_) => { panic!("Expected an error, but got a result"); - } + }, } } @@ -3820,13 +3820,13 @@ mod test { // This is what we expect. // This message *should* indicate that the signature passed // did not match the given public key. - } + }, Err(err) => { panic!("Unexpected error: {:?}", err); - } + }, Ok(_) => { panic!("Expected an error, but got a result"); - } + }, } } @@ -3887,10 +3887,10 @@ mod test { match result { Err(err) => { panic!("Unexpected error: {:?}", err); - } + }, Ok(_) => { // This is expected. - } + }, } } @@ -3943,13 +3943,13 @@ mod test { match result { Err(HandleDaEventError::SignatureValidationFailed) => { // This is expected. - } + }, Ok(_) => { panic!("expected an error, but received a successful attempt instead") - } + }, Err(err) => { panic!("Unexpected error: {:?}", err); - } + }, } } @@ -4001,13 +4001,13 @@ mod test { match result { Err(HandleDaEventError::BroadcastFailed(_)) => { // This error is expected - } + }, Ok(_) => { panic!("Expected an error, but got a result"); - } + }, Err(err) => { panic!("Unexpected error: {:?}", err); - } + }, } } @@ -4050,20 +4050,20 @@ mod test { match result { Ok(_) => { // This is expected. - } + }, Err(err) => { panic!("Unexpected error: {:?}", err); - } + }, } let mut da_channel_receiver = da_channel_receiver; match da_channel_receiver.next().await { Some(MessageType::DaProposalMessage(da_proposal_message)) => { assert_eq!(da_proposal_message.proposal, signed_da_proposal); - } + }, _ => { panic!("Expected a DaProposalMessage, but got something else"); - } + }, } } @@ -4135,13 +4135,13 @@ mod test { match result { Err(HandleQuorumEventError::SignatureValidationFailed) => { // This is expected. - } + }, Ok(_) => { panic!("expected an error, but received a successful attempt instead"); - } + }, Err(err) => { panic!("Unexpected error: {:?}", err); - } + }, } } @@ -4211,13 +4211,13 @@ mod test { match result { Err(HandleQuorumEventError::BroadcastFailed(_)) => { // This is expected. - } + }, Ok(_) => { panic!("Expected an error, but got a result"); - } + }, Err(err) => { panic!("Unexpected error: {:?}", err); - } + }, } } @@ -4278,20 +4278,20 @@ mod test { match result { Ok(_) => { // This is expected. - } + }, Err(err) => { panic!("Unexpected error: {:?}", err); - } + }, } let mut quorum_channel_receiver = quorum_channel_receiver; match quorum_channel_receiver.next().await { Some(MessageType::QuorumProposalMessage(da_proposal_message)) => { assert_eq!(da_proposal_message.proposal, signed_quorum_proposal); - } + }, _ => { panic!("Expected a QuorumProposalMessage, but got something else"); - } + }, } } @@ -4326,16 +4326,16 @@ mod test { match handle_received_txns_iter.next() { Some(Err(HandleReceivedTxnsError::TooManyTransactions)) => { // This is expected, - } + }, Some(Err(err)) => { panic!("Unexpected error: {:?}", err); - } + }, Some(Ok(_)) => { panic!("Expected an error, but got a result"); - } + }, None => { panic!("Expected an error, but got a result"); - } + }, } } @@ -4379,16 +4379,16 @@ mod test { // This is expected, assert!(estimated_length >= 256); assert_eq!(max_txn_len, TEST_MAX_TX_LEN); - } + }, Some(Err(err)) => { panic!("Unexpected error: {:?}", err); - } + }, Some(Ok(_)) => { panic!("Expected an error, but got a result"); - } + }, None => { panic!("Expected an error, but got a result"); - } + }, } } @@ -4434,21 +4434,21 @@ mod test { match err { async_broadcast::TrySendError::Closed(_) => { // This is expected. - } + }, _ => { panic!("Unexpected error: {:?}", err); - } + }, } - } + }, Some(Err(err)) => { panic!("Unexpected error: {:?}", err); - } + }, Some(Ok(_)) => { panic!("Expected an error, but got a result"); - } + }, None => { panic!("Expected an error, but got a result"); - } + }, } } } @@ -4476,10 +4476,10 @@ mod test { match iteration { Ok(_) => { // This is expected. - } + }, Err(err) => { panic!("Unexpected error: {:?}", err); - } + }, } } @@ -4488,10 +4488,10 @@ mod test { match tx_receiver.next().await { Some(received_txn) => { assert_eq!(received_txn.tx, tx); - } + }, _ => { panic!("Expected a TransactionMessage, but got something else"); - } + }, } } } @@ -4556,10 +4556,10 @@ mod test { match proxy_global_state.txn_status(tx.commit()).await { Ok(txn_status) => { assert_eq!(txn_status, TransactionStatus::Pending); - } + }, e => { panic!("transaction status should be Pending instead of {:?}", e); - } + }, } } @@ -4597,10 +4597,10 @@ mod test { match proxy_global_state.txn_status(tx.commit()).await { Ok(txn_status) => { assert_eq!(txn_status, TransactionStatus::Pending); - } + }, e => { panic!("transaction status should be Pending instead of {:?}", e); - } + }, } } @@ -4627,13 +4627,13 @@ mod test { } else { assert_eq!(txn_status, TransactionStatus::Pending); } - } + }, e => { panic!( "transaction status should be a valid status instead of {:?}", e ); - } + }, } } @@ -4647,22 +4647,22 @@ mod test { { Err(err) => { panic!("Expected a result, but got a error {:?}", err); - } + }, _ => { // This is expected - } + }, } match write_guard.txn_status(tx.commit()).await { Ok(txn_status) => { assert_eq!(txn_status, TransactionStatus::Pending); - } + }, e => { panic!( "transaction status should be a valid status instead of {:?}", e ); - } + }, } } } @@ -4685,10 +4685,10 @@ mod test { { Err(_err) => { // This is expected - } + }, _ => { panic!("Expected an error, but got a result"); - } + }, } } @@ -4698,10 +4698,10 @@ mod test { match proxy_global_state.txn_status(unknown_tx.commit()).await { Ok(txn_status) => { assert_eq!(txn_status, TransactionStatus::Unknown); - } + }, e => { panic!("transaction status should be Unknown instead of {:?}", e); - } + }, } } } diff --git a/hotshot-builder-core/src/testing/basic_test.rs b/hotshot-builder-core/src/testing/basic_test.rs index 0825a9e887..7bdd963bd5 100644 --- a/hotshot-builder-core/src/testing/basic_test.rs +++ b/hotshot-builder-core/src/testing/basic_test.rs @@ -16,45 +16,45 @@ use vbs::version::StaticVersionType; #[cfg(test)] mod tests { use super::*; - use std::collections::VecDeque; - use std::{hash::Hash, marker::PhantomData}; + use std::{collections::VecDeque, hash::Hash, marker::PhantomData}; use hotshot::types::SignatureKey; use hotshot_builder_api::v0_2::data_source::BuilderDataSource; - use hotshot_example_types::auction_results_provider_types::TestAuctionResult; - use hotshot_example_types::node_types::TestVersions; - use hotshot_types::data::{DaProposal2, Leaf2, QuorumProposal2, QuorumProposalWrapper}; - use hotshot_types::simple_vote::QuorumData2; - use hotshot_types::traits::node_implementation::Versions; + use hotshot_example_types::{ + auction_results_provider_types::TestAuctionResult, node_types::TestVersions, + }; use hotshot_types::{ - data::vid_commitment, signature_key::BuilderKey, traits::block_contents::BlockHeader, - traits::EncodeBytes, utils::BuilderCommitment, + data::{vid_commitment, DaProposal2, Leaf2, QuorumProposal2, QuorumProposalWrapper}, + signature_key::BuilderKey, + simple_vote::QuorumData2, + traits::{block_contents::BlockHeader, node_implementation::Versions, EncodeBytes}, + utils::BuilderCommitment, }; use hotshot_example_types::{ block_types::{TestBlockHeader, TestBlockPayload, TestMetadata, TestTransaction}, state_types::{TestInstanceState, TestValidatedState}, }; - use marketplace_builder_shared::block::ParentBlockReferences; - use marketplace_builder_shared::testing::constants::{ - TEST_MAX_BLOCK_SIZE_INCREMENT_PERIOD, TEST_MAX_TX_NUM, TEST_NUM_NODES_IN_VID_COMPUTATION, - TEST_PROTOCOL_MAX_BLOCK_SIZE, + use marketplace_builder_shared::{ + block::ParentBlockReferences, + testing::constants::{ + TEST_MAX_BLOCK_SIZE_INCREMENT_PERIOD, TEST_MAX_TX_NUM, + TEST_NUM_NODES_IN_VID_COMPUTATION, TEST_PROTOCOL_MAX_BLOCK_SIZE, + }, }; - use tokio::time::error::Elapsed; - use tokio::time::timeout; + use tokio::time::{error::Elapsed, timeout}; use tracing_subscriber::EnvFilter; - use crate::builder_state::{ - DaProposalMessage, DecideMessage, QuorumProposalMessage, TransactionSource, - }; - use crate::service::{ - handle_received_txns, GlobalState, ProxyGlobalState, ReceivedTransaction, + use crate::{ + builder_state::{ + DaProposalMessage, DecideMessage, QuorumProposalMessage, TransactionSource, + }, + service::{handle_received_txns, GlobalState, ProxyGlobalState, ReceivedTransaction}, }; use async_lock::RwLock; use committable::{Commitment, CommitmentBoundsArkless, Committable}; use sha2::{Digest, Sha256}; - use std::sync::Arc; - use std::time::Duration; + use std::{sync::Arc, time::Duration}; use serde::{Deserialize, Serialize}; /// This test simulates multiple builder states receiving messages from the channels and processing them @@ -462,7 +462,7 @@ mod tests { ) .unwrap(); current_leaf - } + }, }; DecideMessage:: { diff --git a/hotshot-builder-core/src/testing/finalization_test.rs b/hotshot-builder-core/src/testing/finalization_test.rs index 0a1846fa95..ceb493a0a3 100644 --- a/hotshot-builder-core/src/testing/finalization_test.rs +++ b/hotshot-builder-core/src/testing/finalization_test.rs @@ -12,9 +12,10 @@ use hotshot::{ traits::BlockPayload, types::{BLSPubKey, SignatureKey}, }; -use hotshot_builder_api::{ - v0_1::{block_info::AvailableBlockInfo, data_source::BuilderDataSource}, - v0_1::{builder::BuildError, data_source::AcceptsTxnSubmits}, +use hotshot_builder_api::v0_1::{ + block_info::AvailableBlockInfo, + builder::BuildError, + data_source::{AcceptsTxnSubmits, BuilderDataSource}, }; use hotshot_example_types::{ block_types::{TestBlockHeader, TestBlockPayload, TestMetadata, TestTransaction}, @@ -32,15 +33,13 @@ use hotshot_types::{ }, utils::BuilderCommitment, }; -use marketplace_builder_shared::testing::constants::{ - TEST_CHANNEL_BUFFER_SIZE, TEST_MAX_TX_NUM, TEST_NUM_CONSENSUS_RETRIES, - TEST_NUM_NODES_IN_VID_COMPUTATION, -}; -use marketplace_builder_shared::{ - block::BuilderStateId, testing::constants::TEST_MAX_BLOCK_SIZE_INCREMENT_PERIOD, -}; use marketplace_builder_shared::{ - block::ParentBlockReferences, testing::constants::TEST_PROTOCOL_MAX_BLOCK_SIZE, + block::{BuilderStateId, ParentBlockReferences}, + testing::constants::{ + TEST_CHANNEL_BUFFER_SIZE, TEST_MAX_BLOCK_SIZE_INCREMENT_PERIOD, TEST_MAX_TX_NUM, + TEST_NUM_CONSENSUS_RETRIES, TEST_NUM_NODES_IN_VID_COMPUTATION, + TEST_PROTOCOL_MAX_BLOCK_SIZE, + }, }; use sha2::{Digest, Sha256}; use vbs::version::StaticVersionType; diff --git a/hotshot-builder-core/src/testing/mod.rs b/hotshot-builder-core/src/testing/mod.rs index 8c8ea676e6..7f5d25551d 100644 --- a/hotshot-builder-core/src/testing/mod.rs +++ b/hotshot-builder-core/src/testing/mod.rs @@ -6,8 +6,7 @@ use crate::{ }, service::ReceivedTransaction, }; -use async_broadcast::broadcast; -use async_broadcast::Sender as BroadcastSender; +use async_broadcast::{broadcast, Sender as BroadcastSender}; use hotshot::{ traits::BlockPayload, types::{BLSPubKey, SignatureKey}, @@ -43,8 +42,7 @@ use marketplace_builder_shared::{ TEST_MAX_BLOCK_SIZE_INCREMENT_PERIOD, TEST_MAX_TX_NUM, TEST_PROTOCOL_MAX_BLOCK_SIZE, }, }; -use std::sync::Arc; -use std::time::Duration; +use std::{sync::Arc, time::Duration}; mod basic_test; pub mod finalization_test; @@ -207,7 +205,7 @@ pub async fn calc_proposal_msg( prev_justify_qc.signatures.clone(), PhantomData, ) - } + }, }; tracing::debug!("Iteration: {} justify_qc: {:?}", round, justify_qc); diff --git a/hotshot-events-service/src/api.rs b/hotshot-events-service/src/api.rs index 215d1f28e4..dd4579cef8 100644 --- a/hotshot-events-service/src/api.rs +++ b/hotshot-events-service/src/api.rs @@ -40,7 +40,7 @@ fn merge_toml(into: &mut Value, from: Value) { Entry::Occupied(mut entry) => merge_toml(entry.get_mut(), value), Entry::Vacant(entry) => { entry.insert(value); - } + }, } } } diff --git a/hotshot-events-service/src/events_source.rs b/hotshot-events-service/src/events_source.rs index 4f905bca63..22e6793384 100644 --- a/hotshot-events-service/src/events_source.rs +++ b/hotshot-events-service/src/events_source.rs @@ -99,7 +99,7 @@ impl EventFilterSet { EventType::Decide { .. } => filter.contains(&EventFilter::Decide), EventType::ReplicaViewTimeout { .. } => { filter.contains(&EventFilter::ReplicaViewTimeout) - } + }, EventType::ViewFinished { .. } => filter.contains(&EventFilter::ViewFinished), EventType::ViewTimeout { .. } => filter.contains(&EventFilter::ViewTimeout), EventType::Transactions { .. } => filter.contains(&EventFilter::Transactions), diff --git a/hotshot-events-service/src/test.rs b/hotshot-events-service/src/test.rs index be5dde136b..e1d33c5f07 100644 --- a/hotshot-events-service/src/test.rs +++ b/hotshot-events-service/src/test.rs @@ -23,8 +23,10 @@ mod tests { use vbs::version::{StaticVersion, StaticVersionType}; //use crate::fetch::Fetch; - use crate::events::{define_api, Error, Options}; - use crate::events_source::{EventConsumer, EventsStreamer, StartupInfo}; // EventsUpdater}; + use crate::{ + events::{define_api, Error, Options}, + events_source::{EventConsumer, EventsStreamer, StartupInfo}, + }; // EventsUpdater}; // return a empty transaction event fn generate_event>(view_number: u64) -> Event { diff --git a/hotshot-example-types/src/block_types.rs b/hotshot-example-types/src/block_types.rs index 7d4ba68c4d..fde4411837 100644 --- a/hotshot-example-types/src/block_types.rs +++ b/hotshot-example-types/src/block_types.rs @@ -13,8 +13,7 @@ use std::{ use async_trait::async_trait; use committable::{Commitment, Committable, RawCommitmentBuilder}; use hotshot_types::{ - data::VidCommitment, - data::{BlockError, Leaf2}, + data::{BlockError, Leaf2, VidCommitment}, traits::{ block_contents::{BlockHeader, BuilderFee, EncodeBytes, TestableBlock, Transaction}, node_implementation::NodeType, diff --git a/hotshot-example-types/src/testable_delay.rs b/hotshot-example-types/src/testable_delay.rs index 07f460eaf3..ea16b4b3f3 100644 --- a/hotshot-example-types/src/testable_delay.rs +++ b/hotshot-example-types/src/testable_delay.rs @@ -85,16 +85,16 @@ pub trait TestableDelay { /// Add a delay from settings async fn handle_async_delay(settings: &DelaySettings) { match settings.delay_option { - DelayOptions::None => {} + DelayOptions::None => {}, DelayOptions::Fixed => { sleep(Duration::from_millis(settings.fixed_time_in_milliseconds)).await; - } + }, DelayOptions::Random => { let sleep_in_millis = rand::thread_rng().gen_range( settings.min_time_in_milliseconds..=settings.max_time_in_milliseconds, ); sleep(Duration::from_millis(sleep_in_millis)).await; - } + }, } } @@ -124,7 +124,7 @@ impl Iterator for SupportedTraitTypesForAsyncDelayIterator { _ => { assert_eq!(self.index, 3, "Need to ensure that newly added or removed `SupportedTraitTypesForAsyncDelay` enum is handled in iterator"); return None; - } + }, }; self.index += 1; supported_type diff --git a/hotshot-examples/infra/mod.rs b/hotshot-examples/infra/mod.rs index f8fcdf4c9f..aa424eaed6 100755 --- a/hotshot-examples/infra/mod.rs +++ b/hotshot-examples/infra/mod.rs @@ -437,13 +437,13 @@ pub trait RunDa< match event_stream.next().await { None => { panic!("Error! Event stream completed before consensus ended."); - } + }, Some(Event { event, .. }) => { match event { EventType::Error { error } => { error!("Error in consensus: {:?}", error); // TODO what to do here - } + }, EventType::Decide { leaf_chain, qc: _, @@ -510,16 +510,16 @@ pub trait RunDa< warn!("Leaf chain is greater than 1 with len {}", leaf_chain.len()); } // when we make progress, submit new events - } + }, EventType::ReplicaViewTimeout { view_number } => { warn!("Timed out as a replicas in view {:?}", view_number); - } + }, EventType::ViewTimeout { view_number } => { warn!("Timed out in view {:?}", view_number); - } - _ => {} // mostly DA proposal + }, + _ => {}, // mostly DA proposal } - } + }, } } let num_eligible_leaders = context @@ -1088,11 +1088,11 @@ where }) .collect(); bind_address = Url::parse(&format!("http://0.0.0.0:{port}")).unwrap(); - } + }, Some(ref addr) => { bind_address = Url::parse(&format!("http://{addr}")).expect("Valid URL"); advertise_urls = vec![bind_address.clone()]; - } + }, } match run_config.builder { @@ -1112,7 +1112,7 @@ where .await; Some(builder_task) - } + }, BuilderType::Simple => { let builder_task = >::start( @@ -1128,7 +1128,7 @@ where .await; Some(builder_task) - } + }, } } diff --git a/hotshot-fakeapi/src/fake_solver.rs b/hotshot-fakeapi/src/fake_solver.rs index b52418cc9b..f2b81175b5 100644 --- a/hotshot-fakeapi/src/fake_solver.rs +++ b/hotshot-fakeapi/src/fake_solver.rs @@ -91,11 +91,11 @@ impl FakeSolverState { status: tide_disco::StatusCode::INTERNAL_SERVER_ERROR, message: "Internal Server Error".to_string(), }); - } + }, FakeSolverFaultType::TimeoutFault => { // Sleep for the preconfigured 1 second timeout interval tokio::time::sleep(SOLVER_MAX_TIMEOUT_S).await; - } + }, } } diff --git a/hotshot-libp2p-networking/src/network/behaviours/dht/bootstrap.rs b/hotshot-libp2p-networking/src/network/behaviours/dht/bootstrap.rs index 566db12d4c..cf07181249 100644 --- a/hotshot-libp2p-networking/src/network/behaviours/dht/bootstrap.rs +++ b/hotshot-libp2p-networking/src/network/behaviours/dht/bootstrap.rs @@ -50,19 +50,19 @@ impl DHTBootstrapTask { Some(InputEvent::BootstrapFinished) => { tracing::debug!("Bootstrap finished"); self.in_progress = false; - } + }, Some(InputEvent::ShutdownBootstrap) => { tracing::info!("ShutdownBootstrap received, shutting down"); break; - } + }, Some(InputEvent::StartBootstrap) => { tracing::warn!("Trying to start bootstrap that's already in progress"); continue; - } + }, None => { tracing::debug!("Bootstrap channel closed, exiting loop"); break; - } + }, } } else if let Ok(maybe_event) = timeout(Duration::from_secs(120), self.rx.next()).await { @@ -70,18 +70,18 @@ impl DHTBootstrapTask { Some(InputEvent::StartBootstrap) => { tracing::debug!("Start bootstrap in bootstrap task"); self.bootstrap(); - } + }, Some(InputEvent::ShutdownBootstrap) => { tracing::debug!("ShutdownBootstrap received, shutting down"); break; - } + }, Some(InputEvent::BootstrapFinished) => { tracing::debug!("not in progress got bootstrap finished"); - } + }, None => { tracing::debug!("Bootstrap channel closed, exiting loop"); break; - } + }, } } else { tracing::debug!("Start bootstrap in bootstrap task after timeout"); diff --git a/hotshot-libp2p-networking/src/network/behaviours/dht/mod.rs b/hotshot-libp2p-networking/src/network/behaviours/dht/mod.rs index 7ef41e1192..950450aecc 100644 --- a/hotshot-libp2p-networking/src/network/behaviours/dht/mod.rs +++ b/hotshot-libp2p-networking/src/network/behaviours/dht/mod.rs @@ -274,31 +274,31 @@ impl DHTBehaviour { let num_entries = o.get_mut(); *num_entries += 1; *num_entries - } + }, std::collections::hash_map::Entry::Vacant(v) => { v.insert(1); 1 - } + }, } - } + }, GetRecordOk::FinishedWithNoAdditionalRecord { cache_candidates: _, } => { tracing::debug!("GetRecord Finished with No Additional Record"); last = true; 0 - } + }, }, Err(err) => { warn!("Error in Kademlia query: {:?}", err); 0 - } + }, }, None => { // We already finished the query (or it's been cancelled). Do nothing and exit the // function. return; - } + }, }; // if the query has completed and we need to retry @@ -398,7 +398,7 @@ impl DHTBehaviour { if query.notify.send(()).is_err() { warn!("Put DHT: client channel closed before put record request could be sent"); } - } + }, Err(e) => { query.progress = DHTProgress::NotStarted; query.backoff.start_next(false); @@ -409,7 +409,7 @@ impl DHTBehaviour { ); // push back onto the queue self.retry_put(query); - } + }, } } else { warn!("Put DHT: completed DHT query that is no longer tracked."); @@ -439,7 +439,7 @@ impl DHTBehaviour { if last { self.handle_put_query(record_results, id); } - } + }, KademliaEvent::OutboundQueryProgressed { result: QueryResult::GetClosestPeers(r), id: query_id, @@ -454,13 +454,13 @@ impl DHTBehaviour { }; }; debug!("Successfully got closest peers for key {:?}", key); - } + }, Err(e) => { if let Some(chan) = self.in_progress_get_closest_peers.remove(&query_id) { let _: Result<_, _> = chan.send(()); }; warn!("Failed to get closest peers: {:?}", e); - } + }, }, KademliaEvent::OutboundQueryProgressed { result: QueryResult::GetRecord(record_results), @@ -469,7 +469,7 @@ impl DHTBehaviour { .. } => { self.handle_get_query(store, record_results, id, last); - } + }, KademliaEvent::OutboundQueryProgressed { result: QueryResult::Bootstrap(Ok(BootstrapOk { @@ -485,7 +485,7 @@ impl DHTBehaviour { debug!("Bootstrap in progress, {} nodes remaining", num_remaining); } return Some(NetworkEvent::IsBootstrapped); - } + }, KademliaEvent::OutboundQueryProgressed { result: QueryResult::Bootstrap(Err(e)), .. @@ -495,16 +495,16 @@ impl DHTBehaviour { error!("Failed to bootstrap: {:?}", e); } self.finish_bootstrap(); - } + }, KademliaEvent::RoutablePeer { peer, address: _ } => { debug!("Found routable peer {:?}", peer); - } + }, KademliaEvent::PendingRoutablePeer { peer, address: _ } => { debug!("Found pending routable peer {:?}", peer); - } + }, KademliaEvent::UnroutablePeer { peer } => { debug!("Found unroutable peer {:?}", peer); - } + }, KademliaEvent::RoutingUpdated { peer: _, is_new_peer: _, @@ -513,13 +513,13 @@ impl DHTBehaviour { old_peer: _, } => { debug!("Routing table updated"); - } + }, e @ KademliaEvent::OutboundQueryProgressed { .. } => { debug!("Not handling dht event {:?}", e); - } + }, e => { debug!("New unhandled swarm event: {e:?}"); - } + }, } None } diff --git a/hotshot-libp2p-networking/src/network/behaviours/dht/store/persistent.rs b/hotshot-libp2p-networking/src/network/behaviours/dht/store/persistent.rs index cd927c2470..2c89cc741a 100644 --- a/hotshot-libp2p-networking/src/network/behaviours/dht/store/persistent.rs +++ b/hotshot-libp2p-networking/src/network/behaviours/dht/store/persistent.rs @@ -281,10 +281,10 @@ impl PersistentStore { .await .map_err(|_| anyhow::anyhow!("save operation timed out")) { - Ok(Ok(())) => {} + Ok(Ok(())) => {}, Ok(Err(error)) | Err(error) => { warn!("Failed to save DHT to persistent storage: {error}"); - } + }, }; // Reset the record delta @@ -324,10 +324,10 @@ impl PersistentStore { err ); } - } + }, Err(err) => { warn!("Failed to parse record from persistent storage: {:?}", err); - } + }, }; } diff --git a/hotshot-libp2p-networking/src/network/behaviours/direct_message.rs b/hotshot-libp2p-networking/src/network/behaviours/direct_message.rs index 72d378a587..dfd8e5ca4f 100644 --- a/hotshot-libp2p-networking/src/network/behaviours/direct_message.rs +++ b/hotshot-libp2p-networking/src/network/behaviours/direct_message.rs @@ -59,7 +59,7 @@ impl DMBehaviour { } => { error!("Inbound message failure from {:?}: {:?}", peer, error); None - } + }, Event::OutboundFailure { peer, request_id, @@ -83,7 +83,7 @@ impl DMBehaviour { } } None - } + }, Event::Message { message, peer, .. } => match message { Message::Request { request: msg, @@ -94,7 +94,7 @@ impl DMBehaviour { // receiver, not initiator. // don't track. If we are disconnected, sender will reinitiate Some(NetworkEvent::DirectRequest(msg, peer, channel)) - } + }, Message::Response { request_id, response: msg, @@ -107,12 +107,12 @@ impl DMBehaviour { warn!("Received response for unknown request id {:?}", request_id); None } - } + }, }, e @ Event::ResponseSent { .. } => { debug!("Response sent {:?}", e); None - } + }, } } } diff --git a/hotshot-libp2p-networking/src/network/cbor.rs b/hotshot-libp2p-networking/src/network/cbor.rs index a8ca6afedf..71f19281e7 100644 --- a/hotshot-libp2p-networking/src/network/cbor.rs +++ b/hotshot-libp2p-networking/src/network/cbor.rs @@ -126,19 +126,19 @@ fn decode_into_io_error(err: cbor4ii::serde::DecodeError) -> io::Err match err { cbor4ii::serde::DecodeError::Core(DecodeError::Read(e)) => { io::Error::new(io::ErrorKind::Other, e.to_string()) - } + }, cbor4ii::serde::DecodeError::Core(e @ DecodeError::Unsupported { .. }) => { io::Error::new(io::ErrorKind::Unsupported, e.to_string()) - } + }, cbor4ii::serde::DecodeError::Core(e @ DecodeError::Eof { .. }) => { io::Error::new(io::ErrorKind::UnexpectedEof, e.to_string()) - } + }, cbor4ii::serde::DecodeError::Core(e) => { io::Error::new(io::ErrorKind::InvalidData, e.to_string()) - } + }, cbor4ii::serde::DecodeError::Custom(e) => { io::Error::new(io::ErrorKind::Other, e.to_string()) - } + }, } } diff --git a/hotshot-libp2p-networking/src/network/node.rs b/hotshot-libp2p-networking/src/network/node.rs index 28d009f846..d5e1703a0e 100644 --- a/hotshot-libp2p-networking/src/network/node.rs +++ b/hotshot-libp2p-networking/src/network/node.rs @@ -360,7 +360,7 @@ impl NetworkNode { query.progress = DHTProgress::NotStarted; query.backoff.start_next(false); error!("Error publishing to DHT: {e:?} for peer {:?}", self.peer_id); - } + }, Ok(qid) => { debug!("Published record to DHT with qid {:?}", qid); let query = KadPutQuery { @@ -368,7 +368,7 @@ impl NetworkNode { ..query }; self.dht_handler.put_record(qid, query); - } + }, } } @@ -392,20 +392,20 @@ impl NetworkNode { ClientRequest::BeginBootstrap => { debug!("Beginning Libp2p bootstrap"); let _ = self.swarm.behaviour_mut().dht.bootstrap(); - } + }, ClientRequest::LookupPeer(pid, chan) => { let id = self.swarm.behaviour_mut().dht.get_closest_peers(pid); self.dht_handler .in_progress_get_closest_peers .insert(id, chan); - } + }, ClientRequest::GetRoutingTable(chan) => { self.dht_handler .print_routing_table(&mut self.swarm.behaviour_mut().dht); if chan.send(()).is_err() { warn!("Tried to notify client but client not tracking anymore"); } - } + }, ClientRequest::PutDHT { key, value, notify } => { let query = KadPutQuery { progress: DHTProgress::NotStarted, @@ -415,17 +415,17 @@ impl NetworkNode { backoff: ExponentialBackoff::default(), }; self.put_record(query); - } + }, ClientRequest::GetConnectedPeerNum(s) => { if s.send(self.num_connected()).is_err() { error!("error sending peer number to client"); } - } + }, ClientRequest::GetConnectedPeers(s) => { if s.send(self.connected_pids()).is_err() { error!("error sending peer set to client"); } - } + }, ClientRequest::GetDHT { key, notify, @@ -439,20 +439,20 @@ impl NetworkNode { retry_count, &mut self.swarm.behaviour_mut().dht, ); - } + }, ClientRequest::IgnorePeers(_peers) => { // NOTE used by test with conductor only - } + }, ClientRequest::Shutdown => { if let Some(listener_id) = self.listener_id { self.swarm.remove_listener(listener_id); } return Ok(true); - } + }, ClientRequest::GossipMsg(topic, contents) => { behaviour.publish_gossip(Topic::new(topic.clone()), contents.clone()); - } + }, ClientRequest::Subscribe(t, chan) => { behaviour.subscribe_gossip(&t); if let Some(chan) = chan { @@ -460,7 +460,7 @@ impl NetworkNode { error!("finished subscribing but response channel dropped"); } } - } + }, ClientRequest::Unsubscribe(t, chan) => { behaviour.unsubscribe_gossip(&t); if let Some(chan) = chan { @@ -468,7 +468,7 @@ impl NetworkNode { error!("finished unsubscribing but response channel dropped"); } } - } + }, ClientRequest::DirectRequest { pid, contents, @@ -483,23 +483,23 @@ impl NetworkNode { retry_count, }; self.direct_message_state.add_direct_request(req, id); - } + }, ClientRequest::DirectResponse(chan, msg) => { behaviour.add_direct_response(chan, msg); - } + }, ClientRequest::AddKnownPeers(peers) => { self.add_known_peers(&peers); - } + }, ClientRequest::Prune(pid) => { if self.swarm.disconnect_peer_id(pid).is_err() { warn!("Could not disconnect from {:?}", pid); } - } + }, } - } + }, None => { error!("Error receiving msg in main behaviour loop: channel closed"); - } + }, } Ok(false) } @@ -541,7 +541,7 @@ impl NetworkNode { send_to_client .send(NetworkEvent::ConnectedPeersUpdate(self.num_connected())) .map_err(|err| NetworkError::ChannelSendError(err.to_string()))?; - } + }, SwarmEvent::ConnectionClosed { connection_id: _, peer_id, @@ -565,13 +565,13 @@ impl NetworkNode { send_to_client .send(NetworkEvent::ConnectedPeersUpdate(self.num_connected())) .map_err(|err| NetworkError::ChannelSendError(err.to_string()))?; - } + }, SwarmEvent::Dialing { peer_id, connection_id: _, } => { debug!("Attempting to dial {:?}", peer_id); - } + }, SwarmEvent::ListenerClosed { listener_id: _, addresses: _, @@ -591,7 +591,7 @@ impl NetworkNode { connection_id: _, local_addr: _, send_back_addr: _, - } => {} + } => {}, SwarmEvent::Behaviour(b) => { let maybe_event = match b { NetworkEventInternal::DHTEvent(e) => self @@ -621,7 +621,7 @@ impl NetworkNode { } } None - } + }, NetworkEventInternal::GossipEvent(e) => match *e { GossipEvent::Message { propagation_source: _peer_id, @@ -631,25 +631,25 @@ impl NetworkNode { GossipEvent::Subscribed { peer_id, topic } => { debug!("Peer {:?} subscribed to topic {:?}", peer_id, topic); None - } + }, GossipEvent::Unsubscribed { peer_id, topic } => { debug!("Peer {:?} unsubscribed from topic {:?}", peer_id, topic); None - } + }, GossipEvent::GossipsubNotSupported { peer_id } => { warn!("Peer {:?} does not support gossipsub", peer_id); None - } + }, }, NetworkEventInternal::DMEvent(e) => self .direct_message_state .handle_dm_event(e, self.resend_tx.clone()), NetworkEventInternal::AutonatEvent(e) => { match e { - autonat::Event::InboundProbe(_) => {} + autonat::Event::InboundProbe(_) => {}, autonat::Event::OutboundProbe(e) => match e { autonat::OutboundProbeEvent::Request { .. } - | autonat::OutboundProbeEvent::Response { .. } => {} + | autonat::OutboundProbeEvent::Response { .. } => {}, autonat::OutboundProbeEvent::Error { probe_id: _, peer, @@ -659,14 +659,14 @@ impl NetworkNode { "AutoNAT Probe failed to peer {:?} with error: {:?}", peer, error ); - } + }, }, autonat::Event::StatusChanged { old, new } => { debug!("AutoNAT Status changed. Old: {:?}, New: {:?}", old, new); - } + }, }; None - } + }, }; if let Some(event) = maybe_event { @@ -675,14 +675,14 @@ impl NetworkNode { .send(event) .map_err(|err| NetworkError::ChannelSendError(err.to_string()))?; } - } + }, SwarmEvent::OutgoingConnectionError { connection_id: _, peer_id, error, } => { warn!("Outgoing connection error to {:?}: {:?}", peer_id, error); - } + }, SwarmEvent::IncomingConnectionError { connection_id: _, local_addr: _, @@ -690,29 +690,29 @@ impl NetworkNode { error, } => { warn!("Incoming connection error: {:?}", error); - } + }, SwarmEvent::ListenerError { listener_id: _, error, } => { warn!("Listener error: {:?}", error); - } + }, SwarmEvent::ExternalAddrConfirmed { address } => { let my_id = *self.swarm.local_peer_id(); self.swarm .behaviour_mut() .dht .add_address(&my_id, address.clone()); - } + }, SwarmEvent::NewExternalAddrOfPeer { peer_id, address } => { self.swarm .behaviour_mut() .dht .add_address(&peer_id, address.clone()); - } + }, _ => { debug!("Unhandled swarm event {:?}", event); - } + }, } Ok(()) } diff --git a/hotshot-libp2p-networking/src/network/transport.rs b/hotshot-libp2p-networking/src/network/transport.rs index 01e94e6b90..b69c2c9019 100644 --- a/hotshot-libp2p-networking/src/network/transport.rs +++ b/hotshot-libp2p-networking/src/network/transport.rs @@ -358,7 +358,7 @@ where local_addr, send_back_addr, } - } + }, // We need to re-map the other events because we changed the type of the upgrade TransportEvent::AddressExpired { @@ -377,7 +377,7 @@ where }, TransportEvent::ListenerError { listener_id, error } => { TransportEvent::ListenerError { listener_id, error } - } + }, TransportEvent::NewAddress { listener_id, listen_addr, diff --git a/hotshot-macros/src/lib.rs b/hotshot-macros/src/lib.rs index 3608ef6da1..f318d8e1b0 100644 --- a/hotshot-macros/src/lib.rs +++ b/hotshot-macros/src/lib.rs @@ -118,7 +118,7 @@ impl ToLowerSnakeStr for syn::GenericArgument { syn::Type::Path(p) => p.to_lower_snake_str(), _ => { panic!("Unexpected type for GenericArgument::Type: {t:?}"); - } + }, }, syn::GenericArgument::Const(c) => match c { syn::Expr::Lit(l) => match &l.lit { @@ -126,15 +126,15 @@ impl ToLowerSnakeStr for syn::GenericArgument { syn::Lit::Int(v) => format!("{}_", v.base10_digits()), _ => { panic!("Unexpected type for GenericArgument::Const::Lit: {l:?}"); - } + }, }, _ => { panic!("Unexpected type for GenericArgument::Const: {c:?}"); - } + }, }, _ => { panic!("Unexpected type for GenericArgument: {self:?}"); - } + }, } } } diff --git a/hotshot-orchestrator/src/client.rs b/hotshot-orchestrator/src/client.rs index de167ff505..3c1d8e0884 100644 --- a/hotshot-orchestrator/src/client.rs +++ b/hotshot-orchestrator/src/client.rs @@ -515,7 +515,7 @@ impl OrchestratorClient { Err(err) => { tracing::info!("{err}"); sleep(Duration::from_millis(250)).await; - } + }, } } } diff --git a/hotshot-query-service/src/api.rs b/hotshot-query-service/src/api.rs index 5f447fbb53..85aae097fd 100644 --- a/hotshot-query-service/src/api.rs +++ b/hotshot-query-service/src/api.rs @@ -10,8 +10,7 @@ // You should have received a copy of the GNU General Public License along with this program. If not, // see . -use std::fs; -use std::path::Path; +use std::{fs, path::Path}; use tide_disco::api::{Api, ApiError}; use toml::{map::Entry, Value}; use vbs::version::StaticVersionType; @@ -40,7 +39,7 @@ fn merge_toml(into: &mut Value, from: Value) { Entry::Occupied(mut entry) => merge_toml(entry.get_mut(), value), Entry::Vacant(entry) => { entry.insert(value); - } + }, } } } diff --git a/hotshot-query-service/src/availability.rs b/hotshot-query-service/src/availability.rs index 63122094ea..9c91568939 100644 --- a/hotshot-query-service/src/availability.rs +++ b/hotshot-query-service/src/availability.rs @@ -414,7 +414,7 @@ where .context(FetchTransactionSnafu { resource: hash.to_string(), }) - } + }, None => { let height: u64 = req.integer_param("height")?; let fetch = state @@ -430,7 +430,7 @@ where .context(InvalidTransactionIndexSnafu { height, index: i })?; TransactionQueryData::new(&block, index, i) .context(InvalidTransactionIndexSnafu { height, index: i }) - } + }, } } .boxed() @@ -496,10 +496,8 @@ fn enforce_range_limit(from: usize, until: usize, limit: usize) -> Result<(), Er #[cfg(test)] mod test { use super::*; - use crate::data_source::storage::AvailabilityStorage; - use crate::data_source::VersionedDataSource; use crate::{ - data_source::ExtensibleDataSource, + data_source::{storage::AvailabilityStorage, ExtensibleDataSource, VersionedDataSource}, status::StatusDataSource, task::BackgroundTask, testing::{ @@ -542,7 +540,7 @@ mod test { let leaf = client.get(&format!("leaf/{}", i)).send().await.unwrap(); blocks.push((leaf, block)); } - } + }, Err(Error::Availability { source: super::Error::FetchBlock { .. }, }) => { @@ -550,7 +548,7 @@ mod test { "found end of ledger at height {i}, non-empty blocks are {blocks:?}", ); return (i, blocks); - } + }, Err(err) => panic!("unexpected error {}", err), } } diff --git a/hotshot-query-service/src/availability/query_data.rs b/hotshot-query-service/src/availability/query_data.rs index 6232f7ed70..496b20afe9 100644 --- a/hotshot-query-service/src/availability/query_data.rs +++ b/hotshot-query-service/src/availability/query_data.rs @@ -13,8 +13,7 @@ use crate::{types::HeightIndexed, Header, Metadata, Payload, Transaction, VidCommon, VidShare}; use committable::{Commitment, Committable}; use hotshot_types::{ - data::Leaf, - data::VidCommitment, + data::{Leaf, VidCommitment}, simple_certificate::QuorumCertificate, traits::{ self, diff --git a/hotshot-query-service/src/data_source.rs b/hotshot-query-service/src/data_source.rs index b6c707665d..0d4ac88cce 100644 --- a/hotshot-query-service/src/data_source.rs +++ b/hotshot-query-service/src/data_source.rs @@ -134,9 +134,11 @@ pub mod availability_tests { use committable::Committable; use futures::stream::StreamExt; use hotshot_types::data::Leaf; - use std::collections::HashMap; - use std::fmt::Debug; - use std::ops::{Bound, RangeBounds}; + use std::{ + collections::HashMap, + fmt::Debug, + ops::{Bound, RangeBounds}, + }; async fn validate(ds: &impl TestableDataSource) { // Check the consistency of every block/leaf pair. Keep track of payloads and transactions @@ -777,11 +779,9 @@ pub mod node_tests { use futures::{future::join_all, stream::StreamExt}; use hotshot::traits::BlockPayload; use hotshot_example_types::{ - block_types::TestBlockPayload, node_types::TestTypes, state_types::TestValidatedState, - }; - use hotshot_example_types::{ - block_types::{TestBlockHeader, TestMetadata}, - state_types::TestInstanceState, + block_types::{TestBlockHeader, TestBlockPayload, TestMetadata}, + node_types::TestTypes, + state_types::{TestInstanceState, TestValidatedState}, }; use hotshot_types::{ data::vid_commitment, diff --git a/hotshot-query-service/src/data_source/extension.rs b/hotshot-query-service/src/data_source/extension.rs index 81de4a4293..08968233c9 100644 --- a/hotshot-query-service/src/data_source/extension.rs +++ b/hotshot-query-service/src/data_source/extension.rs @@ -11,7 +11,6 @@ // see . use super::VersionedDataSource; -use crate::data_source::storage::pruning::PrunedHeightDataSource; use crate::{ availability::{ AvailabilityDataSource, BlockId, BlockInfo, BlockQueryData, Fetch, FetchStream, LeafId, @@ -19,6 +18,7 @@ use crate::{ TransactionHash, TransactionQueryData, UpdateAvailabilityData, VidCommonMetadata, VidCommonQueryData, }, + data_source::storage::pruning::PrunedHeightDataSource, explorer::{self, ExplorerDataSource, ExplorerHeader, ExplorerTransaction}, merklized_state::{ MerklizedState, MerklizedStateDataSource, MerklizedStateHeightPersistence, Snapshot, diff --git a/hotshot-query-service/src/data_source/fetching.rs b/hotshot-query-service/src/data_source/fetching.rs index d6a7ce8012..b21ecac2a6 100644 --- a/hotshot-query-service/src/data_source/fetching.rs +++ b/hotshot-query-service/src/data_source/fetching.rs @@ -83,13 +83,12 @@ use super::{ }, Transaction, VersionedDataSource, }; -use crate::availability::HeaderQueryData; use crate::{ availability::{ - AvailabilityDataSource, BlockId, BlockInfo, BlockQueryData, Fetch, FetchStream, LeafId, - LeafQueryData, PayloadMetadata, PayloadQueryData, QueryableHeader, QueryablePayload, - TransactionHash, TransactionQueryData, UpdateAvailabilityData, VidCommonMetadata, - VidCommonQueryData, + AvailabilityDataSource, BlockId, BlockInfo, BlockQueryData, Fetch, FetchStream, + HeaderQueryData, LeafId, LeafQueryData, PayloadMetadata, PayloadQueryData, QueryableHeader, + QueryablePayload, TransactionHash, TransactionQueryData, UpdateAvailabilityData, + VidCommonMetadata, VidCommonQueryData, }, explorer::{self, ExplorerDataSource}, fetching::{self, request, Provider}, @@ -118,13 +117,13 @@ use hotshot_types::traits::{ node_implementation::NodeType, }; use jf_merkle_tree::{prelude::MerkleProof, MerkleTreeScheme}; -use std::sync::Arc; use std::{ cmp::{max, min}, fmt::{Debug, Display}, iter::repeat_with, marker::PhantomData, ops::{Bound, Range, RangeBounds}, + sync::Arc, time::Duration, }; use tagged_base64::TaggedBase64; @@ -463,15 +462,15 @@ where match storage.prune(&mut pruner).await { Ok(Some(height)) => { tracing::warn!("Pruned to height {height}"); - } + }, Ok(None) => { tracing::warn!("pruner run complete."); break; - } + }, Err(e) => { tracing::error!("pruner run failed: {e:?}"); break; - } + }, } } } @@ -966,7 +965,7 @@ where ?req, "unable to fetch object; spawning a task to retry: {err:#}" ); - } + }, } // We'll use this channel to get the object back if we successfully load it on retry. @@ -994,14 +993,14 @@ where tracing::info!(?req, "object was ready after retries"); send.send(obj).ok(); break; - } + }, Ok(None) => { // The object was not immediately available after all, but we have // successfully spawned a fetch for it if possible. The spawned fetch // will notify the original request once it completes. tracing::info!(?req, "spawned fetch after retries"); break; - } + }, Err(err) => { tracing::warn!( ?req, @@ -1012,7 +1011,7 @@ where if let Some(next_delay) = backoff.next_backoff() { delay = next_delay; } - } + }, } } } @@ -1047,12 +1046,12 @@ where tracing::debug!(?req, "object missing from local storage, will try to fetch"); self.fetch::(&mut tx, req).await?; Ok(None) - } + }, Err(err) => { // An error occurred while querying the database. We don't know if we need to fetch // the object or not. Return an error so we can try again. bail!("failed to fetch resource {req:?} from local storage: {err:#}"); - } + }, } } @@ -1213,13 +1212,13 @@ where None => passive(T::Request::from(chunk.start + i), passive_fetch), }) .collect(); - } + }, Err(err) => { tracing::warn!( ?chunk, "unable to fetch chunk; spawning a task to retry: {err:#}" ); - } + }, } // We'll use these channels to get the objects back that we successfully load on retry. @@ -1261,7 +1260,7 @@ where } } break; - } + }, Err(err) => { tracing::warn!( ?chunk, @@ -1272,7 +1271,7 @@ where if let Some(next_delay) = backoff.next_backoff() { delay = next_delay; } - } + }, } } } @@ -1421,7 +1420,7 @@ where backoff = min(2 * backoff, max_backoff); metrics.backoff.set(backoff.as_secs() as usize); continue; - } + }, }; let heights = match Heights::load(&mut tx).await { Ok(heights) => heights, @@ -1432,7 +1431,7 @@ where backoff = min(2 * backoff, max_backoff); metrics.backoff.set(backoff.as_secs() as usize); continue; - } + }, }; metrics.retries.set(0); break heights; @@ -1566,7 +1565,7 @@ where tracing::error!("unable to open read tx: {err:#}"); sleep(Duration::from_secs(5)).await; continue; - } + }, }; match tx.load_prev_aggregate().await { Ok(agg) => break agg, @@ -1574,7 +1573,7 @@ where tracing::error!("unable to load previous aggregate: {err:#}"); sleep(Duration::from_secs(5)).await; continue; - } + }, } }; @@ -1618,7 +1617,7 @@ where match res { Ok(()) => { break; - } + }, Err(err) => { tracing::warn!( num_blocks, @@ -1626,7 +1625,7 @@ where "failed to update aggregates for chunk: {err:#}" ); sleep(Duration::from_secs(1)).await; - } + }, } } metrics.height.set(height as usize); @@ -2190,7 +2189,7 @@ impl ResultExt for Result { "error loading resource from local storage, will try to fetch: {err:#}" ); None - } + }, } } } @@ -2309,7 +2308,7 @@ where // dropped. If this happens, things are very broken in any case, and it is // better to panic loudly than simply block forever. panic!("notifier dropped without satisfying request {req:?}"); - } + }, } }) .boxed(), diff --git a/hotshot-query-service/src/data_source/fetching/header.rs b/hotshot-query-service/src/data_source/fetching/header.rs index 6782fb5d37..948ccbe458 100644 --- a/hotshot-query-service/src/data_source/fetching/header.rs +++ b/hotshot-query-service/src/data_source/fetching/header.rs @@ -16,32 +16,25 @@ use super::{ block::fetch_block_with_header, leaf::fetch_leaf_with_callbacks, vid::fetch_vid_common_with_header, AvailabilityProvider, Fetcher, }; -use crate::data_source::fetching::Fetchable; -use crate::data_source::fetching::HeaderQueryData; -use crate::data_source::fetching::LeafQueryData; -use crate::data_source::fetching::Notifiers; -use crate::QueryResult; use crate::{ availability::{BlockId, QueryablePayload}, data_source::{ + fetching::{Fetchable, HeaderQueryData, LeafQueryData, Notifiers}, storage::{ pruning::PrunedHeightStorage, AvailabilityStorage, NodeStorage, UpdateAvailabilityStorage, }, update::VersionedDataSource, }, - Header, Payload, QueryError, + Header, Payload, QueryError, QueryResult, }; use anyhow::bail; use async_trait::async_trait; use committable::Committable; use derivative::Derivative; -use futures::future::BoxFuture; -use futures::FutureExt; +use futures::{future::BoxFuture, FutureExt}; use hotshot_types::traits::{block_contents::BlockHeader, node_implementation::NodeType}; -use std::cmp::Ordering; -use std::future::IntoFuture; -use std::sync::Arc; +use std::{cmp::Ordering, future::IntoFuture, sync::Arc}; impl From> for HeaderQueryData { fn from(leaf: LeafQueryData) -> Self { @@ -188,14 +181,14 @@ where header.block_number() ); fetch_block_with_header(fetcher, header); - } + }, Self::VidCommon { fetcher } => { tracing::info!( "fetched leaf {}, will now fetch VID common", header.block_number() ); fetch_vid_common_with_header(fetcher, header); - } + }, } } } @@ -225,17 +218,17 @@ where Ok(header) => { callback.run(header); return Ok(()); - } + }, Err(QueryError::Missing | QueryError::NotFound) => { // We successfully queried the database, but the header wasn't there. Fall through to // fetching it. tracing::debug!(?req, "header not available locally; trying fetch"); - } + }, Err(QueryError::Error { message }) => { // An error occurred while querying the database. We don't know if we need to fetch the // header or not. Return an error so we can try again. bail!("failed to fetch header for block {req:?}: {message}"); - } + }, } // If the header is _not_ present, we may still be able to fetch the request, but we need to @@ -245,16 +238,16 @@ where match req { BlockId::Number(n) => { fetch_leaf_with_callbacks(tx, callback.fetcher(), n.into(), [callback.into()]).await?; - } + }, BlockId::Hash(h) => { // Given only the hash, we cannot tell if the corresponding leaf actually exists, since // we don't have a corresponding header. Therefore, we will not spawn an active fetch. tracing::debug!("not fetching unknown block {h}"); - } + }, BlockId::PayloadHash(h) => { // Same as above, we don't fetch a block with a payload that is not known to exist. tracing::debug!("not fetching block with unknown payload {h}"); - } + }, } Ok(()) diff --git a/hotshot-query-service/src/data_source/fetching/leaf.rs b/hotshot-query-service/src/data_source/fetching/leaf.rs index 3692d01851..fb714defda 100644 --- a/hotshot-query-service/src/data_source/fetching/leaf.rs +++ b/hotshot-query-service/src/data_source/fetching/leaf.rs @@ -36,8 +36,7 @@ use derivative::Derivative; use derive_more::From; use futures::future::{BoxFuture, FutureExt}; use hotshot_types::traits::node_implementation::NodeType; -use std::sync::Arc; -use std::{cmp::Ordering, future::IntoFuture, iter::once, ops::RangeBounds}; +use std::{cmp::Ordering, future::IntoFuture, iter::once, ops::RangeBounds, sync::Arc}; use tokio::spawn; use tracing::Instrument; @@ -172,19 +171,19 @@ where callbacks, ); return Ok(()); - } + }, Err(QueryError::Missing | QueryError::NotFound) => { // We successfully queried the database, but the next leaf wasn't there. We // know for sure that based on the current state of the DB, we cannot fetch this // leaf. tracing::debug!(n, "not fetching leaf with unknown successor"); return Ok(()); - } + }, Err(QueryError::Error { message }) => { // An error occurred while querying the database. We don't know if we need to // fetch the leaf or not. Return an error so we can try again. bail!("failed to fetch successor for leaf {n}: {message}"); - } + }, }; let fetcher = fetcher.clone(); @@ -197,13 +196,13 @@ where fetcher.provider.clone(), once(LeafCallback::Leaf { fetcher }).chain(callbacks), ); - } + }, LeafId::Hash(h) => { // We don't actively fetch leaves when requested by hash, because we have no way of // knowing whether a leaf with such a hash actually exists, and we don't want to bother // peers with requests for non-existent leaves. tracing::debug!("not fetching unknown leaf {h}"); - } + }, } Ok(()) @@ -262,7 +261,7 @@ pub(super) fn trigger_fetch_for_parent( if tx.get_leaf(((height - 1) as usize).into()).await.is_ok() { return; } - } + }, Err(err) => { // If we can't open a transaction, we can't be sure that we already have the // parent, so we fall through to fetching it just to be safe. @@ -271,7 +270,7 @@ pub(super) fn trigger_fetch_for_parent( %parent, "error opening transaction to check for parent leaf: {err:#}", ); - } + }, } tracing::info!(height, %parent, "received new leaf; fetching missing parent"); @@ -369,7 +368,7 @@ impl Ord for LeafCallback { (Self::Continuation { callback: cb1 }, Self::Continuation { callback: cb2 }) => { cb1.cmp(cb2) - } + }, _ => Ordering::Equal, } } @@ -396,7 +395,7 @@ where // Trigger a fetch of the parent leaf, if we don't already have it. trigger_fetch_for_parent(&fetcher, &leaf); fetcher.store_and_notify(leaf).await; - } + }, Self::Continuation { callback } => callback.run(leaf.leaf.block_header().clone()), } } diff --git a/hotshot-query-service/src/data_source/fetching/vid.rs b/hotshot-query-service/src/data_source/fetching/vid.rs index 7849ba2a77..29c6d5c2a6 100644 --- a/hotshot-query-service/src/data_source/fetching/vid.rs +++ b/hotshot-query-service/src/data_source/fetching/vid.rs @@ -35,8 +35,7 @@ use derivative::Derivative; use derive_more::From; use futures::future::{BoxFuture, FutureExt}; use hotshot_types::traits::{block_contents::BlockHeader, node_implementation::NodeType}; -use std::sync::Arc; -use std::{cmp::Ordering, future::IntoFuture, iter::once, ops::RangeBounds}; +use std::{cmp::Ordering, future::IntoFuture, iter::once, ops::RangeBounds, sync::Arc}; pub(super) type VidCommonFetcher = fetching::Fetcher>; diff --git a/hotshot-query-service/src/data_source/metrics.rs b/hotshot-query-service/src/data_source/metrics.rs index a539673a10..16e61a3a38 100644 --- a/hotshot-query-service/src/data_source/metrics.rs +++ b/hotshot-query-service/src/data_source/metrics.rs @@ -112,8 +112,7 @@ mod impl_testable_data_source { #[cfg(test)] mod test { - use super::super::status_tests; - use super::MetricsDataSource; + use super::{super::status_tests, MetricsDataSource}; // For some reason this is the only way to import the macro defined in another module of this // crate. diff --git a/hotshot-query-service/src/data_source/notifier.rs b/hotshot-query-service/src/data_source/notifier.rs index a21e497c9f..24ed3982eb 100644 --- a/hotshot-query-service/src/data_source/notifier.rs +++ b/hotshot-query-service/src/data_source/notifier.rs @@ -73,13 +73,17 @@ use async_lock::Mutex; use derivative::Derivative; use futures::future::{BoxFuture, FutureExt}; -use std::sync::Arc; use std::{ future::IntoFuture, - sync::atomic::{AtomicBool, Ordering}, + sync::{ + atomic::{AtomicBool, Ordering}, + Arc, + }, +}; +use tokio::sync::{ + mpsc::{unbounded_channel, UnboundedReceiver, UnboundedSender}, + oneshot, }; -use tokio::sync::mpsc::{unbounded_channel, UnboundedReceiver, UnboundedSender}; -use tokio::sync::oneshot; use tracing::warn; /// A predicate on a type ``. diff --git a/hotshot-query-service/src/data_source/storage/fail_storage.rs b/hotshot-query-service/src/data_source/storage/fail_storage.rs index 1b366bd6b2..e377c76bce 100644 --- a/hotshot-query-service/src/data_source/storage/fail_storage.rs +++ b/hotshot-query-service/src/data_source/storage/fail_storage.rs @@ -35,8 +35,7 @@ use async_lock::Mutex; use async_trait::async_trait; use futures::future::Future; use hotshot_types::traits::node_implementation::NodeType; -use std::ops::RangeBounds; -use std::sync::Arc; +use std::{ops::RangeBounds, sync::Arc}; /// A specific action that can be targeted to inject an error. #[derive(Clone, Copy, Debug, PartialEq, Eq)] @@ -86,8 +85,8 @@ impl FailureMode { match self { Self::Once(fail_action) if fail_action.matches(action) => { *self = Self::Never; - } - Self::Always(fail_action) if fail_action.matches(action) => {} + }, + Self::Always(fail_action) if fail_action.matches(action) => {}, _ => return Ok(()), } diff --git a/hotshot-query-service/src/data_source/storage/fs.rs b/hotshot-query-service/src/data_source/storage/fs.rs index 296261666b..3ed3ec21ef 100644 --- a/hotshot-query-service/src/data_source/storage/fs.rs +++ b/hotshot-query-service/src/data_source/storage/fs.rs @@ -43,13 +43,15 @@ use futures::future::Future; use hotshot_types::traits::{block_contents::BlockHeader, node_implementation::NodeType}; use serde::{de::DeserializeOwned, Serialize}; use snafu::OptionExt; -use std::collections::{ - hash_map::{Entry, HashMap}, - BTreeMap, +use std::{ + collections::{ + hash_map::{Entry, HashMap}, + BTreeMap, + }, + hash::Hash, + ops::{Bound, Deref, RangeBounds}, + path::Path, }; -use std::hash::Hash; -use std::ops::{Bound, Deref, RangeBounds}; -use std::path::Path; const CACHED_LEAVES_COUNT: usize = 100; const CACHED_BLOCKS_COUNT: usize = 100; @@ -85,10 +87,10 @@ where BlockId::Number(n) => Ok(n), BlockId::Hash(h) => { Ok(*self.index_by_block_hash.get(&h).context(NotFoundSnafu)? as usize) - } + }, BlockId::PayloadHash(h) => { Ok(*self.index_by_payload_hash.get(&h).context(NotFoundSnafu)? as usize) - } + }, } } @@ -392,11 +394,11 @@ where iter.nth(n - 1); } n - } + }, Bound::Excluded(n) => { iter.nth(n); n + 1 - } + }, Bound::Unbounded => 0, }; @@ -649,10 +651,10 @@ fn update_index_by_hash(index: &mut HashMap, hash: H // Overwrite the existing entry if the new object was sequenced first. e.insert(pos); } - } + }, Entry::Vacant(e) => { e.insert(pos); - } + }, } } @@ -759,7 +761,7 @@ where // entry in `index_by_time` has a non-empty list associated with it, so this // indexing is safe. blocks[0] - } + }, } as usize; let mut res = TimeWindowQueryData::default(); diff --git a/hotshot-query-service/src/data_source/storage/ledger_log.rs b/hotshot-query-service/src/data_source/storage/ledger_log.rs index 4ff798ee52..fe30f17100 100644 --- a/hotshot-query-service/src/data_source/storage/ledger_log.rs +++ b/hotshot-query-service/src/data_source/storage/ledger_log.rs @@ -16,8 +16,7 @@ use atomic_store::{ append_log, load_store::BincodeLoadStore, AppendLog, AtomicStoreLoader, PersistenceError, }; use serde::{de::DeserializeOwned, Serialize}; -use std::collections::VecDeque; -use std::fmt::Debug; +use std::{collections::VecDeque, fmt::Debug}; use tracing::{debug, warn}; /// A caching append log for ledger objects. diff --git a/hotshot-query-service/src/data_source/storage/sql.rs b/hotshot-query-service/src/data_source/storage/sql.rs index 3bb20aa98a..cf9b12c0d5 100644 --- a/hotshot-query-service/src/data_source/storage/sql.rs +++ b/hotshot-query-service/src/data_source/storage/sql.rs @@ -571,11 +571,11 @@ impl SqlStorage { match runner.run_async(&mut Migrator::from(&mut conn)).await { Ok(report) => { tracing::info!("ran DB migrations: {report:?}"); - } + }, Err(err) => { tracing::error!("DB migrations failed: {:?}", err.report()); Err(err)?; - } + }, } } @@ -703,7 +703,7 @@ impl PruneStorage for SqlStorage { }; height - } + }, }; // Prune data exceeding target retention in batches @@ -821,8 +821,7 @@ pub mod testing { str::{self, FromStr}, time::Duration, }; - use tokio::net::TcpStream; - use tokio::time::timeout; + use tokio::{net::TcpStream, time::timeout}; use portpicker::pick_unused_port; diff --git a/hotshot-query-service/src/data_source/storage/sql/queries.rs b/hotshot-query-service/src/data_source/storage/sql/queries.rs index b8c227b752..c7845752a9 100644 --- a/hotshot-query-service/src/data_source/storage/sql/queries.rs +++ b/hotshot-query-service/src/data_source/storage/sql/queries.rs @@ -138,20 +138,20 @@ impl QueryBuilder<'_> { match range.start_bound() { Bound::Included(n) => { bounds.push(format!("{column} >= {}", self.bind(*n as i64)?)); - } + }, Bound::Excluded(n) => { bounds.push(format!("{column} > {}", self.bind(*n as i64)?)); - } - Bound::Unbounded => {} + }, + Bound::Unbounded => {}, } match range.end_bound() { Bound::Included(n) => { bounds.push(format!("{column} <= {}", self.bind(*n as i64)?)); - } + }, Bound::Excluded(n) => { bounds.push(format!("{column} < {}", self.bind(*n as i64)?)); - } - Bound::Unbounded => {} + }, + Bound::Unbounded => {}, } let mut where_clause = bounds.join(" AND "); diff --git a/hotshot-query-service/src/data_source/storage/sql/queries/availability.rs b/hotshot-query-service/src/data_source/storage/sql/queries/availability.rs index 759296fb87..f6c02009fc 100644 --- a/hotshot-query-service/src/data_source/storage/sql/queries/availability.rs +++ b/hotshot-query-service/src/data_source/storage/sql/queries/availability.rs @@ -17,13 +17,14 @@ use super::{ QueryBuilder, BLOCK_COLUMNS, LEAF_COLUMNS, PAYLOAD_COLUMNS, PAYLOAD_METADATA_COLUMNS, VID_COMMON_COLUMNS, VID_COMMON_METADATA_COLUMNS, }; -use crate::data_source::storage::sql::sqlx::Row; use crate::{ availability::{ BlockId, BlockQueryData, LeafId, LeafQueryData, PayloadQueryData, QueryableHeader, QueryablePayload, TransactionHash, TransactionQueryData, VidCommonQueryData, }, - data_source::storage::{AvailabilityStorage, PayloadMetadata, VidCommonMetadata}, + data_source::storage::{ + sql::sqlx::Row, AvailabilityStorage, PayloadMetadata, VidCommonMetadata, + }, types::HeightIndexed, ErrorSnafu, Header, MissingSnafu, Payload, QueryError, QueryResult, }; diff --git a/hotshot-query-service/src/data_source/storage/sql/queries/explorer.rs b/hotshot-query-service/src/data_source/storage/sql/queries/explorer.rs index 14fb489a00..0e1fef4c6f 100644 --- a/hotshot-query-service/src/data_source/storage/sql/queries/explorer.rs +++ b/hotshot-query-service/src/data_source/storage/sql/queries/explorer.rs @@ -282,7 +282,7 @@ where let query_stmt = match request.target { BlockIdentifier::Latest => { query(&GET_BLOCK_SUMMARIES_QUERY_FOR_LATEST).bind(request.num_blocks.get() as i64) - } + }, BlockIdentifier::Height(height) => query(&GET_BLOCK_SUMMARIES_QUERY_FOR_HEIGHT) .bind(height as i64) .bind(request.num_blocks.get() as i64), @@ -305,10 +305,10 @@ where BlockIdentifier::Latest => query(&GET_BLOCK_DETAIL_QUERY_FOR_LATEST), BlockIdentifier::Height(height) => { query(&GET_BLOCK_DETAIL_QUERY_FOR_HEIGHT).bind(height as i64) - } + }, BlockIdentifier::Hash(hash) => { query(&GET_BLOCK_DETAIL_QUERY_FOR_HASH).bind(hash.to_string()) - } + }, }; let query_result = query_stmt.fetch_one(self.as_mut()).await?; @@ -375,7 +375,7 @@ where TransactionSummaryFilter::Block(block) => { query(&GET_TRANSACTION_SUMMARIES_QUERY_FOR_BLOCK).bind(*block as i64) - } + }, }; let block_stream = query_stmt @@ -432,10 +432,10 @@ where query(&GET_TRANSACTION_DETAIL_QUERY_FOR_HEIGHT_AND_OFFSET) .bind(height as i64) .bind(offset as i64) - } + }, TransactionIdentifier::Hash(hash) => { query(&GET_TRANSACTION_DETAIL_QUERY_FOR_HASH).bind(hash.to_string()) - } + }, }; let query_row = query_stmt.fetch_one(self.as_mut()).await?; @@ -455,7 +455,7 @@ where key: format!("at {height} and {offset}"), }), ) - } + }, TransactionIdentifier::Hash(hash) => txns .into_iter() .enumerate() diff --git a/hotshot-query-service/src/data_source/storage/sql/queries/node.rs b/hotshot-query-service/src/data_source/storage/sql/queries/node.rs index ca8874c179..b2a446599e 100644 --- a/hotshot-query-service/src/data_source/storage/sql/queries/node.rs +++ b/hotshot-query-service/src/data_source/storage/sql/queries/node.rs @@ -47,11 +47,11 @@ where // The height of the block is the number of blocks below it, so the total number of // blocks is one more than the height of the highest block. Ok(height as usize + 1) - } + }, (None,) => { // If there are no blocks yet, the height is 0. Ok(0) - } + }, } } @@ -171,11 +171,11 @@ where // The height of the block is the number of blocks below it, so the total number of // blocks is one more than the height of the highest block. height as usize + 1 - } + }, None => { // If there are no blocks yet, the height is 0. 0 - } + }, }; let total_leaves = row.get::("total_leaves") as usize; let null_payloads = row.get::("null_payloads") as usize; @@ -213,7 +213,7 @@ where // sufficient data to answer the query is not as simple as just trying `load_header` // for a specific block ID. return self.time_window::(t, end, limit).await; - } + }, WindowStart::Height(h) => h, WindowStart::Hash(h) => self.load_header::(h).await?.block_number(), }; @@ -476,7 +476,7 @@ async fn aggregate_range_bounds( return Ok(None); } height - 1 - } + }, }; Ok(Some((from, to))) } diff --git a/hotshot-query-service/src/data_source/storage/sql/queries/state.rs b/hotshot-query-service/src/data_source/storage/sql/queries/state.rs index 4e3d41d141..0d0ff44415 100644 --- a/hotshot-query-service/src/data_source/storage/sql/queries/state.rs +++ b/hotshot-query-service/src/data_source/storage/sql/queries/state.rs @@ -16,10 +16,12 @@ use super::{ super::transaction::{query_as, Transaction, TransactionMode, Write}, DecodeError, QueryBuilder, }; -use crate::data_source::storage::sql::sqlx::Row; -use crate::data_source::storage::{pruning::PrunedHeightStorage, sql::build_where_in}; use crate::{ - data_source::storage::{MerklizedStateHeightStorage, MerklizedStateStorage}, + data_source::storage::{ + pruning::PrunedHeightStorage, + sql::{build_where_in, sqlx::Row}, + MerklizedStateHeightStorage, MerklizedStateStorage, + }, merklized_state::{MerklizedState, Snapshot}, QueryError, QueryResult, }; @@ -31,10 +33,11 @@ use jf_merkle_tree::{ prelude::{MerkleNode, MerkleProof}, DigestAlgorithm, MerkleCommitment, ToTraversalPath, }; -use sqlx::types::BitVec; -use sqlx::types::JsonValue; -use std::collections::{HashMap, HashSet, VecDeque}; -use std::sync::Arc; +use sqlx::types::{BitVec, JsonValue}; +use std::{ + collections::{HashMap, HashSet, VecDeque}, + sync::Arc, +}; #[async_trait] impl MerklizedStateStorage @@ -148,7 +151,7 @@ where .decode_error("malformed merkle node value")?, children: child_nodes, }); - } + }, // If it has an entry, it's a leaf (None, None, Some(index), Some(entry)) => { proof_path.push_back(MerkleNode::Leaf { @@ -159,16 +162,16 @@ where elem: serde_json::from_value(entry.clone()) .decode_error("malformed merkle element")?, }); - } + }, // Otherwise, it's empty. (None, None, Some(_), None) => { proof_path.push_back(MerkleNode::Empty); - } + }, _ => { return Err(QueryError::Error { message: "Invalid type of merkle node found".to_string(), }); - } + }, } } } @@ -223,7 +226,7 @@ where State::Digest::digest(&data).map_err(|err| QueryError::Error { message: format!("failed to update digest: {err:#}"), }) - } + }, MerkleNode::Empty => Ok(init), _ => Err(QueryError::Error { message: "Invalid type of Node in the proof".to_string(), @@ -292,7 +295,7 @@ impl Transaction { .await?; (height, commit) - } + }, Snapshot::Index(created) => { let created = created as i64; let (commit,) = query_as::<(String,)>(&format!( @@ -307,7 +310,7 @@ impl Transaction { let commit = serde_json::from_value(commit.into()) .decode_error("malformed state commitment")?; (created, commit) - } + }, }; // Make sure the requested snapshot is up to date. diff --git a/hotshot-query-service/src/data_source/storage/sql/transaction.rs b/hotshot-query-service/src/data_source/storage/sql/transaction.rs index efeea128e6..50d979f2fa 100644 --- a/hotshot-query-service/src/data_source/storage/sql/transaction.rs +++ b/hotshot-query-service/src/data_source/storage/sql/transaction.rs @@ -52,9 +52,10 @@ use hotshot_types::traits::{ }; use itertools::Itertools; use jf_merkle_tree::prelude::{MerkleNode, MerkleProof}; -use sqlx::types::BitVec; pub use sqlx::Executor; -use sqlx::{pool::Pool, query_builder::Separated, Encode, FromRow, QueryBuilder, Type}; +use sqlx::{ + pool::Pool, query_builder::Separated, types::BitVec, Encode, FromRow, QueryBuilder, Type, +}; use std::{ collections::{HashMap, HashSet}, marker::PhantomData, @@ -673,10 +674,10 @@ impl, const ARITY: usize> [0_u8; 32].to_vec(), )); hashset.insert([0_u8; 32].to_vec()); - } + }, MerkleNode::ForgettenSubtree { .. } => { bail!("Node in the Merkle path contains a forgetten subtree"); - } + }, MerkleNode::Leaf { value, pos, elem } => { let mut leaf_commit = Vec::new(); // Serialize the leaf node hash value into a vector @@ -703,7 +704,7 @@ impl, const ARITY: usize> )); hashset.insert(leaf_commit); - } + }, MerkleNode::Branch { value, children } => { // Get hash let mut branch_hash = Vec::new(); @@ -720,7 +721,7 @@ impl, const ARITY: usize> match child { MerkleNode::Empty => { children_bitvec.push(false); - } + }, MerkleNode::Branch { value, .. } | MerkleNode::Leaf { value, .. } | MerkleNode::ForgettenSubtree { value } => { @@ -732,7 +733,7 @@ impl, const ARITY: usize> children_values.push(hash); // Mark the entry as 1 in bitvec to indicate a non-empty child children_bitvec.push(true); - } + }, } } @@ -750,7 +751,7 @@ impl, const ARITY: usize> )); hashset.insert(branch_hash); hashset.extend(children_values); - } + }, } // advance the traversal path for the internal nodes at each iteration @@ -790,7 +791,7 @@ impl, const ARITY: usize> } } - Node::upsert(name, nodes.into_iter().map(|(n, _, _)| n), self).await?; + Node::upsert(name, nodes.into_iter().map(|(n, ..)| n), self).await?; Ok(()) } diff --git a/hotshot-query-service/src/data_source/update.rs b/hotshot-query-service/src/data_source/update.rs index b1ddd13033..7b4398cd7e 100644 --- a/hotshot-query-service/src/data_source/update.rs +++ b/hotshot-query-service/src/data_source/update.rs @@ -23,17 +23,14 @@ use async_trait::async_trait; use futures::future::Future; use hotshot::types::{Event, EventType}; use hotshot_types::{ - data::{Leaf, Leaf2, QuorumProposal}, + data::{Leaf, Leaf2, QuorumProposal, VidCommitment, VidDisperseShare}, + event::LeafInfo, traits::{ block_contents::{BlockHeader, BlockPayload, EncodeBytes, GENESIS_VID_NUM_STORAGE_NODES}, node_implementation::{ConsensusTime, NodeType}, }, vid::advz::advz_scheme, }; -use hotshot_types::{ - data::{VidCommitment, VidDisperseShare}, - event::LeafInfo, -}; use jf_vid::VidScheme; use std::iter::once; @@ -129,7 +126,7 @@ where "inconsistent leaf; cannot append leaf information: {err:#}" ); return Err(leaf.block_header().block_number()); - } + }, }; let block_data = leaf .block_payload() @@ -161,12 +158,12 @@ where Err(err) => { tracing::warn!("failed to compute genesis VID: {err:#}"); (None, None) - } + }, } } else { (None, None) } - } + }, }; if vid_common.is_none() { diff --git a/hotshot-query-service/src/explorer.rs b/hotshot-query-service/src/explorer.rs index 03ca26323c..9b3bc40382 100644 --- a/hotshot-query-service/src/explorer.rs +++ b/hotshot-query-service/src/explorer.rs @@ -18,8 +18,11 @@ pub(crate) mod query_data; pub(crate) mod traits; use self::errors::InvalidLimit; -use crate::availability::{QueryableHeader, QueryablePayload}; -use crate::{api::load_api, Header, Payload, Transaction}; +use crate::{ + api::load_api, + availability::{QueryableHeader, QueryablePayload}, + Header, Payload, Transaction, +}; pub use currency::*; pub use data_source::*; @@ -28,11 +31,8 @@ use hotshot_types::traits::node_implementation::NodeType; pub use monetary_value::*; pub use query_data::*; use serde::{Deserialize, Serialize}; -use std::fmt::Display; -use std::num::NonZeroUsize; -use std::path::Path; -use tide_disco::StatusCode; -use tide_disco::{api::ApiError, method::ReadState, Api}; +use std::{fmt::Display, num::NonZeroUsize, path::Path}; +use tide_disco::{api::ApiError, method::ReadState, Api, StatusCode}; pub use traits::*; use vbs::version::StaticVersionType; @@ -308,7 +308,7 @@ where ) { (Ok(Some(height)), Ok(Some(offset)), _) => { TransactionIdentifier::HeightAndOffset(height, offset) - } + }, (_, _, Ok(Some(hash))) => TransactionIdentifier::Hash(hash), _ => TransactionIdentifier::Latest, }, @@ -341,7 +341,7 @@ where ) { (Ok(Some(height)), Ok(Some(offset)), _) => { TransactionIdentifier::HeightAndOffset(height, offset) - } + }, (_, _, Ok(Some(hash))) => TransactionIdentifier::Hash(hash), _ => TransactionIdentifier::Latest, }; diff --git a/hotshot-query-service/src/explorer/currency.rs b/hotshot-query-service/src/explorer/currency.rs index 2e128d17e9..021255fea3 100644 --- a/hotshot-query-service/src/explorer/currency.rs +++ b/hotshot-query-service/src/explorer/currency.rs @@ -11,8 +11,7 @@ // see . use super::errors::ExplorerAPIError; -use serde::ser::SerializeStruct; -use serde::{Deserialize, Serialize, Serializer}; +use serde::{ser::SerializeStruct, Deserialize, Serialize, Serializer}; use std::fmt::Display; /// CurrencyMismatchError is an error that occurs when two different currencies diff --git a/hotshot-query-service/src/explorer/errors.rs b/hotshot-query-service/src/explorer/errors.rs index 90c6a0ac1d..896aea9393 100644 --- a/hotshot-query-service/src/explorer/errors.rs +++ b/hotshot-query-service/src/explorer/errors.rs @@ -10,8 +10,7 @@ // You should have received a copy of the GNU General Public License along with this program. If not, // see . -use serde::ser::SerializeStruct; -use serde::{Deserialize, Serialize, Serializer}; +use serde::{ser::SerializeStruct, Deserialize, Serialize, Serializer}; use std::fmt::{Debug, Display}; use tide_disco::StatusCode; @@ -417,7 +416,7 @@ mod test { let want = query_error; match &have.error { - crate::QueryError::NotFound => {} + crate::QueryError::NotFound => {}, _ => panic!("deserialized QueryError mismatch: have: {have}, want: {want}"), } } diff --git a/hotshot-query-service/src/explorer/monetary_value.rs b/hotshot-query-service/src/explorer/monetary_value.rs index 399e18e021..78f4b761f1 100644 --- a/hotshot-query-service/src/explorer/monetary_value.rs +++ b/hotshot-query-service/src/explorer/monetary_value.rs @@ -13,9 +13,8 @@ use super::currency::{CurrencyCode, CurrencyMismatchError}; use itertools::Itertools; use serde::{Deserialize, Serialize, Serializer}; -use std::fmt::Display; use std::{ - fmt::Debug, + fmt::{Debug, Display}, ops::{Add, Sub}, }; @@ -195,7 +194,7 @@ where return Err(E::custom( "no non-breaking space found in expected MonetaryValue", )) - } + }, }; let first: String = value.chars().take(index).collect(); @@ -244,7 +243,7 @@ fn determine_pre_and_post_decimal_strings(value: &str) -> (String, Option { panic!("{} failed to parse: {}", value, err); - } + }, Ok(result) => result, }; @@ -436,7 +435,7 @@ mod test { let result = match result { Err(err) => { panic!("{} failed to parse: {}", value, err); - } + }, Ok(result) => result, }; diff --git a/hotshot-query-service/src/explorer/query_data.rs b/hotshot-query-service/src/explorer/query_data.rs index 7b4f0b3de7..a14bcacfaf 100644 --- a/hotshot-query-service/src/explorer/query_data.rs +++ b/hotshot-query-service/src/explorer/query_data.rs @@ -17,9 +17,10 @@ use super::{ }; use crate::{ availability::{BlockQueryData, QueryableHeader, QueryablePayload, TransactionHash}, + node::BlockHash, + types::HeightIndexed, Header, Payload, Resolvable, Transaction, }; -use crate::{node::BlockHash, types::HeightIndexed}; use hotshot_types::traits::node_implementation::NodeType; use serde::{Deserialize, Serialize}; use std::{ @@ -79,7 +80,7 @@ impl Display for TransactionIdentifier { TransactionIdentifier::Latest => write!(f, "latest"), TransactionIdentifier::HeightAndOffset(height, offset) => { write!(f, "{} {}", height, offset) - } + }, TransactionIdentifier::Hash(hash) => write!(f, "{}", hash), } } diff --git a/hotshot-query-service/src/fetching.rs b/hotshot-query-service/src/fetching.rs index 427f482553..ce1237ab01 100644 --- a/hotshot-query-service/src/fetching.rs +++ b/hotshot-query-service/src/fetching.rs @@ -21,8 +21,7 @@ //! implementations of [`Provider`] for various data availability sources. //! -use async_lock::Mutex; -use async_lock::Semaphore; +use async_lock::{Mutex, Semaphore}; use backoff::{backoff::Backoff, ExponentialBackoff}; use derivative::Derivative; use std::{ @@ -122,12 +121,12 @@ impl Fetcher { e.get_mut().extend(callbacks); tracing::info!(?req, callbacks = ?e.get(), "resource is already being fetched"); return; - } + }, Entry::Vacant(e) => { // If the object is not being fetched, we will register our own callback and // then fetch it ourselves. e.insert(callbacks.into_iter().collect()); - } + }, } } diff --git a/hotshot-query-service/src/fetching/provider/any.rs b/hotshot-query-service/src/fetching/provider/any.rs index c1112cefe2..5f8b4927cd 100644 --- a/hotshot-query-service/src/fetching/provider/any.rs +++ b/hotshot-query-service/src/fetching/provider/any.rs @@ -20,8 +20,7 @@ use crate::{ use async_trait::async_trait; use derivative::Derivative; use hotshot_types::traits::node_implementation::NodeType; -use std::fmt::Debug; -use std::sync::Arc; +use std::{fmt::Debug, sync::Arc}; /// Blanket trait combining [`Debug`] and [`Provider`]. /// @@ -191,7 +190,7 @@ where providers.len() ); continue; - } + }, } } diff --git a/hotshot-query-service/src/fetching/provider/query_service.rs b/hotshot-query-service/src/fetching/provider/query_service.rs index 8e42bce3fd..39227b5671 100644 --- a/hotshot-query-service/src/fetching/provider/query_service.rs +++ b/hotshot-query-service/src/fetching/provider/query_service.rs @@ -78,7 +78,7 @@ where Err(err) => { tracing::error!(%err, "unable to compute VID commitment"); return None; - } + }, }, ); if commit != req.0 { @@ -90,11 +90,11 @@ where } Some(payload.data) - } + }, Err(err) => { tracing::error!("failed to fetch payload {req:?}: {err}"); None - } + }, } } } @@ -133,11 +133,11 @@ where leaf.leaf.unfill_block_payload(); Some(leaf) - } + }, Err(err) => { tracing::error!("failed to fetch leaf {req:?}: {err}"); None - } + }, } } } @@ -170,18 +170,18 @@ where tracing::error!(?req, ?res, "Expect VID common data but found None"); None } - } + }, VidCommitment::V1(_) => { if res.common.is_some() { tracing::warn!(?req, ?res, "Expect no VID common data but found some.") } None - } + }, }, Err(err) => { tracing::error!("failed to fetch VID common {req:?}: {err}"); None - } + }, } } } @@ -1155,7 +1155,7 @@ mod test { .as_ref() .fail_begins_writable(FailableAction::Any) .await - } + }, FailureType::Write => data_source.as_ref().fail_writes(FailableAction::Any).await, FailureType::Commit => data_source.as_ref().fail_commits(FailableAction::Any).await, } @@ -1253,19 +1253,19 @@ mod test { .as_ref() .fail_one_begin_writable(FailableAction::Any) .await - } + }, FailureType::Write => { data_source .as_ref() .fail_one_write(FailableAction::Any) .await - } + }, FailureType::Commit => { data_source .as_ref() .fail_one_commit(FailableAction::Any) .await - } + }, } assert_eq!(leaves[0], data_source.get_leaf(1).await.await); @@ -1796,7 +1796,7 @@ mod test { for (leaf, payload) in leaves.iter().zip(payloads) { assert_eq!(payload.block_hash, leaf.block_hash()); } - } + }, MetadataType::Vid => { let vids = data_source.subscribe_vid_common_metadata(1).await.take(3); @@ -1809,7 +1809,7 @@ mod test { for (leaf, vid) in leaves.iter().zip(vids) { assert_eq!(vid.block_hash, leaf.block_hash()); } - } + }, } } diff --git a/hotshot-query-service/src/fetching/provider/testing.rs b/hotshot-query-service/src/fetching/provider/testing.rs index 22803d7d19..277cd6a55e 100644 --- a/hotshot-query-service/src/fetching/provider/testing.rs +++ b/hotshot-query-service/src/fetching/provider/testing.rs @@ -18,10 +18,12 @@ use async_lock::RwLock; use async_trait::async_trait; use derivative::Derivative; use hotshot_types::traits::node_implementation::NodeType; -use std::sync::Arc; use std::{ fmt::Debug, - sync::atomic::{AtomicBool, Ordering}, + sync::{ + atomic::{AtomicBool, Ordering}, + Arc, + }, }; use tokio::sync::broadcast; diff --git a/hotshot-query-service/src/fetching/request.rs b/hotshot-query-service/src/fetching/request.rs index d0dd2710f2..347de784b5 100644 --- a/hotshot-query-service/src/fetching/request.rs +++ b/hotshot-query-service/src/fetching/request.rs @@ -19,8 +19,7 @@ use crate::{ use derive_more::{From, Into}; use hotshot_types::traits::node_implementation::NodeType; -use std::fmt::Debug; -use std::hash::Hash; +use std::{fmt::Debug, hash::Hash}; /// A request for a resource. pub trait Request: Copy + Debug + Eq + Hash + Send { diff --git a/hotshot-query-service/src/lib.rs b/hotshot-query-service/src/lib.rs index 20a9e92846..7821e28671 100644 --- a/hotshot-query-service/src/lib.rs +++ b/hotshot-query-service/src/lib.rs @@ -447,8 +447,7 @@ use tide_disco::{method::ReadState, App, StatusCode}; use vbs::version::StaticVersionType; pub use hotshot_types::{ - data::Leaf, - data::{VidCommitment, VidShare}, + data::{Leaf, VidCommitment, VidShare}, simple_certificate::QuorumCertificate, }; @@ -601,8 +600,10 @@ mod test { use futures::future::FutureExt; use hotshot_types::simple_certificate::QuorumCertificate; use portpicker::pick_unused_port; - use std::ops::{Bound, RangeBounds}; - use std::time::Duration; + use std::{ + ops::{Bound, RangeBounds}, + time::Duration, + }; use surf_disco::Client; use tempfile::TempDir; use testing::mocks::MockBase; diff --git a/hotshot-query-service/src/metrics.rs b/hotshot-query-service/src/metrics.rs index 9216fb0a30..b45a27f794 100644 --- a/hotshot-query-service/src/metrics.rs +++ b/hotshot-query-service/src/metrics.rs @@ -19,8 +19,10 @@ use prometheus::{ Encoder, HistogramVec, Opts, Registry, TextEncoder, }; use snafu::Snafu; -use std::collections::HashMap; -use std::sync::{Arc, RwLock}; +use std::{ + collections::HashMap, + sync::{Arc, RwLock}, +}; #[derive(Debug, Snafu)] pub enum MetricsError { diff --git a/hotshot-query-service/src/status.rs b/hotshot-query-service/src/status.rs index abe973f10a..0f99265d67 100644 --- a/hotshot-query-service/src/status.rs +++ b/hotshot-query-service/src/status.rs @@ -28,9 +28,7 @@ use derive_more::From; use futures::FutureExt; use serde::{Deserialize, Serialize}; use snafu::Snafu; -use std::borrow::Cow; -use std::fmt::Display; -use std::path::PathBuf; +use std::{borrow::Cow, fmt::Display, path::PathBuf}; use tide_disco::{api::ApiError, method::ReadState, Api, RequestError, StatusCode}; use vbs::version::StaticVersionType; @@ -122,8 +120,7 @@ mod test { use futures::FutureExt; use portpicker::pick_unused_port; use reqwest::redirect::Policy; - use std::str::FromStr; - use std::time::Duration; + use std::{str::FromStr, time::Duration}; use surf_disco::Client; use tempfile::TempDir; use tide_disco::{App, Url}; diff --git a/hotshot-query-service/src/task.rs b/hotshot-query-service/src/task.rs index 5b816b6ae6..8d61cc8dd1 100644 --- a/hotshot-query-service/src/task.rs +++ b/hotshot-query-service/src/task.rs @@ -14,8 +14,7 @@ use derivative::Derivative; use futures::future::Future; -use std::fmt::Display; -use std::sync::Arc; +use std::{fmt::Display, sync::Arc}; use tokio::{ spawn, task::{JoinError, JoinHandle}, diff --git a/hotshot-query-service/src/testing/consensus.rs b/hotshot-query-service/src/testing/consensus.rs index 4e04ac0a86..5673e26ad6 100644 --- a/hotshot-query-service/src/testing/consensus.rs +++ b/hotshot-query-service/src/testing/consensus.rs @@ -43,10 +43,7 @@ use hotshot_types::{ traits::{election::Membership, network::Topic, signature_key::SignatureKey as _}, HotShotConfig, PeerConfig, }; -use std::num::NonZeroUsize; -use std::sync::Arc; -use std::time::Duration; -use std::{fmt::Display, str::FromStr}; +use std::{fmt::Display, num::NonZeroUsize, str::FromStr, sync::Arc, time::Duration}; use tokio::{ runtime::Handle, task::{block_in_place, yield_now}, diff --git a/hotshot-query-service/src/testing/mocks.rs b/hotshot-query-service/src/testing/mocks.rs index 5c271ca1ff..04aae45efe 100644 --- a/hotshot-query-service/src/testing/mocks.rs +++ b/hotshot-query-service/src/testing/mocks.rs @@ -10,10 +10,10 @@ // You should have received a copy of the GNU General Public License along with this program. If not, // see . -use crate::explorer::traits::{ExplorerHeader, ExplorerTransaction}; -use crate::merklized_state::MerklizedState; use crate::{ availability::{QueryableHeader, QueryablePayload}, + explorer::traits::{ExplorerHeader, ExplorerTransaction}, + merklized_state::MerklizedState, types::HeightIndexed, }; use hotshot::traits::{ @@ -25,11 +25,10 @@ use hotshot_example_types::{ state_types::{TestInstanceState, TestValidatedState}, storage_types::TestStorage, }; -use hotshot_types::traits::node_implementation::Versions; use hotshot_types::{ data::{QuorumProposal, ViewNumber}, signature_key::BLSPubKey, - traits::node_implementation::NodeType, + traits::node_implementation::{NodeType, Versions}, }; use jf_merkle_tree::{ diff --git a/hotshot-stake-table/src/mt_based.rs b/hotshot-stake-table/src/mt_based.rs index a6804662be..f96cf53a58 100644 --- a/hotshot-stake-table/src/mt_based.rs +++ b/hotshot-stake-table/src/mt_based.rs @@ -100,7 +100,7 @@ impl StakeTableScheme for StakeTable { Some(index) => { let branches = to_merkle_path(*index, self.height); root.simple_lookup(self.height, &branches) - } + }, None => Err(StakeTableError::KeyNotFound), } } @@ -116,7 +116,7 @@ impl StakeTableScheme for StakeTable { Some(index) => { let branches = to_merkle_path(*index, self.height); root.lookup(self.height, &branches) - } + }, None => Err(StakeTableError::KeyNotFound), }?; let amount = *proof.value().ok_or(StakeTableError::KeyNotFound)?; @@ -149,7 +149,7 @@ impl StakeTableScheme for StakeTable { negative, )?; Ok(value) - } + }, None => Err(StakeTableError::KeyNotFound), } } @@ -221,7 +221,7 @@ impl StakeTable { value, )?; Ok(old_value) - } + }, None => Err(StakeTableError::KeyNotFound), } } diff --git a/hotshot-stake-table/src/mt_based/internal.rs b/hotshot-stake-table/src/mt_based/internal.rs index b08301ee30..d28233f2e7 100644 --- a/hotshot-stake-table/src/mt_based/internal.rs +++ b/hotshot-stake-table/src/mt_based/internal.rs @@ -155,10 +155,10 @@ impl MerkleProof { let comm = Digest::evaluate(input) .map_err(|_| StakeTableError::RescueError)?[0]; Ok(comm) - } + }, MerklePathEntry::Leaf { .. } => Err(StakeTableError::MalformedProof), }) - } + }, _ => Err(StakeTableError::MalformedProof), } } @@ -305,7 +305,7 @@ impl PersistentMerkleNode { siblings: siblings.try_into().unwrap(), }); Ok(proof) - } + }, PersistentMerkleNode::Leaf { comm: _, key, @@ -341,7 +341,7 @@ impl PersistentMerkleNode { ptr += 1; } children[ptr].key_by_stake(stake_number) - } + }, PersistentMerkleNode::Leaf { comm: _, key, @@ -441,7 +441,7 @@ impl PersistentMerkleNode { }), value, )) - } + }, PersistentMerkleNode::Leaf { comm: _, key: node_key, @@ -473,7 +473,7 @@ impl PersistentMerkleNode { } else { Err(StakeTableError::MismatchedKey) } - } + }, } } @@ -518,7 +518,7 @@ impl PersistentMerkleNode { old_value, )) } - } + }, PersistentMerkleNode::Leaf { comm: _, key: cur_key, @@ -541,7 +541,7 @@ impl PersistentMerkleNode { } else { Err(StakeTableError::MismatchedKey) } - } + }, } } } @@ -584,7 +584,7 @@ impl Iterator for IntoIter { // put the left-most child to the last, so it is visited first. self.unvisited.extend(children.into_iter().rev()); self.next() - } + }, PersistentMerkleNode::Leaf { comm: _, key, diff --git a/hotshot-stake-table/src/vec_based.rs b/hotshot-stake-table/src/vec_based.rs index 6267dd21ca..0117e302d5 100644 --- a/hotshot-stake-table/src/vec_based.rs +++ b/hotshot-stake-table/src/vec_based.rs @@ -126,7 +126,7 @@ where self.head_total_stake -= self.head.stake_amount[*pos]; self.head.stake_amount[*pos] = U256::zero(); Ok(()) - } + }, None => Err(StakeTableError::KeyNotFound), } } @@ -306,7 +306,7 @@ where self.head_total_stake -= old_value; self.head_total_stake += value; Ok(old_value) - } + }, None => Err(StakeTableError::KeyNotFound), } } diff --git a/hotshot-stake-table/src/vec_based/config.rs b/hotshot-stake-table/src/vec_based/config.rs index 4415555142..a752088765 100644 --- a/hotshot-stake-table/src/vec_based/config.rs +++ b/hotshot-stake-table/src/vec_based/config.rs @@ -41,7 +41,7 @@ impl ToFields for QCVerKey { FieldType::from_le_bytes_mod_order(&bytes[31..62]), FieldType::from_le_bytes_mod_order(&bytes[62..]), ] - } + }, Err(_) => unreachable!(), } } diff --git a/hotshot-state-prover/src/circuit.rs b/hotshot-state-prover/src/circuit.rs index baf5c8af38..c45f517c9a 100644 --- a/hotshot-state-prover/src/circuit.rs +++ b/hotshot-state-prover/src/circuit.rs @@ -331,8 +331,10 @@ where #[cfg(test)] mod tests { use ark_ed_on_bn254::EdwardsConfig as Config; - use hotshot_types::light_client::LightClientState; - use hotshot_types::traits::stake_table::{SnapshotVersion, StakeTableScheme}; + use hotshot_types::{ + light_client::LightClientState, + traits::stake_table::{SnapshotVersion, StakeTableScheme}, + }; use jf_crhf::CRHF; use jf_relation::Circuit; use jf_rescue::crhf::VariableLengthRescueCRHF; diff --git a/hotshot-state-prover/src/service.rs b/hotshot-state-prover/src/service.rs index 60a31acc31..d03dfd51d1 100644 --- a/hotshot-state-prover/src/service.rs +++ b/hotshot-state-prover/src/service.rs @@ -9,13 +9,13 @@ use std::{ use anyhow::{anyhow, Context, Result}; use contract_bindings_ethers::light_client::{LightClient, LightClientErrors}; use displaydoc::Display; -use ethers::middleware::{ - gas_oracle::{GasCategory, GasOracle}, - signer::SignerMiddlewareError, -}; use ethers::{ core::k256::ecdsa::SigningKey, - middleware::SignerMiddleware, + middleware::{ + gas_oracle::{GasCategory, GasOracle}, + signer::SignerMiddlewareError, + SignerMiddleware, + }, providers::{Http, Middleware, Provider, ProviderError}, signers::{LocalWallet, Signer, Wallet}, types::{transaction::eip2718::TypedTransaction, Address, U256}, @@ -42,8 +42,7 @@ use jf_pcs::prelude::UnivariateUniversalParams; use jf_plonk::errors::PlonkError; use jf_relation::Circuit as _; use jf_signature::constants::CS_ID_SCHNORR; -use sequencer_utils::blocknative::BlockNative; -use sequencer_utils::deployer::is_proxy_contract; +use sequencer_utils::{blocknative::BlockNative, deployer::is_proxy_contract}; use serde::Deserialize; use surf_disco::Client; use tide_disco::{error::ServerError, Api}; @@ -155,12 +154,12 @@ async fn init_stake_table_from_sequencer( Err(e) => { tracing::error!("Failed to parse the network config: {e}"); sleep(Duration::from_secs(5)).await; - } + }, }, Err(e) => { tracing::error!("Failed to fetch the network config: {e}"); sleep(Duration::from_secs(5)).await; - } + }, } }; @@ -288,7 +287,7 @@ pub async fn read_contract_state( Err(e) => { tracing::error!("unable to read finalized_state from contract: {}", e); return Err(ProverError::ContractError(e.into())); - } + }, }; let st_state: ParsedStakeTableState = match contract.genesis_stake_table_state().call().await { Ok(s) => s.into(), @@ -298,7 +297,7 @@ pub async fn read_contract_state( e ); return Err(ProverError::ContractError(e.into())); - } + }, }; Ok((state.into(), st_state.into())) @@ -330,10 +329,10 @@ pub async fn submit_state_and_proof( priority_fee ); } - } + }, Err(e) => { tracing::warn!("!! BlockNative Price Oracle failed: {}", e); - } + }, } } diff --git a/hotshot-task-impls/src/builder.rs b/hotshot-task-impls/src/builder.rs index d40d041e6d..ca5acd10ef 100644 --- a/hotshot-task-impls/src/builder.rs +++ b/hotshot-task-impls/src/builder.rs @@ -43,10 +43,10 @@ impl From for BuilderClientError { match value { BuilderApiError::Request(source) | BuilderApiError::TxnUnpack(source) => { Self::Api(source.to_string()) - } + }, BuilderApiError::TxnSubmit(source) | BuilderApiError::BuilderAddress(source) => { Self::Api(source.to_string()) - } + }, BuilderApiError::Custom { message, .. } => Self::Api(message), BuilderApiError::BlockAvailable { source, .. } | BuilderApiError::BlockClaim { source, .. } => match source { diff --git a/hotshot-task-impls/src/consensus/mod.rs b/hotshot-task-impls/src/consensus/mod.rs index 484039f1b0..758ef1d624 100644 --- a/hotshot-task-impls/src/consensus/mod.rs +++ b/hotshot-task-impls/src/consensus/mod.rs @@ -30,8 +30,11 @@ use tracing::instrument; use self::handlers::{ handle_quorum_vote_recv, handle_timeout, handle_timeout_vote_recv, handle_view_change, }; -use crate::helpers::{validate_qc_and_next_epoch_qc, wait_for_next_epoch_qc}; -use crate::{events::HotShotEvent, helpers::broadcast_event, vote_collection::VoteCollectorsMap}; +use crate::{ + events::HotShotEvent, + helpers::{broadcast_event, validate_qc_and_next_epoch_qc, wait_for_next_epoch_qc}, + vote_collection::VoteCollectorsMap, +}; /// Event handlers for use in the `handle` method. mod handlers; @@ -118,14 +121,14 @@ impl, V: Versions> ConsensusTaskSt { tracing::debug!("Failed to handle QuorumVoteRecv event; error = {e}"); } - } + }, HotShotEvent::TimeoutVoteRecv(ref vote) => { if let Err(e) = handle_timeout_vote_recv(vote, Arc::clone(&event), &sender, self).await { tracing::debug!("Failed to handle TimeoutVoteRecv event; error = {e}"); } - } + }, HotShotEvent::ViewChange(new_view_number, epoch_number) => { if let Err(e) = handle_view_change(*new_view_number, *epoch_number, &sender, &receiver, self) @@ -134,12 +137,12 @@ impl, V: Versions> ConsensusTaskSt tracing::trace!("Failed to handle ViewChange event; error = {e}"); } self.view_start_time = Instant::now(); - } + }, HotShotEvent::Timeout(view_number, epoch) => { if let Err(e) = handle_timeout(*view_number, *epoch, &sender, self).await { tracing::debug!("Failed to handle Timeout event; error = {e}"); } - } + }, HotShotEvent::Qc2Formed(Either::Left(quorum_cert)) => { let cert_view = quorum_cert.view_number(); if !self.upgrade_lock.epochs_enabled(cert_view).await { @@ -192,7 +195,7 @@ impl, V: Versions> ConsensusTaskSt &sender, ) .await; - } + }, HotShotEvent::ExtendedQcRecv(high_qc, next_epoch_high_qc, _) => { if !self .consensus @@ -241,8 +244,8 @@ impl, V: Versions> ConsensusTaskSt ) .await; } - } - _ => {} + }, + _ => {}, } Ok(()) diff --git a/hotshot-task-impls/src/da.rs b/hotshot-task-impls/src/da.rs index 9ce863d193..a01934e171 100644 --- a/hotshot-task-impls/src/da.rs +++ b/hotshot-task-impls/src/da.rs @@ -139,7 +139,7 @@ impl, V: Versions> DaTaskState { let cur_view = self.consensus.read().await.cur_view(); let view_number = proposal.data.view_number(); @@ -310,7 +310,7 @@ impl, V: Versions> DaTaskState { tracing::debug!("DA vote recv, Main Task {:?}", vote.view_number()); // Check if we are the leader and the vote is from the sender. @@ -341,7 +341,7 @@ impl, V: Versions> DaTaskState { if *epoch > self.cur_epoch { self.cur_epoch = *epoch; @@ -357,7 +357,7 @@ impl, V: Versions> DaTaskState { let PackedBundle:: { encoded_transactions, @@ -421,8 +421,8 @@ impl, V: Versions> DaTaskState {} + }, + _ => {}, } Ok(()) } diff --git a/hotshot-task-impls/src/events.rs b/hotshot-task-impls/src/events.rs index e34f856476..4ddae79751 100644 --- a/hotshot-task-impls/src/events.rs +++ b/hotshot-task-impls/src/events.rs @@ -10,10 +10,9 @@ use async_broadcast::Sender; use either::Either; use hotshot_task::task::TaskEvent; use hotshot_types::{ - data::VidCommitment, data::{ DaProposal2, Leaf2, PackedBundle, QuorumProposal2, QuorumProposalWrapper, UpgradeProposal, - VidDisperse, VidDisperseShare, + VidCommitment, VidDisperse, VidDisperseShare, }, message::Proposal, request_response::ProposalRequestPayload, @@ -282,7 +281,7 @@ impl HotShotEvent { HotShotEvent::QuorumVoteRecv(v) => Some(v.view_number()), HotShotEvent::TimeoutVoteRecv(v) | HotShotEvent::TimeoutVoteSend(v) => { Some(v.view_number()) - } + }, HotShotEvent::QuorumProposalRecv(proposal, _) | HotShotEvent::QuorumProposalSend(proposal, _) | HotShotEvent::QuorumProposalValidated(proposal, _) @@ -290,16 +289,16 @@ impl HotShotEvent { | HotShotEvent::QuorumProposalResponseSend(_, proposal) | HotShotEvent::QuorumProposalPreliminarilyValidated(proposal) => { Some(proposal.data.view_number()) - } + }, HotShotEvent::QuorumVoteSend(vote) | HotShotEvent::ExtendedQuorumVoteSend(vote) => { Some(vote.view_number()) - } + }, HotShotEvent::DaProposalRecv(proposal, _) | HotShotEvent::DaProposalValidated(proposal, _) | HotShotEvent::DaProposalSend(proposal, _) => Some(proposal.data.view_number()), HotShotEvent::DaVoteRecv(vote) | HotShotEvent::DaVoteSend(vote) => { Some(vote.view_number()) - } + }, HotShotEvent::QcFormed(cert) => match cert { either::Left(qc) => Some(qc.view_number()), either::Right(tc) => Some(tc.view_number()), @@ -324,41 +323,41 @@ impl HotShotEvent { | HotShotEvent::ViewSyncCommitCertificateSend(cert, _) => Some(cert.view_number()), HotShotEvent::ViewSyncFinalizeCertificateRecv(cert) | HotShotEvent::ViewSyncFinalizeCertificateSend(cert, _) => Some(cert.view_number()), - HotShotEvent::SendPayloadCommitmentAndMetadata(_, _, _, view_number, _, _) => { + HotShotEvent::SendPayloadCommitmentAndMetadata(_, _, _, view_number, ..) => { Some(*view_number) - } + }, HotShotEvent::BlockRecv(packed_bundle) => Some(packed_bundle.view_number), HotShotEvent::Shutdown - | HotShotEvent::TransactionSend(_, _) + | HotShotEvent::TransactionSend(..) | HotShotEvent::TransactionsRecv(_) => None, HotShotEvent::VidDisperseSend(proposal, _) => Some(proposal.data.view_number()), HotShotEvent::VidShareRecv(_, proposal) | HotShotEvent::VidShareValidated(proposal) => { Some(proposal.data.view_number()) - } + }, HotShotEvent::UpgradeProposalRecv(proposal, _) | HotShotEvent::UpgradeProposalSend(proposal, _) => Some(proposal.data.view_number()), HotShotEvent::UpgradeVoteRecv(vote) | HotShotEvent::UpgradeVoteSend(vote) => { Some(vote.view_number()) - } + }, HotShotEvent::QuorumProposalRequestSend(req, _) | HotShotEvent::QuorumProposalRequestRecv(req, _) => Some(req.view_number), HotShotEvent::ViewChange(view_number, _) - | HotShotEvent::ViewSyncTimeout(view_number, _, _) + | HotShotEvent::ViewSyncTimeout(view_number, ..) | HotShotEvent::ViewSyncTrigger(view_number) | HotShotEvent::Timeout(view_number, ..) => Some(*view_number), HotShotEvent::DaCertificateRecv(cert) | HotShotEvent::DacSend(cert, _) => { Some(cert.view_number()) - } + }, HotShotEvent::DaCertificateValidated(cert) => Some(cert.view_number), HotShotEvent::UpgradeCertificateFormed(cert) => Some(cert.view_number()), - HotShotEvent::VidRequestSend(request, _, _) + HotShotEvent::VidRequestSend(request, ..) | HotShotEvent::VidRequestRecv(request, _) => Some(request.view), HotShotEvent::VidResponseSend(_, _, proposal) | HotShotEvent::VidResponseRecv(_, proposal) => Some(proposal.data.view_number()), HotShotEvent::HighQcRecv(qc, _) | HotShotEvent::HighQcSend(qc, ..) - | HotShotEvent::ExtendedQcRecv(qc, _, _) - | HotShotEvent::ExtendedQcSend(qc, _, _) => Some(qc.view_number()), + | HotShotEvent::ExtendedQcRecv(qc, ..) + | HotShotEvent::ExtendedQcSend(qc, ..) => Some(qc.view_number()), } } } @@ -375,20 +374,20 @@ impl Display for HotShotEvent { ), HotShotEvent::QuorumVoteRecv(v) => { write!(f, "QuorumVoteRecv(view_number={:?})", v.view_number()) - } + }, HotShotEvent::ExtendedQuorumVoteSend(v) => { write!( f, "ExtendedQuorumVoteSend(view_number={:?})", v.view_number() ) - } + }, HotShotEvent::TimeoutVoteRecv(v) => { write!(f, "TimeoutVoteRecv(view_number={:?})", v.view_number()) - } + }, HotShotEvent::TimeoutVoteSend(v) => { write!(f, "TimeoutVoteSend(view_number={:?})", v.view_number()) - } + }, HotShotEvent::DaProposalRecv(proposal, _) => write!( f, "DaProposalRecv(view_number={:?})", @@ -401,10 +400,10 @@ impl Display for HotShotEvent { ), HotShotEvent::DaVoteRecv(vote) => { write!(f, "DaVoteRecv(view_number={:?})", vote.view_number()) - } + }, HotShotEvent::DaCertificateRecv(cert) => { write!(f, "DaCertificateRecv(view_number={:?})", cert.view_number()) - } + }, HotShotEvent::DaCertificateValidated(cert) => write!( f, "DaCertificateValidated(view_number={:?})", @@ -417,7 +416,7 @@ impl Display for HotShotEvent { ), HotShotEvent::QuorumVoteSend(vote) => { write!(f, "QuorumVoteSend(view_number={:?})", vote.view_number()) - } + }, HotShotEvent::QuorumProposalValidated(proposal, _) => write!( f, "QuorumProposalValidated(view_number={:?})", @@ -430,7 +429,7 @@ impl Display for HotShotEvent { ), HotShotEvent::DaVoteSend(vote) => { write!(f, "DaVoteSend(view_number={:?})", vote.view_number()) - } + }, HotShotEvent::QcFormed(cert) => match cert { either::Left(qc) => write!(f, "QcFormed(view_number={:?})", qc.view_number()), either::Right(tc) => write!(f, "QcFormed(view_number={:?})", tc.view_number()), @@ -442,23 +441,23 @@ impl Display for HotShotEvent { HotShotEvent::NextEpochQc2Formed(cert) => match cert { either::Left(qc) => { write!(f, "NextEpochQc2Formed(view_number={:?})", qc.view_number()) - } + }, either::Right(tc) => { write!(f, "NextEpochQc2Formed(view_number={:?})", tc.view_number()) - } + }, }, HotShotEvent::DacSend(cert, _) => { write!(f, "DacSend(view_number={:?})", cert.view_number()) - } + }, HotShotEvent::ViewChange(view_number, epoch_number) => { write!( f, "ViewChange(view_number={view_number:?}, epoch_number={epoch_number:?})" ) - } - HotShotEvent::ViewSyncTimeout(view_number, _, _) => { + }, + HotShotEvent::ViewSyncTimeout(view_number, ..) => { write!(f, "ViewSyncTimeout(view_number={view_number:?})") - } + }, HotShotEvent::ViewSyncPreCommitVoteRecv(vote) => write!( f, "ViewSyncPreCommitVoteRecv(view_number={:?})", @@ -495,59 +494,59 @@ impl Display for HotShotEvent { "ViewSyncPreCommitCertificateRecv(view_number={:?})", cert.view_number() ) - } + }, HotShotEvent::ViewSyncCommitCertificateRecv(cert) => { write!( f, "ViewSyncCommitCertificateRecv(view_number={:?})", cert.view_number() ) - } + }, HotShotEvent::ViewSyncFinalizeCertificateRecv(cert) => { write!( f, "ViewSyncFinalizeCertificateRecv(view_number={:?})", cert.view_number() ) - } + }, HotShotEvent::ViewSyncPreCommitCertificateSend(cert, _) => { write!( f, "ViewSyncPreCommitCertificateSend(view_number={:?})", cert.view_number() ) - } + }, HotShotEvent::ViewSyncCommitCertificateSend(cert, _) => { write!( f, "ViewSyncCommitCertificateSend(view_number={:?})", cert.view_number() ) - } + }, HotShotEvent::ViewSyncFinalizeCertificateSend(cert, _) => { write!( f, "ViewSyncFinalizeCertificateSend(view_number={:?})", cert.view_number() ) - } + }, HotShotEvent::ViewSyncTrigger(view_number) => { write!(f, "ViewSyncTrigger(view_number={view_number:?})") - } + }, HotShotEvent::Timeout(view_number, epoch) => { write!(f, "Timeout(view_number={view_number:?}, epoch={epoch:?})") - } + }, HotShotEvent::TransactionsRecv(_) => write!(f, "TransactionsRecv"), - HotShotEvent::TransactionSend(_, _) => write!(f, "TransactionSend"), - HotShotEvent::SendPayloadCommitmentAndMetadata(_, _, _, view_number, _, _) => { + HotShotEvent::TransactionSend(..) => write!(f, "TransactionSend"), + HotShotEvent::SendPayloadCommitmentAndMetadata(_, _, _, view_number, ..) => { write!( f, "SendPayloadCommitmentAndMetadata(view_number={view_number:?})" ) - } + }, HotShotEvent::BlockRecv(packed_bundle) => { write!(f, "BlockRecv(view_number={:?})", packed_bundle.view_number) - } + }, HotShotEvent::VidDisperseSend(proposal, _) => write!( f, "VidDisperseSend(view_number={:?})", @@ -575,10 +574,10 @@ impl Display for HotShotEvent { ), HotShotEvent::UpgradeVoteRecv(vote) => { write!(f, "UpgradeVoteRecv(view_number={:?})", vote.view_number()) - } + }, HotShotEvent::UpgradeVoteSend(vote) => { write!(f, "UpgradeVoteSend(view_number={:?})", vote.view_number()) - } + }, HotShotEvent::UpgradeCertificateFormed(cert) => write!( f, "UpgradeCertificateFormed(view_number={:?})", @@ -586,63 +585,63 @@ impl Display for HotShotEvent { ), HotShotEvent::QuorumProposalRequestSend(view_number, _) => { write!(f, "QuorumProposalRequestSend(view_number={view_number:?})") - } + }, HotShotEvent::QuorumProposalRequestRecv(view_number, _) => { write!(f, "QuorumProposalRequestRecv(view_number={view_number:?})") - } + }, HotShotEvent::QuorumProposalResponseSend(_, proposal) => { write!( f, "QuorumProposalResponseSend(view_number={:?})", proposal.data.view_number() ) - } + }, HotShotEvent::QuorumProposalResponseRecv(proposal) => { write!( f, "QuorumProposalResponseRecv(view_number={:?})", proposal.data.view_number() ) - } + }, HotShotEvent::QuorumProposalPreliminarilyValidated(proposal) => { write!( f, "QuorumProposalPreliminarilyValidated(view_number={:?}", proposal.data.view_number() ) - } - HotShotEvent::VidRequestSend(request, _, _) => { + }, + HotShotEvent::VidRequestSend(request, ..) => { write!(f, "VidRequestSend(view_number={:?}", request.view) - } + }, HotShotEvent::VidRequestRecv(request, _) => { write!(f, "VidRequestRecv(view_number={:?}", request.view) - } + }, HotShotEvent::VidResponseSend(_, _, proposal) => { write!( f, "VidResponseSend(view_number={:?}", proposal.data.view_number() ) - } + }, HotShotEvent::VidResponseRecv(_, proposal) => { write!( f, "VidResponseRecv(view_number={:?}", proposal.data.view_number() ) - } + }, HotShotEvent::HighQcRecv(qc, _) => { write!(f, "HighQcRecv(view_number={:?}", qc.view_number()) - } + }, HotShotEvent::HighQcSend(qc, ..) => { write!(f, "HighQcSend(view_number={:?}", qc.view_number()) - } + }, HotShotEvent::ExtendedQcRecv(qc, ..) => { write!(f, "ExtendedQcRecv(view_number={:?}", qc.view_number()) - } + }, HotShotEvent::ExtendedQcSend(qc, ..) => { write!(f, "ExtendedQcSend(view_number={:?}", qc.view_number()) - } + }, } } } diff --git a/hotshot-task-impls/src/helpers.rs b/hotshot-task-impls/src/helpers.rs index 4b78a68922..f51cf4c9c4 100644 --- a/hotshot-task-impls/src/helpers.rs +++ b/hotshot-task-impls/src/helpers.rs @@ -796,7 +796,7 @@ pub(crate) async fn validate_proposal_view_and_certs< *view_number, e ) })?; - } + }, ViewChangeEvidence2::ViewSync(view_sync_cert) => { ensure!( view_sync_cert.view_number == view_number, @@ -822,7 +822,7 @@ pub(crate) async fn validate_proposal_view_and_certs< ) .await .context(|e| warn!("Invalid view sync finalize cert provided: {}", e))?; - } + }, } } @@ -855,13 +855,13 @@ pub async fn broadcast_event(event: E, sender: &Send "Event sender queue overflow, Oldest event removed form queue: {:?}", overflowed ); - } + }, Err(SendError(e)) => { tracing::warn!( "Event: {:?}\n Sending failed, event stream probably shutdown", e ); - } + }, } } diff --git a/hotshot-task-impls/src/network.rs b/hotshot-task-impls/src/network.rs index 03004f5077..50747e07df 100644 --- a/hotshot-task-impls/src/network.rs +++ b/hotshot-task-impls/src/network.rs @@ -85,7 +85,7 @@ impl NetworkMessageTaskState { return; } HotShotEvent::QuorumProposalRecv(convert_proposal(proposal), sender) - } + }, GeneralConsensusMessage::Proposal2(proposal) => { if !self .upgrade_lock @@ -96,10 +96,10 @@ impl NetworkMessageTaskState { return; } HotShotEvent::QuorumProposalRecv(convert_proposal(proposal), sender) - } + }, GeneralConsensusMessage::ProposalRequested(req, sig) => { HotShotEvent::QuorumProposalRequestRecv(req, sig) - } + }, GeneralConsensusMessage::ProposalResponse(proposal) => { if self .upgrade_lock @@ -110,7 +110,7 @@ impl NetworkMessageTaskState { return; } HotShotEvent::QuorumProposalResponseRecv(convert_proposal(proposal)) - } + }, GeneralConsensusMessage::ProposalResponse2(proposal) => { if !self .upgrade_lock @@ -121,21 +121,21 @@ impl NetworkMessageTaskState { return; } HotShotEvent::QuorumProposalResponseRecv(convert_proposal(proposal)) - } + }, GeneralConsensusMessage::Vote(vote) => { if self.upgrade_lock.epochs_enabled(vote.view_number()).await { tracing::warn!("received GeneralConsensusMessage::Vote for view {} but epochs are enabled for that view", vote.view_number()); return; } HotShotEvent::QuorumVoteRecv(vote.to_vote2()) - } + }, GeneralConsensusMessage::Vote2(vote) => { if !self.upgrade_lock.epochs_enabled(vote.view_number()).await { tracing::warn!("received GeneralConsensusMessage::Vote2 for view {} but epochs are not enabled for that view", vote.view_number()); return; } HotShotEvent::QuorumVoteRecv(vote) - } + }, GeneralConsensusMessage::ViewSyncPreCommitVote(view_sync_message) => { if self .upgrade_lock @@ -146,7 +146,7 @@ impl NetworkMessageTaskState { return; } HotShotEvent::ViewSyncPreCommitVoteRecv(view_sync_message.to_vote2()) - } + }, GeneralConsensusMessage::ViewSyncPreCommitVote2(view_sync_message) => { if !self .upgrade_lock @@ -157,7 +157,7 @@ impl NetworkMessageTaskState { return; } HotShotEvent::ViewSyncPreCommitVoteRecv(view_sync_message) - } + }, GeneralConsensusMessage::ViewSyncPreCommitCertificate( view_sync_message, ) => { @@ -172,7 +172,7 @@ impl NetworkMessageTaskState { HotShotEvent::ViewSyncPreCommitCertificateRecv( view_sync_message.to_vsc2(), ) - } + }, GeneralConsensusMessage::ViewSyncPreCommitCertificate2( view_sync_message, ) => { @@ -185,7 +185,7 @@ impl NetworkMessageTaskState { return; } HotShotEvent::ViewSyncPreCommitCertificateRecv(view_sync_message) - } + }, GeneralConsensusMessage::ViewSyncCommitVote(view_sync_message) => { if self .upgrade_lock @@ -196,7 +196,7 @@ impl NetworkMessageTaskState { return; } HotShotEvent::ViewSyncCommitVoteRecv(view_sync_message.to_vote2()) - } + }, GeneralConsensusMessage::ViewSyncCommitVote2(view_sync_message) => { if !self .upgrade_lock @@ -207,7 +207,7 @@ impl NetworkMessageTaskState { return; } HotShotEvent::ViewSyncCommitVoteRecv(view_sync_message) - } + }, GeneralConsensusMessage::ViewSyncCommitCertificate(view_sync_message) => { if self .upgrade_lock @@ -218,7 +218,7 @@ impl NetworkMessageTaskState { return; } HotShotEvent::ViewSyncCommitCertificateRecv(view_sync_message.to_vsc2()) - } + }, GeneralConsensusMessage::ViewSyncCommitCertificate2(view_sync_message) => { if !self .upgrade_lock @@ -229,7 +229,7 @@ impl NetworkMessageTaskState { return; } HotShotEvent::ViewSyncCommitCertificateRecv(view_sync_message) - } + }, GeneralConsensusMessage::ViewSyncFinalizeVote(view_sync_message) => { if self .upgrade_lock @@ -240,7 +240,7 @@ impl NetworkMessageTaskState { return; } HotShotEvent::ViewSyncFinalizeVoteRecv(view_sync_message.to_vote2()) - } + }, GeneralConsensusMessage::ViewSyncFinalizeVote2(view_sync_message) => { if !self .upgrade_lock @@ -251,7 +251,7 @@ impl NetworkMessageTaskState { return; } HotShotEvent::ViewSyncFinalizeVoteRecv(view_sync_message) - } + }, GeneralConsensusMessage::ViewSyncFinalizeCertificate(view_sync_message) => { if self .upgrade_lock @@ -264,7 +264,7 @@ impl NetworkMessageTaskState { HotShotEvent::ViewSyncFinalizeCertificateRecv( view_sync_message.to_vsc2(), ) - } + }, GeneralConsensusMessage::ViewSyncFinalizeCertificate2( view_sync_message, ) => { @@ -277,7 +277,7 @@ impl NetworkMessageTaskState { return; } HotShotEvent::ViewSyncFinalizeCertificateRecv(view_sync_message) - } + }, GeneralConsensusMessage::TimeoutVote(message) => { if self .upgrade_lock @@ -288,7 +288,7 @@ impl NetworkMessageTaskState { return; } HotShotEvent::TimeoutVoteRecv(message.to_vote2()) - } + }, GeneralConsensusMessage::TimeoutVote2(message) => { if !self .upgrade_lock @@ -299,18 +299,18 @@ impl NetworkMessageTaskState { return; } HotShotEvent::TimeoutVoteRecv(message) - } + }, GeneralConsensusMessage::UpgradeProposal(message) => { HotShotEvent::UpgradeProposalRecv(message, sender) - } + }, GeneralConsensusMessage::UpgradeVote(message) => { tracing::error!("Received upgrade vote!"); HotShotEvent::UpgradeVoteRecv(message) - } + }, GeneralConsensusMessage::HighQc(qc) => HotShotEvent::HighQcRecv(qc, sender), GeneralConsensusMessage::ExtendedQc(qc, next_epoch_qc) => { HotShotEvent::ExtendedQcRecv(qc, next_epoch_qc, sender) - } + }, }, SequencingMessage::Da(da_message) => match da_message { DaConsensusMessage::DaProposal(proposal) => { @@ -323,7 +323,7 @@ impl NetworkMessageTaskState { return; } HotShotEvent::DaProposalRecv(convert_proposal(proposal), sender) - } + }, DaConsensusMessage::DaProposal2(proposal) => { if !self .upgrade_lock @@ -334,35 +334,35 @@ impl NetworkMessageTaskState { return; } HotShotEvent::DaProposalRecv(proposal, sender) - } + }, DaConsensusMessage::DaVote(vote) => { if self.upgrade_lock.epochs_enabled(vote.view_number()).await { tracing::warn!("received DaConsensusMessage::DaVote for view {} but epochs are enabled for that view", vote.view_number()); return; } HotShotEvent::DaVoteRecv(vote.clone().to_vote2()) - } + }, DaConsensusMessage::DaVote2(vote) => { if !self.upgrade_lock.epochs_enabled(vote.view_number()).await { tracing::warn!("received DaConsensusMessage::DaVote2 for view {} but epochs are not enabled for that view", vote.view_number()); return; } HotShotEvent::DaVoteRecv(vote.clone()) - } + }, DaConsensusMessage::DaCertificate(cert) => { if self.upgrade_lock.epochs_enabled(cert.view_number()).await { tracing::warn!("received DaConsensusMessage::DaCertificate for view {} but epochs are enabled for that view", cert.view_number()); return; } HotShotEvent::DaCertificateRecv(cert.to_dac2()) - } + }, DaConsensusMessage::DaCertificate2(cert) => { if !self.upgrade_lock.epochs_enabled(cert.view_number()).await { tracing::warn!("received DaConsensusMessage::DaCertificate2 for view {} but epochs are not enabled for that view", cert.view_number()); return; } HotShotEvent::DaCertificateRecv(cert) - } + }, DaConsensusMessage::VidDisperseMsg(proposal) => { if self .upgrade_lock @@ -373,7 +373,7 @@ impl NetworkMessageTaskState { return; } HotShotEvent::VidShareRecv(sender, convert_proposal(proposal)) - } + }, DaConsensusMessage::VidDisperseMsg2(proposal) => { if !self .upgrade_lock @@ -384,11 +384,11 @@ impl NetworkMessageTaskState { return; } HotShotEvent::VidShareRecv(sender, convert_proposal(proposal)) - } + }, }, }; broadcast_event(Arc::new(event), &self.internal_event_stream).await; - } + }, // Handle data messages MessageKind::Data(message) => match message { @@ -403,7 +403,7 @@ impl NetworkMessageTaskState { &self.internal_event_stream, ) .await; - } + }, DataMessage::DataResponse(response) => { if let ResponseMessage::Found(message) = response { match message { @@ -416,7 +416,7 @@ impl NetworkMessageTaskState { &self.internal_event_stream, ) .await; - } + }, SequencingMessage::Da(DaConsensusMessage::VidDisperseMsg2( proposal, )) => { @@ -428,11 +428,11 @@ impl NetworkMessageTaskState { &self.internal_event_stream, ) .await; - } - _ => {} + }, + _ => {}, } } - } + }, DataMessage::RequestData(data) => { let req_data = data.clone(); if let RequestKind::Vid(_view_number, _key) = req_data.request { @@ -442,7 +442,7 @@ impl NetworkMessageTaskState { ) .await; } - } + }, }, // Handle external messages @@ -459,7 +459,7 @@ impl NetworkMessageTaskState { &self.external_event_stream, ) .await; - } + }, } } } @@ -607,7 +607,7 @@ impl< Err(e) => { tracing::error!("Failed to serialize message: {}", e); continue; - } + }, }; messages.insert(recipient, serialized_message); @@ -630,7 +630,7 @@ impl< return; } match net.vid_broadcast_message(messages).await { - Ok(()) => {} + Ok(()) => {}, Err(e) => tracing::warn!("Failed to send message from network task: {:?}", e), } }); @@ -665,7 +665,7 @@ impl< Err(e) => { tracing::warn!("Not Sending {:?} because of storage error: {:?}", action, e); Err(()) - } + }, } } else { Ok(()) @@ -718,7 +718,7 @@ impl< }; Some((sender, message, TransmitType::Broadcast)) - } + }, // ED Each network task is subscribed to all these message types. Need filters per network task HotShotEvent::QuorumVoteSend(vote) => { @@ -738,7 +738,7 @@ impl< e ); return None; - } + }, }; let message = if self.upgrade_lock.epochs_enabled(vote.view_number()).await { @@ -752,7 +752,7 @@ impl< }; Some((vote.signing_key(), message, TransmitType::Direct(leader))) - } + }, HotShotEvent::ExtendedQuorumVoteSend(vote) => { *maybe_action = Some(HotShotAction::Vote); let message = if self.upgrade_lock.epochs_enabled(vote.view_number()).await { @@ -766,7 +766,7 @@ impl< }; Some((vote.signing_key(), message, TransmitType::Broadcast)) - } + }, HotShotEvent::QuorumProposalRequestSend(req, signature) => Some(( req.key.clone(), MessageKind::::from_consensus_message(SequencingMessage::General( @@ -794,11 +794,11 @@ impl< message, TransmitType::Direct(sender_key), )) - } + }, HotShotEvent::VidDisperseSend(proposal, sender) => { self.handle_vid_disperse_proposal(proposal, &sender).await; None - } + }, HotShotEvent::DaProposalSend(proposal, sender) => { *maybe_action = Some(HotShotAction::DaPropose); @@ -817,7 +817,7 @@ impl< }; Some((sender, message, TransmitType::DaCommitteeBroadcast)) - } + }, HotShotEvent::DaVoteSend(vote) => { *maybe_action = Some(HotShotAction::DaVote); let view_number = vote.view_number(); @@ -831,7 +831,7 @@ impl< e ); return None; - } + }, }; let message = if self.upgrade_lock.epochs_enabled(view_number).await { @@ -845,7 +845,7 @@ impl< }; Some((vote.signing_key(), message, TransmitType::Direct(leader))) - } + }, HotShotEvent::DacSend(certificate, sender) => { *maybe_action = Some(HotShotAction::DaCert); let message = if self @@ -863,7 +863,7 @@ impl< }; Some((sender, message, TransmitType::Broadcast)) - } + }, HotShotEvent::ViewSyncPreCommitVoteSend(vote) => { let view_number = vote.view_number() + vote.date().relay; let leader = match self.membership.read().await.leader(view_number, self.epoch) { @@ -875,7 +875,7 @@ impl< e ); return None; - } + }, }; let message = if self.upgrade_lock.epochs_enabled(vote.view_number()).await { MessageKind::::from_consensus_message(SequencingMessage::General( @@ -888,7 +888,7 @@ impl< }; Some((vote.signing_key(), message, TransmitType::Direct(leader))) - } + }, HotShotEvent::ViewSyncCommitVoteSend(vote) => { *maybe_action = Some(HotShotAction::ViewSyncVote); let view_number = vote.view_number() + vote.date().relay; @@ -901,7 +901,7 @@ impl< e ); return None; - } + }, }; let message = if self.upgrade_lock.epochs_enabled(vote.view_number()).await { MessageKind::::from_consensus_message(SequencingMessage::General( @@ -914,7 +914,7 @@ impl< }; Some((vote.signing_key(), message, TransmitType::Direct(leader))) - } + }, HotShotEvent::ViewSyncFinalizeVoteSend(vote) => { *maybe_action = Some(HotShotAction::ViewSyncVote); let view_number = vote.view_number() + vote.date().relay; @@ -927,7 +927,7 @@ impl< e ); return None; - } + }, }; let message = if self.upgrade_lock.epochs_enabled(vote.view_number()).await { MessageKind::::from_consensus_message(SequencingMessage::General( @@ -940,7 +940,7 @@ impl< }; Some((vote.signing_key(), message, TransmitType::Direct(leader))) - } + }, HotShotEvent::ViewSyncPreCommitCertificateSend(certificate, sender) => { let view_number = certificate.view_number(); let message = if self.upgrade_lock.epochs_enabled(view_number).await { @@ -954,7 +954,7 @@ impl< }; Some((sender, message, TransmitType::Broadcast)) - } + }, HotShotEvent::ViewSyncCommitCertificateSend(certificate, sender) => { let view_number = certificate.view_number(); let message = if self.upgrade_lock.epochs_enabled(view_number).await { @@ -968,7 +968,7 @@ impl< }; Some((sender, message, TransmitType::Broadcast)) - } + }, HotShotEvent::ViewSyncFinalizeCertificateSend(certificate, sender) => { let view_number = certificate.view_number(); let message = if self.upgrade_lock.epochs_enabled(view_number).await { @@ -982,7 +982,7 @@ impl< }; Some((sender, message, TransmitType::Broadcast)) - } + }, HotShotEvent::TimeoutVoteSend(vote) => { *maybe_action = Some(HotShotAction::Vote); let view_number = vote.view_number() + 1; @@ -995,7 +995,7 @@ impl< e ); return None; - } + }, }; let message = if self.upgrade_lock.epochs_enabled(vote.view_number()).await { MessageKind::::from_consensus_message(SequencingMessage::General( @@ -1008,7 +1008,7 @@ impl< }; Some((vote.signing_key(), message, TransmitType::Direct(leader))) - } + }, HotShotEvent::UpgradeProposalSend(proposal, sender) => Some(( sender, MessageKind::::from_consensus_message(SequencingMessage::General( @@ -1028,7 +1028,7 @@ impl< e ); return None; - } + }, }; Some(( vote.signing_key(), @@ -1037,7 +1037,7 @@ impl< )), TransmitType::Direct(leader), )) - } + }, HotShotEvent::ViewChange(view, epoch) => { self.view = view; if epoch > self.epoch { @@ -1052,7 +1052,7 @@ impl< net.update_view::(*keep_view, epoch, mem).await; }); None - } + }, HotShotEvent::VidRequestSend(req, sender, to) => Some(( sender, MessageKind::Data(DataMessage::RequestData(req)), @@ -1082,7 +1082,7 @@ impl< vid_share_proposal, )), ))) - } + }, VidDisperseShare::V1(data) => { if !epochs_enabled { tracing::warn!( @@ -1101,10 +1101,10 @@ impl< vid_share_proposal, )), ))) - } + }, }; Some((sender, message, TransmitType::Direct(to))) - } + }, HotShotEvent::HighQcSend(quorum_cert, leader, sender) => Some(( sender, MessageKind::Consensus(SequencingMessage::General( @@ -1187,18 +1187,18 @@ impl< Err(e) => { tracing::error!("Failed to serialize message: {}", e); return; - } + }, }; let transmit_result = match transmit { TransmitType::Direct(recipient) => { network.direct_message(serialized_message, recipient).await - } + }, TransmitType::Broadcast => { network .broadcast_message(serialized_message, committee_topic, broadcast_delay) .await - } + }, TransmitType::DaCommitteeBroadcast => { network .da_broadcast_message( @@ -1207,11 +1207,11 @@ impl< broadcast_delay, ) .await - } + }, }; match transmit_result { - Ok(()) => {} + Ok(()) => {}, Err(e) => tracing::warn!("Failed to send message task: {:?}", e), } }); diff --git a/hotshot-task-impls/src/quorum_proposal/handlers.rs b/hotshot-task-impls/src/quorum_proposal/handlers.rs index 4ac06ff2f3..06f98d9f54 100644 --- a/hotshot-task-impls/src/quorum_proposal/handlers.rs +++ b/hotshot-task-impls/src/quorum_proposal/handlers.rs @@ -431,22 +431,22 @@ impl HandleDepOutput for ProposalDependencyHandle< block_view: *view, auction_result: auction_result.clone(), }); - } + }, HotShotEvent::Qc2Formed(cert) => match cert { either::Right(timeout) => { timeout_certificate = Some(timeout.clone()); - } + }, either::Left(qc) => { parent_qc = Some(qc.clone()); - } + }, }, HotShotEvent::ViewSyncFinalizeCertificateRecv(cert) => { view_sync_finalize_cert = Some(cert.clone()); - } + }, HotShotEvent::VidDisperseSend(share, _) => { vid_share = Some(share.clone()); - } - _ => {} + }, + _ => {}, } } diff --git a/hotshot-task-impls/src/quorum_proposal/mod.rs b/hotshot-task-impls/src/quorum_proposal/mod.rs index 3866ee6042..1d506be532 100644 --- a/hotshot-task-impls/src/quorum_proposal/mod.rs +++ b/hotshot-task-impls/src/quorum_proposal/mod.rs @@ -113,14 +113,14 @@ impl, V: Versions> } else { return false; } - } + }, ProposalDependency::TimeoutCert => { if let HotShotEvent::Qc2Formed(either::Right(timeout)) = event { timeout.view_number() + 1 } else { return false; } - } + }, ProposalDependency::ViewSyncCert => { if let HotShotEvent::ViewSyncFinalizeCertificateRecv(view_sync_cert) = event { @@ -128,7 +128,7 @@ impl, V: Versions> } else { return false; } - } + }, ProposalDependency::Proposal => { if let HotShotEvent::QuorumProposalPreliminarilyValidated(proposal) = event { @@ -136,7 +136,7 @@ impl, V: Versions> } else { return false; } - } + }, ProposalDependency::PayloadAndMetadata => { if let HotShotEvent::SendPayloadCommitmentAndMetadata( _payload_commitment, @@ -151,14 +151,14 @@ impl, V: Versions> } else { return false; } - } + }, ProposalDependency::VidShare => { if let HotShotEvent::VidDisperseSend(vid_disperse, _) = event { vid_disperse.data.view_number() } else { return false; } - } + }, }; let valid = event_view == view_number; if valid { @@ -217,25 +217,25 @@ impl, V: Versions> match event.as_ref() { HotShotEvent::SendPayloadCommitmentAndMetadata(..) => { payload_commitment_dependency.mark_as_completed(Arc::clone(&event)); - } + }, HotShotEvent::QuorumProposalPreliminarilyValidated(..) => { proposal_dependency.mark_as_completed(event); - } + }, HotShotEvent::Qc2Formed(quorum_certificate) => match quorum_certificate { Either::Right(_) => { timeout_dependency.mark_as_completed(event); - } + }, Either::Left(_) => { qc_dependency.mark_as_completed(event); - } + }, }, HotShotEvent::ViewSyncFinalizeCertificateRecv(_) => { view_sync_dependency.mark_as_completed(event); - } - HotShotEvent::VidDisperseSend(_, _) => { + }, + HotShotEvent::VidDisperseSend(..) => { vid_share_dependency.mark_as_completed(event); - } - _ => {} + }, + _ => {}, }; // We have three cases to consider: @@ -398,7 +398,7 @@ impl, V: Versions> self.formed_upgrade_certificate = Some(cert.clone()); } - } + }, HotShotEvent::Qc2Formed(cert) => match cert.clone() { either::Right(timeout_cert) => { let view_number = timeout_cert.view_number + 1; @@ -411,7 +411,7 @@ impl, V: Versions> epoch_transition_indicator, ) .await?; - } + }, either::Left(qc) => { // Only update if the qc is from a newer view if qc.view_number <= self.consensus.read().await.high_qc().view_number { @@ -446,7 +446,7 @@ impl, V: Versions> epoch_transition_indicator, ) .await?; - } + }, }, HotShotEvent::SendPayloadCommitmentAndMetadata( _payload_commitment, @@ -467,7 +467,7 @@ impl, V: Versions> EpochTransitionIndicator::NotInTransition, ) .await?; - } + }, HotShotEvent::ViewSyncFinalizeCertificateRecv(certificate) => { let epoch_number = certificate.data.epoch; @@ -503,7 +503,7 @@ impl, V: Versions> EpochTransitionIndicator::NotInTransition, ) .await?; - } + }, HotShotEvent::QuorumProposalPreliminarilyValidated(proposal) => { let view_number = proposal.data.view_number(); // All nodes get the latest proposed view as a proxy of `cur_view` of old. @@ -520,7 +520,7 @@ impl, V: Versions> epoch_transition_indicator, ) .await?; - } + }, HotShotEvent::QuorumProposalSend(proposal, _) => { let view = proposal.data.view_number(); @@ -528,7 +528,7 @@ impl, V: Versions> self.update_latest_proposed_view(view).await, "Failed to update latest proposed view" ); - } + }, HotShotEvent::VidDisperseSend(vid_disperse, _) => { let view_number = vid_disperse.data.view_number(); self.create_dependency_task_if_new( @@ -540,18 +540,18 @@ impl, V: Versions> EpochTransitionIndicator::NotInTransition, ) .await?; - } + }, HotShotEvent::ViewChange(view, epoch) => { if epoch > &self.cur_epoch { self.cur_epoch = *epoch; } let keep_view = TYPES::View::new(view.saturating_sub(1)); self.cancel_tasks(keep_view); - } + }, HotShotEvent::Timeout(view, ..) => { let keep_view = TYPES::View::new(view.saturating_sub(1)); self.cancel_tasks(keep_view); - } + }, HotShotEvent::HighQcSend(qc, ..) | HotShotEvent::ExtendedQcSend(qc, ..) => { ensure!(qc.view_number() > self.highest_qc.view_number()); let cert_epoch_number = qc.data.epoch; @@ -571,7 +571,7 @@ impl, V: Versions> .context(|e| warn!("Quorum certificate {:?} was invalid: {}", qc.data(), e))?; self.highest_qc = qc.clone(); - } + }, HotShotEvent::NextEpochQc2Formed(Either::Left(next_epoch_qc)) => { // Only update if the qc is from a newer view let current_next_epoch_qc = @@ -597,8 +597,8 @@ impl, V: Versions> .await .wrap() .context(error!("Failed to update next epoch high QC in storage!"))?; - } - _ => {} + }, + _ => {}, } Ok(()) } diff --git a/hotshot-task-impls/src/quorum_proposal_recv/handlers.rs b/hotshot-task-impls/src/quorum_proposal_recv/handlers.rs index a70fc30c96..d55c980895 100644 --- a/hotshot-task-impls/src/quorum_proposal_recv/handlers.rs +++ b/hotshot-task-impls/src/quorum_proposal_recv/handlers.rs @@ -220,7 +220,7 @@ pub(crate) async fn handle_quorum_proposal_recv< } else { bail!("Parent state not found! Consensus internally inconsistent"); } - } + }, None => None, }; diff --git a/hotshot-task-impls/src/quorum_proposal_recv/mod.rs b/hotshot-task-impls/src/quorum_proposal_recv/mod.rs index a7ab61cd50..d9368878f4 100644 --- a/hotshot-task-impls/src/quorum_proposal_recv/mod.rs +++ b/hotshot-task-impls/src/quorum_proposal_recv/mod.rs @@ -165,10 +165,10 @@ impl, V: Versions> ) .await { - Ok(()) => {} + Ok(()) => {}, Err(e) => debug!(?e, "Failed to validate the proposal"), } - } + }, HotShotEvent::ViewChange(view, epoch) => { if *epoch > self.cur_epoch { self.cur_epoch = *epoch; @@ -183,8 +183,8 @@ impl, V: Versions> // to enter view V + 1. let oldest_view_to_keep = TYPES::View::new(view.saturating_sub(1)); self.cancel_tasks(oldest_view_to_keep); - } - _ => {} + }, + _ => {}, } } } diff --git a/hotshot-task-impls/src/quorum_vote/handlers.rs b/hotshot-task-impls/src/quorum_vote/handlers.rs index 7f1937c253..da4bf842b7 100644 --- a/hotshot-task-impls/src/quorum_vote/handlers.rs +++ b/hotshot-task-impls/src/quorum_vote/handlers.rs @@ -103,7 +103,7 @@ async fn store_and_get_computed_drb_result< .await; task_state.drb_computation = None; Ok(result) - } + }, Err(e) => Err(warn!("Error in DRB calculation: {:?}.", e)), } } @@ -215,10 +215,10 @@ async fn start_drb_task, V: Versio ) .await; task_state.drb_computation = None; - } + }, Err(e) => { tracing::error!("error joining DRB computation task: {e:?}"); - } + }, } } else if *task_epoch == new_epoch_number { return; @@ -535,10 +535,10 @@ pub(crate) async fn update_shared_state< Some((leaf, view)) => { maybe_validated_view = Some(view); Some(leaf) - } + }, None => None, } - } + }, }; let parent = maybe_parent.context(info!( diff --git a/hotshot-task-impls/src/quorum_vote/mod.rs b/hotshot-task-impls/src/quorum_vote/mod.rs index 5493a166e7..7f80052a14 100644 --- a/hotshot-task-impls/src/quorum_vote/mod.rs +++ b/hotshot-task-impls/src/quorum_vote/mod.rs @@ -121,7 +121,7 @@ impl + 'static, V: Versions> Handl Err(e) => { tracing::error!("{e:#}"); return; - } + }, }; let proposal_payload_comm = proposal.data.block_header().payload_commitment(); let parent_commitment = parent_leaf.commit(); @@ -163,7 +163,7 @@ impl + 'static, V: Versions> Handl } leaf = Some(proposed_leaf); parent_view_number = Some(parent_leaf.view_number()); - } + }, HotShotEvent::DaCertificateValidated(cert) => { let cert_payload_comm = &cert.data().payload_commit; let next_epoch_cert_payload_comm = cert.data().next_epoch_payload_commit; @@ -185,7 +185,7 @@ impl + 'static, V: Versions> Handl } else { next_epoch_payload_commitment = next_epoch_cert_payload_comm; } - } + }, HotShotEvent::VidShareValidated(share) => { let vid_payload_commitment = &share.data.payload_commitment(); vid_share = Some(share.clone()); @@ -209,8 +209,8 @@ impl + 'static, V: Versions> Handl } else { payload_commitment = Some(*vid_payload_commitment); } - } - _ => {} + }, + _ => {}, } } @@ -360,21 +360,21 @@ impl, V: Versions> QuorumVoteTaskS } else { return false; } - } + }, VoteDependency::Dac => { if let HotShotEvent::DaCertificateValidated(cert) = event { cert.view_number } else { return false; } - } + }, VoteDependency::Vid => { if let HotShotEvent::VidShareValidated(disperse) = event { disperse.data.view_number() } else { return false; } - } + }, }; if event_view == view_number { tracing::trace!( @@ -532,7 +532,7 @@ impl, V: Versions> QuorumVoteTaskS Arc::clone(&event), ); } - } + }, HotShotEvent::DaCertificateRecv(cert) => { let view = cert.view_number; @@ -577,7 +577,7 @@ impl, V: Versions> QuorumVoteTaskS &event_sender, Arc::clone(&event), ); - } + }, HotShotEvent::VidShareRecv(sender, share) => { let view = share.data.view_number(); // Do nothing if the VID share is old @@ -636,7 +636,7 @@ impl, V: Versions> QuorumVoteTaskS &event_sender, Arc::clone(&event), ); - } + }, HotShotEvent::Timeout(view, ..) => { let view = TYPES::View::new(view.saturating_sub(1)); // cancel old tasks @@ -645,7 +645,7 @@ impl, V: Versions> QuorumVoteTaskS task.abort(); } self.vote_dependencies = current_tasks; - } + }, HotShotEvent::ViewChange(mut view, _) => { view = TYPES::View::new(view.saturating_sub(1)); if !self.update_latest_voted_view(view).await { @@ -657,8 +657,8 @@ impl, V: Versions> QuorumVoteTaskS task.abort(); } self.vote_dependencies = current_tasks; - } - _ => {} + }, + _ => {}, } Ok(()) } diff --git a/hotshot-task-impls/src/request.rs b/hotshot-task-impls/src/request.rs index 02d10a284d..fb71bd937a 100644 --- a/hotshot-task-impls/src/request.rs +++ b/hotshot-task-impls/src/request.rs @@ -143,14 +143,14 @@ impl> TaskState for NetworkRequest .await; } Ok(()) - } + }, HotShotEvent::ViewChange(view, _) => { let view = *view; if view > self.view { self.view = view; } Ok(()) - } + }, _ => Ok(()), } } diff --git a/hotshot-task-impls/src/response.rs b/hotshot-task-impls/src/response.rs index f0000a7c14..50bfaa6f47 100644 --- a/hotshot-task-impls/src/response.rs +++ b/hotshot-task-impls/src/response.rs @@ -112,7 +112,7 @@ impl NetworkResponseState { ) .await; } - } + }, HotShotEvent::QuorumProposalRequestRecv(req, signature) => { // Make sure that this request came from who we think it did if !req.key.validate(signature, req.commit().as_ref()) { @@ -138,16 +138,16 @@ impl NetworkResponseState { ) .await; } - } + }, HotShotEvent::Shutdown => { return; - } - _ => {} + }, + _ => {}, } - } + }, Err(e) => { tracing::error!("Failed to receive event. {:?}", e); - } + }, } } } diff --git a/hotshot-task-impls/src/rewind.rs b/hotshot-task-impls/src/rewind.rs index 82e267dfb3..d4a9bcb58e 100644 --- a/hotshot-task-impls/src/rewind.rs +++ b/hotshot-task-impls/src/rewind.rs @@ -58,7 +58,7 @@ impl TaskState for RewindTaskState { Err(e) => { tracing::error!("Failed to write file {}; error = {}", filename, e); return; - } + }, }; for (event_number, event) in self.events.iter().enumerate() { diff --git a/hotshot-task-impls/src/transactions.rs b/hotshot-task-impls/src/transactions.rs index 4437597c56..5918a3599f 100644 --- a/hotshot-task-impls/src/transactions.rs +++ b/hotshot-task-impls/src/transactions.rs @@ -17,8 +17,7 @@ use hotshot_builder_api::v0_1::block_info::AvailableBlockInfo; use hotshot_task::task::TaskState; use hotshot_types::{ consensus::OuterConsensus, - data::VidCommitment, - data::{null_block, PackedBundle}, + data::{null_block, PackedBundle, VidCommitment}, event::{Event, EventType}, message::UpgradeLock, traits::{ @@ -135,7 +134,7 @@ impl, V: Versions> TransactionTask Err(e) => { tracing::error!("Failed to calculate version: {:?}", e); return None; - } + }, }; if version < V::Marketplace::VERSION { @@ -160,7 +159,7 @@ impl, V: Versions> TransactionTask Err(err) => { tracing::error!("Upgrade certificate requires unsupported version, refusing to request blocks: {}", err); return None; - } + }, }; // Request a block from the builder unless we are between versions. @@ -304,11 +303,11 @@ impl, V: Versions> TransactionTask Ok(Err(e)) => { tracing::debug!("Failed to retrieve bundle: {e}"); continue; - } + }, Err(e) => { tracing::debug!("Failed to retrieve bundle: {e}"); continue; - } + }, } } @@ -385,7 +384,7 @@ impl, V: Versions> TransactionTask Err(err) => { tracing::error!("Upgrade certificate requires unsupported version, refusing to request blocks: {}", err); return None; - } + }, }; let packed_bundle = match self @@ -411,7 +410,7 @@ impl, V: Versions> TransactionTask .add(1); null_block - } + }, }; broadcast_event( @@ -459,7 +458,7 @@ impl, V: Versions> TransactionTask &self.output_event_stream, ) .await; - } + }, HotShotEvent::ViewChange(view, epoch) => { let view = TYPES::View::new(std::cmp::max(1, **view)); let epoch = if self.upgrade_lock.epochs_enabled(view).await { @@ -487,8 +486,8 @@ impl, V: Versions> TransactionTask self.handle_view_change(&event_stream, view, epoch).await; return Ok(()); } - } - _ => {} + }, + _ => {}, } Ok(()) } @@ -509,7 +508,7 @@ impl, V: Versions> TransactionTask // We still have time, will re-try in a bit sleep(RETRY_DELAY).await; continue; - } + }, } } } @@ -543,13 +542,13 @@ impl, V: Versions> TransactionTask let leaf = consensus_reader.saved_leaves().get(leaf_commitment).context (info!("Missing leaf with commitment {leaf_commitment} for view {target_view} in saved_leaves"))?; return Ok((target_view, leaf.payload_commitment())); - } + }, ViewInner::Failed => { // For failed views, backtrack target_view = TYPES::View::new(target_view.checked_sub(1).context(warn!("Reached genesis. Something is wrong -- have we not decided any blocks since genesis?"))?); continue; - } + }, } } } @@ -567,7 +566,7 @@ impl, V: Versions> TransactionTask Err(e) => { tracing::warn!("Failed to find last vid commitment in time: {e}"); return None; - } + }, }; let parent_comm_sig = match <::SignatureKey as SignatureKey>::sign( @@ -578,7 +577,7 @@ impl, V: Versions> TransactionTask Err(err) => { tracing::error!(%err, "Failed to sign block hash"); return None; - } + }, }; while task_start_time.elapsed() < self.builder_timeout { @@ -592,7 +591,7 @@ impl, V: Versions> TransactionTask // We got a block Ok(Ok(block)) => { return Some(block); - } + }, // We failed to get a block Ok(Err(err)) => { @@ -600,13 +599,13 @@ impl, V: Versions> TransactionTask // pause a bit sleep(RETRY_DELAY).await; continue; - } + }, // We timed out while getting available blocks Err(err) => { tracing::info!(%err, "Timeout while getting available blocks"); return None; - } + }, } } @@ -671,7 +670,7 @@ impl, V: Versions> TransactionTask Err(err) => { tracing::warn!(%err,"Error getting available blocks"); None - } + }, }) .flatten() .collect::>() @@ -731,7 +730,7 @@ impl, V: Versions> TransactionTask Err(err) => { tracing::error!(%err, "Failed to sign block hash"); continue; - } + }, }; let response = { @@ -747,7 +746,7 @@ impl, V: Versions> TransactionTask Err(err) => { tracing::warn!(%err, "Error claiming block data"); continue; - } + }, }; let header_input = match header_input { @@ -755,7 +754,7 @@ impl, V: Versions> TransactionTask Err(err) => { tracing::warn!(%err, "Error claiming header input"); continue; - } + }, }; // verify the signature over the message diff --git a/hotshot-task-impls/src/upgrade.rs b/hotshot-task-impls/src/upgrade.rs index c98cd611e9..248d9f0080 100644 --- a/hotshot-task-impls/src/upgrade.rs +++ b/hotshot-task-impls/src/upgrade.rs @@ -213,7 +213,7 @@ impl UpgradeTaskState { tracing::debug!("Sending upgrade vote {:?}", vote.view_number()); broadcast_event(Arc::new(HotShotEvent::UpgradeVoteSend(vote)), &tx).await; - } + }, HotShotEvent::UpgradeVoteRecv(ref vote) => { tracing::debug!("Upgrade vote recv, Main Task {:?}", vote.view_number()); @@ -244,7 +244,7 @@ impl UpgradeTaskState { EpochTransitionIndicator::NotInTransition, ) .await?; - } + }, HotShotEvent::ViewChange(new_view, epoch_number) => { if *epoch_number > self.cur_epoch { self.cur_epoch = *epoch_number; @@ -320,8 +320,8 @@ impl UpgradeTaskState { ) .await; } - } - _ => {} + }, + _ => {}, } Ok(()) } diff --git a/hotshot-task-impls/src/vid.rs b/hotshot-task-impls/src/vid.rs index 21ffe46eed..d1e043c8cd 100644 --- a/hotshot-task-impls/src/vid.rs +++ b/hotshot-task-impls/src/vid.rs @@ -159,7 +159,7 @@ impl, V: Versions> VidTaskState { if *epoch > self.cur_epoch { @@ -177,7 +177,7 @@ impl, V: Versions> VidTaskState { let proposed_block_number = proposal.data.block_header().block_number(); @@ -242,11 +242,11 @@ impl, V: Versions> VidTaskState { return Some(HotShotTaskCompleted); - } - _ => {} + }, + _ => {}, } None } diff --git a/hotshot-task-impls/src/view_sync.rs b/hotshot-task-impls/src/view_sync.rs index 8d203f1107..e9c87c7467 100644 --- a/hotshot-task-impls/src/view_sync.rs +++ b/hotshot-task-impls/src/view_sync.rs @@ -269,25 +269,25 @@ impl ViewSyncTaskState { let view = certificate.view_number(); self.send_to_or_create_replica(event, view, &event_stream) .await; - } + }, HotShotEvent::ViewSyncCommitCertificateRecv(certificate) => { tracing::debug!("Received view sync cert for phase {:?}", certificate); let view = certificate.view_number(); self.send_to_or_create_replica(event, view, &event_stream) .await; - } + }, HotShotEvent::ViewSyncFinalizeCertificateRecv(certificate) => { tracing::debug!("Received view sync cert for phase {:?}", certificate); let view = certificate.view_number(); self.send_to_or_create_replica(event, view, &event_stream) .await; - } - HotShotEvent::ViewSyncTimeout(view, _, _) => { + }, + HotShotEvent::ViewSyncTimeout(view, ..) => { tracing::debug!("view sync timeout in main task {:?}", view); let view = *view; self.send_to_or_create_replica(event, view, &event_stream) .await; - } + }, HotShotEvent::ViewSyncPreCommitVoteRecv(ref vote) => { let mut map = self.pre_commit_relay_map.write().await; @@ -336,7 +336,7 @@ impl ViewSyncTaskState { .await?; relay_map.insert(relay, vote_collector); - } + }, HotShotEvent::ViewSyncCommitVoteRecv(ref vote) => { let mut map = self.commit_relay_map.write().await; @@ -385,7 +385,7 @@ impl ViewSyncTaskState { ) .await?; relay_map.insert(relay, vote_collector); - } + }, HotShotEvent::ViewSyncFinalizeVoteRecv(vote) => { let mut map = self.finalize_relay_map.write().await; @@ -435,7 +435,7 @@ impl ViewSyncTaskState { if let Ok(vote_task) = vote_collector { relay_map.insert(relay, vote_task); } - } + }, &HotShotEvent::ViewChange(new_view, epoch) => { if epoch > self.cur_epoch { @@ -477,7 +477,7 @@ impl ViewSyncTaskState { self.last_garbage_collected_view = self.cur_view - 1; } - } + }, &HotShotEvent::Timeout(view_number, ..) => { // This is an old timeout and we can ignore it ensure!( @@ -521,9 +521,9 @@ impl ViewSyncTaskState { ) .await; } - } + }, - _ => {} + _ => {}, } Ok(()) } @@ -630,7 +630,7 @@ impl ViewSyncReplicaTaskState { .await; } })); - } + }, HotShotEvent::ViewSyncCommitCertificateRecv(certificate) => { let last_seen_certificate = ViewSyncPhase::Commit; @@ -737,7 +737,7 @@ impl ViewSyncReplicaTaskState { .await; } })); - } + }, HotShotEvent::ViewSyncFinalizeCertificateRecv(certificate) => { // Ignore certificate if it is for an older round @@ -792,7 +792,7 @@ impl ViewSyncReplicaTaskState { ) .await; return Some(HotShotTaskCompleted); - } + }, HotShotEvent::ViewSyncTrigger(view_number) => { let view_number = *view_number; @@ -846,7 +846,7 @@ impl ViewSyncReplicaTaskState { })); return None; - } + }, HotShotEvent::ViewSyncTimeout(round, relay, last_seen_certificate) => { let round = *round; @@ -880,11 +880,11 @@ impl ViewSyncReplicaTaskState { &event_stream, ) .await; - } + }, ViewSyncPhase::Finalize => { // This should never occur unimplemented!() - } + }, } self.timeout_task = Some(spawn({ @@ -913,7 +913,7 @@ impl ViewSyncReplicaTaskState { return None; } - } + }, _ => return None, } None diff --git a/hotshot-task-impls/src/vote_collection.rs b/hotshot-task-impls/src/vote_collection.rs index ede632a973..75d66f5e12 100644 --- a/hotshot-task-impls/src/vote_collection.rs +++ b/hotshot-task-impls/src/vote_collection.rs @@ -147,7 +147,7 @@ impl< self.accumulator = None; Ok(Some(cert)) - } + }, } } } @@ -294,7 +294,7 @@ where entry.insert(collector); Ok(()) - } + }, Entry::Occupied(mut entry) => { // handle the vote, and garbage collect if the vote collector is finished if entry @@ -308,7 +308,7 @@ where } Ok(()) - } + }, } } @@ -533,7 +533,7 @@ impl match event.as_ref() { HotShotEvent::QuorumVoteRecv(vote) => { self.accumulate_vote(vote, self.epoch, sender).await - } + }, _ => Ok(None), } } @@ -562,7 +562,7 @@ impl .ok_or_else(|| error!("epoch should not be none in handle_vote_event"))?; self.accumulate_vote(&vote.clone().into(), Some(next_epoch), sender) .await - } + }, _ => Ok(None), } } @@ -585,7 +585,7 @@ impl match event.as_ref() { HotShotEvent::UpgradeVoteRecv(vote) => { self.accumulate_vote(vote, self.epoch, sender).await - } + }, _ => Ok(None), } } @@ -626,7 +626,7 @@ impl match event.as_ref() { HotShotEvent::TimeoutVoteRecv(vote) => { self.accumulate_vote(vote, self.epoch, sender).await - } + }, _ => Ok(None), } } @@ -648,7 +648,7 @@ impl match event.as_ref() { HotShotEvent::ViewSyncPreCommitVoteRecv(vote) => { self.accumulate_vote(vote, self.epoch, sender).await - } + }, _ => Ok(None), } } @@ -670,7 +670,7 @@ impl match event.as_ref() { HotShotEvent::ViewSyncCommitVoteRecv(vote) => { self.accumulate_vote(vote, self.epoch, sender).await - } + }, _ => Ok(None), } } @@ -692,7 +692,7 @@ impl match event.as_ref() { HotShotEvent::ViewSyncFinalizeVoteRecv(vote) => { self.accumulate_vote(vote, self.epoch, sender).await - } + }, _ => Ok(None), } } diff --git a/hotshot-task/src/dependency.rs b/hotshot-task/src/dependency.rs index 7b3d7dfa0b..d4a0e2eed8 100644 --- a/hotshot-task/src/dependency.rs +++ b/hotshot-task/src/dependency.rs @@ -163,13 +163,13 @@ impl Dependency for EventDependency { if (self.match_fn)(&event) { return Some(event); } - } + }, Err(RecvError::Overflowed(n)) => { tracing::error!("Dependency Task overloaded, skipping {} events", n); - } + }, Err(RecvError::Closed) => { return None; - } + }, } } } diff --git a/hotshot-task/src/task.rs b/hotshot-task/src/task.rs index 170d7dbc02..c0e4ec5b07 100644 --- a/hotshot-task/src/task.rs +++ b/hotshot-task/src/task.rs @@ -86,13 +86,13 @@ impl Task { S::handle_event(&mut self.state, input, &self.sender, &self.receiver) .await .inspect_err(|e| tracing::debug!("{e}")); - } + }, Err(RecvError::Closed) => { break self.boxed_state(); - } + }, Err(e) => { tracing::error!("Failed to receive from event stream Error: {}", e); - } + }, } } }) diff --git a/hotshot-testing/src/block_builder/mod.rs b/hotshot-testing/src/block_builder/mod.rs index 103b59c14d..534e6167ef 100644 --- a/hotshot-testing/src/block_builder/mod.rs +++ b/hotshot-testing/src/block_builder/mod.rs @@ -109,13 +109,13 @@ pub fn run_builder_source( match event { BuilderChange::Up if handle.is_none() => { handle = Some(start_builder(url.clone(), source.clone())); - } + }, BuilderChange::Down => { if let Some(handle) = handle.take() { handle.abort(); } - } - _ => {} + }, + _ => {}, } } }); @@ -153,13 +153,13 @@ pub fn run_builder_source_0_1( match event { BuilderChange::Up if handle.is_none() => { handle = Some(start_builder(url.clone(), source.clone())); - } + }, BuilderChange::Down => { if let Some(handle) = handle.take() { handle.abort(); } - } - _ => {} + }, + _ => {}, } } }); diff --git a/hotshot-testing/src/block_builder/random.rs b/hotshot-testing/src/block_builder/random.rs index 7a8723b22f..ec7d6129e2 100644 --- a/hotshot-testing/src/block_builder/random.rs +++ b/hotshot-testing/src/block_builder/random.rs @@ -178,7 +178,7 @@ where match stream.next().await { None => { break; - } + }, Some(evt) => { if let EventType::ViewFinished { view_number } = evt.event { if let Some(change) = self.changes.remove(&view_number) { @@ -192,18 +192,18 @@ where self.blocks.clone(), ))) } - } + }, BuilderChange::Down => { if let Some(handle) = task.take() { handle.abort(); } - } - BuilderChange::FailClaims(_) => {} + }, + BuilderChange::FailClaims(_) => {}, } let _ = self.change_sender.broadcast(change).await; } } - } + }, } } }); diff --git a/hotshot-testing/src/block_builder/simple.rs b/hotshot-testing/src/block_builder/simple.rs index bc098033a8..c29cf8666e 100644 --- a/hotshot-testing/src/block_builder/simple.rs +++ b/hotshot-testing/src/block_builder/simple.rs @@ -382,7 +382,7 @@ impl BuilderTask for SimpleBuilderTask { match stream.next().await { None => { break; - } + }, Some(evt) => match evt.event { EventType::ViewFinished { view_number } => { if let Some(change) = self.changes.remove(&view_number) { @@ -392,14 +392,14 @@ impl BuilderTask for SimpleBuilderTask { should_build_blocks = false; self.transactions.write().await.clear(); self.blocks.write().await.clear(); - } + }, BuilderChange::FailClaims(value) => { self.should_fail_claims.store(value, Ordering::Relaxed); - } + }, } let _ = self.change_sender.broadcast(change).await; } - } + }, EventType::Decide { leaf_chain, .. } if should_build_blocks => { let mut queue = self.transactions.write().await; for leaf_info in leaf_chain.iter() { @@ -413,7 +413,7 @@ impl BuilderTask for SimpleBuilderTask { } } self.blocks.write().await.clear(); - } + }, EventType::DaProposal { proposal, .. } if should_build_blocks => { let payload = TYPES::BlockPayload::from_bytes( &proposal.data.encoded_transactions, @@ -429,7 +429,7 @@ impl BuilderTask for SimpleBuilderTask { txn.claimed = Some(now); } } - } + }, EventType::Transactions { transactions } if should_build_blocks => { let mut queue = self.transactions.write().await; for transaction in transactions { @@ -443,8 +443,8 @@ impl BuilderTask for SimpleBuilderTask { ); } } - } - _ => {} + }, + _ => {}, }, } } diff --git a/hotshot-testing/src/byzantine/byzantine_behaviour.rs b/hotshot-testing/src/byzantine/byzantine_behaviour.rs index 8fab295bd4..482341bae3 100644 --- a/hotshot-testing/src/byzantine/byzantine_behaviour.rs +++ b/hotshot-testing/src/byzantine/byzantine_behaviour.rs @@ -67,7 +67,7 @@ impl, V: Versions> EventTransforme consensus.write().await.reset_actions(); result - } + }, _ => vec![event.clone()], } } @@ -94,9 +94,9 @@ impl, V: Versions> EventTransforme _consensus: Arc>>, ) -> Vec> { match event { - HotShotEvent::QuorumProposalSend(_, _) | HotShotEvent::QuorumVoteSend(_) => { + HotShotEvent::QuorumProposalSend(..) | HotShotEvent::QuorumVoteSend(_) => { vec![event.clone(), event.clone()] - } + }, _ => vec![event.clone()], } } @@ -182,11 +182,11 @@ impl + std::fmt::Debug, V: Version self.handle_proposal_send_event(event, proposal, sender) .await, ]; - } + }, HotShotEvent::QuorumProposalValidated(proposal, _) => { self.validated_proposals.push(proposal.data.clone()); - } - _ => {} + }, + _ => {}, } vec![event.clone()] } @@ -413,7 +413,7 @@ impl + std::fmt::Debug, V: Version .unwrap(); return vec![HotShotEvent::QuorumVoteSend(vote)]; } - } + }, HotShotEvent::TimeoutVoteSend(vote) => { // Check if this view was a dishonest proposal view, if true dont send timeout let dishonest_proposals = self.dishonest_proposal_view_numbers.read().await; @@ -422,11 +422,11 @@ impl + std::fmt::Debug, V: Version // So, dont send the timeout to the next leader from this byzantine replica return vec![]; } - } + }, HotShotEvent::QuorumVoteSend(vote) => { self.votes_sent.push(vote.clone()); - } - _ => {} + }, + _ => {}, } vec![event.clone()] } diff --git a/hotshot-testing/src/consistency_task.rs b/hotshot-testing/src/consistency_task.rs index 8813725db9..9caac9c975 100644 --- a/hotshot-testing/src/consistency_task.rs +++ b/hotshot-testing/src/consistency_task.rs @@ -44,15 +44,15 @@ fn sanitize_node_map( reduced.dedup(); match reduced.len() { - 0 => {} + 0 => {}, 1 => { result.insert(*view, reduced[0].clone()); - } + }, _ => { bail!( "We have received inconsistent leaves for view {view:?}. Leaves:\n\n{leaves:?}" ); - } + }, } } @@ -300,12 +300,12 @@ impl, V: Versions> ConsistencyTas match result { Ok(TestProgress::Finished) => { let _ = self.test_sender.broadcast(TestEvent::Shutdown).await; - } + }, Err(e) => { self.add_error(e); let _ = self.test_sender.broadcast(TestEvent::Shutdown).await; - } - Ok(TestProgress::Incomplete) => {} + }, + Ok(TestProgress::Incomplete) => {}, } } diff --git a/hotshot-testing/src/predicates/event.rs b/hotshot-testing/src/predicates/event.rs index 6ee78fb2f8..4e1139f09a 100644 --- a/hotshot-testing/src/predicates/event.rs +++ b/hotshot-testing/src/predicates/event.rs @@ -217,7 +217,7 @@ where QuorumProposalSend(proposal, _) => { Some(proposal.data.block_header().payload_commitment()) == null_block::commitment::(num_storage_nodes) - } + }, _ => false, }); Box::new(EventPredicate { check, info }) diff --git a/hotshot-testing/src/script.rs b/hotshot-testing/src/script.rs index b25e286f9f..29a853c6ba 100644 --- a/hotshot-testing/src/script.rs +++ b/hotshot-testing/src/script.rs @@ -121,6 +121,6 @@ pub async fn validate_output_or_panic_in_script( "Stage {} | Output in {} failed to satisfy: {:?}.\n\nReceived:\n\n{:?}", stage_number, script_name, assert, output ) - } + }, } } diff --git a/hotshot-testing/src/spinning_task.rs b/hotshot-testing/src/spinning_task.rs index 8f54eaee0a..7857008602 100644 --- a/hotshot-testing/src/spinning_task.rs +++ b/hotshot-testing/src/spinning_task.rs @@ -192,10 +192,10 @@ where marketplace_config, ) .await - } + }, LateNodeContext::Restart => { panic!("Cannot spin up a node with Restart context") - } + }, }; let handle = context.run_tasks().await; @@ -212,13 +212,13 @@ where self.handles.write().await.push(node); } - } + }, NodeAction::Down => { if let Some(node) = self.handles.write().await.get_mut(idx) { tracing::error!("Node {} shutting down", idx); node.handle.shut_down().await; } - } + }, NodeAction::RestartDown(delay_views) => { let node_id = idx.try_into().unwrap(); if let Some(node) = self.handles.write().await.get_mut(idx) { @@ -318,25 +318,25 @@ where self.restart_contexts.insert(idx, new_ctx); } } - } + }, NodeAction::RestartUp => { if let Some(ctx) = self.restart_contexts.remove(&idx) { new_nodes.push((ctx.context, idx)); new_networks.push(ctx.network.clone()); } - } + }, NodeAction::NetworkUp => { if let Some(handle) = self.handles.write().await.get(idx) { tracing::error!("Node {} networks resuming", idx); handle.network.resume(); } - } + }, NodeAction::NetworkDown => { if let Some(handle) = self.handles.write().await.get(idx) { tracing::error!("Node {} networks pausing", idx); handle.network.pause(); } - } + }, } } } diff --git a/hotshot-testing/src/test_builder.rs b/hotshot-testing/src/test_builder.rs index 452d90473a..829bad2d9d 100644 --- a/hotshot-testing/src/test_builder.rs +++ b/hotshot-testing/src/test_builder.rs @@ -272,7 +272,7 @@ pub async fn create_test_handle< .await; left_handle - } + }, Behaviour::Byzantine(state) => { let state = Box::leak(state); state @@ -289,7 +289,7 @@ pub async fn create_test_handle< marketplace_config, ) .await - } + }, Behaviour::Standard => { let hotshot = SystemContext::::new( public_key, @@ -306,7 +306,7 @@ pub async fn create_test_handle< .await; hotshot.run_tasks().await - } + }, } } diff --git a/hotshot-testing/src/test_runner.rs b/hotshot-testing/src/test_runner.rs index 545004f4d2..9d5ee2e593 100644 --- a/hotshot-testing/src/test_runner.rs +++ b/hotshot-testing/src/test_runner.rs @@ -278,12 +278,12 @@ where Ok(res) => match res { TestResult::Pass => { info!("Task shut down successfully"); - } + }, TestResult::Fail(e) => error_list.push(e), }, Err(e) => { tracing::error!("Error Joining the test task {:?}", e); - } + }, } } @@ -562,14 +562,14 @@ where if let Some(task) = builder_tasks.pop() { task.start(Box::new(handle.event_stream())) } - } + }, std::cmp::Ordering::Equal => { // If we have more builder tasks than DA nodes, pin them all on the last node. while let Some(task) = builder_tasks.pop() { task.start(Box::new(handle.event_stream())) } - } - std::cmp::Ordering::Greater => {} + }, + std::cmp::Ordering::Greater => {}, } self.nodes.push(Node { diff --git a/hotshot-testing/src/test_task.rs b/hotshot-testing/src/test_task.rs index 14520c6d13..890fd2ddf9 100644 --- a/hotshot-testing/src/test_task.rs +++ b/hotshot-testing/src/test_task.rs @@ -158,12 +158,12 @@ impl TestTask { let _ = S::handle_event(&mut self.state, (input, id)) .await .inspect_err(|e| tracing::error!("{e}")); - } + }, Ok((Err(e), _id, _)) => { error!("Error from one channel in test task {:?}", e); sleep(Duration::from_millis(4000)).await; - } - _ => {} + }, + _ => {}, }; } }) @@ -202,7 +202,7 @@ pub async fn add_network_message_test_task< Err(e) => { error!("Failed to receive message: {:?}", e); continue; - } + }, }; // Deserialize the message @@ -212,7 +212,7 @@ pub async fn add_network_message_test_task< Err(e) => { tracing::error!("Failed to deserialize message: {:?}", e); continue; - } + }, }; // Handle the message diff --git a/hotshot-testing/src/txn_task.rs b/hotshot-testing/src/txn_task.rs index 41b5ec3b14..f20d1524f3 100644 --- a/hotshot-testing/src/txn_task.rs +++ b/hotshot-testing/src/txn_task.rs @@ -52,7 +52,7 @@ impl, V: Versions> TxnTask match handles.get(idx) { None => { tracing::error!("couldn't get node in txn task"); - } + }, Some(node) => { // use rand::seq::IteratorRandom; // we're assuming all nodes have the same leaf. @@ -64,7 +64,7 @@ impl, V: Versions> TxnTask .submit_transaction(txn.clone()) .await .expect("Could not send transaction"); - } + }, } } } diff --git a/hotshot-testing/src/view_generator.rs b/hotshot-testing/src/view_generator.rs index 5b55391461..6bf09d0b4c 100644 --- a/hotshot-testing/src/view_generator.rs +++ b/hotshot-testing/src/view_generator.rs @@ -667,7 +667,7 @@ impl Stream for TestViewGenerator { Poll::Ready(test_view) => { self.current_view = Some(test_view.clone()); Poll::Ready(Some(test_view)) - } + }, Poll::Pending => Poll::Pending, } } diff --git a/hotshot-testing/src/view_sync_task.rs b/hotshot-testing/src/view_sync_task.rs index 9ad967c74b..e41bfc0842 100644 --- a/hotshot-testing/src/view_sync_task.rs +++ b/hotshot-testing/src/view_sync_task.rs @@ -42,7 +42,7 @@ impl> TestTaskState async fn handle_event(&mut self, (event, id): (Self::Event, usize)) -> Result<()> { match event.as_ref() { // all the view sync events - HotShotEvent::ViewSyncTimeout(_, _, _) + HotShotEvent::ViewSyncTimeout(..) | HotShotEvent::ViewSyncPreCommitVoteRecv(_) | HotShotEvent::ViewSyncCommitVoteRecv(_) | HotShotEvent::ViewSyncFinalizeVoteRecv(_) @@ -52,12 +52,12 @@ impl> TestTaskState | HotShotEvent::ViewSyncPreCommitCertificateRecv(_) | HotShotEvent::ViewSyncCommitCertificateRecv(_) | HotShotEvent::ViewSyncFinalizeCertificateRecv(_) - | HotShotEvent::ViewSyncPreCommitCertificateSend(_, _) - | HotShotEvent::ViewSyncCommitCertificateSend(_, _) - | HotShotEvent::ViewSyncFinalizeCertificateSend(_, _) + | HotShotEvent::ViewSyncPreCommitCertificateSend(..) + | HotShotEvent::ViewSyncCommitCertificateSend(..) + | HotShotEvent::ViewSyncFinalizeCertificateSend(..) | HotShotEvent::ViewSyncTrigger(_) => { self.hit_view_sync.insert(id); - } + }, _ => (), } @@ -75,7 +75,7 @@ impl> TestTaskState hit_view_sync: self.hit_view_sync.clone(), })) } - } + }, } } } diff --git a/hotshot-testing/tests/tests_1/quorum_proposal_task.rs b/hotshot-testing/tests/tests_1/quorum_proposal_task.rs index 6a5db34c52..436379ad31 100644 --- a/hotshot-testing/tests/tests_1/quorum_proposal_task.rs +++ b/hotshot-testing/tests/tests_1/quorum_proposal_task.rs @@ -27,9 +27,7 @@ use hotshot_testing::{ use hotshot_types::{ data::{null_block, EpochNumber, Leaf2, ViewChangeEvidence2, ViewNumber}, simple_vote::{TimeoutData2, ViewSyncFinalizeData2}, - traits::{ - node_implementation::{ConsensusTime, Versions}, - }, + traits::node_implementation::{ConsensusTime, Versions}, utils::BuilderCommitment, }; use sha2::Digest; diff --git a/hotshot-testing/tests/tests_1/transaction_task.rs b/hotshot-testing/tests/tests_1/transaction_task.rs index ee5a80bed0..bab4968388 100644 --- a/hotshot-testing/tests/tests_1/transaction_task.rs +++ b/hotshot-testing/tests/tests_1/transaction_task.rs @@ -9,9 +9,7 @@ use hotshot_task_impls::{ use hotshot_testing::helpers::build_system_handle; use hotshot_types::{ data::{null_block, EpochNumber, PackedBundle, ViewNumber}, - traits::{ - node_implementation::{ConsensusTime, Versions}, - }, + traits::node_implementation::{ConsensusTime, Versions}, }; use vbs::version::StaticVersionType; diff --git a/hotshot-testing/tests/tests_6/test_epochs.rs b/hotshot-testing/tests/tests_6/test_epochs.rs index 43c71d188d..686ea8f6ab 100644 --- a/hotshot-testing/tests/tests_6/test_epochs.rs +++ b/hotshot-testing/tests/tests_6/test_epochs.rs @@ -4,7 +4,6 @@ // You should have received a copy of the MIT License // along with the HotShot repository. If not, see . -use std::time::Duration; use hotshot_example_types::{ node_types::{ CombinedImpl, EpochUpgradeTestVersions, EpochsTestVersions, Libp2pImpl, MemoryImpl, @@ -23,6 +22,7 @@ use hotshot_testing::{ test_builder::{TestDescription, TimingData}, view_sync_task::ViewSyncTaskDescription, }; +use std::time::Duration; cross_tests!( TestName: test_success_with_epochs, diff --git a/hotshot-types/src/consensus.rs b/hotshot-types/src/consensus.rs index c775880206..c2ff430ddf 100644 --- a/hotshot-types/src/consensus.rs +++ b/hotshot-types/src/consensus.rs @@ -588,7 +588,7 @@ impl Consensus { // because the leader of view n + 1 may propose to the DA (and we would vote) // before the leader of view n. return true; - } + }, _ => return true, }; if view > *old_view { diff --git a/hotshot-types/src/data.rs b/hotshot-types/src/data.rs index a57bec5069..d61d6e486d 100644 --- a/hotshot-types/src/data.rs +++ b/hotshot-types/src/data.rs @@ -504,13 +504,13 @@ impl VidDisperseShare { .into_iter() .map(|share| Self::V0(share)) .collect() - } + }, VidDisperse::V1(vid_disperse) => { VidDisperseShare2::::from_vid_disperse(vid_disperse) .into_iter() .map(|share| Self::V1(share)) .collect() - } + }, } } @@ -671,10 +671,10 @@ impl ViewChangeEvidence { match self { ViewChangeEvidence::Timeout(timeout_cert) => { ViewChangeEvidence2::Timeout(timeout_cert.to_tc2()) - } + }, ViewChangeEvidence::ViewSync(view_sync_cert) => { ViewChangeEvidence2::ViewSync(view_sync_cert.to_vsc2()) - } + }, } } } @@ -704,10 +704,10 @@ impl ViewChangeEvidence2 { match self { ViewChangeEvidence2::Timeout(timeout_cert) => { ViewChangeEvidence::Timeout(timeout_cert.to_tc()) - } + }, ViewChangeEvidence2::ViewSync(view_sync_cert) => { ViewChangeEvidence::ViewSync(view_sync_cert.to_vsc()) - } + }, } } } @@ -1241,7 +1241,7 @@ impl Leaf2 { // Easiest cases are: // - no upgrade certificate on either: this is the most common case, and is always fine. // - if the parent didn't have a certificate, but we see one now, it just means that we have begun an upgrade: again, this is always fine. - (None | Some(_), None) => {} + (None | Some(_), None) => {}, // If we no longer see a cert, we have to make sure that we either: // - no longer care because we have passed new_version_first_view, or // - no longer care because we have passed `decide_by` without deciding the certificate. @@ -1251,13 +1251,13 @@ impl Leaf2 { || (self.view_number() > parent_cert.data.decide_by && decided_upgrade_certificate_read.is_none()), "The new leaf is missing an upgrade certificate that was present in its parent, and should still be live." ); - } + }, // If we both have a certificate, they should be identical. // Technically, this prevents us from initiating a new upgrade in the view immediately following an upgrade. // I think this is a fairly lax restriction. (Some(cert), Some(parent_cert)) => { ensure!(cert == parent_cert, "The new leaf does not extend the parent leaf, because it has attached a different upgrade certificate."); - } + }, } // This check should be added once we sort out the genesis leaf/justify_qc issue. @@ -1620,7 +1620,7 @@ impl Leaf { // Easiest cases are: // - no upgrade certificate on either: this is the most common case, and is always fine. // - if the parent didn't have a certificate, but we see one now, it just means that we have begun an upgrade: again, this is always fine. - (None | Some(_), None) => {} + (None | Some(_), None) => {}, // If we no longer see a cert, we have to make sure that we either: // - no longer care because we have passed new_version_first_view, or // - no longer care because we have passed `decide_by` without deciding the certificate. @@ -1630,13 +1630,13 @@ impl Leaf { || (self.view_number() > parent_cert.data.decide_by && decided_upgrade_certificate_read.is_none()), "The new leaf is missing an upgrade certificate that was present in its parent, and should still be live." ); - } + }, // If we both have a certificate, they should be identical. // Technically, this prevents us from initiating a new upgrade in the view immediately following an upgrade. // I think this is a fairly lax restriction. (Some(cert), Some(parent_cert)) => { ensure!(cert == parent_cert, "The new leaf does not extend the parent leaf, because it has attached a different upgrade certificate."); - } + }, } // This check should be added once we sort out the genesis leaf/justify_qc issue. diff --git a/hotshot-types/src/lib.rs b/hotshot-types/src/lib.rs index 8d227f42ba..a2668d9ce8 100644 --- a/hotshot-types/src/lib.rs +++ b/hotshot-types/src/lib.rs @@ -132,7 +132,7 @@ impl PeerConfig { Err(e) => { error!(?e, "Failed to serialize public key"); vec![] - } + }, } } @@ -146,7 +146,7 @@ impl PeerConfig { Err(e) => { error!(?e, "Failed to deserialize public key"); None - } + }, } } } diff --git a/hotshot-types/src/message.rs b/hotshot-types/src/message.rs index b2ecca7840..43ccdd628c 100644 --- a/hotshot-types/src/message.rs +++ b/hotshot-types/src/message.rs @@ -173,9 +173,7 @@ impl HasEpoch for MessageKind { fn epoch(&self) -> Option { match &self { MessageKind::Consensus(message) => message.epoch_number(), - MessageKind::Data( - DataMessage::SubmitTransaction(_, _) | DataMessage::RequestData(_), - ) + MessageKind::Data(DataMessage::SubmitTransaction(..) | DataMessage::RequestData(_)) | MessageKind::External(_) => None, MessageKind::Data(DataMessage::DataResponse(msg)) => match msg { ResponseMessage::Found(m) => m.epoch_number(), @@ -325,66 +323,66 @@ impl SequencingMessage { // view of leader in the leaf when proposal // this should match replica upon receipt p.data.view_number() - } + }, GeneralConsensusMessage::Proposal2(p) => { // view of leader in the leaf when proposal // this should match replica upon receipt p.data.view_number() - } + }, GeneralConsensusMessage::ProposalRequested(req, _) => req.view_number, GeneralConsensusMessage::ProposalResponse(proposal) => { proposal.data.view_number() - } + }, GeneralConsensusMessage::ProposalResponse2(proposal) => { proposal.data.view_number() - } + }, GeneralConsensusMessage::Vote(vote_message) => vote_message.view_number(), GeneralConsensusMessage::Vote2(vote_message) => vote_message.view_number(), GeneralConsensusMessage::TimeoutVote(message) => message.view_number(), GeneralConsensusMessage::ViewSyncPreCommitVote(message) => { message.view_number() - } + }, GeneralConsensusMessage::ViewSyncCommitVote(message) => message.view_number(), GeneralConsensusMessage::ViewSyncFinalizeVote(message) => message.view_number(), GeneralConsensusMessage::ViewSyncPreCommitCertificate(message) => { message.view_number() - } + }, GeneralConsensusMessage::ViewSyncCommitCertificate(message) => { message.view_number() - } + }, GeneralConsensusMessage::ViewSyncFinalizeCertificate(message) => { message.view_number() - } + }, GeneralConsensusMessage::TimeoutVote2(message) => message.view_number(), GeneralConsensusMessage::ViewSyncPreCommitVote2(message) => { message.view_number() - } + }, GeneralConsensusMessage::ViewSyncCommitVote2(message) => message.view_number(), GeneralConsensusMessage::ViewSyncFinalizeVote2(message) => { message.view_number() - } + }, GeneralConsensusMessage::ViewSyncPreCommitCertificate2(message) => { message.view_number() - } + }, GeneralConsensusMessage::ViewSyncCommitCertificate2(message) => { message.view_number() - } + }, GeneralConsensusMessage::ViewSyncFinalizeCertificate2(message) => { message.view_number() - } + }, GeneralConsensusMessage::UpgradeProposal(message) => message.data.view_number(), GeneralConsensusMessage::UpgradeVote(message) => message.view_number(), GeneralConsensusMessage::HighQc(qc) | GeneralConsensusMessage::ExtendedQc(qc, _) => qc.view_number(), } - } + }, SequencingMessage::Da(da_message) => { match da_message { DaConsensusMessage::DaProposal(p) => { // view of leader in the leaf when proposal // this should match replica upon receipt p.data.view_number() - } + }, DaConsensusMessage::DaVote(vote_message) => vote_message.view_number(), DaConsensusMessage::DaCertificate(cert) => cert.view_number, DaConsensusMessage::VidDisperseMsg(disperse) => disperse.data.view_number(), @@ -392,12 +390,12 @@ impl SequencingMessage { // view of leader in the leaf when proposal // this should match replica upon receipt p.data.view_number() - } + }, DaConsensusMessage::DaVote2(vote_message) => vote_message.view_number(), DaConsensusMessage::DaCertificate2(cert) => cert.view_number, DaConsensusMessage::VidDisperseMsg2(disperse) => disperse.data.view_number(), } - } + }, } } @@ -410,13 +408,13 @@ impl SequencingMessage { // view of leader in the leaf when proposal // this should match replica upon receipt p.data.epoch() - } + }, GeneralConsensusMessage::Proposal2(p) => { // view of leader in the leaf when proposal // this should match replica upon receipt p.data.epoch() - } - GeneralConsensusMessage::ProposalRequested(_, _) => None, + }, + GeneralConsensusMessage::ProposalRequested(..) => None, GeneralConsensusMessage::ProposalResponse(proposal) => proposal.data.epoch(), GeneralConsensusMessage::ProposalResponse2(proposal) => proposal.data.epoch(), GeneralConsensusMessage::Vote(vote_message) => vote_message.epoch(), @@ -427,35 +425,35 @@ impl SequencingMessage { GeneralConsensusMessage::ViewSyncFinalizeVote(message) => message.epoch(), GeneralConsensusMessage::ViewSyncPreCommitCertificate(message) => { message.epoch() - } + }, GeneralConsensusMessage::ViewSyncCommitCertificate(message) => message.epoch(), GeneralConsensusMessage::ViewSyncFinalizeCertificate(message) => { message.epoch() - } + }, GeneralConsensusMessage::TimeoutVote2(message) => message.epoch(), GeneralConsensusMessage::ViewSyncPreCommitVote2(message) => message.epoch(), GeneralConsensusMessage::ViewSyncCommitVote2(message) => message.epoch(), GeneralConsensusMessage::ViewSyncFinalizeVote2(message) => message.epoch(), GeneralConsensusMessage::ViewSyncPreCommitCertificate2(message) => { message.epoch() - } + }, GeneralConsensusMessage::ViewSyncCommitCertificate2(message) => message.epoch(), GeneralConsensusMessage::ViewSyncFinalizeCertificate2(message) => { message.epoch() - } + }, GeneralConsensusMessage::UpgradeProposal(message) => message.data.epoch(), GeneralConsensusMessage::UpgradeVote(message) => message.epoch(), GeneralConsensusMessage::HighQc(qc) | GeneralConsensusMessage::ExtendedQc(qc, _) => qc.epoch(), } - } + }, SequencingMessage::Da(da_message) => { match da_message { DaConsensusMessage::DaProposal(p) => { // view of leader in the leaf when proposal // this should match replica upon receipt p.data.epoch() - } + }, DaConsensusMessage::DaVote(vote_message) => vote_message.epoch(), DaConsensusMessage::DaCertificate(cert) => cert.epoch(), DaConsensusMessage::VidDisperseMsg(disperse) => disperse.data.epoch(), @@ -464,11 +462,11 @@ impl SequencingMessage { // view of leader in the leaf when proposal // this should match replica upon receipt p.data.epoch() - } + }, DaConsensusMessage::DaVote2(vote_message) => vote_message.epoch(), DaConsensusMessage::DaCertificate2(cert) => cert.epoch(), } - } + }, } } } @@ -658,7 +656,7 @@ impl UpgradeLock { } else { V::Base::VERSION } - } + }, None => V::Base::VERSION, }; @@ -678,7 +676,7 @@ impl UpgradeLock { } else { cert.data.old_version } - } + }, None => V::Base::VERSION, } } @@ -707,7 +705,7 @@ impl UpgradeLock { v if v == V::Upgrade::VERSION => Serializer::::serialize(&message), v => { bail!("Attempted to serialize with version {}, which is incompatible. This should be impossible.", v); - } + }, }; serialized_message @@ -734,7 +732,7 @@ impl UpgradeLock { v if v == V::Upgrade::VERSION => Serializer::::deserialize(message), v => { bail!("Cannot deserialize message with stated version {}", v); - } + }, } .wrap() .context(info!("Failed to deserialize message!"))?; diff --git a/hotshot-types/src/network.rs b/hotshot-types/src/network.rs index f2d35b6984..3a5dd4fe31 100644 --- a/hotshot-types/src/network.rs +++ b/hotshot-types/src/network.rs @@ -209,7 +209,7 @@ impl NetworkConfig { Ok(data) => data, Err(e) => { return Err(NetworkConfigError::ReadFromFileError(e)); - } + }, }; // deserialize @@ -256,7 +256,7 @@ impl NetworkConfig { Ok(data) => data, Err(e) => { return Err(NetworkConfigError::SerializeError(e)); - } + }, }; // write to file diff --git a/hotshot-types/src/simple_vote.rs b/hotshot-types/src/simple_vote.rs index 547db100a6..1ae78c4f20 100644 --- a/hotshot-types/src/simple_vote.rs +++ b/hotshot-types/src/simple_vote.rs @@ -19,8 +19,7 @@ use serde::{de::DeserializeOwned, Deserialize, Serialize}; use vbs::version::Version; use crate::{ - data::VidCommitment, - data::{Leaf, Leaf2}, + data::{Leaf, Leaf2, VidCommitment}, message::UpgradeLock, traits::{ node_implementation::{NodeType, Versions}, diff --git a/hotshot-types/src/traits/storage.rs b/hotshot-types/src/traits/storage.rs index 1b66b4d512..4d4edbc71c 100644 --- a/hotshot-types/src/traits/storage.rs +++ b/hotshot-types/src/traits/storage.rs @@ -18,11 +18,10 @@ use committable::Commitment; use super::node_implementation::NodeType; use crate::{ consensus::{CommitmentMap, View}, - data::VidCommitment, data::{ vid_disperse::{ADVZDisperseShare, VidDisperseShare2}, DaProposal, DaProposal2, Leaf, Leaf2, QuorumProposal, QuorumProposal2, - QuorumProposalWrapper, VidDisperseShare, + QuorumProposalWrapper, VidCommitment, VidDisperseShare, }, event::HotShotAction, message::{convert_proposal, Proposal}, @@ -54,7 +53,7 @@ pub trait Storage: Send + Sync + Clone { _pd: std::marker::PhantomData, }) .await - } + }, VidDisperseShare::V1(share) => { self.append_vid2(&Proposal { data: share.clone(), @@ -62,7 +61,7 @@ pub trait Storage: Send + Sync + Clone { _pd: std::marker::PhantomData, }) .await - } + }, } } /// Add a proposal to the stored DA proposals. diff --git a/hotshot-types/src/vote.rs b/hotshot-types/src/vote.rs index 21d2f8ad85..4cbd851477 100644 --- a/hotshot-types/src/vote.rs +++ b/hotshot-types/src/vote.rs @@ -179,7 +179,7 @@ impl< Err(e) => { tracing::warn!("Failed to generate versioned vote data: {e}"); return None; - } + }, }; if !key.validate(&vote.signature(), vote_commitment.as_ref()) { diff --git a/hotshot-utils/src/anytrace.rs b/hotshot-utils/src/anytrace.rs index 12e129ca01..b9aec49221 100644 --- a/hotshot-utils/src/anytrace.rs +++ b/hotshot-utils/src/anytrace.rs @@ -24,21 +24,21 @@ impl Log for Error { match error_level { Level::Trace => { tracing::trace!("{}", self.message); - } + }, Level::Debug => { tracing::debug!("{}", self.message); - } + }, Level::Info => { tracing::info!("{}", self.message); - } + }, Level::Warn => { tracing::warn!("{}", self.message); - } + }, Level::Error => { tracing::error!("{}", self.message); - } + }, // impossible - Level::Unspecified => {} + Level::Unspecified => {}, } } } @@ -48,7 +48,7 @@ impl Log for Result { let error = match self { Ok(_) => { return; - } + }, Err(e) => e, }; @@ -60,21 +60,21 @@ impl Log for Result { match error_level { Level::Trace => { tracing::trace!("{}", error.message); - } + }, Level::Debug => { tracing::debug!("{}", error.message); - } + }, Level::Info => { tracing::info!("{}", error.message); - } + }, Level::Warn => { tracing::warn!("{}", error.message); - } + }, Level::Error => { tracing::error!("{}", error.message); - } + }, // impossible - Level::Unspecified => {} + Level::Unspecified => {}, } } } diff --git a/hotshot-utils/src/anytrace/macros.rs b/hotshot-utils/src/anytrace/macros.rs index 29c5178b07..b9f6b7db56 100644 --- a/hotshot-utils/src/anytrace/macros.rs +++ b/hotshot-utils/src/anytrace/macros.rs @@ -167,21 +167,21 @@ macro_rules! log { match error_level { Level::Trace => { tracing::trace!("{}", error.message); - } + }, Level::Debug => { tracing::debug!("{}", error.message); - } + }, Level::Info => { tracing::info!("{}", error.message); - } + }, Level::Warn => { tracing::warn!("{}", error.message); - } + }, Level::Error => { tracing::error!("{}", error.message); - } + }, // impossible - Level::Unspecified => {} + Level::Unspecified => {}, } } }; diff --git a/hotshot/src/lib.rs b/hotshot/src/lib.rs index 84400a2364..0e571e77a8 100644 --- a/hotshot/src/lib.rs +++ b/hotshot/src/lib.rs @@ -217,10 +217,10 @@ impl, V: Versions> SystemContext {} + Ok(()) => {}, Err(e) => { panic!("Failed to migrate consensus storage: {e}"); - } + }, } let internal_chan = broadcast(EVENT_CHANNEL_SIZE); @@ -760,10 +760,10 @@ where match event { Either::Left(msg) => { let _ = left_sender.broadcast(msg.into()).await; - } + }, Either::Right(msg) => { let _ = right_sender.broadcast(msg.into()).await; - } + }, } } } diff --git a/hotshot/src/tasks/mod.rs b/hotshot/src/tasks/mod.rs index e69ed4aaa2..7ca4abda80 100644 --- a/hotshot/src/tasks/mod.rs +++ b/hotshot/src/tasks/mod.rs @@ -280,13 +280,13 @@ pub fn create_shutdown_event_monitor { return; - } + }, Err(e) => { tracing::error!("Shutdown event monitor channel recv error: {}", e); - } + }, } } } diff --git a/hotshot/src/traits/networking/combined_network.rs b/hotshot/src/traits/networking/combined_network.rs index 438f790d68..6e9e01f472 100644 --- a/hotshot/src/traits/networking/combined_network.rs +++ b/hotshot/src/traits/networking/combined_network.rs @@ -184,12 +184,12 @@ impl CombinedNetworks { // The primary fail counter reached 0, the primary is now considered up primary_down.store(false, Ordering::Relaxed); debug!("primary_fail_counter reached zero, primary_down set to false"); - } + }, c => { // Decrement the primary fail counter primary_fail_counter.store(c - 1, Ordering::Relaxed); debug!("primary_fail_counter set to {:?}", c - 1); - } + }, } return Ok(()); } @@ -210,7 +210,7 @@ impl CombinedNetworks { c if c < COMBINED_NETWORK_PRIMARY_CHECK_INTERVAL => { // Just increment the 'no delay counter' self.no_delay_counter.store(c + 1, Ordering::Relaxed); - } + }, _ => { // The 'no delay counter' reached the threshold debug!( @@ -225,7 +225,7 @@ impl CombinedNetworks { // The primary fail counter is set just below the threshold to delay the next message self.primary_fail_counter .store(COMBINED_NETWORK_MIN_PRIMARY_FAILURES, Ordering::Relaxed); - } + }, } } // Send the message diff --git a/hotshot/src/traits/networking/libp2p_network.rs b/hotshot/src/traits/networking/libp2p_network.rs index 24ae0d9138..d0a23710cf 100644 --- a/hotshot/src/traits/networking/libp2p_network.rs +++ b/hotshot/src/traits/networking/libp2p_network.rs @@ -290,7 +290,7 @@ impl TestableNetworkingImplementation for Libp2pNetwork { Ok(network) => network, Err(err) => { panic!("Failed to create libp2p network: {err:?}"); - } + }, }, ) }) @@ -373,7 +373,7 @@ pub fn derive_libp2p_multiaddr(addr: &String) -> anyhow::Result { } format!("/dns/{host}/udp/{port}/quic-v1") - } + }, }; // Convert the multiaddr string to a `Multiaddr` @@ -681,7 +681,7 @@ impl Libp2pNetwork { sender.try_send(msg).map_err(|err| { NetworkError::ChannelSendError(format!("failed to send gossip message: {err}")) })?; - } + }, DirectRequest(msg, _pid, chan) => { sender.try_send(msg).map_err(|err| { NetworkError::ChannelSendError(format!( @@ -703,12 +703,12 @@ impl Libp2pNetwork { { error!("failed to ack!"); }; - } - DirectResponse(_msg, _) => {} + }, + DirectResponse(_msg, _) => {}, NetworkEvent::IsBootstrapped => { error!("handle_recvd_events received `NetworkEvent::IsBootstrapped`, which should be impossible."); - } - NetworkEvent::ConnectedPeersUpdate(_) => {} + }, + NetworkEvent::ConnectedPeersUpdate(_) => {}, } Ok::<(), NetworkError>(()) } @@ -910,7 +910,7 @@ impl ConnectedNetwork for Libp2pNetwork { return Err(NetworkError::LookupError(format!( "failed to look up node for direct message: {err}" ))); - } + }, }; #[cfg(feature = "hotshot-testing")] @@ -942,7 +942,7 @@ impl ConnectedNetwork for Libp2pNetwork { Err(e) => { self.inner.metrics.num_failed_messages.add(1); Err(e) - } + }, } } @@ -1006,7 +1006,7 @@ impl ConnectedNetwork for Libp2pNetwork { "Failed to calculate leader for view {:?}: {e}", future_view ); - } + }, }; let _ = self diff --git a/hotshot/src/traits/networking/memory_network.rs b/hotshot/src/traits/networking/memory_network.rs index 9aa8adfef2..4a0663d246 100644 --- a/hotshot/src/traits/networking/memory_network.rs +++ b/hotshot/src/traits/networking/memory_network.rs @@ -282,10 +282,10 @@ impl ConnectedNetwork for MemoryNetwork { match res { Ok(()) => { trace!(?key, "Delivered message to remote"); - } + }, Err(e) => { warn!(?e, ?key, "Error sending broadcast message to node"); - } + }, } } } @@ -336,10 +336,10 @@ impl ConnectedNetwork for MemoryNetwork { match res { Ok(()) => { trace!(?key, "Delivered message to remote"); - } + }, Err(e) => { warn!(?e, ?key, "Error sending broadcast message to node"); - } + }, } } } @@ -375,7 +375,7 @@ impl ConnectedNetwork for MemoryNetwork { Ok(()) => { trace!(?recipient, "Delivered message to remote"); Ok(()) - } + }, Err(e) => Err(NetworkError::MessageSendError(format!( "error sending direct message to node: {e}", ))), diff --git a/hotshot/src/traits/networking/push_cdn_network.rs b/hotshot/src/traits/networking/push_cdn_network.rs index a742e5f857..0f222f2729 100644 --- a/hotshot/src/traits/networking/push_cdn_network.rs +++ b/hotshot/src/traits/networking/push_cdn_network.rs @@ -591,7 +591,7 @@ impl ConnectedNetwork for PushCdnNetwork { return Err(NetworkError::MessageReceiveError(format!( "failed to receive message: {error}" ))); - } + }, }; // Extract the underlying message diff --git a/hotshot/src/types/handle.rs b/hotshot/src/types/handle.rs index f8c82dfad6..8f0e9f850f 100644 --- a/hotshot/src/types/handle.rs +++ b/hotshot/src/types/handle.rs @@ -115,17 +115,17 @@ impl + 'static, V: Versions> self.network .broadcast_message(serialized_message, Topic::Global, BroadcastDelay::None) .await?; - } + }, RecipientList::Direct(recipient) => { self.network .direct_message(serialized_message, recipient) .await?; - } + }, RecipientList::Many(recipients) => { self.network .da_broadcast_message(serialized_message, recipients, BroadcastDelay::None) .await?; - } + }, } Ok(()) } diff --git a/marketplace-builder-core/src/service.rs b/marketplace-builder-core/src/service.rs index 29fff93c46..8ade390422 100644 --- a/marketplace-builder-core/src/service.rs +++ b/marketplace-builder-core/src/service.rs @@ -10,10 +10,10 @@ use marketplace_builder_shared::{ pub use async_broadcast::{broadcast, RecvError, TryRecvError}; use async_trait::async_trait; use committable::{Commitment, Committable}; -use futures::{future::BoxFuture, stream::FuturesUnordered, Stream}; use futures::{ - stream::{FuturesOrdered, StreamExt}, - TryStreamExt, + future::BoxFuture, + stream::{FuturesOrdered, FuturesUnordered, StreamExt}, + Stream, TryStreamExt, }; use hotshot::types::Event; use hotshot_builder_api::{ @@ -23,18 +23,17 @@ use hotshot_builder_api::{ data_source::{AcceptsTxnSubmits, BuilderDataSource}, }, }; -use hotshot_types::bundle::Bundle; -use hotshot_types::traits::block_contents::{BuilderFee, Transaction}; use hotshot_types::{ + bundle::Bundle, data::VidCommitment, event::EventType, traits::{ + block_contents::{BuilderFee, Transaction}, node_implementation::{ConsensusTime, NodeType}, signature_key::{BuilderSignatureKey, SignatureKey}, }, }; -use std::sync::Arc; -use std::{fmt::Display, time::Instant}; +use std::{fmt::Display, sync::Arc, time::Instant}; use tagged_base64::TaggedBase64; use tide_disco::{app::AppError, method::ReadState, App}; use tokio::{spawn, task::JoinHandle, time::sleep}; @@ -189,7 +188,7 @@ where match event.event { EventType::Error { error } => { tracing::error!("Error event in HotShot: {:?}", error); - } + }, EventType::Transactions { transactions } => { let hooks = Arc::clone(&hooks); let coordinator = Arc::clone(&coordinator); @@ -208,20 +207,20 @@ where .collect::>() .await; }); - } + }, EventType::Decide { leaf_chain, .. } => { let coordinator = Arc::clone(&coordinator); spawn(async move { coordinator.handle_decide(leaf_chain).await }); - } + }, EventType::DaProposal { proposal, .. } => { let coordinator = Arc::clone(&coordinator); spawn(async move { coordinator.handle_da_proposal(proposal.data).await }); - } + }, EventType::QuorumProposal { proposal, .. } => { let coordinator = Arc::clone(&coordinator); spawn(async move { coordinator.handle_quorum_proposal(proposal.data).await }); - } - _ => {} + }, + _ => {}, } } } @@ -356,14 +355,14 @@ where // If we couldn't find the state because it hasn't yet been created, try again sleep(self.api_timeout / 10).await; continue; - } + }, BuilderStateLookup::Decided => { // If we couldn't find the state because the view has already been decided, we can just return an error tracing::warn!("Requested a bundle for view we already GCd as decided",); return Err(BuildError::Error( "Request for a bundle for a view that has already been decided.".to_owned(), )); - } + }, }; tracing::info!( diff --git a/marketplace-builder-core/src/testing/basic_test.rs b/marketplace-builder-core/src/testing/basic_test.rs index 1d4cf42c5f..71dd3c7d18 100644 --- a/marketplace-builder-core/src/testing/basic_test.rs +++ b/marketplace-builder-core/src/testing/basic_test.rs @@ -4,11 +4,12 @@ use hotshot_builder_api::v0_99::data_source::{AcceptsTxnSubmits, BuilderDataSour use hotshot_example_types::block_types::TestTransaction; use tracing_test::traced_test; -use crate::hooks::NoHooks; -use crate::service::{BuilderConfig, GlobalState, ProxyGlobalState}; +use crate::{ + hooks::NoHooks, + service::{BuilderConfig, GlobalState, ProxyGlobalState}, +}; use marketplace_builder_shared::testing::consensus::SimulatedChainState; -use std::marker::PhantomData; -use std::sync::Arc; +use std::{marker::PhantomData, sync::Arc}; /// This test simulates multiple builder states receiving messages from the channels and processing them #[tokio::test] diff --git a/marketplace-builder-core/src/testing/integration.rs b/marketplace-builder-core/src/testing/integration.rs index 1b986aa549..14c6e30cee 100644 --- a/marketplace-builder-core/src/testing/integration.rs +++ b/marketplace-builder-core/src/testing/integration.rs @@ -125,8 +125,7 @@ mod tests { validation::BuilderValidationConfig, }; - use hotshot_example_types::node_types::MarketplaceTestVersions; - use hotshot_example_types::node_types::{MemoryImpl, TestTypes}; + use hotshot_example_types::node_types::{MarketplaceTestVersions, MemoryImpl, TestTypes}; use hotshot_macros::cross_tests; use hotshot_testing::{ completion_task::{CompletionTaskDescription, TimeBasedCompletionTaskDescription}, diff --git a/marketplace-builder-core/src/testing/order_test.rs b/marketplace-builder-core/src/testing/order_test.rs index 9de0297172..036cb8cad8 100644 --- a/marketplace-builder-core/src/testing/order_test.rs +++ b/marketplace-builder-core/src/testing/order_test.rs @@ -64,12 +64,12 @@ impl RoundTransactionBehavior { ]), ); transactions - } + }, RoundTransactionBehavior::AdjustRemoveTail => { let mut transactions = transactions.clone(); transactions.pop(); transactions - } + }, RoundTransactionBehavior::ProposeInAdvance(propose_in_advance_round) => { let mut transactions = transactions.clone(); transactions.push(TestTransaction::new(vec![ @@ -77,12 +77,12 @@ impl RoundTransactionBehavior { 0_u8, ])); transactions - } + }, RoundTransactionBehavior::AdjustRemove => { let mut transactions = transactions.clone(); transactions.remove(rand::random::() % (transactions.len() - 1)); transactions - } + }, } } } diff --git a/marketplace-builder-shared/src/block.rs b/marketplace-builder-shared/src/block.rs index 1f458f2e62..b9775b2aaa 100644 --- a/marketplace-builder-shared/src/block.rs +++ b/marketplace-builder-shared/src/block.rs @@ -3,11 +3,12 @@ use std::time::Instant; use committable::{Commitment, Committable}; -use hotshot_types::data::{fake_commitment, Leaf2}; -use hotshot_types::traits::node_implementation::ConsensusTime; use hotshot_types::{ - data::VidCommitment, - traits::{block_contents::Transaction, node_implementation::NodeType}, + data::{fake_commitment, Leaf2, VidCommitment}, + traits::{ + block_contents::Transaction, + node_implementation::{ConsensusTime, NodeType}, + }, utils::BuilderCommitment, }; diff --git a/marketplace-builder-shared/src/coordinator/mod.rs b/marketplace-builder-shared/src/coordinator/mod.rs index e546aa3f23..b3b9b81da4 100644 --- a/marketplace-builder-shared/src/coordinator/mod.rs +++ b/marketplace-builder-shared/src/coordinator/mod.rs @@ -195,7 +195,7 @@ where }, ); return Err(Error::TxnSender(err)); - } + }, }; self.update_txn_status(&commit, TransactionStatus::Pending); @@ -251,15 +251,15 @@ where (Either::Right(da_proposal), Either::Left(quorum_proposal)) | (Either::Left(quorum_proposal), Either::Right(da_proposal)) => { self.spawn_builder_state(quorum_proposal, da_proposal).await - } + }, _ => { unreachable!() - } + }, } - } + }, Entry::Vacant(entry) => { entry.insert(proposal); - } + }, } } @@ -499,10 +499,10 @@ where "Not changing status of rejected/sequenced transaction", ); return; - } + }, _ => { tracing::debug!(?old_status, ?new_status, "Changing status of transaction",); - } + }, } } self.tx_status.insert(*txn_hash, new_status); diff --git a/marketplace-builder-shared/src/coordinator/tiered_view_map.rs b/marketplace-builder-shared/src/coordinator/tiered_view_map.rs index 6d52f3d955..46d648bebd 100644 --- a/marketplace-builder-shared/src/coordinator/tiered_view_map.rs +++ b/marketplace-builder-shared/src/coordinator/tiered_view_map.rs @@ -143,10 +143,10 @@ where match self.0.entry(*key.view()) { Entry::Vacant(entry) => { entry.insert(nem![key.into_subkey() => value]); - } + }, Entry::Occupied(mut entry) => { entry.get_mut().insert(key.into_subkey(), value); - } + }, } } diff --git a/marketplace-builder-shared/src/error.rs b/marketplace-builder-shared/src/error.rs index ac2d3b155e..9200c49c06 100644 --- a/marketplace-builder-shared/src/error.rs +++ b/marketplace-builder-shared/src/error.rs @@ -33,18 +33,18 @@ impl From> for BuildError { match value { Error::SignatureValidation => { BuildError::Error("Signature validation failed".to_owned()) - } + }, Error::Signing(_) => BuildError::Error("Failed to sign response".to_owned()), Error::ApiTimeout => BuildError::Error("Timeout".to_owned()), Error::NotFound => BuildError::NotFound, Error::AlreadyDecided => { BuildError::Error("Request for an already decided view".to_owned()) - } + }, Error::BuildBlock(_) => BuildError::Error("Failed to build block".to_owned()), Error::TxnSender(_) => BuildError::Error("Transaction channel error".to_owned()), Error::TxTooBig { len, max_tx_len } => { BuildError::Error(format!("Transaction too big ({len}/{max_tx_len}")) - } + }, } } } diff --git a/marketplace-builder-shared/src/state.rs b/marketplace-builder-shared/src/state.rs index 9666d17337..9cee9aa3f1 100644 --- a/marketplace-builder-shared/src/state.rs +++ b/marketplace-builder-shared/src/state.rs @@ -208,7 +208,7 @@ where self.txn_queue.write().await.insert(txn); queue_empty = false; - } + }, Err(async_broadcast::TryRecvError::Empty) | Err(async_broadcast::TryRecvError::Closed) => { @@ -216,12 +216,12 @@ where // If it's closed that's a big problem and we should // probably indicate it as such. break; - } + }, Err(async_broadcast::TryRecvError::Overflowed(lost)) => { tracing::warn!("Missed {lost} transactions due to backlog"); continue; - } + }, } } queue_empty diff --git a/marketplace-builder-shared/src/testing/consensus.rs b/marketplace-builder-shared/src/testing/consensus.rs index 93845e7113..6734342082 100644 --- a/marketplace-builder-shared/src/testing/consensus.rs +++ b/marketplace-builder-shared/src/testing/consensus.rs @@ -2,8 +2,7 @@ use std::marker::PhantomData; -use crate::block::BuilderStateId; -use crate::testing::constants::TEST_NUM_NODES_IN_VID_COMPUTATION; +use crate::{block::BuilderStateId, testing::constants::TEST_NUM_NODES_IN_VID_COMPUTATION}; use async_broadcast::Sender; use committable::Committable; use hotshot::{ @@ -17,8 +16,10 @@ use hotshot_example_types::{ state_types::{TestInstanceState, TestValidatedState}, }; use hotshot_types::{ - data::vid_commitment, - data::{DaProposal2, EpochNumber, Leaf2, QuorumProposal2, QuorumProposalWrapper, ViewNumber}, + data::{ + vid_commitment, DaProposal2, EpochNumber, Leaf2, QuorumProposal2, QuorumProposalWrapper, + ViewNumber, + }, message::Proposal, simple_certificate::{QuorumCertificate, SimpleCertificate, SuccessThreshold}, simple_vote::QuorumData2, @@ -123,7 +124,7 @@ impl SimulatedChainState { prev_justify_qc.signatures.clone(), PhantomData, ) - } + }, }; tracing::debug!("Iteration: {} justify_qc: {:?}", self.round, justify_qc); diff --git a/marketplace-builder-shared/src/testing/generation.rs b/marketplace-builder-shared/src/testing/generation.rs index d7667a24e8..e16293a384 100644 --- a/marketplace-builder-shared/src/testing/generation.rs +++ b/marketplace-builder-shared/src/testing/generation.rs @@ -137,7 +137,7 @@ where .map(Result::unwrap), ); } - } + }, GenerationStrategy::Random { min_per_view, max_per_view, @@ -164,7 +164,7 @@ where self.txn_nonce += 1; } - } + }, GenerationStrategy::Flood { min_tx_size, max_tx_size, @@ -188,7 +188,7 @@ where self.txn_nonce += 1; } - } + }, }; } } @@ -235,7 +235,7 @@ where .publish_transaction_async(txn) .await .expect("Failed to submit transaction to public mempool"); - } + }, SubmissionEndpoint::Private => { if let Err(e) = private_mempool_client .post::<()>("submit") @@ -248,17 +248,17 @@ where // If we can't reach the builder altogether, test should fail builder::Error::Request(request_error) => { panic!("Builder API not available: {request_error}") - } + }, // If the builder returns an error, we will re-submit this transaction // on the next view, so we return it to the queue and break error => { tracing::warn!(?error, "Builder API error"); self.txn_queue.push_front(txn); break; - } + }, }; } - } + }, } } } diff --git a/marketplace-builder-shared/src/testing/mock.rs b/marketplace-builder-shared/src/testing/mock.rs index 31d8c4fbf6..1e0e7c2cf4 100644 --- a/marketplace-builder-shared/src/testing/mock.rs +++ b/marketplace-builder-shared/src/testing/mock.rs @@ -2,38 +2,34 @@ use std::{marker::PhantomData, sync::Arc, time::Duration}; use async_broadcast::broadcast; -use committable::Commitment; -use committable::Committable; -use hotshot_example_types::block_types::{TestBlockHeader, TestBlockPayload, TestTransaction}; +use committable::{Commitment, Committable}; use hotshot_example_types::{ + block_types::{TestBlockHeader, TestBlockPayload, TestTransaction}, node_types::{TestTypes, TestVersions}, state_types::{TestInstanceState, TestValidatedState}, }; -use hotshot_types::data::DaProposal2; -use hotshot_types::data::ViewNumber; -use hotshot_types::data::{QuorumProposal2, QuorumProposalWrapper}; -use hotshot_types::event::LeafInfo; -use hotshot_types::simple_certificate::QuorumCertificate2; -use hotshot_types::simple_vote::QuorumData2; -use hotshot_types::traits::block_contents::GENESIS_VID_NUM_STORAGE_NODES; -use hotshot_types::traits::node_implementation::Versions; -use hotshot_types::traits::EncodeBytes; -use hotshot_types::vid::advz::advz_scheme; use hotshot_types::{ - data::{random_commitment, vid_commitment, Leaf, Leaf2}, + data::{ + random_commitment, vid_commitment, DaProposal2, Leaf, Leaf2, QuorumProposal2, + QuorumProposalWrapper, ViewNumber, + }, + event::LeafInfo, message::UpgradeLock, - simple_certificate::QuorumCertificate, - simple_vote::VersionedVoteData, - traits::node_implementation::{ConsensusTime, NodeType}, - traits::BlockPayload, + simple_certificate::{QuorumCertificate, QuorumCertificate2}, + simple_vote::{QuorumData2, VersionedVoteData}, + traits::{ + block_contents::GENESIS_VID_NUM_STORAGE_NODES, + node_implementation::{ConsensusTime, NodeType, Versions}, + BlockPayload, EncodeBytes, + }, utils::BuilderCommitment, + vid::advz::advz_scheme, }; use jf_vid::VidScheme; use rand::{distributions::Standard, thread_rng, Rng}; use vbs::version::StaticVersionType; -use crate::block::ParentBlockReferences; -use crate::state::BuilderState; +use crate::{block::ParentBlockReferences, state::BuilderState}; use super::constants::{TEST_CHANNEL_BUFFER_SIZE, TEST_NUM_NODES_IN_VID_COMPUTATION}; diff --git a/marketplace-builder-shared/src/utils/event_service_wrapper.rs b/marketplace-builder-shared/src/utils/event_service_wrapper.rs index ece95e072d..60af919583 100644 --- a/marketplace-builder-shared/src/utils/event_service_wrapper.rs +++ b/marketplace-builder-shared/src/utils/event_service_wrapper.rs @@ -4,13 +4,11 @@ use std::time::Duration; use anyhow::Context; use either::Either::{self, Left, Right}; -use futures::stream::unfold; -use futures::{Stream, StreamExt}; +use futures::{stream::unfold, Stream, StreamExt}; use hotshot::types::Event; use hotshot_events_service::events::Error as EventStreamError; use hotshot_types::traits::node_implementation::NodeType; -use surf_disco::client::HealthStatus; -use surf_disco::Client; +use surf_disco::{client::HealthStatus, Client}; use tokio::time::{sleep, timeout}; use tracing::{error, warn}; use url::Url; @@ -58,7 +56,7 @@ impl EventServiceStream break, Err(err) => { tracing::debug!(?err, "Healthcheck failed, retrying"); - } + }, } sleep(Self::RETRY_PERIOD).await; } @@ -90,18 +88,18 @@ impl EventServiceStream { return Some((event, this)); - } + }, Ok(Some(Err(err))) => { warn!(?err, "Error in event stream"); continue; - } + }, Ok(None) => { warn!("Event stream ended, attempting reconnection"); let fut = Self::connect_inner(this.api_url.clone()); let _ = std::mem::replace(&mut this.connection, Right(Box::pin(fut))); continue; - } + }, Err(_) => { // Timeout occurred, reconnect warn!("Timeout waiting for next event; reconnecting"); @@ -109,21 +107,21 @@ impl EventServiceStream match reconnection.await { Ok(connection) => { let _ = std::mem::replace(&mut this.connection, Left(connection)); continue; - } + }, Err(err) => { error!(?err, "Error while reconnecting, will retry in a while"); sleep(Self::RETRY_PERIOD).await; let fut = Self::connect_inner(this.api_url.clone()); let _ = std::mem::replace(&mut this.connection, Right(Box::pin(fut))); continue; - } + }, }, } } diff --git a/marketplace-builder/src/bin/marketplace-builder.rs b/marketplace-builder/src/bin/marketplace-builder.rs index c23cf6a1b3..d6aa8d16bb 100644 --- a/marketplace-builder/src/bin/marketplace-builder.rs +++ b/marketplace-builder/src/bin/marketplace-builder.rs @@ -129,11 +129,11 @@ async fn main() -> anyhow::Result<()> { match (base, upgrade) { (FeeVersion::VERSION, MarketplaceVersion::VERSION) => { run::>(genesis, opt).await - } + }, (FeeVersion::VERSION, _) => run::>(genesis, opt).await, (MarketplaceVersion::VERSION, _) => { run::>(genesis, opt).await - } + }, _ => panic!( "Invalid base ({base}) and upgrade ({upgrade}) versions specified in the toml file." ), diff --git a/marketplace-builder/src/builder.rs b/marketplace-builder/src/builder.rs index 8de45bf4d3..4389843856 100644 --- a/marketplace-builder/src/builder.rs +++ b/marketplace-builder/src/builder.rs @@ -209,8 +209,7 @@ mod test { use anyhow::Error; use async_lock::RwLock; - use committable::Commitment; - use committable::Committable; + use committable::{Commitment, Committable}; use espresso_types::{ mock::MockStateCatchup, v0_99::{RollupRegistration, RollupRegistrationBody}, @@ -220,12 +219,14 @@ mod test { use ethers::{core::k256::elliptic_curve::rand_core::block, utils::Anvil}; use futures::{Stream, StreamExt}; use hooks::connect_to_solver; - use hotshot::helpers::initialize_logging; - use hotshot::types::{ - BLSPrivKey, - EventType::{Decide, *}, + use hotshot::{ + helpers::initialize_logging, + rand, + types::{ + BLSPrivKey, EventType, + EventType::{Decide, *}, + }, }; - use hotshot::{rand, types::EventType}; use hotshot_builder_api::v0_99::builder::BuildError; use hotshot_events_service::{ events::{Error as EventStreamApiError, Options as EventStreamingApiOptions}, @@ -247,15 +248,17 @@ mod test { use marketplace_solver::{testing::MockSolver, SolverError}; use portpicker::pick_unused_port; use sequencer::{ - api::test_helpers::TestNetworkConfigBuilder, + api::{ + fs::DataSource, + options::HotshotEvents, + test_helpers::{TestNetwork, TestNetworkConfigBuilder}, + Options, + }, + persistence, persistence::no_storage::{self, NoStorage}, testing::TestConfigBuilder, SequencerApiVersion, }; - use sequencer::{ - api::{fs::DataSource, options::HotshotEvents, test_helpers::TestNetwork, Options}, - persistence, - }; use sequencer_utils::test_utils::setup_test; use surf_disco::{ socket::{Connection, Unsupported}, @@ -607,7 +610,7 @@ mod test { get_bundle(builder_client, parent_view_number, parent_commitment).await, parent_view_number, ) - } + }, Mempool::Private => { submit_and_get_bundle_with_private_mempool( builder_client, @@ -615,7 +618,7 @@ mod test { urls, ) .await - } + }, }; assert_eq!(bundle.transactions, vec![registered_transaction.clone()]); @@ -727,7 +730,7 @@ mod test { get_bundle(builder_client, parent_view_number, parent_commitment).await, parent_view_number, ) - } + }, Mempool::Private => { submit_and_get_bundle_with_private_mempool( builder_client, @@ -735,7 +738,7 @@ mod test { urls, ) .await - } + }, }; assert_eq!(bundle.transactions, vec![unregistered_transaction.clone()]); diff --git a/marketplace-builder/src/hooks.rs b/marketplace-builder/src/hooks.rs index ede7452152..64f7f21c08 100644 --- a/marketplace-builder/src/hooks.rs +++ b/marketplace-builder/src/hooks.rs @@ -1,6 +1,4 @@ -use std::collections::HashSet; -use std::sync::Arc; -use std::time::Duration; +use std::{collections::HashSet, sync::Arc, time::Duration}; use async_lock::RwLock; use async_trait::async_trait; @@ -9,8 +7,7 @@ use tokio::{spawn, time::sleep}; use espresso_types::v0_99::RollupRegistration; -use espresso_types::MarketplaceVersion; -use espresso_types::SeqTypes; +use espresso_types::{MarketplaceVersion, SeqTypes}; use hotshot::types::EventType; use hotshot::types::Event; @@ -26,14 +23,12 @@ use espresso_types::NamespaceId; use hotshot_types::traits::node_implementation::NodeType; -use marketplace_solver::SolverError; -use marketplace_solver::SOLVER_API_PATH; +use marketplace_solver::{SolverError, SOLVER_API_PATH}; use sequencer::SequencerApiVersion; use surf_disco::Client; use tide_disco::Url; -use tracing::error; -use tracing::info; +use tracing::{error, info}; /// Configurations for bid submission. pub struct BidConfig { @@ -67,11 +62,11 @@ pub async fn fetch_namespaces_to_skip(solver_base_url: Url) -> Option { error!("Failed to get the registered rollups: {:?}.", e); None - } + }, } } @@ -130,7 +125,7 @@ impl BuilderHooks for EspressoReserveHooks { Err(e) => { error!("Failed to sign the bid txn: {:?}.", e); return; - } + }, }; let solver_client = connect_to_solver(solver_base_url); @@ -172,12 +167,12 @@ impl BuilderHooks for EspressoFallbackHooks { Some(namespaces_to_skip) => { transactions.retain(|txn| !namespaces_to_skip.contains(&txn.namespace())); transactions - } + }, // Solver connection has failed and we don't have up-to-date information on this None => { error!("Not accepting transactions due to outdated information"); Vec::new() - } + }, } } diff --git a/marketplace-solver/src/api.rs b/marketplace-solver/src/api.rs index 5f0d9c8c30..11ed573a9a 100644 --- a/marketplace-solver/src/api.rs +++ b/marketplace-solver/src/api.rs @@ -164,7 +164,7 @@ fn merge_toml(into: &mut Value, from: Value) { Entry::Occupied(mut entry) => merge_toml(entry.get_mut(), value), Entry::Vacant(entry) => { entry.insert(value); - } + }, } } } diff --git a/marketplace-solver/src/database.rs b/marketplace-solver/src/database.rs index c2d09f84af..127c385935 100644 --- a/marketplace-solver/src/database.rs +++ b/marketplace-solver/src/database.rs @@ -60,7 +60,7 @@ impl PostgresClient { } connect_opts.to_url_lossy() - } + }, }; if let Some(max_connections) = max_connections { diff --git a/marketplace-solver/src/events.rs b/marketplace-solver/src/events.rs index 913fbe3151..89311b49d9 100644 --- a/marketplace-solver/src/events.rs +++ b/marketplace-solver/src/events.rs @@ -59,7 +59,7 @@ pub async fn handle_events( match event.event { hotshot::types::EventType::ViewFinished { view_number } => { tracing::debug!("received view finished event {view_number:?}") - } + }, _ => (), } } @@ -184,8 +184,7 @@ pub mod mock { mod test { use espresso_types::SeqTypes; use futures::StreamExt as _; - use hotshot::helpers::initialize_logging; - use hotshot::types::Event; + use hotshot::{helpers::initialize_logging, types::Event}; use hotshot_events_service::events_source::StartupInfo; use surf_disco::Client; diff --git a/marketplace-solver/src/testing.rs b/marketplace-solver/src/testing.rs index b6745fa86f..2e66fab969 100755 --- a/marketplace-solver/src/testing.rs +++ b/marketplace-solver/src/testing.rs @@ -192,7 +192,7 @@ mod test { let client = surf_disco::Client::::new(solver_api); client.connect(None).await; - let (reg_ns_1, _, _) = + let (reg_ns_1, ..) = register_rollup_helper(1, Some("http://localhost"), 200, true, "test").await; // registering a rollup @@ -230,7 +230,7 @@ mod test { let client = surf_disco::Client::::new(solver_api); client.connect(None).await; - let (reg_ns_1, _, _) = + let (reg_ns_1, ..) = register_rollup_helper(1, Some("http://localhost"), 200, true, "test").await; // registering a rollup @@ -268,7 +268,7 @@ mod test { // Ensure the error indicates an invalid signature match err { SolverError::InvalidSignature(signature) - if reg_ns_2.signature.to_string() == signature => {} + if reg_ns_2.signature.to_string() == signature => {}, _ => panic!("err {err:?}"), } } @@ -375,7 +375,7 @@ mod test { .unwrap_err(); match err { - SolverError::Database(_) => {} + SolverError::Database(_) => {}, _ => panic!("err {err:?}"), } } @@ -532,7 +532,7 @@ mod test { client.connect(Some(Duration::from_secs(5))).await; // Register the first rollup (ns = 1) - let (reg_ns_1, _, _) = + let (reg_ns_1, ..) = register_rollup_helper(1, Some("http://localhost"), 200, true, "test").await; let _: RollupRegistration = client .post("register_rollup") @@ -543,7 +543,7 @@ mod test { .unwrap(); // Register the second rollup (ns = 2) - let (reg_ns_2, _, _) = + let (reg_ns_2, ..) = register_rollup_helper(2, Some("http://localhost"), 200, true, "test").await; let _: RollupRegistration = client .post("register_rollup") diff --git a/node-metrics/src/api/node_validator/v0/cdn/mod.rs b/node-metrics/src/api/node_validator/v0/cdn/mod.rs index 9359afec01..a128b19fa7 100644 --- a/node-metrics/src/api/node_validator/v0/cdn/mod.rs +++ b/node-metrics/src/api/node_validator/v0/cdn/mod.rs @@ -95,7 +95,7 @@ impl CdnReceiveMessagesTask { Err(err) => { tracing::error!("error receiving message: {:?}", err); continue; - } + }, }; // We want to try and decode this message. @@ -106,17 +106,17 @@ impl CdnReceiveMessagesTask { Err(err) => { tracing::error!("error deserializing message: {:?}", err); continue; - } + }, }; let external_message_deserialize_result = match message.kind { MessageKind::External(external_message) => { bincode::deserialize::(&external_message) - } + }, _ => { tracing::error!("unexpected message kind: {:?}", message); continue; - } + }, }; let external_message = match external_message_deserialize_result { @@ -124,7 +124,7 @@ impl CdnReceiveMessagesTask { Err(err) => { tracing::error!("error deserializing message: {:?}", err); continue; - } + }, }; match external_message { @@ -137,11 +137,11 @@ impl CdnReceiveMessagesTask { tracing::error!("error sending public api url: {:?}", err); return; } - } + }, _ => { // We're not concerned about other message types - } + }, } } } @@ -237,7 +237,7 @@ impl BroadcastRollCallTask { Err(err) => { tracing::error!("error serializing rollcall request: {:?}", err); return; - } + }, }; let hotshot_message = Message:: { @@ -250,7 +250,7 @@ impl BroadcastRollCallTask { Err(err) => { tracing::error!("error serializing hotshot message: {:?}", err); return; - } + }, }; let broadcast_result = network @@ -279,28 +279,28 @@ impl Drop for BroadcastRollCallTask { #[cfg(test)] mod test { use super::{BroadcastRollCallTask, ConnectedNetworkConsumer, ConnectedNetworkPublisher}; - use crate::api::node_validator::v0::create_node_validator_api::ExternalMessage; use crate::api::node_validator::v0::{ - cdn::CdnReceiveMessagesTask, create_node_validator_api::RollCallInfo, + cdn::CdnReceiveMessagesTask, + create_node_validator_api::{ExternalMessage, RollCallInfo}, }; use core::panic; use espresso_types::SeqTypes; - use futures::channel::mpsc::Sender; - use futures::SinkExt; use futures::{ - channel::mpsc::{self}, - StreamExt, + channel::mpsc::{ + Sender, {self}, + }, + SinkExt, StreamExt, }; - use hotshot::types::SignatureKey; use hotshot::{ traits::NetworkError, - types::{BLSPubKey, Message}, + types::{BLSPubKey, Message, SignatureKey}, + }; + use hotshot_types::{ + message::{DataMessage, MessageKind}, + traits::network::{BroadcastDelay, ResponseMessage}, }; - use hotshot_types::message::{DataMessage, MessageKind}; - use hotshot_types::traits::network::{BroadcastDelay, ResponseMessage}; use std::time::Duration; - use tokio::time::error::Elapsed; - use tokio::time::{sleep, timeout}; + use tokio::time::{error::Elapsed, sleep, timeout}; use url::Url; /// [TestConnectedNetworkConsumer] is a test implementation of the @@ -564,7 +564,7 @@ mod test { public_key, BLSPubKey::generated_from_seed_indexed([0; 32], 0).0 ); - } + }, _ => panic!("unexpected external message"), } diff --git a/node-metrics/src/api/node_validator/v0/create_node_validator_api.rs b/node-metrics/src/api/node_validator/v0/create_node_validator_api.rs index eb05938302..953bdddfbf 100644 --- a/node-metrics/src/api/node_validator/v0/create_node_validator_api.rs +++ b/node-metrics/src/api/node_validator/v0/create_node_validator_api.rs @@ -119,7 +119,7 @@ impl HotShotEventProcessingTask { None => { tracing::info!("event stream closed"); break; - } + }, }; let Event { event, .. } = event; @@ -136,7 +136,7 @@ impl HotShotEventProcessingTask { panic!("HotShotEventProcessingTask leaf sender is closed, unrecoverable, the block state will stagnate."); } } - } + }, EventType::ExternalMessageReceived { data, .. } => { let roll_call_info = match bincode::deserialize(&data) { @@ -148,12 +148,12 @@ impl HotShotEventProcessingTask { err ); continue; - } + }, _ => { // Ignore any other potentially recognized messages continue; - } + }, }; let public_api_url = roll_call_info.public_api_url; @@ -164,11 +164,11 @@ impl HotShotEventProcessingTask { tracing::error!("url sender closed: {}", err); panic!("HotShotEventProcessingTask url sender is closed, unrecoverable, the node state will stagnate."); } - } + }, _ => { // Ignore all other events continue; - } + }, } } } @@ -237,7 +237,7 @@ impl ProcessExternalMessageHandlingTask { None => { tracing::error!("external message receiver closed"); break; - } + }, }; match external_message { @@ -249,12 +249,12 @@ impl ProcessExternalMessageHandlingTask { tracing::error!("url sender closed: {}", err); break; } - } + }, _ => { // Ignore all other messages continue; - } + }, } } } @@ -400,14 +400,14 @@ mod test { Ok(node_validator_api) => node_validator_api, Err(err) => { panic!("error defining node validator api: {:?}", err); - } + }, }; match app.register_module("node-validator", node_validator_api) { - Ok(_) => {} + Ok(_) => {}, Err(err) => { panic!("error registering node validator api: {:?}", err); - } + }, } let (leaf_sender, leaf_receiver) = mpsc::channel(10); @@ -450,7 +450,7 @@ mod test { Err(err) => { panic!("error defining node validator api: {:?}", err); - } + }, }; // We would like to wait until being signaled diff --git a/node-metrics/src/api/node_validator/v0/mod.rs b/node-metrics/src/api/node_validator/v0/mod.rs index 90d1867474..87b01c0fd5 100644 --- a/node-metrics/src/api/node_validator/v0/mod.rs +++ b/node-metrics/src/api/node_validator/v0/mod.rs @@ -1,35 +1,30 @@ pub mod cdn; pub mod create_node_validator_api; -use crate::service::client_message::{ClientMessage, InternalClientMessage}; -use crate::service::data_state::{LocationDetails, NodeIdentity}; -use crate::service::server_message::ServerMessage; +use crate::service::{ + client_message::{ClientMessage, InternalClientMessage}, + data_state::{LocationDetails, NodeIdentity}, + server_message::ServerMessage, +}; use espresso_types::{BackoffParams, SeqTypes}; -use futures::channel::mpsc::SendError; -use futures::future::Either; use futures::{ - channel::mpsc::{self, Sender}, + channel::mpsc::{self, SendError, Sender}, + future::Either, FutureExt, Sink, SinkExt, Stream, StreamExt, }; use hotshot_query_service::Leaf; use hotshot_stake_table::vec_based::StakeTable; -use hotshot_types::light_client::{CircuitField, StateVerKey}; -use hotshot_types::signature_key::BLSPubKey; -use hotshot_types::traits::{signature_key::StakeTableEntryType, stake_table::StakeTableScheme}; -use hotshot_types::PeerConfig; +use hotshot_types::{ + light_client::{CircuitField, StateVerKey}, + signature_key::BLSPubKey, + traits::{signature_key::StakeTableEntryType, stake_table::StakeTableScheme}, + PeerConfig, +}; use prometheus_parse::{Sample, Scrape}; use serde::{Deserialize, Serialize}; -use std::fmt; -use std::future::Future; -use std::io::BufRead; -use std::pin::Pin; -use std::str::FromStr; -use std::time::Duration; -use tide_disco::socket::Connection; -use tide_disco::{api::ApiError, Api}; -use tokio::spawn; -use tokio::task::JoinHandle; -use tokio::time::sleep; +use std::{fmt, future::Future, io::BufRead, pin::Pin, str::FromStr, time::Duration}; +use tide_disco::{api::ApiError, socket::Connection, Api}; +use tokio::{spawn, task::JoinHandle, time::sleep}; use url::Url; use vbs::version::{StaticVersion, StaticVersionType, Version}; @@ -64,11 +59,11 @@ impl fmt::Display for Error { match self { Self::UnhandledSurfDisco(status, msg) => { write!(f, "Unhandled Surf Disco Error: {} - {}", status, msg) - } + }, Self::UnhandledTideDisco(status, msg) => { write!(f, "Unhandled Tide Disco Error: {} - {}", status, msg) - } + }, } } } @@ -255,7 +250,7 @@ where // let's queue up the next client message to receive next_client_message = socket_stream.next(); next_server_message = remaining_server_message; - } + }, Either::Right((server_message, remaining_client_message)) => { // Alright, we have a server message, we want to forward it // to the down-stream client. @@ -277,7 +272,7 @@ where // let's queue up the next server message to receive next_server_message = server_message_receiver.next(); next_client_message = remaining_client_message; - } + }, } } @@ -327,7 +322,7 @@ pub async fn get_stake_table_from_sequencer( Err(err) => { tracing::info!("retrieve stake table request failed: {}", err); return Err(err); - } + }, }; let public_hot_shot_config = sequencer_config.config; @@ -481,7 +476,7 @@ impl LeafStreamRetriever for HotshotQueryServiceLeafStreamRetriever { Err(err) => { tracing::info!("retrieve block height request failed: {}", err); return Err(err); - } + }, }; let latest_block_start = block_height.saturating_sub(50); @@ -504,7 +499,7 @@ impl LeafStreamRetriever for HotshotQueryServiceLeafStreamRetriever { Err(err) => { tracing::info!("retrieve leaves stream failed: {}", err); return Err(err); - } + }, }; Ok(leaves_stream) @@ -621,7 +616,7 @@ impl ProcessProduceLeafStreamTask { delay = backoff_params.backoff(delay); sleep(delay).await; continue; - } + }, Ok(leaves_stream) => leaves_stream, }; @@ -795,7 +790,7 @@ pub fn populate_node_identity_from_scrape(node_identity: &mut NodeIdentity, scra // We couldn't parse the public key, so we can't create a NodeIdentity. tracing::info!("parsing public key failed: {}", err); return; - } + }, } } else { // We were unable to find the public key in the scrape result. @@ -878,7 +873,7 @@ pub fn node_identity_from_scrape(scrape: Scrape) -> Option { Err(err) => { tracing::info!("parsing public key failed: {}", err); return None; - } + }, }; let mut node_identity = NodeIdentity::from_public_key(public_key); @@ -937,7 +932,7 @@ impl ProcessNodeIdentityUrlStreamTask { None => { tracing::info!("node identity url stream closed"); return; - } + }, }; // Alright we have a new Url to try and scrape for a Node Identity. @@ -949,7 +944,7 @@ impl ProcessNodeIdentityUrlStreamTask { Err(err) => { tracing::warn!("get node identity from url failed. bad base url?: {}", err); continue; - } + }, }; let send_result = node_identity_sender.send(node_identity).await; diff --git a/node-metrics/src/lib.rs b/node-metrics/src/lib.rs index cc1d7c8e90..bfbad63039 100644 --- a/node-metrics/src/lib.rs +++ b/node-metrics/src/lib.rs @@ -233,10 +233,10 @@ pub async fn run_standalone_service(options: Options) { api::node_validator::v0::define_api().expect("error defining node validator api"); match app.register_module("node-validator", node_validator_api) { - Ok(_) => {} + Ok(_) => {}, Err(err) => { panic!("error registering node validator api: {:?}", err); - } + }, } let (leaf_sender, leaf_receiver) = mpsc::channel(10); @@ -260,7 +260,7 @@ pub async fn run_standalone_service(options: Options) { Err(err) => { panic!("error defining node validator api: {:?}", err); - } + }, }; let _cdn_tasks = if let Some(cdn_broker_url_string) = options.cdn_marshal_endpoint() { @@ -278,7 +278,7 @@ pub async fn run_standalone_service(options: Options) { Ok(cdn_network) => cdn_network, Err(err) => { panic!("error creating cdn network: {:?}", err); - } + }, }; let url_sender = node_validator_task_state.url_sender.clone(); diff --git a/node-metrics/src/service/client_id/mod.rs b/node-metrics/src/service/client_id/mod.rs index 11353b6e5d..54b2ed7be5 100644 --- a/node-metrics/src/service/client_id/mod.rs +++ b/node-metrics/src/service/client_id/mod.rs @@ -108,8 +108,10 @@ mod tests { #[test] fn test_hash() { - use std::collections::hash_map::DefaultHasher; - use std::hash::{Hash, Hasher}; + use std::{ + collections::hash_map::DefaultHasher, + hash::{Hash, Hasher}, + }; let hash_1 = { let client_id = ClientId::from_count(1); diff --git a/node-metrics/src/service/client_message/mod.rs b/node-metrics/src/service/client_message/mod.rs index d19881430f..692517af18 100644 --- a/node-metrics/src/service/client_message/mod.rs +++ b/node-metrics/src/service/client_message/mod.rs @@ -38,8 +38,7 @@ impl ClientMessage { #[cfg(test)] mod tests { - use super::InternalClientMessage; - use super::*; + use super::{InternalClientMessage, *}; use crate::service::server_message::ServerMessage; use futures::channel::mpsc::Sender; use std::iter::zip; @@ -141,7 +140,7 @@ mod tests { match internal_client_message { InternalClientMessage::Request(id, _) => { assert_eq!(id, client_id); - } + }, _ => panic!("Unexpected InternalClientMessage"), } } diff --git a/node-metrics/src/service/client_state/mod.rs b/node-metrics/src/service/client_state/mod.rs index 97a06fac6f..d79cc4665c 100644 --- a/node-metrics/src/service/client_state/mod.rs +++ b/node-metrics/src/service/client_state/mod.rs @@ -112,7 +112,7 @@ impl std::fmt::Display for HandleConnectedError { match self { HandleConnectedError::ClientSendError(err) => { write!(f, "handle connected error: client send error: {}", err) - } + }, } } } @@ -235,7 +235,7 @@ impl std::fmt::Display for HandleRequestBlocksSnapshotsError { "handle request blocks snapshot error: client send error:: {}", err ) - } + }, } } } @@ -306,7 +306,7 @@ impl std::fmt::Display for HandleRequestNodeIdentitySnapshotError { "handle request node identity snapshot error: client send error: {}", err ) - } + }, } } } @@ -374,7 +374,7 @@ impl std::fmt::Display for HandleRequestHistogramSnapshotError { "handle request histogram snapshot error: client send error: {}", err ) - } + }, } } } @@ -461,7 +461,7 @@ impl std::fmt::Display for HandleRequestVotersSnapshotError { "handle request voters snapshot error: client send error: {}", err ) - } + }, } } } @@ -557,27 +557,27 @@ impl std::fmt::Display for ProcessClientMessageError { match self { ProcessClientMessageError::Connected(err) => { write!(f, "process client message error: connected: {}", err) - } + }, ProcessClientMessageError::BlocksSnapshot(err) => { write!(f, "process client message error: blocks snapshot: {}", err) - } + }, ProcessClientMessageError::NodeIdentitySnapshot(err) => { write!( f, "process client message error: node identity snapshot: {}", err ) - } + }, ProcessClientMessageError::HistogramSnapshot(err) => { write!( f, "process client message error: histogram snapshot: {}", err ) - } + }, ProcessClientMessageError::VotersSnapshot(err) => { write!(f, "process client message error: voters snapshot: {}", err) - } + }, } } } @@ -615,27 +615,27 @@ where InternalClientMessage::Connected(sender) => { handle_client_message_connected(sender, client_thread_state).await?; Ok(()) - } + }, InternalClientMessage::Disconnected(client_id) => { handle_client_message_disconnected(client_id, client_thread_state).await; Ok(()) - } + }, InternalClientMessage::Request(client_id, ClientMessage::SubscribeLatestBlock) => { handle_client_message_subscribe_latest_block(client_id, client_thread_state).await; Ok(()) - } + }, InternalClientMessage::Request(client_id, ClientMessage::SubscribeNodeIdentity) => { handle_client_message_subscribe_node_identity(client_id, client_thread_state).await; Ok(()) - } + }, InternalClientMessage::Request(client_id, ClientMessage::SubscribeVoters) => { handle_client_message_subscribe_voters(client_id, client_thread_state).await; Ok(()) - } + }, InternalClientMessage::Request(client_id, ClientMessage::RequestBlocksSnapshot) => { handle_client_message_request_blocks_snapshot( @@ -645,7 +645,7 @@ where ) .await?; Ok(()) - } + }, InternalClientMessage::Request(client_id, ClientMessage::RequestNodeIdentitySnapshot) => { handle_client_message_request_node_identity_snapshot( @@ -655,7 +655,7 @@ where ) .await?; Ok(()) - } + }, InternalClientMessage::Request(client_id, ClientMessage::RequestHistogramSnapshot) => { handle_client_message_request_histogram_snapshot( @@ -665,7 +665,7 @@ where ) .await?; Ok(()) - } + }, InternalClientMessage::Request(client_id, ClientMessage::RequestVotersSnapshot) => { handle_client_message_request_voters_snapshot( @@ -675,7 +675,7 @@ where ) .await?; Ok(()) - } + }, } } diff --git a/node-metrics/src/service/data_state/mod.rs b/node-metrics/src/service/data_state/mod.rs index 6325a69b83..e56ad187a0 100644 --- a/node-metrics/src/service/data_state/mod.rs +++ b/node-metrics/src/service/data_state/mod.rs @@ -52,7 +52,7 @@ impl DataState { let stake_table_iter_result = stake_table.try_iter(SnapshotVersion::Head); match stake_table_iter_result { Ok(into_iter) => into_iter - .map(|(key, _, _)| NodeIdentity::from_public_key(key)) + .map(|(key, ..)| NodeIdentity::from_public_key(key)) .collect(), Err(_) => vec![], } @@ -106,10 +106,10 @@ impl DataState { }; let missing_node_identity_entries = - stake_table_iter.filter(|(key, _, _)| !current_identity_set.contains(key)); + stake_table_iter.filter(|(key, ..)| !current_identity_set.contains(key)); self.node_identity.extend( - missing_node_identity_entries.map(|(key, _, _)| NodeIdentity::from_public_key(key)), + missing_node_identity_entries.map(|(key, ..)| NodeIdentity::from_public_key(key)), ); } @@ -200,10 +200,10 @@ impl std::fmt::Display for ProcessLeafError { match self { ProcessLeafError::BlockSendError(err) => { write!(f, "error sending block detail to sender: {}", err) - } + }, ProcessLeafError::VotersSendError(err) => { write!(f, "error sending voters to sender: {}", err) - } + }, } } } @@ -283,7 +283,7 @@ where // In this case, we just want to determine who voted for this // Leaf. - let (key, _, _): (BLSPubKey, _, _) = entry; + let (key, ..): (BLSPubKey, _, _) = entry; key }); @@ -396,10 +396,10 @@ impl ProcessLeafStreamTask { match err { ProcessLeafError::BlockSendError(_) => { panic!("ProcessLeafStreamTask: process_incoming_leaf failed, underlying sink is closed, blocks will stagnate: {}", err) - } + }, ProcessLeafError::VotersSendError(_) => { panic!("ProcessLeafStreamTask: process_incoming_leaf failed, underlying sink is closed, voters will stagnate: {}", err) - } + }, } } } @@ -429,7 +429,7 @@ impl std::fmt::Display for ProcessNodeIdentityError { match self { ProcessNodeIdentityError::SendError(err) => { write!(f, "error sending node identity to sender: {}", err) - } + }, } } } diff --git a/node-metrics/src/service/data_state/node_identity.rs b/node-metrics/src/service/data_state/node_identity.rs index 8396a81340..5a3a1bffdd 100644 --- a/node-metrics/src/service/data_state/node_identity.rs +++ b/node-metrics/src/service/data_state/node_identity.rs @@ -126,10 +126,8 @@ impl NodeIdentity { #[cfg(test)] pub mod tests { - use super::LocationDetails; - use super::NodeIdentity; - use hotshot_types::signature_key::BLSPubKey; - use hotshot_types::traits::signature_key::SignatureKey; + use super::{LocationDetails, NodeIdentity}; + use hotshot_types::{signature_key::BLSPubKey, traits::signature_key::SignatureKey}; pub fn create_test_node(index: u64) -> NodeIdentity { let (pub_key, _) = BLSPubKey::generated_from_seed_indexed([0; 32], index); diff --git a/request-response/src/lib.rs b/request-response/src/lib.rs index d643547ba6..3dd92db83e 100644 --- a/request-response/src/lib.rs +++ b/request-response/src/lib.rs @@ -388,24 +388,24 @@ impl< Err(e) => { warn!("Received invalid message: {e}"); continue; - } + }, }; // Handle the message based on its type match message { Message::Request(request_message) => { self.handle_request(request_message, &mut outgoing_responses); - } + }, Message::Response(response_message) => { self.handle_response(response_message, &mut incoming_responses); - } + }, } - } + }, // An error here means the receiver will _NEVER_ receive any more messages Err(e) => { error!("Request/response receive task exited: {e}"); return; - } + }, } } } diff --git a/request-response/src/message.rs b/request-response/src/message.rs index 622be26f22..a704e1c454 100644 --- a/request-response/src/message.rs +++ b/request-response/src/message.rs @@ -140,14 +140,14 @@ impl Serializable for Message { // Write the request content bytes.extend_from_slice(request_message.to_bytes()?.as_slice()); - } + }, Message::Response(response_message) => { // Write the type (response) bytes.push(1); // Write the response content bytes.extend_from_slice(response_message.to_bytes()?.as_slice()); - } + }, }; Ok(bytes) @@ -168,13 +168,13 @@ impl Serializable for Message { Ok(Message::Request(RequestMessage::from_bytes(&read_to_end( &mut bytes, )?)?)) - } + }, 1 => { // Read the `ResponseMessage` Ok(Message::Response(ResponseMessage::from_bytes( &read_to_end(&mut bytes)?, )?)) - } + }, _ => Err(anyhow::anyhow!("invalid message type")), } } @@ -353,7 +353,7 @@ mod tests { // It should not be valid anymore (false, Duration::from_secs(1)) - } + }, 2 => { // Alter the timestamp @@ -361,13 +361,13 @@ mod tests { // It should not be valid anymore (false, Duration::from_secs(1)) - } + }, 3 => { // Change the request ttl to be 0. This should make the request // invalid immediately (true, Duration::from_secs(0)) - } + }, _ => unreachable!(), }; diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 6dc822914a..0b80460114 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] channel = "stable" -components = ["rustfmt", "llvm-tools-preview", "rust-src", "clippy"] +components = ["llvm-tools-preview", "rust-src", "clippy"] profile = "minimal" diff --git a/vid/rustfmt.toml b/rustfmt.toml similarity index 73% rename from vid/rustfmt.toml rename to rustfmt.toml index b288fc82e4..afed4afcb0 100644 --- a/vid/rustfmt.toml +++ b/rustfmt.toml @@ -1,9 +1,7 @@ reorder_imports = true -wrap_comments = true -normalize_comments = true use_try_shorthand = true match_block_trailing_comma = true use_field_init_shorthand = true -edition = "2018" +edition = "2021" condense_wildcard_suffixes = true imports_granularity = "Crate" diff --git a/sequencer/src/api.rs b/sequencer/src/api.rs index 51f309f97e..c409679232 100644 --- a/sequencer/src/api.rs +++ b/sequencer/src/api.rs @@ -23,17 +23,17 @@ use hotshot_types::{ event::Event, light_client::StateSignatureRequestBody, network::NetworkConfig, + stake_table::StakeTableEntry, traits::{ + election::Membership, network::ConnectedNetwork, node_implementation::{NodeType, Versions}, ValidatedState as _, }, utils::{View, ViewInner}, }; -use hotshot_types::{stake_table::StakeTableEntry, traits::election::Membership}; use jf_merkle_tree::MerkleTreeScheme; -use std::pin::Pin; -use std::sync::Arc; +use std::{pin::Pin, sync::Arc}; use self::data_source::{ HotShotConfigDataSource, NodeStateDataSource, PublicNetworkConfig, StateSignatureDataSource, @@ -281,7 +281,7 @@ impl< Ok(accounts) => return Ok(accounts), Err(err) => { tracing::info!("accounts not in memory, trying storage: {err:#}"); - } + }, } // Try storage. @@ -318,7 +318,7 @@ impl< } (Arc::new(state), delta.clone()) - } + }, _ => { // If we don't already have a leaf for this view, or if we don't have the view // at all, we can create a new view based on the recovered leaf and add it to @@ -327,7 +327,7 @@ impl< let mut state = ValidatedState::from_header(leaf.block_header()); state.fee_merkle_tree = tree.clone(); (Arc::new(state), None) - } + }, }; if let Err(err) = consensus.update_leaf(leaf, Arc::clone(&state), delta) { tracing::warn!(?view, "cannot update fetched account state: {err:#}"); @@ -349,7 +349,7 @@ impl< Ok(frontier) => return Ok(frontier), Err(err) => { tracing::info!("frontier is not in memory, trying storage: {err:#}"); - } + }, } // Try storage. @@ -365,7 +365,7 @@ impl< Ok(cf) => return Ok(cf), Err(err) => { tracing::info!("chain config is not in memory, trying storage: {err:#}"); - } + }, } // Try storage. @@ -507,10 +507,9 @@ pub mod test_helpers { use tokio::{spawn, time::sleep}; use crate::network; - use espresso_types::MockSequencerVersions; use espresso_types::{ v0::traits::{NullEventConsumer, PersistenceOptions, StateCatchup}, - MarketplaceVersion, NamespaceId, ValidatedState, + MarketplaceVersion, MockSequencerVersions, NamespaceId, ValidatedState, }; use ethers::{prelude::Address, utils::Anvil}; use futures::{ @@ -528,8 +527,7 @@ pub mod test_helpers { use portpicker::pick_unused_port; use sequencer_utils::test_utils::setup_test; use surf_disco::Client; - use tide_disco::error::ServerError; - use tide_disco::{Api, App, Error, StatusCode}; + use tide_disco::{error::ServerError, Api, App, Error, StatusCode}; use tokio::task::JoinHandle; use url::Url; use vbs::version::{StaticVersion, StaticVersionType}; @@ -1094,10 +1092,9 @@ mod api_tests { use committable::Committable; use data_source::testing::TestableSequencerDataSource; use endpoints::NamespaceProofQueryData; - use espresso_types::MockSequencerVersions; use espresso_types::{ traits::{EventConsumer, PersistenceOptions}, - Header, Leaf, Leaf2, NamespaceId, + Header, Leaf, Leaf2, MockSequencerVersions, NamespaceId, }; use ethers::utils::Anvil; use futures::{future, stream::StreamExt}; @@ -1107,14 +1104,15 @@ mod api_tests { }; use hotshot_query_service::VidCommitment; - use hotshot_types::data::vid_disperse::ADVZDisperseShare; - use hotshot_types::vid::advz::advz_scheme; use hotshot_types::{ - data::{DaProposal, QuorumProposal2, QuorumProposalWrapper}, + data::{ + vid_disperse::ADVZDisperseShare, DaProposal, QuorumProposal2, QuorumProposalWrapper, + }, event::LeafInfo, message::Proposal, simple_certificate::QuorumCertificate, traits::{node_implementation::ConsensusTime, signature_key::SignatureKey, EncodeBytes}, + vid::advz::advz_scheme, }; use jf_vid::VidScheme; @@ -1130,8 +1128,8 @@ mod api_tests { use vbs::version::StaticVersion; use super::{update::ApiEventConsumer, *}; - use crate::network; use crate::{ + network, persistence::no_storage::NoStorage, testing::{wait_for_decide_on_handle, TestConfigBuilder}, }; @@ -2301,7 +2299,7 @@ mod test { let new_version = upgrade.new_version; assert_eq!(new_version, ::Upgrade::VERSION); break upgrade.new_version_first_view; - } + }, _ => continue, } }; diff --git a/sequencer/src/api/data_source.rs b/sequencer/src/api/data_source.rs index e3703d3874..2c64e475c8 100644 --- a/sequencer/src/api/data_source.rs +++ b/sequencer/src/api/data_source.rs @@ -19,15 +19,16 @@ use hotshot_query_service::{ use hotshot_types::{ data::ViewNumber, light_client::StateSignatureRequestBody, - network::NetworkConfig, + network::{ + BuilderType, CombinedNetworkConfig, Libp2pConfig, NetworkConfig, RandomBuilderConfig, + }, stake_table::StakeTableEntry, - traits::{network::ConnectedNetwork, node_implementation::Versions}, + traits::{ + network::ConnectedNetwork, + node_implementation::{NodeType, Versions}, + }, HotShotConfig, PeerConfig, ValidatorConfig, }; -use hotshot_types::{ - network::{BuilderType, CombinedNetworkConfig, Libp2pConfig, RandomBuilderConfig}, - traits::node_implementation::NodeType, -}; use serde::{Deserialize, Serialize}; use tide_disco::Url; use vec1::Vec1; diff --git a/sequencer/src/api/endpoints.rs b/sequencer/src/api/endpoints.rs index 35e15d32b6..4e26172a2c 100644 --- a/sequencer/src/api/endpoints.rs +++ b/sequencer/src/api/endpoints.rs @@ -13,11 +13,12 @@ use hotshot_query_service::{ availability::{self, AvailabilityDataSource, CustomSnafu, FetchBlockSnafu}, explorer::{self, ExplorerDataSource}, merklized_state::{ - self, MerklizedState, MerklizedStateDataSource, MerklizedStateHeightPersistence, + self, MerklizedState, MerklizedStateDataSource, MerklizedStateHeightPersistence, Snapshot, }, - node, ApiState, Error, + node, + node::NodeDataSource, + ApiState, Error, }; -use hotshot_query_service::{merklized_state::Snapshot, node::NodeDataSource}; use hotshot_types::{ data::{EpochNumber, ViewNumber}, traits::{ diff --git a/sequencer/src/api/sql.rs b/sequencer/src/api/sql.rs index 96251929d6..b405d9f8a6 100644 --- a/sequencer/src/api/sql.rs +++ b/sequencer/src/api/sql.rs @@ -144,7 +144,7 @@ impl CatchupStorage for SqlStorage { LookupResult::Ok(_, proof) => Ok(proof), _ => { bail!("state snapshot {view:?},{height} was found but does not contain frontier at height {}; this should not be possible", height - 1); - } + }, } } } @@ -250,13 +250,13 @@ async fn load_accounts( ))? { MerkleNode::Leaf { pos, elem, .. } => { snapshot.remember(*pos, *elem, proof)?; - } + }, MerkleNode::Empty => { snapshot.non_membership_remember(*account, proof)?; - } + }, _ => { bail!("Invalid proof"); - } + }, } } @@ -417,7 +417,7 @@ async fn header_dependencies( // so the STF will be able to look it up later. catchup.add_chain_config(cf); cf - } + }, } }; diff --git a/sequencer/src/api/update.rs b/sequencer/src/api/update.rs index 5f49fde095..22d5e03e73 100644 --- a/sequencer/src/api/update.rs +++ b/sequencer/src/api/update.rs @@ -8,8 +8,7 @@ use espresso_types::{v0::traits::SequencerPersistence, PubKey}; use hotshot::types::Event; use hotshot_query_service::data_source::UpdateDataSource; use hotshot_types::traits::{network::ConnectedNetwork, node_implementation::Versions}; -use std::fmt::Debug; -use std::sync::Arc; +use std::{fmt::Debug, sync::Arc}; use super::{data_source::SequencerDataSource, StorageState}; use crate::{EventConsumer, SeqTypes}; diff --git a/sequencer/src/bin/cdn-whitelist.rs b/sequencer/src/bin/cdn-whitelist.rs index 23273f9d8d..2e47b3d049 100644 --- a/sequencer/src/bin/cdn-whitelist.rs +++ b/sequencer/src/bin/cdn-whitelist.rs @@ -9,8 +9,10 @@ use cdn_broker::reexports::discovery::{DiscoveryClient, Embedded, Redis}; use clap::Parser; use espresso_types::SeqTypes; use hotshot_orchestrator::client::OrchestratorClient; -use hotshot_types::network::NetworkConfig; -use hotshot_types::traits::{node_implementation::NodeType, signature_key::SignatureKey}; +use hotshot_types::{ + network::NetworkConfig, + traits::{node_implementation::NodeType, signature_key::SignatureKey}, +}; use surf_disco::Url; #[derive(Parser, Debug)] diff --git a/sequencer/src/bin/espresso-bridge.rs b/sequencer/src/bin/espresso-bridge.rs index 8201904e45..c89dd0cc3c 100644 --- a/sequencer/src/bin/espresso-bridge.rs +++ b/sequencer/src/bin/espresso-bridge.rs @@ -213,7 +213,7 @@ async fn deposit(opt: Deposit) -> anyhow::Result<()> { Err(err) => { tracing::warn!("error in header stream: {err:#}"); continue; - } + }, }; let Some(l1_finalized) = header.l1_finalized() else { continue; diff --git a/sequencer/src/bin/keygen.rs b/sequencer/src/bin/keygen.rs index 188179f982..f4ac7d7d83 100644 --- a/sequencer/src/bin/keygen.rs +++ b/sequencer/src/bin/keygen.rs @@ -33,7 +33,7 @@ impl Scheme { Self::All => { Self::Bls.gen(seed, index, env_file)?; Self::Schnorr.gen(seed, index, env_file)?; - } + }, Self::Bls => { let (pub_key, priv_key) = BLSPubKey::generated_from_seed_indexed(seed, index); let priv_key = priv_key.to_tagged_base64()?; @@ -43,7 +43,7 @@ impl Scheme { "ESPRESSO_SEQUENCER_PRIVATE_STAKING_KEY={priv_key}" )?; tracing::info!(%pub_key, "generated staking key") - } + }, Self::Schnorr => { let key_pair = StateKeyPair::generate_from_seed_indexed(seed, index); let priv_key = key_pair.sign_key_ref().to_tagged_base64()?; @@ -54,7 +54,7 @@ impl Scheme { )?; writeln!(env_file, "ESPRESSO_SEQUENCER_PRIVATE_STATE_KEY={priv_key}")?; tracing::info!(pub_key = %key_pair.ver_key(), "generated state key"); - } + }, } Ok(()) } diff --git a/sequencer/src/bin/nasty-client.rs b/sequencer/src/bin/nasty-client.rs index b3741582d8..d981c2fa1f 100644 --- a/sequencer/src/bin/nasty-client.rs +++ b/sequencer/src/bin/nasty-client.rs @@ -520,7 +520,7 @@ impl ResourceManager { Ok(res) if i == 0 => { // Succeeded on the first try, get on with it. return Ok(res); - } + }, Ok(res) => { // Succeeded after at least one failure; retry a number of additional times to // be sure the endpoint is healed. @@ -531,14 +531,14 @@ impl ResourceManager { )?; } return Ok(res); - } + }, Err(err) if i < self.cfg.max_retries => { tracing::warn!("failed, will retry: {err:#}"); i += 1; - } + }, Err(err) => { return Err(err).context("failed too many times"); - } + }, } } } @@ -674,7 +674,7 @@ impl ResourceManager { obj.height() ); } - } + }, Err(_) if to - from > limit => { tracing::info!( limit, @@ -682,10 +682,10 @@ impl ResourceManager { to, "range query exceeding limit failed as expected" ); - } + }, Err(err) => { return Err(err).context("error in range query"); - } + }, } self.metrics.query_range_actions[&T::RESOURCE].add(1); @@ -800,7 +800,7 @@ impl ResourceManager { ); } break obj; - } + }, Err(err) if refreshed.elapsed() >= self.cfg.web_socket_timeout => { // Streams are allowed to fail if the connection is too old. Warn about it, // but refresh the connection and try again. @@ -818,7 +818,7 @@ impl ResourceManager { "{} stream refreshed due to connection reset", Self::singular(), ); - } + }, Err(err) => { // Errors on a relatively fresh connection are not allowed. Close the stream // since it is apparently in a bad state, and return an error. @@ -830,7 +830,7 @@ impl ResourceManager { Self::singular(), refreshed.elapsed() )); - } + }, } }; @@ -944,11 +944,11 @@ impl ResourceManager
{ // The block state at height 0 is empty, so to have a valid query just adjust to // querying at height 1. At height 1, the only valid index to query is 0. (1, 0) - } + }, block => { // At any other height, all indices between 0 and `block - 1` are valid to query. (block, index % (block - 1)) - } + }, }; // Get the header of the state snapshot we're going to query and the block commitment we're @@ -1344,7 +1344,7 @@ impl Client { Resource::Payloads => self.payloads.close_stream(id).await, }; Ok(()) - } + }, Action::PollStream { resource, id, @@ -1357,16 +1357,16 @@ impl Client { }, Action::QueryWindow { from, duration } => { self.headers.query_window(from, duration).await - } + }, Action::QueryNamespace { block, namespace } => { self.blocks.query_namespace(block, namespace).await - } + }, Action::QueryBlockState { block, index } => { self.headers.query_block_state(block, index).await - } + }, Action::QueryFeeState { block, builder } => { self.headers.query_fee_state(block, builder).await - } + }, } } } diff --git a/sequencer/src/bin/pub-key.rs b/sequencer/src/bin/pub-key.rs index 0c2bbc99cc..38efb49a86 100644 --- a/sequencer/src/bin/pub-key.rs +++ b/sequencer/src/bin/pub-key.rs @@ -49,7 +49,7 @@ fn main() { (false, PrivateKey::Bls(key)) => println!("{}", PubKey::from_private(&key)), (false, PrivateKey::Schnorr(key)) => { println!("{}", StateKeyPair::from_sign_key(key).ver_key()) - } + }, // Libp2p (true, PrivateKey::Bls(key)) => { @@ -57,9 +57,9 @@ fn main() { "{}", derive_libp2p_peer_id::(&key).expect("Failed to derive libp2p peer ID") ); - } + }, (true, _) => { eprintln!("Key type unsupported for libp2p peer ID derivation"); - } + }, } } diff --git a/sequencer/src/bin/reset-storage.rs b/sequencer/src/bin/reset-storage.rs index a635cda1b7..88d83fd1fd 100644 --- a/sequencer/src/bin/reset-storage.rs +++ b/sequencer/src/bin/reset-storage.rs @@ -35,11 +35,11 @@ async fn main() -> anyhow::Result<()> { Command::Fs(opt) => { tracing::warn!("resetting file system storage {opt:?}"); reset_storage(opt).await - } + }, Command::Sql(opt) => { tracing::warn!("resetting SQL storage {opt:?}"); reset_storage(*opt).await - } + }, } } diff --git a/sequencer/src/bin/submit-transactions.rs b/sequencer/src/bin/submit-transactions.rs index 87795b4761..03102a4bd9 100644 --- a/sequencer/src/bin/submit-transactions.rs +++ b/sequencer/src/bin/submit-transactions.rs @@ -229,7 +229,7 @@ async fn main() { Err(err) => { tracing::warn!("error getting block: {err}"); continue; - } + }, }; let received_at = Instant::now(); tracing::debug!("got block {}", block.height()); diff --git a/sequencer/src/bin/utils/keygen.rs b/sequencer/src/bin/utils/keygen.rs index a381dc0d25..5240493f16 100644 --- a/sequencer/src/bin/utils/keygen.rs +++ b/sequencer/src/bin/utils/keygen.rs @@ -32,7 +32,7 @@ impl Scheme { Self::All => { Self::Bls.gen(seed, index, env_file)?; Self::Schnorr.gen(seed, index, env_file)?; - } + }, Self::Bls => { let (pub_key, priv_key) = BLSPubKey::generated_from_seed_indexed(seed, index); let priv_key = priv_key.to_tagged_base64()?; @@ -42,7 +42,7 @@ impl Scheme { "ESPRESSO_SEQUENCER_PRIVATE_STAKING_KEY={priv_key}" )?; tracing::info!(%pub_key, "generated staking key") - } + }, Self::Schnorr => { let key_pair = StateKeyPair::generate_from_seed_indexed(seed, index); let priv_key = key_pair.sign_key_ref().to_tagged_base64()?; @@ -53,7 +53,7 @@ impl Scheme { )?; writeln!(env_file, "ESPRESSO_SEQUENCER_PRIVATE_STATE_KEY={priv_key}")?; tracing::info!(pub_key = %key_pair.ver_key(), "generated state key"); - } + }, } Ok(()) } diff --git a/sequencer/src/bin/utils/main.rs b/sequencer/src/bin/utils/main.rs index 97ac6486ba..d2636be6ff 100644 --- a/sequencer/src/bin/utils/main.rs +++ b/sequencer/src/bin/utils/main.rs @@ -34,7 +34,7 @@ async fn main() -> anyhow::Result<()> { Command::Pubkey(opt) => { pubkey::run(opt); Ok(()) - } + }, Command::ResetStorage(opt) => reset_storage::run(opt).await, } } diff --git a/sequencer/src/bin/utils/pubkey.rs b/sequencer/src/bin/utils/pubkey.rs index 84b65c5042..bd4156df8b 100644 --- a/sequencer/src/bin/utils/pubkey.rs +++ b/sequencer/src/bin/utils/pubkey.rs @@ -3,10 +3,11 @@ use std::str::FromStr; use anyhow::bail; use clap::Parser; use espresso_types::{PrivKey, PubKey}; -use hotshot::traits::implementations::derive_libp2p_peer_id; -use hotshot::types::SignatureKey; -use hotshot_types::light_client::StateSignKey; -use hotshot_types::{light_client::StateKeyPair, signature_key::BLSPubKey}; +use hotshot::{traits::implementations::derive_libp2p_peer_id, types::SignatureKey}; +use hotshot_types::{ + light_client::{StateKeyPair, StateSignKey}, + signature_key::BLSPubKey, +}; use tagged_base64::TaggedBase64; #[derive(Clone, Debug)] @@ -47,7 +48,7 @@ pub fn run(opt: Options) { (false, PrivateKey::Bls(key)) => println!("{}", PubKey::from_private(&key)), (false, PrivateKey::Schnorr(key)) => { println!("{}", StateKeyPair::from_sign_key(key).ver_key()) - } + }, // Libp2p (true, PrivateKey::Bls(key)) => { @@ -55,9 +56,9 @@ pub fn run(opt: Options) { "{}", derive_libp2p_peer_id::(&key).expect("Failed to derive libp2p peer ID") ); - } + }, (true, _) => { eprintln!("Key type unsupported for libp2p peer ID derivation"); - } + }, } } diff --git a/sequencer/src/bin/utils/reset_storage.rs b/sequencer/src/bin/utils/reset_storage.rs index b25c8a3c11..7e1e8e080c 100644 --- a/sequencer/src/bin/utils/reset_storage.rs +++ b/sequencer/src/bin/utils/reset_storage.rs @@ -32,11 +32,11 @@ pub async fn run(opt: Commands) -> anyhow::Result<()> { SequencerStorage::Fs(opt) => { tracing::warn!("resetting sequencer file system storage {opt:?}"); reset_storage(opt).await - } + }, SequencerStorage::Sql(opt) => { tracing::warn!("resetting sequencer SQL storage {opt:?}"); reset_storage(*opt).await - } + }, }, Commands::Solver(opt) => { @@ -45,7 +45,7 @@ pub async fn run(opt: Commands) -> anyhow::Result<()> { opts.connect().await?; Ok(()) - } + }, } } diff --git a/sequencer/src/bin/verify-headers.rs b/sequencer/src/bin/verify-headers.rs index 4b999070a3..c86a037524 100644 --- a/sequencer/src/bin/verify-headers.rs +++ b/sequencer/src/bin/verify-headers.rs @@ -134,7 +134,7 @@ async fn get_header( // Back off a bit and then retry. sleep(Duration::from_millis(100)).await; - } + }, } } } @@ -147,12 +147,12 @@ async fn get_l1_block(l1: &Provider, height: u64) -> L1BlockInfo { tracing::warn!("L1 block {height} not yet available"); sleep(Duration::from_secs(1)).await; continue; - } + }, Err(err) => { tracing::warn!("error fetching L1 block {height}: {err}"); sleep(Duration::from_millis(100)).await; continue; - } + }, }; let Some(hash) = block.hash else { diff --git a/sequencer/src/catchup.rs b/sequencer/src/catchup.rs index 8c8ca7a667..c23e8e4311 100644 --- a/sequencer/src/catchup.rs +++ b/sequencer/src/catchup.rs @@ -3,12 +3,11 @@ use std::sync::Arc; use anyhow::{anyhow, bail, ensure, Context}; use async_lock::RwLock; use async_trait::async_trait; -use committable::Commitment; -use committable::Committable; -use espresso_types::traits::SequencerPersistence; +use committable::{Commitment, Committable}; use espresso_types::{ - v0::traits::StateCatchup, v0_99::ChainConfig, BackoffParams, BlockMerkleTree, FeeAccount, - FeeAccountProof, FeeMerkleCommitment, FeeMerkleTree, Leaf2, NodeState, + traits::SequencerPersistence, v0::traits::StateCatchup, v0_99::ChainConfig, BackoffParams, + BlockMerkleTree, FeeAccount, FeeAccountProof, FeeMerkleCommitment, FeeMerkleTree, Leaf2, + NodeState, }; use futures::future::{Future, FutureExt, TryFuture, TryFutureExt}; use hotshot_types::{ @@ -76,7 +75,7 @@ pub(crate) async fn local_and_remote( Err(err) => { tracing::warn!("not using local catchup: {err:#}"); Arc::new(remote) - } + }, } } @@ -165,15 +164,15 @@ impl StatePeers { requests.insert(id, true); res = Ok(t); break; - } + }, Ok(Err(err)) => { tracing::warn!(id, ?score, peer = %client.url, "error from peer: {err:#}"); requests.insert(id, false); - } + }, Err(_) => { tracing::warn!(id, ?score, peer = %client.url, ?timeout_dur, "request timed out"); requests.insert(id, false); - } + }, } } diff --git a/sequencer/src/context.rs b/sequencer/src/context.rs index b56c0b6eb0..a23f1586d2 100644 --- a/sequencer/src/context.rs +++ b/sequencer/src/context.rs @@ -27,8 +27,10 @@ use hotshot_types::{ PeerConfig, ValidatorConfig, }; use parking_lot::Mutex; -use std::fmt::Debug; -use std::{fmt::Display, sync::Arc}; +use std::{ + fmt::{Debug, Display}, + sync::Arc, +}; use tokio::{spawn, task::JoinHandle}; use tracing::{Instrument, Level}; use url::Url; diff --git a/sequencer/src/external_event_handler.rs b/sequencer/src/external_event_handler.rs index bcf5f9e23d..63f10a0f73 100644 --- a/sequencer/src/external_event_handler.rs +++ b/sequencer/src/external_event_handler.rs @@ -13,8 +13,7 @@ use hotshot_types::{ }; use serde::{Deserialize, Serialize}; use std::{marker::PhantomData, sync::Arc}; -use tokio::sync::mpsc::channel; -use tokio::sync::mpsc::{Receiver, Sender}; +use tokio::sync::mpsc::{channel, Receiver, Sender}; use url::Url; /// An external message that can be sent to or received from a node @@ -122,11 +121,11 @@ impl ExternalEventHandler { self.outbound_message_sender .try_send(OutboundMessage::Direct(response_bytes, pub_key)) .with_context(|| "External outbound message queue is full")?; - } + }, _ => { return Err(anyhow::anyhow!("Unknown external message type")); - } + }, } Ok(()) } @@ -166,7 +165,7 @@ impl ExternalEventHandler { if let Err(err) = network.direct_message(message, recipient).await { tracing::error!("Failed to send message: {:?}", err); }; - } + }, OutboundMessage::Broadcast(message) => { // Broadcast the message to the global topic @@ -176,7 +175,7 @@ impl ExternalEventHandler { { tracing::error!("Failed to broadcast message: {:?}", err); }; - } + }, } } } diff --git a/sequencer/src/genesis.rs b/sequencer/src/genesis.rs index 2e6235fc54..d6f9228c11 100644 --- a/sequencer/src/genesis.rs +++ b/sequencer/src/genesis.rs @@ -254,12 +254,12 @@ mod upgrade_ser { return Err(de::Error::custom( "both view and time mode parameters are set", )) - } + }, (None, None) => { return Err(de::Error::custom( "no view or time mode parameters provided", )) - } + }, (None, Some(v)) => { if v.start_proposing_view > v.stop_proposing_view { return Err(de::Error::custom( @@ -274,7 +274,7 @@ mod upgrade_ser { upgrade_type: fields.upgrade_type, }, ); - } + }, (Some(t), None) => { if t.start_proposing_time.unix_timestamp() > t.stop_proposing_time.unix_timestamp() @@ -291,7 +291,7 @@ mod upgrade_ser { upgrade_type: fields.upgrade_type.clone(), }, ); - } + }, } } @@ -321,10 +321,12 @@ impl Genesis { #[cfg(test)] mod test { - use ethers::middleware::Middleware; - use ethers::prelude::*; - use ethers::signers::Signer; - use ethers::utils::{Anvil, AnvilInstance}; + use ethers::{ + middleware::Middleware, + prelude::*, + signers::Signer, + utils::{Anvil, AnvilInstance}, + }; use sequencer_utils::deployer::test_helpers::{ deploy_fee_contract, deploy_fee_contract_as_proxy, }; @@ -337,9 +339,7 @@ mod test { L1BlockInfo, TimeBasedUpgrade, Timestamp, UpgradeMode, UpgradeType, ViewBasedUpgrade, }; - use sequencer_utils::deployer; - use sequencer_utils::ser::FromStringOrInteger; - use sequencer_utils::test_utils::setup_test; + use sequencer_utils::{deployer, ser::FromStringOrInteger, test_utils::setup_test}; use toml::toml; use super::*; diff --git a/sequencer/src/lib.rs b/sequencer/src/lib.rs index c50598d6da..9655be898a 100644 --- a/sequencer/src/lib.rs +++ b/sequencer/src/lib.rs @@ -15,10 +15,9 @@ mod message_compat_tests; use anyhow::Context; use catchup::StatePeers; use context::SequencerContext; -use espresso_types::EpochCommittees; use espresso_types::{ - traits::EventConsumer, BackoffParams, L1ClientOptions, NodeState, PubKey, SeqTypes, - SolverAuctionResultsProvider, ValidatedState, + traits::EventConsumer, BackoffParams, EpochCommittees, L1ClientOptions, NodeState, PubKey, + SeqTypes, SolverAuctionResultsProvider, ValidatedState, }; use ethers_conv::ToAlloy; use genesis::L1Finalized; @@ -38,19 +37,16 @@ pub mod state; use derivative::Derivative; use espresso_types::v0::traits::SequencerPersistence; pub use genesis::Genesis; -use hotshot::traits::implementations::{ - derive_libp2p_multiaddr, CombinedNetworks, GossipConfig, Libp2pNetwork, RequestResponseConfig, -}; use hotshot::{ traits::implementations::{ - derive_libp2p_peer_id, CdnMetricsValue, CdnTopic, KeyPair, MemoryNetwork, PushCdnNetwork, - WrappedSignatureKey, + derive_libp2p_multiaddr, derive_libp2p_peer_id, CdnMetricsValue, CdnTopic, + CombinedNetworks, GossipConfig, KeyPair, Libp2pNetwork, MemoryNetwork, PushCdnNetwork, + RequestResponseConfig, WrappedSignatureKey, }, types::SignatureKey, MarketplaceConfig, }; -use hotshot_orchestrator::client::get_complete_config; -use hotshot_orchestrator::client::OrchestratorClient; +use hotshot_orchestrator::client::{get_complete_config, OrchestratorClient}; use hotshot_types::{ data::ViewNumber, light_client::{StateKeyPair, StateSignKey}, @@ -65,8 +61,7 @@ use hotshot_types::{ }; pub use options::Options; use serde::{Deserialize, Serialize}; -use std::time::Duration; -use std::{fmt::Debug, marker::PhantomData}; +use std::{fmt::Debug, marker::PhantomData, time::Duration}; use vbs::version::{StaticVersion, StaticVersionType}; pub mod network; @@ -311,7 +306,7 @@ pub async fn init_node( (Some(config), _) => { tracing::info!("loaded network config from storage, rejoining existing network"); (config, false) - } + }, // If we were told to fetch the config from an already-started peer, do so. (None, Some(peers)) => { tracing::info!(?peers, "loading network config from peers"); @@ -329,7 +324,7 @@ pub async fn init_node( ); persistence.save_config(&config).await?; (config, false) - } + }, // Otherwise, this is a fresh network; load from the orchestrator. (None, None) => { tracing::info!("loading network config from orchestrator"); @@ -355,7 +350,7 @@ pub async fn init_node( persistence.save_config(&config).await?; tracing::error!("all nodes connected"); (config, true) - } + }, }; if let Some(upgrade) = genesis.upgrades.get(&V::Upgrade::VERSION) { @@ -450,7 +445,7 @@ pub async fn init_node( ethers::types::U256::from(timestamp.unix_timestamp()).to_alloy(), ) .await - } + }, }; let mut genesis_state = ValidatedState { @@ -590,13 +585,16 @@ pub mod testing { use hotshot_testing::block_builder::{ BuilderTask, SimpleBuilderImplementation, TestBuilderImplementation, }; - use hotshot_types::traits::network::Topic; - use hotshot_types::traits::signature_key::StakeTableEntryType; use hotshot_types::{ event::LeafInfo, light_client::{CircuitField, StateKeyPair, StateVerKey}, - traits::signature_key::BuilderSignatureKey, - traits::{block_contents::BlockHeader, metrics::NoMetrics, stake_table::StakeTableScheme}, + traits::{ + block_contents::BlockHeader, + metrics::NoMetrics, + network::Topic, + signature_key::{BuilderSignatureKey, StakeTableEntryType}, + stake_table::StakeTableScheme, + }, HotShotConfig, PeerConfig, }; use marketplace_builder_core::{ diff --git a/sequencer/src/options.rs b/sequencer/src/options.rs index 93d52f3463..2241fd0e41 100644 --- a/sequencer/src/options.rs +++ b/sequencer/src/options.rs @@ -472,10 +472,10 @@ fn fmt_opt_urls( write!(fmt, "Some(")?; fmt_urls(urls, fmt)?; write!(fmt, ")")?; - } + }, None => { write!(fmt, "None")?; - } + }, } Ok(()) } @@ -536,13 +536,13 @@ impl ModuleArgs { match module { SequencerModule::Storage(m) => { curr = m.add(&mut modules.storage_fs, &mut provided)? - } + }, SequencerModule::StorageFs(m) => { curr = m.add(&mut modules.storage_fs, &mut provided)? - } + }, SequencerModule::StorageSql(m) => { curr = m.add(&mut modules.storage_sql, &mut provided)? - } + }, SequencerModule::Http(m) => curr = m.add(&mut modules.http, &mut provided)?, SequencerModule::Query(m) => curr = m.add(&mut modules.query, &mut provided)?, SequencerModule::Submit(m) => curr = m.add(&mut modules.submit, &mut provided)?, @@ -551,10 +551,10 @@ impl ModuleArgs { SequencerModule::Config(m) => curr = m.add(&mut modules.config, &mut provided)?, SequencerModule::HotshotEvents(m) => { curr = m.add(&mut modules.hotshot_events, &mut provided)? - } + }, SequencerModule::Explorer(m) => { curr = m.add(&mut modules.explorer, &mut provided)? - } + }, } } diff --git a/sequencer/src/persistence.rs b/sequencer/src/persistence.rs index 39aa46bd5c..b507da601e 100644 --- a/sequencer/src/persistence.rs +++ b/sequencer/src/persistence.rs @@ -747,7 +747,7 @@ mod persistence_tests { let leaf_chain = chain .iter() .take(2) - .map(|(leaf, qc, _, _)| (leaf_info(leaf.clone()), qc.clone())) + .map(|(leaf, qc, ..)| (leaf_info(leaf.clone()), qc.clone())) .collect::>(); tracing::info!("decide with event handling failure"); storage @@ -794,7 +794,7 @@ mod persistence_tests { let leaf_chain = chain .iter() .skip(2) - .map(|(leaf, qc, _, _)| (leaf_info(leaf.clone()), qc.clone())) + .map(|(leaf, qc, ..)| (leaf_info(leaf.clone()), qc.clone())) .collect::>(); tracing::info!("decide successfully"); storage @@ -839,7 +839,7 @@ mod persistence_tests { tracing::info!("check decide event"); let leaf_chain = consumer.leaf_chain().await; assert_eq!(leaf_chain.len(), 4, "{leaf_chain:#?}"); - for ((leaf, _, _, _), info) in chain.iter().zip(leaf_chain.iter()) { + for ((leaf, ..), info) in chain.iter().zip(leaf_chain.iter()) { assert_eq!(info.leaf, *leaf); let decided_vid_share = info.vid_share.as_ref().unwrap(); let view_number = match decided_vid_share { diff --git a/sequencer/src/persistence/fs.rs b/sequencer/src/persistence/fs.rs index c3b0abf7a9..968da4e94b 100644 --- a/sequencer/src/persistence/fs.rs +++ b/sequencer/src/persistence/fs.rs @@ -25,13 +25,13 @@ use hotshot_types::{ utils::View, vote::HasViewNumber, }; -use std::sync::Arc; use std::{ collections::BTreeMap, fs::{self, File, OpenOptions}, io::{Read, Seek, SeekFrom, Write}, ops::RangeInclusive, path::{Path, PathBuf}, + sync::Arc, }; use crate::ViewNumber; @@ -554,7 +554,7 @@ impl SequencerPersistence for Persistence { // managed to persist the decided leaves successfully, and the event processing will // just run again at the next decide. tracing::warn!(?view, "event processing failed: {err:#}"); - } + }, Ok(intervals) => { if let Err(err) = inner.collect_garbage(view, &intervals) { // Similarly, garbage collection is not an error. We have done everything we @@ -562,7 +562,7 @@ impl SequencerPersistence for Persistence { // error but do not return it. tracing::warn!(?view, "GC failed: {err:#}"); } - } + }, } Ok(()) @@ -794,7 +794,7 @@ impl SequencerPersistence for Persistence { // some unintended file whose name happened to match the naming convention. tracing::warn!(?view, "ignoring malformed quorum proposal file: {err:#}"); continue; - } + }, }; let proposal2 = convert_proposal(proposal); diff --git a/sequencer/src/persistence/no_storage.rs b/sequencer/src/persistence/no_storage.rs index 56b69bb938..ca72d92438 100644 --- a/sequencer/src/persistence/no_storage.rs +++ b/sequencer/src/persistence/no_storage.rs @@ -19,8 +19,7 @@ use hotshot_types::{ simple_certificate::{NextEpochQuorumCertificate2, QuorumCertificate2, UpgradeCertificate}, utils::View, }; -use std::collections::BTreeMap; -use std::sync::Arc; +use std::{collections::BTreeMap, sync::Arc}; use crate::{SeqTypes, ViewNumber}; diff --git a/sequencer/src/persistence/sql.rs b/sequencer/src/persistence/sql.rs index ef16f30ae6..c1b1a9fd2b 100644 --- a/sequencer/src/persistence/sql.rs +++ b/sequencer/src/persistence/sql.rs @@ -48,8 +48,7 @@ use hotshot_types::{ vote::HasViewNumber, }; use itertools::Itertools; -use sqlx::Row; -use sqlx::{query, Executor}; +use sqlx::{query, Executor, Row}; use std::{collections::BTreeMap, path::PathBuf, str::FromStr, sync::Arc, time::Duration}; use crate::{catchup::SqlStateCatchup, SeqTypes, ViewNumber}; @@ -658,7 +657,7 @@ impl Persistence { // we do have. tracing::warn!("error loading row: {err:#}"); break; - } + }, }; let leaf_data: Vec = row.get("leaf"); @@ -1397,7 +1396,7 @@ impl Provider for Persistence { Err(err) => { tracing::warn!("could not open transaction: {err:#}"); return None; - } + }, }; let bytes = match query_as::<(Vec,)>( @@ -1412,7 +1411,7 @@ impl Provider for Persistence { Err(err) => { tracing::warn!("error loading VID share: {err:#}"); return None; - } + }, }; let share: Proposal> = @@ -1421,7 +1420,7 @@ impl Provider for Persistence { Err(err) => { tracing::warn!("error decoding VID share: {err:#}"); return None; - } + }, }; Some(share.data.common) @@ -1437,7 +1436,7 @@ impl Provider for Persistence { Err(err) => { tracing::warn!("could not open transaction: {err:#}"); return None; - } + }, }; let bytes = match query_as::<(Vec,)>( @@ -1452,7 +1451,7 @@ impl Provider for Persistence { Err(err) => { tracing::warn!("error loading DA proposal: {err:#}"); return None; - } + }, }; let proposal: Proposal> = match bincode::deserialize(&bytes) @@ -1461,7 +1460,7 @@ impl Provider for Persistence { Err(err) => { tracing::warn!("error decoding DA proposal: {err:#}"); return None; - } + }, }; Some(Payload::from_bytes( @@ -1480,7 +1479,7 @@ impl Provider> for Persistence { Err(err) => { tracing::warn!("could not open transaction: {err:#}"); return None; - } + }, }; let (leaf, qc) = match fetch_leaf_from_proposals(&mut tx, req).await { @@ -1488,7 +1487,7 @@ impl Provider> for Persistence { Err(err) => { tracing::info!("requested leaf not found in undecided proposals: {err:#}"); return None; - } + }, }; match LeafQueryData::new(leaf, qc) { @@ -1496,7 +1495,7 @@ impl Provider> for Persistence { Err(err) => { tracing::warn!("fetched invalid leaf: {err:#}"); None - } + }, } } } diff --git a/sequencer/src/proposal_fetcher.rs b/sequencer/src/proposal_fetcher.rs index d9232bc5cd..dda416ce57 100644 --- a/sequencer/src/proposal_fetcher.rs +++ b/sequencer/src/proposal_fetcher.rs @@ -184,10 +184,10 @@ where let leaf = proposal.data.justify_qc().data.leaf_commit; self.request((view, leaf)).await; return Ok(()); - } + }, Err(err) => { tracing::info!("proposal missing from storage; fetching from network: {err:#}"); - } + }, } let future = self.consensus.read().await.request_proposal(view, leaf)?; diff --git a/sequencer/src/restart_tests.rs b/sequencer/src/restart_tests.rs index 7631120994..8de29b370d 100755 --- a/sequencer/src/restart_tests.rs +++ b/sequencer/src/restart_tests.rs @@ -31,10 +31,10 @@ use hotshot_testing::{ block_builder::{SimpleBuilderImplementation, TestBuilderImplementation}, test_builder::BuilderChange, }; -use hotshot_types::network::{Libp2pConfig, NetworkConfig}; use hotshot_types::{ event::{Event, EventType}, light_client::StateKeyPair, + network::{Libp2pConfig, NetworkConfig}, traits::{node_implementation::ConsensusTime, signature_key::SignatureKey}, }; use itertools::Itertools; @@ -45,10 +45,9 @@ use sequencer_utils::test_utils::setup_test; use std::{collections::HashSet, path::Path, time::Duration}; use surf_disco::{error::ClientError, Url}; use tempfile::TempDir; -use tokio::time::timeout; use tokio::{ task::{spawn, JoinHandle}, - time::sleep, + time::{sleep, timeout}, }; use vbs::version::Version; use vec1::vec1; @@ -358,7 +357,7 @@ impl TestNode { sleep(delay).await; delay *= 2; retries -= 1; - } + }, } }; diff --git a/sequencer/src/run.rs b/sequencer/src/run.rs index 73c17561ea..d84e0a1397 100644 --- a/sequencer/src/run.rs +++ b/sequencer/src/run.rs @@ -48,7 +48,7 @@ pub async fn main() -> anyhow::Result<()> { SequencerVersions::::new(), ) .await - } + }, #[cfg(feature = "fee")] (FeeVersion::VERSION, _) => { run( @@ -58,7 +58,7 @@ pub async fn main() -> anyhow::Result<()> { SequencerVersions::::new(), ) .await - } + }, #[cfg(feature = "marketplace")] (MarketplaceVersion::VERSION, _) => { run( @@ -68,7 +68,7 @@ pub async fn main() -> anyhow::Result<()> { SequencerVersions::::new(), ) .await - } + }, _ => panic!( "Invalid base ({base}) and upgrade ({upgrade}) versions specified in the toml file." ), @@ -237,7 +237,7 @@ where .boxed() }) .await? - } + }, None => { init_node( genesis, @@ -253,7 +253,7 @@ where proposal_fetcher_config, ) .await? - } + }, }; Ok(ctx) diff --git a/sequencer/src/state.rs b/sequencer/src/state.rs index 50eed617ac..4a8a7892b6 100644 --- a/sequencer/src/state.rs +++ b/sequencer/src/state.rs @@ -6,8 +6,7 @@ use espresso_types::{ traits::StateCatchup, v0_99::ChainConfig, BlockMerkleTree, Delta, FeeAccount, FeeMerkleTree, Leaf2, ValidatedState, }; -use futures::future::Future; -use futures::StreamExt; +use futures::{future::Future, StreamExt}; use hotshot::traits::ValidatedState as HotShotState; use hotshot_query_service::{ availability::{AvailabilityDataSource, LeafQueryData}, @@ -300,12 +299,12 @@ where parent_leaf = leaf; parent_state = state; break; - } + }, Err(err) => { tracing::error!(height = leaf.height(), "failed to updated state: {err:#}"); // If we fail, delay for a second and retry. sleep(Duration::from_secs(1)).await; - } + }, } } } diff --git a/sequencer/src/state_signature.rs b/sequencer/src/state_signature.rs index 87ff5b1761..9eeb1bf798 100644 --- a/sequencer/src/state_signature.rs +++ b/sequencer/src/state_signature.rs @@ -97,10 +97,10 @@ impl StateSigner { tracing::warn!("Error posting signature to the relay server: {:?}", error); } } - } + }, Err(err) => { tracing::error!("Error generating light client state: {:?}", err) - } + }, } } diff --git a/sequencer/src/state_signature/relay_server.rs b/sequencer/src/state_signature/relay_server.rs index fcfda46374..c718d8a185 100644 --- a/sequencer/src/state_signature/relay_server.rs +++ b/sequencer/src/state_signature/relay_server.rs @@ -149,11 +149,11 @@ impl StateRelayServerDataSource for StateRelayServerState { StatusCode::BAD_REQUEST, "A signature of this light client state is already posted at this block height for this key.".to_owned(), )); - } + }, std::collections::hash_map::Entry::Vacant(entry) => { entry.insert(signature); bundle.accumulated_weight += *weight; - } + }, } if bundle.accumulated_weight >= self.threshold { @@ -204,7 +204,7 @@ where reason: err.to_string(), })?; Api::::new(toml)? - } + }, }; api.get("getlateststate", |_req, state| { diff --git a/types/src/eth_signature_key.rs b/types/src/eth_signature_key.rs index e5c3de4554..be0de6abbe 100644 --- a/types/src/eth_signature_key.rs +++ b/types/src/eth_signature_key.rs @@ -12,8 +12,7 @@ use ethers::{ types::{Address, Signature}, utils::public_key_to_address, }; -use hotshot_types::traits::signature_key::BuilderSignatureKey; -use hotshot_types::traits::signature_key::PrivateSignatureKey; +use hotshot_types::traits::signature_key::{BuilderSignatureKey, PrivateSignatureKey}; use serde::{Deserialize, Serialize}; use thiserror::Error; diff --git a/types/src/v0/impls/block/full_payload/ns_proof.rs b/types/src/v0/impls/block/full_payload/ns_proof.rs index 4d463658d4..cf1b2d8408 100644 --- a/types/src/v0/impls/block/full_payload/ns_proof.rs +++ b/types/src/v0/impls/block/full_payload/ns_proof.rs @@ -109,25 +109,25 @@ impl NsProof { ) .ok()? // error: internal to payload_verify() .ok()?; // verification failure - } - (None, true) => {} // 0-length namespace, nothing to verify + }, + (None, true) => {}, // 0-length namespace, nothing to verify (None, false) => { tracing::error!( "ns verify: missing proof for nonempty ns payload range {:?}", range ); return None; - } + }, (Some(_), true) => { tracing::error!("ns verify: unexpected proof for empty ns payload range"); return None; - } + }, } // verification succeeded, return some data let ns_id = ns_table.read_ns_id_unchecked(&self.ns_index); Some((self.ns_payload.export_all_txs(&ns_id), ns_id)) - } + }, VidCommitment::V1(_) => None, } } diff --git a/types/src/v0/impls/block/full_payload/ns_proof/test.rs b/types/src/v0/impls/block/full_payload/ns_proof/test.rs index 6bd3849241..5a330b9c58 100644 --- a/types/src/v0/impls/block/full_payload/ns_proof/test.rs +++ b/types/src/v0/impls/block/full_payload/ns_proof/test.rs @@ -1,6 +1,5 @@ use futures::future; -use hotshot::helpers::initialize_logging; -use hotshot::traits::BlockPayload; +use hotshot::{helpers::initialize_logging, traits::BlockPayload}; use hotshot_query_service::VidCommitment; use hotshot_types::{ traits::EncodeBytes, diff --git a/types/src/v0/impls/block/full_payload/payload.rs b/types/src/v0/impls/block/full_payload/payload.rs index dc328273ea..2684ef211f 100644 --- a/types/src/v0/impls/block/full_payload/payload.rs +++ b/types/src/v0/impls/block/full_payload/payload.rs @@ -3,8 +3,8 @@ use std::{collections::BTreeMap, sync::Arc}; use async_trait::async_trait; use committable::Committable; use hotshot_query_service::availability::QueryablePayload; -use hotshot_types::data::ViewNumber; use hotshot_types::{ + data::ViewNumber, traits::{BlockPayload, EncodeBytes}, utils::BuilderCommitment, vid::advz::{ADVZCommon, ADVZScheme}, @@ -13,12 +13,11 @@ use jf_vid::VidScheme; use sha2::Digest; use thiserror::Error; -use crate::Transaction; use crate::{ v0::impls::{NodeState, ValidatedState}, v0_1::ChainConfig, Index, Iter, NamespaceId, NsIndex, NsPayload, NsPayloadBuilder, NsPayloadRange, NsTable, - NsTableBuilder, Payload, PayloadByteLen, SeqTypes, TxProof, + NsTableBuilder, Payload, PayloadByteLen, SeqTypes, Transaction, TxProof, }; #[derive(serde::Deserialize, serde::Serialize, Error, Debug, Eq, PartialEq)] @@ -281,7 +280,7 @@ impl PayloadByteLen { ADVZScheme::get_payload_byte_len(common) ); return false; - } + }, }; self.0 == expected diff --git a/types/src/v0/impls/block/namespace_payload/tx_proof.rs b/types/src/v0/impls/block/namespace_payload/tx_proof.rs index 5c2026088a..370e9da08b 100644 --- a/types/src/v0/impls/block/namespace_payload/tx_proof.rs +++ b/types/src/v0/impls/block/namespace_payload/tx_proof.rs @@ -199,19 +199,19 @@ impl TxProof { { return Some(false); } - } - (None, true) => {} // 0-length tx, nothing to verify + }, + (None, true) => {}, // 0-length tx, nothing to verify (None, false) => { tracing::error!( "tx verify: missing proof for nonempty tx payload range {:?}", range ); return None; - } + }, (Some(_), true) => { tracing::error!("tx verify: unexpected proof for empty tx payload range"); return None; - } + }, } } diff --git a/types/src/v0/impls/fee_info.rs b/types/src/v0/impls/fee_info.rs index d1d61dd42e..3316abce61 100644 --- a/types/src/v0/impls/fee_info.rs +++ b/types/src/v0/impls/fee_info.rs @@ -390,7 +390,7 @@ impl FeeAccountProof { .elem() .context("presence proof is missing account balance")? .0) - } + }, FeeMerkleProof::Absence(proof) => { let tree = FeeMerkleTree::from_commitment(comm); ensure!( @@ -398,7 +398,7 @@ impl FeeAccountProof { "invalid proof" ); Ok(0.into()) - } + }, } } @@ -413,11 +413,11 @@ impl FeeAccountProof { proof, )?; Ok(()) - } + }, FeeMerkleProof::Absence(proof) => { tree.non_membership_remember(FeeAccount(self.account), proof)?; Ok(()) - } + }, } } } @@ -442,14 +442,14 @@ pub fn retain_accounts( // This remember cannot fail, since we just constructed a valid proof, and are // remembering into a tree with the same commitment. snapshot.remember(account, *elem, proof).unwrap(); - } + }, LookupResult::NotFound(proof) => { // Likewise this cannot fail. snapshot.non_membership_remember(account, proof).unwrap() - } + }, LookupResult::NotInMemory => { bail!("missing account {account}"); - } + }, } } diff --git a/types/src/v0/impls/header.rs b/types/src/v0/impls/header.rs index 13940947e6..8adb69acae 100644 --- a/types/src/v0/impls/header.rs +++ b/types/src/v0/impls/header.rs @@ -177,7 +177,7 @@ impl<'de> Deserialize<'de> for Header { )), EitherOrVersion::Version(v) => { Err(serde::de::Error::custom(format!("invalid version {v:?}"))) - } + }, } } @@ -214,7 +214,7 @@ impl<'de> Deserialize<'de> for Header { )), EitherOrVersion::Version(v) => { Err(de::Error::custom(format!("invalid version {v:?}"))) - } + }, chain_config => Err(de::Error::custom(format!( "expected version, found chain_config {chain_config:?}" ))), @@ -607,7 +607,7 @@ impl Header { .as_ref() .fetch_chain_config(validated_cf.commit()) .await - } + }, } } } diff --git a/types/src/v0/impls/instance_state.rs b/types/src/v0/impls/instance_state.rs index 545b3722ce..c9b62ee730 100644 --- a/types/src/v0/impls/instance_state.rs +++ b/types/src/v0/impls/instance_state.rs @@ -2,8 +2,7 @@ use crate::v0::{ traits::StateCatchup, v0_99::ChainConfig, GenesisHeader, L1BlockInfo, L1Client, PubKey, Timestamp, Upgrade, UpgradeMode, }; -use hotshot_types::traits::states::InstanceState; -use hotshot_types::HotShotConfig; +use hotshot_types::{traits::states::InstanceState, HotShotConfig}; use std::{collections::BTreeMap, sync::Arc}; use vbs::version::Version; #[cfg(any(test, feature = "testing"))] @@ -174,7 +173,7 @@ impl Upgrade { config.stop_proposing_time = u64::MAX; config.start_voting_time = 0; config.stop_voting_time = u64::MAX; - } + }, UpgradeMode::Time(t) => { config.start_proposing_time = t.start_proposing_time.unix_timestamp(); config.stop_proposing_time = t.stop_proposing_time.unix_timestamp(); @@ -187,7 +186,7 @@ impl Upgrade { config.stop_proposing_view = u64::MAX; config.start_voting_view = 0; config.stop_voting_view = u64::MAX; - } + }, } } } diff --git a/types/src/v0/impls/l1.rs b/types/src/v0/impls/l1.rs index 7071a9192e..74853bc09d 100644 --- a/types/src/v0/impls/l1.rs +++ b/types/src/v0/impls/l1.rs @@ -28,11 +28,11 @@ use futures::{ use hotshot_types::traits::metrics::Metrics; use lru::LruCache; use parking_lot::RwLock; -use std::result::Result as StdResult; use std::{ cmp::{min, Ordering}, num::NonZeroUsize, pin::Pin, + result::Result as StdResult, sync::Arc, time::Instant, }; @@ -312,7 +312,7 @@ impl Service for SwitchingTransport { // If it's okay, log the success to the status current_transport.status.write().log_success(); Ok(res) - } + }, Err(err) => { // Increment the failure metric if let Some(f) = self_clone @@ -364,7 +364,7 @@ impl Service for SwitchingTransport { } Err(err) - } + }, } }) } @@ -737,12 +737,12 @@ impl L1Client { ); self.retry_delay().await; continue; - } + }, Err(err) => { tracing::warn!(number, "failed to get finalized L1 block: {err:#}"); self.retry_delay().await; continue; - } + }, }; break L1BlockInfo { number: block.header.number, @@ -815,7 +815,7 @@ impl L1Client { Err(err) => { tracing::warn!(from, to, %err, "Fee L1Event Error"); sleep(retry_delay).await; - } + }, } } } diff --git a/types/src/v0/impls/solver.rs b/types/src/v0/impls/solver.rs index e16fbc7f9f..fd7566b79c 100644 --- a/types/src/v0/impls/solver.rs +++ b/types/src/v0/impls/solver.rs @@ -54,7 +54,7 @@ impl Committable for RollupUpdatebody { comm = comm .u64_field("reserve_url", 2) .var_size_bytes(url.as_str().as_ref()) - } + }, Set(None) => comm = comm.u64_field("reserve_url", 1), Update::Skip => comm = comm.u64_field("reserve_url", 0), } diff --git a/types/src/v0/impls/state.rs b/types/src/v0/impls/state.rs index 8f0439d21e..c750c740c3 100644 --- a/types/src/v0/impls/state.rs +++ b/types/src/v0/impls/state.rs @@ -1118,7 +1118,7 @@ mod test { }), Header::V99(_) => { panic!("You called `Header.next()` on unimplemented version (v3)") - } + }, } } /// Replaces builder signature w/ invalid one. @@ -1147,7 +1147,7 @@ mod test { }), Header::V99(_) => { panic!("You called `Header.sign()` on unimplemented version (v3)") - } + }, } } diff --git a/types/src/v0/traits.rs b/types/src/v0/traits.rs index 9a33355288..3afc2046f0 100644 --- a/types/src/v0/traits.rs +++ b/types/src/v0/traits.rs @@ -344,7 +344,7 @@ impl StateCatchup for Vec { provider = provider.name(), "failed to fetch accounts: {err:#}" ); - } + }, } } @@ -371,7 +371,7 @@ impl StateCatchup for Vec { provider = provider.name(), "failed to fetch frontier: {err:#}" ); - } + }, } } @@ -391,7 +391,7 @@ impl StateCatchup for Vec { provider = provider.name(), "failed to fetch chain config: {err:#}" ); - } + }, } } @@ -488,11 +488,11 @@ pub trait SequencerPersistence: Sized + Send + Sync + Clone + 'static { Some(view) => { tracing::info!(?view, "starting from saved view"); view - } + }, None => { tracing::info!("no saved view, starting from genesis"); ViewNumber::genesis() - } + }, }; let next_epoch_high_qc = self @@ -517,7 +517,7 @@ pub trait SequencerPersistence: Sized + Send + Sync + Clone + 'static { let anchor_view = leaf.view_number(); (leaf, high_qc, Some(anchor_view)) - } + }, None => { tracing::info!("no saved leaf, starting from genesis leaf"); ( @@ -529,7 +529,7 @@ pub trait SequencerPersistence: Sized + Send + Sync + Clone + 'static { .to_qc2(), None, ) - } + }, }; let validated_state = if leaf.block_header().height() == 0 { // If we are starting from genesis, we can provide the full state. diff --git a/types/src/v0/utils.rs b/types/src/v0/utils.rs index fdac8c80e0..96d363a7ea 100644 --- a/types/src/v0/utils.rs +++ b/types/src/v0/utils.rs @@ -294,14 +294,14 @@ impl BackoffParams { Ok(res) => return Ok(res), Err(err) if self.disable => { return Err(err.context("Retryable operation failed; retries disabled")); - } + }, Err(err) => { tracing::warn!( "Retryable operation failed, will retry after {delay:?}: {err:#}" ); sleep(delay).await; delay = self.backoff(delay); - } + }, } } unreachable!() diff --git a/utils/src/lib.rs b/utils/src/lib.rs index 014cecec6d..b76ecf50d5 100644 --- a/utils/src/lib.rs +++ b/utils/src/lib.rs @@ -257,14 +257,14 @@ pub async fn init_signer(provider: &Url, mnemonic: &str, index: u32) -> Option { tracing::error!("error connecting to RPC {}: {}", provider, err); return None; - } + }, }; let chain_id = match provider.get_chainid().await { Ok(id) => id.as_u64(), Err(err) => { tracing::error!("error getting chain ID: {}", err); return None; - } + }, }; let mnemonic = match MnemonicBuilder::::default() .phrase(mnemonic) @@ -274,14 +274,14 @@ pub async fn init_signer(provider: &Url, mnemonic: &str, index: u32) -> Option { tracing::error!("error building wallet: {}", err); return None; - } + }, }; let wallet = match mnemonic.build() { Ok(wallet) => wallet, Err(err) => { tracing::error!("error opening wallet: {}", err); return None; - } + }, }; let wallet = wallet.with_chain_id(chain_id); Some(SignerMiddleware::new(provider, wallet)) @@ -367,7 +367,7 @@ where tracing::error!("contract revert: {:?}", e); } return Err(anyhow!("error sending transaction: {:?}", err)); - } + }, }; let hash = pending.tx_hash(); @@ -382,12 +382,12 @@ where Ok(Some(receipt)) => receipt, Ok(None) => { return Err(anyhow!("contract call {hash:x}: no receipt")); - } + }, Err(err) => { return Err(anyhow!( "contract call {hash:x}: error getting transaction receipt: {err}" )) - } + }, }; if receipt.status != Some(1.into()) { return Err(anyhow!("contract call {hash:x}: transaction reverted")); @@ -418,19 +418,19 @@ async fn wait_for_transaction_to_be_mined( if i >= log_retries { tracing::warn!("contract call {hash:?} (retry {i}/{retries}): error getting transaction status: {err}"); } - } + }, Ok(None) => { if i >= log_retries { tracing::warn!( "contract call {hash:?} (retry {i}/{retries}): missing from mempool" ); } - } + }, Ok(Some(tx)) if tx.block_number.is_none() => { if i >= log_retries { tracing::warn!("contract call {hash:?} (retry {i}/{retries}): pending"); } - } + }, Ok(Some(_)) => return true, } diff --git a/utils/src/stake_table.rs b/utils/src/stake_table.rs index 943c53f808..02bd624fcc 100644 --- a/utils/src/stake_table.rs +++ b/utils/src/stake_table.rs @@ -144,8 +144,10 @@ pub async fn update_stake_table( #[cfg(test)] mod test { - use crate::stake_table::{PermissionedStakeTableConfig, PermissionedStakeTableUpdate}; - use crate::test_utils::setup_test; + use crate::{ + stake_table::{PermissionedStakeTableConfig, PermissionedStakeTableUpdate}, + test_utils::setup_test, + }; use hotshot::types::{BLSPubKey, SignatureKey}; use hotshot_types::{light_client::StateKeyPair, network::PeerConfigKeys}; use toml::toml;