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

isthmus: operator fee #388

Draft
wants to merge 15 commits into
base: optimism
Choose a base branch
from

Conversation

yuwen01
Copy link

@yuwen01 yuwen01 commented Sep 25, 2024

Adds the operator fee, as described in this design doc and this spec

@yuwen01 yuwen01 marked this pull request as ready for review September 25, 2024 23:37
@yuwen01 yuwen01 requested a review from a team as a code owner September 25, 2024 23:37
@yuwen01 yuwen01 changed the title Yuwen/operator fee feat: holocene operator fee Sep 25, 2024
@yuwen01 yuwen01 changed the title feat: holocene operator fee holocene: operator fee Sep 27, 2024
@yuwen01 yuwen01 marked this pull request as draft October 3, 2024 01:32
@yuwen01 yuwen01 changed the title holocene: operator fee isthmus: operator fee Oct 10, 2024
GasLimit: header.GasLimit,
Random: random,
L1CostFunc: types.NewL1CostFunc(config, statedb),
OperatorCostFunc: types.NewOperatorCostFunc(config, statedb),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I lean towards not adding a new hook and just making the L1 cost function more generic, a better name for it would be L2CostFunc which would imply it does the L2 specific fee calculations. Curious what other people think

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about this too. Currently, these are the function signatures for the L1CostFunc and the OperatorCostFunc

type L1CostFunc func(rcd RollupCostData, blockTime uint64) *big.Int

type OperatorCostFunc func(gasUsed *big.Int, isRefund bool, blockTime uint64) *big.Int

I could potentially package up the gasUsed and isRefund together into an OperatorCostData or something. Then, we'd have this type.

type L2CostFunc func(rcd RollupCostData, ocd OperatorCostData, blockTime uint64) (*big.Int, *big.Int)

which returns the l1 cost and operator cost as a pair.

This pattern seems clunkier to me -- though the L1 fee and Operator fee are conceptually similar, I don't like returning both in a single function. For example, when calculating refunds, we only need the operator fee but not the L1 fee.

I'd definitely be open to unifying the two with a cleaner function design though.

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

Successfully merging this pull request may close these issues.

2 participants