diff --git a/contrib/localnet/solana/gateway.so b/contrib/localnet/solana/gateway.so index ac5e5a3034..564e726e06 100755 Binary files a/contrib/localnet/solana/gateway.so and b/contrib/localnet/solana/gateway.so differ diff --git a/contrib/localnet/solana/start-solana.sh b/contrib/localnet/solana/start-solana.sh index 73a4564f56..d87e9672ae 100644 --- a/contrib/localnet/solana/start-solana.sh +++ b/contrib/localnet/solana/start-solana.sh @@ -8,10 +8,9 @@ echo "starting solana test validator..." solana-test-validator & sleep 5 -# airdrop to e2e sol account and rent payer (used to generate atas for withdraw spl receivers if they don't exist) +# airdrop to e2e sol account solana airdrop 100 solana airdrop 100 37yGiHAnLvWZUNVwu9esp74YQFqxU1qHCbABkDvRddUQ -solana airdrop 100 C6KPvGDYfNusoE4yfRP21F8wK35bxCBMT69xk4xo3X79 solana program deploy gateway.so diff --git a/e2e/e2etests/test_spl_withdraw_and_create_receiver_ata.go b/e2e/e2etests/test_spl_withdraw_and_create_receiver_ata.go index 51196c8a46..77e201005f 100644 --- a/e2e/e2etests/test_spl_withdraw_and_create_receiver_ata.go +++ b/e2e/e2etests/test_spl_withdraw_and_create_receiver_ata.go @@ -13,8 +13,8 @@ import ( crosschaintypes "github.com/zeta-chain/node/x/crosschain/types" ) -// TestSPLWithdrawAndCreateReceiverAta withdraws spl, but letting gateway to create receiver ata using rent payer -// instead of providing receiver that has it already created +// TestSPLWithdrawAndCreateReceiverAta withdraws SPL, but letting gateway program to create receiver ATA +// using PDA funds, instead of providing already created ATA func TestSPLWithdrawAndCreateReceiverAta(r *runner.E2ERunner, args []string) { require.Len(r, args, 1) diff --git a/e2e/runner/setup_solana.go b/e2e/runner/setup_solana.go index 46155c8386..41ad540bc2 100644 --- a/e2e/runner/setup_solana.go +++ b/e2e/runner/setup_solana.go @@ -85,30 +85,6 @@ func (r *E2ERunner) SetupSolana(gatewayID, deployerPrivateKey string) { require.NoError(r, err) r.Logger.Info("initial PDA balance: %d lamports", balance.Value) - // initialize rent payer - var instRentPayer solana.GenericInstruction - rentPayerPdaComputed := r.SolanaRentPayerPDA() - - // create 'initialize_rent_payer' instruction - accountSlice = []*solana.AccountMeta{} - accountSlice = append(accountSlice, solana.Meta(rentPayerPdaComputed).WRITE()) - accountSlice = append(accountSlice, solana.Meta(privkey.PublicKey()).WRITE().SIGNER()) - accountSlice = append(accountSlice, solana.Meta(solana.SystemProgramID)) - instRentPayer.ProgID = r.GatewayProgram - instRentPayer.AccountValues = accountSlice - - instRentPayer.DataBytes, err = borsh.Serialize(solanacontracts.InitializeRentPayerParams{ - Discriminator: solanacontracts.DiscriminatorInitializeRentPayer, - }) - require.NoError(r, err) - - // create and sign the transaction - signedTx = r.CreateSignedTransaction([]solana.Instruction{&instRentPayer}, privkey, []solana.PrivateKey{}) - - // broadcast the transaction and wait for finalization - _, out = r.BroadcastTxSync(signedTx) - r.Logger.Info("initialize_rent_payer logs: %v", out.Meta.LogMessages) - err = r.ensureSolanaChainParams() require.NoError(r, err) diff --git a/e2e/runner/solana.go b/e2e/runner/solana.go index 3bd56e80a7..bc940db79f 100644 --- a/e2e/runner/solana.go +++ b/e2e/runner/solana.go @@ -29,17 +29,6 @@ func (r *E2ERunner) ComputePdaAddress() solana.PublicKey { return pdaComputed } -// SolanaRentPayerPDA computes the rent payer PDA (Program Derived Address) address for the gateway program -func (r *E2ERunner) SolanaRentPayerPDA() solana.PublicKey { - seed := []byte(solanacontract.RentPayerPDASeed) - pdaComputed, bump, err := solana.FindProgramAddress([][]byte{seed}, r.GatewayProgram) - require.NoError(r, err) - - r.Logger.Info("computed rent payer pda: %s, bump %d\n", pdaComputed, bump) - - return pdaComputed -} - // CreateDepositInstruction creates a 'deposit' instruction func (r *E2ERunner) CreateDepositInstruction( signer solana.PublicKey, diff --git a/pkg/contracts/solana/gateway.go b/pkg/contracts/solana/gateway.go index 2fa1f61763..c1b859cd33 100644 --- a/pkg/contracts/solana/gateway.go +++ b/pkg/contracts/solana/gateway.go @@ -11,9 +11,6 @@ const ( // PDASeed is the seed for the Solana gateway program derived address PDASeed = "meta" - // RentPayerPDASeed is the seed for the Solana gateway program derived address - RentPayerPDASeed = "rent-payer" - // AccountsNumberOfDeposit is the number of accounts required for Solana gateway deposit instruction // [signer, pda, system_program] accountsNumDeposit = 3 @@ -27,9 +24,6 @@ var ( // DiscriminatorInitialize returns the discriminator for Solana gateway 'initialize' instruction DiscriminatorInitialize = idlgateway.IDLGateway.GetDiscriminator("initialize") - // DiscriminatorInitializeRentPayer returns the discriminator for Solana gateway 'initialize_rent_payer' instruction - DiscriminatorInitializeRentPayer = idlgateway.IDLGateway.GetDiscriminator("initialize_rent_payer") - // DiscriminatorDeposit returns the discriminator for Solana gateway 'deposit' instruction DiscriminatorDeposit = idlgateway.IDLGateway.GetDiscriminator("deposit") @@ -62,12 +56,3 @@ func ParseGatewayWithPDA(gatewayAddress string) (solana.PublicKey, solana.Public return gatewayID, pda, err } - -// ParseRentPayerPDA parses the rent payer program derived address from the given string -func RentPayerPDA(gateway solana.PublicKey) (solana.PublicKey, error) { - var rentPayerPda solana.PublicKey - seed := []byte(RentPayerPDASeed) - rentPayerPda, _, err := solana.FindProgramAddress([][]byte{seed}, gateway) - - return rentPayerPda, err -} diff --git a/pkg/contracts/solana/gateway.json b/pkg/contracts/solana/gateway.json index f60f3b45a8..39f985c9de 100644 --- a/pkg/contracts/solana/gateway.json +++ b/pkg/contracts/solana/gateway.json @@ -375,54 +375,6 @@ } ] }, - { - "name": "initialize_rent_payer", - "discriminator": [ - 225, - 73, - 166, - 180, - 25, - 245, - 183, - 96 - ], - "accounts": [ - { - "name": "rent_payer_pda", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 114, - 101, - 110, - 116, - 45, - 112, - 97, - 121, - 101, - 114 - ] - } - ] - } - }, - { - "name": "authority", - "writable": true, - "signer": true - }, - { - "name": "system_program", - "address": "11111111111111111111111111111111" - } - ], - "args": [] - }, { "name": "set_deposit_paused", "discriminator": [ @@ -878,29 +830,6 @@ ], "writable": true }, - { - "name": "rent_payer_pda", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 114, - 101, - 110, - 116, - 45, - 112, - 97, - 121, - 101, - 114 - ] - } - ] - } - }, { "name": "token_program", "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" @@ -966,19 +895,6 @@ 94 ] }, - { - "name": "RentPayerPda", - "discriminator": [ - 48, - 247, - 192, - 150, - 46, - 218, - 14, - 121 - ] - }, { "name": "WhitelistEntry", "discriminator": [ @@ -1084,13 +1000,6 @@ ] } }, - { - "name": "RentPayerPda", - "type": { - "kind": "struct", - "fields": [] - } - }, { "name": "WhitelistEntry", "type": { diff --git a/pkg/contracts/solana/instruction.go b/pkg/contracts/solana/instruction.go index 9bd216d338..e11116e35f 100644 --- a/pkg/contracts/solana/instruction.go +++ b/pkg/contracts/solana/instruction.go @@ -22,12 +22,6 @@ type InitializeParams struct { ChainID uint64 } -// InitializeRentPayerParams contains the parameters for a gateway initialize_rent_payer instruction -type InitializeRentPayerParams struct { - // Discriminator is the unique identifier for the initialize_rent_payer instruction - Discriminator [8]byte -} - // DepositInstructionParams contains the parameters for a gateway deposit instruction type DepositInstructionParams struct { // Discriminator is the unique identifier for the deposit instruction diff --git a/zetaclient/chains/solana/signer/signer.go b/zetaclient/chains/solana/signer/signer.go index 42b9855ab9..b6739751ac 100644 --- a/zetaclient/chains/solana/signer/signer.go +++ b/zetaclient/chains/solana/signer/signer.go @@ -44,9 +44,6 @@ type Signer struct { // pda is the program derived address of the gateway program pda solana.PublicKey - - // rent payer pda is the program derived address of the gateway program to pay rent for creating atas - rentPayerPda solana.PublicKey } // NewSigner creates a new Solana signer @@ -68,19 +65,12 @@ func NewSigner( return nil, errors.Wrapf(err, "cannot parse gateway address %s", chainParams.GatewayAddress) } - // parse rent payer PDA, used in case receiver ATA should be created in gateway - rentPayerPda, err := contracts.RentPayerPDA(gatewayID) - if err != nil { - return nil, errors.Wrapf(err, "cannot parse gateway address %s", chainParams.GatewayAddress) - } - // create Solana signer signer := &Signer{ - Signer: baseSigner, - client: solClient, - gatewayID: gatewayID, - pda: pda, - rentPayerPda: rentPayerPda, + Signer: baseSigner, + client: solClient, + gatewayID: gatewayID, + pda: pda, } // construct Solana private key if present diff --git a/zetaclient/chains/solana/signer/withdraw_spl.go b/zetaclient/chains/solana/signer/withdraw_spl.go index 93303fb5e6..1436cf937c 100644 --- a/zetaclient/chains/solana/signer/withdraw_spl.go +++ b/zetaclient/chains/solana/signer/withdraw_spl.go @@ -105,7 +105,6 @@ func (signer *Signer) signWithdrawSPLTx( solana.Meta(msg.MintAccount()), solana.Meta(msg.To()), solana.Meta(recipientAta).WRITE(), - solana.Meta(signer.rentPayerPda).WRITE(), solana.Meta(solana.TokenProgramID), solana.Meta(solana.SPLAssociatedTokenAccountProgramID), solana.Meta(solana.SystemProgramID),