Skip to content

Commit

Permalink
chore: update rust to 1.74, run fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
dancoombs committed Nov 21, 2023
1 parent f303ac3 commit bc72090
Show file tree
Hide file tree
Showing 40 changed files with 626 additions and 625 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
toolchain: 1.71.0
toolchain: 1.74.0
- name: Install toolchain (nightly)
run: rustup toolchain add nightly --component rustfmt --profile minimal
- uses: Swatinem/rust-cache@v2
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ resolver = "2"
[workspace.package]
version = "0.1.0-beta"
edition = "2021"
rust-version = "1.71"
rust-version = "1.74"
license = "MIT OR Apache-2.0"
repository = "https://github.com/alchemyplatform/rundler"

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Adapted from https://github.com/paradigmxyz/reth/blob/main/Dockerfile
# syntax=docker/dockerfile:1.4

FROM rust:1.72.0 AS chef-builder
FROM rust:1.74.0 AS chef-builder

# Install system dependencies
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
Expand Down
15 changes: 8 additions & 7 deletions bin/rundler/src/cli/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,14 @@ pub async fn run(rpc_args: RpcCliArgs, common_args: CommonArgs) -> anyhow::Resul
)
.await?;

let builder = connect_with_retries_shutdown(
"builder from rpc",
&builder_url,
RemoteBuilderClient::connect,
tokio::signal::ctrl_c(),
)
.await?;
let builder =
connect_with_retries_shutdown(
"builder from rpc",
&builder_url,
RemoteBuilderClient::connect,
tokio::signal::ctrl_c(),
)
.await?;

spawn_tasks_with_shutdown(
[RpcTask::new(task_args, pool, builder).boxed()],
Expand Down
4 changes: 1 addition & 3 deletions bin/tools/src/bin/deploy_dev_contracts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ async fn main() -> anyhow::Result<()> {
);
println!(
"Paymaster private signing key: 0x{}",
hex::encode(rundler_dev::test_signing_key_bytes(
PAYMASTER_SIGNER_ACCOUNT_ID
))
hex::encode(rundler_dev::test_signing_key_bytes(PAYMASTER_SIGNER_ACCOUNT_ID))
);
Ok(())
}
32 changes: 16 additions & 16 deletions crates/builder/src/bundle_proposer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -595,10 +595,11 @@ where
}

fn emit(&self, event: BuilderEvent) {
let _ = self.event_sender.send(WithEntryPoint {
entry_point: self.entry_point.address(),
event,
});
let _ =
self.event_sender.send(WithEntryPoint {
entry_point: self.entry_point.address(),
event,
});
}

fn op_hash(&self, op: &UserOperation) -> H256 {
Expand Down Expand Up @@ -893,9 +894,9 @@ mod tests {
let op = UserOperation::default();
let bundle = simple_make_bundle(vec![MockOp {
op: op.clone(),
simulation_result: Box::new(|| {
Err(SimulationError::Other(anyhow!("simulation failed")))
}),
simulation_result: Box::new(
|| Err(SimulationError::Other(anyhow!("simulation failed")))
),
}])
.await;
assert!(bundle.ops_per_aggregator.is_empty());
Expand All @@ -905,15 +906,14 @@ mod tests {
#[tokio::test]
async fn test_rejects_on_signature_failure() {
let op = UserOperation::default();
let bundle = simple_make_bundle(vec![MockOp {
op: op.clone(),
simulation_result: Box::new(|| {
Err(SimulationError::Violations(vec![
SimulationViolation::InvalidSignature,
]))
}),
}])
.await;
let bundle =
simple_make_bundle(vec![MockOp {
op: op.clone(),
simulation_result: Box::new(
|| Err(SimulationError::Violations(vec![SimulationViolation::InvalidSignature]))
),
}])
.await;
assert!(bundle.ops_per_aggregator.is_empty());
assert_eq!(bundle.rejected_ops, vec![op]);
}
Expand Down
9 changes: 5 additions & 4 deletions crates/builder/src/bundle_sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -507,10 +507,11 @@ where
}

fn emit(&self, event: BuilderEvent) {
let _ = self.event_sender.send(WithEntryPoint {
entry_point: self.entry_point.address(),
event,
});
let _ =
self.event_sender.send(WithEntryPoint {
entry_point: self.entry_point.address(),
event,
});
}

fn op_hash(&self, op: &UserOperation) -> H256 {
Expand Down
6 changes: 3 additions & 3 deletions crates/builder/src/sender/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ impl TransactionSenderType {
) -> Result<TransactionSenderEnum<C, S>, SenderConstructorErrors> {
let sender = match self {
Self::Raw => TransactionSenderEnum::Raw(RawTransactionSender::new(client, signer)),
Self::Conditional => TransactionSenderEnum::Conditional(
ConditionalTransactionSender::new(client, signer),
),
Self::Conditional => {
TransactionSenderEnum::Conditional(ConditionalTransactionSender::new(client, signer))
}
Self::Flashbots => {
if chain_id != Chain::Mainnet as u64 {
return Err(SenderConstructorErrors::InvalidChainForSender(
Expand Down
12 changes: 6 additions & 6 deletions crates/builder/src/server/remote/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ impl BuilderServer for RemoteBuilderClient {
Ok((H256::from_slice(&s.transaction_hash), s.block_number))
}
Some(debug_send_bundle_now_response::Result::Failure(f)) => Err(f.try_into()?),
None => Err(BuilderServerError::Other(anyhow::anyhow!(
"should have received result from builder"
)))?,
None => Err(BuilderServerError::Other(
anyhow::anyhow!("should have received result from builder")
))?,
}
}

Expand All @@ -103,9 +103,9 @@ impl BuilderServer for RemoteBuilderClient {
match res {
Some(debug_set_bundling_mode_response::Result::Success(_)) => Ok(()),
Some(debug_set_bundling_mode_response::Result::Failure(f)) => Err(f.try_into()?),
None => Err(BuilderServerError::Other(anyhow::anyhow!(
"should have received result from builder"
)))?,
None => Err(BuilderServerError::Other(
anyhow::anyhow!("should have received result from builder")
))?,
}
}
}
Expand Down
4 changes: 1 addition & 3 deletions crates/builder/src/server/remote/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ impl From<BuilderServerError> for ProtoBuilderError {
fn from(value: BuilderServerError) -> Self {
match value {
BuilderServerError::UnexpectedResponse => ProtoBuilderError {
error: Some(builder_error::Error::Internal(
"Unexpected response".to_string(),
)),
error: Some(builder_error::Error::Internal("Unexpected response".to_string())),
},
BuilderServerError::Other(e) => ProtoBuilderError {
error: Some(builder_error::Error::Internal(e.to_string())),
Expand Down
28 changes: 14 additions & 14 deletions crates/builder/src/server/remote/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,16 @@ impl GrpcBuilder for GrpcBuilderServerImpl {
_request: Request<DebugSendBundleNowRequest>,
) -> tonic::Result<Response<DebugSendBundleNowResponse>> {
let resp = match self.local_builder.debug_send_bundle_now().await {
Ok((hash, block_number)) => DebugSendBundleNowResponse {
result: Some(debug_send_bundle_now_response::Result::Success(
DebugSendBundleNowSuccess {
transaction_hash: hash.as_bytes().to_vec(),
block_number,
},
)),
},
Ok((hash, block_number)) => {
DebugSendBundleNowResponse {
result: Some(debug_send_bundle_now_response::Result::Success(
DebugSendBundleNowSuccess {
transaction_hash: hash.as_bytes().to_vec(),
block_number,
},
)),
}
}
Err(e) => {
return Err(Status::internal(format!("Failed to send bundle: {e}")));
}
Expand All @@ -124,9 +126,9 @@ impl GrpcBuilder for GrpcBuilderServerImpl {
) -> tonic::Result<Response<DebugSetBundlingModeResponse>> {
let resp = match self
.local_builder
.debug_set_bundling_mode(request.into_inner().mode.try_into().map_err(|e| {
Status::internal(format!("Failed to convert from proto reputation {e}"))
})?)
.debug_set_bundling_mode(request.into_inner().mode.try_into().map_err(
|e| Status::internal(format!("Failed to convert from proto reputation {e}"))
)?)
.await
{
Ok(()) => DebugSetBundlingModeResponse {
Expand All @@ -135,9 +137,7 @@ impl GrpcBuilder for GrpcBuilderServerImpl {
)),
},
Err(e) => {
return Err(Status::internal(format!(
"Failed to set bundling mode: {e}"
)));
return Err(Status::internal(format!("Failed to set bundling mode: {e}")));
}
};

Expand Down
20 changes: 10 additions & 10 deletions crates/builder/src/signer/aws.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ impl KmsSigner {

if key_ids.len() > 1 {
let (tx, rx) = oneshot::channel::<String>();
kms_guard = Some(SpawnGuard::spawn_with_guard(Self::lock_manager_loop(
redis_uri, key_ids, chain_id, ttl_millis, tx,
)));
kms_guard = Some(SpawnGuard::spawn_with_guard(
Self::lock_manager_loop(redis_uri, key_ids, chain_id, ttl_millis, tx)
));
key_id = rx.await.context("should lock key_id")?;
} else {
key_id = key_ids
Expand All @@ -62,10 +62,9 @@ impl KmsSigner {
.await
.context("should create signer")?;

let monitor_guard = SpawnGuard::spawn_with_guard(monitor_account_balance(
signer.address(),
provider.clone(),
));
let monitor_guard = SpawnGuard::spawn_with_guard(
monitor_account_balance(signer.address(), provider.clone())
);

Ok(Self {
signer,
Expand Down Expand Up @@ -105,9 +104,10 @@ impl KmsSigner {

let lock_id = locked_id.unwrap();
let _ = locked_tx.send(kid.unwrap());
let mut lg_opt = Some(LockGuard {
lock: lock.unwrap(),
});
let mut lg_opt =
Some(LockGuard {
lock: lock.unwrap(),
});

loop {
sleep(Duration::from_millis(ttl_millis / 10)).await;
Expand Down
13 changes: 7 additions & 6 deletions crates/builder/src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,13 @@ where
);

let builder_handle = self.builder_builder.get_handle();
let builder_runnder_handle = self.builder_builder.run(
manual_bundling_mode,
send_bundle_txs,
vec![self.args.entry_point_address],
shutdown_token.clone(),
);
let builder_runnder_handle =
self.builder_builder.run(
manual_bundling_mode,
send_bundle_txs,
vec![self.args.entry_point_address],
shutdown_token.clone(),
);

let remote_handle = match self.args.remote_address {
Some(addr) => {
Expand Down
15 changes: 3 additions & 12 deletions crates/builder/src/transaction_tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -665,10 +665,7 @@ mod tests {
let tracker = create_tracker(sender, provider).await;
let tracker_update = tracker.wait_for_update().await.unwrap();

assert!(matches!(
tracker_update,
TrackerUpdate::StillPendingAfterWait
));
assert!(matches!(tracker_update, TrackerUpdate::StillPendingAfterWait));
}

#[tokio::test]
Expand Down Expand Up @@ -702,10 +699,7 @@ mod tests {
let _sent_transaction = tracker.send_transaction(tx.into(), &exp).await.unwrap();
let tracker_update = tracker.wait_for_update().await.unwrap();

assert!(matches!(
tracker_update,
TrackerUpdate::LatestTxDropped { .. }
));
assert!(matches!(tracker_update, TrackerUpdate::LatestTxDropped { .. }));
}

#[tokio::test]
Expand All @@ -731,10 +725,7 @@ mod tests {

let tracker_update = tracker.wait_for_update().await.unwrap();

assert!(matches!(
tracker_update,
TrackerUpdate::NonceUsedForOtherTx { .. }
));
assert!(matches!(tracker_update, TrackerUpdate::NonceUsedForOtherTx { .. }));
}

#[tokio::test]
Expand Down
6 changes: 3 additions & 3 deletions crates/dev/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,9 +497,9 @@ struct DeterministicDeployProxy<M, S> {
}

impl<M: Middleware + 'static, S: Signer + 'static> DeterministicDeployProxy<M, S> {
const PROXY_ADDRESS: &str = "0x4e59b44847b379578588920ca78fbf26c0b4956c";
const DEPLOYMENT_TRANSACTION: &str = "0xf8a58085174876e800830186a08080b853604580600e600039806000f350fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf31ba02222222222222222222222222222222222222222222222222222222222222222a02222222222222222222222222222222222222222222222222222222222222222";
const DEPLOYMENT_SIGNER: &str = "0x3fab184622dc19b6109349b94811493bf2a45362";
const PROXY_ADDRESS: &'static str = "0x4e59b44847b379578588920ca78fbf26c0b4956c";
const DEPLOYMENT_TRANSACTION: &'static str = "0xf8a58085174876e800830186a08080b853604580600e600039806000f350fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf31ba02222222222222222222222222222222222222222222222222222222222222222a02222222222222222222222222222222222222222222222222222222222222222";
const DEPLOYMENT_SIGNER: &'static str = "0x3fab184622dc19b6109349b94811493bf2a45362";
const DEPLOYMENT_GAS_PRICE: u64 = 100_000_000_000;
const DEPLOYMENT_GAS_LIMIT: u64 = 100_000;

Expand Down
Loading

0 comments on commit bc72090

Please sign in to comment.