Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anything changed libra testnet since September 10th? #47

Open
17number opened this issue Sep 20, 2019 · 3 comments
Open

Anything changed libra testnet since September 10th? #47

17number opened this issue Sep 20, 2019 · 3 comments

Comments

@17number
Copy link
Contributor

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 git@github.com: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

> libra-core@1.0.7 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
}
@olibaron
Copy link

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

@17number
Copy link
Contributor Author

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

@olibaron
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants