Relay

Relay

This file documents a contract which is not yet deployed to Mainnet.

Data

struct Data {
  uint64 requestCount;
  uint64 currentRequestID;
  uint64 currentRequestGroupID;
  uint64 currentRequestStartBlock;
  struct AltBn128.G1Point previousEntry;
  uint32 relayEntrySoftTimeout;
  uint32 relayEntryHardTimeout;
  uint96 relayEntrySubmissionFailureSlashingAmount;
}

relaySeed

bytes relaySeed

Seed used as the first relay entry value. It's a G1 point G * PI = G * 31415926535897932384626433832795028841971693993751058209749445923078164062862 Where G is the generator of G1 abstract cyclic group.

RelayEntryRequested

event RelayEntryRequested(uint256 requestId, uint64 groupId, bytes previousEntry)

RelayEntrySubmitted

event RelayEntrySubmitted(uint256 requestId, address submitter, bytes entry)

RelayEntryTimedOut

event RelayEntryTimedOut(uint256 requestId, uint64 terminatedGroupId)

initSeedEntry

function initSeedEntry(struct Relay.Data self) internal

Initializes the very first previousEntry with an initial relaySeed value. Can be performed only once.

requestEntry

function requestEntry(struct Relay.Data self, uint64 groupId) internal

Creates a request to generate a new relay entry, which will include a random number (by signing the previous entry's random number).

Parameters

submitEntryBeforeSoftTimeout

function submitEntryBeforeSoftTimeout(struct Relay.Data self, bytes entry, bytes groupPubKey) internal

Creates a new relay entry. Gas-optimized version that can be called only before the soft timeout. This should be the majority of cases.

Parameters

submitEntry

function submitEntry(struct Relay.Data self, bytes entry, bytes groupPubKey) internal returns (uint96)

Creates a new relay entry. Can be called at any time. In case the soft timeout has not been exceeded, it is more gas-efficient to call the second variation of submitEntry.

Parameters

Return Values

_submitEntry

function _submitEntry(struct Relay.Data self, bytes entry, bytes groupPubKey) internal

calculateSlashingAmount

function calculateSlashingAmount(struct Relay.Data self) internal view returns (uint96)

Calculates the slashing amount for all group members.

Must be used when a soft timeout was hit.

Return Values

setTimeouts

function setTimeouts(struct Relay.Data self, uint256 _relayEntrySoftTimeout, uint256 _relayEntryHardTimeout) internal

Updates relay-related parameters

Parameters

setRelayEntrySubmissionFailureSlashingAmount

function setRelayEntrySubmissionFailureSlashingAmount(struct Relay.Data self, uint96 newRelayEntrySubmissionFailureSlashingAmount) internal

Set relayEntrySubmissionFailureSlashingAmount parameter.

Parameters

retryOnEntryTimeout

function retryOnEntryTimeout(struct Relay.Data self, uint64 newGroupId) internal

Retries the current relay request in case a relay entry timeout was reported.

Parameters

cleanupOnEntryTimeout

function cleanupOnEntryTimeout(struct Relay.Data self) internal

Cleans up the current relay request in case a relay entry timeout was reported.

isRequestInProgress

function isRequestInProgress(struct Relay.Data self) internal view returns (bool)

Returns whether a relay entry request is currently in progress.

Return Values

hasRequestTimedOut

function hasRequestTimedOut(struct Relay.Data self) internal view returns (bool)

Returns whether the current relay request has timed out.

Return Values

softTimeoutBlock

function softTimeoutBlock(struct Relay.Data self) internal view returns (uint256)

Calculates soft timeout block for the pending relay request.

Return Values

Last updated