Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warm up empty trees for accesslists #7111

Merged
merged 3 commits into from
May 30, 2024
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
11 changes: 9 additions & 2 deletions src/Nethermind/Nethermind.State/PersistentStorageProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,16 @@ private StorageTree GetOrCreateStorage(Address address)
return value;
}

public void WarmUp(in StorageCell storageCell)
public void WarmUp(in StorageCell storageCell, bool isEmpty)
{
LoadFromTree(in storageCell);
if (isEmpty)
{
_preBlockCache[storageCell] = Array.Empty<byte>();
}
else
{
LoadFromTree(in storageCell);
}
}

private ReadOnlySpan<byte> LoadFromTree(in StorageCell storageCell)
Expand Down
4 changes: 2 additions & 2 deletions src/Nethermind/Nethermind.State/StateProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -654,9 +654,9 @@ public StateProvider(IScopedTrieStore? trieStore,
};
}

public void WarmUp(Address address)
public bool WarmUp(Address address)
{
GetState(address);
return GetState(address) is not null;
}

private Account? GetState(Address address)
Expand Down
4 changes: 2 additions & 2 deletions src/Nethermind/Nethermind.State/WorldState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ public void WarmUp(AccessList? accessList)
{
foreach ((Address address, AccessList.StorageKeysEnumerable storages) in accessList)
{
_stateProvider.WarmUp(address);
bool exists = _stateProvider.WarmUp(address);
foreach (UInt256 storage in storages)
{
_persistentStorageProvider.WarmUp(new StorageCell(address, storage));
_persistentStorageProvider.WarmUp(new StorageCell(address, storage), isEmpty: !exists);
}
}
}
Expand Down