gagliardetto/anchor-go

Out-of-order signer accounts can cause issues with generated Anchor bindings

Opened this issue · 2 comments

I ran into this issue using the code gen because in my Rust struct, the authority which I used to sign a transaction was not listed as the zeroth account, which is what the Solana runtime expects for verification (since the signature is in the zeroth index of the list of sigs). So anchor-go complained about sigs, yet, it worked in the Anchor JS client.

Anchor JS bindings, I think were doing some magic behind the scenes (https://github.com/project-serum/anchor/blob/master/ts/src/program/accounts-resolver.ts#L42 ?) to make the ordering work correctly, perhaps the generated Go code could do something like this as well. But that would also probably complicate the code, so I can definitely see it as unnecessary as well.

Can you serialize to base64 the anchor equivalent of the same transaction? And post it here (or send privately)

Do you happen to know the code to do that in Anchor JS/TSX? I can get .transaction() off the RPC, but it's giving me some mystery complaints even after signing, setting fee payer, etc