Skip to content

Commit

Permalink
fix(l1): made the tx-spammer work with our node (#1027)
Browse files Browse the repository at this point in the history
**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
  • Loading branch information
rodrigo-o authored Oct 31, 2024
1 parent acad2ee commit acd0365
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
5 changes: 2 additions & 3 deletions crates/networking/rpc/eth/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,8 @@ impl RpcHandler for GetTransactionCountRequest {
);

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

let nonce = storage
Expand Down
10 changes: 9 additions & 1 deletion crates/networking/rpc/types/block_identifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,15 @@ impl BlockIdentifier {
BlockTag::Finalized => storage.get_finalized_block_number(),
BlockTag::Safe => storage.get_safe_block_number(),
BlockTag::Latest => storage.get_latest_block_number(),
BlockTag::Pending => storage.get_pending_block_number(),
BlockTag::Pending => {
storage
.get_pending_block_number()
// If there are no pending blocks, we return the latest block number
.and_then(|pending_block_number| match pending_block_number {
Some(block_number) => Ok(Some(block_number)),
None => storage.get_latest_block_number(),
})
}
},
}
}
Expand Down
2 changes: 1 addition & 1 deletion test_data/el-stability-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ tasks:

- name: run_task_matrix
title: "Check block proposals from all client pairs"
timeout: 2m
timeout: 3m
configVars:
matrixValues: "validatorPairNames"
config:
Expand Down
4 changes: 3 additions & 1 deletion test_data/network_params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ assertoor_params:
run_block_proposal_check: false
run_blob_transaction_test: true
tests:
- 'https://raw.githubusercontent.com/lambdaclass/lambda_ethereum_rust/refs/heads/main/test_data/el-stability-check.yml'
- 'https://raw.githubusercontent.com/lambdaclass/lambda_ethereum_rust/refs/heads/main/test_data/el-stability-check.yml'
tx_spammer_params:
tx_spammer_extra_args: ["--accounts=10", --txcount=10]

0 comments on commit acd0365

Please sign in to comment.