openvibers/openvibe.network Commits
Grants: bench.judgement.cast for Codes and Run (races as matches) (#900)
Changes
@@@ -802,6 +802,9 @@ const DEFAULT_GRANTS = [['exchange', 'bench.round.create', 'openvibe.bench', []],['exchange', 'bench.judgement.cast', 'openvibe.bench', []],['exchange', 'bench.board.read', 'openvibe.bench', []],++ // The evaluation loop (compare-arena-ecosystem.md, Contracts 0.422.0): Codes records its races (tests, then the merge)++ // and Run records the Arena's race plays as bench.match@1 at Bench's POST /api/v1/matches.++ ...['codes', 'run'].map((svc) => [svc, 'bench.judgement.cast', 'openvibe.bench', []]),// OpenVibe.Fun (contracts 0.236.0): its public quests and plans in Search through the owner API (owner fun), and// its account-event subscriptions; its export/deletion pair is above. Live and Chat are public reads and Today// uses the viewer's own token, so it holds no Live, Chat or Today grant. The optional OpenCoin grantsnnew file mode 100644@@@ -0,0 +1,16 @@++/**++ * The evaluation loop (Contracts 0.422.0): Codes records its races and Run the Arena's race plays as bench.match@1 at++ * Bench's POST /api/v1/matches, which takes bench.judgement.cast on audience openvibe.bench.++ *++ * node test/bench-matches-grant.test.js++ */++'use strict';++const assert = require('assert');++const contracts = require('openvibe-contracts');++const principals = require('../server/identity/principals');++++const has = (svc, cap, aud) => principals.DEFAULT_GRANTS.some((g) => g[0] === svc && g[1] === cap && g[2] === aud);++for (const svc of ['codes', 'run']) assert.ok(has(svc, 'bench.judgement.cast', 'openvibe.bench'), `${svc} records matches on Bench`);++const cap = contracts.capabilities.get('bench.judgement.cast');++assert.ok(cap && cap.status === 'active' && cap.owner === 'bench', 'bench.judgement.cast is an active Bench capability');++console.log('bench matches grant: ok');
@@ -802,6 +802,9 @@ const DEFAULT_GRANTS = [
@@ -802,6 +802,9 @@ const DEFAULT_GRANTS = [
['exchange', 'bench.round.create', 'openvibe.bench', []],
['exchange', 'bench.round.create', 'openvibe.bench', []],
['exchange', 'bench.judgement.cast', 'openvibe.bench', []],
['exchange', 'bench.judgement.cast', 'openvibe.bench', []],
['exchange', 'bench.board.read', 'openvibe.bench', []],
['exchange', 'bench.board.read', 'openvibe.bench', []],
+ // The evaluation loop (compare-arena-ecosystem.md, Contracts 0.422.0): Codes records its races (tests, then the merge)
+ // and Run records the Arena's race plays as bench.match@1 at Bench's POST /api/v1/matches.
+ ...['codes', 'run'].map((svc) => [svc, 'bench.judgement.cast', 'openvibe.bench', []]),
// OpenVibe.Fun (contracts 0.236.0): its public quests and plans in Search through the owner API (owner fun), and
// OpenVibe.Fun (contracts 0.236.0): its public quests and plans in Search through the owner API (owner fun), and
// its account-event subscriptions; its export/deletion pair is above. Live and Chat are public reads and Today
// its account-event subscriptions; its export/deletion pair is above. Live and Chat are public reads and Today
// uses the viewer's own token, so it holds no Live, Chat or Today grant. The optional OpenCoin grants
// uses the viewer's own token, so it holds no Live, Chat or Today grant. The optional OpenCoin grants
new file mode 100644
new file mode 100644
@@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
+/**
+ * The evaluation loop (Contracts 0.422.0): Codes records its races and Run the Arena's race plays as bench.match@1 at
+ * Bench's POST /api/v1/matches, which takes bench.judgement.cast on audience openvibe.bench.
+ *
+ * node test/bench-matches-grant.test.js
+ */
+'use strict';
+const assert = require('assert');
+const contracts = require('openvibe-contracts');
+const principals = require('../server/identity/principals');
+
+const has = (svc, cap, aud) => principals.DEFAULT_GRANTS.some((g) => g[0] === svc && g[1] === cap && g[2] === aud);
+for (const svc of ['codes', 'run']) assert.ok(has(svc, 'bench.judgement.cast', 'openvibe.bench'), `${svc} records matches on Bench`);
+const cap = contracts.capabilities.get('bench.judgement.cast');
+assert.ok(cap && cap.status === 'active' && cap.owner === 'bench', 'bench.judgement.cast is an active Bench capability');
+console.log('bench matches grant: ok');