-
Notifications
You must be signed in to change notification settings - Fork 251
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
Acp 176 config #1462
base: acp-176
Are you sure you want to change the base?
Acp 176 config #1462
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,24 +18,24 @@ | |
) | ||
|
||
type Config struct { | ||
MinGasPrice gas.Price // M | ||
MinTargetPerSecond uint64 // P | ||
MinGasPrice gas.Price // M | ||
TargetToMax uint64 // multiplier to convert from target per second to max per second | ||
TimeToFillCapacity uint64 // in seconds | ||
TargetToPriceUpdateConversion uint64 | ||
} | ||
|
||
const ( | ||
MinTargetPerSecond = 1_000_000 // P | ||
MaxTargetExcessDiff = 1 << 15 // Q | ||
TargetConversion = MaxTargetChangeRate * MaxTargetExcessDiff // D | ||
MaxTargetExcessDiff = 2 ^ 15 // Q | ||
|
||
TimeToFillCapacity = 10 // in seconds | ||
TargetToMax = 2 // multiplier to convert from target per second to max per second | ||
TargetToPriceUpdateConversion = 87 // 87s ~= 60s * ln(2) which makes the price double at most every ~60 seconds | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if the calculation here made by using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know Stephen thought about it, but the more intuitive parameter is this ratio between There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Relating to my comment above, this equation (as a function of this ratio and |
||
MaxTargetChangeRate = 1024 // Controls the rate that the target can change per block. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is something we cannot parameterize because EVM also imposes the same limit. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is something we can parameterize There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. isn't this the same value for https://github.com/ava-labs/subnet-evm/blob/master/params/protocol_params.go#L36? |
||
MaxTargetChangeRate = 1024 // Controls the rate that the target can change per block. | ||
|
||
TargetToMaxCapacity = TargetToMax * TimeToFillCapacity | ||
Check failure on line 34 in plugin/evm/upgrade/acp176/acp176.go
|
||
MinMaxPerSecond = MinTargetPerSecond * TargetToMax | ||
Check failure on line 35 in plugin/evm/upgrade/acp176/acp176.go
|
||
MinMaxCapacity = MinMaxPerSecond * TimeToFillCapacity | ||
Check failure on line 36 in plugin/evm/upgrade/acp176/acp176.go
|
||
|
||
maxTargetExcess = 1_024_950_627 // TargetConversion * ln(MaxUint64 / MinTargetPerSecond) + 1 | ||
// maxTargetExcess = 1_024_950_627 // TargetConversion * ln(MaxUint64 / MinTargetPerSecond) + 1 | ||
) | ||
|
||
// State represents the current state of the gas pricing and constraints. | ||
|
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.
Does
2
here control doubling the price? I.e does 3 here means triple it?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.
This is the ratio between
R
andT
, in variables from the ACP. In other words, we add twice as much gas to the bucket as is our target. This also defines our "sustained maximum capacity", so that with sustained2 * T
sized blocks, we increasex
byT * dt
every block, so the fee will double every 60s. You can think of this as our excess gas over target. So I think that if you change this ratio to something else (say 3), then we get sustained higher excess (like2 * T * dt
), so then this change will actually half the time to double. However, It's important to note that this is because this the time for the fee to double is linear in this "sustained excess gas", not the "sustained gas".