Skip to content

Fix input tx reference#789

Open
vfusco wants to merge 3 commits into
next/2.0from
fix/input-tx-reference
Open

Fix input tx reference#789
vfusco wants to merge 3 commits into
next/2.0from
fix/input-tx-reference

Conversation

@vfusco

@vfusco vfusco commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

@vfusco vfusco added this to the 2.0.0 milestone Jul 8, 2026
@vfusco vfusco self-assigned this Jul 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown

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 replaces the previous “transaction reference” concept on inputs with an explicit L1 transaction hash + log index identity, enabling correct handling of multiple InputAdded logs emitted by a single transaction, and adds filtering by transaction hash via JSON-RPC and CLI.

Changes:

  • Model/repository/schema update: Input.TransactionReferenceInput.TransactionHash + Input.LogIndex, with a uniqueness constraint on (application, transaction_hash, log_index).
  • Add new repository + API support to list/filter inputs by transaction_hash (JSON-RPC + CLI).
  • Add integration + unit test coverage for “multiple inputs in the same transaction” and for the new JSON fields.

Reviewed changes

Copilot reviewed 27 out of 28 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/validator/validator_test.go Updates tests to use TransactionHash instead of TransactionReference.
test/integration/testdata/Spambox.sol Adds helper contract source to generate multiple inputs from one tx.
test/integration/testdata/spambox_bytecode.hex Adds precompiled bytecode for Spambox deployment in tests.
test/integration/testdata/spambox_abi.json Adds ABI used to deploy/call Spambox in tests.
test/integration/same_block_inputs_test.go Adds an integration test that reproduces multi-InputAdded-in-one-tx behavior and validates tx-hash filtering.
test/integration/foreclose_replay_test.go Updates replay comparisons to assert TransactionHash + LogIndex.
internal/repository/repotest/input_test_cases.go Adds repo-level test coverage for same-transaction inputs and tx-hash filtering.
internal/repository/repotest/builders.go Updates input builder defaults and adds helpers for TransactionHash and LogIndex.
internal/repository/repository.go Extends InputFilter with TransactionHash; removes GetInputByTxReference; introduces ErrInputLogIdentityConflict.
internal/repository/postgres/schema/migrations/000001_create_initial_schema.up.sql Updates the input table schema to store transaction_hash and log_index and enforce uniqueness.
internal/repository/postgres/input.go Updates queries/scans to include TransactionHash and LogIndex; removes tx-reference lookup method.
internal/repository/postgres/epoch.go Stores TransactionHash + LogIndex; wraps unique-constraint conflicts as ErrInputLogIdentityConflict.
internal/repository/postgres/db/rollupsdb/public/table/input.go Updates generated table columns to match schema (transaction_hash, log_index).
internal/repository/postgres/application.go Updates snapshot query scanning to include TransactionHash and LogIndex.
internal/model/models.go Updates Input struct fields and JSON marshal/unmarshal to include log_index.
internal/model/models_json_test.go Adds roundtrip + validation tests for transaction_hash and log_index JSON handling.
internal/jsonrpc/jsonrpc.go Adds request param parsing and repository filter wiring for transaction_hash.
internal/jsonrpc/jsonrpc-discover.json Updates OpenRPC docs: adds transaction_hash filter and replaces transaction_reference with transaction_hash + log_index.
internal/jsonrpc/jsonrpc_test.go Adds JSON-RPC tests for filtering by transaction_hash and validates response fields.
internal/jsonrpc/api/params.go Adds transaction_hash to ListInputsParams.
internal/evmreader/input.go Populates TransactionHash and LogIndex from L1 logs; escalates log-identity conflicts to CORRUPTED.
internal/evmreader/input_test.go Updates expectations to assert TransactionHash and LogIndex.
internal/evmreader/fixtures_test.go Ensures fixture logs include types.Log.Index so LogIndex can be tested.
internal/evmreader/edge_cases_test.go Adds tests ensuring log index is preserved across same-tx inputs and conflict handling marks app corrupted.
internal/config/config.go Tightens hash parsing to require exactly 32 bytes (avoids silent pad/truncate).
cmd/cartesi-rollups-cli/root/read/service/repository.go Adds transaction-hash filtering to repository-backed CLI read flow.
cmd/cartesi-rollups-cli/root/read/service/jsonrpc.go Validates transaction_hash before forwarding JSON-RPC requests.
cmd/cartesi-rollups-cli/root/read/inputs/inputs.go Adds --transaction-hash flag and wiring to the read inputs CLI command.
Files not reviewed (1)
  • internal/repository/postgres/db/rollupsdb/public/table/input.go: Generated file

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

@renatomaia renatomaia force-pushed the fix/UseGasLimitEstimateByDefault branch 2 times, most recently from 9d32530 to 7d231d0 Compare July 9, 2026 20:10
Base automatically changed from fix/UseGasLimitEstimateByDefault to next/2.0 July 10, 2026 13:55
@vfusco vfusco force-pushed the fix/input-tx-reference branch from d133218 to deb34e0 Compare July 10, 2026 14:04
@github-project-automation github-project-automation Bot moved this from Todo to Waiting Merge in Rollups SDK Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Waiting Merge

Development

Successfully merging this pull request may close these issues.

4 participants