Skip to content

Commit e3df141

Browse files
authored
Merge branch 'v2.5.0-fixes' into feature/FLY-2212
2 parents 600988d + 922203d commit e3df141

File tree

94 files changed

+3605
-2378
lines changed

Some content is hidden

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

94 files changed

+3605
-2378
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: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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: 11 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(

package-lock.json

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

0 commit comments

Comments
 (0)