mirror of
https://github.com/pezkuwichain/revive-differential-tests.git
synced 2026-06-12 04:11:12 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2a9d497827 | |||
| 4763d763f6 | |||
| bd4de2c83d | |||
| 3c70e0ac76 | |||
| 995ef80940 | |||
| 75afdd9cfd | |||
| 8aaa69780e | |||
| d7795fff9d |
@@ -1,5 +1,5 @@
|
|||||||
/// This constant defines how much Wei accounts are pre-seeded with in genesis.
|
/// This constant defines how much Wei accounts are pre-seeded with in genesis.
|
||||||
///
|
///
|
||||||
/// We use [`u128::MAX`] here which means that accounts will be given 2^128 - 1 WEI which is
|
/// Note: After changing this number, check that the tests for kitchensink work as we encountered
|
||||||
/// (2^128 - 1) / 10^18 ETH.
|
/// some issues with different values of the initial balance on Kitchensink.
|
||||||
pub const INITIAL_BALANCE: u128 = u128::MAX;
|
pub const INITIAL_BALANCE: u128 = 10u128.pow(37);
|
||||||
|
|||||||
+45
-33
@@ -74,8 +74,6 @@ impl Instance {
|
|||||||
const GETH_STDOUT_LOG_FILE_NAME: &str = "node_stdout.log";
|
const GETH_STDOUT_LOG_FILE_NAME: &str = "node_stdout.log";
|
||||||
const GETH_STDERR_LOG_FILE_NAME: &str = "node_stderr.log";
|
const GETH_STDERR_LOG_FILE_NAME: &str = "node_stderr.log";
|
||||||
|
|
||||||
const TRANSACTION_INDEXING_ERROR: &str = "transaction indexing is in progress";
|
|
||||||
|
|
||||||
/// Create the node directory and call `geth init` to configure the genesis.
|
/// Create the node directory and call `geth init` to configure the genesis.
|
||||||
#[tracing::instrument(skip_all, fields(geth_node_id = self.id))]
|
#[tracing::instrument(skip_all, fields(geth_node_id = self.id))]
|
||||||
fn init(&mut self, genesis: String) -> anyhow::Result<&mut Self> {
|
fn init(&mut self, genesis: String) -> anyhow::Result<&mut Self> {
|
||||||
@@ -86,6 +84,8 @@ impl Instance {
|
|||||||
for signer_address in
|
for signer_address in
|
||||||
<EthereumWallet as NetworkWallet<Ethereum>>::signer_addresses(&self.wallet)
|
<EthereumWallet as NetworkWallet<Ethereum>>::signer_addresses(&self.wallet)
|
||||||
{
|
{
|
||||||
|
// Note, the use of the entry API here means that we only modify the entries for any
|
||||||
|
// account that is not in the `alloc` field of the genesis state.
|
||||||
genesis
|
genesis
|
||||||
.alloc
|
.alloc
|
||||||
.entry(signer_address)
|
.entry(signer_address)
|
||||||
@@ -267,45 +267,57 @@ impl EthereumNode for Instance {
|
|||||||
// it eventually works, but we only do that if the error we get back is the "transaction
|
// it eventually works, but we only do that if the error we get back is the "transaction
|
||||||
// indexing is in progress" error or if the receipt is None.
|
// indexing is in progress" error or if the receipt is None.
|
||||||
//
|
//
|
||||||
// Getting the transaction indexed and taking a receipt can take a long time especially
|
// At the moment we do not allow for the 60 seconds to be modified and we take it as
|
||||||
// when a lot of transactions are being submitted to the node. Thus, while initially we
|
// being an implementation detail that's invisible to anything outside of this module.
|
||||||
// only allowed for 60 seconds of waiting with a 1 second delay in polling, we need to
|
//
|
||||||
// allow for a larger wait time. Therefore, in here we allow for 5 minutes of waiting
|
// We allow a total of 60 retries for getting the receipt with one second between each
|
||||||
// with exponential backoff each time we attempt to get the receipt and find that it's
|
// retry and the next which means that we allow for a total of 60 seconds of waiting
|
||||||
// not available.
|
// before we consider that we're unable to get the transaction receipt.
|
||||||
let mut retries = 0;
|
let mut retries = 0;
|
||||||
let mut total_wait_duration = Duration::from_secs(0);
|
|
||||||
let max_allowed_wait_duration = Duration::from_secs(5 * 60);
|
|
||||||
loop {
|
loop {
|
||||||
if total_wait_duration >= max_allowed_wait_duration {
|
|
||||||
tracing::error!(
|
|
||||||
?total_wait_duration,
|
|
||||||
?max_allowed_wait_duration,
|
|
||||||
retry_count = retries,
|
|
||||||
"Failed to get receipt after polling for it"
|
|
||||||
);
|
|
||||||
anyhow::bail!(
|
|
||||||
"Polled for receipt for {total_wait_duration:?} but failed to get it"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
match provider.get_transaction_receipt(*transaction_hash).await {
|
match provider.get_transaction_receipt(*transaction_hash).await {
|
||||||
Ok(Some(receipt)) => break Ok(receipt),
|
Ok(Some(receipt)) => {
|
||||||
Ok(None) => {}
|
tracing::info!("Obtained the transaction receipt");
|
||||||
|
break Ok(receipt);
|
||||||
|
}
|
||||||
|
Ok(None) => {
|
||||||
|
if retries == 60 {
|
||||||
|
tracing::error!(
|
||||||
|
"Polled for transaction receipt for 60 seconds but failed to get it"
|
||||||
|
);
|
||||||
|
break Err(anyhow::anyhow!("Failed to get the transaction receipt"));
|
||||||
|
} else {
|
||||||
|
tracing::trace!(
|
||||||
|
retries,
|
||||||
|
"Sleeping for 1 second and trying to get the receipt again"
|
||||||
|
);
|
||||||
|
retries += 1;
|
||||||
|
tokio::time::sleep(std::time::Duration::from_secs(1)).await;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
let error_string = error.to_string();
|
let error_string = error.to_string();
|
||||||
if !error_string.contains(Self::TRANSACTION_INDEXING_ERROR) {
|
if error_string.contains("transaction indexing is in progress") {
|
||||||
|
if retries == 60 {
|
||||||
|
tracing::error!(
|
||||||
|
"Polled for transaction receipt for 60 seconds but failed to get it"
|
||||||
|
);
|
||||||
|
break Err(error.into());
|
||||||
|
} else {
|
||||||
|
tracing::trace!(
|
||||||
|
retries,
|
||||||
|
"Sleeping for 1 second and trying to get the receipt again"
|
||||||
|
);
|
||||||
|
retries += 1;
|
||||||
|
tokio::time::sleep(std::time::Duration::from_secs(1)).await;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
break Err(error.into());
|
break Err(error.into());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
let next_wait_duration = Duration::from_secs(2u64.pow(retries))
|
|
||||||
.min(max_allowed_wait_duration - total_wait_duration);
|
|
||||||
total_wait_duration += next_wait_duration;
|
|
||||||
retries += 1;
|
|
||||||
|
|
||||||
tokio::time::sleep(next_wait_duration).await;
|
|
||||||
}
|
}
|
||||||
})?
|
})?
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,6 +131,8 @@ impl KitchensinkNode {
|
|||||||
for signer_address in
|
for signer_address in
|
||||||
<EthereumWallet as NetworkWallet<Ethereum>>::signer_addresses(&self.wallet)
|
<EthereumWallet as NetworkWallet<Ethereum>>::signer_addresses(&self.wallet)
|
||||||
{
|
{
|
||||||
|
// Note, the use of the entry API here means that we only modify the entries for any
|
||||||
|
// account that is not in the `alloc` field of the genesis state.
|
||||||
genesis
|
genesis
|
||||||
.alloc
|
.alloc
|
||||||
.entry(signer_address)
|
.entry(signer_address)
|
||||||
|
|||||||
+1
-5
@@ -33,9 +33,5 @@
|
|||||||
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"timestamp": "0x00",
|
"timestamp": "0x00",
|
||||||
"alloc": {
|
"alloc": {}
|
||||||
"90F8bf6A479f320ead074411a4B0e7944Ea8c9C1": {
|
|
||||||
"balance": "10000000000000000000000"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user