Commit Graph

1654 Commits

Author SHA1 Message Date
Giulio rebuffo
2294c8c66c
EthereumExecutionService in MockSentry (#8373)
Now we use the ethereum execution service directly:

* Changed sig of InsertChain
* Use of the service in case of PoS
2023-10-05 18:30:19 +02:00
Somnath
417e316ed5
Small log fix (#8382) 2023-10-05 12:32:43 +00:00
Anshal Shukla
c6f532d68e
Rewind fixes (#8380) 2023-10-05 10:12:47 +01:00
Alex Sharov
8850f3a76d
memstat: to use helper func (#8377) 2023-10-05 13:42:30 +07:00
Alex Sharov
c293883ec0
evm: no interface (#8376)
after removal of tevm experiment - we left interfaces everywhere 
removing it for performance and for geth compatibility
2023-10-05 12:23:08 +07:00
canepat
47690db676
Block execution using embedded Silkworm (#8353)
This introduces _experimental_ block execution run by embedded Silkworm
API library:

- new command-line option `silkworm.path` to enable the feature by
specifying the path to the Silkworm library
- the Silkworm API shared library is dynamically loaded on-demand
- currently requires to build Silkworm library on the target machine
- available only on Linux at the moment: macOS has issue with [stack
size](https://github.com/golang/go/issues/28024) and Windows would
require [TDM-GCC-64](https://jmeubank.github.io/tdm-gcc/), both need
dedicated effort for an assessment
2023-10-05 09:27:37 +07:00
Giulio rebuffo
cb9495cc01
Fixed excessive garbage in temporary directory (#8366)
Somebody forgot to close temp dbs
2023-10-04 16:37:44 +02:00
Srdjan
385e69cebc
Add support for additional block number values in eth_getLogs (#8281)
Closes #8199
2023-10-04 15:19:56 +07:00
Alex Sharov
0165d00ee6
downloader: don't drop torrents after download (performance problem there solved) (#8358) 2023-10-04 12:34:45 +07:00
Alex Sharov
fa3b8c23b2
Downloader: step towards more complex datadir (#8286)
migration included - no manual actions required
2023-10-04 11:01:02 +07:00
ledgerwatch
2521f1a696
Fix another case of header download hanging (non-POS) (#8356) 2023-10-03 17:34:03 +01:00
Dmytro
ae88a69511
diagnostics - added query for bootnodes (#8344) 2023-10-03 10:28:21 +07:00
Mark Holt
3d6d2a7c25
Added fix to allow getroothash to work with no api running (#8342)
Whitelisting calculation of the roothash should not be dependent on the
bor api running. This will not always be the case, for example when
erigon is configured with a separate rpc deamon.

To fix this the calculation has been moved to Bor.

Additionally the redundant Bor API code has been removed as this is not
called by any code and the functionality looks to have migrated to the
turbo/jsonrpc package.
2023-10-02 18:55:31 +01:00
Andrew Ashikhmin
0427b162c4
Optimize gas by default in eth_createAccessList (#8337)
Enable gas optimizations of PRs #3453 & #8261 unless the `optimizeGas`
argument is explicitly set to `false`.
2023-10-01 14:22:18 +02:00
Quentin Kniep
3775f4a5d4
Extend gas optimization for eth_createAccessList (#8261)
This builds upon #3453 and #3524, which previously implemented gas
optimizations for the access lists generated by Erigon's implementation
of the `eth_createAccessList` RPC call.

Erigon currently optimizes inclusion of the recipient address based on
how many storage keys are accessed, but does not perform the same
optimization for sender address and precompiled contract addresses.
These changes make the same optimization available for all of these
cases.

Additionally, this handles the cases of block producer address and
created smart contract addresses. If these cases were omitted on purpose
since they heavily rely on state, it may still make sense to offer them
to users but disable them by default.
2023-10-01 13:24:15 +02:00
Somnath
6dd7d8fe6a
Fix some hive tests (#8331)
Changes:
Reorder some Engine API invalid checks to be closer to specs/hive tests
Move the Engine API direct method names to `interfaces`
2023-10-01 12:42:27 +02:00
Jason Yellick
5654ba07c9
Upgrade libp2p (enables go 1.21 support) (#8288)
Closes #8078 

This change is primarily intended to support go 1.21, but as a
side-effect requires updating libp2p, which in turn triggers an update
of golang.org/x/exp which creates quite a bit of (simple) churn in the
slice sorting.

This change introduces a new `cmp.Compare` function which can be used to
return an integer satisfying the compare interface for slice sorting.

In order to continue to support mplex for libp2p, the change references
github.com/libp2p/go-libp2p-mplex instead. Please see the PR at
https://github.com/libp2p/go-libp2p/pull/2498 for the official usptream
comment that indicates official support for mplex being moved to this
location.

Co-authored-by: Jason Yellick <jason@enya.ai>
2023-09-29 22:11:13 +02:00
Alex Sharov
d0366ae34e
snapshots: remove concept of separated hist .toml file (#8326) 2023-09-29 11:30:02 +07:00
Alex Sharov
e993ee984b
stage loop: allow nil in hook (#8318) 2023-09-29 09:03:19 +07:00
Alex Sharov
664a58a1db
log skipped files (#8297) 2023-09-28 08:56:37 +07:00
Mark Holt
f26c7b389e
Bor break loop onrewind (#8302)
Add code to the headers state to break processing if a bor milestone
rewind is detected.

The rewind processing happens in the bor/heimdall stage - this change
just avoids unnecessary header loading
if a milestone fork is likely to be detected

---------

Co-authored-by: Anshal Shukla <shukla.anshal85@gmail.com>
2023-09-27 13:17:54 +01:00
Mark Holt
f794438335
Diag session routing (#8232)
Code to support react based UI for diagnostics:

* pprof, prometheus and diagnistics rationalized to use a single router
(i.e. they can all run in the same port)
* support_cmd updated to support node routing (was only first node)
* Multi content support in router tunnel (application/octet-stream &
appliaction/json)
* Routing requests changed from using http forms to rest + query params
* REST query requests can now be made against erigon base port and
diagnostics with the same url format/params

---------

Co-authored-by: dvovk <vovk.dimon@gmail.com>
Co-authored-by: Mark Holt <mark@disributed.vision>
2023-09-25 16:24:17 +01:00
ledgerwatch
ef1729214d
Fixes for bor snapshots (#8270) 2023-09-22 17:08:22 +07:00
lupin012
92446bfa66
Rpcdaemon: fixed few bugs in erigon_getLatestLogs (#8153)
doing some testing some bugs in the API implementation were found and
fixed

---------

Co-authored-by: alex.sharov <AskAlexSharov@gmail.com>
2023-09-22 17:07:16 +07:00
Alex Sharov
75b0ba0c69
touch data when do warmup (#8268) 2023-09-22 14:36:54 +07:00
Andrew Ashikhmin
9da6b52dba
Add engine_forkchoiceUpdatedV3 to engine_exchangeCapabilities (#8259)
See
https://discord.com/channels/595666850260713488/892088344438255616/1154413019170869379
2023-09-21 16:23:48 +02:00
Anshal Shukla
3c8cbda809
fix finalized api for polygon chain (#8247)
Co-authored-by: Ubuntu <ubuntu@ip-10-0-0-234.eu-west-1.compute.internal>
2023-09-20 13:32:22 +01:00
Somnath Banerjee
f51d9b61a0
Txpool 4844 upgrades Part 2 (#8213)
Some peer-review changes from the last related PR. 
Addition of a flag for BlobSlots - for max allowed blobs per account in
txpool.
Use BlobFee from the block to validate txs in the pool.

See also https://github.com/ledgerwatch/erigon-lib/pull/1125
2023-09-20 17:29:30 +05:30
lmittmann
6985036070
turbo/adapter/ethapi: Add CallArgs.Input attribute (#8242)
This PR adds the ability to pass `input` instead of `data` in
`eth_call`.

Go-ethereum has support for the `input`-attribute (instead of the
`data`) in `eth_call` for some time. The recent go-ethereum release
v1.13.0 changed the ethclient to do a `eth_call` with the `input`
attribute rather than "data". This makes the latest go-ethereum
ethclient incompatible with erigon.

Co-authored-by: lmittmann <lmittmann@users.noreply.github.com>
2023-09-20 09:31:00 +07:00
Mark Holt
3b45f53f3d
Milestone stage processing (#8187)
This is the second part of the bor milestone release it contains the
following changes:

* Initialize services
* This is a change from the initial pull request I have moved all of the
initialization to the bor engine. To facilitate this I have just passed
in the heimdall client interface, rather than the whole engine
* Stage processing 
* This is also a change from the original PR - the code is contained in
the bor heimdall stage rather than in headers - the effect should be the
same, but this needs testing

---------

Co-authored-by: Mark Holt <mark@disributed.vision>
Co-authored-by: Anshal Shukla <shukla.anshal85@gmail.com>
2023-09-18 18:05:33 +01:00
Giulio rebuffo
2aa060f454
Fixed forkchoice nil exception (#8223) 2023-09-17 17:06:44 +02:00
Andrew Ashikhmin
17d6f86218
Don't mark blocks as bad on transient errors (#8197)
For example, erigon on devnet8 marked a block as bad due to
"mdbx_cursor_open: cannot allocate memory":
```
[INFO] [09-12|04:57:36.041] [NewPayload] Handling new payload        height=171035 hash=0x321dea00c4853ee354bebaf8aef3e63fbe06c4508271c0db4c92b0f087aedc3b
171034
[WARN] [09-12|04:57:36.069] Could not validate block                 err="[3/7 BlockHashes] table: Header, mdbx_cursor_open: cannot allocate memory, stack: [kv_mdbx.go:1057 kv_mdbx.
go:1069 kv_mdbx.go:1077 memory_mutation.go:473 memory_mutation.go:502 etl.go:123 etl.go:96 block_writer.go:40 stage_blockhashes.go:49 default_stages.go:457 sync.go:425 sync.go:258 s
tageloop.go:414 backend.go:476 fork_validator.go:250 fork_validator.go:156 ethereum_execution.go:151 execution_client.go:51 chain_reader.go:252 engine_server.go:741 engine_server.go
:235 engine_server.go:600 value.go:586 value.go:370 service.go:224 handler.go:494 handler.go:444 handler.go:392 handler.go:223 handler.go:316 asm_amd64.s:1598]"
[WARN] [09-12|04:57:36.069] ethereumExecutionModule.ValidateChain: chain is invalid hash=0x321dea00c4853ee354bebaf8aef3e63fbe06c4508271c0db4c92b0f087aedc3b
```
With this PR blocks are marked as bad only on genuine protocol errors.
2023-09-17 11:14:36 +02:00
Alex Sharov
eb747c042a
Downloader: add tests to protect from re-downloading (#8191) 2023-09-15 13:46:59 +07:00
Giulio rebuffo
2f8687fe08
Smart SQL transactions (#8185) 2023-09-14 02:56:29 +02:00
Alex Sharov
3813a5ea10
downloader: better logging (#8183) 2023-09-13 13:42:24 +07:00
Alex Sharov
2158b4916d
Downloader: correct logging when create .torrent files (#8182) 2023-09-13 11:49:45 +07:00
Alex Sharov
3cea1b9b9e
torrent: add --webseeds cli arg (#8176) 2023-09-12 12:18:47 +07:00
Somnath Banerjee
a699f64761
Txpool upgrades for EIP-4844 Blob Transactions (#8004)
See https://github.com/ledgerwatch/erigon-lib/pull/1075
2023-09-11 09:38:58 +07:00
Giulio rebuffo
346b278a3b
Caplin: Improved logging (#8169) 2023-09-10 22:10:21 +02:00
alex.sharov
6c1cf0a9b0 save 2023-09-10 15:49:13 +07:00
Alex Sharov
2318138c6c
Downloader: don't fail when see unusual file, skip it (backward/forward compatibility) (#8170) 2023-09-10 15:46:30 +07:00
alex.sharov
66c94d9760 retire snapshots - nil ptr fix 2023-09-09 08:33:42 +07:00
Somnath Banerjee
a9c3c90347
Fix pre cancun conditions (#8152) 2023-09-07 22:15:26 +05:30
Alex Sharov
d60940d7db
Avoid leaking more popped items (#8145) 2023-09-06 15:47:06 +07:00
Park Changwan
ef84972e7c
Add addPeer RPC (#7804)
This PR mirrors https://github.com/testinprod-io/op-erigon/pull/54.

Actual implementation for `admin_addPeer` method.
RPC Spec: Refer to
https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-admin.

> The addPeer administrative method requests adding a new remote node to
the list of tracked static nodes. The node will try to maintain
connectivity to these nodes at all times, reconnecting every once in a
while if the remote connection goes down.

Requires https://github.com/ledgerwatch/erigon-lib/pull/1033/

After https://github.com/ledgerwatch/erigon-lib/pull/1033 is merged,
will update erigon-lib version, removing replace at go.mod.

Note that even if RPC response returns `true`, it does not guarantee
that RLPx protocol is established between peers. It just adds node
entrypoint to its static peer list, and periodically tries and tests
connections.

## Testing

This RPC needs integration testing, so I made some scenario.

Use below command for testing:

Spin up two dev nodes which p2p enabled:

Start Node 1: RPC running at port 8545:
```sh
./build/bin/erigon --datadir=dev --chain=dev --port=30303 --http.port=8545 --authrpc.port=8551 --torrent.port=42069  --no-downloader --nodiscover --private.api.addr=127.0.0.1:9090 --http --ws --http.api=admin --p2p.allowed-ports=30306,30307,30308  --authrpc.jwtsecret=/tmp/jwt1 --p2p.protocol=67,68  --log.console.verbosity=5
```

Start Node 2: RPC running at port 8546:
```sh
./build/bin/erigon --datadir=dev2 --chain=dev --port=30304 --http.port=8546 --authrpc.port=8552 --torrent.port=42068 --no-downloader --nodiscover --private.api.addr=127.0.0.1:9091 --http --ws --http.api=admin --p2p.allowed-ports=30309,30310,30311  --authrpc.jwtsecret=/tmp/jwt2  --p2p.protocol=67,68  --log.console.verbosity=5
```

Get nodeInfo of node 1 using `admin_nodeInfo` RPC:
```sh
curl --location 'localhost:8545/' \
--header 'Content-Type: application/json' \
--data '{
	"jsonrpc":"2.0",
	"method":"admin_nodeInfo",
	"params":[],
	"id":1
}' 
```
Example response:
```
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "id": "b75e0c4d2113b6f144ea8fd356a8f90e612a2a5f48a13c78d7e0e176e5724eb2",
        "name": "erigon/v2.47.0-dev-5d86cdb5/darwin-arm64/go1.19.6",
        "enode": "enode://05ab575d947f2d73065ea0f795dc2d96ed0ad603f3e730ab90dc881122d552c9f59ffcb148fe50546bec8b319daeb3c22ec02e7d12a7c4f2ac4cd26456a04a7c@127.0.0.1:30303?discport=0",
   ...
```

Get nodeInfo of node 2 using `admin_nodeInfo` RPC:
```sh
curl --location 'localhost:8546/' \
--header 'Content-Type: application/json' \
--data '{
	"jsonrpc":"2.0",
	"method":"admin_nodeInfo",
	"params":[],
	"id":2
}' 
```
Example response:
```
{
    "jsonrpc": "2.0",
    "id": 2,
    "result": {
        "id": "32d721e4d75219b021d7f83235f1f1eb8b705d6f85e634bccde564b8f7f94d78",
        "name": "erigon/v2.47.0-dev-5d86cdb5/darwin-arm64/go1.19.6",
        "enode": "enode://1abb8579647779e13b7f68d18f9c776cbd29281841c7f950e9cf9afa996e31120a6f481cea8e90e0f42a0eb1aa00aeafee81c4bae6c31aa16810b795c6d6e069@127.0.0.1:30304?discport=0",
   ...
```

Call `admin_addPeer` RPC to node 2:
```sh
curl --location 'localhost:8546/' \
--header 'Content-Type: application/json' \
--data '{
	"jsonrpc":"2.0",
	"method":"admin_addPeer",
	"params":["enode://05ab575d947f2d73065ea0f795dc2d96ed0ad603f3e730ab90dc881122d552c9f59ffcb148fe50546bec8b319daeb3c22ec02e7d12a7c4f2ac4cd26456a04a7c@127.0.0.1:30303"],
	"id":2
}' 
```
Example response:
```
{
    "jsonrpc": "2.0",
    "id": 2,
    "result": true
}
```


Check peer info of node 1 using `admin_peers` RPC:
```sh
curl --location 'localhost:8545/' \
--header 'Content-Type: application/json' \
--data '{
	"jsonrpc":"2.0",
	"method":"admin_peers",
	"params":[],
	"id":1
}' 
```
Example response:
```
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": [
        {
            "enode": "enode://1abb8579647779e13b7f68d18f9c776cbd29281841c7f950e9cf9afa996e31120a6f481cea8e90e0f42a0eb1aa00aeafee81c4bae6c31aa16810b795c6d6e069@127.0.0.1:55426",
            "id": "32d721e4d75219b021d7f83235f1f1eb8b705d6f85e634bccde564b8f7f94d78",
            "name": "erigon/v2.47.0-dev-5d86cdb5/darwin-arm64/go1.19.6",
            "caps": [
                "eth/66",
                "eth/67"
            ],
            "network": {
                "localAddress": "127.0.0.1:30303",
                "remoteAddress": "127.0.0.1:55426",
                "inbound": true,
                "trusted": false,
                "static": false
            },
            "protocols": null
        }
    ]
}
```

---------

Co-authored-by: alex.sharov <AskAlexSharov@gmail.com>
2023-09-06 15:31:02 +07:00
Alex Sharov
6c0c0ef75e exec server: run 1st cycle not in global txn. run exec in async tx, run prune in sync tx. partial progress loss fix (partial fix) (#8128) 2023-09-06 10:23:11 +07:00
Giulio rebuffo
544d4188af Fixed snapshots logging (#8132)
Problem was errgroup subroutines finished before their logs could
internally trigger
2023-09-06 10:03:54 +07:00
Giulio rebuffo
fccc563f69
Fixed snapshots logging (#8132)
Problem was errgroup subroutines finished before their logs could
internally trigger
2023-09-06 09:59:54 +07:00
Alex Sharov
13fc0f2a7e
exec server: run 1st cycle not in global txn. run exec in async tx, run prune in sync tx. partial progress loss fix (partial fix) (#8128) 2023-09-06 08:48:07 +07:00
Alex Sharov
8983128d24
Restore genesis reads code - remote rpc case. Remove ctx parameter from baseApi func (tx already has internal ctx) (#8122) 2023-09-04 12:42:08 +07:00
Mark Holt
8ea0096d56
moved metrics sub packages types to metrics (#8119)
This is a non functional change which consolidates the various packages
under metrics into the top level package now that the dead code is
removed.

It is a precursor to the removal of Victoria metrics after which all
erigon metrics code will be contained in this single package.
2023-09-03 08:09:27 +07:00
lupin012
5a9f430c5a
RPCdaemon: fix to work also with snapshot (#8111)
The FIX is necessary to permit to use API also in case block is in the
snapshot files
2023-09-02 09:55:48 +07:00
Giulio rebuffo
42101f529e
demote logs for fork validator (#8118) 2023-09-02 00:20:14 +02:00
Giulio rebuffo
b4cf5f5be4
Fixed canonical chain truncation (#8117) 2023-09-01 23:44:18 +02:00
alex.sharov
253c232f77 pprof flags in erigon sub-commands 2023-09-01 12:22:24 +07:00
banteg
5fbb9e2f87
fix: correctly process extcodecopy in vmtrace (#8108)
vmtrace routine wasn't outputting the memory extcodecopy has written.
2023-09-01 07:10:34 +07:00
Mark Holt
a4cfbe0d56
Heimdall metrics + Metrics HTTP server rationalization (#8094)
This is an update of:

https://github.com/ledgerwatch/erigon/pull/7846

which uses a local fork of victoria metrics to include the changes that
https://github.com/anshalshukla added to the original for we where
using.

It also includes code to address the duplicate metrics issue identified
here:

https://github.com/ledgerwatch/erigon/issues/8053

It has one more associated fix which is to correctly add a metadata
label to counters, these where previously labelled as gauges.

e.g. 

```
# TYPE p2p_peers counter
p2p_peers 0
```
rather than

```
# TYPE p2p_peers gauge
p2p_peers 0
```

---------

Co-authored-by: Anshal Shukla <53994948+anshalshukla@users.noreply.github.com>
Co-authored-by: Anshal Shukla <shukla.anshal85@gmail.com>
2023-08-31 09:04:27 +01:00
Andrew Ashikhmin
9b63764b16
Move ApplyDAOHardFork & UpgradeBuildInSystemContract to engine.Initialize (#8095)
Now all protocol-stipulated changes at the beginning of the block (AuRa
stuff,
[DAO](https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/dao-fork.md)
irregular state change, Calcutta system contract upgrade,
[EIP-4788](https://eips.ethereum.org/EIPS/eip-4788) beacon root) are
handled by consensus engine `Initialize()`.
2023-08-30 15:51:19 +02:00
Mark Holt
f2d0118a33
Bor snapshot block production (#8065)
I have added:

```go
{
	ID:          stages.BorHeimdall,
	Description: "Download Bor-specific data from Heimdall",
	Forward: func(firstCycle bool, badBlockUnwind bool, s *StageState, u Unwinder, tx kv.RwTx, logger log.Logger) error {
		if badBlockUnwind {
			return nil
		}
		return BorHeimdallForward(s, u, ctx, tx, borHeimdallCfg, true, logger)
	},
	Unwind: func(firstCycle bool, u *UnwindState, s *StageState, tx kv.RwTx, logger log.Logger) error {
		return BorHeimdallUnwind(u, ctx, s, tx, borHeimdallCfg)
	},
	Prune: func(firstCycle bool, p *PruneState, tx kv.RwTx, logger log.Logger) error {
		return BorHeimdallPrune(p, ctx, tx, borHeimdallCfg)
	},
},
```
To MiningStages as well as Default as otherwise bor events are not added
when the block producer creates new blocks.

There are a couple of questions I have around this implementation:

* Is this the right place to add this
* As the state is also executed when the default stage is processed ther
is some duplicate processing for the block producing node.
* There is a duplicated call to heimdall which could be removed if the
stages share state - but its not clear if we want to do this.
* I don't think the mining stage needs to prune as this will be
replicated in the default iteration

This can be tested using the devnet with the following arguments:

```
--chain bor-devnet --bor.localheimdall --scenarios state-sync
```

This will generate sync events via an ethereum devnet which are
transmitted to bor chain and will be executed at the end of the snapshot
delay, which results in events generated from the bor chain. This tests
the whole sync, block generation, event lifecycle. As it needs to wait
for sprints to end after a sufficient delay it is quite slow to run.
2023-08-30 08:06:09 +01:00
Alex Sharov
d1d348211f
add flag --force.partial.commit: to workaround problem "start from backup takes long time and can't save partial progress" (#8090) 2023-08-30 08:49:16 +07:00
racytech
f477348a50
Support for --chain=holesky (#8064) 2023-08-26 16:31:29 +06:00
Giulio rebuffo
f5cc67fe5b
Added ranges to the Execution.proto (#8081) 2023-08-26 02:25:48 +02:00
Giulio rebuffo
d223adf114
Better migrations and chain segmentation recovery (#8079) 2023-08-25 17:45:00 +02:00
battlmonstr
32ca0e5ab1
sync: revert flawed dropUselessPeers logic and alleviate its issues (#8062)
The current logic is flawed, because it drops all peers that are less
synced.
It is valid to return empty responses by the eth spec.
A proper logic should penalize from the context of the sync process,
where enough "reputation" data is collected about a peer.

In order to be able to connect to erigon 2.48 peers that have
--sentry.drop-useless-peers enabled,
this adds a check to not reply with an empty headers list.
If we reply with an empty list, we're going to be considered useless and
kicked.
Once enough of erigon nodes are updated in the network past this commit,
this check should be removed,
because it is totally acceptable to return an empty list by the eth
spec.
2023-08-25 11:42:54 +02:00
Andrew Ashikhmin
a6d9d26fe9
Fix opSelfdestruct6780 (#8066)
also upgrade execution-spec-tests to
[v1.0.2](https://github.com/ethereum/execution-spec-tests/releases/tag/v1.0.2)
2023-08-25 08:06:59 +02:00
Alex Sharov
2b6c21fddb
move mdbx to new org (#8061) 2023-08-24 18:00:24 +07:00
battlmonstr
2e29ff33e1
bor: BroadcastNewBlock to all peers from validator nodes (#8030)
Currently PropagateNewBlockHashes and BroadcastNewBlock
selects a subset of all sentries by taking a `Sqrt(len(sentries))`,
and then for each sentry SendMessageToRandomPeers
selects a subset of its peers by taking `Sqrt(len(peerInfos))`.

This behaviour limits the broadcast scope with a lot of peers, e.g. 100
becomes 10,
but is not great with very few peers, or if the message is very
important
to broadcast to everyone, which is the case of bor validator/proposer
nodes.

* send to all sentries in both BroadcastNewBlock and PropagateNewBlockHashes
* remove peerCountConstrained sqrt logic in SendMessageToRandomPeers
* add maxPeers provider func as a parameter to MultiClient
* default it to 10 for eth and 0 (unlimited) for bor validators

---------

Co-authored-by: Mark Holt <mark@distributed.vision>
2023-08-23 14:28:39 +02:00
Andrew Ashikhmin
6bc0ca9e85
Correctly compute fork id when timestamp fork is activated in genesis (#8046)
See https://github.com/ethereum/go-ethereum/pull/27895
2023-08-21 15:35:13 +02:00
ledgerwatch
6b6c0caad0
Snapshots of Bor events (#7901)
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
Co-authored-by: Alex Sharp <alexsharp@alexs-mbp-2.home>
2023-08-18 17:10:35 +01:00
Giulio rebuffo
38db2ed2e7
[Caplin Phase 2]: Initial working implementation (#8033)
caplin just using execution.proto
2023-08-18 15:43:22 +02:00
Andrew Ashikhmin
611145c385
updateForkChoice: send state changes to txpool after tx is committed (#8035)
[txpool](https://github.com/ledgerwatch/erigon-lib/blob/main/txpool/pool.go)
expects an `OnNewBlock` update only after the DB transaction is
committed.

This fixes, for example, a nonce gap mis-detection in Hive test
"engine-cancun/Blob Transactions On Block 1, Cancun Genesis".
2023-08-17 16:03:12 +02:00
Somnath Banerjee
1867d9393a
Fix duplicate commitments in GetPayloadV3 response (#8018) 2023-08-14 17:57:33 +05:30
Somnath Banerjee
143ff4695c
Fix 17 hive tests (#8014) 2023-08-14 09:24:59 +02:00
Andrew Ashikhmin
7947fc8ad1
Always encode EIP-4844 transactions unwrapped (without blobs) (#8012)
The only time we need to serialize blobs/commitments/proofs is when we
reply to `GetPooledTransactions` (and that's handled by the txpool).
2023-08-13 22:32:47 +05:30
Somnath Banerjee
b7070a9c08
Fix 12 hive tests (#8011) 2023-08-13 19:46:25 +05:30
Andrew Ashikhmin
9609ca9120
Fix JSON marshalling of BlobsBundleV1 (EIP-4844) (#8010)
According to the
[spec](https://github.com/ethereum/execution-apis/blob/main/src/engine/cancun.md#blobsbundlev1),
commitments/proofs/blobs in `BlobsBundleV1` should have the
[DATA](https://github.com/ethereum/execution-apis/blob/main/src/engine/common.md#encoding)
encoding.
2023-08-13 15:43:55 +02:00
Giulio rebuffo
7c0d6e15bb
Added gnosis fields and removed body gap. (#7993) 2023-08-11 23:07:36 +02:00
Alex Sharov
c464d84334
tmpdb: move to tmpdir (#8003) 2023-08-12 01:06:15 +06:00
Andrew Ashikhmin
e377cea51d
Fix CopyTxs for BlobTxWrapper (EIP-4844) (#8002) 2023-08-11 20:30:02 +02:00
Andrew Ashikhmin
03927d3e27
Call InitializeBlockExecution in SpawnMiningExecStage (EIP-4788) (#7999)
This fixes the trie state root issue that was occurring in the Hive
tests for Cancun.
2023-08-11 14:04:53 +02:00
Andrew Ashikhmin
6adad0afde
Add parentBeaconBlockRoot to RPCMarshalHeader (EIP-4788) (#7997) 2023-08-11 10:26:44 +02:00
Alex Sharov
d2bde8c096
Recsplit: cancelable build (#7994) 2023-08-11 11:54:59 +06:00
alex.sharov
7ca6649e0c BlockReader: remove redundant check 2023-08-11 11:45:02 +06:00
racytech
6785ff28e4
hive: minor fixes (EIP-4788) (#7985) 2023-08-09 13:44:21 +06:00
a
db5b348673
Caplin block persistence (#7941)
Co-authored-by: Giulio <giulio.rebuffo@gmail.com>
2023-08-09 01:21:19 +02:00
Giulio rebuffo
6081fe01b8
fixed forkchoices (#7983) 2023-08-08 22:56:16 +02:00
Andrew Ashikhmin
ae76df1b8a
Update execution-spec-tests to v1.0.1 (#7980)
[v1.0.1](https://github.com/ethereum/execution-spec-tests/releases/tag/v1.0.1)
"Cancun Devnet-8 Pre-Release" adds some tests for Cancun. This PR only
fixes a couple of issues; the majority of the new tests are still
failing and thus are skipped in `TestExecutionSpec`.
2023-08-08 15:01:35 +02:00
Alex Sharov
23270eae58
tests: fix nil genesis panic (#7979) 2023-08-08 15:19:08 +06:00
Giulio rebuffo
e3d642d6a0
Fixed EL integration spectest (#7975) 2023-08-06 17:13:36 +02:00
Andrew Ashikhmin
d69b20bc4e
Support engine_forkchoiceUpdatedV3 with ParentBeaconBlockRoot (EIP-4788) (#7969)
Prerequisites: https://github.com/ledgerwatch/interfaces/pull/187 &
https://github.com/ledgerwatch/erigon-lib/pull/1069. Also implement
https://github.com/ethereum/execution-apis/pull/426.
2023-08-06 11:54:14 +02:00
Giulio rebuffo
b4057da8e6
removed missingHash (#7973) 2023-08-06 02:28:18 +02:00
banteg
63ecbf88ba
fix: show stack for push0 (#7970)
this fixes vmtrace after shanghai

before:
```python
VMOperation(pc=24, cost=2, ex=VMExecutedOperation(used=1942085, push=[], mem=None, store=None), sub=None, op='PUSH0', idx='14-644-13')
```

after:
```python
VMOperation(pc=24, cost=2, ex=VMExecutedOperation(used=1942085, push=[HexBytes('0x00')], mem=None, store=None), sub=None, op='PUSH0', idx='14-644-13')
```
2023-08-05 23:37:51 +02:00
Giulio rebuffo
0e4e36b142
Replaced old version of Engine API with newer version (#7972) 2023-08-05 23:33:10 +02:00
Giulio rebuffo
9730cc796a
Cleanup of consensus separation (#7971) 2023-08-05 02:26:53 +02:00
Giulio rebuffo
b09d90ee0e
Added in-memory flushing to execution.proto (#7968) 2023-08-04 14:42:35 +02:00
Giulio rebuffo
c08aa3ac03
fix undownloaded body (#7966) 2023-08-04 02:22:07 +02:00
Andrew Ashikhmin
d014da4dc0
Replace --override.shanghaiTime flag with --override.cancun (#7964)
Prerequisite: https://github.com/ledgerwatch/erigon-lib/pull/1067
2023-08-03 16:05:35 +02:00
racytech
2c2ccb6e27
dencun-devnet: --trusted-setup-file flag support (#7963) 2023-08-03 14:36:47 +02:00
Giulio rebuffo
29935a65f4
Fixed hive tests in consensus separation (#7961) 2023-08-03 03:39:47 +02:00
Andrew Ashikhmin
bd9e8b9b56
Fix eth_getTransactionByHash for EIP-4844 transactions (#7960)
Also pick https://github.com/ledgerwatch/erigon-lib/pull/1063 and
https://github.com/ledgerwatch/erigon-lib/pull/1065
2023-08-02 18:25:15 +02:00
Somnath Banerjee
3e5b9d7490
Fix newPayload parentBeaconBlockRoot check (#7955) 2023-08-02 09:34:13 +02:00
Somnath Banerjee
d91f4263dc
EIP-4788: Beacon block root and stateful precompile (#7888) 2023-08-01 16:01:26 +05:30
Giulio rebuffo
1220ae659e
Most hive tests fixed in --experimental.modular (#7950)
Broken: 25/109
2023-08-01 02:08:15 +02:00
Andrew Ashikhmin
03ac80ad2d
EIP-4844: rename "data hash" to "blob hash" (#7947)
See https://github.com/ethereum/EIPs/pull/7001
2023-07-31 10:12:53 +02:00
Giulio rebuffo
443757edbd
Consensus separation for Engine API (Working on Sepolia) (#7945)
This makes the experimental consensus separation functional on sepolia.
2023-07-30 23:35:55 +02:00
Andrew Ashikhmin
5693439521
EIP-4844: Verify expectedBlobVersionedHashes (#7946)
See the
[engine_newpayloadv3](https://github.com/ethereum/execution-apis/blob/main/src/engine/cancun.md#engine_newpayloadv3)
spec
2023-07-30 17:10:54 +02:00
racytech
af884204cb
eip-4844: hive tests: RLP decode order and newPayloadV3 to expect versionedHashes (#7943) 2023-07-30 15:49:31 +02:00
Giulio rebuffo
2f2a1741d2
Protyped consensus separated engine api (untested) (#7942) 2023-07-29 00:22:38 +02:00
Andrew Ashikhmin
7d35c6b737
EIP-4844: Rename "data gas" to "blob gas" (#7937)
See https://github.com/ethereum/EIPs/pull/7354 &
https://github.com/ethereum/consensus-specs/pull/3461. Prerequisite:
https://github.com/ledgerwatch/erigon-lib/pull/1058
2023-07-28 12:12:05 +02:00
Willian Mitsuda
d3f8b5861c
Max cap search results for ots API by default + cli flag to override it (#7924)
Otterscan API search methods allow the user to inform the page size.

This PR adds an internal max (default == 25 results) to cap the page
size, regardless of what the user asks.

It also adds a `--ots.search.max.pagesize` CLI args to override this max
(either in erigon and rpcdaemon binaries).
2023-07-28 08:29:17 +07:00
Giulio rebuffo
a0865b489f
Prototyped experimental engine reverse downloader (#7936)
Erigon lib now good
2023-07-28 01:32:19 +02:00
Giulio rebuffo
b4ecd7f524
Consensus Separation: Separated GetPayload using an execution service (#7933)
Miracoulously, hive tests pass first try. YIPPIE.

Also for the future, I added `--experimental.modular` which enables a
secondary engine API for consensus separation.

Now block building is responsibility of the execution module.
2023-07-27 14:37:49 +02:00
Giulio rebuffo
f5f833fd70
Proper Error handling in direct communication with engine (#7929) 2023-07-25 14:15:50 +02:00
Giulio rebuffo
39853432be
added --experimental.modular (#7925) 2023-07-24 18:04:36 +02:00
Giulio rebuffo
9d3551f8cf
prototype of ValidataChain (#7921) 2023-07-23 19:10:24 +02:00
Giulio rebuffo
837ffb5b7e
Refactored ForkValidator to be Database-only (#7920) 2023-07-23 14:51:26 +02:00
Giulio rebuffo
9cf07f059d
Prototyped FCU for EL module (#7913)
save
2023-07-20 18:35:02 +02:00
Mark Holt
529d359ca6
Bor span testing (#7897)
An update to the devnet to introduce a local heimdall to facilitate
multiple validators without the need for an external process, and hence
validator registration/staking etc.

In this initial release only span generation is supported.  

It has the following changes:

* Introduction of a local grpc heimdall interface
* Allocation of accounts via a devnet account generator ()
* Introduction on 'Services' for the network config

"--chain bor-devnet --bor.localheimdall" will run a 2 validator network
with a local service
"--chain bor-devnet --bor.withoutheimdall" will sun a single validator
with no heimdall service as before

---------

Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
2023-07-18 09:47:04 +01:00
Alex Sharov
368572f882
mdbx_to_mdbx: increase read-ahead threads amount (#7905) 2023-07-18 13:27:33 +07:00
Giulio rebuffo
735a800eb7
Added insertions and chainDb overlay (#7899) 2023-07-15 18:31:15 +02:00
Giulio rebuffo
814984dffb
Implementation of execution.proto: added getters (#7898) 2023-07-14 16:38:17 +02:00
Delweng
dec2f5a3b3
turbo/jsonrpc: eth_getBlockReceipts support by by hash (#7886)
Signed-off-by: jsvisa <delweng@gmail.com>
2023-07-14 08:57:09 +01:00
ledgerwatch
035a6f867c
Simplifications for bor tx code (#7889)
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
2023-07-14 08:49:10 +01:00
Giulio rebuffo
b2442a7b41
Removed unused stages (Cumulative index + Translation) (#7884) 2023-07-13 16:55:48 +02:00
Mark Holt
bd9896bf4b
added bor tx indexing with tests (#7826)
This request implements the insertion of Bor ephemeral transactions into
snapshot indexes.

I does this by taking the block hash from the header index and passing
it to the transaction indexer to add an additional index entry per block
into the transaction hash -> block index.

The passed entries are currently contained in an in memory array which
is (32 * number of blocks / sprint size) bytes.

In addition to the functional code there is also an update to the
`dump_test.go` so that it runs `DumpBlocks` to exercise the indexing
code. To facilitate this the `InsertChain` method in `mock_sentry` has
been modified so that it can process >128 blocks.

The code in this request also includes additional bor/consensus code
with the following functions:

`CalculateSprint`
`CalculateSprintCount`

The first function is a modification of the code in erigon-lib so that
the sprints are numerically rather than lexically ordered. This code
should be migrated to erigon-lib and should have its sprint set
calculated once from its underlying map rather than this process being
repeated every calculation.

---------

Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
Co-authored-by: ledgerwatch <akhounov@gmail.com>
Co-authored-by: Enrique Jose  Avila Asapche <eavilaasapche@gmail.com>
Co-authored-by: Giulio <giulio.rebuffo@gmail.com>
2023-07-12 23:31:38 +01:00
Giulio rebuffo
bd63cb7c8c
Removed GRPC layer from Engine API (#7878) 2023-07-12 18:11:41 +02:00
Giulio rebuffo
6272559fb7
Separated PendingBlock behaviour to be chain agnostic (#7859)
Instead of getting the pending block with latest payload id, we just
store the latest block built and serve it in remote backend
2023-07-10 19:22:03 +02:00
ledgerwatch
a9c86ab887
[devnet] Always select first node, fix configuration mess up between nodes (#7863)
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
2023-07-10 11:37:55 +01:00
Alex Sharov
bf8ac9a38f
mdbx_to_mdbx: to use logger (#7860) 2023-07-09 08:04:20 +01:00
Giulio rebuffo
20b8e156db
moved cmd/rpcdaemon/commands -> turbo/jsonrpc (#7858) 2023-07-08 19:01:26 +02:00
Enrique Jose Avila Asapche
bff1e0e901
[Caplin] Added json rpc cl (#7836)
Allows for Caplin to be used with other ELs from aside of Erigon

---------

Co-authored-by: Giulio <giulio.rebuffo@gmail.com>
2023-07-08 16:42:30 +02:00
Giulio rebuffo
84f31c873e
Separation of Engine from Ethbackend (#7821)
This PR separates ENGINE from Ethbackend. It makes it so:

1) EthBackend not a god class
2) We can abstract away engine API so that we can make it CL-like and
enable Consensus-Execution driven design
3) Objective is Json-RPC -> Engine Consensus Module -> Execution module.
2023-07-06 18:09:52 +02:00
Alex Sharov
69ae999059
log file unmap/close errors (#7819) 2023-07-06 11:12:26 +07:00
Mark Holt
5935b11b24
Devnet macos startup and windows committed memory startup fixes (#7832)
The fixes here fix a couple of issues related to devnet start-up

1. macos threading and syscall error return where causing multi node
start to both not wait and fail
2. On windows creating DB's with the default 2 TB mapsize causes the os
to reserve about 4GB of committed memory per DB. This may not be used -
but is reserved by the OS - so a default bor node reserves around 10GB
of storage. Starting many nodes causes the OS page file to become
exhausted.

To fix this the consensus DB's now use the node's OpenDatabase function
rather than their own, which means that the consensus DB's take notice
of the config.MdbxDBSizeLimit.

This fix leaves one 4GB committed memory allocation in the TX pool which
needs its own MapSize setting.

---------

Co-authored-by: Alex Sharp <akhounov@gmail.com>
2023-07-02 22:37:23 +01:00
Andrew Ashikhmin
1f7de0e5cf
Rename StageLoopStep to StageLoopIteration (#7820)
Rename for clarity to highlight that not only one stage is executed, but
the entire loop.
2023-06-29 17:53:23 +02:00
Andrew Ashikhmin
a2dd5da2a1
[erigon-lib] EIP-4844: parse transactions when not wrapped with blobs (#7805)
Pick up https://github.com/ledgerwatch/erigon-lib/pull/1034
2023-06-27 12:52:59 +02:00
Andrew Ashikhmin
a24eae8d6c
EIP-4844: Handle data gas in txpool (#7779)
Prerequisite: https://github.com/ledgerwatch/erigon-lib/pull/1029
2023-06-23 11:10:23 +02:00
sonicWhale
1f9bec2557
enable cli RPCGlobalTxFeeCapFlag (#7775)
enable -rpc.txfeecap flag on the RPC daemon in the default sets of CLI
flags
2023-06-23 11:17:10 +07:00
Alex Sharov
f8cb4d6dbb
Fix subscription closing race (#7788)
`go test -p 1 -race -count=100 -run='TestFiltersDeadlock_Test'
./turbo/rpchelper/...`
2023-06-23 10:07:51 +07:00
Alex Sharov
ded166d73d
e3: release chain maker changes (#7787) 2023-06-23 10:07:42 +07:00
ledgerwatch
f8a5c8c6ce
Fix DumpTxs (#7782) 2023-06-22 12:08:16 +01:00
Mark Holt
051cad0fdd
Devnet diagnostics (#7762)
Added support tunnel to the devnet cmd. In order to get this to run I
made the following changes:

* Create a public function 
* Added non root logging

I have also added commentary to the readme to explain the additional
command line arguments needed to integrate with diagnostics. In summary,
if you set the --diagnostics.url the devenet will wait for diagnostic
requests rather than exiting

---------

Co-authored-by: alex.sharov <AskAlexSharov@gmail.com>
2023-06-20 10:11:55 +01:00
Alex Sharov
a77edd7a32
faster opening of snapshots and indices (#7757)
- mostly by MADV_SEQUENTIAL during opening 
- see https://github.com/ledgerwatch/erigon-lib/pull/1025
2023-06-19 11:34:01 +07:00
Alex Sharov
d3c3be9c91
e2: optimize tests speed (#7738) 2023-06-15 16:09:11 +07:00
Andrew Ashikhmin
252e57b76f
Base BlobTx on DynamicFeeTransaction (#7736)
Continuation of PR #7715
2023-06-15 10:57:27 +02:00
Alex Sharov
e5023775aa
Enforce blockReader interface (#7737)
- breaks dependency from staged_sync to package with block_reader
implementation
- breaks dependency from snap_sync to package with block_reader
implementation
- breaks dependency from mining to txpool implementation
2023-06-15 13:11:51 +07:00
Mark Holt
f110102023
Devnet scenarios (#7723)
This is an update to the devnet code which introduces the concept of
configurable scenarios. This replaces the previous hard coded execution
function.

The intention is that now both the network and the operations to run on
the network can be described in a data structure which is configurable
and composable.

The operating model is to create a network and then ask it to run
scenarios:

```go
network.Run(
		runCtx,
		scenarios.Scenario{
			Name: "all",
			Steps: []*scenarios.Step{
				&scenarios.Step{Text: "InitSubscriptions", Args: []any{[]requests.SubMethod{requests.Methods.ETHNewHeads}}},
				&scenarios.Step{Text: "PingErigonRpc"},
				&scenarios.Step{Text: "CheckTxPoolContent", Args: []any{0, 0, 0}},
				&scenarios.Step{Text: "SendTxWithDynamicFee", Args: []any{recipientAddress, services.DevAddress, sendValue}},
				&scenarios.Step{Text: "AwaitBlocks", Args: []any{2 * time.Second}},
			},
		})
```
The steps here refer to step handlers which can be defined as follows:

```go
func init() {
	scenarios.MustRegisterStepHandlers(
		scenarios.StepHandler(GetBalance),
	)
}

func GetBalance(ctx context.Context, addr string, blockNum requests.BlockNumber, checkBal uint64) {
...
```
This commit is an initial implementation of the scenario running - which
is working, but will need to be enhanced to make it more usable &
developable.

The current version of the code is working and has been tested with the
dev network, and bor withoutheimdall. There is a multi miner bor
heimdall configuration but this is yet to be tested.

Note that by default the scenario runner picks nodes at random on the
network to send transactions to. this causes the dev network to run very
slowly as it seems to take a long time to include transactions where the
nonce is incremented across nodes. It seems to take a long time for the
nonce to catch up in the transaction pool processing. This is yet to be
investigated.
2023-06-14 12:35:22 +01:00
Andrew Ashikhmin
862d7b6bc6
Move ChainID from CommonTx to DynamicFeeTransaction (#7732)
For legacy transactions ChainID is optional (missing in
pre-[EIP155](https://eips.ethereum.org/EIPS/eip-155) transactions) and
is derived from `V` anyway.

Also, cherry pick https://github.com/ethereum/go-ethereum/pull/27452.
2023-06-14 11:44:05 +02:00
Alex Sharov
1b14785d79
ws unfreeze (#7724)
attempt to address next issue: 

> when I'm having a lot of websocket connections the node is freezing
and then it needs like 10 mins to sync. Then if I keep pushing requests
it falls out of sync all the time
2023-06-14 16:25:05 +07:00
racytech
8b312d54e8
eip-4844: desszing blobtx: initial commit (#7715) 2023-06-14 11:01:03 +02:00
Alex Sharov
5ff8246e2a
e4: release some tests (#7729) 2023-06-14 10:01:00 +07:00
Alex Sharov
ae1b193d6f
use 1 constant in tests to configure initialCycle variable (#7720) 2023-06-13 10:55:59 +07:00
Mark Holt
e99269ebce
added --log.dir.prefix flag (#7714)
This request adds an additional logging flag to change the name of the
logfiles produced by erigon to be prefixed by a name other than
'erigon'.

This allows multiple nodes to log to the same directory without
overwriting each others files. It is requires so that the devnet when
running can maintain all of its log files in a single consolidated
directory which survives devnet restarts.

---------

Co-authored-by: Mark Holt <mark@distributed.vision>
2023-06-12 15:30:05 +01:00
Alex Sharov
31be6f6885
StagedSync: fix canRunCycleInOneTransaction logic (#7712) 2023-06-12 16:02:28 +07:00
Alex Sharov
afd8ea94d0
e3: move domains to tables.go (#7707) 2023-06-11 21:12:05 +07:00
Mark Holt
1e575ea172
rpc service and stageloop logger updates (#7696)
This is another update to logging to replace the root logger with a
contextual logger
2023-06-10 07:39:39 +01:00
Alex Sharov
afa4f53ae2
e3: use deserializeV3 for history (#7691) 2023-06-09 10:53:04 +07:00
Andrew Ashikhmin
fa0cfcbec7
Remove the Rinkeby testnet (#7677)
See https://github.com/ethereum/go-ethereum/pull/27406
2023-06-07 07:42:36 +02:00
Alex Sharov
bf9f5067f3
fix integration tests run (#7672) 2023-06-06 13:49:01 +07:00
Alex Sharov
e14664d53b
Store Canonical/NonCanonical/Bad blocks/senders/txs in same tables. Make re-org cheaper (#7648)
- allow store non-canonical blocks/senders
- optimize re-org: don't update/delete most of data
- allow mark chain as `Bad` - will be not visible by eth_getBlockByHash,
but can read if have hash+num
2023-06-05 12:36:24 +07:00
Alex Sharov
895e7dd96a
cleanup (#7655) 2023-06-04 10:37:20 +07:00
Alex Sharov
157b6de8e3
release small rename (#7647) 2023-06-03 17:26:20 +07:00
Alex Sharov
63c92010cd
remove txsV3 cli flag (#7644) 2023-06-03 15:54:27 +07:00
Alex Sharov
ad72b7178e
prune speedup. stage_senders: don't re-calc existing senders (#7643)
- stage_senders: don't re-calc existing senders
- stage_tx_lookup: prune less blocks per iteration - because
random-deletes are expensive. pruning must not slow-down sync.
- prune data even if --snap.stop is set
- "prune as-much-as-possible at startup" is not very good idea: at
initialCycle machine can be cold and prune will cause big downtime, no
reason to produce much freelist in 1 tx. People may also restart erigon
- because of some bug - and it will cause unexpected downtime (usually
Erigon startup very fast). So, I just remove all `initialSync`-related
logic in pruning.
- fix lost metrics about disk write byte/sec
2023-06-03 12:30:53 +07:00
Alex Sharov
d40317c905
preparation for --txs.v3, step 2 (#7636) 2023-06-03 07:20:22 +07:00
Andrew Ashikhmin
190bc9dfd8
EIP-4844: add data_gas_used (#7639)
Implement https://github.com/ethereum/EIPs/pull/7062 and
https://github.com/ethereum/EIPs/pull/7095. Pick up
https://github.com/ledgerwatch/erigon-lib/pull/1006.
2023-06-02 21:26:19 +01:00
Andrew Ashikhmin
b2a90e0ea9
Merge EngineGetPayloadWithBlobs into EngineGetPayload (#7637)
Pick up https://github.com/ledgerwatch/interfaces/pull/171 &
https://github.com/ledgerwatch/interfaces/pull/173
2023-06-02 13:02:13 +02:00
Alex Sharov
6439bdd835
txsv3: release small parts (#7632) 2023-06-02 11:38:20 +07:00
Alex Sharov
436656a40f
snapshots: DumpBodies - break dependency on body.BaseTxNum value in db (#7607)
it's step towards saving canonical and non-canonical bodies in same
table (and txs also in same own table). to reduce write amplification
(cheaper re-orgs)

PR change: reading BaseTxNum from existing snapshots instead of DB 
DB will store in field body.BaseTxNum - non-canonical TxnID  
Snapshots will store only canonical TxNum in field body.BaseTxNum
2023-06-02 11:01:57 +07:00
Alex Sharov
b163d3a877
e3: release some e4 parts (#7629) 2023-06-02 10:55:40 +07:00
Alex Sharov
c6b12ed7ca
stageLoop: unbound canRunCycleInOneTransaction logic from initialCycle variable (#7616) 2023-06-01 16:50:19 +07:00
Alex Sharov
6c0b531eca
add "erigon snapshots diff" sub-command to find difference between 2 snapshots (#7619) 2023-06-01 16:29:26 +07:00
Alex Sharov
5c7da48331
blockReader: fix blockNum check logic (#7615) 2023-06-01 15:04:21 +07:00
Alex Sharov
299c81e522
move "makeBodiesCanonical" method to blockWriter (#7605) 2023-05-31 15:44:01 +07:00
Alex Sharov
3cba3908dd
use BlockReader.CanonicalHash method instead of rawdb (#7604) 2023-05-31 13:41:10 +07:00
Alex Sharov
af83845f7e
cheaper isCanonicalHash func, less lookups of blockHash by blockNum in rpc (#7603) 2023-05-31 11:26:38 +07:00
Anshul Yadav
1fb053f260
Header downloader monitor for diagnostics system (#7590)
## What's this PR about?

- Added states to be sent to diagnostics system for header downloader
monitor
- Added the code for sending the states through the tunnel
- Code added for updating the states in the header_algos.go file

---------

Co-authored-by: alex.sharov <AskAlexSharov@gmail.com>
2023-05-29 14:18:31 +07:00
Alex Sharov
279e1bec33
use blockReader as service-provider of RoSnapshots (#7584) 2023-05-26 17:12:33 +07:00
Alex Sharov
cfafa24481
tests for blocks snapshots creation data producer (#7579) 2023-05-25 14:58:31 +07:00
Alex Sharov
111db5f655
blockReader in tests - step8 (#7578) 2023-05-25 12:46:11 +07:00
Alex Sharov
a79033cef8
blockReader in tests, step6 (#7573) 2023-05-24 18:34:36 +07:00
Alex Sharov
31687be599
blockReaders in tests, step4 (#7570) 2023-05-24 15:52:51 +07:00
Alex Sharov
179b138000
add blockReader to mining, blockchain_test (#7569) 2023-05-24 13:53:22 +07:00
Alex Sharov
23bd14744b
blockReader: use in ethstat (#7565) 2023-05-23 16:30:47 +07:00
Alex Sharov
696ccb6edd
add constant to run tests on initialSync=true (#7563) 2023-05-23 14:57:15 +07:00
Alex Sharov
63afe65686
Use BlockReader in ForkValidator, CliqueAPI (#7562) 2023-05-23 14:49:17 +07:00
Alex Sharov
18990ff91a
e2: reduce StageSyncStep interface size (#7561) 2023-05-23 12:28:31 +07:00
Alex Sharov
4d0dee6fb0
Introduce BlockWriter object (txsV3 step 0) (#7559) 2023-05-22 15:49:21 +07:00
Alex Sharov
2865b85888
move e2 snapshots management closer to e3: step 1 (#7543)
- always RLock all snapshots - to guarantee consistency
- introduce class View (analog of RoTx and MakeContext)
- move read methods to View object
- View object will be managed by temporal_tx

---------

Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
2023-05-22 10:09:46 +07:00
Anshul Yadav
2c194e10a1
Args usage msg bug fix (#7554)
## What's this PR is about?
Minor fix in args usage message of support flag. The current message
says that the flag should be 'metrics.url' but it reality it should be
'metrics.urls'
2023-05-20 21:57:23 +01:00
ledgerwatch
2a872b4d54
[devnet] separare logging - headers download (#7551)
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
2023-05-20 07:00:19 +01:00
ledgerwatch
b0117a7c30
[devnet] separate logging - p2p (#7547)
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
2023-05-19 18:41:53 +01:00
ledgerwatch
b382f96f6c
Introduce logger into etl (#7537)
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
2023-05-18 21:20:07 +01:00
ledgerwatch
05597cb195
[devnet tool] separare logging (#7531)
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
2023-05-17 17:36:15 +01:00
Alex Sharov
c0096ee8c8
StageLoopStep: if node synced - then run initialCycle in 1 tx also (for data consistency) (#7532) 2023-05-17 13:39:21 +01:00
ledgerwatch
e75ea786c0
[devnet tool] separate logging (#7526)
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
2023-05-17 07:36:06 +01:00
ledgerwatch
3f9ae3ec77
[devnet tool] separate logging (#7525)
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
2023-05-16 10:53:50 +01:00
Alex Sharov
b3aca15ff8
e2: ReadAhead of blocks, senders accounts, code (#7501)
It improves performance of initial sync (stage exec) by 5-20% when
blocks snapshots are mounted to high-latency drive and when chaindata is
on high-latency drive. And improving cold-start performance.

Current implementation using 2 goroutines for ReadAhead. It also
producing more garbage, can improve it later (here are dashboard with
impact).
```
mainnet2-1: with ReadAhead
mainnet2-3: no ReadAhead
```

<img width="949" alt="Screenshot 2023-05-12 at 09 24 31"
src="https://github.com/ledgerwatch/erigon/assets/46885206/b90b1fa8-9099-48ff-95b3-86e864a36d46">

<img width="845" alt="Screenshot 2023-05-12 at 09 24 13"
src="https://github.com/ledgerwatch/erigon/assets/46885206/39d90c0c-a9d5-4735-8c03-da1455b147aa">
2023-05-15 15:08:35 +07:00
ledgerwatch
bc169179b0
[devnet tool] Side-quest: logging step 7 (#7506)
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
2023-05-13 21:22:30 +01:00
ledgerwatch
5ae9cb7f39
[Devnet tool] side-quest logging step 6 (#7496)
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
2023-05-11 18:59:55 +01:00