Skip to content

Commit abd065c

Browse files
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

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindings/CHANGELOG.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,35 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.11.1] - 2026-05-05
11+
12+
### Fixed
13+
14+
- `approveService` correctness: the TEE root SSTORE is now gated on
15+
`p.teeCommitments.length > 0` directly, not on `keccak256(...) != bytes32(0)`.
16+
The prior gate relied on cryptographic happenstance (any empty hash being
17+
non-zero) instead of input shape, which is the property we actually mean.
18+
- `approveService` manager-hook fidelity: when an operator approves a request
19+
with the protocol-default TNT requirement and supplies no explicit
20+
commitments, the contract auto-fills at the requirement's `minExposureBps`.
21+
The `IBlueprintServiceManager.onApprove` hook now receives the value that
22+
was actually committed (`minExposureBps / 100`), not the prior `100`
23+
fallback. New tests in `ServicesApprovalTest` (`test_managerStakingPercent_*`)
24+
pin this behavior.
25+
26+
### Notes
27+
28+
- Storage layout: `_serviceTeeCommitments` mapping (legacy
29+
`TeeAttestationCommitment[]` value) was retired in 0.11.0 in favor of
30+
`_serviceTeeCommitmentRoot` (`bytes32` value). Same head-slot count, different
31+
shape at keyed slots — safe for greenfield deploys; live-proxy upgrades would
32+
require explicit migration of orphaned data, which is N/A pre-mainnet.
33+
- Rust API: `TangleClient::approve_service(request_id)` lost its
34+
`restaking_percent: u8` parameter at 0.11.0 because the contract derives the
35+
effective exposure on-chain. Direct callers of the convenience method on
36+
`tangle-tools-clients-tangle` must drop the second argument; the unified
37+
builder `approve_service_with_params(ApprovalParams)` is also available.
38+
1039
## [0.11.0] - 2026-05-05
1140

1241
### Changed (BREAKING)
@@ -268,7 +297,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
268297
- Raw ABI JSON exports via `abi` module
269298
- `TNT_CORE_VERSION` constant for commit tracking
270299

271-
[Unreleased]: https://github.com/tangle-network/tnt-core/compare/bindings-v0.10.9...HEAD
300+
[Unreleased]: https://github.com/tangle-network/tnt-core/compare/bindings-v0.11.1...HEAD
301+
[0.11.1]: https://github.com/tangle-network/tnt-core/compare/bindings-v0.11.0...bindings-v0.11.1
302+
[0.11.0]: https://github.com/tangle-network/tnt-core/compare/bindings-v0.10.9...bindings-v0.11.0
272303
[0.1.0]: https://github.com/tangle-network/tnt-core/releases/tag/bindings-v0.1.0
273304
[0.4.1]: https://github.com/tangle-network/tnt-core/compare/bindings-v0.4.0...bindings-v0.4.1
274305
[0.4.2]: https://github.com/tangle-network/tnt-core/compare/bindings-v0.4.1...bindings-v0.4.2

bindings/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "tnt-core-bindings"
3-
version = "0.11.0"
3+
version = "0.11.1"
44
edition = "2021"
55
rust-version = "1.81"
66
description = "Rust bindings for TNT Core Solidity contracts (Tangle staking protocol)"

bindings/TNT_CORE_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5c28b2584adca992067a2b0fe695be61806086b0
1+
95323ea3c3973a48df48a8a9b4dafd9b0ddc380a

bindings/abi/IMultiAssetDelegation.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

bindings/abi/ITangle.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

bindings/abi/ITangleFull.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

bindings/abi/ITangleSlashing.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

bindings/abi/MultiAssetDelegation.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

bindings/abi/OperatorStatusRegistry.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)