Skip to content

Commit

Permalink
Merge branch 'main' into staking_dashboard_bug_fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberhorsey authored Aug 10, 2023
2 parents 47c6aee + e6f7124 commit 7ab59d5
Show file tree
Hide file tree
Showing 8 changed files with 255 additions and 18 deletions.
140 changes: 128 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
**Table of contents:**

- [Make a contribution](#make-a-contribution)
- [Claim a Taiko Contributor GitPOAP](#claim-a-taiko-contributor-gitpoap)
- [Coding standards](#coding-standards)
- [Documentation standards](#documentation-standards)

Expand All @@ -14,16 +13,14 @@ Here are some ways you can contribute:
- Open a new issue [here](https://github.com/taikoxyz/taiko-mono/issues) (please check the issue does not already exist).
- Work on an existing issue (check out the [good first issues list](https://github.com/orgs/taikoxyz/projects/9/views/31) on our public project board).

> Check out the [coding standards](#coding-standards) and [documentation standards](#documentation-standards) before you start working on a pull request.
Please comment on the issue that you're interested in working on. Also, check out the [coding standards](#coding-standards) and [documentation standards](#documentation-standards) before you start working on the pull request.

## Claim a Taiko Contributor GitPOAP

A Taiko Contributor GitPOAP is rewarded to anyone that merges in a pull request to one of Taiko's GitHub repositories (you can see which repositories here: [2023 Taiko Contributor GitPOAP](https://www.gitpoap.io/gp/893)).

After your pull request is merged, a bot will automatically leave a comment with instructions to receive your GitPOAP. You only receive a Taiko Contributor GitPOAP for the first pull request you merge in a given year.
Once the pull request is merged to one of Taiko's GitHub repositories (you can see which repositories here: [2023 Taiko Contributor GitPOAP](https://www.gitpoap.io/gp/893)), you will be automatically awarded a Taiko Contributor GitPOAP. Opening a good new issue (not a spam issue) is also eligible for a GitPOAP, just leave a comment and we will manually invoke a GitHub bot that will send the GitPOAP.

## Coding standards

This section describes our coding standards at Taiko.

### Pull requests

Specify the scope of your change with a [conventional commit](https://www.conventionalcommits.org/en/v1.0.0/) in the PR title (for example, `feat(scope): description of feature`). This will be squashed and merged into the `main` branch. You can find the full list of allowed scopes [here](https://github.com/taikoxyz/taiko-mono/blob/main/.github/workflows/lint-pr.yml#L19).
Expand All @@ -36,20 +33,139 @@ For example, `feat(scope): description of feature` should only impact the `scope

Follow the [NatSpec format](https://docs.soliditylang.org/en/latest/natspec-format.html) for documenting smart contract source code. Please adhere to a few additional standards:

- Choose `/** */` over `///` for multi-line NatSpec comments to save column space.
- Omit the usage of `@notice` and let the compiler automatically pick it up to save column space.
- For example: `/** @notice This is a notice */` becomes `/** This is a notice */`.
#### Multi-line comments

Choose `/** */` over `///` for multi-line NatSpec comments to save column space.

#### Notice tag

Omit the usage of `@notice` and let the compiler automatically pick it up to save column space. For example, this:

```
/// @notice This is a notice.
```

becomes this:

```
/// This is a notice.
```

#### Annotation indentation

For multi-line annotations, do not "align". For example, this is **wrong**:

```
/**
* Here is a comment.
* @param someParam Here is a long parameter blah blah blah
* and I wrap it to here.
* @return someThing Here is a long return parameter blah
* and I wrap it to here.
*/
```

This is **correct**:

```
/**
* Here is a comment.
* @param someParam Here is a long parameter blah blah blah
* and I wrap it to here.
* @return someThing Here is a long return parameter blah
* and I wrap it to here.
*/
```

#### Extra line breaks

Use extra line breaks as you see fit. By default, do not use them unless it improves the readability.

This is **preferred**:

```
/**
* Here is a comment.
* @param someParam Here is a long parameter blah blah blah
* and I wrap it to here.
* @return someThing Here is a long return parameter blah
* and I wrap it to here.
*/
```

This is also **okay**:

```
/**
* Here is a comment.
*
* @param someParam Here is a long parameter blah blah blah
* and I wrap it to here.
* @return someThing Here is a long return parameter blah
* and I wrap it to here.
*/
```

#### Additional comments

You can use additional comments with `//`. These can be above what it is describing **or** to the side. Try to remain consistent in what you are commenting. Do not use `/* */`. You can align comments on the side or not, whichever improves readability.

This is **correct**:

```
struct Some {
// This is foo
uint256 foo;
uint256 bar; // This is bar
}
```

This is **wrong**:

```
struct Some {
uint256 foo; /* This is foo */
}
```

#### Periods

Periods are optional for comments, but recommended if it's a proper sentence. However, remain consistent in whatever file or section you are commenting.

This is **correct**:

```
struct Some {
// This is foo
uint256 foo;
}
```

This is **wrong**:

```
struct Some {
// This is foo.
uint256 foo;
// This is bar
uint256 bar;
}
```

## Documentation standards

Use the [Microsoft Writing Style Guide](https://learn.microsoft.com/en-us/style-guide/welcome/) as a base point of reference for writing style.
This section describes our documentation standards at Taiko.

### Philosophy
### Philosophies

- Create the minimum viable documentation.
- Don't repeat yourself, use links to existing documentation or inherit it.
- Keep documentation close to what it's describing (for example, in the source code).

### Writing style

Use the [Microsoft Writing Style Guide](https://learn.microsoft.com/en-us/style-guide/welcome/) as a base point of reference for writing style. Generally, don't worry too much about things like typos. What's more important is following the basic [philosophies](#philosophies) outlined above and following structural standards for highly readable and minimal documentation.

### Creating content

If you are interested in creating some content (video, blog post, tweet thread, visuals, etc.), you are absolutely free to do so. It's useful to get a peer review on these, if you need a peer review please reach out to the community / team on the [Taiko Discord](https://discord.gg/taikoxyz).
Expand Down
26 changes: 26 additions & 0 deletions packages/website/components/Ecosystem/EcosystemSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ const ecosystemData: EcosystemData[] = [
filters: [],
isLive: true,
},
{
icon: "/images/ecosystem/cloak.png",
name: "Cloak",
link: "https://cloak.exchange/",
description:
"Cloak is a non-custodial dark pool, offering trustless, MEV-resistant, and slippage-resistant trades for any ERC-20 trading pairs.",
filters: [],
isLive: false,
},
{
icon: "/images/ecosystem/crypton.png",
name: "Crypton",
Expand Down Expand Up @@ -268,6 +277,14 @@ const ecosystemData: EcosystemData[] = [
filters: [],
isLive: true,
},
{
icon: "/images/ecosystem/vooi.jpeg",
name: "Vooi",
link: "https://vooi.io/",
description: "vooi is a stableswap AMM DEX built for L2 chains on top of Unbounded pool technology.",
filters: [],
isLive: true,
},
{
icon: "/images/ecosystem/zkpool.png",
name: "ZKPool",
Expand All @@ -286,6 +303,15 @@ const ecosystemData: EcosystemData[] = [
filters: [],
isLive: true,
},
{
icon: "/images/ecosystem/zksynth.png",
name: "ZKSynth",
link: "https://app.zksynth.com/",
description:
"zkSynth allows you to create and trade synthetic assets that track the price of any real-world asset, such as stocks, commodities, currencies, and more.",
filters: [],
isLive: false,
},
];

export function EcosystemSection() {
Expand Down
31 changes: 29 additions & 2 deletions packages/website/pages/docs/guides/run-a-node/enable-a-prover.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { Callout, Steps } from "nextra-theme-docs";
Keep in mind that running a prover is a very competitive space, and those who
generate proofs will have very powerful machines and optimized clients. It's
unlikely to prove a block and gain rewards with the default client and minimum
hardware requirements.
hardware requirements (e.g. even a i9-13900K is not fast enough to prove for Grimsvotn L2).
</Callout>

# Enable a prover

This guide will help you enable your Taiko node as a prover. Read more about prover dynamics [here](/docs/concepts/proving#prover-dynamics) (especially to set your expectations about running a prover).
This guide will help you enable your Taiko node as a prover. Your node will generate proofs, but this does not mean you will be able to submit a proof in time to earn a reward, see the warning above. Read more about prover dynamics [here](/docs/concepts/proving#prover-dynamics) (especially to set your expectations about running a prover).

## Prerequisites

Expand Down Expand Up @@ -92,12 +92,39 @@ docker compose -f ./docker-compose.l3.yml --env-file .env.l3 logs -f l3_taiko_cl

The simple-taiko-node comes with a default value of `PROVE_UNASSIGNED_BLOCKS` set to `true`. This means that your prover will attempt to prove these open blocks. To be assigned blocks by the protocol, you need to stake your TTKOe.

If you are trying to run a prover for Eldfell L3 first keep in mind, the competition for getting into the prover pool will be high. But don't worry! Even if you get slashed, there's nothing wrong with that. TTKOe is a worthless testnet token, and even getting slashed really helps us to test the network.

To stake your TTKOe try using the [staking dashboard](https://staking.l3test.taiko.xyz/) or the base layer contract manually (see [TaikoL1](/docs/reference/contract-addresses)).

To be one of the provers, you must stake more than current prover stakes, and in the list of top 32 stakers [here](https://staking.l3test.taiko.xyz/#/currentProvers).

The stake amount would be calculated by Capacity/Amount per Capacity. If you want to stake 2 TTKOe with 32 capacity, your Amount per Capacity will be calculated as: `2 / 32 = 0.0625`.

If you have already staked some amount, only the difference will be deducted from your balance.

1. Set the amount per capacity. This is the amount you in TTKOe you are staking. The more you stake, the higher your rank will be in prover pool.
2. Set the reward per gas. This is the reward you want to receive in TTKOe. A good value would be close to the current protocol `feePerGas`.
3. Set the capacity you can provide. This is the amount of parallel blocks you can handle within the proof window.

### Changing the Staked TTKOe Amount (Only for Eldfell L3 Provers)

In the event that you have staked TTKOe and made an error in the amount, you can change the staked amount at any time here. However, there are some considerations.

For example, if you've staked 2 TTKOe and want to change the staked amount to 1 TTKOe, the difference of 1 TTKOe will be exited and you will not be able to withdraw it for a week. Be careful when entering the amount.

<Callout type="warning">
Always manually add eight zeros for the decimal '10^8`.
</Callout>

Enter the amount you wish to change your stake to for `amount` on the `stake()` function. Unlike the Staking Dashboard's Amount per Capacity, the entered amount will be the total staked amount. You can call the stake function on the ProverPool contract [here](https://explorer.test.taiko.xyz/address/0xC9580414A4372BDdBd8e19e01854DC0B2b1390Cf).

Here are the parameters to set for `stake()`:
- `amount`
- `rewardPerGas (uint32)`
- `maxCapacity (uint32)` (minimum: 32)

In the example above, if you enter 1 in the amount and click Write, the amount will change from 2 to 1, and 1 TTKOe will be exited.

### Exit your prover from prover pool (Eldfell L3 provers only)

If you want to stop proving, you can exit your prover from the prover pool. This will stop your prover from being assigned blocks.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,34 @@ sudo ./ethd up

### Check your connection

Check if the node is connected and synced by requesting the latest Sepolia block from the Execution Layer client (change port from `8545` to whatever you have the execution client p2p port set to in your `.env` file):
Check if the Execution Layer client is connected to Sepolia (change port from `8545` to whatever you have the execution client p2p port set to in your `.env` file)

```bash
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":0}' http://127.0.0.1:8545
curl http://localhost:8545 \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"eth_chainId","params":[],"id":1,"jsonrpc":"2.0"}'
```

which should return chainId = 0xaa36a7 = 11155111

```json
{ "jsonrpc": "2.0", "id": 0, "result": "0xaa36a7" }
```

Wait for your Consensus Layer client to fully sync by checking

```bash
./ethd logs -f consensus
```

Check if the Execution Layer client is synced by requesting the latest Sepolia block from the Execution Layer client

```bash
curl http://localhost:8545 \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"eth_blockNumber","params":[],"id":1,"jsonrpc":"2.0"}'
```

If your response block number is less than the current block, check the Execution Layer client logs:
Expand Down
48 changes: 46 additions & 2 deletions packages/website/pages/docs/guides/run-a-node/run-a-taiko-node.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -145,24 +145,66 @@ For an Eldfell L3 node this would be:
- `L2_ENDPOINT_HTTP`
- `L2_ENDPOINT_WS`

Take a look at the comments above these values in the `.env.sample` and `.env.sample.l3` to see how to set them up.

### Start a node

Make sure Docker is running and then run the following command to start the node.

For a Grimsvotn L2 node:

```sh
docker compose up -d --remove-orphans
sudo docker compose up -d --remove-orphans
```

For an Eldfell L3 node:

```sh
docker compose -f ./docker-compose.l3.yml --env-file .env.l3 up -d
sudo docker compose -f ./docker-compose.l3.yml --env-file .env.l3 up -d
```

### Verify node is running

#### Check with curl commands

1. Check if the Execution Layer client is connected to Taiko L2 / L3:

```bash
curl http://localhost:8547 \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"eth_chainId","params":[],"id":1,"jsonrpc":"2.0"}'
```

which should return the chainId as `0x28c5d` (167005):

```json
{"jsonrpc":"2.0","id":0,"result":"0x28c5d"}
```

For Taiko L3, use port 8549 for the `eth_chainId` curl request and you should get chainId `0x28c5e` (167006).

2. Check if the Execution Layer client is synced by requesting the latest Taiko L2 / L3 block from the Execution Layer client:

```bash
curl http://localhost:8547 \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"eth_blockNumber","params":[],"id":1,"jsonrpc":"2.0"}'
```

3. If the blockNumber response value is `0` or not growing, check the Taiko L2 logs here:
```bash
sudo docker compose logs -f
```
or the Taiko L3 logs here
```bash
sudo docker compose -f ./docker-compose.l3.yml --env-file .env.l3 logs -f
```
If you find an error, check the [Node troubleshooting](/docs/reference/node-troubleshooting) page.

#### Check with the node dashboard

A node dashboard will be running on `localhost` on the `GRAFANA_PORT` you set in your `.env` or `.env.l3` file. For a Grimsvotn L2 node that would default to: [http://localhost:3001/d/L2ExecutionEngine/l2-execution-engine-overview](http://localhost:3001/d/L2ExecutionEngine/l2-execution-engine-overview).

You can verify that your node is syncing by checking the **chain head** on the dashboard and seeing that it is increasing. Once the chain head matches what's on the block explorer, you are fully synced.
Expand All @@ -176,6 +218,8 @@ You can verify that your node is syncing by checking the **chain head** on the d
height={1106}
/>

If you find an error, check the [Node troubleshooting](/docs/reference/node-troubleshooting) page.

### Operate the node

You can find all node operations (eg. stop node, update node, remove node, view logs) in the [Node runner manual](/docs/manuals/node-runner-manual).
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7ab59d5

Please sign in to comment.