Skip to content

Conversation

@jribbink
Copy link
Contributor

@jribbink jribbink commented Nov 8, 2025

Closes #903

Description

Fixes inaccuracies in the scheduled/system tx result indexing.


For contributor use:

  • Targeted PR against master branch
  • Linked to GitHub issue with discussion and accepted design OR link to spec that describes this work
  • Code follows the standards mentioned here
  • Updated relevant documentation
  • Re-reviewed Files changed in the GitHub PR explorer
  • Added appropriate labels

@jribbink jribbink force-pushed the jribbink/fix-system-txns branch from da93d56 to 1b8ed8e Compare November 10, 2025 20:57
@jribbink jribbink changed the title Jribbink/fix system txns Fix system transaction result indexing & event indexes Nov 10, 2025
@jribbink jribbink changed the title Fix system transaction result indexing & event indexes Fix system transaction result indexing & event block/transaction indices Nov 10, 2025
@jribbink jribbink marked this pull request as ready for review November 10, 2025 23:18
@jribbink jribbink added the Improvement Technical work without new features, refactoring, improving tests label Nov 10, 2025
@chasefleming chasefleming requested a review from Copilot November 10, 2025 23:28
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes inaccuracies in system transaction result indexing by introducing composite keys (blockID + txID) for storage and retrieval. This resolves issues where system transactions with duplicate IDs across blocks would overwrite each other's results. Additionally, the PR corrects event block/transaction indices to ensure each system transaction receives a unique sequential index.

Key changes:

  • System transaction results now stored with composite keys (blockID, txID) instead of txID alone
  • System transaction indices are now computed sequentially after user transactions
  • Refactored CommitBlock to separate system transactions from regular transactions in storage

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
storage/store.go Added SystemTransactionResultByID method and composite key generation; refactored CommitBlock signature to accept separate system transaction parameters
storage/mocks/store.go Updated mock methods to match new CommitBlock and SystemTransactionResultByID signatures
storage/memstore/memstore.go Added in-memory storage for system transaction results with composite keys; updated CommitBlock implementation
storage/checkpoint/checkpoint.go Updated CommitBlock call with additional nil parameters for system transactions
emulator/system_transaction_test.go Added comprehensive tests verifying system transaction events and unique transaction indices
emulator/blockchain.go Refactored system transaction execution to assign correct sequential indices; updated result retrieval to use composite keys

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI commented Nov 10, 2025

@jribbink I've opened a new pull request, #911, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 2 commits November 10, 2025 15:44
#911)

* Initial plan

* Improve comment clarity for system chunk transaction index calculation

Co-authored-by: jribbink <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: jribbink <[email protected]>
@jribbink jribbink merged commit ada7311 into master Nov 11, 2025
3 checks passed
@jribbink jribbink deleted the jribbink/fix-system-txns branch November 11, 2025 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Improvement Technical work without new features, refactoring, improving tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GetSystemTransaction(Result)AtBlockHeight differences in 1.11.0

3 participants