Skip to content

Commit

Permalink
fix: propagated user operation from gossipsub
Browse files Browse the repository at this point in the history
  • Loading branch information
Vid201 committed Jun 17, 2024
1 parent 7ff8782 commit 5e75010
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Cross.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[build]
pre-build = [
"apt-get update && apt-get -y upgrade && apt-get install -y wget pkg-config llvm-dev libclang-6.0-dev clang-6.0 libssl-dev",
"apt-get update && apt-get -y upgrade && apt-get install -y wget pkg-config llvm-dev libclang-6.0-dev clang-6.0 libssl-dev ca-certificates",
"wget -c https://github.com/ethereum/solidity/releases/download/v0.8.20/solc-static-linux && mv solc-static-linux /usr/local/bin/solc && chmod a+x /usr/local/bin/solc"
]

Expand Down
2 changes: 1 addition & 1 deletion bin/silius/src/bundler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ where
if let Some(chain) = chain {
if !CHAINS.contains(&chain) {
warn!("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
warn!("Chain {:?} is not officially supported yet! You could possibly meet a lot of problems with silius. Use at your own risk!!", chain);
warn!("Chain {:?} is not officially supported yet! You could possibly meet a lot of problems with Silius. Use at your own risk!", chain);
warn!("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
}

Expand Down
14 changes: 9 additions & 5 deletions crates/mempool/src/validate/sanity/sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,15 @@ impl<M: Middleware> SanityCheck<M> for Sender {
return Ok(());
}

let uo_prev = mempool
.get_all_by_sender(&uo.sender)
.iter()
.find(|uo_prev| uo_prev.nonce == uo.nonce)
.cloned();
let mut uo_prev: Option<UserOperation> = None;

if !helper.val_config.ignore_prev {
uo_prev = mempool
.get_all_by_sender(&uo.sender)
.iter()
.find(|uo_prev| uo_prev.nonce == uo.nonce)
.cloned();
}

if let Some(uo_prev) = uo_prev {
if uo.max_fee_per_gas <
Expand Down
2 changes: 2 additions & 0 deletions crates/mempool/src/validate/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ where
min_stake: Some(reputation.min_stake()),
min_unstake_delay: Some(reputation.min_unstake_delay()),
topic: None,
ignore_prev: false,
};
}

Expand All @@ -269,6 +270,7 @@ where
if let Some(uo) = mempool.get_prev_by_sender(uo) {
out.prev_hash = Some(uo.hash);
}

debug!("Simulate user operation from {:?}", uo.sender);
let sim_res = self.simulate_validation(uo).await?;

Expand Down
5 changes: 4 additions & 1 deletion crates/p2p/src/service/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ impl Network {
min_stake: Some(canonical_mempool_config.min_stake),
min_unstake_delay: None,
topic: Some(message.topic.to_string()),
ignore_prev: false,
}
})
.expect("mempool channel should be open all the time");
Expand Down Expand Up @@ -424,7 +425,7 @@ impl Network {
verified_at_block_hash,
validation_config,
} => {
info!("Received user {user_operation:?} from ep {ep:?} verified in {verified_at_block_hash:?} to gossip over p2p!");
info!("Received user operation (verified at {verified_at_block_hash:?}) to gossip over p2p: {user_operation:?}");

let user_op = VerifiedUserOperation::new(
user_operation.user_operation.clone(),
Expand All @@ -444,6 +445,7 @@ impl Network {
min_stake: Some(first_mempool_config.min_stake),
min_unstake_delay: None,
topic: Some(first_mempool_topic.to_string()),
ignore_prev: true,
},
})
.expect("mempool channel should be open all the time");
Expand All @@ -463,6 +465,7 @@ impl Network {
min_stake: Some(canonical_mempool_config.min_stake),
min_unstake_delay: None,
topic: Some(canonical_mempool_topic.to_string()),
ignore_prev: true,
},
})
.expect("mempool channel should be open all the time");
Expand Down
1 change: 1 addition & 0 deletions crates/primitives/src/simulation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ pub struct ValidationConfig {
pub min_stake: Option<U256>,
pub min_unstake_delay: Option<U256>,
pub topic: Option<String>,
pub ignore_prev: bool,
}

/// Code hash - hash of the code of the contract
Expand Down

0 comments on commit 5e75010

Please sign in to comment.