Skip to content

Commit cf458a0

Browse files
authored
docs(consensus): update decentralization guide (#3343)
Update decentralization guide with more complete instructions.
1 parent b12da8d commit cf458a0

File tree

14 files changed

+196
-107
lines changed

14 files changed

+196
-107
lines changed

core/bin/snapshots_creator/README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,8 @@ repository root. The storage location can be configured using the object store c
4343
filesystem, or Google Cloud Storage (GCS). Beware that for end-to-end testing of snapshot recovery, changes applied to
4444
the main node configuration must be reflected in the external node configuration.
4545

46-
Creating a snapshot is a part of the [snapshot recovery integration test]. You can run the test using
47-
`yarn recovery-test snapshot-recovery-test`. It requires the main node to be launched with a command like
48-
`zk server --components api,tree,eth,state_keeper,commitment_generator`.
46+
Creating a snapshot is a part of the [snapshot recovery integration test]. You can run the test using `yarn recovery-test snapshot-recovery-test`.
47+
It requires the main node to be launched with a command like `zk server --components api,tree,eth,state_keeper,commitment_generator`.
4948

5049
## Snapshots format
5150

@@ -59,8 +58,8 @@ Each snapshot consists of three types of data (see [`snapshots.rs`] for exact de
5958
enumeration index; both are used to restore the contents of the `initial_writes` table. Chunking storage logs is
6059
motivated by their parallel generation; each chunk corresponds to a distinct non-overlapping range of hashed storage
6160
keys. (This should be considered an implementation detail for the purposes of snapshot recovery; recovery must not
62-
rely on any particular key distribution among chunks.) Stored as gzipped Protobuf messages in an [object store]; each
63-
chunk is a separate object.
61+
rely on any particular key distribution among chunks.) Stored as gzipped Protobuf messages in an [object store]; each chunk
62+
is a separate object.
6463
- **Factory dependencies:** All bytecodes deployed on L2 at the time the snapshot is made. Stored as a single gzipped
6564
Protobuf message in an object store.
6665

core/lib/merkle_tree/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Merkle Tree
22

3-
Binary Merkle tree implementation based on amortized radix-16 Merkle tree (AR16MT) described in the [Jellyfish Merkle
4-
tree] white paper. Unlike Jellyfish Merkle tree, our construction uses vanilla binary tree hashing algorithm to make it
5-
easier for the circuit creation. The depth of the tree is 256, and Blake2 is used as the hashing function.
3+
Binary Merkle tree implementation based on amortized radix-16 Merkle tree (AR16MT) described in the [Jellyfish
4+
Merkle tree] white paper. Unlike Jellyfish Merkle tree, our construction uses vanilla binary tree hashing algorithm to
5+
make it easier for the circuit creation. The depth of the tree is 256, and Blake2 is used as the hashing function.
66

77
## Snapshot tests
88

core/tests/recovery-test/src/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,10 @@ export class NodeProcess {
193193
return new NodeProcess(childProcess, logs);
194194
}
195195

196-
private constructor(private childProcess: ChildProcess, readonly logs: FileHandle) {}
196+
private constructor(
197+
private childProcess: ChildProcess,
198+
readonly logs: FileHandle
199+
) {}
197200

198201
exitCode() {
199202
return this.childProcess.exitCode;

core/tests/ts-integration/src/l1-provider.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ class L1TransactionResponse extends ethers.TransactionResponse implements Augmen
2828
private isWaitingReported: boolean = false;
2929
private isReceiptReported: boolean = false;
3030

31-
constructor(base: ethers.TransactionResponse, public readonly reporter: Reporter) {
31+
constructor(
32+
base: ethers.TransactionResponse,
33+
public readonly reporter: Reporter
34+
) {
3235
super(base, base.provider);
3336
}
3437

core/tests/ts-integration/src/retry-provider.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,10 @@ class L2TransactionResponse extends zksync.types.TransactionResponse implements
8181
private isWaitingReported: boolean = false;
8282
private isReceiptReported: boolean = false;
8383

84-
constructor(base: zksync.types.TransactionResponse, public readonly reporter: Reporter) {
84+
constructor(
85+
base: zksync.types.TransactionResponse,
86+
public readonly reporter: Reporter
87+
) {
8588
super(base, base.provider);
8689
}
8790

core/tests/ts-integration/src/utils.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@ export enum NodeType {
5757
}
5858

5959
export class Node<TYPE extends NodeType> {
60-
constructor(public proc: ChildProcessWithoutNullStreams, public l2NodeUrl: string, private readonly type: TYPE) {}
60+
constructor(
61+
public proc: ChildProcessWithoutNullStreams,
62+
public l2NodeUrl: string,
63+
private readonly type: TYPE
64+
) {}
6165

6266
public async terminate() {
6367
try {

core/tests/ts-integration/tests/api/web3.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1232,7 +1232,10 @@ export class MockMetamask {
12321232
readonly isMetaMask: boolean = true;
12331233
readonly chainId: string;
12341234

1235-
constructor(readonly wallet: zksync.Wallet, readonly networkVersion: bigint) {
1235+
constructor(
1236+
readonly wallet: zksync.Wallet,
1237+
readonly networkVersion: bigint
1238+
) {
12361239
this.chainId = ethers.toBeHex(networkVersion);
12371240
}
12381241

core/tests/ts-integration/tests/system.test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -371,9 +371,11 @@ describe('System behavior checks', () => {
371371
function bootloaderUtilsContract() {
372372
const BOOTLOADER_UTILS_ADDRESS = '0x000000000000000000000000000000000000800c';
373373
const BOOTLOADER_UTILS = new ethers.Interface(
374-
require(`${
375-
testMaster.environment().pathToHome
376-
}/contracts/system-contracts/zkout/BootloaderUtilities.sol/BootloaderUtilities.json`).abi
374+
require(
375+
`${
376+
testMaster.environment().pathToHome
377+
}/contracts/system-contracts/zkout/BootloaderUtilities.sol/BootloaderUtilities.json`
378+
).abi
377379
);
378380

379381
return new ethers.Contract(BOOTLOADER_UTILS_ADDRESS, BOOTLOADER_UTILS, alice);

core/tests/upgrade-test/tests/utils.ts

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,13 @@ export function initContracts(pathToHome: string, zkStack: boolean): Contracts {
9393
complexUpgraderAbi: new ethers.Interface(
9494
require(`${CONTRACTS_FOLDER}/system-contracts/zkout/ComplexUpgrader.sol/ComplexUpgrader.json`).abi
9595
),
96-
counterBytecode:
97-
require(`${pathToHome}/core/tests/ts-integration/artifacts-zk/contracts/counter/counter.sol/Counter.json`)
98-
.deployedBytecode,
96+
counterBytecode: require(
97+
`${pathToHome}/core/tests/ts-integration/artifacts-zk/contracts/counter/counter.sol/Counter.json`
98+
).deployedBytecode,
9999
stateTransitonManager: new ethers.Interface(
100-
require(`${CONTRACTS_FOLDER}/l1-contracts/out/StateTransitionManager.sol/StateTransitionManager.json`).abi
100+
require(
101+
`${CONTRACTS_FOLDER}/l1-contracts/out/StateTransitionManager.sol/StateTransitionManager.json`
102+
).abi
101103
)
102104
};
103105
} else {
@@ -116,16 +118,22 @@ export function initContracts(pathToHome: string, zkStack: boolean): Contracts {
116118
require(`${L1_CONTRACTS_FOLDER}/governance/ChainAdmin.sol/ChainAdmin.json`).abi
117119
),
118120
l2ForceDeployUpgraderAbi: new ethers.Interface(
119-
require(`${pathToHome}/contracts/l2-contracts/artifacts-zk/contracts/ForceDeployUpgrader.sol/ForceDeployUpgrader.json`).abi
121+
require(
122+
`${pathToHome}/contracts/l2-contracts/artifacts-zk/contracts/ForceDeployUpgrader.sol/ForceDeployUpgrader.json`
123+
).abi
120124
),
121125
complexUpgraderAbi: new ethers.Interface(
122-
require(`${pathToHome}/contracts/system-contracts/artifacts-zk/contracts-preprocessed/ComplexUpgrader.sol/ComplexUpgrader.json`).abi
126+
require(
127+
`${pathToHome}/contracts/system-contracts/artifacts-zk/contracts-preprocessed/ComplexUpgrader.sol/ComplexUpgrader.json`
128+
).abi
123129
),
124-
counterBytecode:
125-
require(`${pathToHome}/core/tests/ts-integration/artifacts-zk/contracts/counter/counter.sol/Counter.json`)
126-
.deployedBytecode,
130+
counterBytecode: require(
131+
`${pathToHome}/core/tests/ts-integration/artifacts-zk/contracts/counter/counter.sol/Counter.json`
132+
).deployedBytecode,
127133
stateTransitonManager: new ethers.Interface(
128-
require(`${L1_CONTRACTS_FOLDER}/state-transition/StateTransitionManager.sol/StateTransitionManager.json`).abi
134+
require(
135+
`${L1_CONTRACTS_FOLDER}/state-transition/StateTransitionManager.sol/StateTransitionManager.json`
136+
).abi
129137
)
130138
};
131139
}

docs/src/guides/advanced/13_zk_intuition.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ located in a module [zksync core witness]. However, for the new proof system, th
8585
new location called [separate witness binary].
8686

8787
Inside this new location, after the necessary data is fetched from storage, the witness generator calls another piece of
88-
code from [zkevm_test_harness witness] named `run_with_fixed_params`. This code is responsible for creating the
89-
witnesses themselves (which can get really HUGE).
88+
code from [zkevm_test_harness witness] named `run_with_fixed_params`. This code is responsible for creating the witnesses
89+
themselves (which can get really HUGE).
9090

9191
## Generating the Proof
9292

@@ -96,9 +96,9 @@ The main goal of this step is to take an operation (for example, a calculation c
9696
into smaller pieces. Then, we represent this information as a special mathematical expression called a polynomial.
9797

9898
To construct these polynomials, we use something called a `ConstraintSystem`. The specific type that we use is called
99-
zkSNARK, and our custom version of it is named bellman. You can find our code for this in the [bellman repo].
100-
Additionally, we have an optimized version that's designed to run faster on certain types of hardware (using CUDA
101-
technology), which you can find in the [bellman cuda repo].
99+
zkSNARK, and our custom version of it is named bellman. You can find our code for this in the [bellman repo]. Additionally,
100+
we have an optimized version that's designed to run faster on certain types of hardware (using CUDA technology), which you
101+
can find in the [bellman cuda repo].
102102

103103
An [example ecrecover circuit] might give you a clearer picture of what this looks like in practice.
104104

@@ -107,9 +107,9 @@ heavy calculations, we use GPUs to speed things up.
107107

108108
### Where is the Code
109109

110-
The main code that utilizes the GPUs to create proofs is located in a repository named [heavy_ops_service repo]. This
111-
code combines elements from the [bellman cuda repo] that we mentioned earlier, along with a huge amount of data
112-
generated by the witness, to produce the final proofs.
110+
The main code that utilizes the GPUs to create proofs is located in a repository named [heavy_ops_service repo]. This code
111+
combines elements from the [bellman cuda repo] that we mentioned earlier, along with a huge amount of data generated by the
112+
witness, to produce the final proofs.
113113

114114
## What Does "Verify Proof on L1" Mean
115115

0 commit comments

Comments
 (0)