BuildapireferencegeneratedITangleSlashing

ITangleSlashing

Source: https://github.com/tangle-network/tnt-core/blob/main/src/interfaces/ITangleSlashing.sol

ITangleSlashing

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

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

Propose a slash against an operator

Parameters
NameTypeDescription
serviceIduint64The service where violation occurred
operatoraddressThe operator to slash
slashBpsuint16Slash percentage in basis points
evidencebytes32Evidence hash (must be non-zero)
Return Values
NameTypeDescription
slashIduint64The ID of the created slash proposal

disputeSlash

function disputeSlash(uint64 slashId, string reason) external payable

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

function executeSlash(uint64 slashId) external returns (uint256 actualSlashed)

Execute a slash proposal

executeSlashBatch

function executeSlashBatch(uint64[] slashIds) external returns (uint256 totalSlashed, uint256 executedCount)

Execute a batch of slashes

getExecutableSlashes

function getExecutableSlashes(uint64 fromId, uint64 toId) external view returns (uint64[] ids)

Get list of executable slash IDs in a range

cancelSlash

function cancelSlash(uint64 slashId, string reason) external

Cancel a slash proposal

setSlashConfig

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

Update slashing configuration

Parameters
NameTypeDescription
disputeWindowuint64Time after proposeSlash during which the operator can dispute
instantSlashEnabledboolReserved emergency toggle (no effect through the standard API)
maxSlashBpsuint16Hard cap on any single slash proposal
disputeResolutionDeadlineuint64Time SLASH_ADMIN has to resolve a dispute before it auto-fails
disputeBonduint256Native asset bond required to dispute (0 = disabled)
maxPendingSlashesPerOperatoruint16Cap on concurrent pending slashes per operator (anti-spam)

getSlashProposal

function getSlashProposal(uint64 slashId) external view returns (struct SlashingLib.SlashProposal)

Get slash proposal details

getSlashConfig

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

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
NameTypeDescription
slashIduint64The new slash ID (indexed)
serviceIduint64The service where the violation occurred (indexed)
operatoraddressThe slashed operator (indexed)
proposeraddressThe address that called proposeSlash
slashBpsuint16Requested slash percentage in basis points
effectiveSlashBpsuint16Slash percentage after exposure scaling (what will actually be applied)
evidencebytes32Evidence hash (non-zero, enforced by proposeSlash)
executeAfteruint64Earliest UNIX timestamp at which the slash can be executed

SlashDisputed

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
NameTypeDescription
slashIduint64The disputed slash ID (indexed)
disputeraddressThe address that called disputeSlash
reasonstringHuman-readable rationale (free-form input)

SlashExecuted

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

Emitted when a slash is executed.

Parameters
NameTypeDescription
slashIduint64The executed slash ID (indexed)
serviceIduint64The service the slash was applied to (indexed)
operatoraddressThe slashed operator (indexed)
actualSlasheduint256Total stake actually burned in the underlying call

SlashCancelled

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

Emitted when a slash proposal is cancelled by SLASH_ADMIN_ROLE.

Parameters
NameTypeDescription
slashIduint64The cancelled slash ID (indexed)
cancelleraddressAddress that called cancelSlash (indexed)
reasonstringHuman-readable rationale (free-form input)

SlashConfigUpdated

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.