|
| 1 | +# Just Commands for Recall Role Revocation |
| 2 | + |
| 3 | +Quick reference guide for using the `just` commands to revoke roles on the Recall contract. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +1. Install `just`: https://github.com/casey/just#installation |
| 8 | + ```bash |
| 9 | + # macOS |
| 10 | + brew install just |
| 11 | + |
| 12 | + # Linux |
| 13 | + cargo install just |
| 14 | + ``` |
| 15 | + |
| 16 | +2. Copy `.env.example` to `.env` and configure: |
| 17 | + ```bash |
| 18 | + cp .env.example .env |
| 19 | + # Edit .env with your values |
| 20 | + ``` |
| 21 | + |
| 22 | +## Available Commands |
| 23 | + |
| 24 | +### List all commands |
| 25 | +```bash |
| 26 | +just |
| 27 | +# or |
| 28 | +just --list |
| 29 | +``` |
| 30 | + |
| 31 | +### Validate your .env file |
| 32 | +```bash |
| 33 | +just validate-env |
| 34 | +``` |
| 35 | + |
| 36 | +### Check role status for an account |
| 37 | +```bash |
| 38 | +just check-roles 0xAccountAddress |
| 39 | +``` |
| 40 | + |
| 41 | +### Revoke a single role (dry-run) |
| 42 | +```bash |
| 43 | +# Configure .env first with ROLE_TYPE and ACCOUNT |
| 44 | +just dry-run |
| 45 | +``` |
| 46 | + |
| 47 | +### Revoke a single role (broadcast) |
| 48 | +```bash |
| 49 | +# Set BROADCAST=true in .env, then: |
| 50 | +just revoke-role |
| 51 | +``` |
| 52 | + |
| 53 | +### Batch revoke multiple roles |
| 54 | +```bash |
| 55 | +# Configure REVOKE_ADMIN, REVOKE_MINTER, REVOKE_PAUSER in .env |
| 56 | +just revoke-batch |
| 57 | +``` |
| 58 | + |
| 59 | +### Revoke role from multiple accounts |
| 60 | +```bash |
| 61 | +# Configure ACCOUNTS in .env (comma-separated) |
| 62 | +just revoke-multi |
| 63 | +``` |
| 64 | + |
| 65 | +## Quick Start Examples |
| 66 | + |
| 67 | +### Example 1: Revoke MINTER role using Ledger (Safe Dry-Run First) |
| 68 | + |
| 69 | +1. Create/edit `.env`: |
| 70 | +```bash |
| 71 | +PROXY_ADDR=0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb |
| 72 | +RPC_URL=https://api.calibration.node.glif.io/rpc/v1 |
| 73 | +USE_LEDGER=true |
| 74 | +SENDER=0xYourLedgerAddress |
| 75 | +ROLE_TYPE=MINTER |
| 76 | +ACCOUNT=0xAccountToRevoke |
| 77 | +BROADCAST=false |
| 78 | +``` |
| 79 | + |
| 80 | +2. Validate configuration: |
| 81 | +```bash |
| 82 | +just validate-env |
| 83 | +``` |
| 84 | + |
| 85 | +3. Check current roles: |
| 86 | +```bash |
| 87 | +just check-roles 0xAccountToRevoke |
| 88 | +``` |
| 89 | + |
| 90 | +4. Dry run (simulate): |
| 91 | +```bash |
| 92 | +just dry-run |
| 93 | +``` |
| 94 | + |
| 95 | +5. If everything looks good, broadcast: |
| 96 | +```bash |
| 97 | +# Edit .env: set BROADCAST=true |
| 98 | +just revoke-role |
| 99 | +``` |
| 100 | + |
| 101 | +### Example 2: Remove all roles from compromised account |
| 102 | + |
| 103 | +1. Edit `.env`: |
| 104 | +```bash |
| 105 | +PROXY_ADDR=0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb |
| 106 | +RPC_URL=https://api.calibration.node.glif.io/rpc/v1 |
| 107 | +USE_LEDGER=true |
| 108 | +SENDER=0xYourLedgerAddress |
| 109 | +ACCOUNT=0xCompromisedAccount |
| 110 | +REVOKE_ADMIN=true |
| 111 | +REVOKE_MINTER=true |
| 112 | +REVOKE_PAUSER=true |
| 113 | +BROADCAST=false |
| 114 | +``` |
| 115 | + |
| 116 | +2. Dry run: |
| 117 | +```bash |
| 118 | +just revoke-batch |
| 119 | +``` |
| 120 | + |
| 121 | +3. Broadcast: |
| 122 | +```bash |
| 123 | +# Edit .env: set BROADCAST=true |
| 124 | +just revoke-batch |
| 125 | +``` |
| 126 | + |
| 127 | +### Example 3: Revoke MINTER from multiple test accounts |
| 128 | + |
| 129 | +1. Edit `.env`: |
| 130 | +```bash |
| 131 | +PROXY_ADDR=0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb |
| 132 | +RPC_URL=https://api.calibration.node.glif.io/rpc/v1 |
| 133 | +USE_LEDGER=true |
| 134 | +SENDER=0xYourLedgerAddress |
| 135 | +ROLE_TYPE=MINTER |
| 136 | +ACCOUNTS=0x1111...,0x2222...,0x3333... |
| 137 | +BROADCAST=true |
| 138 | +``` |
| 139 | + |
| 140 | +2. Execute: |
| 141 | +```bash |
| 142 | +just revoke-multi |
| 143 | +``` |
| 144 | + |
| 145 | +## Configuration Options |
| 146 | + |
| 147 | +### Authentication Methods |
| 148 | + |
| 149 | +**Ledger (Recommended):** |
| 150 | +```bash |
| 151 | +USE_LEDGER=true |
| 152 | +SENDER=0xYourLedgerAddress |
| 153 | +# Optional custom path: |
| 154 | +# HD_PATH=m/44'/60'/0'/0/1 |
| 155 | +``` |
| 156 | + |
| 157 | +**Trezor:** |
| 158 | +```bash |
| 159 | +USE_TREZOR=true |
| 160 | +SENDER=0xYourTrezorAddress |
| 161 | +``` |
| 162 | + |
| 163 | +**Private Key (Not Recommended):** |
| 164 | +```bash |
| 165 | +PRIVATE_KEY=0xYourPrivateKey |
| 166 | +``` |
| 167 | + |
| 168 | +### Role Types |
| 169 | + |
| 170 | +- `ADMIN` - Can manage roles and authorize upgrades |
| 171 | +- `MINTER` - Can mint new tokens |
| 172 | +- `PAUSER` - Can pause the contract |
| 173 | + |
| 174 | +### Safety Options |
| 175 | + |
| 176 | +```bash |
| 177 | +# Prevent accidental self-admin revocation (default: false) |
| 178 | +ALLOW_SELF_ADMIN_REVOKE=false |
| 179 | + |
| 180 | +# Dry-run mode - simulate without broadcasting (default: false) |
| 181 | +BROADCAST=false |
| 182 | + |
| 183 | +# Verbose output for debugging |
| 184 | +VERBOSE=true |
| 185 | +``` |
| 186 | + |
| 187 | +## Workflow Best Practices |
| 188 | + |
| 189 | +1. **Always validate first:** |
| 190 | + ```bash |
| 191 | + just validate-env |
| 192 | + ``` |
| 193 | + |
| 194 | +2. **Check current state:** |
| 195 | + ```bash |
| 196 | + just check-roles 0xTargetAccount |
| 197 | + ``` |
| 198 | + |
| 199 | +3. **Dry-run before broadcasting:** |
| 200 | + ```bash |
| 201 | + just dry-run |
| 202 | + ``` |
| 203 | + |
| 204 | +4. **Review the output carefully** |
| 205 | + |
| 206 | +5. **Set BROADCAST=true and execute:** |
| 207 | + ```bash |
| 208 | + just revoke-role |
| 209 | + ``` |
| 210 | + |
| 211 | +6. **Verify the result:** |
| 212 | + ```bash |
| 213 | + just check-roles 0xTargetAccount |
| 214 | + ``` |
| 215 | + |
| 216 | +## Troubleshooting |
| 217 | + |
| 218 | +### "Error: PROXY_ADDR not set in .env" |
| 219 | +Make sure you've created a `.env` file from `.env.example` and filled in the required values. |
| 220 | + |
| 221 | +### "Error: Must set either USE_LEDGER=true, USE_TREZOR=true, or PRIVATE_KEY" |
| 222 | +You need to specify an authentication method in your `.env` file. |
| 223 | + |
| 224 | +### Ledger not detected |
| 225 | +1. Connect and unlock your Ledger |
| 226 | +2. Open the Ethereum app |
| 227 | +3. Enable "Contract data" in Ethereum app settings |
| 228 | +4. Try the command again |
| 229 | + |
| 230 | +### "Caller Not Admin" error |
| 231 | +The address you're using (SENDER) doesn't have ADMIN_ROLE. Check with: |
| 232 | +```bash |
| 233 | +just check-roles $YOUR_SENDER_ADDRESS |
| 234 | +``` |
| 235 | + |
| 236 | +## Security Notes |
| 237 | + |
| 238 | +- ⚠️ **Always dry-run first** with `BROADCAST=false` |
| 239 | +- ✅ **Use hardware wallets** (Ledger/Trezor) instead of private keys |
| 240 | +- ✅ **Double-check addresses** before broadcasting |
| 241 | +- ✅ **Test on testnet** before mainnet operations |
| 242 | +- ⚠️ **Don't revoke all admin roles** without a replacement admin |
| 243 | + |
| 244 | +## Additional Resources |
| 245 | + |
| 246 | +- Full documentation: [`script/RevokeRecallRole.README.md`](script/RevokeRecallRole.README.md) |
| 247 | +- Script source: [`script/RevokeRecallRole.s.sol`](script/RevokeRecallRole.s.sol) |
| 248 | +- Just documentation: https://just.systems/man/en/ |
0 commit comments