-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: remove empty pending and future transaction lists (#4987)
- Loading branch information
Showing
3 changed files
with
81 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@nomicfoundation/edr": patch | ||
--- | ||
|
||
Fixed a bug in `hardhat_dropTransaction` where empty queues persisted and caused panics |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
use edr_eth::{ | ||
remote::PreEip1898BlockSpec, transaction::EthTransactionRequest, AccountInfo, Address, SpecId, | ||
B256, | ||
}; | ||
use edr_evm::KECCAK_EMPTY; | ||
use edr_provider::{ | ||
test_utils::{create_test_config_with_fork, one_ether}, | ||
MethodInvocation, MiningConfig, NoopLogger, Provider, ProviderRequest, | ||
}; | ||
use tokio::runtime; | ||
|
||
#[tokio::test(flavor = "multi_thread")] | ||
async fn issue_325() -> anyhow::Result<()> { | ||
let logger = Box::new(NoopLogger); | ||
let subscriber = Box::new(|_event| {}); | ||
|
||
let mut config = create_test_config_with_fork(None); | ||
config.hardfork = SpecId::CANCUN; | ||
config.mining = MiningConfig { | ||
auto_mine: false, | ||
..MiningConfig::default() | ||
}; | ||
|
||
let impersonated_account = Address::random(); | ||
config.genesis_accounts.insert( | ||
impersonated_account, | ||
AccountInfo { | ||
balance: one_ether(), | ||
nonce: 0, | ||
code: None, | ||
code_hash: KECCAK_EMPTY, | ||
}, | ||
); | ||
|
||
let provider = Provider::new(runtime::Handle::current(), logger, subscriber, config)?; | ||
|
||
provider.handle_request(ProviderRequest::Single( | ||
MethodInvocation::ImpersonateAccount(impersonated_account.into()), | ||
))?; | ||
|
||
let result = provider.handle_request(ProviderRequest::Single( | ||
MethodInvocation::SendTransaction(EthTransactionRequest { | ||
from: impersonated_account, | ||
to: Some(Address::random()), | ||
..EthTransactionRequest::default() | ||
}), | ||
))?; | ||
|
||
let transaction_hash: B256 = serde_json::from_value(result.result)?; | ||
|
||
let result = provider.handle_request(ProviderRequest::Single( | ||
MethodInvocation::DropTransaction(transaction_hash), | ||
))?; | ||
|
||
let dropped: bool = serde_json::from_value(result.result)?; | ||
|
||
assert!(dropped); | ||
|
||
provider.handle_request(ProviderRequest::Single(MethodInvocation::GetBlockByNumber( | ||
PreEip1898BlockSpec::pending(), | ||
false, | ||
)))?; | ||
|
||
Ok(()) | ||
} |