Skip to content

Commit 2b5b035

Browse files
committed
Update ZKThunder network configuration to testnet environment
- Modify hardhat config to use ZKThunder testnet RPC and verification URLs - Update local-setup README with detailed chain configuration and deployment guide - Change default domain from zkthunder.fi to testnet.zkthunder.fi - Update Blockscout frontend environment to point to testnet endpoints - Adjust L1 block time and chain configuration documentation
1 parent 4e429d4 commit 2b5b035

File tree

4 files changed

+200
-9
lines changed

4 files changed

+200
-9
lines changed

contracts/l2-contracts/hardhat.config.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ export default {
2323
},
2424
defaultNetwork: "localhost",
2525
networks: {
26-
zkthunder: {
27-
url: "https://rpc.zkthunder.fi",
26+
zkthunderTestnet: {
27+
url: "https://rpc.testnet.zkthunder.fi",
2828
ethNetwork: "sepolia",
2929
zksync: true,
30-
verifyURL: "https://l2api.zkthunder.fi/contract_verification",
30+
verifyURL: "https://l2api.testnet.zkthunder.fi/contract_verification",
3131
},
3232
localhost: {
3333
// era-test-node default url

local-setup/README.md

+193-2
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ Your `.env` file must configure the following roles, using addresses that are pr
185185

186186
The Layer 1 chain configuration is defined in `local-setup/reth_chaindata/reth_config`. This file configures the local Ethereum-compatible chain used as the L1 for the zkSync deployment.
187187

188-
##### Chain Parameters
188+
##### L1 Chain Parameters
189189

190190
- `chainId`: 9 - Unique identifier for this development chain
191191
- `gasLimit`: "0x1c9c380" (~30M gas) - Maximum gas per block
@@ -197,9 +197,34 @@ The Layer 1 chain configuration is defined in `local-setup/reth_chaindata/reth_c
197197
##### Network Configuration
198198

199199
- All major Ethereum upgrades (Homestead, EIP150, EIP155, DAO Fork, Frontier, Byzantium, Constantinople, Petersburg, Muir Glacier, Istanbul, Berlin, London, Shanghai, Cancun) are activated from block 0
200-
- Uses Clique PoA consensus with 0 period (instant blocks) and 30000 epoch length
200+
- Uses Clique PoA consensus with 6s period and 30000 epoch length
201201
- Terminal Total Difficulty is set to 0 (post-merge from start)
202202

203+
##### Configuring L1 Block Time
204+
205+
The L1 block time can be configured in the `docker-compose.yml` file through the Reth node service configuration. By default, it's set to 6 seconds (6000ms):
206+
207+
```yaml
208+
reth:
209+
command: >
210+
node --metrics 0.0.0.0:9001
211+
--dev
212+
--datadir /rethdata
213+
--http
214+
--http.corsdomain "*"
215+
--http.addr 0.0.0.0
216+
--http.port 8545
217+
--dev.block-time 6000ms
218+
--chain /chaindata/reth_config
219+
```
220+
221+
To adjust the block time:
222+
223+
1. Modify the `--dev.block-time` parameter in the `reth` service command
224+
2. Values are specified in milliseconds (e.g., `6000ms` for 6 seconds)
225+
3. Shorter block times (e.g., `1000ms`) will result in faster L1 block production but may increase resource usage
226+
4. Longer block times (e.g., `12000ms`) will reduce resource usage but slow down L1 transaction confirmations
227+
203228
##### Important Notes
204229

205230
1. All addresses used in your environment configuration MUST be pre-funded in the reth_config `alloc` section
@@ -242,6 +267,81 @@ Example configuration (before manual replacement):
242267
}
243268
```
244269

270+
## ⛓️ Chain Configuration
271+
272+
### Block and Batch Structure
273+
274+
ZK Thunder uses a hierarchical structure to process transactions:
275+
276+
1. **Transactions**: Individual user operations
277+
2. **L2 Blocks (Miniblocks)**: Collections of transactions processed together
278+
3. **L1 Batches**: Groups of L2 blocks that are proven and committed to L1
279+
280+
### Block Times and Batch Sizes
281+
282+
#### L2 Block Configuration
283+
284+
- **L2 Block Commit Deadline**: `CHAIN_STATE_KEEPER_MINIBLOCK_COMMIT_DEADLINE_MS=1000` (1 second)
285+
- Controls how frequently L2 blocks are created
286+
- New L2 blocks are sealed either when this time passes or when other criteria are met
287+
288+
- **L2 Block Max Payload Size**: `CHAIN_STATE_KEEPER_MINIBLOCK_MAX_PAYLOAD_SIZE=1000000` (1MB)
289+
- Maximum size of an L2 block's payload in bytes
290+
- Blocks will be sealed when they approach this limit
291+
292+
#### L1 Batch Configuration
293+
294+
- **L1 Batch Commit Deadline**: `CHAIN_STATE_KEEPER_BLOCK_COMMIT_DEADLINE_MS=30000` (30 seconds)
295+
- Maximum time before an L1 batch is unconditionally sealed
296+
- Critical for controlling the timing of proof generation and L1 commitments
297+
298+
- **Transaction Slots**: `CHAIN_STATE_KEEPER_TRANSACTION_SLOTS=250`
299+
- Maximum number of transactions that can be included in an L1 batch
300+
- Batches will be sealed when this limit is reached
301+
302+
- **Max Gas Per Batch**: `CHAIN_STATE_KEEPER_MAX_GAS_PER_BATCH=200000000` (200M)
303+
- Maximum amount of gas that can be used in a single L1 batch
304+
- Derived from circuit limitations per batch
305+
306+
- **Max Pubdata Per Batch**: `CHAIN_STATE_KEEPER_MAX_PUBDATA_PER_BATCH=100000` (100KB)
307+
- Maximum amount of pubdata (in bytes) that can be published per batch
308+
- Affects blob usage: <126KB uses 1 blob, 126-252KB uses 2 blobs
309+
310+
- **Max Circuits Per Batch**: `CHAIN_STATE_KEEPER_MAX_CIRCUITS_PER_BATCH=24100`
311+
- Maximum number of circuits that a batch can support
312+
- Refers to "base layer" circuits, not including recursion layers
313+
314+
#### Sealing Criteria
315+
316+
Blocks and batches can be sealed (closed for new transactions) based on several criteria:
317+
318+
- **Geometry Percentage**: Controls sealing based on payload size
319+
- `CHAIN_STATE_KEEPER_CLOSE_BLOCK_AT_GEOMETRY_PERCENTAGE=0.95` (95%)
320+
- `CHAIN_STATE_KEEPER_REJECT_TX_AT_GEOMETRY_PERCENTAGE=0.95` (95%)
321+
322+
- **Gas Percentage**: Controls sealing based on gas usage
323+
- `CHAIN_STATE_KEEPER_CLOSE_BLOCK_AT_GAS_PERCENTAGE=0.95` (95%)
324+
- `CHAIN_STATE_KEEPER_REJECT_TX_AT_GAS_PERCENTAGE=0.95` (95%)
325+
326+
- **ETH Params Percentage**: Controls sealing based on L1 parameters
327+
- `CHAIN_STATE_KEEPER_CLOSE_BLOCK_AT_ETH_PARAMS_PERCENTAGE=0.95` (95%)
328+
- `CHAIN_STATE_KEEPER_REJECT_TX_AT_ETH_PARAMS_PERCENTAGE=0.95` (95%)
329+
330+
### Fee Model Configuration
331+
332+
- **Fee Model Version**: `CHAIN_STATE_KEEPER_FEE_MODEL_VERSION=V2`
333+
- V2 allows pubdata price to be independent from L1 gas price
334+
- L2 gas price includes both proving/computation costs and L1 batch processing costs
335+
336+
- **Minimal L2 Gas Price**: `CHAIN_STATE_KEEPER_MINIMAL_L2_GAS_PRICE=100000000` (100 Gwei)
337+
- Minimum acceptable gas price for L2 transactions
338+
- Includes cost of computation/proving and congestion premium
339+
340+
- **Overhead Configuration**:
341+
- `CHAIN_STATE_KEEPER_COMPUTE_OVERHEAD_PART=0.0` (0%)
342+
- `CHAIN_STATE_KEEPER_PUBDATA_OVERHEAD_PART=1.0` (100%)
343+
- `CHAIN_STATE_KEEPER_BATCH_OVERHEAD_L1_GAS=800000` (800K gas)
344+
245345
Required manual replacements:
246346

247347
1. Replace `${APP_DOMAIN}` with your actual domain name (e.g., if APP_DOMAIN=example.com in your .env, replace all instances with "example.com")
@@ -552,3 +652,94 @@ Options:
552652
- `--help`: Displays help message
553653

554654
Preserving SSL certificates (default behavior) is useful for faster redeployment since you won't need to regenerate them.
655+
656+
## 🚀 Deploying Changes to Production
657+
658+
When you need to apply changes to the production environment, you'll need to follow a specific workflow to ensure your changes are properly built, tagged, and deployed.
659+
660+
### Step-by-Step Deployment Guide
661+
662+
1. **Make and Test Your Changes Locally**
663+
- Develop and test your changes in a local development environment
664+
- Ensure all tests pass and the application works as expected
665+
666+
2. **Create and Push a Release Tag**
667+
- The tag format must follow the pattern: `vX.Y.Z-zkthunder`
668+
- Example: `v1.2.3-zkthunder`
669+
670+
```bash
671+
# Create the tag
672+
git tag v1.2.3-zkthunder
673+
674+
# Push the tag to the remote repository
675+
git push origin v1.2.3-zkthunder
676+
```
677+
678+
3. **Wait for CI/CD Pipeline**
679+
- The CI/CD pipeline will automatically:
680+
- Detect the new tag
681+
- Build the Docker image
682+
- Push the image to DockerHub with the appropriate tag
683+
- You can monitor the build progress in your CI/CD dashboard
684+
685+
4. **Deploy the New Image to Production**
686+
- SSH into your production server
687+
- Navigate to your deployment directory
688+
689+
```bash
690+
cd /path/to/local-setup
691+
```
692+
693+
- Pull the latest Docker image
694+
695+
```bash
696+
docker pull ${DOCKER_REGISTRY_ACCOUNT}/<service-name>:zkthunder
697+
```
698+
699+
- Restart the affected service(s)
700+
701+
```bash
702+
# To restart a specific service
703+
docker compose up -d <service-name>
704+
705+
# Or to pull and restart all services if needed
706+
./start.sh
707+
```
708+
709+
5. **Verify the Deployment**
710+
- Check that the service is running with the new version
711+
712+
```bash
713+
docker compose ps
714+
```
715+
716+
- Verify the application is functioning correctly by accessing it through your browser
717+
- Check the logs for any errors
718+
719+
```bash
720+
docker compose logs -f <service-name>
721+
```
722+
723+
### Important Notes
724+
725+
- **Version Numbering**: Follow semantic versioning (X.Y.Z):
726+
- X: Major version (breaking changes)
727+
- Y: Minor version (new features, no breaking changes)
728+
- Z: Patch version (bug fixes)
729+
730+
- **Tag Format**: The `-zkthunder` suffix is required for the CI/CD pipeline to recognize it as a production release
731+
732+
- **Rollback Procedure**: If issues are detected, you can roll back to a previous version:
733+
734+
```bash
735+
# Pull the previous working version
736+
docker pull ${DOCKER_REGISTRY_ACCOUNT}/<service-name>:previous-tag
737+
738+
# Update your docker-compose.yml to use the previous version
739+
# Then restart the service
740+
docker compose up -d --no-deps <service-name>
741+
```
742+
743+
- **Environment Variables**: Ensure any new environment variables required by your changes are properly set in the production environment's `.env` file
744+
745+
By following this deployment workflow, you can ensure smooth and consistent updates to your production environment.

local-setup/blockscout/common-frontend.env

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
NEXT_PUBLIC_API_HOST=l1api.zkthunder.fi
1+
NEXT_PUBLIC_API_HOST=l1api.testnet.zkthunder.fi
22
NEXT_PUBLIC_API_PROTOCOL=https
33
NEXT_PUBLIC_STATS_API_HOST=
44
NEXT_PUBLIC_NETWORK_NAME=L1 ZK Chain
@@ -8,10 +8,10 @@ NEXT_PUBLIC_NETWORK_CURRENCY_NAME=Ether
88
NEXT_PUBLIC_NETWORK_CURRENCY_SYMBOL=ETH
99
NEXT_PUBLIC_NETWORK_CURRENCY_DECIMALS=18
1010
NEXT_PUBLIC_API_BASE_PATH=/
11-
NEXT_PUBLIC_APP_HOST=l1explorer.zkthunder.fi
11+
NEXT_PUBLIC_APP_HOST=l1explorer.testnet.zkthunder.fi
1212
NEXT_PUBLIC_APP_PROTOCOL=https
1313
NEXT_PUBLIC_HOMEPAGE_CHARTS=['daily_txs']
14-
NEXT_PUBLIC_VISUALIZE_API_HOST=https://l1api.zkthunder.fi
14+
NEXT_PUBLIC_VISUALIZE_API_HOST=https://l1api.testnet.zkthunder.fi
1515
NEXT_PUBLIC_IS_TESTNET=true
1616
NEXT_PUBLIC_API_WEBSOCKET_PROTOCOL=wss
1717
NEXT_PUBLIC_API_SPEC_URL=https://raw.githubusercontent.com/blockscout/blockscout-api-v2-swagger/main/swagger.yaml

local-setup/start.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# latest2.0 - is the 'main' one.
88

99
INSTANCE_TYPE=${1:-zkthunder}
10-
APP_DOMAIN='zkthunder.fi'
10+
APP_DOMAIN='testnet.zkthunder.fi'
1111

1212
export INSTANCE_TYPE=$INSTANCE_TYPE
1313

0 commit comments

Comments
 (0)