Skip to content

Commit 29435c9

Browse files
authored
chore(evm): make DUMMY_CALL_OUTPUT lazy, bump to 8k (foundry-rs#5589)
* chore: make dummy call output lazy, bump * chore: fmt * chore: make lazy bytes
1 parent 1044042 commit 29435c9

File tree

1 file changed

+4
-3
lines changed
  • evm/src/executor/inspector/cheatcodes

1 file changed

+4
-3
lines changed

evm/src/executor/inspector/cheatcodes/expect.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use super::{bail, ensure, fmt_err, Cheatcodes, Result};
22
use crate::{abi::HEVMCalls, executor::backend::DatabaseExt, utils::h160_to_b160};
33
use ethers::{
44
abi::{AbiDecode, RawLog},
5+
contract::Lazy,
56
types::{Address, Bytes, H160, U256},
67
};
78
use foundry_utils::error::{ERROR_PREFIX, REVERT_PREFIX};
@@ -16,9 +17,9 @@ use std::cmp::Ordering;
1617
/// Solidity will see a successful call and attempt to decode the return data. Therefore, we need
1718
/// to populate the return with dummy bytes so the decode doesn't fail.
1819
///
19-
/// 512 bytes was arbitrarily chosen because it is long enough for return values up to 16 words in
20+
/// 8912 bytes was arbitrarily chosen because it is long enough for return values up to 256 words in
2021
/// size.
21-
static DUMMY_CALL_OUTPUT: [u8; 1024] = [0u8; 1024];
22+
static DUMMY_CALL_OUTPUT: Lazy<Bytes> = Lazy::new(|| Bytes::from_static(&[0u8; 8192]));
2223

2324
/// Same reasoning as [DUMMY_CALL_OUTPUT], but for creates.
2425
static DUMMY_CREATE_ADDRESS: Address =
@@ -58,7 +59,7 @@ pub fn handle_expect_revert(
5859
(Some(DUMMY_CREATE_ADDRESS), Bytes::new())
5960
} else {
6061
trace!("successfully handled expected revert");
61-
(None, DUMMY_CALL_OUTPUT.to_vec().into())
62+
(None, DUMMY_CALL_OUTPUT.clone())
6263
})
6364
};
6465
}

0 commit comments

Comments
 (0)