rchain-community / rchain-api

An API for rchain dapps to communicate with the blockchain
Other
22 stars 12 forks source link

Error: Missing signature #64

Closed dimworm closed 5 years ago

dimworm commented 5 years ago

Hi Dan,

I'm using Joshy's nth-caller-game example. The old API on rnode 0.8.1 works fine. But when I try the newest version on rnode 0.9.2, it report this error: Error: Missing signature at eitherSync (/Users/ericmeng/rholang_show/slot_1/node_modules/rchain-api/src/rnodeAPI.js:170:11) at either (/Users/ericmeng/rholang_show/slot_1/node_modules/rchain-api/src/rnodeAPI.js:162:12) I have added insertArbitrary and lookup, the API should return a string from rholang code.

JoshOrndorff commented 5 years ago

Probably related to https://rchain.atlassian.net/browse/RCHAIN-3213 Can't seem to find which PR it was.

dckc commented 5 years ago

I got signed deploys working in at least one case: 1ce2a43

dimworm commented 5 years ago

I changed the code accordingly, then I got a new error: Error: Invalid size at eitherSync (/Users/ericmeng/rholang_show/slot_1/node_modules/rchain-api/src/rnodeAPI.js:170:11) at either (/Users/ericmeng/rholang_show/slot_1/node_modules/rchain-api/src/rnodeAPI.js:162:12) My code is :

  let deployData = {term: code,
                    timestamp: new Date().valueOf(),
                    phloLimit: 9999999,
                    phloPrice: 1,
                    sig      : h2b("3b99eaac3200f07f99f7d5cc1b12cb507b47a42d418653e76a1ab469e5239e02"),
                    sigAlgorithm: "ed25519",
                    deployer : h2b('77f48b59caeda77751ed138b0ec667ff50f8768c25d48309a8f386a2bad187fb'),
                    from: '0x01',
                    nonce: 1
                   }
dckc commented 5 years ago

signatures are 64 bytes, I think.

Where did you get that signature?

I don't see how that code can work; the signature is a function of the timestamp (and the code).

dimworm commented 5 years ago

Yes, I'm reading your code. I'm a bit clearer. I'll try it tomorrow. Thank you so much.

dimworm commented 5 years ago

After using

const deployData=SignDeployment.sign(keyPair(defaultSec), de)

and downloading some files from you new commit, finally I can get the right block data:

[ DataWithBlockInfo {
    postBlockData: [ [Par] ],
    block:
     BlockInfoWithoutTuplespace {
       parentsHashList: [Array],
       blockHash:
        '51c99fb83d027db608ee6036bdad2128732f3e8ddaec7ca529f019fc3c506738',
       blockSize: '102045',
       blockNumber: [Long],
       version: [Long],
       deployCount: 1,
       tupleSpaceHash:
        '21c0821202035fe0e80ca25855a4380bbae658d22e5a63ac00cee117b538b81f',
       timestamp: [Long],
       faultTolerance: -1,
       mainParentHash:
        '22cef0e9f202a3b0bb1da8e8c79ce7f2510f1e8121cb81c8bddcf141fd3cc83e',
       sender:
        '53c2eb28b6621696f170a0390a4dd44cf658fb39690465691831b17999b96d0b' } } ]
dimworm commented 5 years ago

I can see the lastDatum, but RHOCore.toRholang(lastDatum) cannot get the g_string.

image