fix(examples): ExEx rollup reverts (#8151)

This commit is contained in:
Alexey Shekhirin
2024-05-08 14:42:14 +01:00
committed by GitHub
parent 72e5122e73
commit 18b7edb191

View File

@ -114,14 +114,14 @@ impl Database {
if reverts.accounts.len() > 1 {
eyre::bail!("too many blocks in account reverts");
}
for (address, account) in
reverts.accounts.first().ok_or(eyre::eyre!("no account reverts"))?
{
if let Some(account_reverts) = reverts.accounts.into_iter().next() {
for (address, account) in account_reverts {
tx.execute(
"INSERT INTO account_revert (block_number, address, data) VALUES (?, ?, ?) ON CONFLICT(block_number, address) DO UPDATE SET data = excluded.data",
(block.header.number.to_string(), address.to_string(), serde_json::to_string(account)?),
(block.header.number.to_string(), address.to_string(), serde_json::to_string(&account)?),
)?;
}
}
for PlainStorageChangeset { address, wipe_storage, storage } in changeset.storage {
if wipe_storage {
@ -139,9 +139,8 @@ impl Database {
if reverts.storage.len() > 1 {
eyre::bail!("too many blocks in storage reverts");
}
for PlainStorageRevert { address, wiped, storage_revert } in
reverts.storage.into_iter().next().ok_or(eyre::eyre!("no storage reverts"))?
{
if let Some(storage_reverts) = reverts.storage.into_iter().next() {
for PlainStorageRevert { address, wiped, storage_revert } in storage_reverts {
let storage = storage_revert
.into_iter()
.map(|(k, v)| (B256::new(k.to_be_bytes()), v))
@ -154,6 +153,7 @@ impl Database {
)?;
}
}
}
for (hash, bytecode) in changeset.contracts {
tx.execute(