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 address base prefix checks #2015

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

Conversation

ethanoroshiba
Copy link
Contributor

@ethanoroshiba ethanoroshiba commented Mar 6, 2025

Summary

Pulls address base prefix checks for each action into a separate trait.

Background

It's easy to miss checks which we should be performing when writing a new action's check_and_execute trait method. This change pulls the address base prefix checks for each action into a separate trait so that they can be automatically performed for every action upon execution as well as tested in a more streamlined way.

Changes

  • Removed base prefix checks and tests from action ActionHandler impls.
  • Added new module address_check to address, with traits Addresses and AddressCheck: Addresses. Added impls of these for all existing actions.
  • Added call to AddressCheck::check_addresses() in action_handler::transaction::check_execute_and_pay_fees().

Testing

  • Added unit tests for the base prefix checks for all actions which contain addresses
  • Added app unit test to ensure that check_addresses() is called under execute_transaction().

Changelogs

No updates required.

Related Issues

closes #2014

Verified

This commit was signed with the committer’s verified signature.
ethanoroshiba Ethan Oroshiba
@ethanoroshiba ethanoroshiba added sequencer pertaining to the astria-sequencer crate refactor code refactoring or maintainence code-quality labels Mar 6, 2025

Verified

This commit was signed with the committer’s verified signature.
ethanoroshiba Ethan Oroshiba

Verified

This commit was signed with the committer’s verified signature.
ethanoroshiba Ethan Oroshiba
@ethanoroshiba ethanoroshiba marked this pull request as ready for review March 17, 2025 19:28
Copy link
Collaborator

@noot noot left a comment

Choose a reason for hiding this comment

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

looks good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code-quality refactor code refactoring or maintainence sequencer pertaining to the astria-sequencer crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

abstract action base prefix checks
2 participants