-
Notifications
You must be signed in to change notification settings - Fork 172
Description
Version
List the versions of all cryo packages you are using.
559b654
Platform
The output of uname -a (UNIX), or version and 32 or 64-bit (Windows)
Linux *** 5.15.167.4-microsoft-standard-WSL2 #1 SMP Tue Nov 5 00:21:55 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Description
First, collect geth_state_diffs of Ethereum block 16983180. Actually, any block will do.
export ETH_RPC_URL=<Ethereum mainnet endpoint>
./target/release/cryo --subdirs datatype --blocks 16983180:16983181 --include-columns all -- geth_state_diffs
then get the last balance (at the end of block 16983180) of address 0x0000000000A39bb272e79075ade125fd351887Ac. Actually, any address whose balance is updated in the block, will do.
$ duckdb
D select block_number, transaction_index, from_value_string, to_value_string
from read_parquet('./geth_balance_diffs/ethereum__geth_balance_diffs__16983180_to_16983180.parquet')
where block_number = 16983180 and address = from_hex('0000000000A39bb272e79075ade125fd351887Ac')
order by block_number desc, transaction_index desc limit 1;
┌──────────────┬───────────────────┬─────────────────────────┬─────────────────┐
│ block_number │ transaction_index │ from_value_string │ to_value_string │
│ uint32 │ uint64 │ varchar │ varchar │
├──────────────┼───────────────────┼─────────────────────────┼─────────────────┤
│ 16983180 │ 129 │ 66355262376782755343795 │ 0 │
└──────────────┴───────────────────┴─────────────────────────┴─────────────────┘
to_value should be 66355262376782755343795 instead of 0.
In fact, eth_getAccount returns 0xe0d20404e6fba5d2db3.
$ curl --request POST \
--url https://eth.drpc.org/ \
--header 'Content-Type: application/json' \
--data '{
"method": "eth_getBalance",
"params": [
"0x0000000000A39bb272e79075ade125fd351887Ac",
"0x103248c"
],
"id": 1,
"jsonrpc": "2.0"
}'
{
"id": 1,
"jsonrpc": "2.0",
"result": "0xe0d20404e6fba5d2db3"
}
I think the issue is at this line https://github.com/paradigmxyz/cryo/blob/main/crates/freeze/src/multi_datasets/geth_state_diffs.rs#L159.
to_valueshould bepreifpost.is_none(), instead ofU256::zero().- Because
gethonly records post balance if it is updated https://github.com/ethereum/go-ethereum/blob/52ec2b5f47ca899a35df1bd9b03750dc2db6f2a9/eth/tracers/native/prestate.go#L255. - We should ignore the case where both
preandpostare none.
I believe nonce and code also suffers from the same issue, but storage is fine.