Skip to content

Commit

Permalink
compiled and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
invocamanman committed Aug 18, 2024
1 parent 740e5b0 commit 0b086b0
Show file tree
Hide file tree
Showing 13 changed files with 602 additions and 249 deletions.
4 changes: 2 additions & 2 deletions compiled-contracts/FflonkVerifier.json

Large diffs are not rendered by default.

224 changes: 156 additions & 68 deletions compiled-contracts/PolygonRollupManager.json

Large diffs are not rendered by default.

243 changes: 175 additions & 68 deletions compiled-contracts/PolygonRollupManagerMock.json

Large diffs are not rendered by default.

224 changes: 156 additions & 68 deletions compiled-contracts/PolygonRollupManagerMockInternalTest.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions compiled-contracts/PolygonValidiumEtrog.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions compiled-contracts/PolygonZkEVMEtrog.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions compiled-contracts/PolygonZkEVMEtrogPrevious.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions compiled-contracts/PolygonZkEVMExistentEtrog.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions compiled-contracts/PolygonZkEVMGlobalExitRootV2.json

Large diffs are not rendered by default.

27 changes: 25 additions & 2 deletions compiled-contracts/VerifierRollupHelperMock.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,29 @@
"contractName": "VerifierRollupHelperMock",
"sourceName": "contracts/mocks/VerifierRollupHelperMock.sol",
"abi": [
{
"inputs": [
{
"internalType": "bytes32",
"name": "programVKey",
"type": "bytes32"
},
{
"internalType": "bytes",
"name": "publicValues",
"type": "bytes"
},
{
"internalType": "bytes",
"name": "proofBytes",
"type": "bytes"
}
],
"name": "verifyProof",
"outputs": [],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [
{
Expand All @@ -28,8 +51,8 @@
"type": "function"
}
],
"bytecode": "0x608060405234801561000f575f80fd5b5061014e8061001d5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c80639121da8a1461002d575b5f80fd5b61004361003b366004610084565b600192915050565b604051901515815260200160405180910390f35b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f80610320808486031215610097575f80fd5b6103008401858111156100a8575f80fd5b8493508561031f8601126100ba575f80fd5b604051602080820182811067ffffffffffffffff821117156100de576100de610057565b6040529286019281888511156100f2575f80fd5b5b8484101561010a57833581529281019281016100f3565b50949790965094505050505056fea2646970667358221220cd116917bfb356f793a2cef2885c134856a021af9708cf6e35bd8e053205c63b64736f6c63430008140033",
"deployedBytecode": "0x608060405234801561000f575f80fd5b5060043610610029575f3560e01c80639121da8a1461002d575b5f80fd5b61004361003b366004610084565b600192915050565b604051901515815260200160405180910390f35b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f80610320808486031215610097575f80fd5b6103008401858111156100a8575f80fd5b8493508561031f8601126100ba575f80fd5b604051602080820182811067ffffffffffffffff821117156100de576100de610057565b6040529286019281888511156100f2575f80fd5b5b8484101561010a57833581529281019281016100f3565b50949790965094505050505056fea2646970667358221220cd116917bfb356f793a2cef2885c134856a021af9708cf6e35bd8e053205c63b64736f6c63430008140033",
"bytecode": "0x608060405234801561000f575f80fd5b506102298061001d5f395ff3fe608060405234801561000f575f80fd5b5060043610610034575f3560e01c806341493c60146100385780639121da8a1461004f575b5f80fd5b61004d6100463660046100be565b5050505050565b005b61006561005d36600461015f565b600192915050565b604051901515815260200160405180910390f35b5f8083601f840112610089575f80fd5b50813567ffffffffffffffff8111156100a0575f80fd5b6020830191508360208285010111156100b7575f80fd5b9250929050565b5f805f805f606086880312156100d2575f80fd5b85359450602086013567ffffffffffffffff808211156100f0575f80fd5b6100fc89838a01610079565b90965094506040880135915080821115610114575f80fd5b5061012188828901610079565b969995985093965092949392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f80610320808486031215610172575f80fd5b610300840185811115610183575f80fd5b8493508561031f860112610195575f80fd5b604051602080820182811067ffffffffffffffff821117156101b9576101b9610132565b6040529286019281888511156101cd575f80fd5b5b848410156101e557833581529281019281016101ce565b50949790965094505050505056fea264697066735822122038f5c9c95c4978a4f60bda4cf2b4c4a4e47b3482ea70dd8897f22c393d354bd964736f6c63430008140033",
"deployedBytecode": "0x608060405234801561000f575f80fd5b5060043610610034575f3560e01c806341493c60146100385780639121da8a1461004f575b5f80fd5b61004d6100463660046100be565b5050505050565b005b61006561005d36600461015f565b600192915050565b604051901515815260200160405180910390f35b5f8083601f840112610089575f80fd5b50813567ffffffffffffffff8111156100a0575f80fd5b6020830191508360208285010111156100b7575f80fd5b9250929050565b5f805f805f606086880312156100d2575f80fd5b85359450602086013567ffffffffffffffff808211156100f0575f80fd5b6100fc89838a01610079565b90965094506040880135915080821115610114575f80fd5b5061012188828901610079565b969995985093965092949392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f80610320808486031215610172575f80fd5b610300840185811115610183575f80fd5b8493508561031f860112610195575f80fd5b604051602080820182811067ffffffffffffffff821117156101b9576101b9610132565b6040529286019281888511156101cd575f80fd5b5b848410156101e557833581529281019281016101ce565b50949790965094505050505056fea264697066735822122038f5c9c95c4978a4f60bda4cf2b4c4a4e47b3482ea70dd8897f22c393d354bd964736f6c63430008140033",
"linkReferences": {},
"deployedLinkReferences": {}
}
86 changes: 58 additions & 28 deletions docs/v2/PolygonRollupManager.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ them will be done in this one. In this way, the proof aggregation of the rollups
address consensusImplementation,
address verifier,
uint64 forkID,
enum PolygonRollupManager.VerifierType genesis,
enum IPolygonRollupManager.VerifierType genesis,
bytes32 description,
string programVKey
) external
Expand All @@ -42,7 +42,7 @@ Add a new rollup type
|`consensusImplementation` | address | Consensus implementation
|`verifier` | address | Verifier address
|`forkID` | uint64 | ForkID of the verifier
|`genesis` | enum PolygonRollupManager.VerifierType | Genesis block of the rollup
|`genesis` | enum IPolygonRollupManager.VerifierType | Genesis block of the rollup
|`description` | bytes32 | Description of the rollup type
|`programVKey` | string | Hashed program that will be executed in case of using a "general porpuse ZK verifier" e.g SP1

Expand Down Expand Up @@ -94,8 +94,8 @@ Note if a wrapped token of the bridge is used, the original network and address
address verifier,
uint64 forkID,
uint64 chainID,
bytes32 genesis,
enum PolygonRollupManager.VerifierType rollupVerifierType,
bytes32 initRoot,
enum IPolygonRollupManager.VerifierType rollupVerifierType,
bytes32 programVKey
) external
```
Expand All @@ -110,8 +110,8 @@ note that this rollup does not follow any rollupType
|`verifier` | address | Verifier address, must be added before
|`forkID` | uint64 | Fork id of the added rollup
|`chainID` | uint64 | Chain id of the added rollup
|`genesis` | bytes32 | Genesis block for this rollup
|`rollupVerifierType` | enum PolygonRollupManager.VerifierType | Compatibility ID for the added rollup
|`initRoot` | bytes32 | Genesis block for StateTransitionChains & localExitRoot for pessimistic chain
|`rollupVerifierType` | enum IPolygonRollupManager.VerifierType | Compatibility ID for the added rollup
|`programVKey` | bytes32 | Hashed program that will be executed in case of using a "general porpuse ZK verifier" e.g SP1

### updateRollupByRollupAdmin
Expand Down Expand Up @@ -228,28 +228,6 @@ Allows a trusted aggregator to verify multiple batches
|`beneficiary` | address | Address that will receive the verification reward
|`proof` | bytes32[24] | Fflonk proof

### verifyPessimisticTrustedAggregator
```solidity
function verifyPessimisticTrustedAggregator(
uint32 rollupID,
bytes32 selectedGlobalExitRoot,
bytes32 newLocalExitRoot,
bytes32 newPessimisticRoot,
bytes proof
) external
```
Allows a trusted aggregator to verify pessimistic proof


#### Parameters:
| Name | Type | Description |
| :--- | :--- | :------------------------------------------------------------------- |
|`rollupID` | uint32 | Rollup identifier
|`selectedGlobalExitRoot` | bytes32 | Selected global exit root to proof imported bridges
|`newLocalExitRoot` | bytes32 | New local exit root
|`newPessimisticRoot` | bytes32 | New pessimistic information, Hash(localBalanceTreeRoot, nullifierTreeRoot)
|`proof` | bytes | SP1 proof (Plonk)

### _verifyAndRewardBatches
```solidity
function _verifyAndRewardBatches(
Expand All @@ -276,6 +254,28 @@ Verify and reward batches internal function
|`beneficiary` | address | Address that will receive the verification reward
|`proof` | bytes32[24] | Fflonk proof

### verifyPessimisticTrustedAggregator
```solidity
function verifyPessimisticTrustedAggregator(
uint32 rollupID,
bytes32 selectedGlobalExitRoot,
bytes32 newLocalExitRoot,
bytes32 newPessimisticRoot,
bytes proof
) external
```
Allows a trusted aggregator to verify pessimistic proof


#### Parameters:
| Name | Type | Description |
| :--- | :--- | :------------------------------------------------------------------- |
|`rollupID` | uint32 | Rollup identifier
|`selectedGlobalExitRoot` | bytes32 | Selected global exit root to proof imported bridges
|`newLocalExitRoot` | bytes32 | New local exit root
|`newPessimisticRoot` | bytes32 | New pessimistic information, Hash(localBalanceTreeRoot, nullifierTreeRoot)
|`proof` | bytes | SP1 proof (Plonk)

### activateEmergencyState
```solidity
function activateEmergencyState(
Expand Down Expand Up @@ -401,6 +401,7 @@ Function to calculate the pessimistic input bytes
### _getInputPessimisticBytes
```solidity
function _getInputPessimisticBytes(
uint32 rollupID,
struct PolygonRollupManager.RollupData rollup,
bytes32 selectedGlobalExitRoot,
bytes32 newLocalExitRoot,
Expand All @@ -413,6 +414,7 @@ Function to calculate the input snark bytes
#### Parameters:
| Name | Type | Description |
| :--- | :--- | :------------------------------------------------------------------- |
|`rollupID` | uint32 | Rollup identifier
|`rollup` | struct PolygonRollupManager.RollupData | Rollup data storage pointer
|`selectedGlobalExitRoot` | bytes32 | Selected global exit root to proof imported bridges
|`newLocalExitRoot` | bytes32 | New local exit root
Expand Down Expand Up @@ -512,6 +514,34 @@ Get rollup sequence batches struct given a batch number
|`rollupID` | uint32 | Rollup identifier
|`batchNum` | uint64 | Batch number

### rollupIDToRollupData
```solidity
function rollupIDToRollupData(
uint32 rollupID
) public returns (struct PolygonRollupManager.RollupDataReturn rollupData)
```
Get rollup data: VerifierType StateTransition


#### Parameters:
| Name | Type | Description |
| :--- | :--- | :------------------------------------------------------------------- |
|`rollupID` | uint32 | Rollup identifier

### rollupIDToRollupDataV2
```solidity
function rollupIDToRollupDataV2(
uint32 rollupID
) public returns (struct PolygonRollupManager.RollupDataReturnV2 rollupData)
```
Get rollup data: VerifierType Pessimistic


#### Parameters:
| Name | Type | Description |
| :--- | :--- | :------------------------------------------------------------------- |
|`rollupID` | uint32 | Rollup identifier

## Events
### AddNewRollupType
```solidity
Expand Down
8 changes: 8 additions & 0 deletions docs/v2/PolygonZkEVMGlobalExitRootV2.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@ Given the leaf data returns the leaf hash

Emitted when the global exit root is updated

### UpdateL1InfoTreeV2
```solidity
event UpdateL1InfoTreeV2(
)
```

Emitted when the global exit root is updated with the L1InfoTree leaf information

### InitL1InfoRootMap
```solidity
event InitL1InfoRootMap(
Expand Down
9 changes: 9 additions & 0 deletions docs/v2/mocks/PolygonRollupManagerMock.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,12 @@ PolygonRollupManager mock



### exposed_checkStateRootInsidePrime
```solidity
function exposed_checkStateRootInsidePrime(
) public returns (bool)
```




0 comments on commit 0b086b0

Please sign in to comment.