Skip to content

Commit 22ee224

Browse files
authored
docs: fix examples and sdk spec (#1819)
1 parent c237af4 commit 22ee224

File tree

3 files changed

+18
-92
lines changed

3 files changed

+18
-92
lines changed

batcher/aligned-sdk/src/sdk.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ async fn fetch_gas_price(
196196

197197
/// Submits multiple proofs to the batcher to be verified in Aligned.
198198
/// # Arguments
199-
/// * `network` - The netork on which the verification will be done.
199+
/// * `network` - The network on which the verification will be done.
200200
/// * `verification_data` - An array of verification data of each proof.
201201
/// * `max_fees` - An array of the maximum fee that the submitter is willing to pay for each proof verification.
202202
/// * `wallet` - The wallet used to sign the proof.
@@ -367,7 +367,7 @@ pub async fn submit_and_wait_verification(
367367

368368
/// Submits a proof to the batcher to be verified in Aligned.
369369
/// # Arguments
370-
/// * `chain` - The chain on which the verification will be done.
370+
/// * `network` - The network on which the verification will be done.
371371
/// * `verification_data` - The verification data of the proof.
372372
/// * `max_fee` - The maximum fee that the submitter is willing to pay for the verification.
373373
/// * `wallet` - The wallet used to sign the proof.

docs/3_guides/0_submitting_proofs.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,14 @@ Proof submission is done via the `submit` command of the Aligned CLI. The argume
109109
* `proof`: The path of the proof associated to the computation to be verified.
110110
* `vm_program`: When the proving system involves the execution of a program in a zkVM, this argument is associated with the compiled program or some other identifier of the program.
111111
* `pub_input`: The path to the file with the public input associated with the proof.
112-
* `batcher_url`: The batcher websocket URL. Can be:
113-
* mainnet: `wss://mainnet.batcher.alignedlayer.com`
114-
* holesky: `wss://batcher.alignedlayer.com`
115-
* devnet: `ws://localhost:8080`
116-
* `network` to specify the network to be used. Can be `devnet`, `holesky` or `mainnet`.
112+
* One of the following, to specify which Network to interact with:
113+
- `--network <working_network_name>`: Network name to interact with.
114+
- Default: `devnet`
115+
- Possible values: `devnet`, `holesky`, `mainnet`
116+
- For a custom Network, you must specify the following parameters:
117+
- `--aligned_service_manager <aligned_service_manager_contract_address>`
118+
- `--batcher_payment_service <batcher_payment_service_contract_address>`
119+
- `--batcher_url <batcher_websocket_url>`
117120
* `rpc_url`: The RPC Ethereum node URL.
118121
* `proof_generator_addr`: An optional parameter that can be used in some applications to avoid front-running.
119122
* `batch_inclusion_data_directory_path`: An optional parameter indicating the directory where to store the batcher response data. If not provided, the folder with the responses will be created in the current directory.
@@ -130,7 +133,6 @@ aligned submit \
130133
--proving_system SP1 \
131134
--proof <proof_file> \
132135
--vm_program <vm_program_file> \
133-
--batcher_url wss://batcher.alignedlayer.com \
134136
--proof_generator_addr [proof_generator_addr] \
135137
--batch_inclusion_data_directory_path [batch_inclusion_data_directory_path] \
136138
--keystore_path <path_to_ecdsa_keystore> \
@@ -165,7 +167,6 @@ aligned submit \
165167
--proof <proof_file> \
166168
--vm_program <vm_program_file> \
167169
--pub_input <pub_input_file> \
168-
--batcher_url wss://batcher.alignedlayer.com \
169170
--proof_generator_addr [proof_generator_addr] \
170171
--batch_inclusion_data_directory_path [batch_inclusion_data_directory_path] \
171172
--keystore_path <path_to_ecdsa_keystore> \

docs/3_guides/1.2_SDK_api_reference.md

Lines changed: 8 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ Submits a proof to the batcher to be verified and returns an aligned verificatio
88

99
```rust
1010
pub async fn submit(
11-
batcher_url: &str,
1211
network: Network,
1312
verification_data: &VerificationData,
1413
max_fee; U256,
@@ -19,10 +18,6 @@ pub async fn submit(
1918

2019
#### Arguments
2120

22-
- `batcher_url` - The url of the batcher to which the proof will be submitted:
23-
- mainnet: `wss://mainnet.batcher.alignedlayer.com`
24-
- holesky: `wss://batcher.alignedlayer.com`
25-
- devnet: `ws://localhost:8080`
2621
- `network` - The network on which the proof will be submitted (`devnet | holesky | mainnet`)
2722
- `verification_data` - The verification data for the proof.
2823
- `max_fee` - The maximum fee that the submitter is willing to pay for the proof verification.
@@ -57,7 +52,6 @@ Submits multiple proofs to the batcher to be verified and returns an aligned ver
5752

5853
```rust
5954
pub async fn submit_multiple(
60-
batcher_url: &str,
6155
network: Network,
6256
verification_data: &[VerificationData],
6357
max_fees: &[U256],
@@ -68,10 +62,6 @@ pub async fn submit_multiple(
6862

6963
#### Arguments
7064

71-
- `batcher_url` - The url of the batcher to which the proof will be submitted:
72-
- mainnet: `wss://mainnet.batcher.alignedlayer.com`
73-
- holesky: `wss://batcher.alignedlayer.com`
74-
- devnet: `ws://localhost:8080`
7565
- `network` - The network on which the proof will be submitted (`devnet | holesky | mainnet`)
7666
- `verification_data` - A verification data array.
7767
- `max_fees` - A max fee array.
@@ -108,7 +98,6 @@ verification data struct.
10898

10999
```rust
110100
pub async fn submit_and_wait_verification(
111-
batcher_url: &str,
112101
eth_rpc_url: &str,
113102
network: Network,
114103
verification_data: &VerificationData,
@@ -120,18 +109,12 @@ pub async fn submit_and_wait_verification(
120109

121110
#### Arguments
122111

123-
- `batcher_url` - The url of the batcher to which the proof will be submitted
124-
- mainnet: `wss://mainnet.batcher.alignedlayer.com`
125-
- holesky: `wss://batcher.alignedlayer.com`
126-
- devnet: `ws://localhost:8080`
127112
- `eth_rpc_url` - The URL of the Ethereum RPC node.
128113
- `network` - The network on which the verification will be done (`devnet | holesky | mainnet`)
129114
- `verification_data` - The verification data for the proof.
130115
- `max_fee` - The maximum fee that the submitter is willing to pay for the proof verification.
131116
- `wallet` - The wallet used to sign the proof. Should be using correct chain id. See `get_chain_id`.
132117
- `nonce` - The nonce of the submitter address. See `get_nonce_from_ethereum`.
133-
- `payment_service_addr` - The address of the batcher payment service contract.
134-
- `NotAContract(address)` if you are trying to send to an address that is not a contract. This generally occurs if you have misconfigured the `environment` parameter.
135118

136119
#### Returns
137120

@@ -164,30 +147,23 @@ Submits multiple proofs to the batcher for verification, waits for verification
164147

165148
```rust
166149
pub async fn submit_multiple_and_wait_verification(
167-
batcher_url: &str,
168150
eth_rpc_url: &str,
169151
network: Network,
170152
verification_data: &[VerificationData],
153+
max_fee: U256,
171154
wallet: Wallet<SigningKey>,
172-
nonce: U256,
173-
payment_service_addr: &str,
155+
nonce: U256
174156
) -> Vec<Result<AlignedVerificationData, errors::SubmitError>>
175157
```
176158

177159
#### Arguments
178160

179-
- `batcher_url` - The url of the batcher to which the proof will be submitted:
180-
- mainnet: `wss://mainnet.batcher.alignedlayer.com`
181-
- holesky: `wss://batcher.alignedlayer.com`
182-
- devnet: `ws://localhost:8080`
183161
- `eth_rpc_url` - The URL of the Ethereum RPC node.
184162
- `network` - The network on which the verification will be done (`devnet | holesky | mainnet`)
185163
- `verification_data` - A verification data array.
186-
- `max_fees` - A max fee array.
164+
- `max_fee` - The maximum fee that the submitter is willing to pay for the proof verification.
187165
- `wallet` - The wallet used to sign the proof. Should be using correct chain id. See `get_chain_id`.
188166
- `nonce` - The nonce of the submitter address. See `get_nonce_from_ethereum`.
189-
- `payment_service_addr` - The address of the batcher payment service contract.
190-
- `NotAContract(address)` if you are trying to send to an address that is not a contract. This generally occurs if you have misconfigured the `environment` parameter.
191167

192168
#### Returns
193169

@@ -222,8 +198,7 @@ Checks if the proof has been verified with Aligned and is included in the batch
222198
pub async fn is_proof_verified(
223199
aligned_verification_data: AlignedVerificationData,
224200
network: Network,
225-
eth_rpc_url: &str,
226-
payment_service_addr: &str,
201+
eth_rpc_url: &str
227202
) -> Result<bool, errors::VerificationError>
228203
```
229204

@@ -232,7 +207,6 @@ pub async fn is_proof_verified(
232207
- `aligned_verification_data` - The aligned verification data obtained when submitting the proofs.
233208
- `network` - The network on which the verification will be done (`devnet | holesky | mainnet`)
234209
- `eth_rpc_url` - The URL of the Ethereum RPC node.
235-
- `payment_service_addr` - The address of the batcher payment service contract.
236210

237211
#### Returns
238212

@@ -245,24 +219,6 @@ pub async fn is_proof_verified(
245219
- `EthereumCallError` if there is an error in the Ethereum call.
246220
- `HexDecodingError` if there is an error decoding the Aligned service manager contract address.
247221

248-
### `get_commitment`
249-
250-
Generates a keccak256 hash commitment of the verification key.
251-
252-
```rust
253-
pub fn get_commitment(
254-
content: &[u8]
255-
) -> [u8; 32]
256-
```
257-
258-
#### Arguments
259-
260-
- `content` - A byte slice of the verification key.
261-
262-
#### Returns
263-
264-
- `[u8; 32]` - A 32-byte array representing the keccak256 hash of the verification key.
265-
266222
### `get_nonce_from_ethereum`
267223

268224
Returns the nonce for a given address in Ethereum from aligned payment service contract.
@@ -301,17 +257,14 @@ as the batcher proofs might not yet be on ethereum, producing an out-of-sync non
301257

302258
```rust
303259
pub async fn get_nonce_from_batcher(
304-
batcher_ws_url: &str,
260+
network: Network,
305261
address: Address,
306262
) -> Result<U256, GetNonceError> {
307263
```
308264
#### Arguments
309265

310266

311-
- `batcher_url` - The batcher websocket url:
312-
- mainnet: `wss://mainnet.batcher.alignedlayer.com`
313-
- holesky: `wss://batcher.alignedlayer.com`
314-
- devnet: `ws://localhost:8080`
267+
- `network` - The network from which the nonce will be retrieved.
315268
- `address` - The user address for which the nonce will be retrieved.
316269

317270
#### Returns
@@ -353,15 +306,14 @@ priority the user wants to have in the batch, the `estimate` parameter can be se
353306
```rust
354307
pub async fn estimate_fee(
355308
eth_rpc_url: &str,
356-
estimate: PriceEstimate,
309+
fee_estimation_type: FeeEstimationType,
357310
) -> Result<U256, errors::MaxFeeEstimateError>
358311
```
359312

360313
#### Arguments
361314

362315
- `eth_rpc_url` - The URL of the Ethereum RPC node.
363-
- `estimate` - The parameter to set the priority for the proof to be included in the batch. It can be one
364-
of `Min`, `Default` or `Max`.
316+
- `estimate_type` - Enum specifying the type of price estimate: Default, Instant. Custom(usize)
365317

366318
#### Returns
367319

@@ -372,33 +324,6 @@ pub async fn estimate_fee(
372324
- `EthereumProviderError` if there is an error in the connection with the RPC provider.
373325
- `EthereumCallError` if there is an error in the Ethereum call.
374326

375-
### `compute_max_fee`
376-
377-
Computes `max_fee` for a proof based on the number of proofs in a batch (`num_proofs_per_batch`) and number of proofs (`num_proofs`) in that batch the user would pay for i.e (`num_proofs` / `num_proofs_per_batch`).
378-
379-
```rust
380-
pub async fn compute_max_fee(
381-
eth_rpc_url: &str,
382-
num_proofs: usize,
383-
num_proofs_per_batch: usize,
384-
) -> Result<U256, errors::MaxFeeEstimateError>
385-
```
386-
387-
#### Arguments
388-
389-
- `eth_rpc_url` - The URL of the Ethereum RPC node.
390-
- `num_proofs` - The number of proofs in a batch the user would pay for.
391-
- `num_proofs_per_batch` - The number of proofs within a batch.
392-
393-
#### Returns
394-
395-
- `Result<U256, MaxFeeEstimateError>` - The calculated `max_fee` as a `U256`.
396-
397-
#### Errors
398-
399-
- `EthereumProviderError` if there is an error in the connection with the RPC provider.
400-
- `EthereumCallError` if there is an error in the Ethereum call.
401-
402327
### `fee_per_proof`
403328

404329
Returns the `fee_per_proof` based on the current gas price for a batch compromised of `num_proofs_per_batch` i.e. (1 / `num_proofs_per_batch`).

0 commit comments

Comments
 (0)