Skip to content
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

Verify pricing of transactions that consume a lot of gas #603

Open
estensen opened this issue Dec 19, 2024 · 0 comments
Open

Verify pricing of transactions that consume a lot of gas #603

estensen opened this issue Dec 19, 2024 · 0 comments

Comments

@estensen
Copy link
Contributor

Preconfirming a tx that's 10x larger is only slightly more expensive. Verify that this is intentional. Preconfirming 10 txs that use the same amound of gas would be more profitable.

fn test_min_priority_fee_zero_preconfirmed() {
let pricing = PreconfPricing::default();
// Test minimum fee (21k gas ETH transfer, 0 preconfirmed)
let incoming_gas = 21_000;
let preconfirmed_gas = 0;
let min_fee_wei =
pricing.calculate_min_priority_fee(incoming_gas, preconfirmed_gas).unwrap();
// Pricing model article expects fee of 0.61 Gwei
assert!(
(min_fee_wei as f64 - 613_499_092.0).abs() < 1_000.0,
"Expected ~613,499,092 Wei, got {} Wei",
min_fee_wei
);
}
#[test]
fn test_min_priority_fee_zero_big_preconfirmed() {
let pricing = PreconfPricing::default();
// Test minimum fee (210k gas ETH transfer, 0 preconfirmed)
let incoming_gas = 210_000;
let preconfirmed_gas = 0;
let min_fee_wei =
pricing.calculate_min_priority_fee(incoming_gas, preconfirmed_gas).unwrap();
// This preconf uses 10x more gas than the 21k preconf,
// but the fee is only slightly higher.
assert!(
(min_fee_wei as f64 - 615_379_171.0).abs() < 1_000.0,
"Expected ~615,379,171 Wei, got {} Wei",
min_fee_wei
);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant