Skip to content

Use hash to generate state change ID instead of sort order#530

Draft
aditya1702 wants to merge 2 commits intopgx-migrationfrom
fix-statechanges-order
Draft

Use hash to generate state change ID instead of sort order#530
aditya1702 wants to merge 2 commits intopgx-migrationfrom
fix-statechanges-order

Conversation

@aditya1702
Copy link
Contributor

What

[TODO: Short statement about what is changing.]

Why

[TODO: Why this change is being made. Include any context required to understand the why.]

Known limitations

[TODO or N/A]

Issue that this PR addresses

[TODO: Attach the link to the GitHub issue or task. Include the priority of the task here in addition to the link.]

Checklist

PR Structure

  • It is not possible to break this PR down into smaller PRs.
  • This PR does not mix refactoring changes with feature changes.
  • This PR's title starts with name of package that is most changed in the PR, or all if the changes are broad or impact many packages.

Thoroughness

  • This PR adds tests for the new functionality or fixes.
  • All updated queries have been tested (refer to this check if the data set returned by the updated query is expected to be same as the original one).

Release

  • This is not a breaking change.
  • This is ready to be tested in development.
  • The new functionality is gated with a feature flag if this is not ready for production.

Use FNV-64a hash of the sort key to derive a stable, content-based ID
for state changes. This prevents PK collisions when new categories are
added and old ledgers are reprocessed incrementally.

- Rename StateChangeOrder → StateChangeID across all 29 files
- Rename SortKey → HashKey, generateSortKey → generateHashKey
- Compute hash in StateChangeBuilder.Build() via FNV-64a
- Remove sort + positional assignment from indexer.processTransaction
- Update migration to use state_change_id column name
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.

1 participant