Skip to content

Commit a288612

Browse files
authored
Merge pull request #435 from rsksmart/v2.5.0-fixes
V2.5.0 fixes
2 parents ee541e2 + b985681 commit a288612

File tree

107 files changed

+8323
-2905
lines changed

Some content is hidden

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

107 files changed

+8323
-2905
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on: [push, pull_request, workflow_dispatch]
77

88
permissions:
99
contents: read
10+
packages: read
1011

1112
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1213
jobs:

.github/workflows/fuzz.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Fuzz test smart contracts
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- QA-Test
8+
- Stable-Test
9+
- master
10+
- "v*.*.*"
11+
pull_request:
12+
branches:
13+
- QA-Test
14+
- Stable-Test
15+
- master
16+
- "v*.*.*"
17+
18+
permissions:
19+
contents: read
20+
packages: read
21+
22+
jobs:
23+
build:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
27+
28+
- name: Use Node.js 20.15.1
29+
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
30+
with:
31+
node-version: "20.15.1"
32+
33+
- name: NPM Login
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
run: npm config set //npm.pkg.github.com/:_authToken $GITHUB_TOKEN
37+
38+
- name: Install dependencies
39+
run: npm ci
40+
41+
- name: "Install Foundry"
42+
uses: "foundry-rs/foundry-toolchain@50d5a8956f2e319df19e6b57539d7e2acb9f8c1e" # v1.5.0
43+
with:
44+
version: stable
45+
46+
- name: Lint contracts
47+
run: npm run lint:sol
48+
49+
- name: Compile contracts
50+
run: npm run compile
51+
52+
- name: Fuzz test smart contracts
53+
run: npm run test:fuzz
54+
55+
- name: Invariant test smart contracts
56+
run: npm run test:invariant

Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ NETWORK ?= testnet
66
FORK_BLOCK ?= latest
77
VERIFY ?= false
88
BROADCAST ?= true
9-
GAS_LIMIT ?= 10000000
9+
GAS_LIMIT ?= 100000000
1010
GAS_PRICE ?= 0
1111
PRIORITY_GAS_PRICE ?= 0
1212

@@ -1071,6 +1071,12 @@ safe-change-owner: validate-deploy change-owner-fork
10711071
docs:
10721072
@echo "Documentation is available in docs/FOUNDRY_MAKEFILE_GUIDE.md"
10731073

1074+
# Invariant tests
1075+
.PHONY: test-invariant
1076+
test-invariant:
1077+
@echo "Running invariant tests..."
1078+
forge test --match-path "test/invariant/**/*.t.sol" -vv
1079+
10741080
# Catch-all target for hash-quote arguments (pegin/pegout, network names, file paths)
10751081
# This prevents make from complaining about unknown targets when using: make hash-quote pegin testnet
10761082
ifneq (,$(findstring hash-quote,$(MAKECMDGOALS)))

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ PegIn Quotes consist of:
4848
uint callTime; // the time (in seconds) that the LP has to perform the call on behalf of the user after the deposit achieves the number of confirmations
4949
uint depositConfirmations; // the number of confirmations that the LP requires before making the call
5050
bool callOnRegister: // a boolean value indicating whether the callForUser can be called on registerPegIn.
51-
uint256 productFeeAmount; // the fee payed to the network DAO
5251
uint256 gasFee; // the fee payed to the LP to cover the gas of the RSK transaction
5352
}
5453

@@ -72,7 +71,6 @@ PegOut Quotes consist of:
7271
uint transferTime; // the time (in seconds) that the LP has to transfer on behalf of the user after the deposit achieves the number of confirmations
7372
uint expireDate; // the timestamp to consider the quote expired
7473
uint expireBlock; // the block number to consider the quote expired
75-
uint256 productFeeAmount; // the fee payed to the network DAO
7674
uint256 gasFee; // the fee payed to the LP to cover the fee of the BTC transaction
7775
}
7876

@@ -242,6 +240,17 @@ Validates that the LP made the deposit of the service and applies the correspond
242240
* partialMerkleTree: PMT to validate transaction
243241
* merkleBranchHashes: merkleBranchHashes used by the bridge to validate transaction
244242

243+
#### Peg-out BTC transaction structure (required)
244+
245+
For `refundPegOut`, the contract expects a Bitcoin transaction with two specific outputs used to prove the LP delivered the service:
246+
247+
1. **Payment output** at index `0`: pays the user destination (`quote.depositAddress`) with the peg-out amount.
248+
2. **Quote-hash output** at index `1`: an `OP_RETURN` output containing the peg-out quote hash.
249+
250+
The structure is intentionally enforced by contract validation for peg-out refunding. Bitcoin consensus does not enforce output ordering, but `refundPegOut` currently validates these outputs using fixed positions. If the required outputs are present but swapped, validation fails and the LP cannot be refunded through this function.
251+
252+
`btcTx` must be the raw Bitcoin transaction serialization without witness data.
253+
245254
### **refundUserPegOut**
246255

247256
function refundUserPegOut(
@@ -399,8 +408,10 @@ This project uses **Foundry** for smart contract development and deployment. We
399408

400409
```bash
401410
# Setup environment
411+
# Optional: create and activate a Python virtualenv before installing
402412
cp example.env .env
403413
make install
414+
npm ci
404415
make build
405416

406417
# Test deployment (simulation)

addresses.json

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -148,35 +148,39 @@
148148
},
149149
"rskDevelopment": {
150150
"SignatureValidator": {
151-
"address": "0x4008Db45ff34dD9839e3bd69B371e393A8fd2257",
151+
"address": "0xb5698C36773aE6eAE9F8D399beF24B33C3519454",
152152
"deployed": true
153153
},
154154
"Quotes": {
155-
"address": "0x0762F13Fd699f2a9B7611D91c89C2Ebc041DFcEC",
155+
"address": "0xC2Fac578B41e092543db8Dda0C990F64Bb18b6F5",
156156
"deployed": true
157157
},
158158
"BtcUtils": {
159-
"address": "0x229ff422d64d3a3c9a4e77c155e24e89aa2c5958",
159+
"address": "0xddFb077cD156095e31ADE2e53F5153d53b770054",
160160
"deployed": true
161161
},
162162
"FlyoverDiscovery": {
163-
"address": "0x9850388C612adAcb1F7DB1EBb2Ca88573b3De4aA",
163+
"address": "0xe16b04a1a87aC65a4aF8D46a8b797D0d46572408",
164164
"deployed": true
165165
},
166166
"PegOutContract": {
167-
"address": "0xEe3254eE028a2C7971B6774210FdCc05B3267Ca4",
167+
"address": "0x15c240d9Fb91224c0d3Ca9b04Ff63844aA3dF040",
168168
"deployed": true
169169
},
170170
"PegInContract": {
171-
"address": "0xC023B0dF3794cc8a104A6c367796C1f7FACE6300",
171+
"address": "0xcf871fB1D934301dD161A3AD5eB50379527B1CDc",
172172
"deployed": true
173173
},
174174
"CollateralManagementContract": {
175-
"address": "0x22f14668D476b0067fF96dD5b4B2d3C881991317",
175+
"address": "0x4036AC5c4C24C4Ae11BD29D709Dd5d057ca8F39d",
176176
"deployed": true
177177
},
178178
"ProxyAdmin": {
179-
"address": "0xB29D7e452054de57189Ea8dC645293C38F6D20Dd",
179+
"address": "0x46b2Ff811543FA43f5c3378972571e239624E69B",
180+
"deployed": true
181+
},
182+
"PauseRegistry": {
183+
"address": "0x2FDe2c000AB628D6F4B72f671eA8C2f4Be7A451f",
180184
"deployed": true
181185
}
182186
}

broadcast/DeployFlyover.s.sol/31/run-1771582556732.json

Lines changed: 386 additions & 0 deletions
Large diffs are not rendered by default.

broadcast/DeployFlyover.s.sol/31/run-1771582617562.json

Lines changed: 396 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)