kevinheavey / solana-bankrun

Superfast Solana Tests for Node.js
https://kevinheavey.github.io/solana-bankrun/
Apache License 2.0
86 stars 8 forks source link

Serialize without verification of signatures #12

Closed ochaloup closed 3 months ago

ochaloup commented 7 months ago

Hello,

first, thank you for this great tooling for testing of the Solana programs. I started to use it and I really appreciate it.

This PR is more a proposal for discussion (I'm not sure about guidelines for contribution and there could be missing some parts).

For sending transactions I miss a chance to omit verification of signatures at the client side. I would like to pass to the serialize call the SerializeConfig (https://github.com/solana-labs/solana-web3.js/blob/v1.87.6/packages/library-legacy/src/transaction/legacy.ts#L795).

To setup like

{requireAllSignatures: false, verifySignatures: false}

For the client call there could be possible to use the sendRawTransaction https://github.com/solana-labs/solana-web3.js/blob/v1.87.6/packages/library-legacy/src/connection.ts#L5876 which seems to be problematic in case of bankrun. Passing the parameter to sendTransaction calls could be potentially a way.

I'm happy to adjust the code base on the feedback. If this change is not convenient feel free to close the pr. Thanks.

kevinheavey commented 7 months ago

Is the idea here that you want to test sending invalid transactions to see if you handle the error message correctly?

ochaloup commented 7 months ago

Is the idea here that you want to test sending invalid transactions to see if you handle the error message correctly?

Yes, correct. I would like to send the transaction and get the error from the onchain program and not being declined at the level of the client library.

ochaloup commented 6 months ago

@kevinheavey what do you think about the update to make possible to do verification of the signatures at the on-chain program level during testing and not being limited at the js/ts level? Or to provide some processRawTransaction method alternative to current ones?

kevinheavey commented 3 months ago

Closing this because the transaction signatures actually don't get checked on the BanksServer side (some BanksServer methods do check, but not the ones we're using here). Will come back later with an alternative