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

chore(sequencer): refactor fees #1811

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

Conversation

Fraser999
Copy link
Contributor

Summary

This reduces a lot of boilerplate around fees.

Background

The boilerplate code is very prone to copy-paste errors. Changing the 14 different (but structurally identical) FeeComponent structs into a single one with a generic arg reduces a lot of the boilerplate code.

This PR replaces #1739 (an initial, more restricted refactor) and #1794 (a PR on top of #1739). It comprises the net changes of these two PRs in the first commit, followed by most of the changes suggested by @eoroshiba's review of #1794 in the second commit.

The third commit is also in response to @eoroshiba's suggestion to remove the fee aliases, and is a single commit in case others prefer that change to be reverted.

Changes

  • In core, replaced fee component structs with a new FeeComponents<T> where T will be some action type.
  • In sequencer, changed the FeeHandler trait fairly radically to support the new form of fees.

Testing

Existing tests are sufficient - there should be no changed functionality to the business logic.

Changelogs

No updates required.

Related Issues

Closes #1715.

@Fraser999 Fraser999 requested review from a team and joroshiba as code owners November 13, 2024 12:28
@github-actions github-actions bot added the sequencer pertaining to the astria-sequencer crate label Nov 13, 2024
Copy link
Contributor

@ethanoroshiba ethanoroshiba left a comment

Choose a reason for hiding this comment

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

A couple nits, but aside from that looks good to me!

crates/astria-sequencer/src/fees/action.rs Outdated Show resolved Hide resolved
crates/astria-sequencer/src/fees/mod.rs Show resolved Hide resolved
crates/astria-sequencer/src/fees/query.rs Outdated Show resolved Hide resolved
crates/astria-sequencer/src/fees/query.rs Show resolved Hide resolved
crates/astria-sequencer/src/fees/storage/values.rs Outdated Show resolved Hide resolved
crates/astria-sequencer/src/fees/storage/values.rs Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sequencer pertaining to the astria-sequencer crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sequencer: make fee change testing easier to debug
2 participants