Commit Graph

18180 Commits

Author SHA1 Message Date
Alex Sharov
5fb31ae95f
e3: release some e4 parts (#7628) 2023-06-02 10:35:26 +07:00
Alex Sharov
d56d867b4f
e3: move kvlist to erigon-lib (#7627) 2023-06-02 10:18:43 +07:00
Alex Sharov
3ccc7da2e6
e3: move kvlist to erigon-lib (#7626) 2023-06-02 09:52:12 +07:00
Alex Sharov
2278bf5bfc
e3: move kvlist to erigon-lib (#7625) 2023-06-02 09:51:16 +07:00
Alex Sharov
7c89afcb42
e3: add kvlist.push method (#7624) 2023-06-02 09:24:22 +07:00
Giulio rebuffo
8bc1fda4ea
Caplin: mutable public key for validator for 0 copy (#7622)
Co-authored-by: a <a@tuxpa.in>
2023-06-02 01:21:15 +02:00
Enrique Jose Avila Asapche
94276deaf6
Caplin: added tests (#7623)
Added CL tests to have test coverage over 60% in all files covered by
running ssh ./cl/coverage
2023-06-02 01:21:08 +02:00
Giulio rebuffo
d77f057cbc
removed state_encoding package from caplin (#7621) 2023-06-01 20:25:37 +02: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
d54f604f9d
fix nil ptr in close() (#7618) 2023-06-01 16:11:34 +07:00
Alex Sharov
4ddd2c365c
Downloader fix no race between .Download() and .Stats() (#7617)
It fixing 1 case: when erigon start from scratch 
- it did skip stage_snapshots because of race-condition and start
printing `Waiting for Consensus Layer...` logs for long time - but
actually Erigon just did download snapshots at this time and printed
wrong logs.
2023-06-01 16:04:10 +07:00
Alex Sharov
5c7da48331
blockReader: fix blockNum check logic (#7615) 2023-06-01 15:04:21 +07:00
Alex Sharov
5a60ebeca2
blocks retire: fix baseID logic (#7614) 2023-06-01 10:07:57 +07:00
ledgerwatch
b35950441d
[sentry] initiate eth66 protocol under eth67 (#7612)
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
2023-05-31 20:29:57 +01:00
ledgerwatch
d66f9ce51f
[devnet] fix logging (#7611)
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
2023-05-31 20:29:36 +01:00
ledgerwatch
f5bd806b84
[devnet] Remove dependency on rpctest (#7608)
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
2023-05-31 19:47:32 +01:00
Giulio rebuffo
c0042d570c
Added coverage checker for caplin packages (#7609) 2023-05-31 18:12:18 +02:00
Alex Sharov
0dc8e271a9
fix reset tx sequence value (#7606) 2023-05-31 16:06:09 +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
ledgerwatch
708ea9225d
[devnet tool] single request generator (#7600)
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
2023-05-29 20:35:45 +01:00
Manav Darji
eb98a0a5ad
PIP12: Implement time based StateSync confirmation delay (#7587)
This PR implements [PIP
12](https://github.com/maticnetwork/Polygon-Improvement-Proposals/blob/main/PIPs/PIP-12.md).
It introduces time based state sync confirmation delay and adds Indore
hard fork on polygon chains.

The corresponding PR on erigon-lib can be found here:
https://github.com/ledgerwatch/erigon-lib/pull/1002.
2023-05-29 21:08:43 +07:00
Martin Holst Swende
c042afb4af
cmd/evm: support batched statetest-mode (#7598)
This implements batched state-test exectution, similar to
https://github.com/ethereum/go-ethereum/pull/27318 .
Some speedtests, executing a state-test twice on current master takes
~4-5 seconds, and scales linerarly.
```
Doing 2 execs old style

real    0m8.185s
user    0m8.081s
sys     0m0.110s
```
Doing `100` executions on this PR -- a few seconds of ramp-up time, but
very quick execution after that :
```
Doing 100 execs v2

real    0m5.009s
user    0m4.560s
sys     0m0.508s
```
I also tested a version where I moved the db instantiation into the top
callsite, with the `MustOpen` and `.Close` only performed once, instead
of `100` times -- however, I noticed no additional speed gains from
doing so (my branch `batched_evm_v2`).

Therefore, I suspect that the slowdowns comes not from the db, but the
kzg library initialization.
2023-05-29 18:28:24 +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
Giulio rebuffo
027d83b556
Caplin: skip finalized error (#7595) 2023-05-28 22:48:17 +02:00
Giulio rebuffo
2d3b3c3b8d
Caplin: Proper validator set (#7591)
Adding proper flat buffer to Caplin
2023-05-28 17:11:18 +02:00
J1ang
5554ff34a6
feature: support generate parse transaction input bytes codes in abigen (#7593)
feature: support generate parse transaction input bytes codes in
`abigen`.


It's easy to use abigen to generate code that help you parse the event
log and call the payable method with the transactor.

But parsing the transaction call data is missing. You can only send a
transaction with a transactor. This PR aims to generate codes that help
developer parse transaction calldata.

abigen can generate code to parse the transaction call data.    

With this PR, transaction parse codes are generated like this:   

```go
// CollectParams is an auto generated read-only Go binding of transcaction calldata params
type CollectParams struct {
	Param_params INonfungiblePositionManagerCollectParams
}

// Parse Collect method from calldata of a transaction
//
// Solidity: function collect((uint256,address,uint128,uint128) params) payable returns(uint256 amount0, uint256 amount1)
func ParseCollect(calldata []byte) (*CollectParams, error) {
	if len(calldata) <= 4 {
		return nil, fmt.Errorf("invalid calldata input")
	}

	_abi, err := abi.JSON(strings.NewReader(UniswapABI))
	if err != nil {
		return nil, fmt.Errorf("failed to get abi of registry metadata: %w", err)
	}

	out, err := _abi.Methods["collect"].Inputs.Unpack(calldata[4:])
	if err != nil {
		return nil, fmt.Errorf("failed to unpack collect params data: %w", err)
	}

	var paramsResult = new(CollectParams)
	value := reflect.ValueOf(paramsResult).Elem()

	if value.NumField() != len(out) {
		return nil, fmt.Errorf("failed to match calldata with param field number")
	}

	out0 := *abi.ConvertType(out[0], new(INonfungiblePositionManagerCollectParams)).(*INonfungiblePositionManagerCollectParams)

	return &CollectParams{
		Param_params: out0,
	}, nil
}
```


Example of using `Parse` Function above:  


```go
package bin

import (
	"context"
	"fmt"
	"testing"

	"github.com/ledgerwatch/erigon/common/hexutil"
	"github.com/ledgerwatch/erigon/rpc"
	"github.com/ledgerwatch/log/v3"
)

func TestOnParse(t *testing.T) {
	cli, err := rpc.Dial("https://rpc.ankr.com/polygon", log.New(context.Background()))
	if err != nil {
		t.Fatal(err)
	}

	var collectTx struct {
		Input string `json:"input"`
	}
	err = cli.CallContext(context.Background(), &collectTx, "eth_getTransactionByHash", "0x741146cce64d873cfe82ade413651de355a6db92f992e5bfc4e1c58d92f5dd5b")
	if err != nil {
		t.Fatal(err)
	}

	var increaseLiquidityTx struct {
		Input string `json:"input"`
	}
	err = cli.CallContext(context.Background(), &increaseLiquidityTx, "eth_getTransactionByHash", "0x645ff650d7bfb9a74f573af474b9ebee48c3fadc7dac67257a8da6b55c71f338")
	if err != nil {
		t.Fatal(err)
	}

	fmt.Println(collectTx.Input)
	fmt.Println(increaseLiquidityTx.Input)

	collectBytes, _ := hexutil.Decode(collectTx.Input)

	increaseLiquidityBytes, _ := hexutil.Decode(increaseLiquidityTx.Input)

	collectInfo, err := ParseCollect(collectBytes)
	if err != nil {
		t.Fatal(err)
	}

	increaseLiquidityInfo, err := ParseIncreaseLiquidity(increaseLiquidityBytes)
	if err != nil {
		t.Fatal(err)
	}

	fmt.Printf("%+v\n", collectInfo)
	fmt.Printf("%+v\n", increaseLiquidityInfo)
}
```

Output of code above:  


&{Param_params:{TokenId:+894123
Recipient:0x48B8e4ed457da9B64c33Ee50Fd5490614833A37D
Amount0Max:+340282366920938463463374607431768211455
Amount1Max:+340282366920938463463374607431768211455}}
&{Param_params:{TokenId:+891904 Amount0Desired:+331092 Amount1Desired:+0
Amount0Min:+331092 Amount1Min:+0 Deadline:+1685112789}}
2023-05-28 21:11:21 +07:00
a
3c2b99e19c
[caplin] incremental improvements to p2p layer (#7582)
we update observability in the p2p layer for handlers, and also properly
encode error codes, close streams.

---------

Co-authored-by: Alex Sharov <AskAlexSharov@gmail.com>
Co-authored-by: Giulio <giulio.rebuffo@gmail.com>
2023-05-28 07:54:04 +07:00
Alex Sharov
3ec7d9b010
receipts: less allocs in DeriveFields, use blockReader, remove ReadReceiptsByHash, gasPriceOracle don't read block twice and use blockLru (#7592)
preparation for adding BlockID
2023-05-27 16:39:14 +07:00
Andrew Ashikhmin
14653bbda1
Fix Gnosis rewards in trace_block and trace_filter (#7580)
Follow-up to PR #7473
2023-05-26 13:14:58 +02:00
Alex Sharov
3b7c603974
go mod tidy (#7585) 2023-05-26 17:47:10 +07:00
Alex Sharov
94ceb6f6c5
nil ptr in test (#7586) 2023-05-26 17:46:50 +07:00
Alex Sharov
ead45694ff
torrent-related goroutine leack (#7545)
can't merge - because `torrent` lib dropped go1.19 support
2023-05-26 17:12:47 +07:00
Alex Sharov
279e1bec33
use blockReader as service-provider of RoSnapshots (#7584) 2023-05-26 17:12:33 +07:00
Alex Sharov
eafb12088c
fix backend nil ptr (#7583) 2023-05-26 13:09:42 +07:00
Alex Sharov
cfafa24481
tests for blocks snapshots creation data producer (#7579) 2023-05-25 14:58:31 +07:00
Andrew Ashikhmin
a47e49ced6
Fix fork ID test for Chiado (#7576)
Fix a test after PR #7575
2023-05-25 07:59:33 +02:00
Alex Sharov
111db5f655
blockReader in tests - step8 (#7578) 2023-05-25 12:46:11 +07:00
Alex Sharov
000dda6a37
blockReader in tests, step7 (#7574) 2023-05-25 10:56:59 +07:00
Andrew Ashikhmin
946b0e8207
Amend ShanghaiTime for Chiado (#7575)
Hotfix
2023-05-24 14:19:52 +02:00
Alex Sharov
a79033cef8
blockReader in tests, step6 (#7573) 2023-05-24 18:34:36 +07:00
Alex Sharov
0c399e5082
blockReader tests, step5 (#7572) 2023-05-24 17:41:24 +07:00
Alex Sharov
31687be599
blockReaders in tests, step4 (#7570) 2023-05-24 15:52:51 +07:00
alex.sharov
2181b6abfd Merge branch 'devel' of github.com:ledgerwatch/erigon into devel 2023-05-24 14:01:01 +07:00
alex.sharov
cb0434be87 block reader bodies test 2023-05-24 14:00:29 +07:00
Alex Sharov
179b138000
add blockReader to mining, blockchain_test (#7569) 2023-05-24 13:53:22 +07:00
Manav Darji
ad5974da96
consensus/bor: use current producers for extra data validation (#7564)
Fixes issues with consensus validation. Compare against current producer
set instead of whole validator set.
2023-05-24 12:57:31 +07:00
Andrew Ashikhmin
319e99e72a
Skip gas limit checks for chains with gas limit contract (#7567)
Dirty hack to fix Chiado until #7151 is properly implemented. Should fix
the following error:
```
[WARN] [05-23|17:07:39.303] Verification failed for header           hash=0x4eee718e5958a862746ea9a9531a16e6a404698d3a0e8120e8aff743b9f1e0a2 height=1 err="invalid gas limit: have 12500000, want 10000000 +-= 9764"
```
2023-05-23 22:14:18 +02:00