Skip to content

Commit acd0365

Browse files
authored
fix(l1): made the tx-spammer work with our node (#1027)
**Motivation** Have the tx spammer running instead of immediatly shutting down when we are the first node in the devnet setup. **Description** This PR tackled a couple of issues until we were able to process an initial transaction, (they are small changes): - We were returning an error on `eth_getTransactionCount` when we either didn't have a `latest` block before genesis or at any point when we don't have `pending` blocks. The solution in this case was returning `0x0` in those cases. - When requesting `eth_getTransactionCount` on `pending` after some transaction went through we were defaulting to `0x0`, it appears that the idea is to default to the `latest` in those case which make sense. - There were a missing filter that made the node panic when building payloads for transactions with fees lower than the base_fee_per_gas, this generated that those kind of transactions stopped the node's ability to build blocks when they were in the mempool, we made a quick workaround in this PR, but will remove it in favor of #1018 Closes #1026
1 parent acad2ee commit acd0365

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

crates/networking/rpc/eth/account.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,8 @@ impl RpcHandler for GetTransactionCountRequest {
156156
);
157157

158158
let Some(block_number) = self.block.resolve_block_number(&storage)? else {
159-
return Err(RpcErr::Internal(
160-
"Could not resolve block number".to_owned(),
161-
)); // Should we return Null here?
159+
return serde_json::to_value("0x0")
160+
.map_err(|error| RpcErr::Internal(error.to_string()));
162161
};
163162

164163
let nonce = storage

crates/networking/rpc/types/block_identifier.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,15 @@ impl BlockIdentifier {
3939
BlockTag::Finalized => storage.get_finalized_block_number(),
4040
BlockTag::Safe => storage.get_safe_block_number(),
4141
BlockTag::Latest => storage.get_latest_block_number(),
42-
BlockTag::Pending => storage.get_pending_block_number(),
42+
BlockTag::Pending => {
43+
storage
44+
.get_pending_block_number()
45+
// If there are no pending blocks, we return the latest block number
46+
.and_then(|pending_block_number| match pending_block_number {
47+
Some(block_number) => Ok(Some(block_number)),
48+
None => storage.get_latest_block_number(),
49+
})
50+
}
4351
},
4452
}
4553
}

test_data/el-stability-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ tasks:
2424

2525
- name: run_task_matrix
2626
title: "Check block proposals from all client pairs"
27-
timeout: 2m
27+
timeout: 3m
2828
configVars:
2929
matrixValues: "validatorPairNames"
3030
config:

test_data/network_params.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,6 @@ assertoor_params:
2020
run_block_proposal_check: false
2121
run_blob_transaction_test: true
2222
tests:
23-
- 'https://raw.githubusercontent.com/lambdaclass/lambda_ethereum_rust/refs/heads/main/test_data/el-stability-check.yml'
23+
- 'https://raw.githubusercontent.com/lambdaclass/lambda_ethereum_rust/refs/heads/main/test_data/el-stability-check.yml'
24+
tx_spammer_params:
25+
tx_spammer_extra_args: ["--accounts=10", --txcount=10]

0 commit comments

Comments
 (0)