Skip to content

docs: fix factual errors, broken examples, and migrate to Hardhat 3#27

Open
alexander-sei wants to merge 1 commit into
mainfrom
docs/ai-review-fixes
Open

docs: fix factual errors, broken examples, and migrate to Hardhat 3#27
alexander-sei wants to merge 1 commit into
mainfrom
docs/ai-review-fixes

Conversation

@alexander-sei

Copy link
Copy Markdown
Collaborator

Summary

Full-documentation review (45 files) with every finding verified against the sei-chain source or upstream tool docs before fixing. Originated from the automated AI docs review; all fixes were then re-validated against the MDX source and sei-protocol/sei-chain.

Funds-affecting example bugs (verified in sei-chain)

  • Staking precompile: undelegate/redelegate examples used parseEther (18 dec) but amounts are 6-decimal usei — args go raw into sdk.NewCoin(baseDenom) (staking.go). Copying the old example would request undelegation of 5 trillion SEI.
  • Bank precompile: sendNative example used 6 decimals but msg.value is wei (HandlePaymentUseiWei); send() example now reflects its pointer-contract-only restriction (bank.go:150).
  • Distribution: example called nonexistent withdrawDelegatorReward(account, validator); ABI only has withdrawDelegationRewards(validator) (abi.json).

P256 precompile

  • Malleability constant was a truncated 128-bit value (rejected virtually all valid signatures) — replaced with the real P-256 half curve order.
  • All Solidity examples switched to low-level staticcall: per RIP-7212 the precompile returns empty data on invalid signatures, which makes high-level returns (bytes memory) interface calls revert instead of returning false. JS helper updated to ethers v6 with the matching failure handling.

Contradictions resolved

  • SIP-03 FAQ said "expected end of March 2026" (already past) — aligned on June 15, 2026 per the exchange-migration page.
  • Twin Turbo page claimed two-block (~800ms) deterministic finality — now states instant finality at block commit (~400ms), consistent with all EVM pages.
  • Gas fee formula (Gas Price × Gas Used + refund caveat), node min-gas-price guidance (0.01usei), Ledger guidance moved off the deprecated Cosmos-app flow.
  • addr associate examples now pass the full EIP-191 prefixed message including length — recovery hashes the raw message string (addr.go:196), so the old prefix-without-length never recovered the right key.

Hardhat 3 everywhere

  • deploy-verify, migrate-from-solana, migrate-from-other-evms, and the addr/bank/cosmwasm/staking precompile pages converted to defineConfig + configVariable + encrypted keystore + network.getOrCreate() (matching evm-hardhat.mdx).
  • layerzero.mdx intentionally stays on LayerZero's HH2-based create-lz-oapp toolkit.

Broken commands, links, and runtime errors

  • hardhat verify invocation corrected per HH version, invalid @web3auth/modal/react install, corrupted Graph subgraph ID, statesync rm -rf data/\* no-op glob, sei-chain/sei-mainnet-1 placeholder chain IDs → pacific-1/atlantic-2, tab-indented YAML (unparseable), dead RPC link to /, jq .SyncInfo.sync_info, destructive command mislabeled as "compact", fabricated sei_getStorageStats section removed (zero hits across the sei-protocol org).
  • wagmi setState-in-render loop, governance demo wrong import + ethers-v5 bigint math, Pyth ABI/contract selector mismatch, Pimlico undefined dotenv, USDC explorer URL, ledger getAddresses return type, undefined client in association examples, Thirdweb view-call-as-transaction, API3 100x decimals error and non-compiling snippet.

Note for after merge

llms.txt / llms-full.txt are generated from the live site, so regenerate them in a follow-up commit once this deploys (node scripts/generate-llms.mjs).

🤖 Generated with Claude Code

Full-docs review with every finding verified against the sei-chain source
or upstream tool docs before fixing:

- Funds-affecting example bugs: staking undelegate/redelegate amounts are
  6-decimal usei (verified in staking.go), bank sendNative takes wei
  (verified via HandlePaymentUseiWei), distribution uses
  withdrawDelegationRewards per abi.json
- P256: correct half-curve-order malleability constant; switch all
  examples to low-level staticcall since the precompile returns empty
  data on invalid signatures per RIP-7212, which reverts high-level calls
- addr: associate examples now pass the full EIP-191 prefixed message
  (recovery hashes the raw message string, verified in addr.go)
- Contradiction fixes: SIP-03 date (June 15, 2026), instant finality on
  Twin Turbo page, gas fee formula, node min-gas-price guidance, Ledger
  app guidance aligned with the EVM signing path
- Hardhat 3 everywhere: deploy-verify, migrate-from-solana,
  migrate-from-other-evms, and precompile pages now use defineConfig,
  configVariable, encrypted keystore, and network.getOrCreate()
  (layerzero.mdx intentionally stays on LayerZero's HH2-based toolkit)
- Broken commands/links: hardhat verify invocation per HH version, web3auth
  install, The Graph subgraph ID, statesync glob, validator chain IDs,
  tab-indented YAML, dead RPC link, jq field names, destructive
  "compact" command relabeled, fabricated sei_getStorageStats removed
- Runtime errors in examples: wagmi setState-in-render, governance demo
  imports and bigint math, Pyth ABI signature, Pimlico dotenv, USDC
  explorer URL, ledger getAddresses return type, undefined client in
  association examples

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@cursor

cursor Bot commented Jun 11, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Changes are limited to documentation MDX; no runtime or contract code ships, though the corrected snippets address previously copy-pasteable staking/bank/precompile mistakes.

Overview
This PR is a broad documentation accuracy pass (~45 MDX files): broken copy-paste examples, outdated tooling, and contradictory guidance are corrected rather than new product behavior being introduced.

High-impact example fixes include precompile snippets that could mis-handle funds or calls: staking undelegate amounts use 6-decimal usei instead of parseEther; bank sendNative uses wei/msg.value and send() is documented as pointer-contract-only; distribution examples call withdrawDelegationRewards(validator); address associate uses the full EIP-191 prefixed message with length; P256 verification moves to staticcall with empty return treated as failure and fixes the malleability half-order constant.

Hardhat 3 is reflected across deploy/migrate/precompile guides (defineConfig, configVariable, encrypted keystore, network.getOrCreate(), Ignition/Sourcify verify). Smaller fixes cover wagmi post-transfer logic in useEffect, oracle/API3/Pyth/Chainlink examples, node placeholder chain IDs and monitoring YAML, SIP-03 June 15, 2026 timeline, instant finality wording, gas fee = price × gas used, and Ledger guidance off the deprecated Cosmos-app path.

Reviewed by Cursor Bugbot for commit 714fca6. Bugbot is set up for automated code reviews on this repo. Configure here.

@mintlify

mintlify Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
sei-docs 🟢 Ready View Preview Jun 11, 2026, 11:16 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 714fca6. Configure here.

Comment thread evm/precompiles/json.mdx
const isValid = isValidRaw === 1n;
// Extract the parent "prices" object the same way
const pricesJson = await safeExtractBytes(this.jsonPrecompile, oracleResponse, 'prices', '{}');
const rawPrices = JSON.parse(pricesJson);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Oracle parser wrong prices key

Medium Severity

The updated SeiPriceOracle.parsePriceFeed reads a top-level prices key, but the page’s sample oracle JSON nests prices under market, so the example returns empty prices even when the feed is valid.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 714fca6. Configure here.

Comment thread evm/evm-hardhat.mdx
// _nextTokenId starts at 0, so the first minted token has ID 0.
// Read the actual ID from the Transfer event:
const transferEvent = receipt.logs.map((log) => seiNFT.interface.parseLog(log)).find((parsed) => parsed?.name === 'Transfer');
console.log('NFT minted with ID:', transferEvent.args.tokenId.toString());

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

NFT mint log unchecked

Low Severity

The deploy script logs transferEvent.args.tokenId without checking that a Transfer log was parsed, so a missing or unparsed event causes a runtime throw instead of a clear message.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 714fca6. Configure here.

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