Skip to content

Conversation

StephenButtolph
Copy link
Contributor

Why this should be merged

Dynamic fees needs to track the capacity and excess usage of the chain for rate limiting and fee pricing.

How this works

Adds GetFeeState and SetFeeState to the state.Chain interface.

How this was tested

  • Added unit tests

@StephenButtolph StephenButtolph mentioned this pull request Jul 30, 2024
1 task
func getFeeState(db database.KeyValueReader) (fee.State, error) {
feeStateBytes, err := db.Get(FeeStateKey)
if err == database.ErrNotFound {
return fee.State{}, nil
Copy link
Contributor

Choose a reason for hiding this comment

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

q: shouldn't the capacity be max here? I believe this case happens only before etna is activated. In such a casa shouldn't capacity be max instead of zero?

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 ACP doesn't specify this... I think that it makes more sense to have it be set to 0 so that the fork activation doesn't have a complexity spike (although I doubt this would really matter).

I'll make a PR to the ACP to clarify this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added this to the spec: avalanche-foundation/ACPs#136. Feel free to comment on that PR if you think it should be a different value.

Copy link
Contributor

@abi87 abi87 left a comment

Choose a reason for hiding this comment

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

I am not sure we init capacity in the right way when Etna is not activated yet.

@StephenButtolph StephenButtolph added this pull request to the merge queue Jul 31, 2024
Merged via the queue into master with commit d2de35d Jul 31, 2024
@StephenButtolph StephenButtolph deleted the track-fee-state branch July 31, 2024 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants