# IPenalizer
The Penalizer Interface
In some cases the behavior of a Relay Server may be found to be illegal.
It is the responsibility of a Penalizer
contract to judge whether there was a penalizable event.
In case there was, the Penalizer
will direct the RelayHub
to slash the stake of the faulty Relay Server.
# Functions
# commit(bytes32 commitHash)
(external)
Called by the reporter as the first step in the commit-reveal process. Any sender can call it to make sure no-one can front-run it to claim this penalization.
commitHash: The hash of the report of a penalizable behaviour the reporter wants to reveal.
Calculated as commit(keccak(encodedPenalizeFunction))
.
# penalizeRepeatedNonce(bytes unsignedTx1, bytes signature1, bytes unsignedTx2, bytes signature2, contract IRelayHub hub, uint256 randomValue)
(external)
Called by the reporter as the second step in the commit-reveal process.
If a Relay Worker attacked the system by signing multiple transactions with same nonce so only one is accepted,
anyone can grab both transactions from the blockchain and submit them here.
Check whether unsignedTx1
!= unsignedTx2
, that both are signed by the same address,
and that unsignedTx1.nonce
== unsignedTx2.nonce
.
If all conditions are met, relay is considered an "offending relay".
The offending relay will be unregistered immediately, its stake will be forfeited and given
to the address who reported it (the msg.sender
), thus incentivizing anyone to report offending relays.
# penalizeIllegalTransaction(bytes unsignedTx, bytes signature, contract IRelayHub hub, uint256 randomValue)
(external)
Called by the reporter as the second step in the commit-reveal process.
The Relay Workers are not allowed to make calls other than to the relayCall
method.
# versionPenalizer()
→ string
(external)
# Return values
SemVer-compliant version of the Penalizer
contract.
# getPenalizeBlockDelay()
→ uint256
(external)
# Return values
minimum delay between commit and reveal steps.
# getPenalizeBlockExpiration()
→ uint256
(external)
# Return values
maximum delay between commit and reveal steps.
# Events
# CommitAdded(address sender, bytes32 commitHash, uint256 readyBlockNumber)
Emitted once the reporter submits the first step in the commit-reveal process.
# Structs
# Transaction
uint256 nonce
uint256 gasLimit
address to
uint256 value
bytes data
← IPaymaster IRelayHub →