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

transferCoins does not work anymore

Open manihagh opened this issue 5 years ago • 7 comments

Just tried the transferCoins example and seems does not work anymore.

LibraTransactionResponse { signedTransaction: LibraSignedTransaction { transaction: LibraTransaction { program: [Object], gasContraint: [Object], expirationTime: [BigNumber], sendersAddress: [AccountAddress], sequenceNumber: [BigNumber] }, publicKey: Uint8Array [ 126, 142, 165, 73, 194, 136, 153, 77, 213, 61, 211, 220, 2, 180, 195, 48, 128, 186, 113, 104, 203, 53, 60, 113, 224, 54, 74, 205, 207, 172, 13, 60 ], signature: Uint8Array [ 220, 207, 1, 86, 178, 236, 48, 138, 181, 91, 106, 88, 206, 56, 244, 57, 205, 75, 11, 128, 153, 75, 131, 223, 121, 86, 171, 73, 149, 72, 123, 214, 43, 157, 175, 199, 127, 108, 6, 30, 178, 143, 220, 214, 65, 137, 141, 43, 137, 213, 238, 231, 103, 27, 125, 197, 32, 14, 113, 135, 229, 120, 95, 9 ] }, validatorId: Uint8Array [], acStatus: -1, mempoolStatus: -1, vmStatus: LibraVMStatusError { errorType: 1, validationStatusError: { code: 2, message: 'none' }, verificationStatusErrors: undefined, invariantViolationError: undefined, deserializationError: undefined, executionError: undefined } }

manihagh avatar Aug 20 '19 18:08 manihagh

Yes, this has come to my attention recently too, but I'm quite busy this week and won't be able to look into this until weekend.

If you have some time and know what the issue is, I would appreciate your contribution, or else you will have to wait a little while before I can get a fix for it. Thank you for using libra-core.

perfectmak avatar Aug 20 '19 19:08 perfectmak

Thanks, the error indicates error type: 1 ("VALIDATION") and validationStatusError: 2 ( "INVALIDAUTHKEY"). Also looking at LibraTransaction object seems the senders address is not valid: sendersAddress: AccountAddress { addressBytes: Uint8Array [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] }

The issue seems to be be the signed transaction does not contain correct sender address before encoding within execute.

For now, I resolved this by adding below line in 'lib/client/index.ts': transaction.sendersAddress = sender.getAddress();

After this: public async execute(transaction: LibraTransaction, sender: Account): Promise<LibraTransactionResponse> {

However, I prefer not create a PR as the root cause could be within lib/transaction

manihagh avatar Aug 21 '19 05:08 manihagh

@manihagh I'm honestly not sure how to reproduce this error. I just tried the transferring libra coins example and it worked for me.

zoeyTM avatar Aug 22 '19 06:08 zoeyTM

transferCoins works but mintWithFaucetService not, seems related to mintAddress change in c5cce923cb3e076341cff5e1ac83069b29628d73, updated in https://github.com/perfectmak/libra-core/pull/40

mmsqe avatar Aug 23 '19 02:08 mmsqe

@mmsqe yes you're right the problem is come from this, I gonna make PR to fix this soon.

totiz avatar Aug 23 '19 07:08 totiz

@mmsqe Oh you just make a PR, nice!

totiz avatar Aug 23 '19 07:08 totiz

I suggest to change constant of MinterAddress to AssociationAddress, It'll more clear what the constant represent. Reference to this https://github.com/libra/libra/blob/testnet/types/src/account_config.rs#L49

And kula-libra just update as well https://github.com/kulapio/libra-core/pull/7/files

totiz avatar Aug 23 '19 08:08 totiz