Skip to content

fix: set Transaction.to to zero address for contract-creation txs - #244

Closed
rickstaa wants to merge 1 commit into
mainfrom
fix/transaction-to-contract-creation
Closed

fix: set Transaction.to to zero address for contract-creation txs#244
rickstaa wants to merge 1 commit into
mainfrom
fix/transaction-to-contract-creation

Conversation

@rickstaa

@rickstaa rickstaa commented Jul 19, 2026

Copy link
Copy Markdown
Member

Problem

The subgraph halts on any contract-creation transaction that emits a protocol event. On 2026-07-18 this froze Arbitrum One at block 485100964; all 9 indexers report health: failed with missing value for non-nullable field 'to'. See #243.

Root cause

createOrLoadTransactionFromEvent (utils/helpers.ts) skips tx.to when event.transaction.to is null, but Transaction.to is String! (non-nullable). Contract-creation txs have a null to, so graph-node aborts deterministically.

Fix

Default tx.to to the zero address (EMPTY_ADDRESS) when the tx has no recipient. Keeps the schema non-nullable — no downstream/type changes.

Testing

yarn codegen and yarn build pass.

Deployment

Redeploy and graft from block 485100964 (last good block) so indexers resume instead of full-resyncing. Republish so subgraph FE63… points at the fixed deployment.

Fixes #243

🤖 Generated with Claude Code
https://claude.ai/code/session_01JoKwkmU3jMU6DMGoTcCKRe

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of contract-creation transactions by assigning a default empty address when no recipient address is available.

Contract-creation transactions have no `to` address, so
`event.transaction.to` is null. createOrLoadTransactionFromEvent only
set `tx.to` when non-null, but `Transaction.to` is non-nullable in the
schema. graph-node then aborts with "missing value for non-nullable
field `to`", halting all indexers at the offending block.

This first triggered at block 485100965 (tx 0x1eb52cd3…), a batch
claim-and-restake executed from a contract constructor, freezing the
Arbitrum One subgraph ~32h behind chain head.

Default `tx.to` to the zero address when the tx has no recipient.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JoKwkmU3jMU6DMGoTcCKRe
@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 36f5fe04-cec0-448a-af3e-a0d37894e578

📥 Commits

Reviewing files that changed from the base of the PR and between 2eac27f and c5ddb1d.

📒 Files selected for processing (1)
  • utils/helpers.ts

📝 Walkthrough

Walkthrough

The transaction loading helper now defaults Transaction.to to EMPTY_ADDRESS for contract-creation transactions where the event transaction has no recipient.

Changes

Transaction recipient handling

Layer / File(s) Summary
Default missing transaction recipients
utils/helpers.ts
createOrLoadTransactionFromEvent assigns EMPTY_ADDRESS.toHex() when event.transaction.to is absent and preserves the existing recipient mapping otherwise.

Estimated code review effort: 1 (Trivial) | ~2 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main code change: defaulting Transaction.to to the zero address for contract-creation transactions.
Description check ✅ Passed The description includes the problem, root cause, fix, testing, deployment context, and links the issue being fixed.
Linked Issues check ✅ Passed The change satisfies #243 by preventing null Transaction.to values with an EMPTY_ADDRESS fallback for contract-creation txs.
Out of Scope Changes check ✅ Passed The summary shows a focused helper change with no unrelated code modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/transaction-to-contract-creation

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

🚀 Subgraph Studio preview deployed

Item Details
Version label pr-244-c7f08f9-29698352733
Query endpoint https://api.studio.thegraph.com/query/31909/livepeer-ci/pr-244-c7f08f9-29698352733
curl -H 'Content-Type: application/json' \
  -d '{"query":"{ protocol(id: \"0\") { inflation } }"}' \
  https://api.studio.thegraph.com/query/31909/livepeer-ci/pr-244-c7f08f9-29698352733

@rickstaa

Copy link
Copy Markdown
Member Author

Closed in favor of #245

@rickstaa rickstaa closed this Jul 20, 2026
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.

Indexing halts on contract-creation transactions that emit protocol events

1 participant