diff --git a/pkg/contracts/solana/inbound.go b/pkg/contracts/solana/inbound.go index d5bf2d5198..526890c323 100644 --- a/pkg/contracts/solana/inbound.go +++ b/pkg/contracts/solana/inbound.go @@ -201,9 +201,9 @@ func getSignerDeposit(tx *solana.Transaction, inst *solana.CompiledInstruction) return "", err } - // there should be 3 accounts for a deposit instruction - if len(instructionAccounts) != accountsNumDeposit { - return "", fmt.Errorf("want %d accounts, got %d", accountsNumDeposit, len(instructionAccounts)) + // there should be at least all mandatory accounts for a deposit instruction + if len(instructionAccounts) < accountsNumDeposit { + return "", fmt.Errorf("want required %d accounts, got %d", accountsNumDeposit, len(instructionAccounts)) } // the accounts are [signer, pda, system_program] @@ -225,10 +225,10 @@ func getSignerAndSPLFromDepositSPLAccounts( return "", "", err } - // there should be 7 accounts for a deposit spl instruction - if len(instructionAccounts) != accountsNumberDepositSPL { + // there should be at least all mandatory accounts for a deposit spl instruction + if len(instructionAccounts) < accountsNumberDepositSPL { return "", "", fmt.Errorf( - "want %d accounts, got %d", + "want required %d accounts, got %d", accountsNumberDepositSPL, len(instructionAccounts), ) diff --git a/pkg/contracts/solana/inbound_test.go b/pkg/contracts/solana/inbound_test.go index 63de780b57..b8d1354a1f 100644 --- a/pkg/contracts/solana/inbound_test.go +++ b/pkg/contracts/solana/inbound_test.go @@ -113,7 +113,7 @@ func Test_ParseInboundAsDeposit(t *testing.T) { // append one more account to instruction tx.Message.AccountKeys = append(tx.Message.AccountKeys, solana.MustPublicKeyFromBase58(sample.SolanaAddress(t))) - tx.Message.Instructions[0].Accounts = append(tx.Message.Instructions[0].Accounts, 4) + tx.Message.Instructions[0].Accounts = tx.Message.Instructions[0].Accounts[:len(tx.Message.Instructions[0].Accounts)-1] // ACT deposit, err := ParseInboundAsDeposit(tx, 0, txResult.Slot) @@ -218,7 +218,7 @@ func Test_ParseInboundAsDepositAndCall(t *testing.T) { // append one more account to instruction tx.Message.AccountKeys = append(tx.Message.AccountKeys, solana.MustPublicKeyFromBase58(sample.SolanaAddress(t))) - tx.Message.Instructions[0].Accounts = append(tx.Message.Instructions[0].Accounts, 4) + tx.Message.Instructions[0].Accounts = tx.Message.Instructions[0].Accounts[:len(tx.Message.Instructions[0].Accounts)-1] // ACT deposit, err := ParseInboundAsDeposit(tx, 0, txResult.Slot) @@ -322,7 +322,7 @@ func Test_ParseInboundAsDepositSPL(t *testing.T) { // append one more account to instruction tx.Message.AccountKeys = append(tx.Message.AccountKeys, solana.MustPublicKeyFromBase58(sample.SolanaAddress(t))) - tx.Message.Instructions[0].Accounts = append(tx.Message.Instructions[0].Accounts, 4) + tx.Message.Instructions[0].Accounts = tx.Message.Instructions[0].Accounts[:len(tx.Message.Instructions[0].Accounts)-1] // ACT deposit, err := ParseInboundAsDepositSPL(tx, 0, txResult.Slot) @@ -426,7 +426,7 @@ func Test_ParseInboundAsDepositAndCallSPL(t *testing.T) { // append one more account to instruction tx.Message.AccountKeys = append(tx.Message.AccountKeys, solana.MustPublicKeyFromBase58(sample.SolanaAddress(t))) - tx.Message.Instructions[0].Accounts = append(tx.Message.Instructions[0].Accounts, 4) + tx.Message.Instructions[0].Accounts = tx.Message.Instructions[0].Accounts[:len(tx.Message.Instructions[0].Accounts)-1] // ACT deposit, err := ParseInboundAsDepositSPL(tx, 0, txResult.Slot)