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

Submitting an extrinsic without 0x prefix results in an error #305

Open
kratico opened this issue May 31, 2023 · 2 comments
Open

Submitting an extrinsic without 0x prefix results in an error #305

kratico opened this issue May 31, 2023 · 2 comments

Comments

@kratico
Copy link

kratico commented May 31, 2023

It can be reproduced by getting a signed extrinsic and calling the author_submitExtrinsic endpoint.

The Polkadot RPC endpoint allows to pass the param without the 0x prefix

const ws = new WebSocket("ws://127.0.0.1:8000")

// a signed extrinsic without the 0x prefix
const extrinsic = "450284008eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48016e01fd8bb3ec174e95cc09a54ea864e20fe0d5fc609f7c3ea11acb1e79505b7c97fbc65af701124bec1b3d27d1fd50c84924f1a9fc76ab6c08552b2e3cfa04822500040005030090b5ab205c6974c9ea841be688864633dc9ca8a357843eeacf2314649965fe220b000cd809fa08"

ws.addEventListener("message", ({ data }) => console.log(JSON.parse(data)))
ws.addEventListener("open", () => {
  ws.send(JSON.stringify({
    id: 1,
    jsonrpc: "2.0",
    method: "author_submitExtrinsic",
    params: [extrinsic],
  }))
})

RPC error event

{
  id: 1,
  jsonrpc: "2.0",
  error: {
    code: 1011,
    message: "Error: Error while executing Wasm VM: wasm `unreachable` instruction executed\n" +
      `"panicked at 'Bad inpu`... 141 more characters
  }
}

Chopsticks logs

npx @acala-network/chopsticks@latest -e ws://127.0.0.1:9944
[11:22:35.465] INFO (rpc/56531): Development RPC listening on port 8000
[11:23:00.165] INFO (ws/56531): Error handling request: Error: Error: Error while executing Wasm VM: wasm `unreachable` instruction executed
"panicked at 'Bad input data provided to validate_transaction: Codec error', /Users/parity/ghq/github.com/paritytech/polkadot/runtime/polkadot/src/lib.rs:1520:1\n" 'Error: Error: Error while executing Wasm VM: wasm `unreachable` instruction executed
"panicked at 'Bad input data provided to validate_transaction: Codec error', /Users/parity/ghq/github.com/paritytech/polkadot/runtime/polkadot/src/lib.rs:1520:1\n"
    at /Users/parity/.npm/_npx/81ad9c881cb83600/node_modules/@acala-network/chopsticks/lib/rpc/substrate/author.js:12:19
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async WebSocket.<anonymous> (/Users/parity/.npm/_npx/81ad9c881cb83600/node_modules/@acala-network/chopsticks/lib/server.js:131:30)'
@xlc
Copy link
Member

xlc commented May 31, 2023

I will put this as "won't fix" for now until one of those happens:

  • Identify compatibility issue with existing tools due to this
  • OR some spec is created specifying what's the correct behaviour

@dzmitry-lahoda
Copy link
Contributor

i have seen similar issue with wasm genesis. when some binary was not prefixed 0x - smoldot failed to load it. seems like it not only issue to fix. but anyway - fixed by using proper prefix.

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

3 participants