Conversation
📝 WalkthroughWalkthroughAdds a new Morph L2 transaction pool crate with ERC20-fee validation, validator and maintenance tasks; updates chainspec hardfork plumbing (Prague activation); adds MorphTx envelope accessors; and introduces error, transaction wrapper, and validation modules for pool integration. Changes
Sequence Diagram(s)sequenceDiagram
participant PoolMaint as Pool<br/>Maintenance
participant Canon as Canonical<br/>State
participant ChainSpec as ChainSpec<br/>Provider
participant StateDB as StateDB /<br/>State Provider
participant Validator as MorphTx<br/>Validator
participant Pool as Transaction<br/>Pool
PoolMaint->>Canon: Subscribe to head changes
Canon-->>PoolMaint: New block event
PoolMaint->>ChainSpec: Get hardfork at block
ChainSpec-->>PoolMaint: Hardfork ID
PoolMaint->>Pool: Collect MorphTx from pending/queued
Pool-->>PoolMaint: MorphTx list
PoolMaint->>StateDB: Get state provider for tip
StateDB-->>PoolMaint: State snapshot
PoolMaint->>StateDB: Fetch L1 block info
StateDB-->>PoolMaint: L1BlockInfo
loop per MorphTx
PoolMaint->>StateDB: Get sender ETH balance
StateDB-->>PoolMaint: ETH balance
PoolMaint->>Validator: validate_morph_tx(tx, balance, l1_fee, hardfork)
Validator-->>PoolMaint: Valid / Invalid (MorphTxError)
alt Invalid
PoolMaint->>Pool: Remove transaction
end
end
sequenceDiagram
participant Origin as Transaction<br/>Origin
participant Validator as MorphTx<br/>Validator
participant Envelope as MorphTxEnvelope
participant TokenDB as StateDB /<br/>Token Lookup
participant Result as Validation<br/>Result
Origin->>Validator: validate_one(tx)
Validator->>Envelope: extract fee_token_id, fee_limit
Envelope-->>Validator: (token_id, fee_limit) or None
Validator->>Validator: Check ETH balance >= tx.value
alt ETH insufficient
Validator-->>Result: InsufficientEthForValue
else
Validator->>TokenDB: TokenFeeInfo::try_fetch(token_id)
alt Token not found / fetch failed
TokenDB-->>Result: TokenNotFound / TokenInfoFetchFailed
else
TokenDB-->>Validator: TokenFeeInfo
Validator->>Validator: Validate token active & price_ratio
Validator->>Validator: Compute gas + L1 data -> total_eth_fee
Validator->>Validator: Convert eth fee -> required_token_amount
alt fee_limit < required_token_amount
Validator-->>Result: FeeLimitTooLow
else
Validator->>TokenDB: Get token balance(sender)
alt insufficient token balance
TokenDB-->>Result: InsufficientTokenBalance
else
Validator-->>Result: Valid (MorphTxValidationResult)
end
end
end
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@panos-xyz test |
Summary by CodeRabbit
New Features
Improvements
✏️ Tip: You can customize this high-level summary in your review settings.