From cc5f5c42ced66c6c92bdaa45916be67a98f82c5b Mon Sep 17 00:00:00 2001 From: dave | d1onys1us <13951458+d1onys1us@users.noreply.github.com> Date: Fri, 10 Mar 2023 15:30:44 -0500 Subject: [PATCH] docs(website): update docs for hackathon testnet and contract documentation (#13292) --- .../components/AddEthereumChainButton.tsx | 31 ++++--------- .../pages/docs/guides/configure-wallet.mdx | 9 ++-- .../pages/docs/guides/deploy-a-contract.md | 4 +- .../pages/docs/guides/request-from-faucet.md | 22 ++------- .../website/pages/docs/guides/run-a-node.md | 23 ---------- .../{testnet-guide => guides}/run-a-node.mdx | 0 .../pages/docs/guides/use-the-bridge.md | 2 + .../docs/reference/contract-addresses.md | 17 +++---- .../L1/TaikoCustomErrors.md | 44 ++++-------------- .../contract-documentation/L1/TaikoData.md | 22 ++++++--- .../contract-documentation/L1/TaikoEvents.md | 8 +--- .../contract-documentation/L1/TaikoL1.md | 46 +++---------------- .../signal/SignalService.md | 8 ++-- .../pages/docs/reference/rpc-configuration.md | 10 ++-- .../tutorials/signal-service-tutorial.mdx | 6 ++- 15 files changed, 71 insertions(+), 181 deletions(-) delete mode 100644 packages/website/pages/docs/guides/run-a-node.md rename packages/website/pages/docs/{testnet-guide => guides}/run-a-node.mdx (100%) diff --git a/packages/website/components/AddEthereumChainButton.tsx b/packages/website/components/AddEthereumChainButton.tsx index a40a303ed40..870c59ccac6 100644 --- a/packages/website/components/AddEthereumChainButton.tsx +++ b/packages/website/components/AddEthereumChainButton.tsx @@ -1,9 +1,8 @@ type Props = { buttonText: string; - chain: string; }; -async function addEthereumChain(chain: string) { +async function addEthereumChain() { interface AddEthereumChainParameter { chainId: string; // A 0x-prefixed hexadecimal string chainName: string; @@ -16,44 +15,30 @@ async function addEthereumChain(chain: string) { blockExplorerUrls?: string[]; iconUrls?: string[]; // Currently ignored. } - const l1params: AddEthereumChainParameter = { - chainId: "0x7A6A", - chainName: "Ethereum A1 (Taiko)", - nativeCurrency: { - name: "ETH", - symbol: "eth", - decimals: 18, - }, - rpcUrls: ["https://l1rpc.a1.taiko.xyz"], - blockExplorerUrls: ["https://l1explorer.a1.taiko.xyz/"], - iconUrls: [], - }; - const l2params: AddEthereumChainParameter = { - chainId: "0x28C5B", - chainName: "Taiko A1 (Taiko)", + const taikoParams: AddEthereumChainParameter = { + chainId: "0x28C5A", + chainName: "Taiko Hackathon Testnet", nativeCurrency: { name: "ETH", symbol: "eth", decimals: 18, }, - rpcUrls: ["https://l2rpc.a1.taiko.xyz"], - blockExplorerUrls: ["https://l2explorer.a1.taiko.xyz/"], + rpcUrls: ["https://l2rpc.hackathon.taiko.xyz"], + blockExplorerUrls: ["https://l2explorer.hackathon.taiko.xyz/"], iconUrls: [], }; - const params = chain === "l1" ? l1params : l2params; - await (window as any).ethereum.request({ method: "wallet_addEthereumChain", - params: [params], + params: [taikoParams], }); } export default function AddEthereumChainButton(props: Props) { return (
addEthereumChain(props.chain)} + onClick={() => addEthereumChain()} className="hover:cursor-pointer text-neutral-900 bg-white hover:bg-neutral-100 border-solid border-neutral-200 focus:ring-4 focus:outline-none focus:ring-neutral-100 font-medium rounded-lg text-sm px-3 py-2 text-center inline-flex items-center dark:focus:ring-neutral-600 dark:bg-neutral-800 dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700" > {props.buttonText} diff --git a/packages/website/pages/docs/guides/configure-wallet.mdx b/packages/website/pages/docs/guides/configure-wallet.mdx index c0994789404..c1c35ee39c4 100644 --- a/packages/website/pages/docs/guides/configure-wallet.mdx +++ b/packages/website/pages/docs/guides/configure-wallet.mdx @@ -11,9 +11,6 @@ These steps will help you connect your wallet to the Taiko A1 testnet. There are ## Steps 1. Try clicking the buttons below to automatically add the networks to your wallet (using `wallet_addEthereumChain`). - | Network | Add to wallet | - | ----------- | --------------------------------------------------------------- | - | Ethereum A1 | | - | Taiko A1 | | - -2. If that doesn't work, manually add the networks to your wallet using the [RPC configuration](/docs/reference/rpc-configuration). +2. Add the Sepolia testnet by clicking "Add chain" on [https://chainlist.wtf/](https://chainlist.wtf). +3. Add the Taiko network by clicking the "Add chain" button: +4. If that doesn't work, manually add the networks to your wallet using the [RPC configuration](/docs/reference/rpc-configuration). diff --git a/packages/website/pages/docs/guides/deploy-a-contract.md b/packages/website/pages/docs/guides/deploy-a-contract.md index 904dbde55ec..5b720a200a9 100644 --- a/packages/website/pages/docs/guides/deploy-a-contract.md +++ b/packages/website/pages/docs/guides/deploy-a-contract.md @@ -19,7 +19,7 @@ These steps will show you how to deploy a smart contract to Taiko A1 using Found ``` 3. Deploy the contract from your project, located at `src/Counter.sol`. Replace `YOUR_PRIVATE_KEY` with your private key, mentioned in the previous prerequisites section. ```sh - forge create --legacy --rpc-url https://l2rpc.a1.taiko.xyz --private-key YOUR_PRIVATE_KEY src/Counter.sol:Counter + forge create --legacy --rpc-url https://l2rpc.hackathon.taiko.xyz --private-key YOUR_PRIVATE_KEY src/Counter.sol:Counter ``` > Note: The `--legacy` flag is needed because EIP-1559 is currently disabled on Taiko—there are plans to re-enable it in the future. -4. Paste the address from the output into the [L2 block explorer](https://l2explorer.a1.taiko.xyz/) to verify that the contract was deployed. +4. Paste the address from the output into the [L2 block explorer](https://l2explorer.hackathon.taiko.xyz/) to verify that the contract was deployed. diff --git a/packages/website/pages/docs/guides/request-from-faucet.md b/packages/website/pages/docs/guides/request-from-faucet.md index 586bf4bbfc5..44f05a59255 100644 --- a/packages/website/pages/docs/guides/request-from-faucet.md +++ b/packages/website/pages/docs/guides/request-from-faucet.md @@ -4,24 +4,10 @@ These steps will help you receive testnet tokens from the faucet. ## Steps -### Request Ethereum A1 ETH +### Request ETH on Sepolia -1. Visit the [L1 faucet](https://l1faucet.a1.taiko.xyz/) to receive Ethereum A1 ETH. +1. Visit the recommended [Sepolia faucet](https://sepolia-faucet.pk910.de/) to receive ETH on Sepolia. -### Request Taiko A1 ETH +### Request ETH on Taiko -1. Visit the [L2 faucet](https://l2faucet.a1.taiko.xyz/) to receive Taiko A1 ETH. - -### Request HORSE - -1. Visit the [bridge](https://bridge.a1.taiko.xyz/). -2. Select the network as Taiko A1 and the token dropdown as HORSE. -3. Click the faucet button that appears. - -## Common problems - -### Testnet faucet shows error “unable to find Ethereum address.” - -The Twitter API is hitting a rate limit. Because of this, the faucet can’t recognize the Ethereum address in your tweet. - -To solve this, you will need to wait and try again. If you continue having problems, you can ask the community to send you testnet funds by sending your address to the Discord channel: `🪙︱manual-faucet`. +1. Visit the [Taiko faucet](https://l2faucet.hackathon.taiko.xyz/) to receive ETH on Taiko. diff --git a/packages/website/pages/docs/guides/run-a-node.md b/packages/website/pages/docs/guides/run-a-node.md deleted file mode 100644 index 2a06a79ceb5..00000000000 --- a/packages/website/pages/docs/guides/run-a-node.md +++ /dev/null @@ -1,23 +0,0 @@ -# Run a Taiko node - -This is arguably the most important part of the testnet! Taiko is fully decentralized and relies on the community to run nodes. - -Follow the guide at [simple-taiko-node/README.md](https://github.com/taikoxyz/simple-taiko-node/blob/main/README.md) to get started. - -## System requirements - -Because we're a fork of Geth, you can consult the [Geth minimum requirements](https://github.com/ethereum/go-ethereum#hardware-requirements), which are outlined below. - -### Minimum: - -- CPU with 2+ cores -- 4GB RAM -- 50~200GB should be sufficient for testnets -- 8 MBit/sec download Internet service - -### Recommended: - -- Fast CPU with 4+ cores -- 16GB+ RAM -- High-performance SSD with at least 1TB of free space -- 25+ MBit/sec download Internet service diff --git a/packages/website/pages/docs/testnet-guide/run-a-node.mdx b/packages/website/pages/docs/guides/run-a-node.mdx similarity index 100% rename from packages/website/pages/docs/testnet-guide/run-a-node.mdx rename to packages/website/pages/docs/guides/run-a-node.mdx diff --git a/packages/website/pages/docs/guides/use-the-bridge.md b/packages/website/pages/docs/guides/use-the-bridge.md index 7219a05fc7f..6d4e9191e13 100644 --- a/packages/website/pages/docs/guides/use-the-bridge.md +++ b/packages/website/pages/docs/guides/use-the-bridge.md @@ -1,3 +1,5 @@ +> Note: The bridge is currently not deployed on the Taiko hackathon testnet, but you can build bridges with the Signal Service cross-chain messaging. + # Use the bridge These steps will help you to use the bridge to transfer assets between Ethereum A1 and Taiko A1. All the bridge contracts can be found [here](/docs/reference/contract-addresses). diff --git a/packages/website/pages/docs/reference/contract-addresses.md b/packages/website/pages/docs/reference/contract-addresses.md index 7e498ed32db..01462cf3ce4 100644 --- a/packages/website/pages/docs/reference/contract-addresses.md +++ b/packages/website/pages/docs/reference/contract-addresses.md @@ -1,16 +1,11 @@ -# Contract addresses +# Hackathon testnet contract addresses -## L1 +## Sepolia (L1) -- **TaikoL1:** `0x7B3AF414448ba906f02a1CA307C56c4ADFF27ce7` -- **TokenVault:** `0xD0dfd5baCf160B97C8eE3ecb463F18c08673160c` -- **Bridge:** `0x3612E284D763f42f5E4CB72B1602b23DAEC3cA60` -- **HORSE:** `0x3E3a3416DbCc5cb4448B6b171fF15f9Da35Ab72d` +- **TaikoL1:** `0xEdE510d93A3a6C5e8B8Be88F7719716063140197` +- **SignalService:**: `0xe40D5bedD2f3d9F288CC12c69463bC43c77488d6` -## L2 +## Taiko (L2) - **TaikoL2:** `0x0000777700000000000000000000000000000001` -- **TokenVault:** `0x0000777700000000000000000000000000000002` -- **EtherVault:** `0x0000777700000000000000000000000000000003` -- **Bridge:** `0x0000777700000000000000000000000000000004` -- **HORSE:** `0xb8ea36284d1fa062cc0c969e28a49f3531cfb1bf` +- **SignalService:** `0x191E3D5a00d54799D7da6c04d56b19938304c312` diff --git a/packages/website/pages/docs/reference/contract-documentation/L1/TaikoCustomErrors.md b/packages/website/pages/docs/reference/contract-documentation/L1/TaikoCustomErrors.md index b3f25b3e360..8fa125b58bd 100644 --- a/packages/website/pages/docs/reference/contract-documentation/L1/TaikoCustomErrors.md +++ b/packages/website/pages/docs/reference/contract-documentation/L1/TaikoCustomErrors.md @@ -10,6 +10,12 @@ title: TaikoCustomErrors error L1_0_FEE_BASE() ``` +### L1_ALREADY_PROVEN + +```solidity +error L1_ALREADY_PROVEN() +``` + ### L1_ANCHOR_CALLDATA ```solidity @@ -100,12 +106,6 @@ error L1_BLOCK_NUMBER() error L1_CANNOT_BE_FIRST_PROVER() ``` -### L1_CIRCUIT_LENGTH - -```solidity -error L1_CIRCUIT_LENGTH() -``` - ### L1_COMMITTED ```solidity @@ -142,18 +142,6 @@ error L1_EXTRA_DATA() error L1_GAS_LIMIT() ``` -### L1_HALTED - -```solidity -error L1_HALTED() -``` - -### L1_HALT_CONDITION - -```solidity -error L1_HALT_CONDITION() -``` - ### L1_ID ```solidity @@ -190,10 +178,10 @@ error L1_META_MISMATCH() error L1_NOT_COMMITTED() ``` -### L1_NOT_FIRST_PROVER +### L1_NOT_ORACLE_PROVER ```solidity -error L1_NOT_FIRST_PROVER() +error L1_NOT_ORACLE_PROVER() ``` ### L1_PROOF_LENGTH @@ -214,22 +202,10 @@ error L1_PROVER() error L1_SOLO_PROPOSER() ``` -### L1_TOO_LATE - -```solidity -error L1_TOO_LATE() -``` - -### L1_TOO_MANY - -```solidity -error L1_TOO_MANY() -``` - -### L1_TOO_MANY_PROVERS +### L1_TOO_MANY_BLOCKS ```solidity -error L1_TOO_MANY_PROVERS() +error L1_TOO_MANY_BLOCKS() ``` ### L1_TX_LIST diff --git a/packages/website/pages/docs/reference/contract-documentation/L1/TaikoData.md b/packages/website/pages/docs/reference/contract-documentation/L1/TaikoData.md index ab98d748b8c..e17be308bd3 100644 --- a/packages/website/pages/docs/reference/contract-documentation/L1/TaikoData.md +++ b/packages/website/pages/docs/reference/contract-documentation/L1/TaikoData.md @@ -11,10 +11,8 @@ struct Config { uint256 chainId; uint256 maxNumBlocks; uint256 blockHashHistory; - uint256 zkProofsPerBlock; uint256 maxVerificationsPerTx; uint256 commitConfirmations; - uint256 maxProofsPerForkChoice; uint256 blockMaxGasLimit; uint256 maxTransactionsPerBlock; uint256 maxBytesPerTxList; @@ -32,12 +30,9 @@ struct Config { uint64 blockTimeCap; uint64 proofTimeCap; uint64 bootstrapDiscountHalvingPeriod; - uint64 initialUncleDelay; - uint64 proverRewardRandomizedPercentage; bool enableTokenomics; bool enablePublicInputsCheck; bool enableAnchorValidation; - bool enableOracleProver; } ``` @@ -59,6 +54,18 @@ struct BlockMetadata { } ``` +### Evidence + +```solidity +struct Evidence { + struct TaikoData.BlockMetadata meta; + struct BlockHeader header; + address prover; + bytes[] proofs; + uint16 circuitId; +} +``` + ### ProposedBlock ```solidity @@ -75,8 +82,8 @@ struct ProposedBlock { ```solidity struct ForkChoice { bytes32 blockHash; + address prover; uint64 provenAt; - address[] provers; } ``` @@ -88,10 +95,11 @@ struct State { mapping(uint256 => struct TaikoData.ProposedBlock) proposedBlocks; mapping(uint256 => mapping(bytes32 => struct TaikoData.ForkChoice)) forkChoices; mapping(address => mapping(uint256 => bytes32)) commits; + mapping(address => uint256) balances; uint64 genesisHeight; uint64 genesisTimestamp; uint64 __reservedA1; - uint64 statusBits; + uint64 __reservedA2; uint256 feeBase; uint64 nextBlockId; uint64 lastProposedAt; diff --git a/packages/website/pages/docs/reference/contract-documentation/L1/TaikoEvents.md b/packages/website/pages/docs/reference/contract-documentation/L1/TaikoEvents.md index 23580b9eb6d..119dc77917e 100644 --- a/packages/website/pages/docs/reference/contract-documentation/L1/TaikoEvents.md +++ b/packages/website/pages/docs/reference/contract-documentation/L1/TaikoEvents.md @@ -25,11 +25,5 @@ event BlockProposed(uint256 id, struct TaikoData.BlockMetadata meta) ### BlockProven ```solidity -event BlockProven(uint256 id, bytes32 parentHash, bytes32 blockHash, uint64 timestamp, uint64 provenAt, address prover) -``` - -### Halted - -```solidity -event Halted(bool halted) +event BlockProven(uint256 id, bytes32 parentHash, bytes32 blockHash, address prover, uint64 provenAt) ``` diff --git a/packages/website/pages/docs/reference/contract-documentation/L1/TaikoL1.md b/packages/website/pages/docs/reference/contract-documentation/L1/TaikoL1.md index 9faf55c7575..aab1821ccf6 100644 --- a/packages/website/pages/docs/reference/contract-documentation/L1/TaikoL1.md +++ b/packages/website/pages/docs/reference/contract-documentation/L1/TaikoL1.md @@ -99,19 +99,17 @@ Verify up to N blocks. | --------- | ------- | ------------------------------- | | maxBlocks | uint256 | Max number of blocks to verify. | -### halt +### withdrawBalance ```solidity -function halt(bool toHalt) public +function withdrawBalance() external ``` -Halt or resume the chain. +### getRewardBalance -#### Parameters - -| Name | Type | Description | -| ------ | ---- | ------------------------------ | -| toHalt | bool | True to halt, false to resume. | +```solidity +function getRewardBalance(address addr) public view returns (uint256) +``` ### getBlockFee @@ -125,20 +123,6 @@ function getBlockFee() public view returns (uint256) function getProofReward(uint64 provenAt, uint64 proposedAt) public view returns (uint256 reward) ``` -### isHalted - -```solidity -function isHalted() public view returns (bool) -``` - -Check if the L1 is halted. - -#### Return Values - -| Name | Type | Description | -| ---- | ---- | -------------------------------- | -| [0] | bool | True if halted, false otherwise. | - ### isCommitValid ```solidity @@ -181,24 +165,6 @@ function signWithGoldenTouch(bytes32 hash, uint8 k) public view returns (uint8 v function getForkChoice(uint256 id, bytes32 parentHash) public view returns (struct TaikoData.ForkChoice) ``` -### getUncleProofDelay - -```solidity -function getUncleProofDelay(uint256 blockId) public view returns (uint64) -``` - -### getProverRewardBips - -```solidity -function getProverRewardBips(uint256 numProvers) public view returns (uint256[]) -``` - -### isBlockVerifiable - -```solidity -function isBlockVerifiable(uint256 blockId, bytes32 parentHash) public view returns (bool) -``` - ### getConfig ```solidity diff --git a/packages/website/pages/docs/reference/contract-documentation/signal/SignalService.md b/packages/website/pages/docs/reference/contract-documentation/signal/SignalService.md index ecb78cef907..c6c13eb467f 100644 --- a/packages/website/pages/docs/reference/contract-documentation/signal/SignalService.md +++ b/packages/website/pages/docs/reference/contract-documentation/signal/SignalService.md @@ -94,7 +94,7 @@ Check if signal has been received on the destination chain (current). ### getSignalSlot ```solidity -function getSignalSlot(address app, bytes32 signal) public pure returns (bytes32) +function getSignalSlot(address app, bytes32 signal) public pure returns (bytes32 signalSlot) ``` #### Parameters @@ -106,6 +106,6 @@ function getSignalSlot(address app, bytes32 signal) public pure returns (bytes32 #### Return Values -| Name | Type | Description | -| ---- | ------- | ---------------------------------------------------------------- | -| [0] | bytes32 | signalSlot The storage key for the signal on the signal service. | +| Name | Type | Description | +| ---------- | ------- | ----------------------------------------------------- | +| signalSlot | bytes32 | The storage key for the signal on the signal service. | diff --git a/packages/website/pages/docs/reference/rpc-configuration.md b/packages/website/pages/docs/reference/rpc-configuration.md index a5de28f1837..24c0ce013d6 100644 --- a/packages/website/pages/docs/reference/rpc-configuration.md +++ b/packages/website/pages/docs/reference/rpc-configuration.md @@ -1,6 +1,6 @@ -# RPC configuration +# Hackathon testnet RPC configuration -| Network | Chain ID | RPC URL | Symbol | Block Explorer URL | -| ----------- | -------- | -------------------------- | ------ | ------------------------------- | -| Ethereum A1 | 31338 | https://l1rpc.a1.taiko.xyz | ETH | https://l1explorer.a1.taiko.xyz | -| Taiko A1 | 167003 | https://l2rpc.a1.taiko.xyz | ETH | https://l2explorer.a1.taiko.xyz | +| Network | Chain ID | RPC URL | Symbol | Block Explorer URL | +| ------- | -------- | --------------------------------- | ------ | -------------------------------------- | +| Sepolia | 11155111 | https://rpc.sepolia.org | ETH | https://sepolia.etherscan.io/ | +| Taiko | 167002 | https://l2rpc.hackathon.taiko.xyz | ETH | https://l2explorer.hackathon.taiko.xyz | diff --git a/packages/website/pages/docs/tutorials/signal-service-tutorial.mdx b/packages/website/pages/docs/tutorials/signal-service-tutorial.mdx index 117e23326df..68ac1e90e00 100644 --- a/packages/website/pages/docs/tutorials/signal-service-tutorial.mdx +++ b/packages/website/pages/docs/tutorials/signal-service-tutorial.mdx @@ -1 +1,5 @@ -Coming soon™️ +## Build a dapp with Taiko's signal service + +Use the dapp-slaps starter template to create an Ethereum dapp with one-click, which fully demonstrates using Taiko's cross-chain messaging with the Signal Service: [dapp-slaps](https://github.com/d1onys1us/dapp-slaps). + +Read more about cross-chain messaging here: [bridging](/docs/concepts/bridging).