Fluffy State Bridge: State building fixes (#2589)

* Fix bug where code was not correctly being updated during contract creation.

* Delete value from update cache during db delete.
This commit is contained in:
web3-developer 2024-09-03 21:05:38 +08:00 committed by GitHub
parent 35cc78c86d
commit 139b35a80a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 7 deletions

View File

@ -122,6 +122,9 @@ proc del(
): bool {.gcsafe, raises: [].} =
if dbBackend.contains(key):
doAssert dbBackend.tx.delete(key, dbBackend.cfHandle).isOk()
if not dbBackend.updatedCache.isNil():
dbBackend.updatedCache.del(key)
true
else:
false

View File

@ -52,15 +52,9 @@ proc applyStateDiff*(worldState: WorldStateRef, txDiff: TransactionDiff) =
if nonceDiff.kind == create or nonceDiff.kind == update:
accState.setNonce(nonceDiff.after)
elif nonceDiff.kind == delete:
doAssert deleteAccount == true
if codeDiff.kind == create and codeDiff.after.len() > 0:
if codeDiff.kind == create or codeDiff.kind == update:
accState.setCode(codeDiff.after)
elif codeDiff.kind == update:
accState.setCode(codeDiff.after)
elif codeDiff.kind == delete:
doAssert deleteAccount == true
for (slotKey, slotValueDiff) in storageDiff:
if slotValueDiff.kind == create or slotValueDiff.kind == update: