Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pkg/accountsdb/accountsdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,16 +210,21 @@ func (accountsDb *AccountsDb) GetAccount(slot uint64, pubkey solana.PublicKey) (
}

func (accountsDb *AccountsDb) getStoredAccount(slot uint64, pubkey solana.PublicKey) (*accounts.Account, error) {
r := trace.StartRegion(context.Background(), "GetStoredAccountCache")
cachedAcct, hasAcct := accountsDb.VoteAcctCache.Get(pubkey)
if hasAcct {
r.End()
return cachedAcct, nil
}

cachedAcct, hasAcct = accountsDb.CommonAcctsCache.Get(pubkey)
if hasAcct {
r.End()
return cachedAcct, nil
}
r.End()

defer trace.StartRegion(context.Background(), "GetStoredAccountDisk").End()
acctIdxEntryBytes, c, err := accountsDb.Index.Get(pubkey[:])
if err != nil {
//mlog.Log.Debugf("no account found in accountsdb for pubkey %s: %s", pubkey, err)
Expand Down Expand Up @@ -276,6 +281,7 @@ func (accountsDb *AccountsDb) getStoredAccount(slot uint64, pubkey solana.Public
// Returns a slice of the same length as the input with results matching indexes, nil if not found.
// Returns clones to avoid data races with the store worker.
func (accountsDb *AccountsDb) getStoreInProgressAccounts(pks []solana.PublicKey) []*accounts.Account {
defer trace.StartRegion(context.Background(), "getStoreInProgressAccounts").End()
out := make([]*accounts.Account, len(pks))
accountsDb.inProgressStoreRequestsMu.Lock()
defer accountsDb.inProgressStoreRequestsMu.Unlock()
Expand Down
46 changes: 29 additions & 17 deletions pkg/replay/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,30 +206,42 @@ func resolveAddrTableLookups(accountsDb *accountsdb.AccountsDb, block *b.Block)
continue
}

var skipLookup bool
for _, addrTableKey := range tx.Message.GetAddressTableLookups().GetTableIDs() {
if _, alreadyLoaded := tables[addrTableKey]; alreadyLoaded {
continue
}

acct, err := accountsDb.GetAccount(block.Slot, addrTableKey)
if err != nil {
skipLookup = true
break
}
tables[addrTableKey] = nil
}
}

addrLookupTable, err := sealevel.UnmarshalAddressLookupTable(acct.Data)
if err != nil {
return err
}
tablesSlice := make([]solana.PublicKey, 0, len(tables))
for t := range tables {
tablesSlice = append(tablesSlice, t)
}
accts, err := accountsDb.GetAccountsBatch(context.Background(), block.Slot, tablesSlice)
if err != nil {
return err
}

tables[addrTableKey] = addrLookupTable.Addresses
for i := range tablesSlice {
if len(accts[i].Data) == 0 {
delete(tables, tablesSlice[i])
continue
}
addrLookupTable, err := sealevel.UnmarshalAddressLookupTable(accts[i].Data)
if err != nil {
return err
}
tables[tablesSlice[i]] = addrLookupTable.Addresses
}

if skipLookup {
txResolveLoop:
for _, tx := range block.Transactions {
if !tx.Message.IsVersioned() || tx.Message.AddressTableLookups.NumLookups() == 0 {
continue
}

for _, addrTableKey := range tx.Message.GetAddressTableLookups().GetTableIDs() {
if _, ok := tables[addrTableKey]; !ok {
continue txResolveLoop
}
}
err := tx.Message.SetAddressTables(tables)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion pkg/replay/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ func verifySignatures(tx *solana.Transaction, slot uint64, sigverifyWg *sync.Wai
}

func ProcessTransaction(slotCtx *sealevel.SlotCtx, sigverifyWg *sync.WaitGroup, tx *solana.Transaction, txMeta *rpc.TransactionMeta, dbgOpts *DebugOptions, arena *arena.Arena[sealevel.BorrowedAccount]) (*fees.TxFeeInfo, error) {
if slotCtx.TraceCtx != nil {
if trace.IsEnabled() && slotCtx.TraceCtx != nil {
region := trace.StartRegion(slotCtx.TraceCtx, "ProcessTransaction")
defer region.End()

Expand Down