Commit Graph

17039 Commits

Author SHA1 Message Date
Alex Sharov
daf2867194
e3: Recon heap mem leak (#6203) 2022-12-05 08:42:26 +07:00
Giulio rebuffo
6e76643c09
Added Handshake protocol to Erigon-CL Lightclient and Fullclient (#6206) 2022-12-05 01:25:12 +01:00
Alex Sharov
e3085f9290
e3: experiment with btree "path hint" (#6158) 2022-12-04 18:15:28 +07:00
Alex Sharov
4ffd50c716
hashers to use sync.pool (#6200)
for https://github.com/ledgerwatch/erigon/issues/6195
2022-12-04 17:23:44 +07:00
Alex Sharov
7e6a177eec
e3: recon speedup (#6201) 2022-12-04 16:11:24 +07:00
Alex Sharov
60802ebc78
evm: one pointer is enough (#6198) 2022-12-04 12:40:03 +07:00
Nicolas Gotchac
961a0070cc
Fix trace error in Polygon | Pass Engin to the Base API (#6131)
So there is an issue with tracing certain blocks/transactions on
Polygon, for example:
```
> '{"method": "trace_transaction","params":["0xb198d93f640343a98f90d93aa2b74b4fc5c64f3a649f1608d2bfd1004f9dee0e"],"id":1,"jsonrpc":"2.0"}'
```
gives the error `first run for txIndex 1 error: insufficient funds for
gas * price + value: address 0x10AD27A96CDBffC90ab3b83bF695911426A69f5E
have 16927727762862809 want 17594166808296934`

The reason is that this transaction is from the author of the block,
which doesn't have enough ETH to pay for the gas fee + tx value if he's
not the block author receiving transactions fees.

The issue is that currently the APIs are using `ethash.NewFaker()`
Engine for running traces, etc. which doesn't know how to get the author
for a specific block (which is consensus dependant); as it was noting in
several TODO comments.

The fix is to pass the Engine to the BaseAPI, which can then be used to
create the right Block Context. I chose to split the current Engine
interface in 2, with Reader and Writer, so that the BaseAPI only
receives the Reader one, which might be safer (even though it's only
used for getting the block Author).
2022-12-04 12:17:39 +07:00
Alex Sharov
63b88c7d16
use crypto pool (#6197) 2022-12-04 11:59:02 +07:00
Alex Sharov
c401a2e9d2
e3: experiment with Ibs.Reset (#6159) 2022-12-04 11:45:06 +07:00
Alex Sharov
82c7779a85
evm: txContext.gasPrice to uint256 type (#6188) 2022-12-04 11:44:50 +07:00
Håvard Anda Estensen
31ec791d5a
Avoiding leaking the popped item (#6193)
Set the deleted item to its zero val so it can be garbage collected.
2022-12-04 11:17:02 +07:00
Håvard Anda Estensen
099fb7c627
Grow string builders (#6192)
Strings builders have a buffer (slice) that can be pre-allocated
2022-12-04 10:51:20 +07:00
Alex Sharov
0efda1f19f
trace: change type of self destruct arg to uint256 (#6189) 2022-12-03 21:43:53 +07:00
a
007234b489
allow rpcdaemon to bind to tcp (#6184)
this pr adds CLI flag to allow the rpcdaemon to bind to a TCP port.

this is very useful if one wants to maintain a remote connection with
the rpcdaemon without using websocket. This is useful because a lot of
issues come with the websocket protocol (compression, max size, etc).
TCP socket gets around these things (it is just raw json over tcp
stream)

the rpc package already supports this, it was just a matter of adding
the bind.

try `echo
'{"jsonrpc":"2.0","method":"eth_blockNumber","id":"1","params":[""]}' |
nc localhost 8548` as a basic test

to test. Subscriptions are also working (idk how to send keepalives with
netcat)

the default rpc.(*Client).Dial method does not support TCP. I have not
included that in this PR. The code for such is as follow

```
// DialTCP create a new TCP client that connects to the given endpoint.
//
// The context is used for the initial connection establishment. It does not
// affect subsequent interactions with the client.
func DialTCP(ctx context.Context, endpoint string) (*Client, error) {
	parsed, err := url.Parse(endpoint)
	if err != nil {
		return nil, err
	}
	ans := make(chan *Client)
	errc := make(chan error)
	go func() {
		client, err := newClient(ctx, func(ctx context.Context) (ServerCodec, error) {
			conn, err := net.Dial("tcp", parsed.Host)
			if err != nil {
				return nil, err
			}
			return NewCodec(conn), nil
		})
		if err != nil {
			errc <- err
			return
		}
		ans <- client
	}()
	select {
	case err := <-errc:
		return nil, err
	case a := <-ans:
		return a, nil
	case <-ctx.Done():
		return nil, ctx.Err()
	}
}

// DialContext creates a new RPC client, just like Dial.
//
// The context is used to cancel or time out the initial connection establishment. It does
// not affect subsequent interactions with the client.
func DialContext(ctx context.Context, rawurl string) (*Client, error) {
	u, err := url.Parse(rawurl)
	if err != nil {
		return nil, err
	}
	switch u.Scheme {
	case "http", "https":
		return DialHTTP(rawurl)
	case "ws", "wss":
		return DialWebsocket(ctx, rawurl, "")
	case "tcp":
		return DialTCP(ctx, rawurl)
	case "stdio":
		return DialStdIO(ctx)
	case "":
		return DialIPC(ctx, rawurl)
	default:
		return nil, fmt.Errorf("no known transport for URL scheme %q", u.Scheme)
	}
}


```

let me know if you would like me to add this to the PR as well. the TCP
connection can then be established with `rpc.Dial("tcp://host:port")`
2022-12-03 14:22:47 +07:00
alex.sharov
8108085012 fix integration merge conflict 2022-12-03 13:38:57 +07:00
Alex Sharov
ded79088e9
remove code of exeriments (#6187) 2022-12-03 13:04:09 +07:00
Alex Sharov
f9c8d556a5
log experiment enabling (#6186) 2022-12-03 12:56:44 +07:00
alex.sharov
9d1eec8cb3 fix integration merge conflict 2022-12-03 12:38:04 +07:00
Alex Sharov
9b65c533c9
e3: optimize incremental hashstate (#6179) 2022-12-03 12:23:01 +07:00
hexoscott
09a01bc6a0
txpool to pull blocks of transactions until no gas remains for the block (#6160)
Moving the txpool transaction pull into the execution phase and looping
until the gas is used up or the txpool runs dry.

Removed the concept of local vs remote transactions as comments/code
showed this split was no longer in use.

Created a `PreparedTxs` collection to satisfy the use case in the
integration tool when mining is active.

Untested locally as I have no way of mining/validating currently.

Co-authored-by: Alex Sharov <AskAlexSharov@gmail.com>
2022-12-03 12:20:47 +07:00
Giulio rebuffo
1fd3a01edf
Added Consensus Layer staged sync (#6183) 2022-12-03 03:16:26 +01:00
alex.sharov
5e36c9fb5f save 2022-12-02 21:01:43 +07:00
Alex Sharov
76bd23d46d
mdbx: print some logs about settings (#6181) 2022-12-02 20:57:31 +07:00
alex.sharov
bae905b573 save 2022-12-02 18:41:36 +07:00
Alex Sharov
c7c445e167
e3: reset without race (#6177) 2022-12-02 11:46:25 +07:00
Alex Sharov
509a8d9b50
e3: reset table (#6176) 2022-12-02 09:17:05 +07:00
Alex Sharov
5f5a9c23cd
e3: support of --snap.stop (#6175) 2022-12-02 09:03:29 +07:00
Giulio rebuffo
cea51685fe
attempt at fixing lightclient performance leaks (#6169) 2022-12-02 00:21:33 +01:00
Mike Neuder
3a8c9ccdb3
Add state transition function and unit test. (#6170)
Part of https://github.com/ledgerwatch/erigon/issues/5965

See
https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#beacon-chain-state-transition-function.
2022-12-01 20:57:41 +01:00
Alex Sharov
08469bf5dc
e3: fix dao test (#6173) 2022-12-01 15:32:10 +07:00
Andrew Ashikhmin
d82c778ab3
Withdrawals part 1 (#6009)
This PR partially implements
[EIP-4895](https://eips.ethereum.org/EIPS/eip-4895): Beacon chain push
withdrawals as operations. The new Engine API methods
(https://github.com/ethereum/execution-apis/pull/195) are implemented.

_Body downloader and saving withdrawals into DB are not implemented
yet!_
2022-12-01 09:15:01 +01:00
Alex Sharov
fd3c44f6e1
e3: fix dao integration test (#6171) 2022-12-01 14:42:39 +07:00
alex.sharov
5d9e74d39c save 2022-12-01 13:47:35 +07:00
Mike Neuder
d3d65f6caa
Add verify block signature function and unit test (#6166)
Part of https://github.com/ledgerwatch/erigon/issues/5965

See
https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#beacon-chain-state-transition-function.
2022-11-30 22:50:00 +01:00
Giulio rebuffo
a8ac42f429
updated bls and erigon-lib (#6164) 2022-11-30 14:13:17 +01:00
Alex Sharov
cb8f609dc0
e3: fix nil ptr bsc (#6162) 2022-11-30 18:24:42 +07:00
Andrew Ashikhmin
400ad1ab09
Update EIP-3860 according to ethereum/EIPs/pull/6040 (#6161)
See https://github.com/ethereum/EIPs/pull/6040 &
https://github.com/ethereum/tests/pull/1105
2022-11-30 12:19:16 +01:00
Giulio rebuffo
87520f60e3
added MPT storage dumps (#6153) 2022-11-30 10:53:58 +01:00
Alex Sharov
81b438a6e2
e3: option to discard all history writes. useful to test execution performance. (#6157) 2022-11-30 16:06:53 +07:00
alex.sharov
948b325062 save 2022-11-30 14:59:08 +07:00
Alex Sharov
61ebb61e96
up grafana (#6156) 2022-11-30 11:14:25 +07:00
Alex Sharov
0f53bd9e93
grpc version up (#6155) 2022-11-30 09:16:02 +07:00
alex.sharov
f238620fdf save 2022-11-30 08:47:09 +07:00
Alex Sharov
85212b4774
bsc: more static peers (#6150) 2022-11-30 08:36:29 +07:00
Alex Sharov
7239387de0
fix devel build (#6154) 2022-11-30 08:35:31 +07:00
Alex Sharov
60cb4e2bbb
evm tracing interface to use uint256, to avoid value.ToBig() allocations (#5781) 2022-11-30 08:31:39 +07:00
Alex Sharov
16cd87748f
E3: fix unwind changes visibility (#6147) 2022-11-30 08:31:13 +07:00
Giulio rebuffo
ae6d00747e
removed debug util now not necessary (#6149) 2022-11-29 09:46:52 +01:00
J1ang
83dae8dad3
feat: enhance API erigon_getLatestLogs (#6078)
feat:
1. `erigon_getLatestLogs` doesn't have to match the exact position of
the topics. It will match logs that contain the topics regardless of the
topics' position with original bloom filter. And it accepts `blockCount`
& `crit.ToBlock` params for better pagination.
2022-11-29 15:14:41 +07:00
Manav Darji
80e29f29d3
sprint length and base fee denominator change for mumbai testnet (#6142)
This PR includes changes required for delhi hard fork schedule at block
`29638656` on mumbai testnet. It changes few major parameters.

1. Sprint length - the number of bor blocks post which a new validator
mines has been reduced from 64 to 16.
2. Block time - the block time which was increased earlier for some
experiments to 5 seconds has been reduced to 2 seconds (along with
backup multiplier and producer delay).
3. Base fee denominator - this fields has been increased from 8 to 16 to
smoothen the effect of EIP 1559.
2022-11-29 08:11:29 +07:00