-
-
Save arj03/f4a0f38f90c204bddbd57aa5d6a18216 to your computer and use it in GitHub Desktop.
comment booting | |
enter peer | |
hops peer 1 | |
load peer @TWKY4Bq5ezVqbXV2D7NyODxCXgu8o4rgp/sf1GdHbCw=.ed25519 | |
enter server | |
hops server 1 | |
load server @3eIPXptMcbrFPw8seKbywmPbRogERylNuoFVaZ9AlOg=.ed25519 | |
alloffsets server | |
start peer ssb-server | |
start server ssb-server | |
follow peer server | |
follow server peer | |
connect peer server | |
waituntil peer server@latest | |
stop peer |
Ergonomics:
- Allow space in script file
- Allow comments (#) in script file
- Maybe change netsim
test
command torun
, coming from node test means self-test, not run a test from a script :) Or at least add some more info to just running netsim. - Document the different commands: https://github.com/ssb-ngi-pointer/netsim/blob/main/commands.md, like what does post do?
- Change README.md in https://github.com/ssb-ngi-pointer/netsim/ to focus on the command line + examples and maybe move the current readme or parts of it to some kind of history document
- print the number of messages on each peer in the beginning of run
- ctrl-c doesn't work properly ;-)
Check for scheduler changes
my monstrosity of a conn-scheduler.js
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConnScheduler = void 0;
const z = require("ziii");
const secret_stack_decorators_1 = require("secret-stack-decorators");
const ConnQuery = require("ssb-conn-query");
const pull = require('pull-stream');
const Pausable = require('pull-pause');
const ip = require('ip');
const onWakeup = require('on-wakeup');
const onNetwork = require('on-change-network-strict');
const hasNetwork = require('has-network2');
const Ref = require('ssb-ref');
const debug = require('debug')('ssb:conn:scheduler');
let lastCheck = 0;
let lastValue = null;
function hasNetworkDebounced() {
if (lastCheck + 1e3 < Date.now()) {
lastCheck = Date.now();
lastValue = hasNetwork();
}
return lastValue;
}
function isOffline(p) {
if (ip.isLoopback(p[1].host) || p[1].host == 'localhost')
return false;
else
return !hasNetworkDebounced();
}
const canBeConnected = (p) => !isOffline(p);
function isLegacy(peer) {
return hasSuccessfulAttempts(peer) && !hasPinged(peer);
}
function notRoom(peer) {
return peer[1].type !== 'room';
}
function isDefunct(peer) {
return peer[1].defunct === true;
}
function take(n) {
return (arr) => arr.slice(0, Math.max(n, 0));
}
function detectType(peer) {
const [addr, data] = peer;
if (data.type === 'bt')
return 'bt';
if (data.type === 'lan')
return 'lan';
if (data.type === 'internet')
return 'internet';
if (data.type === 'dht')
return 'dht';
if (data.type === 'pub')
return 'pub';
if (data.type === 'room')
return 'room';
if (data.type === 'room-endpoint')
return 'room-endpoint';
if (data.source === 'local')
return 'lan';
if (data.source === 'pub')
return 'pub';
if (data.source === 'internet')
return 'internet';
if (data.source === 'dht')
return 'dht';
if (data.inferredType === 'bt')
return 'bt';
if (data.inferredType === 'lan')
return 'lan';
if (data.inferredType === 'dht')
return 'dht';
if (data.inferredType === 'internet')
return 'internet';
if (addr.startsWith('bt:'))
return 'bt';
if (addr.startsWith('dht:'))
return 'dht';
return '?';
}
const { passesExpBackoff, passesGroupDebounce, hasNoAttempts, hasOnlyFailedAttempts, hasPinged, hasSuccessfulAttempts, sortByStateChange, } = ConnQuery;
function shufflePeers(peers) {
return peers.sort(() => Math.random() - 0.5);
}
const minute = 60e3;
const hour = 60 * 60e3;
let ConnScheduler = class ConnScheduler {
constructor(ssb, config) {
var _a, _b;
this.weBlockThem = ([_addr, data]) => {
if (!(data === null || data === void 0 ? void 0 : data.key))
return false;
return this.hops[data.key] === -1;
};
this.weFollowThem = ([_addr, data]) => {
var _a, _b;
if (!(data === null || data === void 0 ? void 0 : data.key))
return false;
const h = this.hops[data.key];
const maxHops = (_b = (_a = this.config.conn) === null || _a === void 0 ? void 0 : _a.hops) !== null && _b !== void 0 ? _b : 1;
return h > 0 && h <= maxHops;
};
this.start = () => {
var _a, _b;
if (!this.closed)
return;
this.closed = false;
for (let peer of this.ssb.conn.dbPeers()) {
const [address, { source, type }] = peer;
if (source === 'local' ||
source === 'bt' ||
type === 'lan' ||
type === 'bt') {
this.ssb.conn.forget(address);
}
if (isDefunct(peer)) {
this.removeDefunct(address);
}
}
this.loadHops();
// this.populateWithSeeds();
// this.setupPubDiscovery();
(_a = this.pubDiscoveryPausable) === null || _a === void 0 ? void 0 : _a.resume();
this.setupLanDiscovery();
// this.setupBluetoothDiscovery();
// this.intervalForUpdate = setInterval(() => this.updateSoon(), 2e3);
if ((_b = this.intervalForUpdate) === null || _b === void 0 ? void 0 : _b.unref)
this.intervalForUpdate.unref();
onWakeup(() => {
if (this.closed)
return;
this.ssb.conn.hub().reset();
});
onNetwork(() => {
if (this.closed)
return;
this.ssb.conn.hub().reset();
});
// pull(this.ssb.conn.hub().listen(), pull.filter((ev) => ev.type === 'disconnected'), pull.drain(() => this.updateSoon(200)));
// this.updateSoon();
};
this.stop = () => {
var _a, _b, _c;
(_a = this.pubDiscoveryPausable) === null || _a === void 0 ? void 0 : _a.pause();
(_c = (_b = this.ssb.lan) === null || _b === void 0 ? void 0 : _b.stop) === null || _c === void 0 ? void 0 : _c.call(_b);
if (this.intervalForUpdate) {
clearInterval(this.intervalForUpdate);
this.intervalForUpdate = void 0;
}
this.ssb.conn.hub().reset();
this.closed = true;
};
this.ssb = ssb;
this.config = config;
this.hasSsbDb2 = !!((_a = this.ssb.db) === null || _a === void 0 ? void 0 : _a.post) && !!((_b = this.ssb.db) === null || _b === void 0 ? void 0 : _b.query);
this.closed = true;
this.lastMessageAt = 0;
this.hasScheduledAnUpdate = false;
this.isLoadingHops = false;
this.hops = {};
if (this.hasSsbDb2) {
this.ssb.db.post((msg) => {
var _a;
if (msg.value.author !== this.ssb.id) {
this.lastMessageAt = Date.now();
}
if (((_a = msg.value.content) === null || _a === void 0 ? void 0 : _a.type) === 'contact') {
this.loadHops(() => this.updateNow());
}
});
}
}
loadHops(doneCallback) {
var _a;
if (!((_a = this.ssb.friends) === null || _a === void 0 ? void 0 : _a.hops)) {
debug('Warning: ssb-friends is missing, scheduling will miss some info');
return;
}
this.isLoadingHops = true;
this.ssb.friends.hops((err, hops) => {
if (err) {
debug('unable to call ssb.friends.hops: %s', err);
return;
}
this.hops = hops;
this.isLoadingHops = false;
if (doneCallback)
doneCallback();
});
}
isCurrentlyDownloading() {
return this.lastMessageAt && this.lastMessageAt > Date.now() - 500;
}
maxWaitToConnect(peer) {
const type = detectType(peer);
switch (type) {
case 'lan':
return 30e3;
case 'bt':
return 60e3;
case 'dht':
return 300e3;
default:
return 10e3;
}
}
updateTheseConnections(test, opts) {
const query = this.ssb.conn.query();
const peersUp = query.peersInConnection().filter(test);
const peersDown = query.peersConnectable('db').filter(test);
const { quota, backoffStep, backoffMax, groupMin } = opts;
const excess = peersUp.length > quota * 2 ? peersUp.length - quota : 0;
const freeSlots = Math.max(quota - peersUp.length, 0);
z(peersUp)
.z(sortByStateChange)
.z(take(excess))
.forEach(([addr]) => {
const fuzzyPeriod = (120e3 * (0.5 + Math.random())) / excess;
setTimeout(() => {
this.ssb.conn.disconnect(addr);
}, fuzzyPeriod);
});
z(peersDown)
.z(peers => peers.filter(p => !this.weBlockThem(p)))
.z(peers => peers.filter(canBeConnected))
.z(peers => peers.filter(([, data]) => data.autoconnect !== false))
.z(passesGroupDebounce(groupMin))
.z(peers => peers.filter(passesExpBackoff(backoffStep, backoffMax)))
.z(peers => Math.random() <= 0.3 ? shufflePeers(peers) : sortByStateChange(peers))
.z(take(freeSlots))
.forEach(([addr, data]) => this.ssb.conn.connect(addr, data));
}
updateStagingNow() {
this.ssb.conn
.query()
.peersConnectable('db')
.filter(p => !this.weBlockThem(p))
.filter(([, data]) => data.autoconnect === false)
.forEach(([addr, data]) => this.ssb.conn.stage(addr, data));
this.ssb.conn
.query()
.peersConnectable('staging')
.filter(this.weBlockThem)
.forEach(([addr]) => this.ssb.conn.unstage(addr));
this.ssb.conn
.query()
.peersConnectable('staging')
.filter(([, data]) => data.type === 'lan')
.filter(([, data]) => data.stagingUpdated + 10e3 < Date.now())
.forEach(([addr]) => this.ssb.conn.unstage(addr));
this.ssb.conn
.query()
.peersConnectable('staging')
.filter(([, data]) => data.type === 'bt')
.filter(([, data]) => data.stagingUpdated + 30e3 < Date.now())
.forEach(([addr]) => this.ssb.conn.unstage(addr));
}
updateHubNow() {
var _a;
const conn = this.ssb.conn;
if ((_a = this.config.seed) !== null && _a !== void 0 ? _a : true) {
this.updateTheseConnections(p => p[1].source === 'seed', {
quota: 3,
backoffStep: 2e3,
backoffMax: 10 * minute,
groupMin: 1e3,
});
}
if (conn.query().peersInConnection().length === 0) {
this.updateTheseConnections(() => true, {
quota: 1,
backoffStep: 1e3,
backoffMax: 6e3,
groupMin: 0,
});
}
this.updateTheseConnections(p => p[1].type === 'room', {
quota: 5,
backoffStep: 5e3,
backoffMax: 5 * minute,
groupMin: 5e3,
});
this.updateTheseConnections(p => notRoom(p) && hasPinged(p), {
quota: 2,
backoffStep: 10e3,
backoffMax: 10 * minute,
groupMin: 5e3,
});
this.updateTheseConnections(p => notRoom(p) && hasNoAttempts(p), {
quota: 2,
backoffStep: 30e3,
backoffMax: 30 * minute,
groupMin: 15e3,
});
this.updateTheseConnections(p => notRoom(p) && hasOnlyFailedAttempts(p), {
quota: 3,
backoffStep: 1 * minute,
backoffMax: 3 * hour,
groupMin: 5 * minute,
});
this.updateTheseConnections(p => notRoom(p) && isLegacy(p), {
quota: 1,
backoffStep: 4 * minute,
backoffMax: 3 * hour,
groupMin: 5 * minute,
});
z(conn.query().peersConnectable('staging').filter(this.weFollowThem))
.z(take(3 - conn.query().peersInConnection().filter(this.weFollowThem).length))
.forEach(([addr, data]) => conn.connect(addr, data));
conn
.query()
.peersInConnection()
.filter(this.weBlockThem)
.forEach(([addr]) => conn.disconnect(addr));
conn
.query()
.peersInConnection()
.filter(p => conn.hub().getState(p[0]) === 'connecting')
.filter(p => p[1].stateChange + this.maxWaitToConnect(p) < Date.now())
.forEach(([addr]) => conn.disconnect(addr));
conn
.query()
.peersConnected()
.filter(p => p[1].type !== 'bt' && p[1].type !== 'lan')
.filter(p => p[1].stateChange + 0.5 * hour < Date.now())
.forEach(([addr]) => conn.disconnect(addr));
}
updateNow() {
if (this.closed)
return;
if (this.isCurrentlyDownloading())
return;
if (this.isLoadingHops)
return;
this.updateStagingNow();
this.updateHubNow();
}
updateSoon(period = 1000) {
if (this.closed)
return;
if (this.hasScheduledAnUpdate)
return;
const fuzzyPeriod = period * 0.5 + period * Math.random();
this.hasScheduledAnUpdate = true;
const timer = setTimeout(() => {
this.updateNow();
this.hasScheduledAnUpdate = false;
}, fuzzyPeriod);
if (timer.unref)
timer.unref();
}
removeDefunct(addr) {
this.ssb.conn.db().update(addr, { defunct: void 0, autoconnect: void 0 });
}
populateWithSeeds() {
var _a;
const seeds = (_a = this.config.seeds) !== null && _a !== void 0 ? _a : [];
(Array.isArray(seeds) ? seeds : [seeds]).filter(Boolean).forEach(addr => {
const key = Ref.getKeyFromAddress(addr);
this.ssb.conn.remember(addr, { key, source: 'seed' });
});
}
setupPubDiscovery() {
var _a;
if (((_a = this.config.conn) === null || _a === void 0 ? void 0 : _a.populatePubs) === false)
return;
if (!this.hasSsbDb2) {
debug('Warning: ssb-db2 is missing, scheduling will miss some info');
return;
}
setTimeout(() => {
var _a;
if (this.closed)
return;
const MAX_STAGED_PUBS = 3;
const { where, type, live, toPullStream } = this.ssb.db.operators;
this.pubDiscoveryPausable = (_a = this.pubDiscoveryPausable) !== null && _a !== void 0 ? _a : Pausable();
pull(this.ssb.db.query(where(type('pub')), live({ old: true }), toPullStream()), pull.filter((msg) => { var _a; return Ref.isAddress((_a = msg.value.content) === null || _a === void 0 ? void 0 : _a.address); }), pull.asyncMap((x, cb) => setTimeout(() => cb(null, x), 250)), this.pubDiscoveryPausable, pull.drain((msg) => {
try {
const address = Ref.toMultiServerAddress(msg.value.content.address);
const key = Ref.getKeyFromAddress(address);
if (this.weBlockThem([address, { key }])) {
this.ssb.conn.forget(address);
}
else if (!this.ssb.conn.db().has(address)) {
this.ssb.conn.stage(address, { key, type: 'pub' });
this.ssb.conn.remember(address, {
key,
type: 'pub',
autoconnect: false,
});
}
}
catch (err) {
debug('cannot process discovered pub because: %s', err);
}
}));
pull(this.ssb.conn.staging().liveEntries(), pull.drain((staged) => {
var _a, _b;
if (this.closed)
return;
const stagedPubs = staged.filter(([, data]) => data.type === 'pub');
if (stagedPubs.length >= MAX_STAGED_PUBS) {
(_a = this.pubDiscoveryPausable) === null || _a === void 0 ? void 0 : _a.pause();
}
else {
(_b = this.pubDiscoveryPausable) === null || _b === void 0 ? void 0 : _b.resume();
}
}));
}, 1000);
}
setupBluetoothDiscovery() {
var _a;
if (!((_a = this.ssb.bluetooth) === null || _a === void 0 ? void 0 : _a.nearbyScuttlebuttDevices)) {
debug('Warning: ssb-bluetooth is missing, scheduling will miss some info');
return;
}
pull(this.ssb.bluetooth.nearbyScuttlebuttDevices(1000), pull.drain(({ discovered }) => {
if (this.closed)
return;
for (const btPeer of discovered) {
const address = `bt:${btPeer.remoteAddress.split(':').join('')}` +
'~' +
`shs:${btPeer.id.replace(/^\@/, '').replace(/\.ed25519$/, '')}`;
const data = {
type: 'bt',
note: btPeer.displayName,
key: btPeer.id,
};
if (this.weFollowThem([address, data])) {
this.ssb.conn.connect(address, data);
}
else {
this.ssb.conn.stage(address, data);
}
}
}));
}
setupLanDiscovery() {
var _a, _b;
if (!((_a = this.ssb.lan) === null || _a === void 0 ? void 0 : _a.start) || !((_b = this.ssb.lan) === null || _b === void 0 ? void 0 : _b.discoveredPeers)) {
debug('Warning: ssb-lan is missing, scheduling will miss some info');
return;
}
pull(this.ssb.lan.discoveredPeers(), pull.drain(({ address, verified }) => {
const key = Ref.getKeyFromAddress(address);
if (!key)
return;
const data = {
type: 'lan',
key,
verified,
};
// if (this.weFollowThem([address, data])) {
// this.ssb.conn.connect(address, data);
// }
// else {
// this.ssb.conn.stage(address, data);
// }
}));
this.ssb.lan.start();
}
};
__decorate([
secret_stack_decorators_1.muxrpc('sync')
], ConnScheduler.prototype, "start", void 0);
__decorate([
secret_stack_decorators_1.muxrpc('sync')
], ConnScheduler.prototype, "stop", void 0);
ConnScheduler = __decorate([
secret_stack_decorators_1.plugin('1.0.0')
], ConnScheduler);
exports.ConnScheduler = ConnScheduler;
comment booting
enter peer
hops peer 1
load peer @TWKY4Bq5ezVqbXV2D7NyODxCXgu8o4rgp/sf1GdHbCw=.ed25519
skipoffset peer
enter server
hops server 1
load server @3eIPXptMcbrFPw8seKbywmPbRogERylNuoFVaZ9AlOg=.ed25519
alloffsets server
start server ssb-server
start peer ssb-server
connect peer server
waituntil peer server@latest
stop peer
@arj03 can you try this variant instead?
# booting
enter peer
load peer @TWKY4Bq5ezVqbXV2D7NyODxCXgu8o4rgp/sf1GdHbCw=.ed25519
skipoffset peer
hops peer 1
enter server
load server @3eIPXptMcbrFPw8seKbywmPbRogERylNuoFVaZ9AlOg=.ed25519
alloffsets server
hops server 1
start server ssb-server
waituntil server server@latest
start peer ssb-server
has server peer@latest
has peer peer@0
connect peer server
waituntil peer peer@latest
has peer peer@latest
@cblgh Then I'm getting:
not ok 14 - has peer peer@0
# expected: @TWKY4Bq5ezVqbXV2D7NyODxCXgu8o4rgp/sf1GdHbCw=.ed25519 at sequence 0
# was: @TWKY4Bq5ezVqbXV2D7NyODxCXgu8o4rgp/sf1GdHbCw=.ed25519 at sequence 2064: sequences didn't match
I'm using:
./netsim run -fixtures ./fixtures-output/ -spec script-test-alex.txt ./ssb-server
Is it because I already ran one test before, so that the peer db already has data?
and for a smaller diff from your original test:
comment booting
enter peer
hops peer 1
load peer @TWKY4Bq5ezVqbXV2D7NyODxCXgu8o4rgp/sf1GdHbCw=.ed25519
skipoffset peer
enter server
hops server 1
load server @3eIPXptMcbrFPw8seKbywmPbRogERylNuoFVaZ9AlOg=.ed25519
alloffsets server
start server ssb-server
start peer ssb-server
connect peer server
-waituntil peer server@latest
+waituntil peer peer@latest
stop peer
Then I'm getting:
not ok 14 - has peer peer@0 # expected: @TWKY4Bq5ezVqbXV2D7NyODxCXgu8o4rgp/sf1GdHbCw=.ed25519 at sequence 0 # was: @TWKY4Bq5ezVqbXV2D7NyODxCXgu8o4rgp/sf1GdHbCw=.ed25519 at sequence 2064: sequences didn't match
hmmmmmmm that test works for me!! and no matter how many times i re-run it; dang it
Is it because I already ran one test before, so that the peer db already has data?
netsim clears out the puppets
directory on startup, so that should not be the case
4000:
TAP version 13
## Start test file
# 1 comment booting
# 2 enter peer
# 3 hops peer 1
# 4 load peer @TWKY4Bq5ezVqbXV2D7NyODxCXgu8o4rgp/sf1GdHbCw=.ed25519
# 5 skipoffset peer
# 6 enter server
# 7 hops server 1
# 8 load server @3eIPXptMcbrFPw8seKbywmPbRogERylNuoFVaZ9AlOg=.ed25519
# 9 alloffsets server
# 10 start server ssb-server
# 11 start peer ssb-server
# 12 connect peer server
# 13 waituntil peer peer@latest
# 14 stop peer
## End test file
ok 1 - comment booting
ok 2 - enter peer
ok 3 - hops peer 1
ok 4 - load peer @TWKY4Bq5ezVqbXV2D7NyODxCXgu8o4rgp/sf1GdHbCw=.ed25519
ok 5 - skipoffset peer
ok 6 - enter server
ok 7 - hops server 1
ok 8 - load server @3eIPXptMcbrFPw8seKbywmPbRogERylNuoFVaZ9AlOg=.ed25519
ok 9 - alloffsets server
caps is set to 1KHLiKZvAvjbY1ziZEHMXawbCEIM6qwjCDm3VYRan/s=
hops is set to 1
gossip port: 18888
ws port: 18889
puppet lives in /home/arj/dev/netsim/arj-care-package/puppets/ssb-server-server
using log offset from fixtures-output/puppet-all/flume/log.offset
using secret from fixtures-output/puppet-00012/secret
starting as DEBUG=* exec "$SCRIPTPATH"/bin.js start -- --friends.hops "$HOPS" --caps.shs "$CAPS" --path "$DIR" --port "$PORT" --ws.port "$WS_PORT"
ssb-server 16.0.1 /home/arj/dev/netsim/arj-care-package/puppets/ssb-server-server logging.level:notice
my key ID: 3eIPXptMcbrFPw8seKbywmPbRogERylNuoFVaZ9AlOg=.ed25519
2021-08-09T12:57:51.134Z secret-stack Adding transport net
2021-08-09T12:57:51.137Z secret-stack Adding transform shs
2021-08-09T12:57:51.165Z ssb:conn-db Created new conn.json because there was no existing conn.json nor gossip.json
2021-08-09T12:57:51.171Z ssb:conn:scheduler Warning: ssb-db2 is missing, scheduling will miss some info
2021-08-09T12:57:51.174Z secret-stack net plugin creating transport host=127.0.0.1 port=18888 scope=[ 'device' ]
2021-08-09T12:57:51.176Z secret-stack creating server net shs host=127.0.0.1 port=18888 scope=[ 'device' ]
2021-08-09T12:57:51.176Z secret-stack net plugin creating transport host=127.0.0.1 port=18888 scope=[ 'device' ]
2021-08-09T12:57:51.177Z secret-stack net plugin creating transport host=::1 port=18888 scope=[ 'device' ]
2021-08-09T12:57:51.177Z secret-stack creating server net shs host=::1 port=18888 scope=[ 'device' ]
2021-08-09T12:57:51.177Z secret-stack net plugin creating transport host=::1 port=18888 scope=[ 'device' ]
2021-08-09T12:57:51.177Z secret-stack net plugin creating transport host=192.168.10.125 port=18888 scope=[ 'local' ]
2021-08-09T12:57:51.177Z secret-stack creating server net shs host=192.168.10.125 port=18888 scope=[ 'local' ]
2021-08-09T12:57:51.177Z secret-stack net plugin creating transport host=192.168.10.125 port=18888 scope=[ 'local' ]
2021-08-09T12:57:51.177Z secret-stack net plugin creating transport host=undefined port=NaN scope=undefined
2021-08-09T12:57:51.178Z multiserver:net Listening on 127.0.0.1:18888
2021-08-09T12:57:51.179Z multiserver:net Listening on ::1:18888
2021-08-09T12:57:51.180Z multiserver:net Listening on 192.168.10.125:18888
2021-08-09T12:57:51.183Z ssb:conn:scheduler Warning: ssb-bluetooth is missing, scheduling will miss some info
ssb-friends: stream legacy api used
ok 10 - start server ssb-server
# server (6167 messages) has id @3eIPXptMcbrFPw8seKbywmPbRogERylNuoFVaZ9AlOg=.ed25519
# logging to server.txt
caps is set to 1KHLiKZvAvjbY1ziZEHMXawbCEIM6qwjCDm3VYRan/s=
hops is set to 1
gossip port: 18890
ws port: 18891
puppet lives in /home/arj/dev/netsim/arj-care-package/puppets/ssb-server-peer
using secret from fixtures-output/puppet-00000/secret
starting as DEBUG=* exec "$SCRIPTPATH"/bin.js start -- --friends.hops "$HOPS" --caps.shs "$CAPS" --path "$DIR" --port "$PORT" --ws.port "$WS_PORT"
ssb-server 16.0.1 /home/arj/dev/netsim/arj-care-package/puppets/ssb-server-peer logging.level:notice
my key ID: TWKY4Bq5ezVqbXV2D7NyODxCXgu8o4rgp/sf1GdHbCw=.ed25519
2021-08-09T12:57:54.279Z secret-stack Adding transport net
2021-08-09T12:57:54.281Z secret-stack Adding transform shs
2021-08-09T12:57:54.309Z ssb:conn-db Created new conn.json because there was no existing conn.json nor gossip.json
2021-08-09T12:57:54.314Z ssb:conn:scheduler Warning: ssb-db2 is missing, scheduling will miss some info
2021-08-09T12:57:54.316Z secret-stack net plugin creating transport host=127.0.0.1 port=18890 scope=[ 'device' ]
2021-08-09T12:57:54.318Z secret-stack creating server net shs host=127.0.0.1 port=18890 scope=[ 'device' ]
2021-08-09T12:57:54.318Z secret-stack net plugin creating transport host=127.0.0.1 port=18890 scope=[ 'device' ]
2021-08-09T12:57:54.319Z secret-stack net plugin creating transport host=::1 port=18890 scope=[ 'device' ]
2021-08-09T12:57:54.319Z secret-stack creating server net shs host=::1 port=18890 scope=[ 'device' ]
2021-08-09T12:57:54.319Z secret-stack net plugin creating transport host=::1 port=18890 scope=[ 'device' ]
2021-08-09T12:57:54.319Z secret-stack net plugin creating transport host=192.168.10.125 port=18890 scope=[ 'local' ]
2021-08-09T12:57:54.319Z secret-stack creating server net shs host=192.168.10.125 port=18890 scope=[ 'local' ]
2021-08-09T12:57:54.319Z secret-stack net plugin creating transport host=192.168.10.125 port=18890 scope=[ 'local' ]
2021-08-09T12:57:54.319Z secret-stack net plugin creating transport host=undefined port=NaN scope=undefined
2021-08-09T12:57:54.320Z multiserver:net Listening on 127.0.0.1:18890
2021-08-09T12:57:54.321Z multiserver:net Listening on ::1:18890
2021-08-09T12:57:54.322Z multiserver:net Listening on 192.168.10.125:18890
2021-08-09T12:57:54.324Z ssb:conn:scheduler Warning: ssb-bluetooth is missing, scheduling will miss some info
2021-08-09T12:57:54.333Z ssb:conn-hub connecting to net:192.168.10.125:18890~shs:TWKY4Bq5ezVqbXV2D7NyODxCXgu8o4rgp/sf1GdHbCw=
ssb-friends: stream legacy api used
2021-08-09T12:57:54.359Z ssb:conn-hub connected to net:192.168.10.125:18890~shs:TWKY4Bq5ezVqbXV2D7NyODxCXgu8o4rgp/sf1GdHbCw=
2021-08-09T12:57:54.360Z ssb:conn-hub peer @3eIPXptMcbrFPw8seKbywmPbRogERylNuoFVaZ9AlOg=.ed25519 initiated an RPC connection with us
2021-08-09T12:57:54.361Z ssb:conn-hub connected to net:192.168.10.125:49026~shs:3eIPXptMcbrFPw8seKbywmPbRogERylNuoFVaZ9AlOg=
2021-08-09T12:57:56.518Z ssb:conn-hub connecting to net:192.168.10.125:18888~shs:3eIPXptMcbrFPw8seKbywmPbRogERylNuoFVaZ9AlOg=
2021-08-09T12:57:56.800Z ssb:conn-hub connected to net:192.168.10.125:18890~shs:TWKY4Bq5ezVqbXV2D7NyODxCXgu8o4rgp/sf1GdHbCw=
2021-08-09T12:57:56.882Z ssb:conn-hub connected to net:192.168.10.125:49026~shs:3eIPXptMcbrFPw8seKbywmPbRogERylNuoFVaZ9AlOg=
2021-08-09T12:57:56.883Z ssb:conn-hub connected to net:192.168.10.125:18888~shs:3eIPXptMcbrFPw8seKbywmPbRogERylNuoFVaZ9AlOg=
ok 11 - start peer ssb-server
# peer (4246 messages) has id @TWKY4Bq5ezVqbXV2D7NyODxCXgu8o4rgp/sf1GdHbCw=.ed25519
# logging to peer.txt
2021-08-09T12:57:57.317Z ssb:conn-hub connecting to net:localhost:18888~shs:3eIPXptMcbrFPw8seKbywmPbRogERylNuoFVaZ9AlOg=
2021-08-09T12:57:57.417Z ssb:conn-hub connected to net:192.168.10.125:18890~shs:TWKY4Bq5ezVqbXV2D7NyODxCXgu8o4rgp/sf1GdHbCw=
2021-08-09T12:57:57.489Z ssb:conn-hub connected to net:192.168.10.125:49026~shs:3eIPXptMcbrFPw8seKbywmPbRogERylNuoFVaZ9AlOg=
2021-08-09T12:57:57.490Z ssb:conn-hub connected to net:localhost:18888~shs:3eIPXptMcbrFPw8seKbywmPbRogERylNuoFVaZ9AlOg=
ok 12 - connect peer server
ok 13 - waituntil peer peer@latest
# assuming peer@latest => peer@2064
# stopping peer (@TWKY4Bq5ezVqbXV2D7NyODxCXgu8o4rgp/sf1GdHbCw=.ed25519)
sig int received
2021-08-09T12:57:58.051Z ssb:conn-hub disconnected from net:192.168.10.125:49026~shs:3eIPXptMcbrFPw8seKbywmPbRogERylNuoFVaZ9AlOg=
2021-08-09T12:57:58.052Z ssb:conn-hub disconnected from net:192.168.10.125:49026~shs:3eIPXptMcbrFPw8seKbywmPbRogERylNuoFVaZ9AlOg=
2021-08-09T12:57:58.052Z ssb:conn-db Begun serializing and writing ConnDB into conn.json
2021-08-09T12:57:58.053Z ssb:conn-hub disconnected from net:192.168.10.125:18890~shs:TWKY4Bq5ezVqbXV2D7NyODxCXgu8o4rgp/sf1GdHbCw=
2021-08-09T12:57:58.053Z ssb:conn-db Closed the ConnDB instance
2021-08-09T12:57:58.053Z ssb:conn-hub closed the ConnHub instance
2021-08-09T12:57:58.053Z ssb:conn-staging closed the ConnStaging instance
2021-08-09T12:57:58.092Z ssb:conn-hub disconnected from net:192.168.10.125:18890~shs:TWKY4Bq5ezVqbXV2D7NyODxCXgu8o4rgp/sf1GdHbCw=
2021-08-09T12:57:58.158Z ssb:conn-db Done serializing and writing ConnDB into conn.json
fallback to close
2021-08-09T12:57:58.278Z multiserver:net Closing server on 127.0.0.1:18890
2021-08-09T12:57:58.278Z multiserver:net Closing server on ::1:18890
2021-08-09T12:57:58.278Z multiserver:net Closing server on 192.168.10.125:18890
2021-08-09T12:57:58.279Z multiserver:net No longer listening on 127.0.0.1:18890
2021-08-09T12:57:58.279Z multiserver:net No longer listening on ::1:18890
2021-08-09T12:57:58.279Z multiserver:net No longer listening on 192.168.10.125:18890
exiting
ok 14 - stop peer
# peer has been stopped
1..14
# End of simulation
# Total time: 7.577306188s
# Active time: 5.077306188s
# Puppet count: 2
# Puppet Total time Active time # messages
Error replicating with @TWKY4Bq5ezVqbXV2D7NyODxCXgu8o4rgp/sf1GdHbCw=.ed25519:
Error: stream ended with:4 but wanted:34
at drain (/home/arj/dev/netsim/arj-care-package/ssb-server/node_modules/pull-reader/index.js:43:26)
at /home/arj/dev/netsim/arj-care-package/ssb-server/node_modules/pull-reader/index.js:63:18
at /home/arj/dev/netsim/arj-care-package/ssb-server/node_modules/pull-reader/index.js:114:13
at drain (/home/arj/dev/netsim/arj-care-package/ssb-server/node_modules/stream-to-pull-stream/index.js:126:18)
at Socket.<anonymous> (/home/arj/dev/netsim/arj-care-package/ssb-server/node_modules/stream-to-pull-stream/index.js:143:5)
at Socket.emit (events.js:326:22)
at endReadableNT (_stream_readable.js:1244:12)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
2021-08-09T12:57:58.303Z ssb:conn-hub disconnected from net:192.168.10.125:18890~shs:TWKY4Bq5ezVqbXV2D7NyODxCXgu8o4rgp/sf1GdHbCw=
# server 7.573s 5.073s 6167
# peer 4.393s 2.893s 4971
# Closing all puppets
2000:
TAP version 13
## Start test file
# 1 comment booting
# 2 enter peer
# 3 hops peer 1
# 4 load peer @TWKY4Bq5ezVqbXV2D7NyODxCXgu8o4rgp/sf1GdHbCw=.ed25519
# 5 skipoffset peer
# 6 enter server
# 7 hops server 1
# 8 load server @3eIPXptMcbrFPw8seKbywmPbRogERylNuoFVaZ9AlOg=.ed25519
# 9 alloffsets server
# 10 start server ssb-server
# 11 start peer ssb-server
# 12 connect peer server
# 13 waituntil peer peer@latest
# 14 stop peer
## End test file
ok 1 - comment booting
ok 2 - enter peer
ok 3 - hops peer 1
ok 4 - load peer @TWKY4Bq5ezVqbXV2D7NyODxCXgu8o4rgp/sf1GdHbCw=.ed25519
ok 5 - skipoffset peer
ok 6 - enter server
ok 7 - hops server 1
ok 8 - load server @3eIPXptMcbrFPw8seKbywmPbRogERylNuoFVaZ9AlOg=.ed25519
ok 9 - alloffsets server
caps is set to 1KHLiKZvAvjbY1ziZEHMXawbCEIM6qwjCDm3VYRan/s=
hops is set to 1
gossip port: 18888
ws port: 18889
puppet lives in /home/arj/dev/netsim/arj-care-package/puppets/ssb-server-server
using log offset from fixtures-output/puppet-all/flume/log.offset
using secret from fixtures-output/puppet-00012/secret
starting as DEBUG=* exec "$SCRIPTPATH"/bin.js start -- --friends.hops "$HOPS" --caps.shs "$CAPS" --path "$DIR" --port "$PORT" --ws.port "$WS_PORT"
ssb-server 16.0.1 /home/arj/dev/netsim/arj-care-package/puppets/ssb-server-server logging.level:notice
my key ID: 3eIPXptMcbrFPw8seKbywmPbRogERylNuoFVaZ9AlOg=.ed25519
2021-08-09T12:57:04.972Z secret-stack Adding transport net
2021-08-09T12:57:04.974Z secret-stack Adding transform shs
2021-08-09T12:57:05.003Z ssb:conn-db Created new conn.json because there was no existing conn.json nor gossip.json
2021-08-09T12:57:05.008Z ssb:conn:scheduler Warning: ssb-db2 is missing, scheduling will miss some info
2021-08-09T12:57:05.010Z secret-stack net plugin creating transport host=127.0.0.1 port=18888 scope=[ 'device' ]
2021-08-09T12:57:05.013Z secret-stack creating server net shs host=127.0.0.1 port=18888 scope=[ 'device' ]
2021-08-09T12:57:05.013Z secret-stack net plugin creating transport host=127.0.0.1 port=18888 scope=[ 'device' ]
2021-08-09T12:57:05.013Z secret-stack net plugin creating transport host=::1 port=18888 scope=[ 'device' ]
2021-08-09T12:57:05.013Z secret-stack creating server net shs host=::1 port=18888 scope=[ 'device' ]
2021-08-09T12:57:05.013Z secret-stack net plugin creating transport host=::1 port=18888 scope=[ 'device' ]
2021-08-09T12:57:05.013Z secret-stack net plugin creating transport host=192.168.10.125 port=18888 scope=[ 'local' ]
2021-08-09T12:57:05.013Z secret-stack creating server net shs host=192.168.10.125 port=18888 scope=[ 'local' ]
2021-08-09T12:57:05.014Z secret-stack net plugin creating transport host=192.168.10.125 port=18888 scope=[ 'local' ]
2021-08-09T12:57:05.014Z secret-stack net plugin creating transport host=undefined port=NaN scope=undefined
2021-08-09T12:57:05.014Z multiserver:net Listening on 127.0.0.1:18888
2021-08-09T12:57:05.015Z multiserver:net Listening on ::1:18888
2021-08-09T12:57:05.016Z multiserver:net Listening on 192.168.10.125:18888
2021-08-09T12:57:05.019Z ssb:conn:scheduler Warning: ssb-bluetooth is missing, scheduling will miss some info
ssb-friends: stream legacy api used
ok 10 - start server ssb-server
# server (6167 messages) has id @3eIPXptMcbrFPw8seKbywmPbRogERylNuoFVaZ9AlOg=.ed25519
# logging to server.txt
caps is set to 1KHLiKZvAvjbY1ziZEHMXawbCEIM6qwjCDm3VYRan/s=
hops is set to 1
gossip port: 18890
ws port: 18891
puppet lives in /home/arj/dev/netsim/arj-care-package/puppets/ssb-server-peer
using secret from fixtures-output/puppet-00000/secret
starting as DEBUG=* exec "$SCRIPTPATH"/bin.js start -- --friends.hops "$HOPS" --caps.shs "$CAPS" --path "$DIR" --port "$PORT" --ws.port "$WS_PORT"
ssb-server 16.0.1 /home/arj/dev/netsim/arj-care-package/puppets/ssb-server-peer logging.level:notice
my key ID: TWKY4Bq5ezVqbXV2D7NyODxCXgu8o4rgp/sf1GdHbCw=.ed25519
2021-08-09T12:57:08.074Z secret-stack Adding transport net
2021-08-09T12:57:08.076Z secret-stack Adding transform shs
2021-08-09T12:57:08.105Z ssb:conn-db Created new conn.json because there was no existing conn.json nor gossip.json
2021-08-09T12:57:08.109Z ssb:conn:scheduler Warning: ssb-db2 is missing, scheduling will miss some info
2021-08-09T12:57:08.111Z secret-stack net plugin creating transport host=127.0.0.1 port=18890 scope=[ 'device' ]
2021-08-09T12:57:08.113Z secret-stack creating server net shs host=127.0.0.1 port=18890 scope=[ 'device' ]
2021-08-09T12:57:08.114Z secret-stack net plugin creating transport host=127.0.0.1 port=18890 scope=[ 'device' ]
2021-08-09T12:57:08.114Z secret-stack net plugin creating transport host=::1 port=18890 scope=[ 'device' ]
2021-08-09T12:57:08.114Z secret-stack creating server net shs host=::1 port=18890 scope=[ 'device' ]
2021-08-09T12:57:08.114Z secret-stack net plugin creating transport host=::1 port=18890 scope=[ 'device' ]
2021-08-09T12:57:08.114Z secret-stack net plugin creating transport host=192.168.10.125 port=18890 scope=[ 'local' ]
2021-08-09T12:57:08.114Z secret-stack creating server net shs host=192.168.10.125 port=18890 scope=[ 'local' ]
2021-08-09T12:57:08.114Z secret-stack net plugin creating transport host=192.168.10.125 port=18890 scope=[ 'local' ]
2021-08-09T12:57:08.114Z secret-stack net plugin creating transport host=undefined port=NaN scope=undefined
2021-08-09T12:57:08.115Z multiserver:net Listening on 127.0.0.1:18890
2021-08-09T12:57:08.116Z multiserver:net Listening on ::1:18890
2021-08-09T12:57:08.117Z multiserver:net Listening on 192.168.10.125:18890
2021-08-09T12:57:08.120Z ssb:conn:scheduler Warning: ssb-bluetooth is missing, scheduling will miss some info
2021-08-09T12:57:08.128Z ssb:conn-hub connecting to net:192.168.10.125:18890~shs:TWKY4Bq5ezVqbXV2D7NyODxCXgu8o4rgp/sf1GdHbCw=
ssb-friends: stream legacy api used
2021-08-09T12:57:08.155Z ssb:conn-hub connected to net:192.168.10.125:18890~shs:TWKY4Bq5ezVqbXV2D7NyODxCXgu8o4rgp/sf1GdHbCw=
2021-08-09T12:57:08.156Z ssb:conn-hub peer @3eIPXptMcbrFPw8seKbywmPbRogERylNuoFVaZ9AlOg=.ed25519 initiated an RPC connection with us
2021-08-09T12:57:08.156Z ssb:conn-hub connected to net:192.168.10.125:49006~shs:3eIPXptMcbrFPw8seKbywmPbRogERylNuoFVaZ9AlOg=
ok 11 - start peer ssb-server
# peer (2064 messages) has id @TWKY4Bq5ezVqbXV2D7NyODxCXgu8o4rgp/sf1GdHbCw=.ed25519
# logging to peer.txt
2021-08-09T12:57:10.088Z ssb:conn-hub connecting to net:localhost:18888~shs:3eIPXptMcbrFPw8seKbywmPbRogERylNuoFVaZ9AlOg=
2021-08-09T12:57:10.108Z ssb:conn-hub connected to net:192.168.10.125:18890~shs:TWKY4Bq5ezVqbXV2D7NyODxCXgu8o4rgp/sf1GdHbCw=
2021-08-09T12:57:10.116Z ssb:conn-hub connected to net:192.168.10.125:49006~shs:3eIPXptMcbrFPw8seKbywmPbRogERylNuoFVaZ9AlOg=
2021-08-09T12:57:10.117Z ssb:conn-hub connected to net:localhost:18888~shs:3eIPXptMcbrFPw8seKbywmPbRogERylNuoFVaZ9AlOg=
ok 12 - connect peer server
2021-08-09T12:57:11.182Z ssb:conn-hub connecting to net:192.168.10.125:18888~shs:3eIPXptMcbrFPw8seKbywmPbRogERylNuoFVaZ9AlOg=
2021-08-09T12:57:11.344Z ssb:conn-hub connected to net:192.168.10.125:18890~shs:TWKY4Bq5ezVqbXV2D7NyODxCXgu8o4rgp/sf1GdHbCw=
2021-08-09T12:57:11.415Z ssb:conn-hub connected to net:192.168.10.125:49006~shs:3eIPXptMcbrFPw8seKbywmPbRogERylNuoFVaZ9AlOg=
2021-08-09T12:57:11.416Z ssb:conn-hub connected to net:192.168.10.125:18888~shs:3eIPXptMcbrFPw8seKbywmPbRogERylNuoFVaZ9AlOg=
ok 13 - waituntil peer peer@latest
# assuming peer@latest => peer@2064
# stopping peer (@TWKY4Bq5ezVqbXV2D7NyODxCXgu8o4rgp/sf1GdHbCw=.ed25519)
sig int received
2021-08-09T12:57:11.644Z ssb:conn-hub disconnected from net:192.168.10.125:49006~shs:3eIPXptMcbrFPw8seKbywmPbRogERylNuoFVaZ9AlOg=
2021-08-09T12:57:11.645Z ssb:conn-hub disconnected from net:192.168.10.125:18890~shs:TWKY4Bq5ezVqbXV2D7NyODxCXgu8o4rgp/sf1GdHbCw=
2021-08-09T12:57:11.645Z ssb:conn-hub disconnected from net:192.168.10.125:49006~shs:3eIPXptMcbrFPw8seKbywmPbRogERylNuoFVaZ9AlOg=
2021-08-09T12:57:11.645Z ssb:conn-db Begun serializing and writing ConnDB into conn.json
2021-08-09T12:57:11.646Z ssb:conn-db Closed the ConnDB instance
2021-08-09T12:57:11.646Z ssb:conn-hub closed the ConnHub instance
2021-08-09T12:57:11.646Z ssb:conn-staging closed the ConnStaging instance
2021-08-09T12:57:11.646Z ssb:conn-hub disconnected from net:192.168.10.125:18890~shs:TWKY4Bq5ezVqbXV2D7NyODxCXgu8o4rgp/sf1GdHbCw=
2021-08-09T12:57:11.664Z ssb:conn-db Done serializing and writing ConnDB into conn.json
fallback to close
2021-08-09T12:57:12.045Z multiserver:net Closing server on 127.0.0.1:18890
2021-08-09T12:57:12.046Z multiserver:net Closing server on ::1:18890
2021-08-09T12:57:12.046Z multiserver:net Closing server on 192.168.10.125:18890
2021-08-09T12:57:12.046Z multiserver:net No longer listening on 127.0.0.1:18890
2021-08-09T12:57:12.046Z multiserver:net No longer listening on ::1:18890
2021-08-09T12:57:12.046Z multiserver:net No longer listening on 192.168.10.125:18890
exiting
ok 14 - stop peer
# peer has been stopped
1..14
# End of simulation
# Total time: 7.484448211s
# Active time: 4.984448211s
# Puppet count: 2
# Puppet Total time Active time # messages
Error replicating with @TWKY4Bq5ezVqbXV2D7NyODxCXgu8o4rgp/sf1GdHbCw=.ed25519:
Error: stream ended with:4 but wanted:34
at drain (/home/arj/dev/netsim/arj-care-package/ssb-server/node_modules/pull-reader/index.js:43:26)
at /home/arj/dev/netsim/arj-care-package/ssb-server/node_modules/pull-reader/index.js:63:18
at /home/arj/dev/netsim/arj-care-package/ssb-server/node_modules/pull-reader/index.js:114:13
at drain (/home/arj/dev/netsim/arj-care-package/ssb-server/node_modules/stream-to-pull-stream/index.js:126:18)
at Socket.<anonymous> (/home/arj/dev/netsim/arj-care-package/ssb-server/node_modules/stream-to-pull-stream/index.js:143:5)
at Socket.emit (events.js:326:22)
at endReadableNT (_stream_readable.js:1244:12)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
2021-08-09T12:57:12.055Z ssb:conn-hub disconnected from net:192.168.10.125:18890~shs:TWKY4Bq5ezVqbXV2D7NyODxCXgu8o4rgp/sf1GdHbCw=
# server 7.482s 4.982s 6167
# peer 4.356s 2.856s 4829
# Closing all puppets
Latest go-sbot test script:
comment booting
enter peer
hops peer 1
load peer @TWKY4Bq5ezVqbXV2D7NyODxCXgu8o4rgp/sf1GdHbCw=.ed25519
enter server
hops server 1
load server @3eIPXptMcbrFPw8seKbywmPbRogERylNuoFVaZ9AlOg=.ed25519
alloffsets server
start server go-sbot
start peer ssb-server
connect peer server
waituntil peer peer@latest
stop peer
go error:
puppet lives in /home/arj/dev/netsim/arj-care-package/puppets/go-sbot-server
2021/08/09 15:45:30 [margaret/indexes/badger] overwrote batch limit 0
t=147.919µs starting=metrics addr=localhost:6078
level=info t=9.917316ms event="waiting for indexes to catch up"
not ok 9 - start server go-sbot
# error dialing: dial tcp 127.0.0.1:18888: connect: connection refused
....
level=info t=1.519753057s event="repo open" feeds=20 msgs=9001
level=info t=1.519796709s event=serving ID="@3eIPXptMcbrFPw8seKbywmPbRogERylNuoFVaZ9AlOg=.ed25519" addr=:18888 version=snapshot build=
so not waiting for the indexes to be ready, so getting the number of messages fails it seems
can't seem to make the above script work when I have skipoffset on peer