solana-web3.js icon indicating copy to clipboard operation
solana-web3.js copied to clipboard

Make PublicKey.createWithSeed (js) same as create_with_seed in runtime to avoid confusion

Open mcf-rocks opened this issue 5 years ago • 6 comments
trafficstars

SystemProgram CreateAccountWithSeed instruction was failing sometimes, because seed too long.

Here ./sdk/src/pubkey.rs which is used here ./runtime/src/system_instruction_processor.rs

Javascript func doesn't care about seed length https://solana-labs.github.io/solana-web3.js/file/src/publickey.js.html#lineNumber82

So you think it's good, but then the runtime does nothing (nothing reported in logs either)

Suggest: make js function same as runtime, with error if seed too long.

mcf-rocks avatar Nov 11 '20 14:11 mcf-rocks

I would like to work on this Unless someone is already working on this?

Lioncat2002 avatar Aug 22 '23 11:08 Lioncat2002

As per @steveluscher's comments on the linked PR #1286 I think this is going to have to get solved in the new API, which will be laced into the existing API under the hood, effectively solving this problem upon incremental release.

It's possible we can either close this and create a new issue for the new API

buffalojoec avatar Aug 23 '23 03:08 buffalojoec

Ah I had been a little confused since it seemed to link to another issue. But thanks for answering!

Lioncat2002 avatar Aug 23 '23 03:08 Lioncat2002

Is there any other issues that I can try my hands on? 👀

Lioncat2002 avatar Aug 23 '23 06:08 Lioncat2002

Is there any other issues that I can try my hands on? 👀

There should be a few in the issues that are geared towards the new API you might want to take a stab at!

Check out the somewhat recent ones

buffalojoec avatar Aug 23 '23 06:08 buffalojoec

Is there any other issues that I can try my hands on? 👀

There should be a few in the issues that are geared towards the new API you might want to take a stab at!

Check out the somewhat recent ones

Ahhh thanks! I will have a look

Lioncat2002 avatar Aug 23 '23 07:08 Lioncat2002

This is now createAddressWithSeed() in @solana/web3.js 2.0, and seed length is enforced there.

https://github.com/solana-labs/solana-web3.js/blob/e90ed593754c4bb1a18f2c57c716746a3403f498/packages/addresses/src/program-derived-address.ts#L151-L157

steveluscher avatar Oct 21 '24 21:10 steveluscher

Because there has been no activity on this issue for 7 days since it was closed, it has been automatically locked. Please open a new issue if it requires a follow up.

github-actions[bot] avatar Oct 29 '24 08:10 github-actions[bot]