diff --git a/wiki-docs/docs/api/json-rpc-debug.md b/wiki-docs/docs/api/json-rpc-debug.md index 257b9bf857..117550f5dd 100644 --- a/wiki-docs/docs/api/json-rpc-debug.md +++ b/wiki-docs/docs/api/json-rpc-debug.md @@ -22,6 +22,8 @@ Executes all transactions in the block specified by number with a tracer and ret + disableStorage: Boolean - (optional, default: false) The flag indicating disabling storage capture. + enableReturnData: Boolean - (optional, default: false) The flag indicating enabling return data capture. + timeOut: String - (optional, default: "5s") The timeout for cancellation of execution. + + tracer: String - (default: "structTracer") Defines the debug tracer used for given call. Supported values: structTracer, callTracer. + ### Returns diff --git a/wiki-docs/docs/contracts/validator-queue.md b/wiki-docs/docs/contracts/validator-queue.md deleted file mode 100644 index 4e18e4ed8f..0000000000 --- a/wiki-docs/docs/contracts/validator-queue.md +++ /dev/null @@ -1,118 +0,0 @@ -## Overview - -`ValidatorQueue` is a library that can be used to manage a queue of -updates to block validators. The queue is used to register new validators, -add or remove stake, delegate or undelegate stake. - -The queue is processed and cleared at the end of each epoch. - -## Functions - -### insert - -```js -function insert( - ValidatorQueue storage self, - address validator, - int256 stake, - int256 delegation -) internal { - uint256 index = self.indices[validator]; - if (index == 0) { - // insert into queue - // use index starting with 1, 0 is empty by default for easier checking of pending balances - index = self.queue.length + 1; - self.indices[validator] = index; - self.queue.push(QueuedValidator(validator, stake, delegation)); - } else { - // update values - QueuedValidator storage queuedValidator = self.queue[indexOf(self, validator)]; - queuedValidator.stake += stake; - queuedValidator.delegation += delegation; - } -} -``` - -This function is used to queue a validator's `data`. -It takes three arguments: the `ValidatorQueue` struct, the `address` of the validator and -the change to the validator's `stake` and `delegation`. If the validator is not already -in the queue, the validator is added to the queue by adding a new `QueuedValidator` to the -queue array and updating the mapping of validator addresses to their position in the queue. - -If the validator is already in the queue, the function updates the values of the -validator's `stake` and `delegation` in the `QueuedValidator` struct. - -### resetIndex - -```js -function resetIndex(ValidatorQueue storage self, address validator) internal { - self.indices[validator] = 0; -} -``` - -This function is used to delete `data` from a specific validator in the `queue`. -It takes two arguments: the `ValidatorQueue` struct and the `address` of the validator -to remove the `queue` data of. - -The function updates the mapping of validator addresses to their position in the `queue` -by setting the index for the validator to 0, indicating that the validator is not in -the `queue`. - -### reset - -```js -function reset(ValidatorQueue storage self) internal { - delete self.queue; -} -``` - -This function is used to reinitialize the validator `queue`. -It takes one argument: the `ValidatorQueue` struct. - -The function deletes the `queue` array, effectively resetting the `queue`. - -### get - -```js -function get(ValidatorQueue storage self) internal view returns (QueuedValidator[] storage) { - return self.queue; -} -``` - -This function is used to return the `queue`. It takes one argument: the `ValidatorQueue` struct. - -### waiting - -```js -function waiting(ValidatorQueue storage self, address validator) internal view returns (bool) { - return self.indices[validator] != 0; -} -``` - -This function is used to check if a specific validator is in the `queue`. -It takes two arguments: the `ValidatorQueue` struct and the `address` of the -validator to check. - -### pendingState - -```js -function pendingStake(ValidatorQueue storage self, address validator) internal view returns (int256) { - return self.queue[self.indices[validator]].stake; -} -``` - -This function is used to return the change of `stake` for a validator in the `queue`. -It takes two arguments: the `ValidatorQueue` struct and the `address` of the validator -to check the change to `stake` of. - -### pendingDelegation - -```js -function pendingDelegation(ValidatorQueue storage self, address validator) internal view returns (int256) { - return self.queue[self.indices[validator]].delegation; -} -``` - -This function is used to return the change to `delegation` for a validator -in the `queue`. It takes two arguments: the `ValidatorQueue` struct and -the `address` of the validator to check the change to delegation of. diff --git a/wiki-docs/docs/interfaces/erc20/childerc20-predicate.md b/wiki-docs/docs/interfaces/erc20/childerc20-predicate.md index 20eaa001d6..783af83572 100644 --- a/wiki-docs/docs/interfaces/erc20/childerc20-predicate.md +++ b/wiki-docs/docs/interfaces/erc20/childerc20-predicate.md @@ -18,31 +18,12 @@ function initialize( address newStateReceiver, address newRootERC20Predicate, address newChildTokenTemplate, - address newNativeTokenRootAddress, - string calldata newNativeTokenName, - string calldata newNativeTokenSymbol, - uint8 newNativeTokenDecimals -) external; + address newNativeTokenRootAddress +) public virtual onlySystemCall initializer { ``` The parameters for initialization include the addresses of the L2 state sender, the state receiver, the root ERC20 predicate, and the child token template. The initialization also requires the native token's root address, name, symbol, and decimals. -## Deploy a new child token - -To create a new child token on the L2 side, call the deployChildToken method: - -```solidity -function deployChildToken( - address rootToken, - bytes32 salt, - string calldata name, - string calldata symbol, - uint8 decimals -) external; -``` - -The parameters for deploying a new child token include the address of the corresponding root token on L1, a unique salt value, and the token's name, symbol, and decimals. - ## Process state updates The onStateReceive method receives state updates from the L1 side and processes the data accordingly: diff --git a/wiki-docs/docs/interfaces/erc20/native-erc20.md b/wiki-docs/docs/interfaces/erc20/native-erc20.md index 362b10dcff..fbe70eb2d0 100644 --- a/wiki-docs/docs/interfaces/erc20/native-erc20.md +++ b/wiki-docs/docs/interfaces/erc20/native-erc20.md @@ -13,6 +13,7 @@ This function sets the values for the predicate, rootToken, name, symbol, and de - `name_` (string): The token's name. - `symbol_` (string): The token's symbol. - `decimals_` (uint8): The number of decimals for the token. +- `tokenSupply_` (uint256): Initial total supply of token. #### Usage diff --git a/wiki-docs/docs/interfaces/network/exit-helper.md b/wiki-docs/docs/interfaces/network/exit-helper.md index 293240cc57..02244ba528 100644 --- a/wiki-docs/docs/interfaces/network/exit-helper.md +++ b/wiki-docs/docs/interfaces/network/exit-helper.md @@ -28,10 +28,10 @@ This function allows you to perform a batch exit for multiple events. #### Parameters - `inputs` (BatchExitInput[]): An array of BatchExitInput structs, where each struct contains the following fields: -- `blockNumber` (uint256): The block number of the exit event on L2. -- `leafIndex` (uint256): The leaf index in the exit event Merkle tree. -- `unhashedLeaf` (bytes): The ABI-encoded exit event leaf. -- `proof` (bytes32[]): The proof of the event inclusion in the tree. + - `blockNumber` (uint256): The block number of the exit event on L2. + - `leafIndex` (uint256): The leaf index in the exit event Merkle tree. + - `unhashedLeaf` (bytes): The ABI-encoded exit event leaf. + - `proof` (bytes32[]): The proof of the event inclusion in the tree. #### Usage diff --git a/wiki-docs/docs/interfaces/validators/root-validator-set.md b/wiki-docs/docs/interfaces/validators/root-validator-set.md deleted file mode 100644 index 7c0521a607..0000000000 --- a/wiki-docs/docs/interfaces/validators/root-validator-set.md +++ /dev/null @@ -1,73 +0,0 @@ -The `IRootValidatorSet` interface provides functionality for managing the validator set on the rootchain. It allows adding new validators and querying validator information. This user guide will explain how to interact with the functions provided by the `IRootValidatorSet` interface. - -## Data Structures - -### Validator - -The Validator struct represents a validator in the validator set. - -- `_address` (address): The Ethereum address of the validator. -- `blsKey` (uint256[4]): The BLS public key of the validator. - -## Functions - -### addValidators() - -This function adds new validators to the validator set. - -#### Parameters - -`newValidators` (Validator[]): An array of Validator structs representing the new validators to be added. - -#### Usage - -To add new validators to the validator set, call the `addValidators()` function with the required parameters: - -```solidity -IRootValidatorSet rootValidatorSetInstance = IRootValidatorSet(rootValidatorSetAddress); - -IRootValidatorSet.Validator[] memory newValidators = new IRootValidatorSet.Validator[](2); - -newValidators[0] = IRootValidatorSet.Validator(validatorAddress1, blsKey1); -newValidators[1] = IRootValidatorSet.Validator(validatorAddress2, blsKey2); - -rootValidatorSetInstance.addValidators(newValidators); -``` - -Replace `rootValidatorSetAddress` with the address of an existing `IRootValidatorSet` implementation. Replace `validatorAddress1`, `blsKey1`, `validatorAddress2`, and `blsKey2` with the Ethereum addresses and BLS public keys of the new validators. - -### getValidatorBlsKey() - -This function returns the BLS public key of a validator by their ID. - -#### Parameters - -`id` (uint256): The ID of the validator. - -#### Usage - -To get the BLS public key of a validator by their ID, call the `getValidatorBlsKey()` function with the required parameter: - -```solidity -IRootValidatorSet rootValidatorSetInstance = IRootValidatorSet(rootValidatorSetAddress); - -uint256[4] memory blsKey = rootValidatorSetInstance.getValidatorBlsKey(validatorId); -``` - -Replace rootValidatorSetAddress with the address of an existing `IRootValidatorSet` implementation. Replace `validatorId` with the ID of the validator whose BLS public key you want to retrieve. - -### activeValidatorSetSize() - -This function returns the size of the active validator set. - -#### Usage - -To get the size of the active validator set, call the `activeValidatorSetSize()` function: - -```solidity -IRootValidatorSet rootValidatorSetInstance = IRootValidatorSet(rootValidatorSetAddress); - -uint256 validatorSetSize = rootValidatorSetInstance.activeValidatorSetSize(); -``` - -Replace rootValidatorSetAddress with the address of an existing `IRootValidatorSet` implementation. The function will return the number of active validators in the validator set. diff --git a/wiki-docs/docs/interfaces/validators/validators.md b/wiki-docs/docs/interfaces/validators/validators.md deleted file mode 100644 index cd0525e48a..0000000000 --- a/wiki-docs/docs/interfaces/validators/validators.md +++ /dev/null @@ -1,45 +0,0 @@ -The `IValidator` interface represents a validator and its reward pool for delegators on the childchain. This user guide will explain the structs that make up the interface. - -## Structs - -### RewardPool - -RewardPool represents a pool for reward distribution, formed by delegators to a specific validator. It tracks slashed delegations using virtual balances. - -- `supply` (uint256): The amount of tokens in the pool. -- `virtualSupply` (uint256): The total supply of virtual balances in the pool. -- `magnifiedRewardPerShare` (uint256): A coefficient to aggregate rewards. -- `validator` (address): The address of the validator the pool is based on. -- `magnifiedRewardCorrections` (mapping): Adjustments to reward magnifications by address. -- `claimedRewards` (mapping): The amount claimed by address. -- `balances` (mapping): The virtual balance by address. - -### Validator - -Validator represents a validator on the childchain. - -- `blsKey` (uint256[4]): The public BLS key of the validator. -- `stake` (uint256): The amount staked by the validator. -- `commission` (uint256): The fee taken from delegators' rewards and given to the validator. -- `withdrawableRewards` (uint256): The amount that can be withdrawn. -- `active` (bool): Indicates if the validator is actively proposing/attesting. - -### Node - -Node represents a node in the red-black validator tree. - -- `parent` (address): The address of the parent of this node. -- `left` (address): The node in the tree to the left of this one. -- `right` (address): The node in the tree to the right of this one. -- `red` (bool): A boolean denoting the color of the node for balancing. -- `validator` (Validator): The validator data type. - -### ValidatorTree - -ValidatorTree represents a red-black validator tree. - -- `root` (address): The root of the tree. -- `count` (uint256): The number of nodes in the tree. -- `totalStake` (uint256): The total amount staked by nodes of the tree. -- `nodes` (mapping): A mapping from an address to a Node. -- `delegationPools` (mapping): A mapping from a validator address to a RewardPool. diff --git a/wiki-docs/docs/operate/deploy/staking/stake.md b/wiki-docs/docs/operate/deploy/staking/stake.md index b877c5dfc3..7a06d71f24 100644 --- a/wiki-docs/docs/operate/deploy/staking/stake.md +++ b/wiki-docs/docs/operate/deploy/staking/stake.md @@ -7,15 +7,15 @@ Each validator needs to perform initial staking on the rootchain `StakeManager`
Flags ↓ -| Flag | Description | Example | -| -----------------------------| -------------------------------------------------- | ---------------------------------------- | -| `--amount ` | The amount to stake | `--amount 5000000000000000000` | -| `--chain-id` | The ID of the child chain | `--chain-id 100` | -| `--config ` | The path to the SecretsManager config file | `--config /path/to/config/file.yaml` | -| `--data-dir` | The directory for the Polygon Edge data | `--data-dir ./polygon-edge/data` | -| `--jsonrpc` | The JSON-RPC interface | `--jsonrpc 0.0.0.0:8545` | -| `--native-root-token ` | The address of the native root token | `--native-root-token 0x` | -| `--stake-manager` | The address of the stake manager contract | `--stake-manager 0x` | +|| Flag | Description | Example | +| -----------------------------| --------------------------------------------------------------------------------- | ---------------------------------------- | +| `--amount ` | The amount to stake | `--amount 5000000000000000000` | +| `--supernet-id` | The ID of the supernet provided by stake manager on supernet registration | `--chain-id 100` | +| `--config ` | The path to the SecretsManager config file | `--config /path/to/config/file.yaml` | +| `--data-dir` | The directory for the Polygon Edge data | `--data-dir ./polygon-edge/data` | +| `--jsonrpc` | The JSON-RPC interface | `--jsonrpc 0.0.0.0:8545` | +| `--stake-token ` | The address of ERC20 Token used for staking on rootchain | `--native-root-token 0x` | +| `--stake-manager` | The address of the stake manager contract | `--stake-manager 0x` |
diff --git a/wiki-docs/mkdocs.yml b/wiki-docs/mkdocs.yml index 00b521ac4b..ba3a91b522 100644 --- a/wiki-docs/mkdocs.yml +++ b/wiki-docs/mkdocs.yml @@ -57,15 +57,14 @@ nav: - Upgrade using hardfork: operate/deploy/upgrades/hardfork.md - Edge v1.1 upgrade requirements: operate/deploy/upgrades/v1.1.md - Reference: - - Contracts: - - Checkpoint manager: contracts/checkpoint-manager.md - - Exit helper: contracts/exit-helper.md - - Reward pool: contracts/reward-pool.md - - State receiver: contracts/state-receiver.md - - State sender: contracts/state-sender.md - - Validator queue: contracts/validator-queue.md - - Validator set: contracts/validator-set.md - - Withdrawal queue: contracts/withdrawal-queue.md + #- Contracts: + # - Checkpoint manager: contracts/checkpoint-manager.md + # - Exit helper: contracts/exit-helper.md + # - Reward pool: contracts/reward-pool.md + # - State receiver: contracts/state-receiver.md + # - State sender: contracts/state-sender.md + # - Validator set: contracts/validator-set.md + # - Withdrawal queue: contracts/withdrawal-queue.md - Config parameter reference: operate/param-reference.md - Smart contract interfaces: - ERC20: @@ -88,9 +87,7 @@ nav: - StateReceiver: interfaces/network/state-receiver.md - StateSender: interfaces/network/state-sender.md - Validators: - - Validator: interfaces/validators/validators.md - ValidatorSetBase: interfaces/validators/validator-set-base.md - - RootValidatorSet: interfaces/validators/root-validator-set.md - Staking: - StakeManager: interfaces/staking/stake-manager.md - SupernetManager: interfaces/staking/supernet-manager.md