Skip to content

Commit d8b021c

Browse files
authored
feat(protocol-contracts): pausers fetching script for both chains (#1802)
* feat(protocol-contracts): pausers fetching script for both chains * chore(protocol-contracts): improved config checker README and refactor * chore(protocol-contracts): rename config-checker to chains-config-checker
1 parent cdab9d1 commit d8b021c

File tree

7 files changed

+529
-0
lines changed

7 files changed

+529
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
PAUSER_SET_ETHEREUM="0xbBfE1680b4a63ED05f7F80CE330BED7C992A586C"
2+
PAUSER_SET_GATEWAY="0x571ecb596fCc5c840DA35CbeCA175580db50ac1b"
3+
RPC_ETHEREUM="https://ethereum-rpc.publicnode.com"
4+
RPC_GATEWAY="https://rpc.mainnet.zama.org"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.env
2+
node_modules/
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Config Checker
2+
3+
Utilities for checking FHEVM protocol contract configurations.
4+
5+
Returns the current set of active pausers for PauserSet contracts on Ethereum and Gateway chains by analyzing on-chain events.
6+
7+
## Prerequisites
8+
9+
- Node.js (v18+)
10+
- npm
11+
12+
## Installation
13+
14+
```bash
15+
npm install
16+
```
17+
18+
## Configuration
19+
20+
Create a `.env` file based on `.env.example`:
21+
22+
```bash
23+
cp .env.example .env
24+
```
25+
26+
## Available scripts
27+
28+
Currently, most useful scripts are:
29+
30+
```
31+
[*] get-current-pausers
32+
```
33+
### getCurrentPausers
34+
35+
#### Usage
36+
37+
```bash
38+
npm run get-current-pausers
39+
```
40+
41+
The script will:
42+
1. Query both Ethereum and Gateway chains (if configured)
43+
2. Find the deployment block for each PauserSet contract
44+
3. Fetch all `AddPauser`, `RemovePauser`, and `SwapPauser` events
45+
4. Compute the current set of active pausers
46+
5. Display a summary comparing pausers across chains
47+
48+
#### Example Output
49+
50+
```
51+
[Ethereum]
52+
Finding deployment block for 0xbBfE1680b4a63ED05f7F80CE330BED7C992A586C...
53+
Deployment block: 23832655
54+
Current block: 23900000
55+
Fetching pauser events...
56+
AddPauser: 100% - found 2 events
57+
RemovePauser: 100% - found 0 events
58+
SwapPauser: 100% - found 0 events
59+
60+
[Gateway]
61+
Finding deployment block for 0x571ecb596fCc5c840DA35CbeCA175580db50ac1b...
62+
Deployment block: 1000000
63+
Current block: 1050000
64+
Fetching pauser events...
65+
AddPauser: 100% - found 2 events
66+
RemovePauser: 100% - found 0 events
67+
SwapPauser: 100% - found 0 events
68+
69+
==================================================
70+
SUMMARY
71+
==================================================
72+
73+
Ethereum pausers:
74+
1. 0x1234...abcd
75+
2. 0x5678...efgh
76+
Total: 2 pauser(s)
77+
78+
Gateway pausers:
79+
1. 0x1234...abcd
80+
2. 0x5678...efgh
81+
Total: 2 pauser(s)
82+
83+
--------------------------------------------------
84+
Pausers are IDENTICAL on both chains.
85+
```
86+
87+
If pausers differ between chains, the script will show which addresses exist only on one chain.

protocol-contracts/chains-config-checker/package-lock.json

Lines changed: 134 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "chains-config-checker",
3+
"version": "1.0.0",
4+
"description": "FHEVM onchain configuration checker utilities",
5+
"scripts": {
6+
"get-deployment-block": "node utils/get-deployment-block.js",
7+
"get-current-pausers": "node utils/get-current-pausers.js"
8+
},
9+
"dependencies": {
10+
"dotenv": "^16.0.0",
11+
"ethers": "^6.0.0"
12+
}
13+
}

0 commit comments

Comments
 (0)