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

signFakeWithApi not working for Moonbeam #845

Open
albertov19 opened this issue Oct 24, 2024 · 1 comment
Open

signFakeWithApi not working for Moonbeam #845

albertov19 opened this issue Oct 24, 2024 · 1 comment

Comments

@albertov19
Copy link
Contributor

Is the issue related to Moonbeam using ECDSA?

But when I try to use the signFakeWithApi utility of Chopsticks against Moonriver (in this case), I get:

RPC-CORE: submitExtrinsic(extrinsic: Extrinsic): Hash:: 1010: {"invalid":{"badProof":null}}

The code:

import { ApiPromise, WsProvider } from '@polkadot/api';
import { signFakeWithApi } from '@acala-network/chopsticks-utils';

import yargs from 'yargs';

// Get input arguments
const args = yargs.options({
  endpoint: { type: 'string', demandOption: true, default: 'ws://127.0.0.1:8000', alias: 'e' },
  sender: { type: 'string', demandOption: true, alias: 's' },
}).argv;

const main = async () => {
  console.log('--- Chopsticks Test Started ---');

  const chopsticksProvider = new WsProvider(args['endpoint']);
  const chopsticksAPI = await ApiPromise.create({
    provider: chopsticksProvider,
    noInitWarn: true,
  });

  // Call
  const tx = await chopsticksAPI.tx.system.remark('Test');

  // Test
  console.log(tx.method.toHex());
  await signFakeWithApi(chopsticksAPI, tx, args['sender']);
  await tx.send();

  console.log('--- Chopsticks Test Done ---');
  await chopsticksAPI.disconnect();
};

main();

Call Moonriver-Chopsticks (Fails):

ts-node ./chopsticks_fakeTx.ts --sender '0xf24FF3a9CF04c71Dbc94D0b566f7A27B94566cac'

Call Polkadot-Chopsticks(OK):

ts-node ./chopsticks_fakeTx.ts --sender '15oF4uVJwmo4TdGW7VfQxNLavjCXviqxT9S1MgbjMNHr6Sp5'
@xlc
Copy link
Member

xlc commented Oct 24, 2024

I did a quick check of the code and the way mocking works should support all signing algorithms but we never tested it with ECDSA so maybe there is an issue somewhere.
Also is there any chance that Moonbeam verifies the signature in runtime instead of using host functions?

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