Skip to content

Conversation

@randy-cro
Copy link

@randy-cro randy-cro commented Nov 6, 2025

Description

This PR fixes inconsistencies in the staking cache (originally implemented in PR #1725) across different nodes.
Previously, simulation or optimistic execution contexts did not properly handle discarded changes, which could lead to duplicate or incorrect cache data, eventually causing apphash mismatches and halting the chain.

The primary change refactors the cache to use an in-memory KV store.
With this approach, when a context is discarded, the cache is automatically rolled back, just like any other store in the system.

This ensures that cache state remains consistent with the underlying store, even during simulations or optimistic execution scenarios.


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • run make lint and make test
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@randy-cro randy-cro changed the title Fix/staking optimization fix:staking endblocker optimization Nov 6, 2025
@randy-cro randy-cro changed the title fix:staking endblocker optimization fix: staking endblocker optimization Nov 6, 2025
@randy-cro randy-cro changed the title fix: staking endblocker optimization fix: staking cache to in-memory KV store Nov 6, 2025
@randy-cro randy-cro force-pushed the fix/staking-optimization branch from 69b8ae9 to 88156ba Compare November 6, 2025 08:46
@github-actions github-actions bot removed the C:Store label Nov 10, 2025
@randy-cro
Copy link
Author

Member

image image

@songgaoye it is here, did u miss it?

@randy-cro randy-cro force-pushed the fix/staking-optimization branch 3 times, most recently from b2f35a8 to 54ee8f5 Compare November 11, 2025 11:31
@randy-cro randy-cro force-pushed the fix/staking-optimization branch from 54ee8f5 to 298069d Compare November 11, 2025 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants