Skip to content

Conversation

@StephenButtolph
Copy link
Contributor

Why this should be merged

  1. This improves the current performance of the P-chain because time changes are only applied once.
  2. This improves the performance of the suggested change to the P-chain because it only applies decision transactions to one state diff.

How this works

Moves state application from verification to accept.

How this was tested

  • CI

@StephenButtolph StephenButtolph added cleanup Code quality improvement Durango durango fork labels Dec 12, 2023
@StephenButtolph StephenButtolph added this to the v1.10.18 milestone Dec 12, 2023
@StephenButtolph StephenButtolph self-assigned this Dec 12, 2023
return fmt.Errorf("%w %s", errMissingBlockState, parentID)
}
if parentState.onDecisionState != nil {
if err := parentState.onDecisionState.Apply(a.state); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

To confirm, just calling the onAcceptState doesn't commit all diffs under it (for example the wrapped decision state)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's correct

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could apply the onAcceptState to onDecisionState and then apply onDecisionState to a.state if you felt that was cleaner... But this is the (slightly) more efficient way to do the same thing.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think what we have here is fine. Makes sense (should be the same thing).

@dhrubabasu dhrubabasu merged commit c8f2939 into decision-txs-proposal-blocks-alt Dec 12, 2023
@dhrubabasu dhrubabasu deleted the decision-txs-proposal-blocks-alt-alt branch December 12, 2023 09:57
tedim52 pushed a commit to tedim52/avalanchego that referenced this pull request Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup Code quality improvement Durango durango fork

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants