Skip to content

Conversation

@rudy-6-4
Copy link
Contributor

@rudy-6-4 rudy-6-4 commented Dec 2, 2025

No description provided.

@cla-bot cla-bot bot added the cla-signed label Dec 2, 2025
@rudy-6-4 rudy-6-4 changed the base branch from main to release/0.10.x December 2, 2025 16:10
@rudy-6-4 rudy-6-4 force-pushed the rudy/fix/copro/merged-tx branch 8 times, most recently from 29b7096 to 668274f Compare December 4, 2025 09:52
@rudy-6-4 rudy-6-4 changed the title Rudy/fix/copro/merged tx fix(coprocessor): useblock hash to identify transaction Dec 4, 2025
@rudy-6-4 rudy-6-4 changed the title fix(coprocessor): useblock hash to identify transaction Rudy/fix/copro/merged tx Dec 4, 2025
@rudy-6-4 rudy-6-4 changed the title Rudy/fix/copro/merged tx fix(coprocessor): useblock hash to identify transaction Dec 4, 2025
@rudy-6-4 rudy-6-4 marked this pull request as ready for review December 4, 2025 10:23
@rudy-6-4 rudy-6-4 requested a review from a team as a code owner December 4, 2025 10:23
@rudy-6-4
Copy link
Contributor Author

rudy-6-4 commented Dec 4, 2025

add a test with duplicate transaction id that forms a transaction cycle without the block hash

@rudy-6-4 rudy-6-4 force-pushed the rudy/fix/copro/merged-tx branch from 668274f to 05ddd0a Compare December 4, 2025 14:10
@rudy-6-4 rudy-6-4 requested a review from Copilot December 4, 2025 14:10
@rudy-6-4 rudy-6-4 changed the title fix(coprocessor): useblock hash to identify transaction fix(coprocessor): use block hash to identify transaction Dec 4, 2025
Copilot finished reviewing on behalf of rudy-6-4 December 4, 2025 14:13
Copy link

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 enhances transaction identification in the coprocessor system by adding block_hash and block_number fields alongside the existing transaction_id. This change enables proper identification of transactions that may be replayed or reorged across different blocks on the blockchain, which is critical for handling blockchain reorganizations correctly.

Key changes:

  • Added block_hash and block_number fields to the AsyncComputation protobuf message
  • Created a new Transaction type combining transaction_id and block_hash for unique identification
  • Updated database schema with new columns and composite indexes
  • Modified all SQL queries to use the composite key (transaction_id, block_hash) for transaction identification

Reviewed changes

Copilot reviewed 25 out of 29 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
coprocessor/proto/coprocessor.proto Added block_hash and block_number fields to AsyncComputation message
coprocessor/fhevm-engine/scheduler/src/dfg/types.rs Introduced Transaction struct and updated DFGTxResult to use it
coprocessor/fhevm-engine/scheduler/src/dfg.rs Updated component node building to use Transaction type
coprocessor/fhevm-engine/scheduler/src/dfg/scheduler.rs Updated scheduler logic to work with Transaction objects
coprocessor/fhevm-engine/tfhe-worker/src/tfhe_worker.rs Modified queries and handlers to include block_hash in all operations
coprocessor/fhevm-engine/tfhe-worker/src/server.rs Updated computation insertion to include block metadata
coprocessor/fhevm-engine/host-listener/src/database/tfhe_event_propagate.rs Added block_hash to database insertion logic
coprocessor/fhevm-engine/host-listener/src/cmd/mod.rs Updated block insertion to include block_hash
coprocessor/fhevm-engine/db-migration/migrations/*.sql Added new database columns and indexes
coprocessor/fhevm-engine/tfhe-worker/src/tests/*.rs Updated all test fixtures to include block_hash and block_number
coprocessor/fhevm-engine/tfhe-worker/benches/*.rs Updated all benchmark fixtures to include block_hash and block_number
coprocessor/fhevm-engine/tfhe-worker/src/bin/cli.rs Updated CLI smoke test to include new fields
coprocessor/fhevm-engine/tfhe-worker/src/utils.rs Updated test utilities to include new fields
coprocessor/fhevm-engine/stress-test-generator/src/utils.rs Updated stress test generator to include block_hash
coprocessor/fhevm-engine/.sqlx/*.json Updated SQL query metadata files
coprocessor/fhevm-engine/Cargo.lock Updated svm-rs and svm-rs-builds dependencies (unrelated change)
Files not reviewed (2)
  • coprocessor/fhevm-engine/.sqlx/query-63f097acd50a5ec09f959668fce297d0c2c1c9851741c2a5bbb3238af2fe5b75.json: Language not supported
  • coprocessor/fhevm-engine/.sqlx/query-b759c3143d1832a0f950a57fd3a795a87b98cd4267f5a858ab4f6320c8200209.json: Language not supported

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

Comment on lines +2147 to 2149
block_hash: block_hash.clone(),
block_number,
is_allowed: true,
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

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

[nitpick] The field order in this AsyncComputation struct initialization is inconsistent with the protobuf definition order. While Rust allows any field order, it's a best practice to match the definition order for maintainability. The correct order should be: inputs, is_allowed, block_hash, block_number. Consider reordering these fields to match the protobuf definition and the pattern used in other files.

Copilot uses AI. Check for mistakes.
fixes a bug where 2 transactions are swapped during a reorg
while keeping the same tx id

the 4 tx (2 are reorged out) are merged and create a cycle
@rudy-6-4 rudy-6-4 force-pushed the rudy/fix/copro/merged-tx branch from 05ddd0a to eb0ca4b Compare December 4, 2025 14:28
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.

2 participants