mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
fix(examples): ExEx rollup reverts (#8151)
This commit is contained in:
@ -114,13 +114,13 @@ impl Database {
|
|||||||
if reverts.accounts.len() > 1 {
|
if reverts.accounts.len() > 1 {
|
||||||
eyre::bail!("too many blocks in account reverts");
|
eyre::bail!("too many blocks in account reverts");
|
||||||
}
|
}
|
||||||
for (address, account) in
|
if let Some(account_reverts) = reverts.accounts.into_iter().next() {
|
||||||
reverts.accounts.first().ok_or(eyre::eyre!("no account reverts"))?
|
for (address, account) in account_reverts {
|
||||||
{
|
tx.execute(
|
||||||
tx.execute(
|
"INSERT INTO account_revert (block_number, address, data) VALUES (?, ?, ?) ON CONFLICT(block_number, address) DO UPDATE SET data = excluded.data",
|
||||||
"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 {
|
for PlainStorageChangeset { address, wipe_storage, storage } in changeset.storage {
|
||||||
@ -139,19 +139,19 @@ impl Database {
|
|||||||
if reverts.storage.len() > 1 {
|
if reverts.storage.len() > 1 {
|
||||||
eyre::bail!("too many blocks in storage reverts");
|
eyre::bail!("too many blocks in storage reverts");
|
||||||
}
|
}
|
||||||
for PlainStorageRevert { address, wiped, storage_revert } in
|
if let Some(storage_reverts) = reverts.storage.into_iter().next() {
|
||||||
reverts.storage.into_iter().next().ok_or(eyre::eyre!("no storage reverts"))?
|
for PlainStorageRevert { address, wiped, storage_revert } in storage_reverts {
|
||||||
{
|
let storage = storage_revert
|
||||||
let storage = storage_revert
|
.into_iter()
|
||||||
.into_iter()
|
.map(|(k, v)| (B256::new(k.to_be_bytes()), v))
|
||||||
.map(|(k, v)| (B256::new(k.to_be_bytes()), v))
|
.collect::<Vec<_>>();
|
||||||
.collect::<Vec<_>>();
|
let wiped_storage = if wiped { get_storages(&tx, address)? } else { Vec::new() };
|
||||||
let wiped_storage = if wiped { get_storages(&tx, address)? } else { Vec::new() };
|
for (key, data) in StorageRevertsIter::new(storage, wiped_storage) {
|
||||||
for (key, data) in StorageRevertsIter::new(storage, wiped_storage) {
|
tx.execute(
|
||||||
tx.execute(
|
|
||||||
"INSERT INTO storage_revert (block_number, address, key, data) VALUES (?, ?, ?, ?) ON CONFLICT(block_number, address, key) DO UPDATE SET data = excluded.data",
|
"INSERT INTO storage_revert (block_number, address, key, data) VALUES (?, ?, ?, ?) ON CONFLICT(block_number, address, key) DO UPDATE SET data = excluded.data",
|
||||||
(block.header.number.to_string(), address.to_string(), key.to_string(), data.to_string()),
|
(block.header.number.to_string(), address.to_string(), key.to_string(), data.to_string()),
|
||||||
)?;
|
)?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user