Consensys / bela

Besu Lanterna tool, visualize, interrogate and manage besu storage db offline
Apache License 2.0
3 stars 1 forks source link

Bonsai Storage Viewer - Load code by code hash, fallback to account hash #60

Closed siladu closed 2 months ago

siladu commented 2 months ago

Besu "detects" it using the DB...

public static boolean isCodeHashValue(final byte[] key, final byte[] value) {
    final Hash valueHash = Hash.hash(Bytes.wrap(value));
    return Bytes.wrap(key).equals(valueHash);
  }

Perhaps we could do the same here, but I expect most of our use cases of Bela will involve "by code hash" since it's the new default, so seems reasonable to default to it during traversal and fallback if necessary.