Skip to content

docs(genlayer-js): document where consensus results live on a transaction#445

Open
theboyplunger0x wants to merge 2 commits into
genlayerlabs:mainfrom
theboyplunger0x:docs/consensus-result-fields
Open

docs(genlayer-js): document where consensus results live on a transaction#445
theboyplunger0x wants to merge 2 commits into
genlayerlabs:mainfrom
theboyplunger0x:docs/consensus-result-fields

Conversation

@theboyplunger0x

@theboyplunger0x theboyplunger0x commented Jul 20, 2026

Copy link
Copy Markdown

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 including
status, 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 is
resultName, and the execution outcome is txExecutionResultName.

The section also records three behaviours that are easy to get wrong and are not
documented anywhere I could find:

  1. resultName alone does not mean the run was healthy. A transaction can
    be ACCEPTED while validators split underneath, and it can be ACCEPTED
    with every validator agreeing that the contract raised. You need the vote
    vector and txExecutionResultName together.
  2. A numeric status with no name in your SDK version (e.g. 14) is
    transient, not an error.
    Treating it as a failure aborts runs that would
    have succeeded on the next poll.
  3. A write method called immediately after a successful deploy can revert at
    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 getTransactionReceipt returns "not found" for
GenLayer 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, and
the 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

  • Documentation
    • Added a new section on interpreting consensus results returned by getTransaction, including validator vote details and execution outcomes.
    • Clarified transaction polling states, distinguishing in-progress vs decided outcomes and noting transient numeric status values.
    • Documented which nested fields to inspect and how to decode the deployed contract address.
    • Added warnings that generic EVM receipt helpers may not work for GenLayer transactions and that post-deploy writes may temporarily fail even after successful consensus.

@netlify

netlify Bot commented Jul 20, 2026

Copy link
Copy Markdown

Deploy Preview for genlayer-docs ready!

Name Link
🔨 Latest commit b9079f1
🔍 Latest deploy log https://app.netlify.com/projects/genlayer-docs/deploys/6a5ea9301dc78a0008eec267
😎 Deploy Preview https://deploy-preview-445--genlayer-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The transaction reference now explains consensus result fields, polling statuses, receipt handling, and timing requirements after deployment.

Changes

Transaction consensus documentation

Layer / File(s) Summary
Consensus result guidance
pages/api-references/genlayer-js/transactions.md
Adds guidance for interpreting getTransaction consensus fields, distinguishing in-flight and decided statuses, handling unknown numeric statuses, avoiding generic EVM receipts, and waiting after deployment before writes.

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

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is conventional, concise, and accurately summarizes the documentation change about where consensus results are stored on transactions.
Description check ✅ Passed The description is detailed and covers what changed, why, and how it was discovered, matching the template's intent well enough.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 5c1c29d and b146808.

📒 Files selected for processing (1)
  • pages/api-references/genlayer-js/transactions.md

Comment on lines +130 to +136
### 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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 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.

@theboyplunger0x

Copy link
Copy Markdown
Author

Self-correction before anyone spends time reviewing this.

I've hedged two claims that were stated more strongly than my evidence supports:

  1. The deploy-then-write revert. I originally wrote that the call "succeeds
    once the deploy has settled", implying a wait is a fix. Checking my own logs,
    I found reverts that still occurred with a 25 second post-deploy delay. So the
    section now describes it as a flake to retry through, and keeps only the part
    I can stand behind: a revert there may have nothing to do with your contract
    logic, so it isn't the first place to look.

  2. The receipt helper note. I'd phrased it in a way that could read as "don't
    use waitForTransactionReceipt". That's wrong — genlayer-js has a supported
    one. The note is specifically about reaching for a generic EVM client's
    getTransactionReceipt, and now says so.

I also softened the status: 14 line to "has been observed as" rather than
asserting it as a protocol definition, since my evidence is observational.

The core of the PR — the field table for where consensus results live on a
returned transaction — is unchanged and is the part I'm most confident about:
it matches what genlayer-js actually decodes.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between b146808 and b9079f1.

📒 Files selected for processing (1)
  • pages/api-references/genlayer-js/transactions.md

Comment on lines +125 to +130
### 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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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.

Suggested change
### 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 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

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