paritytech / txwrapper-core

Tools for FRAME chain builders to publish chain specific offline transaction generation libraries.

Home Page:https://paritytech.github.io/txwrapper-core/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Request an advice on BadProof => "Transaction has a bad signature".

johnnyji-dev opened this issue · comments

Hi~, I'm on Testing claim-reward "Shibuya" testnet (cf. Astar mainnet).

[[DEV-Environment]]
I got a below error message on testing claim-reward on NESTJS env.
I made an unsigned Transaction and then offline-signed with "@substrate/txwrapper-polkadot"-lib.
Especially, I'm using MPC™ wallets.
Without MPC, using pk has no issue.

2023-09-04 06:50:48 RPC-CORE: submitExtrinsic(extrinsic: Extrinsic): Hash:: 1010: Invalid Transaction: Transaction has a bad signature [project-name] Error 9/4/2023, 6:50:48 AM Response[9c22a544] POST "api-url" 503 Service Unavailable - { stack: [ null ] } +195ms

[[Test Result]]
My transaction is composed of multi-transactions for claim-reward(accumulated ERAs).

[some parts of making unsigned transaction]

...
const txs: Extrinsic[] = [];
for (let i = 0; i < availEra; i++) {
txs.push(provider.tx.dappsStaking.claimStaker(getDappAddressEnum(dAppCa)));
}
...
provider.tx.utility.batch(txs).method.toHex(), ...
...
const actualTxHash = await provider.rpc.author.submitExtrinsic(signedTx);
...

Test01-success case)
if "availEra" on for-loop is below 7(include 7), It succeed to broadcast Transaction.
I can get the "actualTxHash" on "[some parts of making unsigned transaction]".

Test02-fail case)
if "availEra" on for-loop is over 7(more than 8), It failed to broadcast Transaction.
I got the upper err-mesg("... Hash:: 1010: Invalid Transaction: Transaction has a bad signature ...").

After signing a unsigned transaction, I checked the validation of transaction with "signatureVerify-api" on "@polkadot/util-crypto"-lib.
I can get the "true" result.

[checking validation of signature]

await cryptoWaitReady();
const isValid = signatureVerify(
${unsigned data}, ${hex-type signed data}, u8aToHex(decodeAddress(${walt_address}))
);
console.log(isValid : ${isValid.isValid});

Question1)
How can I debug this case with another way?
Or Can I get some advice for resolving it?
Question2)
Using MPC, is it related with "Ledger Nano Condition" on below picture?
sepior-claim sign

Hey so to be clear this is not a txwrapper-* issue. If the unsigned transaction you are constructing ends up working one way but not another means that the fundamental issue comes from the wallet you are using in this case.

Using MPC, is it related with "Ledger Nano Condition" on below picture?

If you are having an issue with the eras and the following photo is correct then yes it is most likely a ledger nano issue. But in any case since txwrapper-* is working correctly when using the pk without MPC I can't say we can have much help in resolving this for you as ledger has there own restrictions.