Skip to content

Commit 702fa23

Browse files
authored
update dev-node.md for multiple providers support (#1857)
* update dev-node.md for multiple providers support * update json response * line breaks * lint
1 parent 6914edd commit 702fa23

File tree

2 files changed

+76
-48
lines changed

2 files changed

+76
-48
lines changed

doc/espresso-dev-node.md

Lines changed: 48 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Espresso Dev Node
22

33
Espresso dev node is a node specifically designed for development and testing. It includes various nodes required to run
4-
a complete Espresso network, such as `builder`, `sequencer`, etc. Developers can use it for development and testing.
4+
a complete Espresso network, such as `builder`, `sequencer`, `state_prover` etc. Additionally, it supports deploying
5+
light client contracts on alternative chains and running a separate prover for each which can be useful for testing
6+
involving L3s. Developers can use dev node for development and testing.
57

68
## Download
79

@@ -13,16 +15,23 @@ docker run ghcr.io/espressosystems/espresso-sequencer/espresso-dev-node:main
1315

1416
## Parameters
1517

16-
| Name | Type | Environment Variable | Default Value | Description |
17-
| ------------------------------- | --------------- | ------------------------------------ | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
18-
| `rpc_url` | `Option<Url>` | `ESPRESSO_SEQUENCER_L1_PROVIDER` | Automatically launched Avil node if not provided. | The JSON-RPC endpoint of the L1. If not provided, an Avil node will be launched automatically. |
19-
| `mnemonic` | `String` | `ESPRESSO_SEQUENCER_ETH_MNEMONIC` | `test test test test test test test test test test test junk` | Mnemonic for an L1 wallet. This wallet is used to deploy the contracts, so the account indicated by `ACCOUNT_INDEX` must be funded with ETH. |
20-
| `account_index` | `u32` | `ESPRESSO_DEPLOYER_ACCOUNT_INDEX` | `0` | Account index of the L1 wallet generated from `MNEMONIC`. Used when deploying contracts. |
21-
| `sequencer_api_port` | `u16` | `ESPRESSO_SEQUENCER_API_PORT` | Required | Port that the HTTP API will use. |
22-
| `sequencer_api_max_connections` | `Option<usize>` | `ESPRESSO_SEQUENCER_MAX_CONNECTIONS` | None | Maximum concurrent connections allowed by the HTTP API server. |
23-
| `builder_port` | `Option<u16>` | `ESPRESSO_BUILDER_PORT` | An unused port | Port for connecting to the builder. |
24-
| `prover_port` | `Option<u16>` | `ESPRESSO_PROVER_PORT` | An unused port | Port for connecting to the prover. If this is not provided, an available port will be selected. |
25-
| `dev_node_port` | `u16` | `ESPRESSO_DEV_NODE_PORT` | `20000` | Port for the dev node. This is used to provide tools and information to facilitate developers debugging. |
18+
| Name | Type | Environment Variable | Default Value | Description |
19+
| ------------------------------- | --------------- | -------------------------------------------- | ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
20+
| `rpc_url` | `Option<Url>` | `ESPRESSO_SEQUENCER_L1_PROVIDER` | Automatically launched Avil node if not provided. | The JSON-RPC endpoint of the L1. If not provided, an Avil node will be launched automatically. |
21+
| `mnemonic` | `String` | `ESPRESSO_SEQUENCER_ETH_MNEMONIC` | `test test test test test test test test test test test junk` | Mnemonic for an L1 wallet. This wallet is used to deploy the contracts, so the account indicated by`ACCOUNT_INDEX` must be funded with ETH. |
22+
| `account_index` | `u32` | `ESPRESSO_DEPLOYER_ACCOUNT_INDEX` | `0` | Account index of the L1 wallet generated from`MNEMONIC`. Used when deploying contracts. |
23+
| `sequencer_api_port` | `u16` | `ESPRESSO_SEQUENCER_API_PORT` | Required | Port that the HTTP API will use. |
24+
| `sequencer_api_max_connections` | `Option<usize>` | `ESPRESSO_SEQUENCER_MAX_CONNECTIONS` | None | Maximum concurrent connections allowed by the HTTP API server. |
25+
| `builder_port` | `Option<u16>` | `ESPRESSO_BUILDER_PORT` | An unused port | Port for connecting to the builder. |
26+
| `prover_port` | `Option<u16>` | `ESPRESSO_PROVER_PORT` | An unused port | Port for connecting to the prover. If this is not provided, an available port will be selected. |
27+
| `dev_node_port` | `u16` | `ESPRESSO_DEV_NODE_PORT` | `20000` | Port for the dev node. This is used to provide tools and information to facilitate developers debugging. |
28+
| `update_interval` | `Duration` | `ESPRESSO_STATE_PROVER_UPDATE_INTERVAL` | `20s` | The frequency of updating the light client state |
29+
| `retry_interval` | `Duration` | `ESPRESSO_STATE_PROVER_RETRY_INTERVAL` | `2s` | Interval between retries if a state update fails. |
30+
| `alt_chain_providers` | `Vec<Url>` | `ESPRESSO_DEPLOYER_ALT_CHAIN_PROVIDERS` | `None` | Optional list of URLs representing alternate chains where the dev node will deploy Light client contracts and submit Light contract state updates. Useful for test environments involving L3s. |
31+
| `alt_mnemonics` | `Vec<String>` | `ESPRESSO_DEPLOYER_ALT_MNEMONICS` | `None` | Optional list of mnemonics for the alternate chains. If there are fewer mnemonics provided than chains, the base `MNEMONIC` will be used. |
32+
| `alt_account_indices` | `Vec<u32>` | `ESPRESSO_SEQUENCER_DEPLOYER_ALT_INDICES` | `None` | Optional list of account indices to use when deploying the contracts. If there are fewer indices provided than chains, the base ACCOUNT_INDEX will be used. |
33+
| `alt_prover_update_intervals` | `Vec<Duration>` | `ESPRESSO_STATE_PROVER_ALT_UPDATE_INTERVALS` | `None` | The frequency of updating the light client state for alternate chains. If there are fewer provided than chains, the base update_interval will be used. |
34+
| `alt_prover_retry_intervals` | `Vec<Duration>` | `ESPRESSO_STATE_PROVER_ALT_RETRY_INTERVALS` | `None` | Interval between retries if a state update fails for alternate chains. If there are fewer intervals provided than chains, the base retry_interval will be used. |
2635

2736
## APIs
2837

@@ -42,9 +51,23 @@ An example response is like this:
4251
```json
4352
{
4453
"builder_url": "http://localhost:41003/",
45-
"prover_port": 23156,
54+
"l1_prover_port": 23156,
4655
"l1_url": "http://localhost:8545/",
47-
"light_client_address": "0xb075b82c7a23e0994df4793422a1f03dbcf9136f"
56+
"l1_light_client_address": "0xb075b82c7a23e0994df4793422a1f03dbcf9136f",
57+
"alt_chains": [
58+
{
59+
"chain_id": 9,
60+
"provider_url": "http://localhost:8546/",
61+
"light_client_address": "0xa1b2c3d4e5f678901234567890abcdef12345678",
62+
"prover_port": 23157
63+
},
64+
{
65+
"chain_id": 10,
66+
"provider_url": "http://localhost:8547/",
67+
"light_client_address": "0xabcdefabcdefabcdefabcdefabcdefabcdefabcdef",
68+
"prover_port": 23158
69+
}
70+
]
4871
}
4972
```
5073

@@ -53,8 +76,8 @@ An example response is like this:
5376
This endpoint simulates the effect of a liveness failure of the hotshot consensus protocol in the Light Client smart
5477
contract.
5578

56-
By calling this, the L1 height in the light contract will be frozen, and rollups will detect the HotShot failure. This
57-
is intended for testing rollups' functionalities when HotShot is down.
79+
By calling this, the height in the light contract will be frozen, and rollups will detect the HotShot failure. This is
80+
intended for testing rollups' functionalities when HotShot is down.
5881

5982
An example of a `curl` command:
6083

@@ -66,9 +89,10 @@ curl -X POST "http://localhost:20000/api/set-hotshot-down" \
6689

6790
Parameters
6891

69-
| Name | Type | Description |
70-
| ------ | ------- | ---------------------------------------- |
71-
| height | integer | The L1 height from which hotshot is down |
92+
| Name | Type | Required | Description |
93+
| -------- | ------- | -------- | ------------------------------------------------------------------------------------------------------------- |
94+
| chain_id | integer | No | chain id for which the height needs to be frozen. If not provided, the base L1 light client contract is used. |
95+
| height | integer | Yes | The height from which hotshot is down |
7296

7397
### POST /api/set-hotshot-up
7498

@@ -84,3 +108,9 @@ An example of a `curl` command:
84108
curl -X POST "http://localhost:20000/api/set-hotshot-up" \
85109
-H "Content-Type: application/json"
86110
```
111+
112+
Parameter
113+
114+
| Name | Type | Required | Description |
115+
| -------- | ------- | -------- | --------------------------------------------------------------------------------------------------------------- |
116+
| chain_id | integer | No | chain id for which the height needs to be unfrozen. If not provided, the base L1 light client contract will be used. |

sequencer/src/bin/espresso-dev-node.rs

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ use vbs::version::StaticVersionType;
4040

4141
#[derive(Clone, Debug, Parser)]
4242
struct Args {
43-
/// A JSON-RPC endpoint for the L1 to deploy to. If this is not provided, an Avil node will be
44-
/// launched automatically.
43+
/// A JSON-RPC endpoint for the L1 to deploy to.
44+
/// If this is not provided, an Avil node will be launched automatically.
4545
#[clap(short, long, env = "ESPRESSO_SEQUENCER_L1_PROVIDER")]
4646
rpc_url: Option<Url>,
4747
/// Mnemonic for an L1 wallet.
4848
///
49-
/// This wallet is used to deploy the contracts, so the account indicated by ACCOUNT_INDEX must
50-
/// be funded with with ETH.
49+
/// This wallet is used to deploy the contracts,
50+
/// so the account indicated by ACCOUNT_INDEX must be funded with with ETH.
5151
#[clap(
5252
long,
5353
name = "MNEMONIC",
@@ -64,27 +64,33 @@ struct Args {
6464
)]
6565
account_index: u32,
6666

67-
/// Optional list of URLs representing alternate chains where the dev node will deploy LC contracts
68-
/// and submit LC state updates.
67+
/// The frequency of updating the light client state, expressed in update interval
68+
#[clap( long, value_parser = parse_duration, default_value = "20s", env = "ESPRESSO_STATE_PROVER_UPDATE_INTERVAL")]
69+
update_interval: Duration,
70+
71+
/// Interval between retries if a state update fails
72+
#[clap(long , value_parser = parse_duration, default_value = "2s", env = "ESPRESSO_STATE_PROVER_RETRY_INTERVAL")]
73+
retry_interval: Duration,
74+
75+
/// Optional list of URLs representing alternate chains
76+
/// where the dev node will deploy LC contracts and submit LC state updates.
6977
///
7078
/// Useful for test environments involving L3s.
7179
#[arg(long, env = "ESPRESSO_DEPLOYER_ALT_CHAIN_PROVIDERS", num_args = 1.., value_delimiter = ',')]
7280
alt_chain_providers: Vec<Url>,
7381

74-
/// Optional list of mnemonics for the alternate chains. If there are fewer mnemonics provided than chains, the base MNEMONIC will be used.
82+
/// Optional list of mnemonics for the alternate chains.
83+
/// If there are fewer mnemonics provided than chains, the base MNEMONIC will be used.
7584
#[arg(long, env = "ESPRESSO_DEPLOYER_ALT_MNEMONICS", num_args = 1.., value_delimiter = ',')]
7685
alt_mnemonics: Vec<String>,
7786

78-
/// The frequency of updating the light client state, expressed in update interval
79-
#[clap( long, value_parser = parse_duration, default_value = "20s", env = "ESPRESSO_STATE_PROVER_UPDATE_INTERVAL")]
80-
update_interval: Duration,
87+
/// Alternate account indices generated by the mnemonics to use when deploying the contracts.
88+
/// If there are fewer indices provided than chains, the base ACCOUNT_INDEX will be used.
89+
#[clap(long, env = "ESPRESSO_SEQUENCER_DEPLOYER_ALT_INDICES")]
90+
alt_account_indices: Vec<u32>,
8191

82-
/// Interval between retries if a state update fails
83-
#[clap(long , value_parser = parse_duration, default_value = "2s", env = "ESPRESSO_STATE_PROVER_RETRY_INTERVAL")]
84-
retry_interval: Duration,
8592
/// The frequency of updating the light client state for alt chains.
8693
/// If there are fewer intervals provided than chains, the base update interval will be used.
87-
8894
#[clap(long, value_parser = parse_duration, env = "ESPRESSO_STATE_PROVER_ALT_UPDATE_INTERVALS", num_args = 1.., value_delimiter = ',')]
8995
alt_prover_update_intervals: Vec<Duration>,
9096

@@ -93,14 +99,6 @@ struct Args {
9399
#[clap(long, value_parser = parse_duration, env = "ESPRESSO_STATE_PROVER_ALT_RETRY_INTERVALS", num_args = 1.., value_delimiter = ',')]
94100
alt_prover_retry_intervals: Vec<Duration>,
95101

96-
/// Alternate account indices generated by the mnemonics to use when deploying the contracts. If there are fewer indices provided than chains, the base ACCOUNT_INDEX will be used.
97-
#[clap(
98-
long,
99-
env = "ESPRESSO_SEQUENCER_DEPLOYER_ALT_INDICES",
100-
default_value = "0"
101-
)]
102-
alt_account_indices: Vec<u32>,
103-
104102
/// Port that the HTTP API will use.
105103
#[clap(long, env = "ESPRESSO_SEQUENCER_API_PORT")]
106104
sequencer_api_port: u16,
@@ -130,14 +128,6 @@ struct Args {
130128
logging: logging::Config,
131129
}
132130

133-
#[derive(Debug, Clone, Serialize, Deserialize)]
134-
struct AltChainInfo {
135-
pub chain_id: u64,
136-
pub provider_url: Url,
137-
pub light_client_address: Address,
138-
pub prover_port: u16,
139-
}
140-
141131
#[async_std::main]
142132
async fn main() -> anyhow::Result<()> {
143133
let cli_params = Args::parse();
@@ -484,6 +474,14 @@ struct DevInfo {
484474
pub alt_chains: Vec<AltChainInfo>,
485475
}
486476

477+
#[derive(Debug, Clone, Serialize, Deserialize)]
478+
struct AltChainInfo {
479+
pub chain_id: u64,
480+
pub provider_url: Url,
481+
pub light_client_address: Address,
482+
pub prover_port: u16,
483+
}
484+
487485
#[derive(Debug, Serialize, Deserialize)]
488486
struct SetHotshotDownReqBody {
489487
// return l1 light client address if not provided

0 commit comments

Comments
 (0)