Skip to content

Commit 3f6acef

Browse files
authored
Merge pull request #489 from rsksmart/version-2.5.0-fixes
Version 2.5.1 -> master
2 parents 88a6d1a + 037bb6d commit 3f6acef

63 files changed

Lines changed: 4189 additions & 1406 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
[submodule "lib/forge-std"]
22
path = lib/forge-std
33
url = https://github.com/foundry-rs/forge-std
4+
[submodule "lib/openzeppelin-foundry-upgrades"]
5+
path = lib/openzeppelin-foundry-upgrades
6+
url = https://github.com/OpenZeppelin/openzeppelin-foundry-upgrades
7+
[submodule "lib/openzeppelin-contracts-upgradeable"]
8+
path = lib/openzeppelin-contracts-upgradeable
9+
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable

Makefile

Lines changed: 165 additions & 111 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -415,10 +415,10 @@ npm ci
415415
make build
416416

417417
# Test deployment (simulation)
418-
make deploy-lbc NETWORK=testnet
418+
make deploy-lbc NETWORK=rskTestnet
419419

420420
# Actual deployment
421-
make deploy-lbc-broadcast NETWORK=testnet
421+
make deploy-lbc-broadcast NETWORK=rskTestnet
422422
```
423423

424424
#### Documentation
@@ -436,20 +436,20 @@ make deploy-lbc-broadcast NETWORK=testnet
436436

437437
```bash
438438
# Deployment
439-
make deploy-lbc NETWORK=testnet # Simulation
440-
make deploy-lbc-broadcast NETWORK=testnet # Actual deployment
439+
make deploy-lbc NETWORK=rskTestnet # Simulation
440+
make deploy-lbc-broadcast NETWORK=rskTestnet # Actual deployment
441441

442442
# Upgrades
443-
make upgrade-lbc NETWORK=testnet # Simulation
444-
make upgrade-lbc-broadcast NETWORK=testnet # Actual upgrade
443+
make upgrade-lbc NETWORK=rskTestnet # Simulation
444+
make upgrade-lbc-broadcast NETWORK=rskTestnet # Actual upgrade
445445

446446
# Fork testing
447447
make testnet-fork-deploy # Testnet fork simulation
448448
make testnet-fork-deploy-broadcast # Testnet fork actual deployment
449449

450450
# Utilities
451451
make get-versions # Get contract versions
452-
make check-env NETWORK=testnet # Environment validation
452+
make check-env NETWORK=rskTestnet # Environment validation
453453
make help # Show all commands
454454
```
455455

docs/FOUNDRY_MAKEFILE_GUIDE.md

Lines changed: 45 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -172,16 +172,16 @@ These commands simulate deployments without broadcasting transactions:
172172

173173
```bash
174174
# Deploy LiquidityBridgeContract (simulation)
175-
make deploy-lbc NETWORK=testnet
175+
make deploy-lbc NETWORK=rskTestnet
176176

177177
# Upgrade to V2 (simulation)
178-
make upgrade-lbc NETWORK=testnet
178+
make upgrade-lbc NETWORK=rskTestnet
179179

180180
# Transfer ownership (simulation)
181-
make change-owner NETWORK=testnet
181+
make change-owner NETWORK=rskTestnet
182182

183183
# High gas deployment (simulation)
184-
make deploy-lbc-high-gas NETWORK=testnet
184+
make deploy-lbc-high-gas NETWORK=rskTestnet
185185
```
186186

187187
### Actual Deployment Commands
@@ -190,16 +190,16 @@ These commands broadcast real transactions:
190190

191191
```bash
192192
# Deploy LiquidityBridgeContract (actual)
193-
make deploy-lbc-broadcast NETWORK=testnet
193+
make deploy-lbc-broadcast NETWORK=rskTestnet
194194

195195
# Upgrade to V2 (actual)
196-
make upgrade-lbc-broadcast NETWORK=testnet
196+
make upgrade-lbc-broadcast NETWORK=rskTestnet
197197

198198
# Transfer ownership (actual)
199-
make change-owner-broadcast NETWORK=testnet
199+
make change-owner-broadcast NETWORK=rskTestnet
200200

201201
# High gas deployment (actual)
202-
make deploy-lbc-high-gas-broadcast NETWORK=testnet
202+
make deploy-lbc-high-gas-broadcast NETWORK=rskTestnet
203203
```
204204

205205
### Safe Deployment Commands
@@ -208,35 +208,36 @@ These include additional validation:
208208

209209
```bash
210210
# Safe deployment with validation
211-
make safe-deploy-lbc-broadcast NETWORK=mainnet
211+
make safe-deploy-lbc-broadcast NETWORK=rskMainnet
212212

213213
# Safe upgrade with validation
214-
make safe-upgrade-lbc-broadcast NETWORK=mainnet
214+
make safe-upgrade-lbc-broadcast NETWORK=rskMainnet
215215

216216
# Safe ownership transfer with validation
217-
make safe-change-owner-broadcast NETWORK=mainnet
217+
make safe-change-owner-broadcast NETWORK=rskMainnet
218218
```
219219

220220
## Network Configuration
221221

222222
### Supported Networks
223223

224-
| Network | Chain ID | RPC URL | Description |
225-
| ------- | -------- | ----------- | ------------------- |
226-
| mainnet | 30 | RSK Mainnet | Production network |
227-
| testnet | 31 | RSK Testnet | Test network |
228-
| dev | 1337 | Local | Development network |
224+
| Network | Chain ID | RPC URL | Description |
225+
| -------------- | -------- | ----------- | --------------------------------------------- |
226+
| rskMainnet | 30 | RSK Mainnet | Production network |
227+
| rskTestnet | 31 | RSK Testnet | Test network |
228+
| rskDevelopment | 31 | RSK Testnet | Development addresses (same chain as testnet) |
229+
| rskRegtest | 33 | RSK Regtest | Local regtest node |
229230

230231
### Network-Specific Commands
231232

232233
```bash
233234
# Mainnet operations
234-
make deploy-lbc NETWORK=mainnet
235-
make upgrade-lbc-broadcast NETWORK=mainnet
235+
make deploy-lbc NETWORK=rskMainnet
236+
make upgrade-lbc-broadcast NETWORK=rskMainnet
236237

237238
# Testnet operations
238-
make deploy-lbc NETWORK=testnet
239-
make change-owner-broadcast NETWORK=testnet
239+
make deploy-lbc NETWORK=rskTestnet
240+
make change-owner-broadcast NETWORK=rskTestnet
240241

241242
# Dev operations
242243
make dev-deploy
@@ -267,10 +268,10 @@ make mainnet-fork-deploy-broadcast
267268

268269
```bash
269270
# Specify fork block
270-
make deploy-lbc NETWORK=testnet FORK_BLOCK=6020639
271+
make deploy-lbc NETWORK=rskTestnet FORK_BLOCK=6020639
271272

272273
# Use latest block
273-
make deploy-lbc NETWORK=mainnet FORK_BLOCK=latest
274+
make deploy-lbc NETWORK=rskMainnet FORK_BLOCK=latest
274275
```
275276

276277
## Safety Features
@@ -281,10 +282,10 @@ The Makefile includes built-in safety checks:
281282

282283
```bash
283284
# Check environment configuration
284-
make check-env NETWORK=testnet
285+
make check-env NETWORK=rskTestnet
285286

286287
# Validate deployment prerequisites
287-
make validate-deploy NETWORK=mainnet
288+
make validate-deploy NETWORK=rskMainnet
288289
```
289290

290291
### Mainnet Protection
@@ -293,20 +294,20 @@ Mainnet deployments require explicit confirmation:
293294

294295
```bash
295296
# This will prompt for confirmation
296-
make safe-deploy-lbc-broadcast NETWORK=mainnet
297+
make safe-deploy-lbc-broadcast NETWORK=rskMainnet
297298
```
298299

299300
### Gas Management
300301

301302
```bash
302303
# Default gas limit (10M)
303-
make deploy-lbc NETWORK=testnet
304+
make deploy-lbc NETWORK=rskTestnet
304305

305306
# High gas limit (15M)
306-
make deploy-lbc-high-gas NETWORK=testnet
307+
make deploy-lbc-high-gas NETWORK=rskTestnet
307308

308309
# Custom gas limit
309-
make deploy-lbc NETWORK=testnet GAS_LIMIT=20000000
310+
make deploy-lbc NETWORK=rskTestnet GAS_LIMIT=20000000
310311
```
311312

312313
## Utility Commands
@@ -370,7 +371,7 @@ make help
370371
**Solution**: Use high gas commands:
371372

372373
```bash
373-
make deploy-lbc-high-gas NETWORK=testnet
374+
make deploy-lbc-high-gas NETWORK=rskTestnet
374375
```
375376

376377
#### 3. EIP-1559 Fee Errors
@@ -403,7 +404,7 @@ forge install
403404

404405
```bash
405406
# Check if private key is set
406-
make check-env NETWORK=testnet
407+
make check-env NETWORK=rskTestnet
407408

408409
# Set in .env file
409410
TESTNET_SIGNER_PRIVATE_KEY=your_private_key
@@ -432,13 +433,13 @@ make install
432433
make build
433434

434435
# 4. Test deployment (simulation)
435-
make deploy-lbc NETWORK=testnet
436+
make deploy-lbc NETWORK=rskTestnet
436437

437438
# 5. Check environment
438-
make check-env NETWORK=testnet
439+
make check-env NETWORK=rskTestnet
439440

440441
# 6. Actual deployment
441-
make deploy-lbc-broadcast NETWORK=testnet
442+
make deploy-lbc-broadcast NETWORK=rskTestnet
442443

443444
# 7. Verify deployment
444445
make get-versions
@@ -461,13 +462,13 @@ make testnet-fork-deploy-broadcast
461462

462463
```bash
463464
# 1. Test upgrade (simulation)
464-
make upgrade-lbc NETWORK=testnet
465+
make upgrade-lbc NETWORK=rskTestnet
465466

466467
# 2. Check environment
467-
make check-env NETWORK=testnet
468+
make check-env NETWORK=rskTestnet
468469

469470
# 3. Perform upgrade
470-
make upgrade-lbc-broadcast NETWORK=testnet
471+
make upgrade-lbc-broadcast NETWORK=rskTestnet
471472

472473
# 4. Verify upgrade
473474
make get-versions
@@ -477,13 +478,13 @@ make get-versions
477478

478479
```bash
479480
# 1. Test ownership transfer (simulation)
480-
make change-owner NETWORK=testnet
481+
make change-owner NETWORK=rskTestnet
481482

482483
# 2. Validate multisig configuration
483-
make check-env NETWORK=testnet
484+
make check-env NETWORK=rskTestnet
484485

485486
# 3. Transfer ownership
486-
make change-owner-broadcast NETWORK=testnet
487+
make change-owner-broadcast NETWORK=rskTestnet
487488
```
488489

489490
## Best Practices
@@ -492,8 +493,8 @@ make change-owner-broadcast NETWORK=testnet
492493

493494
```bash
494495
# Always run simulation before actual deployment
495-
make deploy-lbc NETWORK=testnet
496-
make deploy-lbc-broadcast NETWORK=testnet
496+
make deploy-lbc NETWORK=rskTestnet
497+
make deploy-lbc-broadcast NETWORK=rskTestnet
497498
```
498499

499500
### 2. Use Fork Testing
@@ -508,14 +509,14 @@ make mainnet-fork-deploy
508509

509510
```bash
510511
# Check configuration before deployment
511-
make check-env NETWORK=mainnet
512+
make check-env NETWORK=rskMainnet
512513
```
513514

514515
### 4. Use Safe Commands for Mainnet
515516

516517
```bash
517518
# Safe commands include additional validation
518-
make safe-deploy-lbc-broadcast NETWORK=mainnet
519+
make safe-deploy-lbc-broadcast NETWORK=rskMainnet
519520
```
520521

521522
### 5. Monitor Gas Usage
@@ -525,7 +526,7 @@ make safe-deploy-lbc-broadcast NETWORK=mainnet
525526
make gas-report
526527

527528
# Use high gas for complex deployments
528-
make deploy-lbc-high-gas NETWORK=testnet
529+
make deploy-lbc-high-gas NETWORK=rskTestnet
529530
```
530531

531532
### 6. Keep Dependencies Updated

eslint.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export default [
1616
"coverage/*",
1717
"broadcast/*",
1818
"out/*",
19+
"lib/*",
1920
],
2021
},
2122
pluginJs.configs.recommended,

foundry.lock

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
{
22
"lib/forge-std": {
33
"rev": "8bbcf6e3f8f62f419e5429a0bd89331c85c37824"
4+
},
5+
"lib/openzeppelin-contracts-upgradeable": {
6+
"tag": {
7+
"name": "v5.6.1",
8+
"rev": "7bf4727aacdbfaa0f36cbd664654d0c9e1dc52bf"
9+
}
10+
},
11+
"lib/openzeppelin-foundry-upgrades": {
12+
"tag": {
13+
"name": "v0.4.0",
14+
"rev": "cbce1e00305e943aa1661d43f41e5ac72c662b07"
15+
}
416
}
517
}

foundry.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ optimizer = true
99
optimizer_runs = 1
1010
via_ir = false
1111
ffi = true
12+
ast = true
13+
build_info = true
14+
extra_output = ["storageLayout"]
1215
fs_permissions = [
1316
{ access = "read", path = "./" },
1417
{ access = "read-write", path = "./broadcast" },
@@ -24,7 +27,9 @@ remappings = [
2427
"@rsksmart/=node_modules/@rsksmart/",
2528
"@rsksmart/btc-transaction-solidity-helper/=node_modules/@rsksmart/btc-transaction-solidity-helper/",
2629
"forge-std/=lib/forge-std/src/",
27-
"src/=src/"
30+
"src/=src/",
31+
"@openzeppelin/contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/",
32+
"@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/"
2833
]
2934

3035
[fuzz]

lib/openzeppelin-foundry-upgrades

0 commit comments

Comments
 (0)