Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pages/_meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ const meta: Meta = {
title: "Protocol",
type: "page",
},
"release-notes": {
title: "Release Notes",
type: "page",
},
};

export default meta;
57 changes: 57 additions & 0 deletions pages/developers/api/reference/IBlueprintServiceManager.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,63 @@ _Defines minimum commitment and exit queue timing_
| exitQueueDuration | uint64 | Time between scheduling exit and completing it (seconds) |
| forceExitAllowed | bool | Whether service owner can force-exit operators |

#### getNonPaymentTerminationPolicy

```solidity
function getNonPaymentTerminationPolicy(uint64 serviceId) external view returns (bool useDefault, uint64 graceIntervals)
```

Get the non-payment termination policy for subscription services.

Core computes eligibility as
`lastPaymentAt + subscriptionInterval + (subscriptionInterval * graceIntervals)`.
`graceIntervals = 0` means termination is eligible immediately at the first missed
billing tick. Implementations should return `useDefault = true` unless they need
custom grace behavior. Default implementation in `BlueprintServiceManagerBase` returns
`(true, 0)`.

##### Parameters

| Name | Type | Description |
| --------- | ------ | -------------- |
| serviceId | uint64 | The service ID |

##### Return Values

| Name | Type | Description |
| -------------- | ------ | ---------------------------------------------------------------- |
| useDefault | bool | True to use the protocol default policy |
| graceIntervals | uint64 | Additional full intervals to wait after the first missed payment |

#### forceRemoveAllowsBelowMin

```solidity
function forceRemoveAllowsBelowMin(uint64 serviceId) external view returns (bool ok)
```

Whether `forceRemoveOperator` may drop the service below `minOperators`.

By default the protocol enforces `operatorCount > minOperators` even when a blueprint
manager calls `forceRemoveOperator`. A blueprint that genuinely needs
emergency-eviction-below-min must self-document by returning `true`. Reverting or
unimplemented => the protocol enforces the floor (fail-closed). The default
implementation in `BlueprintServiceManagerBase` returns `false`; custom managers that
do **not** inherit `BlueprintServiceManagerBase` MUST implement this hook explicitly
or `forceRemoveOperator` will revert as soon as the eviction would push the operator
count below `minOperators`.

##### Parameters

| Name | Type | Description |
| --------- | ------ | -------------- |
| serviceId | uint64 | The service ID |

##### Return Values

| Name | Type | Description |
| ---- | ---- | ------------------------------------------------------- |
| ok | bool | True to allow eviction below the minimum operator count |

#### onRequest

```solidity
Expand Down
8 changes: 7 additions & 1 deletion pages/developers/api/reference/IMBSMRegistry.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,13 @@ Get the latest revision number registered in the registry
function pinBlueprint(uint64 blueprintId, uint32 revision) external
```

Pin a blueprint to a specific revision (0 disallowed)
Pin a blueprint to a specific revision (0 disallowed).

Reverts if `revision` is currently inside the deprecation grace window. Pinning a blueprint
to a revision that is itself deprecated would defeat the deprecation flow: `getMBSM` would
return `address(0)` the moment `completeDeprecation` ran, breaking every BSM call for the
pinned blueprint. Choose a revision that is not scheduled for deprecation, or wait until
the deprecation has fully completed before pinning to a different revision.

#### unpinBlueprint

Expand Down
111 changes: 103 additions & 8 deletions pages/developers/api/reference/ITangleSlashing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ Source: https://github.com/tangle-network/tnt-core/blob/main/src/interfaces/ITan

Slashing interface for Tangle protocol

The event declarations on this interface mirror what the protocol actually emits from `SlashingLib`.
Off-chain consumers (Rust bindings, indexers) MUST decode against the shapes documented below.

#### Functions

#### proposeSlash

```solidity
function proposeSlash(uint64 serviceId, address operator, uint256 amount, bytes32 evidence) external returns (uint64 slashId)
function proposeSlash(uint64 serviceId, address operator, uint16 slashBps, bytes32 evidence) external returns (uint64 slashId)
```

Propose a slash against an operator
Expand All @@ -27,8 +30,8 @@ Propose a slash against an operator
| --------- | ------- | ------------------------------------ |
| serviceId | uint64 | The service where violation occurred |
| operator | address | The operator to slash |
| amount | uint256 | Amount to slash |
| evidence | bytes32 | Evidence hash |
| slashBps | uint16 | Slash percentage in basis points |
| evidence | bytes32 | Evidence hash (must be non-zero) |

##### Return Values

Expand All @@ -39,10 +42,14 @@ Propose a slash against an operator
#### disputeSlash

```solidity
function disputeSlash(uint64 slashId, string reason) external
function disputeSlash(uint64 slashId, string reason) external payable
```

Dispute a slash proposal
Dispute a slash proposal.

`payable` because the implementation requires `msg.value == config.disputeBond` when the bond
is non-zero (and zero otherwise). Typed callers MUST use a payable reference so
`disputeSlash{value: bond}(...)` compiles.

#### executeSlash

Expand Down Expand Up @@ -79,11 +86,22 @@ Cancel a slash proposal
#### setSlashConfig

```solidity
function setSlashConfig(uint64 disputeWindow, bool instantSlashEnabled, uint16 maxSlashBps) external
function setSlashConfig(uint64 disputeWindow, bool instantSlashEnabled, uint16 maxSlashBps, uint64 disputeResolutionDeadline, uint256 disputeBond, uint16 maxPendingSlashesPerOperator) external
```

Update slashing configuration

##### Parameters

| Name | Type | Description |
| ---------------------------- | ------- | ---------------------------------------------------------------- |
| disputeWindow | uint64 | Time after `proposeSlash` during which the operator can dispute |
| instantSlashEnabled | bool | Reserved emergency toggle (no effect through the standard API) |
| maxSlashBps | uint16 | Hard cap on any single slash proposal |
| disputeResolutionDeadline | uint64 | Time `SLASH_ADMIN` has to resolve a dispute before it auto-fails |
| disputeBond | uint256 | Native asset bond required to dispute (0 = disabled) |
| maxPendingSlashesPerOperator | uint16 | Cap on concurrent pending slashes per operator (anti-spam) |

#### getSlashProposal

```solidity
Expand All @@ -92,16 +110,93 @@ function getSlashProposal(uint64 slashId) external view returns (struct Slashing

Get slash proposal details

#### getSlashConfig

```solidity
function getSlashConfig() external view returns (struct SlashingLib.SlashConfig)
```

Get the current slashing configuration. Returns the live `SlashConfig` tuple containing
`disputeWindow`, `instantSlashEnabled`, `maxSlashBps`, `disputeResolutionDeadline`,
`disputeBond`, and `maxPendingSlashesPerOperator`.

#### Events

#### SlashProposed

```solidity
event SlashProposed(uint64 serviceId, address operator, uint256 amount, bytes32 evidence)
event SlashProposed(uint64 indexed slashId, uint64 indexed serviceId, address indexed operator, address proposer, uint16 slashBps, uint16 effectiveSlashBps, bytes32 evidence, uint64 executeAfter)
```

Emitted when a new slash proposal is created.

##### Parameters

| Name | Type | Description |
| ----------------- | ------- | ----------------------------------------------------------------------- |
| slashId | uint64 | The new slash ID (indexed) |
| serviceId | uint64 | The service where the violation occurred (indexed) |
| operator | address | The slashed operator (indexed) |
| proposer | address | The address that called `proposeSlash` |
| slashBps | uint16 | Requested slash percentage in basis points |
| effectiveSlashBps | uint16 | Slash percentage after exposure scaling (what will actually be applied) |
| evidence | bytes32 | Evidence hash (non-zero, enforced by `proposeSlash`) |
| executeAfter | uint64 | Earliest UNIX timestamp at which the slash can be executed |

#### SlashDisputed

```solidity
event SlashDisputed(uint64 indexed slashId, address indexed disputer, string reason)
```

Emitted when a slash proposal is disputed by the operator or by `SLASH_ADMIN_ROLE`.

##### Parameters

| Name | Type | Description |
| -------- | ------- | ------------------------------------------ |
| slashId | uint64 | The disputed slash ID (indexed) |
| disputer | address | The address that called `disputeSlash` |
| reason | string | Human-readable rationale (free-form input) |

#### SlashExecuted

```solidity
event SlashExecuted(uint64 serviceId, address operator, uint256 amount)
event SlashExecuted(uint64 indexed slashId, uint64 indexed serviceId, address indexed operator, uint256 actualSlashed)
```

Emitted when a slash is executed.

##### Parameters

| Name | Type | Description |
| ------------- | ------- | -------------------------------------------------- |
| slashId | uint64 | The executed slash ID (indexed) |
| serviceId | uint64 | The service the slash was applied to (indexed) |
| operator | address | The slashed operator (indexed) |
| actualSlashed | uint256 | Total stake actually burned in the underlying call |

#### SlashCancelled

```solidity
event SlashCancelled(uint64 indexed slashId, address indexed canceller, string reason)
```

Emitted when a slash proposal is cancelled by `SLASH_ADMIN_ROLE`.

##### Parameters

| Name | Type | Description |
| --------- | ------- | ------------------------------------------- |
| slashId | uint64 | The cancelled slash ID (indexed) |
| canceller | address | Address that called `cancelSlash` (indexed) |
| reason | string | Human-readable rationale (free-form input) |

#### SlashConfigUpdated

```solidity
event SlashConfigUpdated(uint64 disputeWindow, bool instantSlashEnabled, uint16 maxSlashBps, uint64 disputeResolutionDeadline, uint256 disputeBond, uint16 maxPendingSlashesPerOperator)
```

Emitted when `setSlashConfig` updates the slashing configuration. The full new
configuration is included in the event.
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,63 @@ _Defines minimum commitment and exit queue timing_
| exitQueueDuration | uint64 | Time between scheduling exit and completing it (seconds) |
| forceExitAllowed | bool | Whether service owner can force-exit operators |

#### getNonPaymentTerminationPolicy

```solidity
function getNonPaymentTerminationPolicy(uint64 serviceId) external view returns (bool useDefault, uint64 graceIntervals)
```

Get the non-payment termination policy for subscription services.

Core computes eligibility as
`lastPaymentAt + subscriptionInterval + (subscriptionInterval * graceIntervals)`.
`graceIntervals = 0` means termination is eligible immediately at the first missed
billing tick. Implementations should return `useDefault = true` unless they need
custom grace behavior. Default implementation in `BlueprintServiceManagerBase` returns
`(true, 0)`.

##### Parameters

| Name | Type | Description |
| --------- | ------ | -------------- |
| serviceId | uint64 | The service ID |

##### Return Values

| Name | Type | Description |
| -------------- | ------ | ---------------------------------------------------------------- |
| useDefault | bool | True to use the protocol default policy |
| graceIntervals | uint64 | Additional full intervals to wait after the first missed payment |

#### forceRemoveAllowsBelowMin

```solidity
function forceRemoveAllowsBelowMin(uint64 serviceId) external view returns (bool ok)
```

Whether `forceRemoveOperator` may drop the service below `minOperators`.

By default the protocol enforces `operatorCount > minOperators` even when a blueprint
manager calls `forceRemoveOperator`. A blueprint that genuinely needs
emergency-eviction-below-min must self-document by returning `true`. Reverting or
unimplemented => the protocol enforces the floor (fail-closed). The default
implementation in `BlueprintServiceManagerBase` returns `false`; custom managers that
do **not** inherit `BlueprintServiceManagerBase` MUST implement this hook explicitly
or `forceRemoveOperator` will revert as soon as the eviction would push the operator
count below `minOperators`.

##### Parameters

| Name | Type | Description |
| --------- | ------ | -------------- |
| serviceId | uint64 | The service ID |

##### Return Values

| Name | Type | Description |
| ---- | ---- | ------------------------------------------------------- |
| ok | bool | True to allow eviction below the minimum operator count |

#### onRequest

```solidity
Expand Down
8 changes: 7 additions & 1 deletion pages/developers/api/reference/generated/IMBSMRegistry.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,13 @@ Get the latest revision number registered in the registry
function pinBlueprint(uint64 blueprintId, uint32 revision) external
```

Pin a blueprint to a specific revision (0 disallowed)
Pin a blueprint to a specific revision (0 disallowed).

Reverts if `revision` is currently inside the deprecation grace window. Pinning a blueprint
to a revision that is itself deprecated would defeat the deprecation flow: `getMBSM` would
return `address(0)` the moment `completeDeprecation` ran, breaking every BSM call for the
pinned blueprint. Choose a revision that is not scheduled for deprecation, or wait until
the deprecation has fully completed before pinning to a different revision.

#### unpinBlueprint

Expand Down
Loading
Loading