only stake half available REP if an error was encountered when evaluating a VP
This commit is contained in:
parent
72e16651fb
commit
d9479152da
|
@ -50,17 +50,25 @@ const start = async () => {
|
|||
const decisions = await Promise.mapSeries(deciders, (decider) => decider(pool, post));
|
||||
const inFavor = decisions.some((x) => x === true);
|
||||
const nullResult = decisions.some((x) => x === null);
|
||||
const currentRep = await dao.balanceOf(await wallet.getAddress());
|
||||
let stakeAmount = currentRep;
|
||||
if (!inFavor && nullResult) {
|
||||
console.log(`Obtained a NULL RESULT for pool ${poolIndex}. Abstaining from the vote.`);
|
||||
console.log(`Obtained a NULL RESULT for pool ${poolIndex}.`);
|
||||
// TODO: Retry?
|
||||
// TODO: Notify
|
||||
return;
|
||||
// Calculate the minimum stake S against the post, such that if the honest actors
|
||||
// each stake S, the result will be enough to meet the win ratio.
|
||||
// This way, we combat the threat of a truly invalid post,
|
||||
// while reducing our exposure in the case that the error is unique to us.
|
||||
// Assume 2/3 honest actors.
|
||||
// S * (2/3) = 1/3
|
||||
// S = 1/2;
|
||||
stakeAmount = Math.ceil(currentRep / 2);
|
||||
}
|
||||
// Stake all available reputation
|
||||
const currentRep = await dao.balanceOf(await wallet.getAddress());
|
||||
console.log(`STAKING ${currentRep} ${inFavor ? 'in favor of' : 'against'} pool ${poolIndex}`);
|
||||
console.log(`STAKING ${stakeAmount} ${inFavor ? 'in favor of' : 'against'} pool ${poolIndex}`);
|
||||
try {
|
||||
await dao.stakeOnValidationPool(poolIndex, currentRep, inFavor);
|
||||
await dao.stakeOnValidationPool(poolIndex, stakeAmount, inFavor);
|
||||
} catch (e) {
|
||||
// Maybe the end time passed?
|
||||
console.error(`STAKING failed, reason: ${e.reason}`);
|
||||
|
|
Loading…
Reference in New Issue