From c3155a6e39edcfbbde95eea8269a9e1b06bca90e Mon Sep 17 00:00:00 2001 From: Rob Walker Date: Fri, 19 Apr 2019 14:18:19 -0700 Subject: [PATCH] silence sigverify disabled, make disabling sigverify easier (#3901) * silence sigverify disabled, make disabling sigverify easier * fixup --- core/src/fullnode.rs | 5 ++ core/src/sigverify.rs | 7 +-- multinode-demo/bootstrap-leader.sh | 35 +------------- multinode-demo/extra-fullnode-args.sh | 66 +++++++++++++++++++++++++++ multinode-demo/fullnode.sh | 55 +--------------------- 5 files changed, 76 insertions(+), 92 deletions(-) create mode 100644 multinode-demo/extra-fullnode-args.sh diff --git a/core/src/fullnode.rs b/core/src/fullnode.rs index ec55a6d49..2416d52d4 100644 --- a/core/src/fullnode.rs +++ b/core/src/fullnode.rs @@ -238,6 +238,11 @@ impl Fullnode { &leader_schedule_cache, &exit, ); + + if config.sigverify_disabled { + warn!("signature verification disabled"); + } + let tpu = Tpu::new( &id, &cluster_info, diff --git a/core/src/sigverify.rs b/core/src/sigverify.rs index a307eebdf..ad9386bc2 100644 --- a/core/src/sigverify.rs +++ b/core/src/sigverify.rs @@ -101,11 +101,6 @@ fn verify_packet(packet: &Packet) -> u8 { 1 } -fn verify_packet_disabled(_packet: &Packet) -> u8 { - warn!("signature verification is disabled"); - 1 -} - fn batch_size(batches: &[Packets]) -> usize { batches.iter().map(|p| p.packets.len()).sum() } @@ -195,7 +190,7 @@ pub fn ed25519_verify_disabled(batches: &[Packets]) -> Vec> { debug!("disabled ECDSA for {}", batch_size(batches)); let rv = batches .into_par_iter() - .map(|p| p.packets.par_iter().map(verify_packet_disabled).collect()) + .map(|p| vec![1u8; p.packets.len()]) .collect(); inc_new_counter_info!("ed25519_verify_disabled", count); rv diff --git a/multinode-demo/bootstrap-leader.sh b/multinode-demo/bootstrap-leader.sh index f18257b5b..6957ae007 100755 --- a/multinode-demo/bootstrap-leader.sh +++ b/multinode-demo/bootstrap-leader.sh @@ -14,39 +14,8 @@ if [[ $1 = -h ]]; then fullnode_usage "$@" fi -extra_fullnode_args=() - -while [[ ${1:0:1} = - ]]; do - if [[ $1 = --blockstream ]]; then - extra_fullnode_args+=("$1" "$2") - shift 2 - elif [[ $1 = --enable-rpc-exit ]]; then - extra_fullnode_args+=("$1") - shift - elif [[ $1 = --init-complete-file ]]; then - extra_fullnode_args+=("$1" "$2") - shift 2 - elif [[ $1 = --public-address ]]; then - extra_fullnode_args+=("$1") - shift - elif [[ $1 = --no-voting ]]; then - extra_fullnode_args+=("$1") - shift - elif [[ $1 = --rpc-port ]]; then - extra_fullnode_args+=("$1" "$2") - shift 2 - elif [[ $1 = --dynamic-port-range ]]; then - extra_fullnode_args+=("$1" "$2") - shift 2 - else - echo "Unknown argument: $1" - exit 1 - fi -done - -if [[ -n $3 ]]; then - fullnode_usage "$@" -fi +# shellcheck source=multinode-demo/extra-fullnode-args.sh +source "$here"/extra-fullnode-args.sh [[ -f "$SOLANA_CONFIG_DIR"/bootstrap-leader-id.json ]] || { diff --git a/multinode-demo/extra-fullnode-args.sh b/multinode-demo/extra-fullnode-args.sh new file mode 100644 index 000000000..91c87fd23 --- /dev/null +++ b/multinode-demo/extra-fullnode-args.sh @@ -0,0 +1,66 @@ +# |source| this file +# +# handle arguments for bootstrap leader and validator fullnodes +# +# The following directive disable complaints about unused variables in this +# file: +# shellcheck disable=2034 +# + +if [[ $1 = -h ]]; then + fullnode_usage "$@" +fi + +extra_fullnode_args=() + +stake=43 # number of lamports to assign as stake (plus transaction fee to setup the stake) +poll_for_new_genesis_block=0 +label= + +while [[ ${1:0:1} = - ]]; do + if [[ $1 = --label ]]; then + label="-$2" + shift 2 + elif [[ $1 = --poll-for-new-genesis-block ]]; then + poll_for_new_genesis_block=1 + shift + elif [[ $1 = --blockstream ]]; then + stake=0 + extra_fullnode_args+=("$1" "$2") + shift 2 + elif [[ $1 = --enable-rpc-exit ]]; then + extra_fullnode_args+=("$1") + shift + elif [[ $1 = --init-complete-file ]]; then + extra_fullnode_args+=("$1" "$2") + shift 2 + elif [[ $1 = --public-address ]]; then + extra_fullnode_args+=("$1") + shift + elif [[ $1 = --stake ]]; then + stake="$2" + shift 2 + elif [[ $1 = --no-voting ]]; then + extra_fullnode_args+=("$1") + shift + elif [[ $1 = --no-sigverify ]]; then + extra_fullnode_args+=("$1") + shift + elif [[ $1 = --rpc-port ]]; then + extra_fullnode_args+=("$1" "$2") + shift 2 + elif [[ $1 = --dynamic-port-range ]]; then + extra_fullnode_args+=("$1" "$2") + shift 2 + elif [[ $1 = --gossip-port ]]; then + extra_fullnode_args+=("$1" "$2") + shift 2 + else + echo "Unknown argument: $1" + exit 1 + fi +done + +if [[ -n $3 ]]; then + fullnode_usage "$@" +fi diff --git a/multinode-demo/fullnode.sh b/multinode-demo/fullnode.sh index 922f99c55..8024cb8ad 100755 --- a/multinode-demo/fullnode.sh +++ b/multinode-demo/fullnode.sh @@ -9,59 +9,8 @@ source "$here"/common.sh # shellcheck source=scripts/oom-score-adj.sh source "$here"/../scripts/oom-score-adj.sh -if [[ $1 = -h ]]; then - fullnode_usage "$@" -fi - -extra_fullnode_args=() -stake=43 # number of lamports to assign as stake (plus transaction fee to setup the stake) -poll_for_new_genesis_block=0 -label= - -while [[ ${1:0:1} = - ]]; do - if [[ $1 = --label ]]; then - label="-$2" - shift 2 - elif [[ $1 = --poll-for-new-genesis-block ]]; then - poll_for_new_genesis_block=1 - shift - elif [[ $1 = --blockstream ]]; then - stake=0 - extra_fullnode_args+=("$1" "$2") - shift 2 - elif [[ $1 = --enable-rpc-exit ]]; then - extra_fullnode_args+=("$1") - shift - elif [[ $1 = --init-complete-file ]]; then - extra_fullnode_args+=("$1" "$2") - shift 2 - elif [[ $1 = --stake ]]; then - stake="$2" - shift 2 - elif [[ $1 = --public-address ]]; then - extra_fullnode_args+=("$1") - shift - elif [[ $1 = --no-voting ]]; then - extra_fullnode_args+=("$1") - shift - elif [[ $1 = --gossip-port ]]; then - extra_fullnode_args+=("$1" "$2") - shift 2 - elif [[ $1 = --rpc-port ]]; then - extra_fullnode_args+=("$1" "$2") - shift 2 - elif [[ $1 = --dynamic-port-range ]]; then - extra_fullnode_args+=("$1" "$2") - shift 2 - else - echo "Unknown argument: $1" - exit 1 - fi -done - -if [[ -n $3 ]]; then - fullnode_usage "$@" -fi +# shellcheck source=multinode-demo/extra-fullnode-args.sh +source "$here"/extra-fullnode-args.sh find_leader() { declare leader leader_address