Rename `member` to `expert`
This commit is contained in:
parent
f93aaf7373
commit
f944d19728
|
@ -23,3 +23,31 @@ We're currently supporting anonymous voting.
|
|||
With anonymous voting, we need to wait until the end of the vote duration,
|
||||
and then have a separate interval in which voters reveal their identities.
|
||||
For now, we can let anonymous voters reveal their identities at any time
|
||||
|
||||
---
|
||||
|
||||
Bench.totalReputation is a very important quantity, isn't it? Basically determines inflation for reputation.
|
||||
|
||||
---
|
||||
|
||||
Should availability registration encumber reputation?
|
||||
|
||||
---
|
||||
|
||||
- Is a particular availability stake amount required?
|
||||
|
||||
Currently I support updating the staked amount.
|
||||
Seems like a soft protocol thing.
|
||||
A given DAO can have a formula for deciding appropriate amounts.
|
||||
|
||||
---
|
||||
|
||||
#
|
||||
|
||||
Implementing forum
|
||||
|
||||
Does the following make sense?
|
||||
We will link the forum to the bench
|
||||
An author of a forum post /_ ? is always? can be? _/ a reputation holder.
|
||||
This is what we call a member. Let's update that terminology to be `reputationHolder`.
|
||||
That's too long, though. Let's rename it to `expert`.
|
|
@ -4,7 +4,7 @@ import { Action } from './action.js';
|
|||
import { PostMessage } from './message.js';
|
||||
import { CryptoUtil } from './crypto.js';
|
||||
|
||||
export class Member extends Actor {
|
||||
export class Expert extends Actor {
|
||||
constructor(name, scene) {
|
||||
super(name, scene);
|
||||
this.actions = {
|
||||
|
@ -32,7 +32,6 @@ export class Member extends Actor {
|
|||
async submitPostViaNetwork(forumNode, post, stake) {
|
||||
// TODO: Include fee
|
||||
const postMessage = new PostMessage({ post, stake });
|
||||
console.log('submitPostViaNetwork', postMessage);
|
||||
await postMessage.sign(this.reputationKey);
|
||||
this.actions.submitPostViaNetwork.log(this, forumNode, null, { id: post.id });
|
||||
// For now, directly call forumNode.receiveMessage();
|
|
@ -72,7 +72,6 @@ export class ValidationPool extends Actor {
|
|||
};
|
||||
// tokens minted "for" the post go toward stake of author voting for their own post
|
||||
// also, author can provide additional stakes, e.g. availability stakes for work evidence post
|
||||
console.log('initiateValidationPool casting vote', { signingPublicKey });
|
||||
this.castVote(signingPublicKey, {
|
||||
position: true,
|
||||
stake: this.tokens.for + authorStake,
|
||||
|
@ -83,9 +82,6 @@ export class ValidationPool extends Actor {
|
|||
async castVote(signingPublicKey, {
|
||||
position, stake, lockingTime = 0, anonymous = true,
|
||||
}) {
|
||||
console.log('castVote', {
|
||||
signingPublicKey, position, stake, anonymous,
|
||||
});
|
||||
const vote = new Vote(position, stake, lockingTime);
|
||||
if (this.state === ValidationPoolStates.CLOSED) {
|
||||
throw new Error(`Validation pool ${this.id} is closed`);
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<script type="module">
|
||||
import { Box } from "/classes/box.js";
|
||||
import { Scene } from "/classes/scene.js";
|
||||
import { Member } from "/classes/member.js";
|
||||
import { Expert } from "/classes/expert.js";
|
||||
import { Bench } from "/classes/bench.js";
|
||||
import { Business } from "/classes/business.js";
|
||||
import { Availability } from "/classes/availability.js";
|
||||
|
@ -27,17 +27,17 @@
|
|||
));
|
||||
|
||||
const members = (window.members = []);
|
||||
const newMember = async () => {
|
||||
const newExpert = async () => {
|
||||
const index = members.length;
|
||||
const name = `Member${index + 1}`;
|
||||
const member = await new Member(name, scene).initialize();
|
||||
const name = `Expert${index + 1}`;
|
||||
const member = await new Expert(name, scene).initialize();
|
||||
members.push(member);
|
||||
return member;
|
||||
};
|
||||
|
||||
const member1 = await newMember();
|
||||
const member2 = await newMember();
|
||||
await newMember();
|
||||
const member1 = await newExpert();
|
||||
const member2 = await newExpert();
|
||||
await newExpert();
|
||||
const bench = (window.bench = new Bench("Bench", scene));
|
||||
const forum = (window.forum = new Forum(bench, "Forum", scene));
|
||||
const availability = (window.bench = new Availability(
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
import { Box } from "/classes/box.js";
|
||||
import { Scene } from "/classes/scene.js";
|
||||
import { PostContent } from "/classes/post.js";
|
||||
import { Member } from "/classes/member.js";
|
||||
import { Expert } from "/classes/expert.js";
|
||||
import { ForumNode } from "/classes/forum-node.js";
|
||||
import { ForumNetwork } from "/classes/forum-network.js";
|
||||
import { CryptoUtil } from "/classes/crypto.js";
|
||||
|
@ -23,8 +23,8 @@
|
|||
"sequenceDiagram"
|
||||
);
|
||||
|
||||
window.author1 = await new Member("author1", window.scene).initialize();
|
||||
window.author2 = await new Member("author2", window.scene).initialize();
|
||||
window.author1 = await new Expert("author1", window.scene).initialize();
|
||||
window.author2 = await new Expert("author2", window.scene).initialize();
|
||||
|
||||
window.forumNetwork = new ForumNetwork();
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<script type="module">
|
||||
import { Box } from "/classes/box.js";
|
||||
import { Scene } from "/classes/scene.js";
|
||||
import { Member } from "/classes/member.js";
|
||||
import { Expert } from "/classes/expert.js";
|
||||
import { Bench } from "/classes/bench.js";
|
||||
import { Business } from "/classes/business.js";
|
||||
import { Availability } from "/classes/availability.js";
|
||||
|
@ -28,10 +28,10 @@
|
|||
));
|
||||
|
||||
const members = (window.members = []);
|
||||
const newMember = async () => {
|
||||
const newExpert = async () => {
|
||||
const index = members.length;
|
||||
const name = `Member${index + 1}`;
|
||||
const member = await new Member(name, scene).initialize();
|
||||
const name = `Expert${index + 1}`;
|
||||
const member = await new Expert(name, scene).initialize();
|
||||
members.push(member);
|
||||
return member;
|
||||
};
|
||||
|
@ -43,9 +43,9 @@
|
|||
return postId;
|
||||
};
|
||||
|
||||
const member1 = await newMember();
|
||||
const member2 = await newMember();
|
||||
await newMember();
|
||||
const member1 = await newExpert();
|
||||
const member2 = await newExpert();
|
||||
await newExpert();
|
||||
const bench = (window.bench = new Bench("Bench", scene));
|
||||
const forum = (window.forum = new Forum(bench, "Forum", scene));
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<script type="module">
|
||||
import { Box } from "/classes/box.js";
|
||||
import { Scene } from "/classes/scene.js";
|
||||
import { Member } from "/classes/member.js";
|
||||
import { Expert } from "/classes/expert.js";
|
||||
import { Bench } from "/classes/bench.js";
|
||||
import { delay } from "/util.js";
|
||||
|
||||
|
@ -19,12 +19,12 @@
|
|||
const scene = (window.scene = new Scene("Validation Pool test", rootBox).log(
|
||||
"sequenceDiagram"
|
||||
));
|
||||
const member1 = (window.member1 = await new Member(
|
||||
"Member1",
|
||||
const member1 = (window.member1 = await new Expert(
|
||||
"Expert1",
|
||||
scene
|
||||
).initialize());
|
||||
const member2 = (window.member2 = await new Member(
|
||||
"Member2",
|
||||
const member2 = (window.member2 = await new Expert(
|
||||
"Expert2",
|
||||
scene
|
||||
).initialize());
|
||||
const bench = (window.bench = new Bench("Bench", scene));
|
||||
|
@ -58,6 +58,20 @@
|
|||
tokenLossRatio: 1,
|
||||
});
|
||||
await member1.revealIdentity(pool);
|
||||
// Attempting to evaluate winning conditions before the duration has expired
|
||||
// should result in an exception
|
||||
try {
|
||||
await pool.evaluateWinningConditions();
|
||||
} catch (e) {
|
||||
if (e.message.match(/Validation pool duration has not yet elapsed/)) {
|
||||
console.log(
|
||||
"Caught expected error: Validation pool duration has not yet elapsed"
|
||||
);
|
||||
} else {
|
||||
console.error("Unexpected error");
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
await delay(1000);
|
||||
await pool.evaluateWinningConditions(); // Vote passes
|
||||
await updateDisplayValues();
|
||||
|
|
Loading…
Reference in New Issue