I know that deploy a solana program will send many transactions because each tx has a limited size, most transactions are just for uploading program codes.
So I tried to copy program code on chain, but it doesn't work:
first
- deploy a program A, the program data account of A contains all executable codes
- deploy a helper program, it will do copy(src_account, dst_account, data_len)
then try to build a single tx to deploy a new program
- create a buffer account, assign to helper program
- in helper program, copy all program A's codes to newly created buffer account
- set BPFLoader to be owner of buffer account (FAILED)
- create new program account
- call deployMaxLen to deploy new program
sadly, I failed at step 5, we can only assign an all-zeroed account to another program.
So I want to know is it possible to deploy a program in only one tx? no matter what the program contents are