null result -> abstain from vote
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 34s
Details
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 34s
Details
This commit is contained in:
parent
d3f4740422
commit
8be06678d7
|
@ -36,7 +36,7 @@ const start = async () => {
|
|||
expectedAuthors = await getBatchPostAuthorWeights(post.embeddedData.batchItems);
|
||||
} catch (e) {
|
||||
console.error('Error calculating batch post author weights', e);
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
const valid = authorsMatch(post.authors, expectedAuthors);
|
||||
console.log(`batch post ${pool.props.postId} is ${valid ? 'valid' : 'invalid'}`);
|
||||
|
@ -45,11 +45,6 @@ const start = async () => {
|
|||
|
||||
// Even if we're not the current batch worker, keep track of batch items
|
||||
initializeBatchItems();
|
||||
try {
|
||||
batchItems = await applicationData.get('batchItems');
|
||||
} catch (e) {
|
||||
batchItems = [];
|
||||
}
|
||||
|
||||
// Check for an assigned batch worker
|
||||
await initializeBatchWorker();
|
||||
|
|
|
@ -40,8 +40,6 @@ const start = async () => {
|
|||
}
|
||||
console.log('postId:', pool.props.postId);
|
||||
console.log('post.content:', post.content);
|
||||
const results = await Promise.mapSeries(deciders, (decider) => decider(pool, post));
|
||||
const inFavor = results.some((x) => x === true);
|
||||
// We have the opportunity to stake for/against this validation pool.
|
||||
// To implement the legislative process of upgrading this protocol,
|
||||
// the execution of this code can be protected by a given proposal.
|
||||
|
@ -49,6 +47,15 @@ const start = async () => {
|
|||
if (!enableStaking) {
|
||||
return;
|
||||
}
|
||||
const decisions = await Promise.mapSeries(deciders, (decider) => decider(pool, post));
|
||||
const inFavor = decisions.some((x) => x === true);
|
||||
const nullResult = decisions.some((x) => x === null);
|
||||
if (!inFavor && nullResult) {
|
||||
console.log(`Obtained a NULL RESULT for pool ${poolIndex}. Abstaining from the vote.`);
|
||||
// TODO: Retry?
|
||||
// TODO: Notify
|
||||
return;
|
||||
}
|
||||
// Stake all available reputation
|
||||
const currentRep = await dao.balanceOf(await wallet.getAddress());
|
||||
console.log(`STAKING ${currentRep} ${inFavor ? 'in favor of' : 'against'} pool ${poolIndex}`);
|
||||
|
|
Loading…
Reference in New Issue