Commit abd065c
authored
fix(approvals): correctness + tighter gates + bindings v0.11.1 (#121)
Two correctness fixes on the unified `approveService(ApprovalParams)`
entrypoint, plus the bindings regen that exposes them.
ServicesApprovals.sol
- TEE root SSTORE is now gated on `p.teeCommitments.length > 0` directly,
not on `keccak256(...) != bytes32(0)`. The prior gate relied on the
cryptographic property "any non-empty hash is non-zero" instead of the
shape we actually mean. Functionally equivalent today, theoretically
brittle, harder to read.
- `effectiveStakingPercent` now mirrors what was actually committed,
including the auto-fill case. Previously, when an operator omitted
commitments and the contract auto-filled at the default-TNT
requirement's `minExposureBps`, the manager hook still received `100`.
It now receives `requirements[0].minExposureBps / 100`.
- Cached `hasTeeCommitments` / `registeringBls` booleans up front so the
whole function reads off explicit shape rather than recomputing.
MockBSM + ServicesApprovalTest
- MockBSM_V1 records `approveStakingPercent[requestId][operator]` so the
manager-hook stakingPercent value is observable in tests (it had no
coverage at all before — the existing tests asserted call counts only).
- Two regression tests pin the manager-hook value:
- `test_managerStakingPercent_reflectsAutoFilledDefault` (the bug fix)
- `test_managerStakingPercent_reflectsSuppliedCommitment` (counterpart)
bindings v0.11.1
- Cargo.toml bumped 0.11.0 → 0.11.1
- CHANGELOG documents both fixes plus the storage-layout note (greenfield
N/A) and the Rust API breaking change (`approve_service(request_id)`
lost its `restaking_percent` arg in 0.11.0; surfaced louder here).
- Full regen against tnt-core HEAD (95323ea, includes #118 slashing fixes).
Verification
- `forge test --match-contract ServicesApprovalTest` — 17/17 ✅
- The new test FAILS without the `effectiveStakingPercent` fix (asserts
10 != 100), confirming it actually catches the regression.1 parent 95323ea commit abd065c
19 files changed
Lines changed: 1287 additions & 175 deletions
File tree
- bindings
- abi
- src/bindings
- src/core
- test
- blueprints/mocks
- tangle
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
10 | 39 | | |
11 | 40 | | |
12 | 41 | | |
| |||
268 | 297 | | |
269 | 298 | | |
270 | 299 | | |
271 | | - | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
272 | 303 | | |
273 | 304 | | |
274 | 305 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
0 commit comments