Commit Graph

5084 Commits

Author SHA1 Message Date
Shane Bammel
93c50d59a5 Allow for increased Shanghai time with PulseChain 2024-02-14 13:10:46 -06:00
Shane Bammel
75db06fa1d Add support for PulseChain
Thanks @bretep for the original integration.
2024-02-14 13:10:45 -06:00
Giulio rebuffo
e1a1c0c049
Caplin: Fixed goroutine hell (#9246) 2024-01-17 10:06:18 +01:00
battlmonstr
2793ef6ec1
polygon: flatten redundant packages (#9241)
* move mocks to the owner packages
* squash single file packages
* move types to more appropriate files
* remove unused mocks
2024-01-16 09:23:02 +01:00
battlmonstr
cda48aeaf7
polygon/heimdall: drop GRPC support (#9230) 2024-01-15 16:49:46 +01:00
milen
a7d5b55250
rpcdaemon: fix remote bor engine for trace transaction (#9214)
This PR fixes the below error when running a remote rpcdaemon for
Polygon debug_traceTransaction.

Request:
```
curl http://localhost:9545/ \
-X POST \
-H "Content-Type: application/json" \
--data '{
  "jsonrpc": "2.0",
  "id": 0,
  "method": "debug_traceTransaction",
  "params": [
    "0xf265c04fc31c91eec9971e118f059322a910776ce40584114c351732ab01aec7",
    {
      "tracer": "callTracer",
      "borTraceEnabled": true,
      "borTx": true
    }
  ]
}'
```

Response:
```
{"jsonrpc":"2.0","id":0,"result":null,"error":{"code":-32000,"message":"method handler crashed"}}
```

Logs:
```
EROR[01-11|18:45:14.087] RPC method debug_traceTransaction crashed: interface conversion: *cli.remoteConsensusEngine is not consensus.Engine: missing method APIs
```
2024-01-15 13:26:39 +00:00
Mark Holt
d8b91c4d02
Fix startup sync for txpool processing for bor block production (#9219)
When the sync loop first runs it suppresses block sync events both in
the initial loop and when the blocks being processed are greater than
1000.

This fix removed the first check, because otherwise the first block
received by the process ends up not getting sent to the tx pool. Which
means it won't produce new block for polygon.

As well as this fix - I have also moved the gas initialization to the
txpool start method rather than prompting it with a 'synthetic block
event'

As the txpool start has access to the core & tx DB's it can find the
current block and chain config internally so that it doesn't need to be
externally activated it can just do this itself on start up. This has
the advantage of making the txpool more self contained.
2024-01-13 10:33:34 +00:00
battlmonstr
b1c3006d7a
bor: remove duplicate validator_set file and debug logger (#9198) 2024-01-11 08:45:48 +07:00
milen
f690301c03
devnet: integration tests port clash fix (#9194)
Integration tests CI is failing due to a port clash in devnet tests. I
believe this is because there are 2 packages of devnet integration tests
and go can run tests from separate packages in parallel (by default it
does package level parallelism). A simple fix would be to just have all
devnet integration tests in 1 package and run all these tests
sequentially within the package (ie not use t.Parallel). This PR moves
all devnet integration tests in 1 package.

`"ContextStart devnet start failed: private api: could not create
listener: listen top 127.0.0.1:10090: bind: address already in use,
addr=localhost:10090"`

![Screenshot 2024-01-10 at 13 38
37](https://github.com/ledgerwatch/erigon/assets/94537774/06bda987-45e5-46ef-9e0b-3876b3f85c01)
2024-01-10 19:04:27 +00:00
Mark Holt
b05ffc909d
Fixes for Bor Block Production Synchronization (#9162)
This PR contains 3 fixes for interaction between the Bor mining loop and
the TX pool which where causing the regular creation of blocks with zero
transactions.

* Mining/Tx pool block synchronization
The synchronization of the tx pool between the sync loop and the mining
loop has been changed so that both are triggered by the same event and
synchronized via a sync.Cond rather than a polling loop with a hard
coded loop limit. This means that mining now waits for the pool to be
updated from the previous block before it starts the mining process.
* Txpool Startup consolidated into its MainLoop
Previously the tx pool start process was dynamically triggered at
various points in the code. This has all now been moved to the start of
the main loop. This is necessary to avoid a timing hole which can leave
the mining loop hanging waiting for a previously block broadcast which
it missed due to its delay start.
* Mining listens for block broadcast to avoid duplicate mining
operations
The mining loop for bor has a recommit timer in case blocks re not
produced on time. However in the case of sprint transitions where the
seal publication is delayed this can lead to duplicate block production.
This is suppressed by introducing a `waiting` state which is exited upon
the block being broadcast from the sealing operation.
2024-01-10 17:12:15 +00:00
milen
0cfe6617db
devnet: fix infinite recursion & enable TestStateSync & TestCallContract integration tests (#9183)
This PR fixes an infinite recursion (stack overflow) error in devnet
integration tests that surfaced in our integration CI a week or more ago
and additionally enables some integration tests that are now fixed -
`TestStateSync` & `TestCallContract`.

![Screenshot 2024-01-09 at 17 10
24](https://github.com/ledgerwatch/erigon/assets/94537774/a5a8c9c9-9f68-4084-9e08-1bf3c1601cab)
2024-01-09 20:02:14 +00:00
battlmonstr
9c47cce62c
bor: move to polygon directory (#9174) 2024-01-09 19:20:42 +01:00
vuittont60
fec0c9eef5
docs: fix typos (#9173) 2024-01-09 15:34:47 +00:00
ledgerwatch
459ccf8de4
[E3] Some fixes for the in-memory database when working with Caplin (… (#9164)
…testing on Sepolia) (#9151)

---------

Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
2024-01-09 08:26:26 +07:00
Alex Sharov
36fefbbee1
downloader: verify fixempty (#9161) 2024-01-09 08:25:12 +07:00
Giulio rebuffo
b2fa618f74
Caplin: Fixed crash in OnAttestation (#9159)
* Added handling of AggregateAndProof
2024-01-08 17:13:25 +01:00
Dmytro
ff92b701c3
dvovk/updsync (#9134)
refactored data structure for sync statistics
2024-01-08 10:43:04 +01:00
Alex Sharov
2cbe8b7fe7
downloader: --verify --verify.files --verify.failfast support (#9156) 2024-01-08 16:01:02 +07:00
battlmonstr
ebe16d8360
bor: BorConfig setup fix (#9145)
A crash on startup happens on --chain=mumbai , because I've confused
chainConfig.Bor (from type chain.Config) and config.Bor (from type
ethconfig.Config) in the setup code.

ethconfig.Config.Bor property contained bogus values, and was used only
to check its type in CreateConsensusEngine(). Its value was never read
(before PR #9117).

This change removes the property to avoid confusion and fix the crash.

Devnet network.BorStateSyncDelay was implemented using
ethconfig.Config.Bor, but it wasn't taking any effect. It should be
fixed separately in a different way.
2024-01-05 20:03:19 +07:00
battlmonstr
b57cbdcff7
polygon/sync: canonical chain builder (#9117) 2024-01-04 10:44:57 +01:00
Giulio rebuffo
18baf81b78
Caplin: Fixed Invalid reading for historical states (#9124) 2024-01-03 23:26:56 +01:00
milen
b94ca6dc1c
devnet: fix ws port clash for state-sync scenario (#9125)
Getting an error in one of the bor nodes in devnet when trying to run
the "state-sync" scenario:
```
[EROR] [01-03|16:55:44.179] cli.StartRpcServer error                 err="could not start separate Websocket RPC api at port 8546: listen tcp 127.0.0.1:8546: bind: address already in use"
```

This happens for scenarios with more than 1 node.

Digging further this regressions has happened due to this change:
https://github.com/ledgerwatch/erigon/pull/8909

This PR fixes this by updating the devnet `NodeArgs` struct to set the
corresponding `--ws.port` `arg` tag which now exists.
2024-01-03 18:58:52 +00:00
umba
a645ef62a7
Update README.md (#9112)
Hi, I made three suggestions for this section:

- "devenet" should be "devnet" (typo).

- "are currently build" should be "are currently built" (grammatical
error).

- "sptep" should be "step" (typo).

Thanks.
2024-01-03 19:01:40 +07:00
ddl
a2274f36e5
chore(cmd/evm):fix link jump in cmd/evm/README.md (#9114)
fix the relative path in cmd/evm/README.md


![image](https://github.com/ledgerwatch/erigon/assets/24953789/058b0486-f8cf-4fa3-ad53-e01b5ea6f0c3)
2024-01-03 18:59:45 +07:00
Giulio rebuffo
3d10cee49b
Make Caplin work with Otterscan (#9115)
* Fixed mispelling in json fields
* Added CORS
2024-01-02 23:29:00 +01:00
Mark Holt
19bc328a07
Added db loggers to all db callers and fixed flag settings (#9099)
Mdbx now takes a logger - but this has not been pushed to all callers -
meaning it had an invalid logger

This fixes the log propagation.

It also fixed a start-up issue for http.enabled and txpool.disable
created by a previous merge
2023-12-31 17:10:08 +07:00
Giulio rebuffo
698ee60339
Beacon API: Added attestation rewards endpoint. (#9091) 2023-12-28 13:07:53 +01:00
Delweng
398bcb50a0
rpc: implement txpool_contentFrom (#9057)
implement the `txpool_contentFrom` rpc, used to retrieve the specified
address's tx contents.

---------

Signed-off-by: jsvisa <delweng@gmail.com>
2023-12-28 14:15:16 +07:00
Mark Holt
79ed8cad35
E2 snapshot uploading (#9056)
This change introduces additional processes to manage snapshot uploading
for E2 snapshots:

## erigon snapshots upload

The `snapshots uploader` command starts a version of erigon customized
for uploading snapshot files to
a remote location.  

It breaks the stage execution process after the senders stage and then
uses the snapshot stage to send
uploaded headers, bodies and (in the case of polygon) bor spans and
events to snapshot files. Because
this process avoids execution in run signifigantly faster than a
standard erigon configuration.

The uploader uses rclone to send seedable (100K or 500K blocks) to a
remote storage location specified
in the rclone config file.

The **uploader** is configured to minimize disk usage by doing the
following:

* It removes snapshots once they are loaded
* It aggressively prunes the database once entities are transferred to
snapshots

in addition to this it has the following performance related features:

* maximizes the workers allocated to snapshot processing to improve
throughput
* Can be started from scratch by downloading the latest snapshots from
the remote location to seed processing

## snapshots command

Is a stand alone command for managing remote snapshots it has the
following sub commands

* **cmp** - compare snapshots
* **copy** - copy snapshots
* **verify** - verify snapshots
* **manifest** - manage the manifest file in the root of remote snapshot
locations
* **torrent** - manage snapshot torrent files
2023-12-27 22:05:09 +00:00
Mark Holt
df0699a12b
Added sentry simulator implementation (#9087)
This adds a simulator object with implements the SentryServer api but
takes objects from a pre-existing snapshot file.

If the snapshot is not available locally it will download and index the
.seg file for the header range being asked for.

It is created as follows: 

```go
sim, err := simulator.NewSentry(ctx, "mumbai", dataDir, 1, logger)
```

Where the arguments are:

* ctx - a callable context where cancel will close the simulator torrent
and file connections (it also has a Close method)
* chain - the name of the chain to take the snapshots from
* datadir - a directory potentially containing snapshot .seg files. If
not files exist in this directory they will be downloaded
 *  num peers - the number of peers the simulator should create
 *  logger - the loger to log actions to

It can be attached to a client as follows:

```go
simClient := direct.NewSentryClientDirect(66, sim)
```

At the moment only very basic functionality is implemented:

* get headers will return headers by range or hash (hash assumes a
pre-downloaded .seg as it needs an index
* the header replay semantics need to be confirmed
* eth 65 and 66(+) messaging is supported
* For details see: `simulator_test.go

More advanced peer behavior (e.g. header rewriting) can be added
Bodies/Transactions handling can be added
2023-12-27 14:56:57 +00:00
Giulio rebuffo
eaf0348bd0
[Grindmas] Added tests to Beacon API, also fixed stuff. (#9074)
* Testing Beacon API
* Fixed sentinel code (a little bit)
* Fixed sentinel tests
* Added historical state support
* Fixed state-related endpoints (i was drunk when writing them)
2023-12-25 02:34:13 +01:00
Alex Sharov
77d32ccdc6
"downloader manifest": cmd to produce manifest.txt (#9067)
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
2023-12-24 07:32:21 +00:00
Giulio rebuffo
a4d7b6d33f
Switched Caplin snapshot format to ZSTD blinded blocks (#9058)
* Chunked format -> blinded
* LZ4 -> ZSTD
* Implemented parent block root support for history download
* Rationale: Allows to optimize GC collection easily on state
reconstruction and it allows to read fast attestations in historical
states reader
2023-12-23 15:56:35 +01:00
lupin012
6a83a91145
Add create access list test (#9062) 2023-12-23 21:38:47 +07:00
Bayram Guvanjov
a2f375c0b1
Add blocksByRange & blocksByRoot P2P rpc handlers (#8885)
This PR is ready to review. 

PR introduces `blocksByRange` and `blocksByRoot` P2P RPC methods
- `blocksByRange` - allows peers to request a range of blocks
- `blocksByRoot` - enables block requests using their root hashes(list
format)

Reference:
https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/p2p-interface.md#beaconblocksbyrange
2023-12-23 14:32:00 +01:00
Alex Sharov
657aafd5b7
allow erigon download .torrent from webseed by default (#9052) 2023-12-22 11:42:35 +07:00
Giulio rebuffo
0e18866ed9
Added fill-up with pre-existing API (#9042) 2023-12-21 17:49:40 +01:00
Alex Sharov
9eb9151be4
atomic CRUD for .torrent files (#9043) 2023-12-21 05:15:32 +00:00
Alex Sharov
4eecd8c86c
print_stages: bor snaps info (#9008) 2023-12-21 08:08:55 +07:00
Alex Sharov
7107cfed0f
snaps: stop merge to 500K and enjoy immutability (#9034) 2023-12-21 08:04:46 +07:00
battlmonstr
2760eeb961
polygon: astrid sync heimdall wrapper (#9017) 2023-12-20 16:48:37 +01:00
Giulio rebuffo
e75dc25181
Disabled caplin phase2 for Gnosis temporairly. (#9006)
Gnosis phase2 will be disabled until we get good snapshot automation.

* Just run it in "phase1" mode.
* Create jwt secret accordingly
2023-12-19 13:10:34 +01:00
Alex Sharov
1468317efd
erigon snapshots index: build bor indices (#9009) 2023-12-18 17:46:50 +07:00
a
a53b1d8b29
flip this inequality (#8904)
this is funny
2023-12-15 21:52:55 -06:00
Giulio rebuffo
eeb471d800
Added Finality_Checkpoints endpoint (#8979) 2023-12-15 02:27:27 +01:00
ddl
e018bb062a
cmd/evm:fix Env struct json tag (#8986)
use geth found this doc problem
https://github.com/ethereum/go-ethereum/pull/28635
2023-12-15 07:24:03 +07:00
Alex Sharov
d41d523050
Downloader: add ProhibitNewDownloads() (#8939)
"whitelisting" mechanism (list of files - stored in DB) - which
protecting us from downloading new files after upgrade/downgrade was
broken. And seems it became over-complicated with time.
I replacing it by 1 persistent flag inside downloader:
"prohibit_new_downloads.lock"
Erigon will turn downloader into this mode after
downloading/verification of first snapshots.


```
//Corner cases:
	// - Erigon generated file X with hash H1. User upgraded Erigon. New version has preverified file X with hash H2. Must ignore H2 (don't send to Downloader)
	// - Erigon "download once": means restart/upgrade/downgrade must not download files (and will be fast)
	// - After "download once" - Erigon will produce and seed new files
```

------
`downloader --seedbox` is never "prohibit new downloads"
2023-12-12 16:05:56 +07:00
Giulio rebuffo
24987878e4
Resumable beacon state reconstruction (#8918)
* Most of the PR changed files are extra and slightly more complicated
unit tests.
* Fixed Eth1DataVotes not inheriting genesis
* Fixed Attestations simulation using wrong slot when reconstructing
partecipation
* Fixed Copy() operation on BeaconState on Eth1DataVotes
* Used correct ListSSZ type for Eth1DataVotes and HistoricalSummaries
* Fixed wrong []uint64 deltas on empty slots
2023-12-11 14:07:57 +01:00
Alex Sharov
e006db6ed9
evm cli: no logs if --json (#8925) 2023-12-09 13:42:07 +07:00
Somnath
5987d4ef72
Enable superfluous ws.port flag to fix some Hive RPC tests (#8909)
### Context
**Websocket port flag**
Hive tests for RPC suite depend on the (geth) default 8546 port. So,
opening one more listener for this additional port if `ws.port` was
specified. This flag isn't used in Erigon, as it shares port with http
listener. Normally, one may not specify and it offers no other benefit.
2023-12-07 14:59:22 +04:00