docs: Fix proof query example errors#1504
Conversation
WalkthroughThe recent update introduces enhancements to the blockchain's fraud proof mechanisms. A notable addition is the Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Actionable comments posted: 2
Review Status
Configuration used: CodeRabbit UI
Files selected for processing (1)
- developers/blobstream-proof-queries.md (3 hunks)
Additional Context Used
Additional comments not posted (1)
developers/blobstream-proof-queries.md (1)
1003-1003: Thecopyoperation in thesubmitFraudProoffunction is correctly implemented, but it's important to ensure that the source slice (dataRoot) is not shorter than the destination array (blockDataRoot). This is crucial to avoid runtime panics due to slice bounds out of range.Verification successful
To verify the length of
dataRootbefore the copy operation, we need to examine the code more closely around thecopyoperation for any length checks or assignments ensuringdataRoothas at least 32 bytes. Let's proceed with a new script to gather this information.
The verification process has confirmed that there's no explicit length check or assignment ensuring
dataRoothas at least 32 bytes before the copy operation in the provided context. This aligns with the concern raised in the review comment about the potential risk of runtime panics ifdataRootis shorter than the destination arrayblockDataRoot. Therefore, the review comment is accurate.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify that dataRoot slice has a length of at least 32 bytes before the copy operation. grep -B 5 "copy(blockDataRoot\[:\], dataRoot)" developers/blobstream-proof-queries.md | grep "dataRoot \[\]byte"Length of output: 132
Script:
#!/bin/bash # Look for any length checks or assignments to `dataRoot` ensuring it has at least 32 bytes before the copy operation. grep -B 10 "copy(blockDataRoot\[:\], dataRoot)" developers/blobstream-proof-queries.mdLength of output: 355
|
thank you for fixing this and for the PR @CryptoKass |
| for i, b := range dataRoot[58:] { | ||
| blockDataRoot[i] = b | ||
| } | ||
| copy(blockDataRoot[:], dataRoot) |
There was a problem hiding this comment.
We can use the data root directly without making a copy. For some reason, I thought that the data root would also contain the min-max namespace. Good catch 🙏
* Add missing return statement in toRowProofs function * fix dataRoot slice out of range error * fixes another missing return in toRowProofs
…stream (#1489) * docs: add documentation on how to build rollups on Celestia * docs: remove question * docs: one -> value * docs: explain more the proofs + reformating * docs: set ETA * docs: expand on protobuf deserialisation * docs: expand on protobuf deserialisation * docs: rewrite, reorganise, explain * docs: review feedback * docs: grammar * docs: remove new lines * docs: add links to inclusion proofs * docs: update blobstream contract addresses (#1485) Replaces #1482 * ci: test removing the CNAME file for clean up of previews. (#1493) * docs: update blobstream (#1495) * docs: update bubs-testnet.md with new URIs * docs: add status page and bridge * docs: comment out thirdweb bc chain is different now * docs: update gm portal and contract guides for bubs * docs: add mocha and namespace * docs: add bridging context * [GH Action] Update release tags and commit SHAs for arabica (#1497) * [automated GH action] update latest release tags & commit sha (arabica) * Update .vitepress/constants/arabica_versions.js --------- Co-authored-by: jcstein <jcstein@users.noreply.github.com> Co-authored-by: Josh Stein <46639943+jcstein@users.noreply.github.com> * [GH Action] Update release tags and commit SHAs for mocha (#1498) * [automated GH action] update latest release tags & commit sha (mocha) * Update .vitepress/constants/mocha_versions.js --------- Co-authored-by: jcstein <jcstein@users.noreply.github.com> Co-authored-by: Josh Stein <46639943+jcstein@users.noreply.github.com> * docs: update go constants for arabiac and mocha * docs: update to make install for all types of machines (#1502) * feat: Update node-tutorial.md (#1478) this is live in v0.13.0 i think, cc @vgonkivs for review * feat: split consensus node page (#1472) * docs: split consensus node page * docs: setup to set up * docs: setup to set up 2 * docs: coderabbit reviews * docs: change to everywhere * docs: add backlink --------- Co-authored-by: jcstein <mail@jcstein.dev> * docs: rollup available link Vitalik (#1505) * docs: rollup link Vitalik * docs: changes follow suggestion for example giving comma * docs: Fix proof query example errors (#1504) * Add missing return statement in toRowProofs function * fix dataRoot slice out of range error * fixes another missing return in toRowProofs * docs: fix blobstream proof queries code (#1506) * docs: initial commit, needs revision * docs: remove old light node config * docs: edits and refactor page * docs: minor copy edit * docs: cleanup for new deployment guide * docs: todos for deployment guide * docs: edit intro * docs: step 1-2 * docs: deploy steps and table * docs: remainder of deploy steps draft * docs: change style of quickstart to Quickstart: Deploy an Orbit rollup * docs: add todos * docs: update contract addresses * docs: using light node, namespace, auth token * docs: add link to arb doc * docs: add todo * docs: resolve build errs * docs: add bridging guide * docs: small revisions * docs: copy edits * docs: deploy revision * docs: fix blobstream address * docs: add alchemy rpc section * docs: note about opening ports in docker * docs: bump celestia-node version * docs: edit l1 to l2 * docs: add newer success logs * feat: add full node page to docs for orbit * feat: write out full node page * docs: more info on validatorfn page * docs: update wasm root * docs: update nitro release * docs: use v2.3.1-rc.1 everywhere for nitro * docs: edit out 'click heres' * fix: links * docs: add eth-rpc variable * docs: coderabbit suggestions * docs: clarify wss * docs: swap steps 6 and 7 for deploy doc * docs: edit wss section * docs: add more context for wss * docs: improve md readabliity in table * docs: update deployui url * docs: update ui url * docs: we'll use in next step * docs: updates * docs: add fn * [GH Action] Update release tags and commit SHAs for mainnet (#1507) * [automated GH action] update latest release tags & commit sha (mainnet) * Update .vitepress/constants/mainnet_versions.js --------- Co-authored-by: jcstein <jcstein@users.noreply.github.com> Co-authored-by: Josh Stein <46639943+jcstein@users.noreply.github.com> * docs: update newmetric endpoints Resolves #1501 * docs: update orbit URL * docs: coderabbit suggestions * docs: add op raspberry testnet * [GH Action] Update release tags and commit SHAs for arabica (#1511) * [automated GH action] update latest release tags & commit sha (arabica) * Apply suggestions from code review --------- Co-authored-by: jcstein <jcstein@users.noreply.github.com> Co-authored-by: Josh Stein <46639943+jcstein@users.noreply.github.com> * docs: add sepolia -> mocha (#1512) * fix typo in arabica-devnet page (#1513) * [WIP] docs: add audits for blobstream x (#1491) * docs: add audits for blobstream x * docs: add veridise audit * Update rollup-overview.md (#1516) * feat: restructure developers category (#1515) * feat: drafting buttons * fix: color of btn * feat: add note text optional * feat: rename to build-whatever.md * fix: copy * feat: category shuffle * fix: suggestions from code review * feat: add vistara * Apply suggestions from code review * fix: typo * feat: add alt texts * fix: typo * feat: aria-labels * docs: shuffle intro * feat: add celestia-node.sh script * fix: clarify section vs. tutorial * feat: exit if dir change fails * Update mocha_versions.js (#1529) * Update mocha_versions.js * Update mocha_versions.js * Add Grove archival endpoints to `nodes/mainnet.md` (#1525) * Add Grove to nodes/mainnet.md * Apply suggestions from code review Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update nodes/mainnet.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Store image in src code * Add description of archival nodes * Apply suggestions from code review * Apply suggestions from code review * Update nodes/mainnet.md --------- Co-authored-by: joshcs.eth <46639943+jcstein@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * docs: fix typos (#1526) * fix typo * fix typo * fix typo * fix typo * fix typos * fix typo * fix typo * fix typos * fix typos * fix typos * fix typos * fix typo * fix typo * fix typo Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Apply suggestions from code review --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: joshcs.eth <46639943+jcstein@users.noreply.github.com> * Update mainnet.md (#1527) Add noders endpoints * Update mocha-testnet.md (#1528) * Update mocha-testnet.md Add noders endpoints * Fixed link to endpoint * Apply suggestions from code review --------- Co-authored-by: joshcs.eth <46639943+jcstein@users.noreply.github.com> * fix: veridise path * feat: add to menu * docs: begin lint * docs: remove duplicate headings * docs: clarify duplicate headings * docs: better headings * docs: mention blobstream rollups docs in the blobstream overview --------- Co-authored-by: Josh Stein <46639943+jcstein@users.noreply.github.com> Co-authored-by: Matthew Sevey <mjsevey@gmail.com> Co-authored-by: jcstein <mail@jcstein.dev> Co-authored-by: celestia-bot <136652805+celestia-bot@users.noreply.github.com> Co-authored-by: jcstein <jcstein@users.noreply.github.com> Co-authored-by: Levai Mackenzie Ágbàrà <levaiagbara@gmail.com> Co-authored-by: Guspan Tanadi <36249910+guspan-tanadi@users.noreply.github.com> Co-authored-by: Kassius <34594014+CryptoKass@users.noreply.github.com> Co-authored-by: Ratan Kaliani <ratankaliani@berkeley.edu> Co-authored-by: Callum Waters <cmwaters19@gmail.com> Co-authored-by: Alex Beckett <75361908+alex-beckett@users.noreply.github.com> Co-authored-by: mindstyle85 <55639830+mindstyle85@users.noreply.github.com> Co-authored-by: Daniel Olshansky <olshansky.daniel@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: omahs <73983677+omahs@users.noreply.github.com> Co-authored-by: Alex Moskaleu (SeptimA) <dudava45@gmail.com>


Overview
This PR fixes two errors/typos in the "Proof Queries" example code, making it easier to for readers to follow.
toRowProofsmissing return statement. This code cannot compile.dataRootinsubmitFraudProofalways leading to aslice bounds out of rangeerror.blockRes.Block.DataHash– which is always 32 bytes long, as the dataRoot to the submitFraudProof function. ThesubmitFraudProoffunction then attempts to get slice that is out of boundsfor i, b := range dataRoot[58:].Missing return statement:
The function signature for toRowProofs claims it should return []client.BinaryMerkleProof, but there is no return statement.
DataRoot slice bounds out of range
The example calls submitFraudProof, providing a 32 byte dataHash as the dataRoot, the called function then attempts to create a slice starting at the 58th byte, which is out of bounds.
Checklist
Summary by CodeRabbit
copyoperation for more efficient data handling in fraud proof submissions.rowProofsfrom a function.