storj-archived/core

ALLOC not storing audit_tree -> AUDIT not working, farmer crashing

Closed this issue · 4 comments

Package Versions

Replace the values below using the output from npm list storj. Use npm list -g storj if installed globally.

root@storj:~# npm list -g storj-lib
/usr/local/lib
└─┬ storjshare-daemon@5.3.0
  └── storj-lib@8.5.0

Replace the values below using the output from node --version.

v8.9.4

Expected Behavior

Please describe the program's expected behavior. Include an example of your
usage code in the back ticks below if applicable.

I would expect an error message telling me that I am not authorized to call AUDIT.

Actual Behavior

Please describe the program's actual behavior. Please include any stack traces
or log output in the back ticks below.

Farmer is crashing:

{"level":"info","message":"handling storage audit from 988394a21927418b8e8a1b7e906618ceb45c78dc","timestamp":"2018-02-12T22:14:41.988Z"}
assert.js:42
  throw new errors.AssertionError({
  ^

AssertionError [ERR_ASSERTION]: Merkle leaves must be an array
    at new ProofStream (/root/git/core/lib/audit-tools/proof-stream.js:23:3)
    at /root/git/core/lib/network/protocol.js:208:17
    at /root/git/core/lib/storage/manager.js:64:5
    at /root/git/core/lib/storage/adapter.js:64:5
    at /root/git/core/lib/storage/adapters/embedded.js:90:11
    at _getSbucketForKey (/root/git/core/node_modules/kfs/lib/b-table.js:319:7)
    at Btable._getSbucketForKey (/root/git/core/node_modules/kfs/lib/b-table.js:162:5)
    at Btable.createReadStream (/root/git/core/node_modules/kfs/lib/b-table.js:314:10)
    at _getShardStreamPointer (/root/git/core/lib/storage/adapters/embedded.js:83:9)
    at /root/git/core/lib/storage/adapters/embedded.js:94:7
    at _db.get (/root/git/core/node_modules/kfs/lib/s-bucket.js:224:7)

Steps to Reproduce

Please include the steps the reproduce the issue, numbered below. Include as
much detail as possible.

'use strict';

const request = require('request');
const storj = require('storj-lib');
const keypair = storj.KeyPair('54e8b615160e91c129b4a2054a8dda83257236ded266131adb50a378438662a0');

const nonce = '1511220328771';
const nodeID = keypair.getNodeID();

const id = nonce;
const data = {
        method: 'AUDIT',
        params: {
                audits: [{
                        data_hash: '<existing hash>',
                        challenge: '6290bb9e1766bf3fc00eea3bb14146925611026d453e1aa95c32973f8baa5c98'
                }],
                contact: {
                        address: 'litteskunk AUDIT test',
                        port: 1337,
                        nodeID: nodeID,
                        protocol: '1.2.0',
                        userAgent: 'littleskunk',
                        spaceAvailable: true,
                        lastSeen: nonce
                },
                nonce: nonce,
                signature: keypair.sign(id + nonce),
        },
        id: id,
};
request.post({
        url: 'http://localhost:4000',
        json: data,
        timeout: 30000
}, (err, res, data) => {
        if (err) {
                console.log('Error request:', err);
        } else if (res.statusCode !== 200) {
                console.log('Status code %s message %s', res.statusCode, res.statusMessage);
        } else {
                console.log(data);
        }
});

The old CONSIGN is storing the audit_tree https://github.com/Storj/core/blob/a95b59ef9ee8058d86698cd3da5053f0464fb558/lib/network/protocol.js#L264

The new ALLOC is not storing it. That is the reason for this issue.

Oh it is even worse. The bridge itself is not sending audit_tree. CONSIGN includes it: https://github.com/Storj/core/blob/master/doc/protocol-spec.md#consign

The new ALLOC doesn't has it: https://github.com/Storj/sips/blob/master/sip-0006.md#publishing-contracts-to-farmers

AUDIT isn't activated or used, and is something that needs to be revisited in upcoming architecture design.

👋 Hey! Thanks for this contribution. Apologies for the delay in responding!

We've decided to rearchitect Storj, so that we can scale better. You can read more about this decision here. This means that we are entirely focused on v3 at the moment, in the storj/storj repository. Our white paper for v3 is coming very, very soon - follow along on the blog and in our Rocketchat.

As this repository is part of the v2 network, we're no longer maintaining this repository. I am going to close this for now. If you have any questions, I encourage you to jump on Rocketchat and ask them there. Thanks!