Skip to content

Conversation

@ARR4N
Copy link
Collaborator

@ARR4N ARR4N commented Dec 8, 2024

Why this should be merged

There are 3 places at which we perform the same, sensitive logic to access registered payloads and as we modify more types this is likely to expand. (e.g. types.Header).

How this works

Introduces pseudo.Accessor to abstract the reusable code.

How this was tested

Existing unit tests. Note that the types.StateAccount tests needed a minor refactor to provide the assertions with access to the ExtraPayloads[T] without introducing generic types anywhere.

@ARR4N ARR4N marked this pull request as ready for review December 8, 2024 16:14
@ARR4N ARR4N requested review from a team, ceyonur, darioush and michaelkaplan13 and removed request for a team December 8, 2024 17:09
ARR4N added a commit that referenced this pull request Dec 9, 2024
## Why this should be merged

Consolidates duplicated logic. Similar rationale to #84.

## How this works

New `register.AtMostOnce[T]` type is responsible for limiting calls to
`Register()`.

## How this was tested

Existing unit tests of `params`. Note that the equivalent functionality
in `types` wasn't tested but now is.
@ARR4N ARR4N enabled auto-merge (squash) December 9, 2024 18:25
@ARR4N ARR4N disabled auto-merge December 9, 2024 18:25
@ARR4N ARR4N changed the title refactor: consolidate params and types payload access refactor!: consolidate params and types payload access Dec 9, 2024
@ARR4N ARR4N enabled auto-merge (squash) December 9, 2024 18:26
@ARR4N ARR4N merged commit 380aa31 into main Dec 9, 2024
3 checks passed
@ARR4N ARR4N deleted the arr4n/consolidate-pseudo-type-access branch December 9, 2024 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants