Skip to content

fix(rpc): add opt-in NewTransaction receipt log for pre-v2 SDKs - #1809

Closed
danieljrc888 wants to merge 1 commit into
v0.123-devfrom
fix/legacy-receipt-log-compat
Closed

danieljrc888 wants to merge 1 commit into
v0.123-devfrom
fix/legacy-receipt-log-compat

Conversation

@danieljrc888

Copy link
Copy Markdown
Contributor

Problem and outcome

Rally has to keep working when its Studio upgrades to v0.123, with time to migrate. Its clients use genlayer-js 0.20.3 (app) and 0.18.9 (bridge). Disabling fees is not enough for them:

  • Since fix(fees): align Studio with Consensus v0.6 economics #1748 receipts only carry CreatedTransaction.
  • Those SDKs only parse NewTransaction, so they throw Transaction not processed by consensus.
  • Studio did process the transaction, but the caller never gets the txId, and a retry could duplicate it.

This PR adds GENLAYER_STUDIO_LEGACY_NEW_TRANSACTION_RECEIPT_LOG, off by default. When on, consensus transaction receipts also carry NewTransaction(bytes32,address,address) after CreatedTransaction.

Non-goals:

  • This does not disable fees. A pre-v2 SDK also needs gasless mode (the three price vars at 0), since it sends no fees and otherwise reverts with FeesDistributionMissing.
  • This does not set the flag on any environment. That belongs in devexp-argocd-apps, on rally-studio-prd only.

Implementation and validation

The default path is unchanged and keeps the receipt faithful to CreationPhase. NewTransaction is emitted unconditionally when the flag is on, even though the real contract only emits it for the recipient queue head. That is why it is opt-in and temporary: remove the flag once Rally is on SDK v2.

CreatedTransaction stays at log index 0. SEND transactions and reverted envelopes still have no logs. Only jsonrpc serves receipts, so the flag is not passed to consensus-worker.

Unit tests cover the default, the log shape and order, a missing recipient, and SEND.

In-place upgrade from v0.121.25 to rc.10 images on the same database, with fees off and this PR's endpoints.py mounted:

Client Flag Result
genlayer-js 0.20.3, on v0.121.25 before the upgrade n/a 10/10
genlayer-js 0.20.3 on 19/19
genlayer-js 0.18.9 on 15/15
genlayer-js 0.18.9, rc.10 image without this code n/a 8/15, every write fails on the client
genlayer-js v2 (genlayerlabs/genlayer-js#237 build) on deploy, write and read pass

The runs cover reads and state from before the upgrade, writes to existing contracts, create_campaign on an existing factory (child and shard), a nondeterministic web write, and a transaction reaching FINALIZED. New # v0.1.0 and zip deploys still fail with invalid_contract runner malformed, as the v0.2 policy intends.

Not covered: LLM nondeterministic flows (the test stack used a dummy key), a real browser wallet, Rally's own app code, and turning fees back on later against the same database.

Rollback: unset the flag.

User facing release notes

New optional setting GENLAYER_STUDIO_LEGACY_NEW_TRANSACTION_RECEIPT_LOG for operators who need to keep genlayer-js clients older than v2 working during an upgrade. Off by default.

Since #1748 receipts only carry CreatedTransaction. genlayer-js before v2
only parses NewTransaction, so it throws "Transaction not processed by
consensus" for a transaction Studio did process, and the caller never gets
the txId.

GENLAYER_STUDIO_LEGACY_NEW_TRANSACTION_RECEIPT_LOG (default off) adds the
legacy log after CreatedTransaction, so a Studio can be upgraded before its
clients migrate. These SDKs also need gasless mode, since they send no fees.
The default keeps the receipt faithful to CreationPhase.

Validated with an in-place upgrade from v0.121.25 on rc.10 images with fees
off, using genlayer-js 0.20.3 and 0.18.9.
@danieljrc888 danieljrc888 self-assigned this Nov 4, 2026
@coderabbitai

coderabbitai Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 44ed25d5-1d54-4649-b679-2a6570c96933

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-04T21:49:22.231919Z eb8fe3d PR opened
🔒 Security Review ✅ Completed 2026-11-04T21:51:16.058614Z eb8fe3d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

danieljrc888 added a commit that referenced this pull request Nov 10, 2026
…) (#1818)

* fix(rpc): add opt-in NewTransaction receipt log for pre-v2 SDKs

Since #1748 receipts only carry CreatedTransaction. genlayer-js before v2
only parses NewTransaction, so it throws "Transaction not processed by
consensus" for a transaction Studio did process, and the caller never gets
the txId.

GENLAYER_STUDIO_LEGACY_NEW_TRANSACTION_RECEIPT_LOG (default off) adds the
legacy log after CreatedTransaction, so a Studio can be upgraded before its
clients migrate. These SDKs also need gasless mode, since they send no fees.
The default keeps the receipt faithful to CreationPhase.

Validated with an in-place upgrade from v0.121.25 on rc.10 images with fees
off, using genlayer-js 0.20.3 and 0.18.9.

* fix(rpc): run sync RPC handlers and snapshot loads off the event loop

Forward-port the RPC threadpool part of #1766 (2004fc4) to v0.123:
sync JSON-RPC handlers run in the threadpool, async endpoints load
contract snapshots and ConsensusData queries in workers, and worker
notifications are published on the app loop via call_soon_threadsafe.

The validator registry read handlers stay on the loop because they use
the validators manager's shared long-lived session.

* fix(genvm): run v0.2 line selectors no earlier than the studio v0.2 fork

A sim_config.genvm_datetime before 2026-01-01 made the manager drop the
v0.2 line (studio network fork in genvm-chainforks.json, v0.6.0-rc11), so
every run of a pinned contract or a '# v0.2.x' deploy was refused before
start: gen_call errors, and consensus retried until cancel while counting
GenVM failures toward the worker health threshold. Clamp such runs to the
fork activation time.

* fix(genvm): give each executor version its own precompile cache dir

/genvm-cache is a node-wide hostPath shared by every Studio release on the
node, and GenVM keys precompiled modules only by runner hash. v0.121
(v0.2.16) and v0.123 (v0.2.17, v0.3.x) wrote into the same pc/ tree, so
v0.2 calls could load modules built by another executor and time out.

Point each executor's cache_dir at /genvm-cache/<executor-version>/, keep
the precompile marker inside each per-version dir, and leave the legacy
shared pc/ tree untouched for older Studios. Bump the CI precompile cache
key so old-layout caches are not restored.

* fix(migrations): lift inherited statement_timeout for evm envelope and queue order backfills

c1d2e3f4a5b6 sets SET LOCAL statement_timeout = '30s' and env.py runs the
whole chain in one transaction, so e4f6a8c0d2b4 and f5a7c9e1b3d5 inherited
the limit and were cancelled on prod-sized data, rolling back the upgrade.
Reset statement_timeout to 0 at the start of both upgrades; lock_timeout
and the single-transaction behaviour are unchanged.

* fix(rpc): commit sim_fundAccount's tx together with its credit

fund_account committed the PENDING faucet SEND (value_credited=false)
before credit_tx_value_once ran. A consensus worker could claim it in that
gap; execute_transfer's unlocked value_credited read then credited the
recipient a second time once the endpoint committed (balance 2000 for a
1000 fund, seen in the rc11 bundle's integration run). The race predates
the threadpool change, which can widen the window.

Insert with commit=False so the row only becomes visible already
credited. The worker-side guard in execute_transfer is still a plain
read; making it a compare-and-set is left for a follow-up.

* ci(genvm): key the precompile cache on host CPU features

Precompiled GenVM modules carry the CPU features of the host that built
them. The cache key only had OS and arch, so a cache saved on an AVX-512
runner was restored on one without avx512bitalg. GenVM then rejected every
module ("compilation setting has_avx512bitalg is enabled, but not available
on the host"), recompiled in memory on each run, and the first legacy v0.2
schema call hit GENVM_TIMEOUT at 30s (rc11 bundle run 42737821857, suite
52m vs 33m). The arch-only entrypoint marker still said "already
precompiled", so nothing re-precompiled.

Add a hash of the /proc/cpuinfo flags to the key so each runner CPU type
gets its own cache entry.
@danieljrc888

Copy link
Copy Markdown
Contributor Author

Landed in v0.123-dev through the rc.11 bundle #1818 (squash 51e0bf7). This PR's head is contained in the bundle head cc88d76, which passed full E2E. Closing since the squash merge doesn't auto-close feeders.

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