From 13b618b0b4394a85cdf76ba718a77e701accd149 Mon Sep 17 00:00:00 2001 From: claravanstaden Date: Wed, 17 Jan 2024 14:48:43 +0200 Subject: [PATCH] remove minimal spec --- parachain/pallets/ethereum-client/src/lib.rs | 37 ++------------------ web/packages/test/scripts/build-binary.sh | 2 +- web/packages/test/scripts/deploy-ethereum.sh | 18 ++++++---- 3 files changed, 15 insertions(+), 42 deletions(-) diff --git a/parachain/pallets/ethereum-client/src/lib.rs b/parachain/pallets/ethereum-client/src/lib.rs index daee85c650..c99458441a 100644 --- a/parachain/pallets/ethereum-client/src/lib.rs +++ b/parachain/pallets/ethereum-client/src/lib.rs @@ -238,11 +238,8 @@ pub mod pallet { /// Submits a new finalized beacon header update. The update may contain the next /// sync committee. pub fn submit(origin: OriginFor, update: Box) -> DispatchResult { - log::info!(target: LOG_TARGET,"💫 submitted finalized header."); ensure_signed(origin)?; - log::info!(target: LOG_TARGET,"💫 is signed."); ensure!(!Self::operating_mode().is_halted(), Error::::Halted); - log::info!(target: LOG_TARGET,"💫 bridge not halted."); Self::process_update(&update)?; Ok(()) } @@ -334,11 +331,8 @@ pub mod pallet { pub(crate) fn process_update(update: &Update) -> DispatchResult { Self::cross_check_execution_state()?; - log::info!(target: LOG_TARGET,"💫 cross checked execution state."); Self::verify_update(update)?; - log::info!(target: LOG_TARGET,"💫 verified update."); Self::apply_update(update)?; - log::info!(target: LOG_TARGET,"💫 applied update."); Ok(()) } @@ -372,17 +366,12 @@ pub mod pallet { decompress_sync_committee_bits(update.sync_aggregate.sync_committee_bits); Self::sync_committee_participation_is_supermajority(&participation)?; - log::info!(target: LOG_TARGET,"💫 sync committee is a supermajority."); - // Verify update does not skip a sync committee period. ensure!( update.signature_slot > update.attested_header.slot && update.attested_header.slot >= update.finalized_header.slot, Error::::InvalidUpdateSlot ); - - log::info!(target: LOG_TARGET,"💫 update does not skip a sync committee period."); - // Retrieve latest finalized state. let latest_finalized_state = FinalizedBeaconState::::get(LatestFinalizedBlockRoot::::get()) @@ -398,8 +387,6 @@ pub mod pallet { ensure!(signature_period == store_period, Error::::SkippedSyncCommitteePeriod) } - log::info!(target: LOG_TARGET,"💫 next sync committee checks."); - // Verify update is relevant. let update_attested_period = compute_period(update.attested_header.slot); let update_has_next_sync_committee = !>::exists() && @@ -411,8 +398,6 @@ pub mod pallet { Error::::IrrelevantUpdate ); - log::info!(target: LOG_TARGET,"💫 update is relevant."); - // Verify that the `finality_branch`, if present, confirms `finalized_header` to match // the finalized checkpoint root saved in the state of `attested_header`. let finalized_block_root: H256 = update @@ -430,8 +415,6 @@ pub mod pallet { Error::::InvalidHeaderMerkleProof ); - log::info!(target: LOG_TARGET,"💫 finalized block header merkle proof passed."); - // Though following check does not belong to ALC spec we verify block_roots_root to // match the finalized checkpoint root saved in the state of `finalized_header` so to // cache it for later use in `verify_ancestry_proof`. @@ -446,12 +429,9 @@ pub mod pallet { Error::::InvalidBlockRootsRootMerkleProof ); - log::info!(target: LOG_TARGET,"💫 ancestry proof passed."); - // Verify that the `next_sync_committee`, if present, actually is the next sync // committee saved in the state of the `attested_header`. if let Some(next_sync_committee_update) = &update.next_sync_committee_update { - log::info!(target: LOG_TARGET,"💫 sync committee is present."); let sync_committee_root = next_sync_committee_update .next_sync_committee .hash_tree_root() @@ -463,7 +443,6 @@ pub mod pallet { Error::::InvalidSyncCommitteeUpdate ); } - log::info!(target: LOG_TARGET,"💫 checked sync committee periods."); ensure!( verify_merkle_branch( sync_committee_root, @@ -474,7 +453,6 @@ pub mod pallet { ), Error::::InvalidSyncCommitteeMerkleProof ); - log::info!(target: LOG_TARGET,"💫 sync committee merkle proof passed."); } // Verify sync committee aggregate signature. @@ -483,7 +461,6 @@ pub mod pallet { } else { >::get() }; - log::info!(target: LOG_TARGET,"💫 verifying signature."); let absent_pubkeys = Self::find_pubkeys(&participation, (*sync_committee.pubkeys).as_ref(), false); let signing_root = Self::signing_root( @@ -491,7 +468,6 @@ pub mod pallet { Self::validators_root(), update.signature_slot, )?; - log::info!(target: LOG_TARGET,"💫 fast_aggregate_verify."); // Improvement here per // suggested start from the full set aggregate_pubkey then subtracting the absolute // minority that did not participate. @@ -501,17 +477,8 @@ pub mod pallet { signing_root, &update.sync_aggregate.sync_committee_signature, ) - .map_err(|e| { - match e { - BlsError::InvalidSignature => log::error!(target: LOG_TARGET,"💫 InvalidSignature"), - BlsError::InvalidPublicKey=> log::error!(target: LOG_TARGET,"💫 InvalidPublicKey"), - BlsError::InvalidAggregatePublicKeys=> log::error!(target: LOG_TARGET,"💫 InvalidAggregatePublicKeys"), - BlsError::SignatureVerificationFailed=> log::error!(target: LOG_TARGET,"💫 SignatureVerificationFailed"), - } - log::error!(target: LOG_TARGET,"💫 BLSVerificationFailed: {:?}.", e); - Error::::BLSVerificationFailed(e) - })?; - log::info!(target: LOG_TARGET,"💫 verified signature."); + .map_err(|e| Error::::BLSVerificationFailed(e))?; + Ok(()) } diff --git a/web/packages/test/scripts/build-binary.sh b/web/packages/test/scripts/build-binary.sh index c92b934255..7d80fae313 100755 --- a/web/packages/test/scripts/build-binary.sh +++ b/web/packages/test/scripts/build-binary.sh @@ -7,7 +7,7 @@ build_binaries() { pushd $root_dir/polkadot-sdk local features='' - if [[ "$active_spec" == "minimal" ]]; then + if [ "$eth_network" == "localhost" ]; then features="--features fast-runtime" fi diff --git a/web/packages/test/scripts/deploy-ethereum.sh b/web/packages/test/scripts/deploy-ethereum.sh index 8af8526e6b..c99b619cc7 100755 --- a/web/packages/test/scripts/deploy-ethereum.sh +++ b/web/packages/test/scripts/deploy-ethereum.sh @@ -71,13 +71,15 @@ start_lodestar() { fi } -hack_beacon_client() { +set_slot_time() { + local old_value=$1 + local new_value=$2 echo "Hack lodestar for faster slot time" - local preset_minimal_config_file="$web_dir/node_modules/.pnpm/@lodestar+config@$lodestar_version/node_modules/@lodestar/config/lib/chainConfig/presets/minimal.js" + local preset_mainnet_config_file="$web_dir/node_modules/.pnpm/@lodestar+config@$lodestar_version/node_modules/@lodestar/config/lib/chainConfig/presets/mainnet.js" if [[ "$(uname)" == "Darwin" && -z "${IN_NIX_SHELL:-}" ]]; then - gsed -i "s/SECONDS_PER_SLOT: 6/SECONDS_PER_SLOT: 2/g" $preset_minimal_config_file + gsed -i "s/SECONDS_PER_SLOT: $old_value/SECONDS_PER_SLOT: $new_value/g" $preset_mainnet_config_file else - sed -i "s/SECONDS_PER_SLOT: 6/SECONDS_PER_SLOT: 2/g" $preset_minimal_config_file + sed -i "s/SECONDS_PER_SLOT: $old_value/SECONDS_PER_SLOT: $new_value/g" $preset_mainnet_config_file fi } @@ -89,8 +91,12 @@ deploy_local() { echo "Waiting for geth API to be ready" sleep 3 - if [ "$eth_fast_mode" == "true" ]; then - hack_beacon_client + # if were are running locally speed up the seconds per slot from 12 seconds to 2 seconds. if we are not + # running locally, revert + if [ "$eth_network" == "localhost" ]; then + set_slot_time 12 2 + else + set_slot_time 2 12 fi # 2. deploy consensus client