Commit Graph

4685 Commits

Author SHA1 Message Date
Alex Sharov
f28f97acc9
history_reader_v3: must always return accounts encoded as v3 (#7460) 2023-05-08 15:30:15 +07:00
Alex Sharov
231d128d91
e3: parallel exec docs (#7459) 2023-05-08 14:32:12 +07:00
racytech
36e70c545b
eip-4844: data gas fees & related check (#7449)
Logic to compute fees for data blobs as well as additional check that
verifies if user was willing to pay the current `data_gas` price.
Updated `FakeExponential` function to work with uint256.
2023-05-08 12:20:10 +07:00
Joe Netti
5a56b45b40
fix: erigon_getLatestLogs (#7450)
When calling erigon_getLatestLogs, I was getting a crash in
[erigon_receipts.go](beb97784d4/cmd/rpcdaemon/commands/erigon_receipts.go (L254)).
I think it is a simple indexing bug

```
[service.go:217 panic.go:884 panic.go:113 erigon_receipts.go:254 value.go:586 value.go:370 service.go:222 
handler.go:494 handler.go:444 handler.go:392 handler.go:223 handler.go:316 asm_amd64.s:1598]
[WARN] [05-05|21:13:59.749] Served                                   
conn=100.70.204.111:50141 method=erigon_getLatestLogs reqid=1 t=621.5936ms err="method handler crashed"
```
2023-05-08 11:54:17 +07:00
Giulio rebuffo
3b9636644d
fixed cache concurrency issue in BLS (#7455) 2023-05-07 14:38:44 +02:00
ledgerwatch
fdd385cef1
[Devnet tool] Side-quest to improve logging - part 1 (#7445)
This is the beginning of the series of changes to make it possible to
run multiple instances of erigon inside a single process (as devnet tool
does), with the logging from these processes going to respective log
files correctly.
This is the first part where the initial infrastructure is being
established

---------

Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
2023-05-07 07:28:15 +01:00
Giulio rebuffo
5b7643c57b
Added dencun networking (#7453) 2023-05-07 01:37:53 +02:00
Enrique Jose Avila Asapche
fbd18516ae
Deneb container changes beacon-chain (#7420)
Adding container changes for Deneb:
https://github.com/ethereum/consensus-specs/blob/dev/specs/deneb/beacon-chain.md

Changed to use pointers for BlobSideCar
 
 #7389
2023-05-06 18:50:58 +02:00
Andrew Ashikhmin
ac087d8ca5
[interfaces] Header mix_digest -> prev_randao (#7448)
Pick up https://github.com/ledgerwatch/interfaces/pull/169
2023-05-05 17:58:20 +02:00
Giulio rebuffo
9d443dd052
Caplin: fixed dereferencing (#7447) 2023-05-05 13:16:50 +02:00
Giulio rebuffo
43b09a7f55
Refactor of ssz interface (#7439)
Also added a better way to copy and the hasher
2023-05-05 11:19:24 +02:00
racytech
e751b9d219
eip-4844: minor additions (#7443) 2023-05-05 09:24:45 +07:00
0xMaxMa
9440126ddf
Add clique API, support "clique" option in --http.api flag (#6985)
* Enable the `clique` option in the `--http.api` flag.

* List of Clique commands:
`clique_getSnapshot(block number)`
`clique_getSnapshotAtHash(block hash)`
`clique_getSnapshotAtHash(block hash)`
`clique_getSigners(block number)`
`clique_getSignersAtHash(block hash)`
`clique_proposals()`
`clique_propose(signer address, bool)`
`clique_discard(signer address)`
`clique_status()`
Example:
`curl --data
'{"method":"clique_getSigners","params":[],"id":1,"jsonrpc":"2.0"}' -H
"Content-Type: application/json" -X POST http://localhost:8545`

* Please be careful while using the Clique API. Do not make the HTTP API
public on the Clique's signer node, as anyone can directly call a Clique
command. Instead, it should only be allowed in the localhost by using
the flag `--http.addr "127.0.0.1"`.
2023-05-05 09:20:40 +07:00
Roberto Bayardo
df124d4108
fix block rlp logging bug (#7441)
fixes a logging statement was logging the outer rpc proto instead of the
inner rlp of the block as intended
2023-05-05 09:16:43 +07:00
Alex Sharov
2a37cc8513
fix devel evm tests (#7444) 2023-05-05 09:16:13 +07:00
a
30430d585a
begin refactor of beacon state (#7433)
this first major move separates the transient beacon state cache from
the underlying tree.

leaf updates are enforced in the setters, which should make programming
easier.

all exported methods of the raw.BeaconState should be safe to call
(without disrupting internal state)

changes many functions to consume *raw.BeaconState in perparation for
interface


beyond refactor it also:

adds a pool for the leaves of the validator ssz hash 

adds a pool for the snappy writers
  
removed the parallel hash experiment (high memory use)
2023-05-04 15:18:42 +02:00
Alex Sharov
fe30cf8c6f
up urwafe and docker version (#7435) 2023-05-04 10:48:43 +07:00
Giulio rebuffo
0e0b12d68f
Added checkpoint states object to optimize memory consumption (#7429) 2023-05-03 10:51:39 +02:00
racytech
40947f6c98
eip-4844: adding data_gas to gaspool (#7428)
Adding `data_gas` to gas pool. EIP-4844 gas pool includes data_gas which
is used to fee blob transactions.
2023-05-03 09:02:30 +07:00
a
9644e6d220
Implement SpecTests in native go, add fork_choice handler (#7422)
a few TODO: remain to make this not a draft

---------

Co-authored-by: Giulio <giulio.rebuffo@gmail.com>
2023-05-02 16:19:22 +02:00
Giulio rebuffo
80d06bc385
Caplin: Fixed sentinel deadlock (#7419) 2023-05-01 23:32:00 +02:00
Andrew Ashikhmin
1533674dad
Implement EIP-1153 transient storage (#7405)
Port https://github.com/ethereum/go-ethereum/pull/26003

---------

Co-authored-by: Mark Tyneway <mark.tyneway@gmail.com>
2023-05-01 18:26:24 +02:00
naviechan
d475bab15f
Add diagnostics endpoint for flags (#7417)
To expose context flags through diagnostic endpoint
`/debug/metrics/flags`.

The current `/debug/metrics/cmdline` only provides the command run by
user. In the case when user runs Erigon using config file, `cmdline`’s
info does not truly reflect the ‘launch setting' and flags set that
Erigon is running on.

## Example

### Command
```
erigon --datadir /tmp/data --config test.yaml
```
### Pseudo config file (in yaml)
```
datadir : '/tmp/data'
chain : "sepolia"
http : true
metrics: true
private.api.addr : "localhost:9090"

http.api : ["eth","debug","net"]
```
### Output
```
SUCCESS
chain=sepolia
config=test.yaml
datadir=/tmp/data
http=true
http.api=eth,debug,net
metrics=true
private.api.addr=localhost:9090
```
2023-05-01 15:38:00 +01:00
Giulio rebuffo
cab15c9f2e
Caplin: Remotion of bad peers on request (#7414) 2023-04-30 22:24:42 +02:00
racytech
726ce264ef
eip-4844: RPCTransactions to support BlobTx (#7407)
Small additions to support eip-4844 transaction marshalling
2023-04-30 14:03:38 +07:00
racytech
f31d2b097d
eip-4844: Unwrap() additional tx method (#7410)
Transaction extension to support BlobTxWrapper (or network
representation of BlobTx). BlobTxWrapper wraps BlobTx with additional
data: blobs, commitments and proofs. Unwrap() returns unwrapped tx if
its network tx, otherwise returns itself.
2023-04-30 14:03:15 +07:00
Alex Sharov
4344136973
e3: rethink meaning of kv_temporal.BeginRw() (#7413) 2023-04-30 10:08:41 +07:00
Giulio rebuffo
250a0a4a65
Caplin: Remotion of bad peers giving us bad blocks (#7411) 2023-04-29 21:32:33 +02:00
Giulio rebuffo
8a3b9e6d17
Added caching for BLS affines (#7408)
Improved CPU usage by 10x, we just really avoid re-compressing and
re-validating public keys
2023-04-29 02:36:53 +02:00
racytech
631681ccfd
eip-4844: receipts to include dataGasPrice and dataGasUsed (#7385)
Small additions to block receipts. Now it includes `dataGasPrice` and
`dataGasUsed`. `dataGas` is a new type of a gas and blobs are priced in
it.
2023-04-28 17:53:43 +01:00
ledgerwatch
9b5b24a0b3
Fix lint (#7399)
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
2023-04-27 13:39:27 +01:00
Alex Sharov
ded8283df7
erigon backup: v0 of sub-command (#7396) 2023-04-27 10:42:12 +07:00
Jason Yellick
4e9b378a5d
Enable negative Merkle proofs for eth_getProof (#7393)
This addresses the last known deficiency of the eth_getProof
implementation. The previous code would return an error in the event
that the element was not found in the trie. EIP-1186 allows for
'negative' proofs where a proof demonstrates that an element cannot be
in the trie, so this commit updates the logic to support that case.

Co-authored-by: Jason Yellick <jason@enya.ai>
2023-04-27 10:38:45 +07:00
Alex Sharov
7b7b2fca0a
e3: drain when no new tasks causing deadlock (#7395) 2023-04-27 09:10:24 +07:00
Giulio rebuffo
01ce968361
Fixed networking issue in Caplin (#7388) 2023-04-26 14:33:21 +01:00
Jason Yellick
434ac76f79
Add additional trie proof testing (#7382)
This PR extends the function merged in #7337 to cover the proof
generation paths as well.

The first commit simply migrates the internal proof checking code from
the rpc `eth_getProof` test to be available externally exported under
`turbo/trie`. In the process, it translates the in place testing
assertions to return more normally as errors and adapts to use the
pre-existing trie node types which are defined slightly differently
(although this code is still intended only for testing purposes).

The second commit refactors the existing trie fuzzing tests from the
previous PR and adds new fuzzing tests for the proof generation. In
order to validate the proofs, these fuzzing tests fundamentally do two
things. Firstly, after bootstrapping the test (by seeding, and modifying
the db), for each key we compute the 'naive' proof utilizing the
existing code in `proof.go` and the in memory `trie.Trie` structure. The
`trie.Trie` code actually had a couple small bugs which are fixed in
this PR (not handling value nodes, and not honoring the `NewTestRLPTrie`
contract of pre-RLP encoded nodes in proof generation). Secondly, we
re-compute the same proof for the flatDB production variant, and verify
that it is exactly the same proof as computed by the naive
implementation.

This fuzzing has been run for ~72 hours locally with no errors. Although
this code hasn't identified any new bugs in the proof generation path,
it improves coverage and should help to prevent regressions. Additional
extensions will be provided in a subsequent PR.

---------

Co-authored-by: Jason Yellick <jason@enya.ai>
2023-04-26 09:33:46 +07:00
Alex Sharov
ca088bd68e
fix build of cli flags (#7377) 2023-04-24 17:47:23 +07:00
Alex Sharov
c5e7b07de5
custom cli flags - move to own package (#7376) 2023-04-24 13:31:52 +07:00
racytech
6588bca40b
eip-4844: NewMessage now expectes maxFeePerDataGas & GetPayloadV3 impl (#7365)
types.NewMessage now expects maxFeePerDataGas param, which will be used
in transaction verification (preCheck). GetPayloadV3 method added to
EngineAPI. Some cosmetic changes applied.
2023-04-23 18:27:05 +01:00
Alex Sharov
74e08e197d
e3: remove files when no readers (#7370) 2023-04-23 11:55:16 +07:00
alex.sharov
f3aefe2fc0 set default db.size.limit to 7gb (as it was before) 2023-04-23 11:28:09 +07:00
Alex Sharov
e1f549ff01
cli: use SplitAndTrim instead of strgings.Split(",") (#7369) 2023-04-23 10:54:55 +07:00
Alex Sharov
d7d7af3b86
p2p: reduce verbosity of NetworkIdMissmatchErr and EOF (because likely we can't do anything about it and user can't) (#7368) 2023-04-23 10:41:46 +07:00
rekyyang
d6986ad6d3
trace_filter: support Mode == intersection (#7345) 2023-04-21 09:28:42 +07:00
alexqrid
db51dd5f02
trace_block: add new gasBailOut parameter to request (default: false) (#7326)
**Problem**
While tracing the block with Parity tracer(`trace_block`) it returns
error for a few blocks.
<details><summary>Example of blocks that couldn't be traced</summary>

These are the example of payloads with the errors occured during tracing
the blocks:
1. `{"method":"trace_block","params":["0x24165bd"],"id":0}` - `first run
for txIndex 32 error: insufficient funds for gas * price + value:
address 0x000005D814d5abD6e0F9345c9b1f37C82Eaf1EBb have
547961731687102852 want 675024999764675175`
2. `{"method":"trace_block","params":["0x2658753"],"id":0}` - `first run
for txIndex 45 error: insufficient funds for gas * price + value:
address 0x000004BeDC012a5D043270AF67de24c20a3b8aeB have
211658993830905595 want 235579381558610848`
3. `{"method":"trace_block","params":["0x258b00c"],"id":0} -first run
for txIndex 274 error: insufficient funds for gas * price + value:
address 0xA3a762006D22806B35895f4C0599bAe3adF1B349 have
342048586356638524 want 386865441635818752`

</details>

After looking through the
[trace_filtering.go](https://github.com/ledgerwatch/erigon/blob/devel/cmd/rpcdaemon/commands/trace_filtering.go#L1006)
and
[trace_adhoc.go](https://github.com/ledgerwatch/erigon/blob/devel/cmd/rpcdaemon/commands/trace_adhoc.go#L1072)
noticed that `doCallMany` called with `gasBailOut = true` in
[one](https://github.com/ledgerwatch/erigon/blob/devel/cmd/rpcdaemon/commands/trace_adhoc.go#L1072)
place and `gasBailOut = false` in
[another](https://github.com/ledgerwatch/erigon/blob/devel/cmd/rpcdaemon/commands/trace_filtering.go#L1006)
(actually the part of the code that is called by `trace_block`.
Changing its value to `true` fixed the problem and traces are successful
with this change.
Attaching the partial result of the successful trace below.


<details><summary>{"method":"trace_block","params":["0x24165bd"],"id":0}</summary>

```json
{
  "jsonrpc": "2.0",
  "id": 0,
  "result": [
    {
      "action": {
        "from": "0x3eaf7de168a79c1d6a1aab8c106e42b6f4e0a7c8",
        "callType": "call",
        "gas": "0x30464",
        "input": "0x0000000100000000000000000000000000000000000000000000000000000001dcbde73f0000000000000000000000000000000000000000000002086b35cd47c9189dc02791bca1f2de4661ed88a30c99a7a9449aa841740d500b1d8e8ef31e21c99d1db9a6444d3adf12700001f4000000000000000000000f490d8e000000000000",
        "to": "0x1d36f9688cceafee9d7df45fe8e24884ed0d6730",
        "value": "0x0"
      },
      "blockHash": "0x96f0792349a67b7995dda853df79bd5fa9d2926eb2ac8a07ac46e4df429632af",
      "blockNumber": 37840317,
      "error": "Reverted",
      "result": {
        "gasUsed": "0x1d2d",
        "output": "0x08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000056572723332000000000000000000000000000000000000000000000000000000"
      },
      "subtraces": 1,
      "traceAddress": [],
      "transactionHash": "0x1417cab7ae635884117909cc828474df0121d4a2a0ad033f462e6fa84bfab176",
      "transactionPosition": 0,
      "type": "call"
    },
    {
      "action": {
        "from": "0x1d36f9688cceafee9d7df45fe8e24884ed0d6730",
        "callType": "staticcall",
        "gas": "0x2e9b7",
        "input": "0x3850c7bd",
        "to": "0xa374094527e1673a86de625aa59517c5de346d32",
        "value": "0x0"
      },
      "blockHash": "0x96f0792349a67b7995dda853df79bd5fa9d2926eb2ac8a07ac46e4df429632af",
      "blockNumber": 37840317,
      "result": {
        "gasUsed": "0xa88",
        "output": "0x000000000000000000000000000000000000000000000f49c33e3991750050fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffbc158000000000000000000000000000000000000000000000000000000000000096d00000000000000000000000000000000000000000000000000000000000009c400000000000000000000000000000000000000000000000000000000000009c400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001"
      },
      "subtraces": 0,
      "traceAddress": [
        0
      ],
.....
      },
      "blockHash": "0x96f0792349a67b7995dda853df79bd5fa9d2926eb2ac8a07ac46e4df429632af",
      "blockNumber": 37840317,
      "result": null,
      "subtraces": 0,
      "traceAddress": [],
      "type": "reward"
    }
  ]
}

```

</details>

---------

Co-authored-by: alexqrid <>
2023-04-21 09:28:04 +07:00
Giulio rebuffo
ec8cdd4701
Refactore fork choice to RR approach (#7359) 2023-04-20 22:47:58 +02:00
Jason Yellick
7f31b047f1
Fix eth_getProof element order (#7351)
According to EIP-1186 the `proof` parts of the response to eth_getProof
should be returned "starting with the stateRoot-Node, following the path
of the SHA3 (address) as key." Currently, the proof is returned in
traversal order, rather than from the root.

Although all of the proof elements are there and correct, this is
contrary to the EIP and will cause problems for some clients. The
existing rpc test uses a map to lookup proof elements by hash, rather
than by index, so this bug was not initially caught.

This commit fixes the behavior, updates the existing test, and adds
additional checks to the rpc test.

Co-authored-by: Jason Yellick <jason@enya.ai>
2023-04-20 10:06:19 +07:00
Giulio rebuffo
f8f1658f8d
added deep copy to BeaconState copy (#7352)
Before caches were recomputed, now caches are not recomputed anymore for
BeaconStates internals
2023-04-19 22:56:24 +02:00
Giulio rebuffo
2ce5e761bb
added --internalcl flag to Erigon (#7349) 2023-04-19 14:37:35 +02:00
Alex Sharov
b23a0267d3
e3: deadlock fix part2 (#7344) 2023-04-19 08:12:13 +00:00