Skip to content

Commit

Permalink
Merge pull request #3576 from anoma/fraccaman/remove-load-shed
Browse files Browse the repository at this point in the history
ledger: avoid load shedding tower info service
  • Loading branch information
mergify[bot] authored Aug 2, 2024
2 parents 27e9d91 + 3e4d48e commit 6d3fc90
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .changelog/unreleased/bug-fixes/3576-remove-load-shed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Do not load shed tower-abci info service.
([\#3576](https://github.com/anoma/namada/pull/3576))
9 changes: 1 addition & 8 deletions crates/node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ use once_cell::unsync::Lazy;
use sysinfo::{RefreshKind, System, SystemExt};
use tokio::sync::mpsc;
use tokio::task;
use tower::ServiceBuilder;

use self::abortable::AbortableSpawner;
use self::ethereum_oracle::last_processed_block;
Expand Down Expand Up @@ -746,13 +745,7 @@ async fn run_abci(
.consensus(consensus)
.snapshot(snapshot)
.mempool(mempool) // don't load_shed, it will make CometBFT crash
.info(
ServiceBuilder::new()
.load_shed()
.buffer(100)
.rate_limit(50, std::time::Duration::from_secs(1))
.service(info),
)
.info(info) // don't load_shed, it will make tower-abci crash
.finish()
.unwrap();
tokio::select! {
Expand Down
16 changes: 11 additions & 5 deletions crates/sdk/src/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3548,10 +3548,15 @@ pub async fn build_update_account(
let threshold = *threshold;

let invalid_threshold = threshold.is_zero();
let invalid_threshold_updated = !public_keys.is_empty() && public_keys.len() < threshold as usize;
let invalid_threshold_current = public_keys.is_empty() && account.get_all_public_keys().len() < threshold as usize;

if invalid_threshold || invalid_threshold_updated || invalid_threshold_current {
let invalid_threshold_updated =
!public_keys.is_empty() && public_keys.len() < threshold as usize;
let invalid_threshold_current = public_keys.is_empty()
&& account.get_all_public_keys().len() < threshold as usize;

if invalid_threshold
|| invalid_threshold_updated
|| invalid_threshold_current
{
edisplay_line!(
context.io(),
"Invalid account threshold: either the provided threshold is \
Expand All @@ -3566,7 +3571,8 @@ pub async fn build_update_account(

Some(threshold)
} else {
let invalid_too_few_pks = !public_keys.is_empty() && public_keys.len() < account.threshold as usize;
let invalid_too_few_pks = !public_keys.is_empty()
&& public_keys.len() < account.threshold as usize;

if invalid_too_few_pks {
return Err(Error::from(TxSubmitError::InvalidAccountThreshold));
Expand Down

0 comments on commit 6d3fc90

Please sign in to comment.