Repository navigation
fix(rpc): add opt-in NewTransaction receipt log for pre-v2 SDKs - #1809
danieljrc888 wants to merge 1 commit into
Conversation
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.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…) (#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.
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:
CreatedTransaction.NewTransaction, so they throwTransaction not processed by consensus.This PR adds
GENLAYER_STUDIO_LEGACY_NEW_TRANSACTION_RECEIPT_LOG, off by default. When on, consensus transaction receipts also carryNewTransaction(bytes32,address,address)afterCreatedTransaction.Non-goals:
FeesDistributionMissing.devexp-argocd-apps, onrally-studio-prdonly.Implementation and validation
The default path is unchanged and keeps the receipt faithful to
CreationPhase.NewTransactionis 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.CreatedTransactionstays at log index 0.SENDtransactions and reverted envelopes still have no logs. Onlyjsonrpcserves receipts, so the flag is not passed toconsensus-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.pymounted:The runs cover reads and state from before the upgrade, writes to existing contracts,
create_campaignon an existing factory (child and shard), a nondeterministic web write, and a transaction reaching FINALIZED. New# v0.1.0and zip deploys still fail withinvalid_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_LOGfor operators who need to keep genlayer-js clients older than v2 working during an upgrade. Off by default.