EcdsaDkg
EcdsaDkg
Parameters
Data
Result
State
groupSize
Size of a group in ECDSA wallet.
DkgStarted
DkgResultSubmitted
DkgTimedOut
DkgResultApproved
DkgResultChallenged
DkgStateLocked
DkgSeedTimedOut
init
Initializes SortitionPool and EcdsaDkgValidator addresses. Can be performed only once.
Parameters
currentState
Determines the current state of group creation. It doesn't take timeouts into consideration. The timeouts should be tracked and notified separately.
lockState
Locks the sortition pool and starts awaiting for the group creation seed.
start
submitResult
Allows to submit a DKG result. The submitted result does not go through a validation and before it gets accepted, it needs to wait through the challenge period during which everyone has a chance to challenge the result as invalid one. Submitter of the result needs to be in the sortition pool and if the result gets challenged, the submitter will get slashed.
hasSeedTimedOut
Checks if awaiting seed timed out.
Return Values
hasDkgTimedOut
Checks if DKG timed out. The DKG timeout period includes time required for off-chain protocol execution and time for the result publication. After this time a result cannot be submitted and DKG can be notified about the timeout. DKG period is adjusted by result submission offset that include blocks that were mined while invalid result has been registered until it got challenged.
Return Values
notifySeedTimeout
Notifies about the seed was not delivered and restores the initial DKG state (IDLE).
notifyDkgTimeout
Notifies about DKG timeout.
approveResult
Approves DKG result. Can be called when the challenge period for the submitted result is finished. Considers the submitted result as valid. For the first submitterPrecedencePeriodLength
blocks after the end of the challenge period can be called only by the DKG result submitter. After that time, can be called by anyone.
Can be called after a challenge period for the submitted result.
Parameters
Return Values
challengeResult
Challenges DKG result. If the submitted result is proved to be invalid it reverts the DKG back to the result submission phase.
Can be called during a challenge period for the submitted result.
Parameters
Return Values
requireChallengeExtraGas
Due to EIP150, 1/64 of the gas is not forwarded to the call, and will be kept to execute the remaining operations in the function after the call inside the try-catch.
To ensure there is no way for the caller to manipulate gas limit in such a way that the call inside try-catch fails with out-of-gas and the rest of the function is executed with the remaining 1/64 of gas, we require an extra gas amount to be left at the end of the call to the function challenging DKG result and wrapping the call to EcdsaDkgValidator and TokenStaking contracts inside a try-catch.
isResultValid
Checks if DKG result is valid for the current DKG.
Parameters
Return Values
setSeedTimeout
Set setSeedTimeout parameter.
setResultChallengePeriodLength
Set resultChallengePeriodLength parameter.
setResultChallengeExtraGas
Set resultChallengeExtraGas parameter.
setResultSubmissionTimeout
Set resultSubmissionTimeout parameter.
setSubmitterPrecedencePeriodLength
Set submitterPrecedencePeriodLength parameter.
complete
Completes DKG by cleaning up state.
Should be called after DKG times out or a result is approved.
Last updated