Add example of negatively citing a zero-value post

Also adds misc. notes
This commit is contained in:
Ladd Hoffman 2023-03-13 21:25:54 -05:00
parent dddee70365
commit 63b43a0f4d
8 changed files with 86 additions and 10 deletions

View File

@ -10,3 +10,11 @@ Effective power can be considered as a flow rate of posts; (value per post) / (d
Internal energy is similar to Forum total value / DAO total reputation
Total available reputation is similar to thermodynamic free energy
---
Examples to add:
- Incinerator
- Negatively cite a zero-value post -- intent is to show how governance might cite a post as a counter-example

View File

@ -0,0 +1,9 @@
Matrix is a communications network.
It has a client-server, server-server decentralized architecture.
Rooms are synced (eventually consistent) among all servers with clients participating in the room.
Matrix supports "Application Services", which are limited to funcion in a passive mode, meaning they only piggyback on top of the existing protocols.
Synapse, a Matrix server implementation, supports "Modules"
The Matrix devs recognize the need for a robust reputation system and are in pursuit of funding and development for that purpose.

View File

@ -54,8 +54,7 @@ export class ValidationPool extends ReputationHolder {
|| [null, undefined].includes(duration)
) {
throw new Error(
`Duration must be in the range [${params.voteDuration.min}, ${
params.voteDuration.max ?? 'Inf'
`Duration must be in the range [${params.voteDuration.min}, ${params.voteDuration.max ?? 'Inf'
}]; got ${duration}`,
);
}

View File

@ -21,6 +21,7 @@
<li><a href="./tests/forum4.test.html">Redistribute power through subsequent support</a></li>
<li><a href="./tests/forum5.test.html">Destroy a post after it has received positive citations</a></li>
<li><a href="./tests/forum6.test.html">Initially zero-valued posts later receive citations</a></li>
<li><a href="./tests/forum7.test.html">Negatively cite a zero-valued post</a></li>
</ol>
</ul>
<ul>

View File

@ -33,6 +33,7 @@
<script type="module" src="./scripts/forum/forum4.test.js"></script>
<script type="module" src="./scripts/forum/forum5.test.js"></script>
<script type="module" src="./scripts/forum/forum6.test.js"></script>
<script type="module" src="./scripts/forum/forum7.test.js"></script>
<script defer class="mocha-init">
mocha.setup({
ui: 'bdd',

View File

@ -0,0 +1,26 @@
<!DOCTYPE html>
<head>
<title>Forum test 7</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="https://unpkg.com/mocha/mocha.css" />
<link type="text/css" rel="stylesheet" href="../index.css" />
</head>
<body>
<h2><a href="../">DGF Tests</a></h2>
<div id="mocha"></div>
<div id="scene"></div>
</body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/radash/10.7.0/radash.js"
integrity="sha512-S207zKWG3iqXqe6msO7/Mr8X3DzzF4u8meFlokHjGtBPTGUhgzVo0lpcqEy0GoiMUdcoct+H+SqzoLsxXbynzg=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://unpkg.com/mocha/mocha.js"></script>
<script src="https://unpkg.com/chai/chai.js"></script>
<script type="module" src="./scripts/forum/forum7.test.js"></script>
<script defer class="mocha-init">
mocha.setup({
ui: 'bdd',
});
chai.should();
</script>

View File

@ -10,7 +10,7 @@ describe('Forum', function tests() {
await forumTest.setup();
});
context('Initially zero-valued post later receives citations', async () => {
context('Negatively citing a zero-valued post', async () => {
let forum;
let experts;
let posts;
@ -66,11 +66,4 @@ describe('Forum', function tests() {
});
});
// await addPost(experts[0], 10);
// await addPost(experts[0], 10, [{ postId: posts[3], weight: -1 }]);
// await addPost(experts[0], 10, [{ postId: posts[4], weight: -1 }]);
// await addPost(expert3, 'Post 4', 100, [{ postId: postId2, weight: -1 }]);
// await addPost(expert1, 'Post 5', 100, [{ postId: postId3, weight: -1 }]);
mochaRun();

View File

@ -0,0 +1,39 @@
import { mochaRun } from '../../../util.js';
import { ForumTest } from './forum.test-util.js';
describe('Forum', function tests() {
this.timeout(0);
const forumTest = new ForumTest();
before(async () => {
await forumTest.setup();
});
context('Initially zero-valued post later receives citations', async () => {
let forum;
let experts;
let posts;
before(() => {
forum = forumTest.forum;
experts = forumTest.experts;
posts = forumTest.posts;
});
it('Post1 has zero value', async () => {
await forumTest.addPost(experts[0], 0);
forum.getPost(posts[0]).value.should.equal(0);
});
it('Post2 negatively cites Post1', async () => {
await forumTest.addPost(experts[0], 10, [
{ postId: posts[0], weight: -1 },
]);
forum.getPost(posts[0]).value.should.equal(0);
forum.getPost(posts[1]).value.should.equal(10);
});
});
});
mochaRun();