Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wiki docs migrated to Edge repo #2052

Merged
merged 14 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,12 @@ node_modules

vendor/
coverage.out

# for the docs folder
.code
docs/site/
docs/venv/
docs/env/
*.out
node_modules/
*.iml
17 changes: 17 additions & 0 deletions docs/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM python:3.9-alpine

# Install system dependencies
RUN apk update && \
apk add --no-cache rsync git nodejs npm && \
rm -rf /var/cache/apk/*

# Copy and install Python dependencies
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt --no-cache-dir

# Switch to a non-root user (if 'nonroot' is already created)
USER nonroot

# Build doc by default
ENTRYPOINT ["mkdocs"]
CMD ["serve", "--dev-addr", "0.0.0.0:8000"]
48 changes: 48 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Polygon Edge docs

Welcome to the Polygon Edge documentation, built with [the Material theme for MkDocs](https://squidfunk.github.io/mkdocs-material/).

## Build and serve the site

### Clone the repo

```sh
https://github.com/0xPolygon/polygon-edge.git
cd polygon-edge/wiki-docs
```

### Run with Python

1. Download and install Python 3.11: https://www.python.org/downloads/

2. Install the `virtualenv` package:

```sh
pip install virtualenv
```

3. Build and serve the html

```sh
./run.sh
```

The site runs at: http://127.0.0.1:8000/

### Run with Docker

:warning: Remove line 10 from the `Dockerfile` to run locally.

1. Spin up the image:

```sh
docker build -t polygon-edge-docs .
```

2. Run the container:

```
docker compose up
```

The site runs at: http://127.0.0.1:8000/
13 changes: 13 additions & 0 deletions docs/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: "3.6"

services:
developer-docs:
image: "polygon-edge-docs"
ports:
- "0.0.0.0:8000:8000"
container_name: "serve-edge-docs"
working_dir: /workspace/
volumes:
- type: bind
source: .
target: /workspace
31 changes: 31 additions & 0 deletions docs/docs/api/json-rpc-bridge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
## bridge_generateExitProof

Returns the proof for a given exit event. Used by users that want to exit the L2 chain and withdraw tokens to L1.

### Parameters

**exitID** - ID of the exit event submitted by L2StateSender contract when the user wants to exit the L2 contract.

### Returns


- **Object** - A proof object containing:
- **Array of hashes** - representing the proof of membership of a given exit event on some checkpoint.
- **Map** - containing a leaf index of given exit event in the Merkle tree, Exit event and block number in which checkpoint that contains a given exit event was submitted to the rootchain.

---

## bridge_getStateSyncProof

Returns the proof for a given state sync event. Used by users (Relayer) when they want to execute a state change on the childchain (for example, depositing funds from L1 to L2).

### Parameters

**stateSyncID** - ID of the state sync event submitted by StateSender contract.

### Returns


- **Object** - A proof object containing:
- **Array of hashes** - representing the proof of membership of a given state sync event on some commitment.
- **Map** - containing the state sync event data.
137 changes: 137 additions & 0 deletions docs/docs/api/json-rpc-debug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
To enable the debug route namespace, you need to modify the configuration and add the "debug" parameter as shown below:

```
[jsonrpc.http]
enabled = true
port = 8545
host = "0.0.0.0"
api = ["eth", "net", "web3", "txpool", "bor", "debug"]
```

## debug_traceBlockByNumber

Executes all transactions in the block specified by number with a tracer and returns the tracing result.

### Parameters

* <b>QUANTITY|TAG </b> - integer of a block number, or the string "latest"
* <b> Object </b> - The tracer options:

+ <b> enableMemory: Boolean </b> - (optional, default: false) The flag indicating enabling memory capture.
+ <b> disableStack: Boolean </b> - (optional, default: false) The flag indicating disabling stack capture.
+ <b> disableStorage: Boolean </b> - (optional, default: false) The flag indicating disabling storage capture.
+ <b> enableReturnData: Boolean </b> - (optional, default: false) The flag indicating enabling return data capture.
+ <b> timeOut: String </b> - (optional, default: "5s") The timeout for cancellation of execution.
+ <b> tracer: String </b> - (default: "structTracer") Defines the debug tracer used for given call. Supported values: structTracer, callTracer.


### Returns

<b> Array </b> - Array of trace objects with the following fields:

* <b> failed: Boolean </b> - the tx is successful or not
* <b> gas: QUANTITY </b> - the total consumed gas in the tx
* <b> returnValue: DATA </b> - the return value of the executed contract call
* <b> structLogs: Array </b> - the trace result of each step with the following fields:

+ <b> pc: QUANTITY </b> - the current index in bytecode
+ <b> op: String </b> - the name of current executing operation
+ <b> gas: QUANTITY </b> - the available gas ßin the execution
+ <b> gasCost: QUANTITY </b> - the gas cost of the operation
+ <b> depth: QUANTITY </b> - the number of levels of calling functions
+ <b> error: String </b> - the error of the execution
+ <b> stack: Array </b> - array of values in the current stack
+ <b> memory: Array </b> - array of values in the current memory
+ <b> storage: Object </b> - mapping of the current storage
+ <b> refund: QUANTITY </b> - the total of current refund value

### Example

````bash
curl https://rpc-endpoint.io:8545 -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"debug_traceBlockByNumber","params":["latest"],"id":1}'
````

## debug_traceBlockByHash

Executes all transactions in the block specified by block hash with a tracer and returns the tracing result.

### Parameters

* <b> DATA , 32 Bytes </b> - Hash of a block.
* <b> Object </b> - The tracer options. See debug_traceBlockByNumber for more details.

### Returns

<b> Array </b> - Array of trace objects. See debug_traceBlockByNumber for more details.

### Example

````bash
curl https://rpc-endpoint.io:8545 -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"debug_traceBlockByHash","params":["0xdc0818cf78f21a8e70579cb46a43643f78291264dda342ae31049421c82d21ae"],"id":1}'
````

## debug_traceBlock

Executes all transactions in the block given from the first argument with a tracer and returns the tracing result.

### Parameters

* <b> DATA </b> - RLP Encoded block bytes
* <b> Object </b> - The tracer options. See debug_traceBlockByNumber for more details.

### Returns

<b> Array </b> - Array of trace objects. See debug_traceBlockByNumber for more details.

### Example

````bash
curl https://rpc-endpoint.io:8545 -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"debug_traceBlock","params":["0xf9...."],"id":1}'
````

## debug_traceTransaction

Executes the transaction specified by transaction hash with a tracer and returns the tracing result.

### Parameters

* <b> DATA , 32 Bytes </b> - Hash of a transaction.
* <b> Object </b> - The tracer options. See debug_traceBlockByNumber for more details.

### Returns

<b> Object </b> - Trace object. See debug_traceBlockByNumber for more details.

### Example

````bash
curl https://rpc-endpoint.io:8545 -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"debug_traceTransaction","params":["0xdc0818cf78f21a8e70579cb46a43643f78291264dda342ae31049421c82d21ae"],"id":1}'
````

## debug_traceCall

Executes a new message call with a tracer and returns the tracing result.

### Parameters

* <b> Object </b> - The transaction call object

+ <b> from: DATA, 20 Bytes </b> - (optional) The address the transaction is sent from.
+ <b> to: DATA, 20 Bytes </b> - The address the transaction is directed to.
+ <b> gas: QUANTITY </b> - (optional) Integer of the gas provided for the transaction execution. eth_call consumes zero gas, but this parameter may be needed by some executions.
+ <b> gasPrice: QUANTITY </b> - (optional) Integer of the gasPrice used for each paid gas
+ <b> value: QUANTITY </b> - (optional) Integer of the value sent with this transaction
+ <b> data: DATA </b> - (optional) Hash of the method signature and encoded parameters. For details see Ethereum Contract ABI in the Solidity documentation

* <b> QUANTITY|TAG </b> - integer block number, or the string "latest"
* <b> Object </b> - The tracer options. See debug_traceBlockByNumber for more details.

### Returns

<b> Object </b> - Trace object. See debug_traceBlockByNumber for more details.

### Example

````bash
curl https://rpc-endpoint.io:8545 -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"debug_traceCall","params":[{"to": "0x1234", "data": "0x1234"}, "latest", {}],"id":1}'
````
Loading
Loading