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 73 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.

@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

Choose a reason for hiding this comment

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

Can you send a link to one of the ecotone specs that contains an example of the network upgrade transaction definitions?

I don't see a clear format in the derivation spec: https://github.com/ethereum-optimism/specs/blob/main/specs/protocol/ecotone/derivation.md#ecotone-blob-retrieval

Copy link
Contributor

Choose a reason for hiding this comment

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

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.

specs/protocol/isthmus/exec-engine.md Show resolved Hide resolved
specs/protocol/isthmus/exec-engine.md Show resolved Hide resolved
@benjaminion benjaminion assigned leruaa and unassigned yuwen01 Jan 24, 2025
@tynes
Copy link
Contributor

tynes commented Jan 28, 2025

Another question - now that standard L2 genesis is being decoupled from this, what is the state of the implementation of the system config + operator fee vault? how is the RECIPIENT set?

@tynes
Copy link
Contributor

tynes commented Jan 28, 2025

We need to handle both the upgrade case and the from genesis case. How do we handle the new predeploy in the upgrade case? We have a requirement that the derivation pipeline upgrade transactions are deterministic, its not straight forward to set the RECIPIENT due to this constraint. I recommend the network upgrade tx deploys a FeeVault with the RECIPIENT set to address(0) and then chains that upgrade will need to set a new implementation with the RECIPIENT that they want. Without standard L2 genesis, there isn't much of a better way to do this

@tynes
Copy link
Contributor

tynes commented Jan 28, 2025

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

cc @yuwen01 @ratankaliani @leruaa thoughts on this?

@tynes
Copy link
Contributor

tynes commented Jan 29, 2025

Opened #562 so that you can see what a spec for network upgrade txs look like

@leruaa
Copy link

leruaa commented Jan 29, 2025

@tynes about @hashcashier suggestion, we think that gas used is more representative of proving costs. Furthermore, we are in favor of an incremental approach, rather than updating the current implementation, at the risk of delaying delivery. Especially considering it's possible that Isthmus could be advanced to cycle 35, and that an audit needs to be done.

@tynes
Copy link
Contributor

tynes commented Jan 30, 2025

@leruaa I am more concerned about delivery being delayed due to underspecification of key parts that i have commented on without it being addressed in a timely manner

we think that gas used is more representative of proving costs.

Please explain why

@puma314
Copy link

puma314 commented Jan 30, 2025

The gas_used represents the actual amount of gas/computation that is used for processing the transaction. The way that proving works is that every opcode that is processed incurs a certain amount of "cycles" in the zkVM, and so gas_used is a direct measure of the opcodes that are processed. The gas_limit is NOT correlated with this, so it is quite obvious to me that gas_used is significantly more correlated with proving costs vs. gas_limit?

I think @hashcashier should specify what potential "abuse" there might be on gas refunds, as that is not clear to me.

@K-Ho
Copy link

K-Ho commented Jan 30, 2025

The gas_used represents the actual amount of gas/computation that is used for processing the transaction. The way that proving works is that every opcode that is processed incurs a certain amount of "cycles" in the zkVM, and so gas_used is a direct measure of the opcodes that are processed. The gas_limit is NOT correlated with this, so it is quite obvious to me that gas_used is significantly more correlated with proving costs vs. gas_limit?

I think @hashcashier should specify what potential "abuse" there might be on gas refunds, as that is not clear to me.

This makes sense to me.

  1. We have agreed this is a v0 of how to accurately charge for zk proving costs, and that we will iterate on it in the future.
  2. This feature is growing stale and as long as there is no security risk (which should be reviewed in the FMA review), we should not optimize towards getting this out into the real world and testing it over making the perfect formula on our first try.

We've iterated many times on the fee formula for accurately charging for L1 data fees, and I guarantee we will continue to make improvements to it

@tynes
Copy link
Contributor

tynes commented Jan 30, 2025

The gas_used represents the actual amount of gas/computation that is used for processing the transaction. The way that proving works is that every opcode that is processed incurs a certain amount of "cycles" in the zkVM, and so gas_used is a direct measure of the opcodes that are processed. The gas_limit is NOT correlated with this, so it is quite obvious to me that gas_used is significantly more correlated with proving costs vs. gas_limit?

I think @hashcashier should specify what potential "abuse" there might be on gas refunds, as that is not clear to me.

See the following EIP for an explanation: https://eips.ethereum.org/EIPS/eip-7778

It is a real thing, given you do not get your electricity and gpu time back in the same way that you get gas back onchain

| `L1_ERC_721_BRIDGE_ADDRESS` | `uint8(5)` | Sets the `L1ERC721Bridge` address |
| `L1_STANDARD_BRIDGE_ADDRESS` | `uint8(6)` | Sets the `L1StandardBridge` address |
| `REMOTE_CHAIN_ID` | `uint8(7)` | Sets the chain id of the base chain |
| `OPERATOR_FEE_VAULT_CONFIG` | `uint8(4)` | Sets the Fee Vault Config for the `OperatorFeeVault` |
Copy link
Contributor

Choose a reason for hiding this comment

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

Given we are not combining this with L2 standard genesis, we are going to need to rethink how we go about configuring the system. How does the existing solidity implementation work?

Copy link

Choose a reason for hiding this comment

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

Seems like there was a bad merge in this file, I will have a look.

Currently I added a new method setOperatorFeeScalars(uint32, uint64) to SystemConfig. But reading the same file in the main branch, I see a section about Fee Vault Config, so I guess I should conform with that and add a function setOperatoreFeeVaultConfig(address,uint256,WithdrawalNetwork) method. Is it what you have in mind?

Copy link

Choose a reason for hiding this comment

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

Ah ok, I saw the Fee Vault Config section is part of L2 standard genesis, so I won't need to conform with that.

Verify `data`:

```bash
git checkout 905311d64d3df67649837ec57f0b0a4b6214ce31
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a copypasta - we don't use pnpm anymore. Please prove to me that the bytecode in the txt file is legit

Copy link
Contributor

Choose a reason for hiding this comment

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

We are going to want to use a commit of a release. This means we will want to remove any rc suffix on the semver of the specific contracts being upgraded

@@ -67,6 +73,7 @@ graph LR
BaseFeeVault -- "getConfig(ConfigType.GAS_PAYING_TOKEN)(address,uint256,uint8)" --> L1Block
SequencerFeeVault -- "getConfig(ConfigType.SEQUENCER_FEE_VAULT_CONFIG)(address,uint256,uint8)" --> L1Block
L1FeeVault -- "getConfig(ConfigType.L1_FEE_VAULT_CONFIG)(address,uint256,uint8)" --> L1Block
OperatorFeeVault -- "getConfig(ConfigType.OPERATOR_FEE_VAULT_CONFIG)(address,uint256,uint8)" --> L1Block
Copy link
Contributor

Choose a reason for hiding this comment

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

i am confused about this integration into std L2 genesis, will need to look at what the implementation does

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
Status: No status
Development

Successfully merging this pull request may close these issues.