Commit Graph

16994 Commits

Author SHA1 Message Date
lupin012
a442293be1
ChainId conditional in Legacy transaction (#5856)
impacted API:
     eth_getTransactionByHash()
     eth_getTransactionByNumber()
     eth_getTransactionByBlockHashAndIndex()
     eth_getTransactionByBlockNumberAndIndex()
     eth_getBlockByHash()
     eth_getBlockByNumber()

1) In case of legacy transitions the chainId field should be inserted
only if V is not 27/28.
This seems also the Geth/v1.10.23 behaviour via infura

2) In case of dynamicFee/AccessList transaction the access_list should
be inserted in the response also if empty
This is done correctly in cmd/rpcdaemon/commands/eth_api.go and NOT in
internal/ethapi/api.go
This seems also the Geth/v1.10.23 behaviour via infura
2022-11-18 03:15:32 +03:00
lupin012
8ceb1638a0
add totalDifficulty to GetBlockByTimestamp (#5827)
Added totalDifficulty to the returned response to be similar to the data
returned by eth_getBlockByNumber() or eth_getBlockByHash()
2022-11-18 03:15:00 +03:00
lupin012
21d24a20a0
fix on number of samples for blocks (#5826)
eth_gasPrice(): A maximum of 3 samples should be taken per block (see
sample const)
The getBlockPrices() function takes 3 samples on the first block and one
on the others.
In the check s.Len() >= limit s.Len() after first block will contain 3
samples and so the loop will be executed only one time for each block
NOT three times
2022-11-18 03:14:49 +03:00
Alex Sharov
4509f496c6
bsc: new blocks snapshots (#6075) 2022-11-18 03:09:07 +03:00
Nathan (Blaise) Bruer
ca89620e56
SendMessageToRandomPeers() now is truely pseudo-random (#6050)
Fixes an issue where if the peer count didn't change much, we'd send the
message to the same peers nearly every time.

We now pick new random peers on every call to
SendMessageToRandomPeers().
2022-11-18 02:44:43 +03:00
Enrique Jose Avila Asapche
a4b9da9bd4
fixed nil ptr err (#6035)
The from field would sometimes be nil causing an error when trying to
access it, instead changed it to be an empty address #5882
2022-11-18 02:43:22 +03:00
Manav Darji
1da4d3abbf
eth, consensus/bor: fixes and improvements related to mining (#6051)
In context of https://github.com/ledgerwatch/erigon/issues/5694, this PR
adds some fixes and improvement in the mining flow. Also, a relevant
change in txpool (present in erigon-lib) is made here:
https://github.com/ledgerwatch/erigon-lib/pull/737

#### Changes in triggering mining in `startMining()`
The mining module didn't honour the block time as a simple 3 second
timer and a notifier from txpool was used to trigger mining. This would
cause inconsistencies, at least with the bor consensus. Hence, a geth
like approach is used instead for simplicity. A new head channel
subscription is added in the `startMining()` loop which would notify the
addition of new block. Hence, this would make sure that the block time
is being honoured. Moreover, the fixed 3 second timer is replaced by the
`miner.recommit` value set using flags.

####  Changes in the arrangement of calls made post mining
When all the mining stages are completed, erigon writes all the data in
a cache. It then processes the block through all the stages as it would
process a block received from P2P. In this case, some of the stages
aren't really required. Like the block header and body download stage is
not required as the block was mined locally. Even execution stage is not
required as it already went through it in the mining stages.

Now, we encountered an issue where the chain was halted and kept mining
the same block again and again (liveness issue). The root cause is
because of an error in a stage of it's parent block. This stage turns
out to be the 4th stage which is "Block body download" stage. This stage
tries to download the block body from peers using the headers. As, we
mined this block locally we don't really need to download anything (or
process anything again). Hence, it reaches out to the cache which we
store for the block body.

Interestingly that cache turned out to be empty for some blocks. This
was because post mining, before adding block header and body to a cache,
we call the broadcast method which starts the staged sync. So,
technically it’s a bit uncertain at any stage if the block header and
body has been written or not.(see
[this](https://github.com/ledgerwatch/erigon/blob/devel/eth/backend.go#L553-L572)).
To achieve complete certainty, we rearranged the calls with the write to
cache being called first and broadcast next. This pretty much solves the
issue as now we’re sure that we’d always have a block body in the cache
when we reach the body download stage.

#### Misc changes
This PR also adds some logs in bor consensus.
2022-11-18 02:39:16 +03:00
Mark Shields
0d854fea6e
feat(k8s): base with google-kubernetes-engine overlay example (#6041)
re:
https://discord.com/channels/687972960811745322/738982866670714901/1041381487754354689

Introduces a more modular base with a google-kubernetes-engine overlay
example.
2022-11-18 02:37:53 +03:00
Alex Sharov
874d96fb47
e3: Non parallel exec (with exec in RO goroutine) (#6073) 2022-11-17 20:52:12 +03:00
Alex Sharov
c50d4e6c0b
e3: panic logging (#6072) 2022-11-17 16:17:02 +03:00
Alex Sharov
d5c23c4df4
e3: enable test (#6071) 2022-11-17 16:06:57 +03:00
Alex Sharov
04293ef67a
Revert "e3: more mainnet snapshots" (#6069)
Reverts ledgerwatch/erigon#6068
2022-11-17 06:20:58 +03:00
Alex Sharov
17541b26da
e3: more mainnet snapshots (#6068) 2022-11-17 06:15:53 +03:00
Alex Sharov
66e1dc2dfd
better format p2p error (#6066) 2022-11-16 19:46:25 +03:00
Alex Sharov
591c2c5ff4
e3: disalbe ci test (#6064) 2022-11-16 19:12:02 +03:00
Giulio rebuffo
7ea8de4a3f
added checkpoint saving (#6060) 2022-11-16 16:19:40 +01:00
Alex Sharov
e7a3c0789a
Disable ci3 (#6063) 2022-11-16 15:53:46 +03:00
Alex Sharov
30bf54ebf2
disable ci3 (#6062) 2022-11-16 15:49:32 +03:00
Alex Sharov
93926646f8
e3: prepare downloader for extraction (#6061) 2022-11-16 15:48:23 +03:00
Alex Sharov
7d034d0c79
e3: fix stuck exec after recon (#6059) 2022-11-16 14:22:49 +03:00
Alex Sharov
7957e69773
mdbx: configure merge threshold (#6057) 2022-11-16 09:44:34 +03:00
alex.sharov
bfda9bc731 save 2022-11-16 09:43:56 +03:00
Nebojsa Urosevic
44f909767d
Feat: add eth_exitst endpoint (#5992)
Feat: add `eth_exists` endpoint.

By introducing this endpoint, Erigon will fully enable remote execution
for pre-EIP158 blocks.
2022-11-16 07:12:52 +03:00
Andrew Ashikhmin
d9f342bb43
Restore MigrateFlags (#6055)
Another postfix to PR #6047. This fixes `--datadir` flag passed to
`erigon init`. See also
https://github.com/ethereum/go-ethereum/pull/24751.
2022-11-15 21:38:31 +01:00
Giulio rebuffo
3a2d3be080
Added persistence in LightClient (#6056) 2022-11-15 20:39:18 +01:00
Alex Sharov
242b5a76df
e3: fix doneCount variable (#6053) 2022-11-15 18:03:10 +03:00
Andrew Ashikhmin
ec9db8662c
Fix command line help (#6052)
Postfix after PR #6047.
2022-11-15 12:03:06 +01:00
Andrew Ashikhmin
14c0643476
Enable both eth/66 and eth/67 by default (#6048) 2022-11-15 10:41:56 +01:00
Andrew Ashikhmin
32629bdce4
Upgrade urfave/cli to v2 (#6047)
See also
https://github.com/urfave/cli/blob/main/docs/migrate-v1-to-v2.md
2022-11-14 17:33:57 +01:00
Andrew Ashikhmin
8152d5c7e4
txpool: sync.Mutex instead of RWMutex (#6045)
Pick up https://github.com/ledgerwatch/erigon-lib/pull/735
2022-11-14 12:24:14 +01:00
Giulio rebuffo
ae01026ca9
Customizable networking for Erigon Lightclient (#6032) 2022-11-11 23:22:47 +01:00
Andrew Ashikhmin
5b3f2b8c5f
Update interfaces (#6031)
Pick up
813d816908
& https://github.com/ledgerwatch/interfaces/pull/131.
2022-11-11 17:16:39 +01:00
ledgerwatch
5fc2ec4b52
Enable snapshot creation for Gnosis Chain (#6030)
Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
2022-11-11 15:38:59 +00:00
Max Revitt
74308f2500
fix(test): eliminate race conditions (#6019) 2022-11-11 15:22:09 +00:00
Andrew Ashikhmin
09c5e4699b
Fix panic("durations cannot be empty") (#6029) 2022-11-11 15:24:58 +01:00
Andrew Ashikhmin
04e3a18463
Block difficulty can be really big on Gnosis Chain (#6028)
For example, see https://gnosisscan.io/block/24938312.

This fixes the following errors:
```
t=2022-11-11T12:39:01+0000 lvl=dbug msg="Handling incoming message" stream=RecvMessage err="newBlock66: too large block difficulty: bitlen 128"
t=2022-11-11T12:39:01+0000 lvl=dbug msg="Handling incoming message" stream=RecvMessage err="newBlock66: too large block difficulty: bitlen 128"
t=2022-11-11T12:39:01+0000 lvl=dbug msg="Handling incoming message" stream=RecvMessage err="newBlock66: too large block difficulty: bitlen 128"
```
2022-11-11 15:24:46 +01:00
Alex Sharov
c21a266236
Allow bigger jumps in 1 RwTx - for consistency (#6026) 2022-11-11 16:30:28 +07:00
Alex Sharov
90952c4110
e3: wal ram configure (#6023) 2022-11-11 11:28:22 +07:00
ledgerwatch
de26ccf6f6
Try non-parallel tests (#6021)
Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
2022-11-10 23:47:35 +00:00
ledgerwatch
14906fec17
Bump version (#6020) 2022-11-10 22:18:01 +00:00
Giulio rebuffo
f8916e9226
Made Lightclient default (#5813)
lightclient cl is default, for external cl, run `--externalcl`
2022-11-10 17:06:04 +00:00
hexoscott
ea1edf4a11
trace json error fix (#6014)
write trace transaction errors to json and continue
2022-11-10 15:37:16 +00:00
hexoscott
475fa08fdf
eth_gasPrice performance tweaks (#6016)
Code news up an oracle for every call so existing cache checks always
came back as 0. Moved cache up a layer and pass in via the new
`gasprice.Cache` interface. Looked at putting the oracle instance onto
the ethApi itself to re-use it that way, but the backend transaction
made it a little hard work as we can't re-use that. This seemed cleaner
but happy to take feedback.

Locally takes me from ±2.5k rps to ±43k rps so quite a difference there.
(k6 with 1000 virtual users)
2022-11-10 15:36:04 +00:00
Mike Neuder
bf34bed004
Adding GetStatus to the req/resp domain (#6010)
Part of https://github.com/ledgerwatch/erigon/issues/5884 defined in the
spec
https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/p2p-interface.md#status.

We need this functionality to continue
https://github.com/ledgerwatch/erigon/issues/5965 because we need to
determine how many blocks to request from the checkpoint block.
2022-11-10 14:14:26 +01:00
Andrew Ashikhmin
424f38a9b6
AuRa: iterate over durations in order (#6013)
Iteration order over go maps is random.
2022-11-10 13:47:57 +01:00
ledgerwatch
7f12b809ec
Improvements to the downloader (#6012)
Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
2022-11-10 10:33:10 +00:00
ledgerwatch
00365ba6e8
Move anchor state logging into DEBUG (now that we redirect it to a file) (#6007) 2022-11-09 12:00:30 +00:00
Alex Sharov
6b0f7fa913
e3: recon reduce ram (#6004) 2022-11-09 14:32:44 +07:00
Alex Sharov
57db64b692
e3: fix coinbase 2 (#6006) 2022-11-09 13:53:07 +07:00
Alex Sharov
906953b246
e3: fix coinbase (#6005) 2022-11-09 13:48:23 +07:00