-
Notifications
You must be signed in to change notification settings - Fork 39
feat: add transaction gas limit #214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
fd22cf1
fc2db02
572821b
f437868
6416745
a3021bf
a2f0546
680c10f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -195,42 +195,83 @@ async fn test_no_tx_pool(rbuilder: LocalInstance) -> eyre::Result<()> { | |
| } | ||
|
|
||
| #[rb_test(args = OpRbuilderArgs { | ||
| max_gas_per_txn: Some(21000), | ||
| max_gas_per_txn: Some(25000), | ||
| ..Default::default() | ||
| })] | ||
| async fn chain_produces_big_txs(rbuilder: LocalInstance) -> eyre::Result<()> { | ||
| async fn chain_produces_big_tx_with_gas_limit(rbuilder: LocalInstance) -> eyre::Result<()> { | ||
| let driver = rbuilder.driver().await?; | ||
|
|
||
| #[cfg(target_os = "linux")] | ||
| let driver = driver | ||
| .with_validation_node(crate::tests::ExternalNode::reth().await?) | ||
| .await?; | ||
|
|
||
| let count = rand::random_range(1..8); | ||
| let mut tx_hashes = HashSet::<TxHash>::default(); | ||
| // insert txn with gas usage above limit | ||
| let _ = driver | ||
| .create_transaction() | ||
| .random_big_transaction() | ||
| .send() | ||
| .await | ||
| .expect("Failed to send transaction"); | ||
|
|
||
| let block = driver.build_new_block_with_current_timestamp(None).await?; | ||
| let txs = block.transactions; | ||
|
|
||
| for _ in 0..count { | ||
| // insert txns with gas = 210_000 | ||
| let tx = driver | ||
| .create_transaction() | ||
| .random_big_transaction() | ||
| .send() | ||
| .await | ||
| .expect("Failed to send transaction"); | ||
| println!("{}", txs.len()); | ||
| assert!(txs.len() == 3); | ||
|
|
||
| tx_hashes.insert(*tx.tx_hash()); | ||
| } | ||
| Ok(()) | ||
| } | ||
|
|
||
| // insert 1 valid txn with gas=21_000 | ||
| #[rb_test(args = OpRbuilderArgs { | ||
| ..Default::default() | ||
| })] | ||
| async fn chain_produces_big_tx_without_gas_limit(rbuilder: LocalInstance) -> eyre::Result<()> { | ||
| let driver = rbuilder.driver().await?; | ||
|
|
||
| #[cfg(target_os = "linux")] | ||
| let driver = driver | ||
| .with_validation_node(crate::tests::ExternalNode::reth().await?) | ||
| .await?; | ||
|
|
||
| // insert txn with gas usage but there is no limit | ||
| let _ = driver | ||
| .create_transaction() | ||
| .random_valid_transfer() | ||
| .random_big_transaction() | ||
| .send() | ||
| .await | ||
| .expect("Failed to send transaction"); | ||
|
|
||
| let block = driver.build_new_block_with_current_timestamp(None).await?; | ||
| let txs = block.transactions; | ||
|
|
||
| println!("{}", txs.len()); | ||
|
||
| assert!(txs.len() == 4); | ||
|
|
||
| Ok(()) | ||
| } | ||
|
|
||
| #[rb_test(args = OpRbuilderArgs { | ||
| max_gas_per_txn: Some(25000), | ||
| ..Default::default() | ||
| })] | ||
| async fn chain_produces_small_tx(rbuilder: LocalInstance) -> eyre::Result<()> { | ||
|
||
| let driver = rbuilder.driver().await?; | ||
|
|
||
| #[cfg(target_os = "linux")] | ||
| let driver = driver | ||
| .with_validation_node(crate::tests::ExternalNode::reth().await?) | ||
| .await?; | ||
|
|
||
| // insert valid txn under limit | ||
| let _ = driver | ||
| .create_transaction() | ||
| .random_valid_transfer() | ||
| .send() | ||
| .await | ||
| .expect("Failed to send transaction"); | ||
|
|
||
| let block = driver.build_new_block_with_current_timestamp(None).await?; | ||
| let txs = block.transactions; | ||
|
|
||
| assert!(txs.len() == 4); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
debug