Skip to content

Commit 8a14f19

Browse files
devin-ai-integration[bot]Jayant Krishnamurthy
andcommitted
test(fortuna): add test for max_priority_fee computed from estimate_priority_fee
Co-Authored-By: Jayant Krishnamurthy <[email protected]>
1 parent efa56d7 commit 8a14f19

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

apps/fortuna/src/eth_utils/eth_gas_oracle.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,4 +332,20 @@ mod tests {
332332

333333
assert_eq!(max_fee, max_priority_fee + surged_base_fee);
334334
}
335+
336+
#[test]
337+
fn test_eip1559_default_estimator_uses_estimated_priority_fee() {
338+
let base_fee = U256::from(EIP1559_FEE_ESTIMATION_PRIORITY_FEE_TRIGGER + 1);
339+
let rewards = vec![
340+
vec![U256::from(10000)], // Higher than default priority fee (3000)
341+
];
342+
343+
let (max_fee, max_priority_fee) = eip1559_default_estimator(base_fee, rewards);
344+
345+
assert_eq!(max_priority_fee, U256::from(10000));
346+
347+
let surged_base_fee = base_fee * 14 / 10;
348+
349+
assert_eq!(max_fee, surged_base_fee);
350+
}
335351
}

0 commit comments

Comments
 (0)