feat(L1): make deposit resource minimum base fee deploy-configurable - #401
Conversation
Allow L3 deployments to align SystemConfig minimumBaseFee and portal prevBaseFee with the 0.01 gwei conversion floor so standard deposits stay under Base's per-transaction gas cap during low parent demand. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
robriks
left a comment
There was a problem hiding this comment.
wow this touches some really involved mechanisms.
got pretty nerdsniped on how these gas configs are significant and am aligned that this the least invasive way to resolve the 100x overcharge for our use of this codebase as an L3.
long term, assuming the L3 goes to production, we might need to consider addressing this more invasively if gas conditions (on Base) are volatile and we expect to see high deposit volume.
that's because the 0.01gwei alignment between the minimum base fee and the conversion floor (enacted by this PR) can still be pushed out of balance if Base gas fees drop very low and deposit volume skyrockets.
accordingly, I think the long term solution would be to bound the burn itself so it's provably below the parent's per‑tx cap for the max deposit size. (Claude suggests to clamp gasCost or equivalently cap maximumBaseFee so _amount_max × maximumBaseFee / floor < 2^24). that way deposits would stay includable (ie don't revert) no matter what, with a downstream outcome that the fusaka limit becomes the canonical maximum fee to bridge to L3.
doing that would be pretty involved though since we'd definitely need to ascertain that bounding the burn doesn't create a cheaper‑spam or undercharge‑exploit surfaces. not worth the effort at this time but wanted to surface it as my recommendation if we get to that point
oh and also, Claude suggested that we bump @Custom:semver from 5.2.0 to 5.2.1 for this , I don't think we strictly need to in this PR but whenever we are "done" with the contract changes I think we should think about how to handle the semver so that it's clear our L3 versioning is distinct from canonical Base L2 versioning
|
|
||
| uint256 internal l2ChainId = 901; | ||
| uint32 internal constant L3_MINIMUM_BASE_FEE = 10_000_000; | ||
| uint256 internal constant BASE_TX_GAS_CAP = 16_777_216; |
There was a problem hiding this comment.
could we reference Fusaka here in a doc comment? some chains don't implement the newer tx gas limit, and a future hard fork alters this value
| uint256 gasUsed = gasBefore - gasleft(); | ||
| vm.stopBroadcast(); | ||
|
|
||
| assertLt(gasUsed, BASE_TX_GAS_CAP); |
There was a problem hiding this comment.
could we expand this test or add another regression one asserting the issue itself? claude's suggestion:
// 1 gwei default + parent base fee at the 0.01 gwei conversion floor => ~100x burn
SystemDeploy.DeployOutput memory output = systemDeploy.deploy(_deployInput(uint32(1 gwei)));
// ... resolve bridge/portal ...
vm.fee(0.01 gwei);
// ... measure gasUsed for the same depositETH call ...
assertGe(gasUsed, BASE_TX_GAS_CAP); // proves the regression the fix preventsCo-Authored-By: Claude <noreply@anthropic.com>
Summary
resourceConfigMinimumBaseFeeto deploy config (default1 gwei) and wire it intoSystemConfigresource config initialization.ResourceMetering.prevBaseFeefrom the configured minimum instead of hardcoding1 gwei, keeping portal metering aligned with the parent base-fee conversion floor.snapshots/semver-lock.jsonfor the updated OptimismPortal2 init bytecode.Test plan
just test --match-path test/deploy/ResourceConfigMinimumBaseFee.t.soljust test --match-path test/deploy/DeployConfig.t.soljust test --match-path test/L1/ResourceMetering.t.soljust test --match-path test/deploy/SystemDeploy.t.soljust semver-lockL3 deploy config
Set
"resourceConfigMinimumBaseFee": 10000000to align the0.01 gweiresource minimum with the portal conversion floor.