The Offchain adapter is under development, this documentation is not up to date.
The Offchain Voting Adapter manages offchain voting using a merkle tree to commit to a result that can be challenge during the grace period if necessary.
There are also two fallback solutions implemented:
- fallback voting that falls back to simple onchain voting if something is wrong
- admin force fail proposal to mark a proposal as failed by an admin if necessary. This is present until a more formal verfication of the system is done
The idea is to use a merkle tree to commit to a computation (calculate the result) and have a way to challenge a result if anyone sees an issue in the computation. The approach assumes data availability.
Each leaf in the merkle tree is a "step" in computing the vote result. The last leaf is the result (and the leaf submitted). This works with a modified version of snapshot that uses ERC-712 for hashing / signing proposals and votes.
voting.votingPeriod: How long after the starting time is the voting valid (seconds).
voting.gracePeriod: How long after the end of the voting period is the result settled (seconds).
offchainvoting.fallbackThreshold: The threshold ( in % ) of members needed to request a fallback voting for it to kick in.
Admin function (only owner can call it) to fail a proposal. Used as a failsafe if anything goes wrong since the adapter is still new
Submits a new vote result for a specific dao / proposalId. result is the last step that contains the vote result. resultRoot is the merkle root of the computation merkle tree.
If a result has been already published, it checks whether this one has more steps (index is higher) or if the vote is already finished.
If the voting period is not done yet but the result cannot be changed anymore (50+% have voted either yes or no), the grace period starts right away
Returns the status of a vote session.
Checks and marks a result as bad if a specific node has bad data. The checks are:
- bad signature
- invalid choice
- bad proposalHash
- vote timestamp is after the current grace period started
function defining what a valid choice is
Checks that the step from a node to another is correct or not let's define a step function S(state, choice) that creates a new state based on a previous one and a choice We check that S(previousState, currentChoice) = currentState If not, we challenge the result
If something is wrong with the vote but it is not possible to challenge it, members can request a fallback
If a result has been challenged, it is needed to vote on the faith of the reporter. Should he continue being a member or should he be banned.
Process the vote for the faith of a bad reporter
- No event are emitted.