Skip to content

Commit 1f07c98

Browse files
committed
add tmp fix on race condition
1 parent a3cfc0e commit 1f07c98

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

tests/e2e/cases/delegation.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crate::e2e::{
88
use alloy::{
99
eips::eip7702::constants::EIP7702_DELEGATION_DESIGNATOR,
1010
primitives::{Address, B256, Bytes, U64, U256},
11-
providers::{Provider, ext::AnvilApi},
11+
providers::{PendingTransactionBuilder, Provider, ext::AnvilApi},
1212
rpc::types::TransactionRequest,
1313
sol_types::{SolCall, SolValue},
1414
};
@@ -22,7 +22,7 @@ use relay::{
2222
rpc::{Meta, PrepareCallsCapabilities, PrepareCallsParameters},
2323
},
2424
};
25-
use std::ops::Div;
25+
use std::{ops::Div, time::Duration};
2626

2727
/// Ensures unsupported delegation implementations and proxies are caught.
2828
#[tokio::test(flavor = "multi_thread")]
@@ -121,6 +121,7 @@ async fn catch_invalid_delegation() -> eyre::Result<()> {
121121

122122
// Change the proxy before sending the quote and expect it to fail offchain.
123123
{
124+
tokio::time::sleep(Duration::from_secs(5)).await;
124125
env.provider()
125126
.anvil_set_code(
126127
env.eoa.address(),
@@ -152,6 +153,7 @@ async fn catch_invalid_delegation() -> eyre::Result<()> {
152153

153154
// Change the delegation proxy bytecodecode and prepare_calls & send_prepared_calls should fail.
154155
{
156+
tokio::time::sleep(Duration::from_secs(5)).await;
155157
let mut code = expected_proxy_code.to_vec();
156158
code[2] = code[2].wrapping_add(1);
157159
env.provider()
@@ -194,6 +196,7 @@ async fn catch_invalid_delegation() -> eyre::Result<()> {
194196

195197
// Upgrade implementation to another one and expect it to fail.
196198
{
199+
tokio::time::sleep(Duration::from_secs(5)).await;
197200
env.provider().anvil_set_code(env.eoa.address(), expected_eoa_code).await?;
198201
upgrade_delegation(&env, another_impl).await;
199202

@@ -223,6 +226,7 @@ async fn catch_invalid_delegation() -> eyre::Result<()> {
223226

224227
// Upgrade implementation to original and expect it to succeed sending the intent.
225228
{
229+
tokio::time::sleep(Duration::from_secs(5)).await;
226230
upgrade_delegation(
227231
&env,
228232
caps.chain(env.chain_id()).contracts.delegation_implementation.address,
@@ -258,8 +262,14 @@ pub async fn upgrade_delegation(env: &Environment, address: Address) {
258262
.into(),
259263
)
260264
.gas_limit(100_000);
261-
let _tx_hash: B256 =
265+
let tx_hash: B256 =
262266
env.provider().client().request("eth_sendTransaction", (tx,)).await.unwrap();
267+
268+
// Wait for transaction to be confirmed
269+
PendingTransactionBuilder::new(env.provider().root().clone(), tx_hash)
270+
.get_receipt()
271+
.await
272+
.unwrap();
263273
}
264274

265275
/// Ensures upgradeProxyAccount can be called as a precall.

0 commit comments

Comments
 (0)