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

Fork manager handlers precedence #1878

Merged
merged 3 commits into from
Oct 12, 2023

Conversation

igorcrevar
Copy link
Contributor

Description

There was a problem with the way the fork manager stores handlers when multiple forks start on the same block.
We should maintain the precedence of handlers, and their precedence is determined by the order of their registration.

For example:

forkManager.RegisterHandler(ForkA, HandlerA, func() string { return "A" })
forkManager.RegisterHandler(ForkB, HandlerA, func() string { return "B" })
forkManager.RegisterHandler(ForkC, HandlerA, func() string { return "C" })

If all of these forks (ForkA, ForkB, ForkC) start on the same block and all of them are activated, the GetHandler function should return the last one that was registered. If the last one is not activated or is deactivated, then the second one should be returned.

Changes include

  • Bugfix (non-breaking change that solves an issue)
  • Hotfix (change that solves an urgent issue, and requires immediate attention)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (change that is not backwards-compatible and/or changes current functionality)

Checklist

  • I have assigned this PR to myself
  • I have added at least 1 reviewer
  • I have added the relevant labels
  • I have updated the official documentation
  • I have added sufficient documentation in code

Testing

  • I have tested this code with the official test suite
  • I have tested this code manually

@igorcrevar igorcrevar added the bug fix Functionality that fixes a bug label Sep 6, 2023
@igorcrevar igorcrevar requested a review from a team September 6, 2023 09:28
@igorcrevar igorcrevar self-assigned this Sep 6, 2023
@igorcrevar igorcrevar force-pushed the feature/forkmanager_handler_precedence branch from f17d2ba to d5d42d4 Compare September 6, 2023 09:39
@igorcrevar igorcrevar marked this pull request as ready for review September 6, 2023 21:03
@igorcrevar igorcrevar force-pushed the feature/forkmanager_handler_precedence branch from d5d42d4 to 7eccbdc Compare September 29, 2023 11:13
@igorcrevar igorcrevar force-pushed the feature/forkmanager_handler_precedence branch 2 times, most recently from 6568420 to f66265a Compare October 12, 2023 10:34
@igorcrevar igorcrevar force-pushed the feature/forkmanager_handler_precedence branch from f66265a to 72a803a Compare October 12, 2023 10:44
@igorcrevar igorcrevar merged commit 03b3389 into develop Oct 12, 2023
9 checks passed
@igorcrevar igorcrevar deleted the feature/forkmanager_handler_precedence branch October 12, 2023 14:25
@github-actions github-actions bot locked and limited conversation to collaborators Oct 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug fix Functionality that fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants