Skip to content

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

Open
alexander-sei wants to merge 3 commits into
mainfrom
docs/ai-review-fixes
Open

docs: fix factual errors, broken examples, and migrate to Hardhat 3#27
alexander-sei wants to merge 3 commits 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 documentation-only (MDX); no application or on-chain code ships with this PR, though it fixes previously dangerous example snippets readers might have followed.

Overview
This PR is a broad documentation accuracy pass (~45 MDX files): broken or misleading examples are corrected so copy-paste matches Sei EVM behavior and current tooling.

Highest-impact fixes include precompile snippets that could move real funds wrong—staking undelegate amounts in 6-decimal usei (not parseEther), bank sendNative using wei and clarifying send() is pointer-contract-only, and distribution calling withdrawDelegationRewards(validator) instead of a non-existent method. P256 docs now use the full half-order malleability check and low-level staticcall so invalid signatures don’t revert on empty precompile returns. Address associate examples pass the full EIP-191 prefixed message (length + body).

Hardhat 3 is rolled through deploy/migrate/precompile guides: defineConfig, configVariable, encrypted keystore, Ignition deploy, and network.create() for ethers—aligned with evm-hardhat.mdx (LayerZero sample still HH2 where noted).

Smaller but important edits: SIP-03/USDC.n timeline (June 15, 2026), instant finality wording, gas fee = price × used, Ledger → Ethereum/Sei app (Cosmos flow deprecated), wagmi post-transfer cleanup in useEffect, oracle/API fixes (Pyth ABI, API3 decimals), node ops (min gas, chain IDs pacific-1/atlantic-2, destructive DB wipe labeled correctly), and removal of unsupported sei_getStorageStats content.

AI/MCP pages mostly get consistent example recipient addresses; x402 Axiom section heading levels are normalized.

Reviewed by Cursor Bugbot for commit 812bdfd. 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.

Comment thread evm/precompiles/json.mdx Outdated
Comment thread evm/evm-hardhat.mdx Outdated
… module, command fixes

Bank precompile (Codex P2 + review):
- rewrite all Solidity/JS examples that called send() from arbitrary
  callers (reverts; pointer-only per bank.go:150) to use the denom's
  ERC20 pointer transfer()/transferFrom(); key supportedTokens by
  pointer address; rename misleading amountInUsei variable

Deploy & verify page (Codex P3 + review):
- add toolbox plugin to configs so the ignition task exists, add the
  missing ignition/modules/MyContract.ts example, note toolbox-bundled
  hardhat-verify, fix 'simultaneously' wording, drop duplicate H1

Command fixes:
- drop jq parsing from seid status examples — key casing and output
  stream vary across seid versions and output modes, so show the bare
  command (also removes a pre-existing broken jq pipe)
- drop --keep-addr-book: sei-tendermint's unsafe-reset-all only
  defines --key, the flag errors
- artifact JSON imports resolve relative to the script in scripts/, so
  use ../artifacts (verified against Hardhat 3.9.0); add the missing
  run command for addr.mdx

Other:
- replace invalid-EIP-55-checksum example address with the canonical
  valid one in MCP server pages and (same pre-existing bug) both
  agentic-wallets pages
- bump example minimum-gas-prices to the chain-enforced mainnet floor
  (0.02usei)
- guard the Transfer-event lookup in the NFT deploy script

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

@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 1 potential issue.

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 812bdfd. 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() ?? 'unknown (no Transfer event in receipt)');

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 example throws on parseLog

Medium Severity

The deploy script walks every receipt log with seiNFT.interface.parseLog, which throws on logs that are not from SeiNFT. Typical receipts include unrelated logs, so the example often fails before it can find the Transfer event.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 812bdfd. 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