libra-core icon indicating copy to clipboard operation
libra-core copied to clipboard

Anything changed libra testnet since September 10th?

Open 17number opened this issue 6 years ago • 3 comments

I tried transfer coins sample code with PR #46, but transfer failed. So I executed test(npm test), but test suites also failed. I want to know to the reason of failure. My development environment is something wrong? Or any changes on libra/libra? Someone knows?

My environment.

$ sw_vers
ProductName:	Mac OS X
ProductVersion:	10.14.6
BuildVersion:	18G95

$ node -v
v12.7.0

$ npm -v
6.10.3

$ tsc -v
Version 3.5.3

Below is my command history.

$ git clone [email protected]:perfectmak/libra-core.git
Cloning into 'libra-core'...
...
$ cd libra-core
$ git fetch origin pull/46/head:pr46
$ git checkout pr46
$ npm i
$ npm run build
$ npm test

> [email protected] test /Users/r17n/development/experiment/libra-core
> jest

 PASS  test/wallet.test.ts
 FAIL  test/client.test.ts (9.927s)
  ● Console

    console.log test/client.test.ts:28
      Account 1 address 7f58df27522872ecfac340c5c072427e6f8083ca3c79bb748cdd1ae073dacc42
    console.log test/client.test.ts:33
      Account 2 address e5474077f11a366b2620bc2aa7c260e68311e4b0fddcfe0505849bd5aadb3766

  ● LibraClient › should use minter address and sanity test calling getAccountTransaction()

    TypeError: Cannot read property 'getArgumentsList' of undefined

      116 |
      117 |     const program: LibraProgram = {
    > 118 |       arguments: rawProgram.getArgumentsList().map(argument => ({
          |                             ^
      119 |         type: (argument.getType() as unknown) as LibraProgramArgumentType,
      120 |         value: argument.getData_asU8(),
      121 |       })),

      at ClientDecoder.decodeRawTransactionBytes (lib/client/Decoder.ts:118:29)
      at ClientDecoder.decodeSignedTransactionWithProof (lib/client/Decoder.ts:85:35)
      at lib/client/index.ts:164:30
      at Object.onReceiveStatus (node_modules/grpc/src/client_interceptors.js:1207:9)
      at InterceptingListener.Object.<anonymous>.InterceptingListener._callNext (node_modules/grpc/src/client_interceptors.js:568:42)
      at InterceptingListener.Object.<anonymous>.InterceptingListener.onReceiveStatus (node_modules/grpc/src/client_interceptors.js:618:8)
      at callback (node_modules/grpc/src/client_interceptors.js:845:24)

  ● LibraClient › should query account state and transfer

    expect(received).toEqual(expected) // deep equality

    Expected: 0
    Received: 2

      45 |     account1State = await client.getAccountState(account1Address);
      46 |     const response = await client.transferCoins(account1, account2Address, amountToTransfer);
    > 47 |     expect(response.acStatus).toEqual(LibraAdmissionControlStatus.ACCEPTED);
         |                               ^
      48 |
      49 |     // ensure new account balance is +yAmount
      50 |     await response.awaitConfirmation(client);

      at Object.<anonymous> (test/client.test.ts:47:31)

Test Suites: 1 failed, 1 passed, 2 total
Tests:       2 failed, 1 passed, 3 total
Snapshots:   0 total
Time:        10.986s
Ran all test suites.
npm ERR! Test failed.  See above for more details.

https://libraview.org/Account/71d1fc92139f8a247d6758e9e69c8b26b67b5e3547655a6eb1f615ec5411e668 is my test account.

const libra_core = require("./build/index.js");
const LibraWallet = libra_core.LibraWallet;
const LibraClient = libra_core.LibraClient;
const LibraNetwork = libra_core.LibraNetwork;
const client = new LibraClient({ network: LibraNetwork.Testnet });

const mnemonic = "...";
const wallet = new LibraWallet({mnemonic: mnemonic});
const account = wallet.newAccount();

async function send(srcAccount, destAddress, amount) {
  const response = await client.transferCoins(srcAccount, destAddress, amount * 1e6);
  console.log(response);
  await response.awaitConfirmation(client);
}

send(account, account.getAddress().toString(), 0.1);
$ node send.js
LibraTransactionResponse {
  signedTransaction: LibraSignedTransaction {
    transaction: [LibraTransaction],
    publicKey: [Uint8Array],
    signature: [Uint8Array]
  },
  validatorId: Uint8Array [],
  acStatus: 2,
  mempoolStatus: -1,
  vmStatus: undefined
}

17number avatar Sep 20 '19 02:09 17number

Testnet updated and the transaction.proto as well. libra-core relies on RawTransaction which has been removed from the transaction.proto. So basically this means that a lot need to be rewritten

olibaron avatar Sep 20 '19 10:09 olibaron

@olibaron Thank you for reply. That sounds bad to me...

17number avatar Sep 20 '19 13:09 17number

Not bad, but every client in whatever language is now forced to implement the libra canonical serializer. Meaning that it will need to be ported to javascript.

olibaron avatar Sep 20 '19 14:09 olibaron