Commit 668fb4d
committed
revive: cap remaining_gas to u64::MAX in substrate_execution
When calculating resource limits for nested calls through
substrate_execution::new_nested_meter, the ratio-based scaling
fails when deposit_left is very large (e.g., u128::MAX default).
The ratio becomes near-zero because:
- remaining_gas = weight_gas + deposit_gas (huge number from deposit)
- ratio = requested_gas / remaining_gas ≈ 0
- nested_weight_limit = ratio × weight_left ≈ 0
This causes proxy contracts using delegatecall to fail with OutOfGas
when called through ReviveApi.call, while the same calls succeed
through eth_transact.
Cap remaining_gas to u64::MAX since Ethereum gas is a u64 value.
This ensures the ratio is 1.0 when requesting all gas, giving the
nested call the full remaining weight.1 parent 5fd7bb5 commit 668fb4d
1 file changed
+6
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
123 | 129 | | |
124 | 130 | | |
125 | 131 | | |
| |||
0 commit comments