-
Notifications
You must be signed in to change notification settings - Fork 83
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
base: main
Are you sure you want to change the base?
isthmus: operator fee #382
Conversation
There was a problem hiding this 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
.
calculation: the `ConfigurableFee`, which is parameterized by two scalars: the `configurableFeeScalar` | ||
and the `configurableFeeConstant`. |
There was a problem hiding this comment.
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)BaseFeeScalar
s 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`. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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` |
There was a problem hiding this comment.
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
`configurableFee = gas_used * configurableFeeScalar + configurableFeeConstant` | |
`configurableFee = (gas_used * configurableFeeScalar + configurableFeeConstant) / 1e6` |
to allow for a decimal precision of 6.
There was a problem hiding this comment.
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.
| configurableFeeScalar | uint64 | 180-187 | | | ||
| configurableFeeConstant | uint64 | 188-195 | | |
There was a problem hiding this comment.
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)baseFeeScalar
s also worked with 32 bits (and also a decimal scaling factor, see other comment).
There was a problem hiding this comment.
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.
```function | ||
function getOperatorFee(uint256 gasUsed)(uint256) | ||
``` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will also need an isHolocene
bool as well as branching logic in the fee estimation functions
- [System config contents (version 0)](#system-config-contents-version-0) | ||
- [Scalars](#scalars) | ||
- [Holocene `scalar`, `overhead` (`uint256,uint256`) change](#holocene-scalar-overhead-uint256uint256-change) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will also want to include the specific ABI changes to the SystemConfig
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work.
- `0`: scalar-version byte | ||
- `[1, 32)`: depending scalar-version: | ||
- Scalar-version `2`: | ||
- `[1, 8)`: padding, must be zero. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this should be padded to the start of the operatorFeeScalar
.
i.e.
- `[1, 8)`: padding, must be zero. | |
- `[1, 12)`: padding, must be zero. |
|
||
##### `setIsthmus` | ||
|
||
This function is meant to be called once on the activation block of the isthmus network upgrade. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on second thought maybe this isn't necessary -- if we read the scalars from the l1block before isthmus is set, we'll just read from uninitialized storage, which defaults to 0. So the derived operator fee will just be 0.
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.