Skip to content

Commit c865d08

Browse files
authored
Merge pull request #598 from 0xPolygon/feature/balance_nullifier_tree
Feature/balance nullifier tree tool
2 parents 974bf09 + 8a05c96 commit c865d08

18 files changed

+1817
-22
lines changed
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
[
2+
{
3+
"inputs": [
4+
{
5+
"internalType": "address",
6+
"name": "_bridgeAddress",
7+
"type": "address"
8+
}
9+
],
10+
"stateMutability": "nonpayable",
11+
"type": "constructor"
12+
},
13+
{
14+
"inputs": [],
15+
"name": "GlobalExitRootAlreadySet",
16+
"type": "error"
17+
},
18+
{
19+
"inputs": [],
20+
"name": "GlobalExitRootNotFound",
21+
"type": "error"
22+
},
23+
{
24+
"inputs": [],
25+
"name": "OnlyAllowedContracts",
26+
"type": "error"
27+
},
28+
{
29+
"inputs": [],
30+
"name": "OnlyGlobalExitRootRemover",
31+
"type": "error"
32+
},
33+
{
34+
"inputs": [],
35+
"name": "OnlyGlobalExitRootUpdater",
36+
"type": "error"
37+
},
38+
{
39+
"inputs": [],
40+
"name": "bridgeAddress",
41+
"outputs": [
42+
{
43+
"internalType": "address",
44+
"name": "",
45+
"type": "address"
46+
}
47+
],
48+
"stateMutability": "view",
49+
"type": "function"
50+
},
51+
{
52+
"inputs": [
53+
{
54+
"internalType": "bytes32",
55+
"name": "",
56+
"type": "bytes32"
57+
}
58+
],
59+
"name": "globalExitRootMap",
60+
"outputs": [
61+
{
62+
"internalType": "uint256",
63+
"name": "",
64+
"type": "uint256"
65+
}
66+
],
67+
"stateMutability": "view",
68+
"type": "function"
69+
},
70+
{
71+
"inputs": [],
72+
"name": "lastRollupExitRoot",
73+
"outputs": [
74+
{
75+
"internalType": "bytes32",
76+
"name": "",
77+
"type": "bytes32"
78+
}
79+
],
80+
"stateMutability": "view",
81+
"type": "function"
82+
},
83+
{
84+
"inputs": [
85+
{
86+
"internalType": "bytes32",
87+
"name": "newRoot",
88+
"type": "bytes32"
89+
}
90+
],
91+
"name": "updateExitRoot",
92+
"outputs": [],
93+
"stateMutability": "nonpayable",
94+
"type": "function"
95+
}
96+
]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
60a060405234801561000f575f5ffd5b506040516103fe3803806103fe833981810160405281019061003191906100c9565b8073ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff1681525050506100f4565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100988261006f565b9050919050565b6100a88161008e565b81146100b2575f5ffd5b50565b5f815190506100c38161009f565b92915050565b5f602082840312156100de576100dd61006b565b5b5f6100eb848285016100b5565b91505092915050565b6080516102ec6101125f395f818160f2015261018101526102ec5ff3fe608060405234801561000f575f5ffd5b506004361061004a575f3560e01c806301fd90441461004e578063257b36321461006c57806333d6247d1461009c578063a3c573eb146100b8575b5f5ffd5b6100566100d6565b60405161006391906101bb565b60405180910390f35b61008660048036038101906100819190610202565b6100dc565b6040516100939190610245565b60405180910390f35b6100b660048036038101906100b19190610202565b6100f0565b005b6100c061017f565b6040516100cd919061029d565b60405180910390f35b60015481565b5f602052805f5260405f205f915090505481565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610175576040517fb49365dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060018190555050565b7f000000000000000000000000000000000000000000000000000000000000000081565b5f819050919050565b6101b5816101a3565b82525050565b5f6020820190506101ce5f8301846101ac565b92915050565b5f5ffd5b6101e1816101a3565b81146101eb575f5ffd5b50565b5f813590506101fc816101d8565b92915050565b5f60208284031215610217576102166101d4565b5b5f610224848285016101ee565b91505092915050565b5f819050919050565b61023f8161022d565b82525050565b5f6020820190506102585f830184610236565b92915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6102878261025e565b9050919050565b6102978161027d565b82525050565b5f6020820190506102b05f83018461028e565b9291505056fea2646970667358221220c393973a9ae757dd7bd5220cac1b2d60f5f06c1013be10c2e6464de440e474f864736f6c634300081c0033

bindings/ulxly/polygonzkevmglobalexitrootl2/polygonzkevmglobalexitrootl2.go

Lines changed: 317 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/ulxly/balanceTreeUsage.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
This command will attempt to compute the root of the balnace tree based on the bridge
2+
events that are provided.
3+
4+
Example usage:
5+
6+
```bash
7+
polycli ulxly compute-balance-tree \
8+
--l2-claims-file l2-claims-0-to-11454081.ndjson \
9+
--l2-deposits-file l2-deposits-0-to-11454081.ndjson \
10+
--l2-network-id 3
11+
--bridge-address 0x528e26b25a34a4A5d0dbDa1d57D318153d2ED582 \
12+
--rpc-url http://localhost:8213 | jq '.'
13+
```
14+
15+
In this case we are assuming we have two files
16+
`l2-claims-0-to-11454081.ndjson` and `l2-deposits-0-to-11454081.ndjson` that would have been generated
17+
with a call to `polycli ulxly get-deposits` and `polycli ulxly get-claims` pointing to each network. The output will be the
18+
root of the tree for the provided deposits and claims.
19+
20+
This is the response from polycli:
21+
22+
```json
23+
{
24+
"root": "0x4516ca2a793b8e20f56ec6ba8ca6033a672330670a3772f76f2ade9bc2125150"",
25+
}
26+
```
27+
28+
Note: more info https://github.com/BrianSeong99/Agglayer_PessimisticProof_Benchmark?tab=readme-ov-file#architecture-of-pessimistic-proof

0 commit comments

Comments
 (0)