docs(genlayer-js): document where consensus results live on a transaction#445
docs(genlayer-js): document where consensus results live on a transaction#445theboyplunger0x wants to merge 2 commits into
Conversation
✅ Deploy Preview for genlayer-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
📝 WalkthroughWalkthroughThe transaction reference now explains consensus result fields, polling statuses, receipt handling, and timing requirements after deployment. ChangesTransaction consensus documentation
Estimated code review effort: 1 (Trivial) | ~3 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pages/api-references/genlayer-js/transactions.md`:
- Around line 130-136: Update the deploy-then-write guidance in the transaction
documentation to instruct callers to poll for deployment settlement using
waitForTransactionReceipt with FINALIZED (or getTransaction) before invoking the
write method. Remove the fixed-delay recommendation and retain the existing
deploy-then-write context.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: b5d09572-7753-4a0d-bb39-aaaa47a13c30
📒 Files selected for processing (1)
pages/api-references/genlayer-js/transactions.md
| ### Allow a deploy to settle before calling a write method | ||
|
|
||
| Calling a write method immediately after a successful deploy can revert at the | ||
| EVM level against the consensus contract, even when the deploy itself returned a | ||
| unanimous AGREE. The same call to the same contract address succeeds once the | ||
| deploy has settled. If you are scripting deploy-then-write cycles, insert a | ||
| short wait between the two rather than chaining them directly. |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Poll for settlement instead of using a fixed short delay.
A “short wait” is timing-dependent and can make deploy-then-write scripts flaky. Use waitForTransactionReceipt with FINALIZED (or poll getTransaction) before issuing the write, rather than chaining it after an arbitrary delay.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@pages/api-references/genlayer-js/transactions.md` around lines 130 - 136,
Update the deploy-then-write guidance in the transaction documentation to
instruct callers to poll for deployment settlement using
waitForTransactionReceipt with FINALIZED (or getTransaction) before invoking the
write method. Remove the fixed-delay recommendation and retain the existing
deploy-then-write context.
…eneric EVM clients
|
Self-correction before anyone spends time reviewing this. I've hedged two claims that were stated more strongly than my evidence supports:
I also softened the The core of the PR — the field table for where consensus results live on a |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pages/api-references/genlayer-js/transactions.md`:
- Line 140: Update the sentence near “prevents” to hyphenate “25-second” when it
modifies “post-deploy,” using the phrasing “a 25-second post-deploy delay” while
preserving the existing meaning.
- Around line 125-130: Update the “A generic EVM receipt helper will not find
the transaction” note to use conditional wording: generic EVM clients may not
find GenLayer transactions and may return “not found.” Preserve the distinction
that this applies to the EVM client’s getTransactionReceipt, while genlayer-js’s
waitForTransactionReceipt remains the preferred supported helper.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 9503ea35-036f-4b69-bfe9-5087d3dd8aee
📒 Files selected for processing (1)
pages/api-references/genlayer-js/transactions.md
| ### A generic EVM receipt helper will not find the transaction | ||
|
|
||
| `getTransactionReceipt` from a generic EVM client (for example Viem's) returns | ||
| "not found" for GenLayer transactions. Use genlayer-js's `getTransaction`. This | ||
| note is about the EVM client's method, not about genlayer-js's own | ||
| `waitForTransactionReceipt`, which is supported. |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Avoid stating the receipt limitation unconditionally.
The PR objective scopes this behavior to generic EVM clients potentially returning "not found". Change “will not find” and “returns” to “may not find” and “may return”; keep waitForTransactionReceipt as the preferred supported helper.
Proposed wording
-### A generic EVM receipt helper will not find the transaction
+### A generic EVM receipt helper may not find the transaction
...
-returns
+may return📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| ### A generic EVM receipt helper will not find the transaction | |
| `getTransactionReceipt` from a generic EVM client (for example Viem's) returns | |
| "not found" for GenLayer transactions. Use genlayer-js's `getTransaction`. This | |
| note is about the EVM client's method, not about genlayer-js's own | |
| `waitForTransactionReceipt`, which is supported. | |
| ### A generic EVM receipt helper may not find the transaction | |
| `getTransactionReceipt` from a generic EVM client (for example Viem's) may return | |
| "not found" for GenLayer transactions. Use genlayer-js's `getTransaction`. This | |
| note is about the EVM client's method, not about genlayer-js's own | |
| `waitForTransactionReceipt`, which is supported. |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@pages/api-references/genlayer-js/transactions.md` around lines 125 - 130,
Update the “A generic EVM receipt helper will not find the transaction” note to
use conditional wording: generic EVM clients may not find GenLayer transactions
and may return “not found.” Preserve the distinction that this applies to the
EVM client’s getTransactionReceipt, while genlayer-js’s
waitForTransactionReceipt remains the preferred supported helper.
| to the identical address succeeding after a wait. | ||
|
|
||
| Treat it as a flake to retry through rather than something a delay reliably | ||
| prevents: we have also seen this revert occur with a 25 second post-deploy |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Hyphenate “25-second.”
Use “a 25-second post-deploy delay” for correct compound-adjective grammar.
🧰 Tools
🪛 LanguageTool
[grammar] ~140-~140: Use a hyphen to join words.
Context: ...ve also seen this revert occur with a 25 second post-deploy delay. The practical ...
(QB_NEW_EN_HYPHEN)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@pages/api-references/genlayer-js/transactions.md` at line 140, Update the
sentence near “prevents” to hyphenate “25-second” when it modifies
“post-deploy,” using the phrasing “a 25-second post-deploy delay” while
preserving the existing meaning.
Source: Linters/SAST tools
What
Adds a Reading consensus results section to the genlayer-js transaction
reference, documenting where the consensus fields actually live on a returned
transaction, plus four practical notes.
Why
The page currently says
getTransaction"Fetches transaction data includingstatus, execution result, and consensus details" — but does not say where those
consensus details are. Finding them took a debugging session: the votes are
nested under
lastRound(validatorVotes,validatorVotesName,votesCommitted/votesRevealed,validatorResultHash), the verdict isresultName, and the execution outcome istxExecutionResultName.The section also records three behaviours that are easy to get wrong and are not
documented anywhere I could find:
resultNamealone does not mean the run was healthy. A transaction canbe
ACCEPTEDwhile validators split underneath, and it can beACCEPTEDwith every validator agreeing that the contract raised. You need the vote
vector and
txExecutionResultNametogether.statuswith no name in your SDK version (e.g.14) istransient, not an error. Treating it as a failure aborts runs that would
have succeeded on the next poll.
the EVM level against the consensus contract, even when the deploy returned
a unanimous AGREE. The same call to the same address succeeds once the deploy
has settled. Anyone scripting deploy-then-write cycles hits this and it looks
like a contract bug.
Also notes that a generic EVM
getTransactionReceiptreturns "not found" forGenLayer transactions, since that is a natural thing to reach for.
How this was found
While building and measuring Intelligent Contracts on the bradbury testnet. The
deploy-then-write revert was observed at ~2.2s after a
{AGREE: 5}deploy, andthe identical call to the identical contract address succeeded after a wait.
Happy to adjust wording, placement, or trim anything that duplicates docs I did
not find.
Summary by CodeRabbit
getTransaction, including validator vote details and execution outcomes.