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 #382

Open
wants to merge 67 commits into
base: main
Choose a base branch
from

Conversation

yuwen01
Copy link
Contributor

@yuwen01 yuwen01 commented Sep 20, 2024

Overview

We propose adding additional fee scalars to the fee formula, which allow for more flexibility for chains that leverage alt-DA, ZK proving, or custom gas tokens.

This spec goes with this design doc.

@yuwen01 yuwen01 marked this pull request as ready for review September 20, 2024 06:01
Copy link
Member

@sebastianst sebastianst left a comment

Choose a reason for hiding this comment

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

Also curious to hear from @tynes and @roberto-bayardo, who's implemented changes to the fee function in Fjord.

I propose to use a prefix for this feature that conveys more meaning, like OperatorFee or FixedFee.

specs/protocol/isthmus/configurability.md Outdated Show resolved Hide resolved
Comment on lines 17 to 18
calculation: the `ConfigurableFee`, which is parameterized by two scalars: the `configurableFeeScalar`
and the `configurableFeeConstant`.
Copy link
Member

Choose a reason for hiding this comment

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

I find the use of the prefix "configurable" a bit meaningless for this feature. Other fee parameters, like the (blob)BaseFeeScalars are also "configurable". Maybe we use a prefix that better describes the reason for their introduction, like

  • OperatorFee
  • operatorFeeScalar
  • operatorFeeConstant
    or something similar that attaches more meaning to them? fixedFee... could also work.

Blocks after the Isthmus activation block contain all pre-Isthmus values 1:1,
and also set the following new attributes:

- The `configurableFeeScalar` is set to `0`.
Copy link
Member

Choose a reason for hiding this comment

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

Don't we want to set it to 1? Otherwise there's no fees any more.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The configurableFeeScalar is only scaled by the gas used -- it doesn't scale any of the existing fees. The goal is to add a separate component to the fee calculation, like base fee and priority fee.


The configurable fee is set as follows:

`configurableFee = gas_used * configurableFeeScalar + configurableFeeConstant`
Copy link
Member

Choose a reason for hiding this comment

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

So we don't need any fractional scaling, like we introduced with Fjord for the model parameters? I mean something like

Suggested change
`configurableFee = gas_used * configurableFeeScalar + configurableFeeConstant`
`configurableFee = (gas_used * configurableFeeScalar + configurableFeeConstant) / 1e6`

to allow for a decimal precision of 6.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point -- it makes sense for users to be able to have fractional scalars. However, I don't know why a user would want to have a fractional constant. The only reason I can think would be to save bits -- see my other comment.

Comment on lines 30 to 31
| configurableFeeScalar | uint64 | 180-187 | |
| configurableFeeConstant | uint64 | 188-195 | |
Copy link
Member

Choose a reason for hiding this comment

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

Do we really want or need 64 bits instead of 32 bits size for the new parameters? E.g. the (blob)baseFeeScalars also worked with 32 bits (and also a decimal scaling factor, see other comment).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the feedback! I agree with your point about renaming to operatorFee and allowing for 6 decimal points of precision, but I was a little unsure about reducing the bit width of the operatorFeeConstant and operatorFeeScalar.

I think it should be fine to decrease the Scalar to 32 bits, but I'm concerned that 32 bits won't be enough to represent the constant factor. For example, in this transaction https://optimistic.etherscan.io/tx/0xa6dfc18c35bf39fa60823e9280bde18496e27e9016040f7ad9ded6797c374f05, the total transaction fee in wei requires 43 bits to represent.

If we scale the constant term by a fixed factor we could fit it in 32 bits. But I don't know how much control a user might want over this constant.


#### Configuring Parameters

`operatorFeeScalar` and `operatorFeeConstant` are loaded in a similar way to the `baseFeeScalar` and
Copy link
Contributor

Choose a reason for hiding this comment

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

I saw comment somewhere, maybe gone by now, that there would be restrictions on how large the operator fee scalar and fee constant should be set. If this feature becomes a standard chain features I think that this restriction is very important to protect user funds.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think that the operator fee will probably not become part of the superchain config since it adds complexity. Its purpose is more intended for non-standard chains, like op-succinct chains, for example.

My previous proposal wa the at the constant was between 0 and 600 Gwei and that the scalar was between 0 and 0.5x (basefee + priorityfee).

Copy link
Contributor

@refcell refcell left a comment

Choose a reason for hiding this comment

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

This looks good, just add a clarifier for the l1 block attributes function signature so it's clear what that value is at the top of the table in l1-attributes.md.

@yuwen01
Copy link
Contributor Author

yuwen01 commented Nov 25, 2024

This looks good, just add a clarifier for the l1 block attributes function signature so it's clear what that value is at the top of the table in l1-attributes.md.

Thanks! Just fixed.

@yuwen01
Copy link
Contributor Author

yuwen01 commented Dec 4, 2024

@sebastianst If you have a moment could you please review this spec?

@tynes
Copy link
Contributor

tynes commented Dec 4, 2024

cc @emhane @vdamle - Would be good to have your eyes on this as its isthmus related work

@benjaminion benjaminion changed the title isthmus: operator fee Isthmus: operator fee Dec 9, 2024

### `Roles`

The `Roles` struct is updated to include the new `OPERATOR_FEE_MANAGER` role.
Copy link

Choose a reason for hiding this comment

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

@tynes About the possible conflicts in SystemConfig, my concern is mainly about that part with the Roles struct that don't exist yet, but added in ethereum-optimism/optimism#12932

Copy link

@hashcashier hashcashier left a comment

Choose a reason for hiding this comment

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

While the simplicity here is appealing, this method of using gas to meter proving costs won't really work. The underlying assumption here is that gas correlates with proving cost, which doesn't really hold at all, and would lead often to a higher fee than what should be paid if the constant & scalar billing parameters are set to assume the worst-case ratio.

For example, SSTORE costs differ based on the delta from zero to non-zero values, and have gas refunds for clearing values. Cycle counts for a trie update in the stateless zk clients don't really follow these dynamics.

Do you think we can generalize this further into a more customizeable or precise metering approach?

@tynes
Copy link
Contributor

tynes commented Jan 13, 2025

@leruaa Do you mind sharing an update of the status of this?

@leruaa
Copy link

leruaa commented Jan 13, 2025

@tynes I think it's ready to be merged, all the feedbacks have been handled.

# Network upgrade automation transactions

The Isthmus hardfork activation block contains the following transactions, in this order:

Copy link
Contributor

Choose a reason for hiding this comment

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

This section is underspecified. What are the definitions of the network upgrade transactions? The ecotone specs contain examples of this. This is important because the derivation pipeline has to deterministically create these transactions, ie who is the from, what is the to, what is the data? For the contract deployments, we need finalized bytecode, which will need to come from a release

Copy link

@hashcashier hashcashier left a comment

Choose a reason for hiding this comment

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

Suggesting we use the transaction gas limit instead of metered usage to minimize the potential abuse of gas refunds on proving costs.


The operator fee, is set as follows:

`operatorFee = (gasUsed * operatorFeeScalar / 1e6) + operatorFeeConstant`

Choose a reason for hiding this comment

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

Suggested change
`operatorFee = (gasUsed * operatorFeeScalar / 1e6) + operatorFeeConstant`
`operatorFee = (gasLimit * operatorFeeScalar / 1e6) + operatorFeeConstant`


Where:

- `gasUsed` is amount of gas used by the transaction.

Choose a reason for hiding this comment

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

Suggested change
- `gasUsed` is amount of gas used by the transaction.
- `gasLimit` is the maximum amount of gas that can be used by the transaction.

@benjaminion benjaminion assigned leruaa and unassigned yuwen01 Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

9 participants