Skip to content

Commit

Permalink
chore: updating api ref docs
Browse files Browse the repository at this point in the history
  • Loading branch information
itsacoyote committed Apr 2, 2024
1 parent 3903211 commit 45718af
Show file tree
Hide file tree
Showing 11 changed files with 2,463 additions and 261 deletions.
File renamed without changes.
874 changes: 874 additions & 0 deletions content/20.api-reference/20.zks-rpc.md

Large diffs are not rendered by default.

183 changes: 0 additions & 183 deletions content/20.api-reference/20.zks.md

This file was deleted.

207 changes: 207 additions & 0 deletions content/20.api-reference/30.debug-rpc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
---
title: Debug JSON-RPC API
description:
github: https://github.com/matter-labs/zksync-era/blob/main/core/lib/web3_decl/src/namespaces/debug.rs
---

## `debug_traceBlockByHash`

Traces all calls made from a specific block by its L2 hash.

| **Parameter** | **Type** | **Description** |
|---------------|------------------------|----------------------------------|
| `hash` | `H256` | The 32 byte hash defining the L2 block. |
| `options` | `TracerConfig` | Optional. See the <a href="https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug#traceconfig" target="_blank">TraceConfig documentation</a> for details. |

### Example Request

```sh
curl --request POST \
--url https://mainnet.era.zksync.io/ \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"id": 1,
"method": "debug_traceBlockByHash",
"params": ["0x4bd0bd4547d8f8a4fc86a024e54558e156c1acf43d82e24733c6dac2fe5c5fc7"]
}'
```

### Example Response

```json
{
"jsonrpc": "2.0",
"result": [
{
"type": "Call",
"from": "0x0000000000000000000000000000000000000000",
"to": "0x0000000000000000000000000000000000008001",
"gas": "0x18be25",
"gasUsed": "0x7603b",
"value": "0xa1e94fc0fe6043",
"output": "0x",
"input": "0x",
"error": null,
"revertReason": null,
"calls": [...]
},
...
]
}
```

---

## `debug_traceBlockByNumber`

Traces all calls made from a specific block by its L2 block number.

| **Parameter** | **Type** | **Description** |
|---------------|------------------------|-----------------------------------|
| `block` | `BlockNumber` | The number of the block to trace. |
| `options` | `TracerConfig` | Optional. See the <a href="https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug#traceconfig" target="_blank">TraceConfig documentation</a> for details. |

### Example Request

```sh
curl --request POST \
--url https://mainnet.era.zksync.io/ \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"id": 1,
"method": "debug_traceBlockByNumber",
"params": ["0x24b258"]
}'
```

### Example Response

```json
{
"jsonrpc": "2.0",
"result": [
{
"result": {
"type": "Call",
"from": "0x0000000000000000000000000000000000000000",
"to": "0x0000000000000000000000000000000000008001",
"gas": "0x18be25",
"gasUsed": "0x7603b",
"value": "0xa1e94fc0fe6043",
"output": "0x",
"input": "0x",
"error": null,
"revertReason": null,
"calls": [...]
},
...
]
}
```

---

## `debug_traceCall`

Traces a call made at a specific block, by block number or hash.

| **Parameter** | **Type** | **Description** |
|---------------|------------------------|----------------------------------------------|
| `request` | `CallRequest` | The call request to trace. |
| `block` | `BlockId` | Optional. The block identifier, by number or hash. |
| `options` | `TracerConfig` | Optional. See the <a href="https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug#traceconfig" target="_blank">TraceConfig documentation</a> for details. |

### Example Request

```sh
curl --request POST \
--url https://mainnet.era.zksync.io/ \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"id": 1,
"method": "debug_traceCall",
"params": [
{
"from": "0x1111111111111111111111111111111111111111",
"to": "0x2222222222222222222222222222222222222222",
"data": "0xffffffff"
},
"0x24b258"
]
}'
```

### Example Response

```json
{
"jsonrpc": "2.0",
"result": {
"type": "Call",
"from": "0x0000000000000000000000000000000000000000",
"to": "0x0000000000000000000000000000000000008001",
"gas": "0x0",
"gasUsed": "0x6b4b",
"value": "0x0",
"output": "0x",
"input": "0xffffffff",
"error": null,
"revertReason": null,
"calls": []
},
"id": 1
}
```

---

## `debug_traceTransaction`

Uses the <a href="https://geth.ethereum.org/docs/developers/evm-tracing/built-in-tracers#call-tracer" target="_block">EVM's `callTracer`</a>
to return a debug trace of a specific transaction given by its transaction hash.

| **Parameter** | **Type** | **Description** |
|---------------|------------------------|---------------------------------------|
| `tx_hash` | `H256` | The 32 byte hash of the transaction to trace. |
| `options` | `TracerConfig` | Optional. See the <a href="https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug#traceconfig" target="_blank">TraceConfig documentation</a> for details. |

### Example Request

```sh
curl --request POST \
--url https://mainnet.era.zksync.io/ \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"id": 1,
"method": "debug_traceTransaction",
"params": ["0x4b228f90e796de5a18227072745b0f28e0c4a4661a339f70d3bdde591d3b7f3a"]
}'
```

### Example Response

```json
{
"jsonrpc": "2.0",
"result": [
{
"type": "Call",
"from": "0x0000000000000000000000000000000000000000",
"to": "0x0000000000000000000000000000000000008001",
"gas": "0x154800",
"gasUsed": "0xc2419",
"value": "0x0",
"output": "0x",
"input": "0x095ea7b30000000000000000000000002da10a1e27bf85cedd8ffb1abbe97e53391c0295ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"error": null,
"revertReason": null,
"calls": [...]
},
...
]
}
```
Loading

0 comments on commit 45718af

Please sign in to comment.