Skip to content

Commit

Permalink
Fixed filter lookup table error case and fixed linting
Browse files Browse the repository at this point in the history
  • Loading branch information
amit-momin committed Dec 6, 2024
1 parent a01ba58 commit 03fd1bf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion pkg/solana/chainwriter/chain_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func (s *SolanaChainWriterService) FilterLookupTableAddresses(
for innerIdentifier, metas := range innerMap {
tableKey, err := solana.PublicKeyFromBase58(innerIdentifier)
if err != nil {
fmt.Errorf("error parsing lookup table key: %w", err)
continue
}

// Collect public keys that are actually used
Expand Down
17 changes: 8 additions & 9 deletions pkg/solana/chainwriter/chain_writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,15 +330,14 @@ func TestChainWriter_SubmitTransaction(t *testing.T) {
// match transaction fields to ensure it was built as expected
require.Equal(t, recentBlockHash, tx.Message.RecentBlockhash)
require.Len(t, tx.Message.Instructions, 1)
require.Len(t, tx.Message.AccountKeys, 5) // fee payer + derived accounts
require.Equal(t, admin, tx.Message.AccountKeys[0]) // fee payer
require.Equal(t, account1, tx.Message.AccountKeys[1]) // account constant
require.Equal(t, account2, tx.Message.AccountKeys[2]) // account lookup
require.Equal(t, account3, tx.Message.AccountKeys[3]) // pda lookup
require.Equal(t, configProgramID, tx.Message.AccountKeys[4]) // instruction program ID
require.Len(t, tx.Message.AddressTableLookups, 1) // address table look contains entry
addressTableLookup := tx.Message.AddressTableLookups[0].AccountKey
require.Equal(t, derivedLookupTablePubkey, addressTableLookup) // address table
require.Len(t, tx.Message.AccountKeys, 5) // fee payer + derived accounts
require.Equal(t, admin, tx.Message.AccountKeys[0]) // fee payer
require.Equal(t, account1, tx.Message.AccountKeys[1]) // account constant
require.Equal(t, account2, tx.Message.AccountKeys[2]) // account lookup
require.Equal(t, account3, tx.Message.AccountKeys[3]) // pda lookup
require.Equal(t, configProgramID, tx.Message.AccountKeys[4]) // instruction program ID
require.Len(t, tx.Message.AddressTableLookups, 1) // address table look contains entry
require.Equal(t, derivedLookupTablePubkey, tx.Message.AddressTableLookups[0].AccountKey) // address table
return true
}), &txID).Return(nil).Once()

Expand Down

0 comments on commit 03fd1bf

Please sign in to comment.