Closed fridary closed 4 months ago
Maybe I'm missing something, but I don't understand why erigon and etherscan are showing the difference in balance to be 0.00000422664333.
It is a simple transfer tx. The builder receives the transaction fees, that's the only way it's balance should be modified. As per etherscan itself the transaction fee is 0.000146000760003 which is the same value geth returns. I confirmed by doing 21000 * 6952417143 since it's a legacy transaction.
Edit: Ok I think I know. We are not reducing the burnt fee.
I have been trying to reproduce this locally with no luck. I tried submitting a legacy transfer on a devnet and doing traceCall like in the example above. The balance is updated as it should be. Base fee of block number 2 is 766024067.
debug.traceCall({ from: eth.accounts[0], to: '0x1111111111111111111111111111111111111111', value: '0x5', gasPrice: '0x342770c1' }, '0x2', { tracer: 'prestateTracer', tracerConfig: { diffMode: true } })
{
post: {
0x0000000000000000000000000000000000000000: {
balance: "0x429a9d17de8"
},
0x01d5b4c6722015be2d0b5cc52a7b731dc6d5bc28: {
balance: "0xffffffffffffffffffffffffffffffffffffffffffffffffffffcddd35f3f7d0",
nonce: 3
},
0x1111111111111111111111111111111111111111: {
balance: "0xf"
}
},
pre: {
0x0000000000000000000000000000000000000000: {
balance: "0x214d4e8e7f8"
},
0x01d5b4c6722015be2d0b5cc52a7b731dc6d5bc28: {
balance: "0xffffffffffffffffffffffffffffffffffffffffffffffffffffde93794d4fdd",
nonce: 2
},
0x1111111111111111111111111111111111111111: {
balance: "0xa"
}
}
}
As we can see:
>>> 875000001 - 766024067
108975934 // effectiveGasPrice
>>> 108975934 * 2100
228849461400 // Total fee
>>> 0x429a9d17de8 - 0x214d4e8e7f8
2288494614000 // miner post - pre balance
@s1na thank you for try. Can you please make a call on transaction that is in etherscan like I did? So I can compare etherscan results, your results and mine results. Your transaction example is different than mine.
Can someone please check my transaction example above? Error is critical
The transaction you linked is a legacy type transaction (type 0). Can you confirm that those transactions return a wrong result? or have you also observed the same issue in type 2 transactions?
@s1na I can confirm those transactions return wrong results, I checked on many other transactions where is Uniswap buy/sell token executes. Type 2 transactions are just simple Transfer()?
I still haven't been able to reproduce this. I don't know how you're saying its wrong for all transactions... Take this tx: https://etherscan.io/tx/0x38fe0db5b641513a3f98f08b9d5ff5e6decf0574de92d1366dcb6d33409590c2#statechange
When I trace it:
> debug.traceCall({ from: '0x95222290DD7278Aa3Ddd389Cc1E1d165CC4BAfe5', to: tx.to, gas: web3.toHex(tx.gas), gasPrice: web3.toHex(tx.gasPrice), value: web3.toHex(tx.value) }, web3.toHex(tx.blockNumber), { tracer: 'prestateTracer', tracerConfig: { diffMode: true } })
{
post: {
0x1647a050294a5d5a1d42d34234a3bd5533b04e4a: {
balance: "0x21ecc9447b5e53"
},
0x4838b106fce9647bdf1e7877bf73ce8b0bad5f97: {
balance: "0xb26045a85e1dab63"
},
0x95222290dd7278aa3ddd389cc1e1d165cc4bafe5: {
balance: "0x744accd8983c3f9a",
nonce: 1143967
}
},
pre: {
0x1647a050294a5d5a1d42d34234a3bd5533b04e4a: {
balance: "0x13e87dcfd60853",
nonce: 5
},
0x4838b106fce9647bdf1e7877bf73ce8b0bad5f97: {
balance: "0xb25e5275cd127d73",
nonce: 447381
},
0x95222290dd7278aa3ddd389cc1e1d165cc4bafe5: {
balance: "0x745c215a7d23125a",
nonce: 1143966
}
}
}
Here the producer's (0x4838B106FCe9647Bdf1E7877BF73cE8B0BAD5f97) balance is increased by 548873484054000 same as etherscan reports.
Re transaction type you can check it on etherscan, it will tell you which type it is at bottom.
I compare state results on builders addresses. Here is 0.00000422664333 state diff for beaverbuild. But Geth prints 0.000146000760003
@fridary I think the result is because the burned_fee was not subtracted:
tx_fee = 21000*6.952417143GW = 0.000146000760003ETH
burned_fee = 0.000141774116673ETH
miner's balance = 0.000146000760003ETH - 0.000141774116673ETH = 0.00000422664333ETH
@jsvisa how can I calculate/find/query burned fee? I did not understand your example where you got it. Or burned fee is just a block's base fee? My example transaction has block 20185214 and it's baseFeePerGas
is 6751148413 (not 0.000141774116673ETH)
@jsvisa how can I calculate/find/query burned fee? I did not understand your example where you got it. Or burned fee is just a block's base fee? My example transaction has block 20185214 and it's
baseFeePerGas
is 6751148413 (not 0.000141774116673ETH)
6751148413wei*21000
Could you reproduce the result?
@jsvisa 6751148413wei*21000=141774116673000=0,000141774116673ETH now it works, thanks.
System information
Version: 1.14.3-stable Git Commit: ab48ba42f4f34873d65fd1737fabac5c680baff6 Architecture: amd64 Go Version: go1.22.3 Geth command:
/usr/bin/geth --datadir=/disk_sda/geth --syncmode snap --cache 4096 --ws --ws.origins "http://127.0.0.1" --http --port 40311 --authrpc.port 9551 --http.port 9545 --ws.port 9546 --http.api eth,debug,net,txpool,web3 --authrpc.jwtsecret=/disk_sda/geth/jwt.hex
CL client & version: Lighthouse v5.1.3-3058b96 OS & Version: Ubuntu 20.04.6 LTS, CPU E5-2695 v4, 36 cores, 192 Gb RAM Disk: NVMe HPE MT006400KWHAE 6.4 Tb Python: 3.11
behaviour
I am comparing state changes results with etherscan and Erigon, and Geth prints wrong results on all tranactions. Let's take https://etherscan.io/tx/0x760b9dec655dfee2bc06b443091ef257e753736f92a8caf0a14ae7799b5f9dc5#statechange I compare state results on builders addresses. Here is 0.00000422664333 state diff for beaverbuild. But Geth prints 0.000146000760003
Steps to reproduce the behaviour
Code results that compares results on Erigon and Geth nodes, both on same machine (but Erigon runs Caplin client). Erigon shows correct value 0.00000422664333 (comparing etherscan), but Geth shows wrong 0.000146000760003. You can easy test code on other transactions.
Code: