Giulio rebuffo
bae56ff119
Backfilling is now smooth and does not get stuck ( #6374 )
2022-12-19 22:40:34 +01:00
Mike Neuder
3e7c1502b7
Implement ProcessBlockHeader ( #6365 )
...
This is described in
https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#block-header
Part of https://github.com/ledgerwatch/erigon/issues/5965
2022-12-19 14:24:39 +01:00
Alex Sharov
dfa6505f93
e3: kv/temporal prototype ( #6367 )
2022-12-19 15:38:54 +07:00
ledgerwatch
97c9a9108d
Native tracers - step 4 ( #6363 )
...
Remove `callType` argument from `CaptureStart`, and change `callType
vm.CallType` to `typ vm.OpCode` in `CaptureEnter` and move to the first
position (as it is in geth)
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
2022-12-19 03:12:08 +00:00
Giulio rebuffo
ed2c79d2ca
fixed backfilling algo ( #6364 )
2022-12-18 23:28:30 +01:00
Giulio rebuffo
e640cea7d0
no CPU implosion when using sentinel ( #6361 )
2022-12-18 18:57:30 +01:00
ledgerwatch
0761671607
Native tracers step 3 ( #6362 )
...
Remove `env` argument from all Capture functions except for
`CaptureStart`
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
2022-12-18 17:06:40 +00:00
Mike Neuder
66654dc4b1
Implement GetBeaconProposerIndex ( #6352 )
...
This is described in
https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#get_beacon_proposer_index .
Part of https://github.com/ledgerwatch/erigon/issues/5965
I compared with the Prysm tests to confirm the implementation is
correct:
2e49fdb3d2/beacon-chain/core/helpers/validators_test.go (L151-L204)
.
2022-12-18 17:39:43 +01:00
ledgerwatch
b8c6a4d263
Native tracers - step 2 ( #6360 )
...
Splitting function `CaptureStart` into `CaptureStart` (when depth == 0)
and `CaptureEnter` (when depth > 0), while removing argument `depth`.
Same with splitting `CaptureEnd` into `CaptureEnd` and `CaptureExit`
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
2022-12-18 16:11:31 +00:00
Alex Sharov
7c42ecf66e
e3: better print_stages ( #6357 )
2022-12-18 12:12:11 +07:00
ledgerwatch
3999c46046
Native tracers - step 1 ( #6356 )
...
In this first step, the new functions `CaptureTxStart` and
`CaptureTxEnd` are introduced to all tracers
Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
2022-12-18 04:36:57 +00:00
Alex Sharov
d45bddc5ad
StagedSync: break dependency to CurrentHeader. Always run non-initial cycle in 1 RwTx ( #6348 )
...
cc: @AlexeyAkhunov
2022-12-18 07:59:31 +07:00
Giulio rebuffo
0a3bfef484
Added prototype for Beacon history reconstruction stage ( #6351 )
2022-12-17 16:05:56 +01:00
Giulio rebuffo
14cf0771a4
slight modification to computation of indexes ( #6345 )
2022-12-17 01:01:24 +01:00
Giulio rebuffo
de8bae6fe0
optimized beacon state computation ( #6341 )
2022-12-16 13:38:54 +01:00
Andrew Ashikhmin
0fc2022a0e
Extend fork ID to timestamp-based forks ( #6324 )
...
Starting from
[Shanghai](https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/shanghai.md ),
forks are based on timestamps rather than block heights (see PR #6238 ).
This PR extends [EIP-2124](https://eips.ethereum.org/EIPS/eip-2124 ) Fork
ID to include timestamp-based blocks. See also
https://github.com/ethereum/go-ethereum/pull/25878 .
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
2022-12-16 12:08:54 +01:00
Alex Sharov
2f143523d5
e3: to fix integration test ( #6337 )
2022-12-16 14:21:38 +07:00
Alex Sharov
d95f0ca51e
e3: apply inline-retry ( #6336 )
2022-12-16 14:14:00 +07:00
Alex Sharov
a8c5318c56
e3: exec tx right after conflict (but only 1 such exec per applyLoopStep) ( #6332 )
2022-12-16 11:10:12 +07:00
Mike Neuder
d1f6ed29ff
Add ComputeProposerIndex ( #6297 )
...
This is described in
https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#compute_proposer_index .
Part of https://github.com/ledgerwatch/erigon/issues/5965
I compared with the Prysm tests to confirm the implementation is
correct:
2e49fdb3d2/beacon-chain/core/helpers/validators_test.go (L506-L614)
2022-12-16 00:06:49 +01:00
ledgerwatch
cb04e1166c
Fix precompile filtering in trace_ methods ( #6328 )
2022-12-15 18:54:05 +00:00
ledgerwatch
0104698033
Not kick static and trusted peers due to empty responses ( #6325 )
...
Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
2022-12-15 12:25:35 +00:00
formatting
7fee016cf4
Fix eth_getBlockByNumber and eth_getTransactionReceipt some bugs for polygon ( #6319 )
...
Get bor state sync tx and receipt has some error:
```
Reqeust:
curl -X "POST" "{{polygon_rpc_endpoint}}" -H 'Content-Type: application/json; charset=utf-8' -d $'{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_getTransactionByHash",
"params": [
"0x9916e99b24daba1fb01e093105bc6988b49125ea15fd4b3c4cfa18719e1631ad"
]
}'
Response:
{"jsonrpc":"2.0","id":1,"result":null}
```
```
Reqeust:
curl -X "POST" "{{polygon_rpc_endpoint}}" -H 'Content-Type: application/json; charset=utf-8' -d $'{
"id": 1,
"method": "eth_getTransactionReceipt",
"jsonrpc": "2.0",
"params": [
"0x9916e99b24daba1fb01e093105bc6988b49125ea15fd4b3c4cfa18719e1631ad"
]
}'
Response
{"jsonrpc":"2.0","id":1,"error":{"code":-32000,"message":"EOF"}}
```
fixed:
```
Request:
curl -X "POST" "{{polygon_rpc_endpoint}}" -H 'Content-Type: application/json; charset=utf-8' -d $'{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_getTransactionByHash",
"params": [
"0x9916e99b24daba1fb01e093105bc6988b49125ea15fd4b3c4cfa18719e1631ad"
]
}'
Response:
{"jsonrpc":"2.0","id":1,"result":{"blockHash":"0xb308eeda80e2a20e1f934d5d37e5f82a078b828128a60283978286ddf0a25264","blockNumber":"0x1c317c0","from":"0x0000000000000000000000000000000000000000","gas":"0x0","gasPrice":"0x0","hash":"0x9916e99b24daba1fb01e093105bc6988b49125ea15fd4b3c4cfa18719e1631ad","input":"0x","nonce":"0x0","to":"0x0000000000000000000000000000000000000000","transactionIndex":"0x89","value":"0x0","type":"0x0","chainId":"0x89","v":"0x0","r":"0x0","s":"0x0"}}
```
```
curl -X "POST" "{{polygon_rpc_endpoint}}" -H 'Content-Type: application/json; charset=utf-8' -d $'{
"id": 1,
"method": "eth_getTransactionReceipt",
"jsonrpc": "2.0",
"params": [
"0x9916e99b24daba1fb01e093105bc6988b49125ea15fd4b3c4cfa18719e1631ad"
]
}'
{"jsonrpc":"2.0","id":1,"result":{"blockHash":"0xb308eeda80e2a20e1f934d5d37e5f82a078b828128a60283978286ddf0a25264","blockNumber":"0x1c317c0","contractAddress":null,"cumulativeGasUsed":"0x0","effectiveGasPrice":"0xd532a03e6","from":"0x0000000000000000000000000000000000000000","gasUsed":"0x0","logs":[{"address":"0x7ceb23fd6bc0add59e62ac25578270cff1b9f619","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x00000000000000000000000038830f36f752ed29039f441cfb543639a6e07b41"],"data":"0x000000000000000000000000000000000000000000000000009c51c4521e0000","blockNumber":"0x1c317c0","transactionHash":"0x9916e99b24daba1fb01e093105bc6988b49125ea15fd4b3c4cfa18719e1631ad","transactionIndex":"0x89","blockHash":"0xb308eeda80e2a20e1f934d5d37e5f82a078b828128a60283978286ddf0a25264","logIndex":"0x2ee","removed":false},{"address":"0x7ceb23fd6bc0add59e62ac25578270cff1b9f619","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x000000000000000000000000f93bcb6f00c1a90050a60a9f737b4cb87126b8f8"],"data":"0x000000000000000000000000000000000000000000000000006a6674f260d000","blockNumber":"0x1c317c0","transactionHash":"0x9916e99b24daba1fb01e093105bc6988b49125ea15fd4b3c4cfa18719e1631ad","transactionIndex":"0x89","blockHash":"0xb308eeda80e2a20e1f934d5d37e5f82a078b828128a60283978286ddf0a25264","logIndex":"0x2ef","removed":false},{"address":"0x7ceb23fd6bc0add59e62ac25578270cff1b9f619","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x000000000000000000000000fd1091c0e49bf1d44b4786747e034d65ab46f36e"],"data":"0x000000000000000000000000000000000000000000000000002386f26fc10000","blockNumber":"0x1c317c0","transactionHash":"0x9916e99b24daba1fb01e093105bc6988b49125ea15fd4b3c4cfa18719e1631ad","transactionIndex":"0x89","blockHash":"0xb308eeda80e2a20e1f934d5d37e5f82a078b828128a60283978286ddf0a25264","logIndex":"0x2f0","removed":false},{"address":"0x7f280dac515121dcda3eac69eb4c13a52392cace","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x000000000000000000000000882d04c3d8410ddf2061b3cba2c3522854316feb"],"data":"0x000000000000000000000000000000000000000000001850e2f557310490f925","blockNumber":"0x1c317c0","transactionHash":"0x9916e99b24daba1fb01e093105bc6988b49125ea15fd4b3c4cfa18719e1631ad","transactionIndex":"0x89","blockHash":"0xb308eeda80e2a20e1f934d5d37e5f82a078b828128a60283978286ddf0a25264","logIndex":"0x2f1","removed":false},{"address":"0x7ceb23fd6bc0add59e62ac25578270cff1b9f619","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x00000000000000000000000028515b56512cb168ad6e6a2428bb39cb696d8bee"],"data":"0x0000000000000000000000000000000000000000000000000058d15e17628000","blockNumber":"0x1c317c0","transactionHash":"0x9916e99b24daba1fb01e093105bc6988b49125ea15fd4b3c4cfa18719e1631ad","transactionIndex":"0x89","blockHash":"0xb308eeda80e2a20e1f934d5d37e5f82a078b828128a60283978286ddf0a25264","logIndex":"0x2f2","removed":false}],"logsBloom":"0x000000000100a0000000000000000000000000000040000000000000000000000000000000000020000000000000000000000000000080000000000000000800000000000000000000000008000000000800000000000000040000000000000000000000020000000000000000000800000000000000000000000010000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000020000002000000000008000000001000000000000002000000000000000020001000040000008000000000000000000080000000000000000000000000000000","status":"0x1","to":"0x0000000000000000000000000000000000000000","transactionHash":"0x9916e99b24daba1fb01e093105bc6988b49125ea15fd4b3c4cfa18719e1631ad","transactionIndex":"0x89","type":"0x0"}}
```
2022-12-15 11:13:52 +00:00
ledgerwatch
71fb4ccc8e
Workaround for gnosis chain POS downloader ( #6315 )
...
Workaround for https://github.com/ledgerwatch/erigon/issues/6308
Very inefficient, because it get 1 single header from the request of 192
headers, so moves quite slowly
Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
2022-12-15 11:13:28 +00:00
Enrique Jose Avila Asapche
e5ddccf212
Disable ipv6 flag ( #6295 )
...
This was a great idea #6261
Added two new flags to turn off downloader ipv6 and/or ipv4 usage
2022-12-15 16:40:59 +07:00
Alex Sharov
863e1ed07b
e3: handle "kill -9" during merge, auto-hide history .ef file if not corresponding .v file ( #6304 )
2022-12-15 13:49:06 +07:00
Enrique Jose Avila Asapche
941a228ec9
fixed tx index being empty ( #6316 )
...
#6309
2022-12-15 09:53:14 +07:00
Igor Mandrigin
94d12a5d3c
fix debug_traceBlock* methods for Gnosis Chain ( #6312 )
2022-12-14 16:06:24 +01:00
ledgerwatch
47692bb334
Prevent empty responses to skeleton requests ( #6305 )
...
Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
2022-12-14 12:02:23 +00:00
Alex Sharov
5f77c8a025
Snap flags docs ( #6302 )
2022-12-14 11:09:13 +07:00
Alex Sharov
ce9203d80d
e3: more aggressive prune #780 ( #6299 )
2022-12-14 09:50:48 +07:00
ledgerwatch
f03d29293c
Kick useless peers instead of putting them on stand-by ( #6296 )
...
Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
2022-12-13 22:21:10 +00:00
Enrique Jose Avila Asapche
287a3d1d6c
added erigon_GetBlockReceiptsByBlockHash ( #6292 )
...
I added a way to get canonical receipts through block hash under the
erigon name space
#6229
Tested:
BlockHash:
0xb5d50393734894e02a94a500a5a5aade9c66f388438aeed8d7775b3b344745f1
<img width="1727" alt="Screenshot 2022-12-12 at 22 16 18"
src="https://user-images.githubusercontent.com/19207637/207166860-436ecf26-a777-4b2f-8377-22acec732486.png ">
2022-12-13 20:41:51 +00:00
Andrew Ashikhmin
1e206e375b
Set default for externalcl based on whether embedded CL is supported ( #6294 )
...
Embedded CL is not supported for Gnosis Chain, so it makes sense to set
`externalcl` to true by default for it.
Also, this PR sets `terminalTotalDifficultyPassed` for Gnosis Chain &
Chiado (see https://docs.gnosischain.com/updates/20221210-merge ).
2022-12-13 14:51:13 +01:00
ledgerwatch
5616ec2529
Disable validator set check in historical due to BEP-131, restore Ske… ( #6290 )
...
…letons
Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
2022-12-12 20:46:20 +00:00
Changyoung Koh
27ec4f02d7
Fix Trace RPCs for Bor Transactions ( #6288 )
...
FIrst of all, thanks in advance for your advice.
I've found that `trace_replayTransaction` is having trouble tracing some
Polygon State Sync transactions such as
[`0xd5f4f8c3cd85cf65e8df23a2c1ae02aefda1e6293db0c3a9ddcc08cee8ca1131`](https://polygonscan.com/tx/0xd5f4f8c3cd85cf65e8df23a2c1ae02aefda1e6293db0c3a9ddcc08cee8ca1131 ),
just like [the case of the previous PR][p].
[p]: https://github.com/ledgerwatch/erigon/pull/6286
```shell
$ curl -XPOST 'http://localhost:8545 ' \
-H 'Content-Type: application/json' \
--data '{"method":"trace_replayTransaction","params":["0xd5f4f8c3cd85cf65e8df23a2c1ae02aefda1e6293db0c3a9ddcc08cee8ca1131",["trace","stateDiff"]],"id":1,"jsonrpc":"2.0"}'
{"jsonrpc":"2.0","id":1,"result":null}
```
This is because RPCDaemon doesn't query for blocks by Bor Hash, even
though `api.txnLookup` has failed. Same as #6286 .
2022-12-12 16:39:17 +00:00
Changyoung Koh
72de9410d7
Fix eth_getTransactionReceipt for Bor Transactions ( #6289 )
...
Same as #6286 and #6288
This patch closes #6276
```shell
$ curl -XPOST 'http://localhost:8545 ' \
-H 'Content-Type: application/json' \
--data '{"method":"eth_getTransactionReceipt","params":["0x31ce15ce9a1ff347f4204a1ed3625861165c53ae08743c1f36a32865c62744c6"],"id":1,"jsonrpc":"2.0"}'
{"jsonrpc":"2.0","id":1,"error":{"code":-32000,"message":"block has less receipts than expected: 0 \u003c= 0, block: 36635776"}}
```
cc. @0xKrishna
2022-12-12 15:21:30 +00:00
Changyoung Koh
4c02fef323
Fix eth_getTransactionByHash for Bor Transactions ( #6286 )
...
FIrst of all, thanks in advance for your advice.
I've found that `eth_getTransactionByHash` is having trouble retrieving
some Polygon State Sync transactions such as
[`0xd5f4f8c3cd85cf65e8df23a2c1ae02aefda1e6293db0c3a9ddcc08cee8ca1131`](https://polygonscan.com/tx/0xd5f4f8c3cd85cf65e8df23a2c1ae02aefda1e6293db0c3a9ddcc08cee8ca1131 ),
while `eth_getBlockByNumber` can retrieve them without problem.
```shell
$ curl -XPOST 'http://localhost:8545 ' \
-H 'Content-Type: application/json' \
--data '{"method":"eth_getTransactionByHash","params":["0xd5f4f8c3cd85cf65e8df23a2c1ae02aefda1e6293db0c3a9ddcc08cee8ca1131"],"id":1,"jsonrpc":"2.0"}'
{"jsonrpc":"2.0","id":1,"result":null}
```
This is because RPCDaemon doesn't query for blocks by Bor Hash, even
though `api.txnLookup` has failed.
2022-12-12 13:26:00 +00:00
awskii
a124bcf6ac
added --p2p.allowed-port flag ( #6263 )
...
Regarding https://github.com/ledgerwatch/erigon/issues/6260
added flag `--p2p.allowed-ports=<porta>,<portb>` to restrict which ports
to use for sentries for different protocol versions.
Default for this flag is `30303, 30304` (first port is inherited from
`--port` flag defaults.
If `--port` is changed and it's new value is not presented in allowed
port list, provided port will be allowed as well as list provided via
`--p2p.allowed-ports`
Port picking is straightforward, we create sentry gRPC server for
protocol over first allowed port that is not already taken.
If there are no allowed ports left, erigon exits with hint.
2022-12-12 13:25:47 +00:00
ledgerwatch
1c3c486d00
Avoid using peers returning empty responses, not sending skeleton requests ( #6281 )
...
Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
2022-12-11 23:03:10 +00:00
ledgerwatch
4ab76849d8
Use old method of peer selection for non-POS networks ( #6279 )
...
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
2022-12-11 15:14:49 +00:00
Giulio rebuffo
0f0d0de783
Use of proper beacon state interface ( #6277 )
2022-12-11 15:12:38 +01:00
Alex Sharov
7a055a51d4
e3: graceful shutdown ( #6272 )
2022-12-11 13:15:55 +07:00
Andrew Ashikhmin
ecefc53dd0
Remove Ropsten & Fermion ( #6262 )
...
See https://blog.ethereum.org/2022/11/30/ropsten-shutdown-announcement
2022-12-10 22:55:31 +00:00
ledgerwatch
df21079ae0
vmTrace - prevent panic at stack underflow ( #6275 )
...
Fixes https://github.com/ledgerwatch/erigon/issues/4778
Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
2022-12-10 22:41:14 +00:00
ledgerwatch
0a31f5ac2a
Workaround for the code history of BSC system contracts ( #6274 )
...
Works around a flaw in the upgrade logic of the system contracts. Since
they are updated directly, without first being self-destructed and then
re-created, the usual incarnation logic does not get activated, and all
historical records of the code of these contracts are retrieved as the
most recent version. This problem will not exist in erigon3, but until
then, a workaround will be used to access code of such contracts through
a special structure, `SystemContractCodeLookup`
Fixes https://github.com/ledgerwatch/erigon/issues/5865
Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
2022-12-10 22:41:04 +00:00
ledgerwatch
983f41790d
Fetch header correctly (including snapshots) for debug_traceCall, fix… ( #6273 )
...
… formatting when error
Fixes https://github.com/ledgerwatch/erigon/issues/5365
Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
2022-12-10 15:22:07 +00:00
Mike Neuder
f512c887dc
Add ComputeShuffledIndex algorithm. ( #6267 )
...
This is described in:
https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#compute_shuffled_index .
I ran the prysm implementation locally to generate the expected outputs:
babfc66c5b/beacon-chain/core/helpers/shuffle.go (L73)
Part of https://github.com/ledgerwatch/erigon/issues/5965
2022-12-10 13:59:29 +01:00
ledgerwatch
b5a7faa8db
[e3] Incremental reconstitution ( #6270 )
...
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
2022-12-10 09:34:17 +00:00
Giulio rebuffo
5ba6859c92
Added Fully-Working State Trie Computation to Beacon State ( #6268 )
2022-12-10 01:08:49 +01:00