Commit Graph

18426 Commits

Author SHA1 Message Date
jack meng
d370ea7ac2
fixed bitmap performance when write index (#7986)
Here is my case:

writeIndex function takes about 39% in pprof flame graph. I dive into it
and find out that we use POA consensus, therefore mining addresses have
a big bitmap.

```
func writeIndex(blocknum uint64, changes *historyv2.ChangeSet, bucket string, changeDb kv.RwTx) error {
	buf := bytes.NewBuffer(nil)
	for _, change := range changes.Changes {
		k := dbutils.CompositeKeyWithoutIncarnation(change.Key)
		index, err := bitmapdb.Get64(changeDb, bucket, k, math.MaxUint32, math.MaxUint32)
		if err != nil {
			return fmt.Errorf("find chunk failed: %w", err)
		}
		index.Add(blocknum)
		if err = bitmapdb.WalkChunkWithKeys64(k, index, bitmapdb.ChunkLimit, func(chunkKey []byte, chunk *roaring64.Bitmap) error {
			buf.Reset()
			if _, err = chunk.WriteTo(buf); err != nil {
				return err
			}
			return changeDb.Put(bucket, chunkKey, common.CopyBytes(buf.Bytes()))
		}); err != nil {
			return err
		}
	}
	return nil
}
```
assume that a mining address has a big bitmap (Cardinality 400000), then
"writeIndex" will split it into 300 small bitmaps according to
”ChunkLimit“ and next time "writeIndex" will union all small bitmaps
into a big bitmap, then use binary search to split it into 300 small
bitmaps. over and over again.

I think blockNum > index.Maximum(), so that we only need get the last
one of 300 small bitmaps .

Co-authored-by: mengweifu <75886642@qq.com>
2023-08-13 02:07:43 +06:00
Alex Sharov
d0ce7380aa
up 'x' packages versions (#8005) 2023-08-12 11:58:32 +06:00
Giulio rebuffo
de5706dbc6
Direct sentinel instead of over the network sentinel (#8006) 2023-08-12 01:54:45 +02:00
Giulio rebuffo
7c0d6e15bb
Added gnosis fields and removed body gap. (#7993) 2023-08-11 23:07:36 +02:00
Alex Sharov
c464d84334
tmpdb: move to tmpdir (#8003) 2023-08-12 01:06:15 +06:00
Andrew Ashikhmin
e377cea51d
Fix CopyTxs for BlobTxWrapper (EIP-4844) (#8002) 2023-08-11 20:30:02 +02:00
dependabot[bot]
8809a4acd3
Bump github.com/supranational/blst from 0.3.10 to 0.3.11 (#7988)
Bumps
[github.com/supranational/blst](https://github.com/supranational/blst)
from 0.3.10 to 0.3.11.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/supranational/blst/releases">github.com/supranational/blst's
releases</a>.</em></p>
<blockquote>
<h2>Release v0.3.11</h2>
<p>Essential changes:</p>
<ul>
<li>security bugfix in Go bindings</li>
<li>run-time switch in portable build</li>
<li>no-std support [exercised with limited stack size of 56K]</li>
<li>serde support</li>
<li>blst_miller_loop_n interface, with parallelized Rust and Go
counterparts</li>
<li>optional blst_fr_pentaroot subroutine</li>
<li>Emscripten bindings</li>
<li>hardened security on non-asm platforms</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="3dd0f804b1"><code>3dd0f80</code></a>
bindings/rust/Cargo.toml: bump the version number.</li>
<li><a
href="fb91221c91"><code>fb91221</code></a>
bindings/go/blst.go: fix logical error in SigValidate.</li>
<li><a
href="c6a3cc00ca"><code>c6a3cc0</code></a>
build.sh: don't pass -mno-avx unless actually required.</li>
<li><a
href="9fa8bcfb93"><code>9fa8bcf</code></a>
vect.h: tolerate compilation with -std=cNM flag.</li>
<li><a
href="5aa7ce1d6f"><code>5aa7ce1</code></a>
bindings/&lt;swig-based&gt;/*: minimize dynamic library symbol
pollution.</li>
<li><a
href="e1a44c97c0"><code>e1a44c9</code></a>
build.sh: drop --version-script linker argument.</li>
<li><a
href="492319a8c0"><code>492319a</code></a>
cpuid.c: adjust symbol visibility.</li>
<li><a
href="6dd7aa4ed9"><code>6dd7aa4</code></a>
Execute build/refresh.sh.</li>
<li><a
href="701e42a70b"><code>701e42a</code></a>
asm/ct_*: add missing .hidden directives.</li>
<li><a
href="dce883beb4"><code>dce883b</code></a>
Execute build/refresh.sh.</li>
<li>Additional commits viewable in <a
href="https://github.com/supranational/blst/compare/v0.3.10...v0.3.11">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=github.com/supranational/blst&package-manager=go_modules&previous-version=0.3.10&new-version=0.3.11)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/ledgerwatch/erigon/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-11 16:23:54 +02:00
Andrew Ashikhmin
f854a73185
Add enough blob gas for block building (EIP-4844) (#8001) 2023-08-11 16:09:03 +02:00
Andrew Ashikhmin
03927d3e27
Call InitializeBlockExecution in SpawnMiningExecStage (EIP-4788) (#7999)
This fixes the trie state root issue that was occurring in the Hive
tests for Cancun.
2023-08-11 14:04:53 +02:00
Andrew Ashikhmin
6adad0afde
Add parentBeaconBlockRoot to RPCMarshalHeader (EIP-4788) (#7997) 2023-08-11 10:26:44 +02:00
Alex Sharov
d2bde8c096
Recsplit: cancelable build (#7994) 2023-08-11 11:54:59 +06:00
alex.sharov
7ca6649e0c BlockReader: remove redundant check 2023-08-11 11:45:02 +06:00
Giulio rebuffo
e3a59ed902
Better caplin logging and logic (#7992) 2023-08-10 22:34:58 +02:00
Alex Sharov
6dfe491d30
e3: remove history snapshots (#7991) 2023-08-10 23:39:03 +06:00
dependabot[bot]
11f9137c08
Bump github.com/libp2p/go-libp2p from 0.28.0 to 0.28.2 (#7987)
Bumps [github.com/libp2p/go-libp2p](https://github.com/libp2p/go-libp2p)
from 0.28.0 to 0.28.2.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/libp2p/go-libp2p/releases">github.com/libp2p/go-libp2p's
releases</a>.</em></p>
<blockquote>
<h2>v0.28.2</h2>
<p>This patch release contains backports of:</p>
<ul>
<li>updating the qtls dependencies (qtls is quic-go's fork of
crypto/tls). The new versions now contain a backport of the Go standard
library fix included in the Go 1.20.7 / 1.19.12 release for quic-go's
crypto/tls fork: <a
href="2350afd2e8</a></li>
<li>core/crypto: restrict RSA keys to &lt;= 8192 bits: <a
href="https://redirect.github.com/libp2p/go-libp2p/pull/2454">libp2p/go-libp2p#2454</a>.
The analogous vulnerability in go-libp2p's crypto package.</li>
<li>swarm: don't open new streams over transient connections: <a
href="https://redirect.github.com/libp2p/go-libp2p/pull/2450">libp2p/go-libp2p#2450</a>.
This fixes a regression introduced in v0.26.0.</li>
</ul>
<p>Note that in order to be protected against the DoS attack making use
of large RSA keys, it's necessary to update to this patch release AND to
use the updated Go compiler (1.20.7 or 1.19.12, respectively).</p>
<p>Full Changelog: <a
href="https://github.com/libp2p/go-libp2p/compare/v0.28.1...v0.28.2">https://github.com/libp2p/go-libp2p/compare/v0.28.1...v0.28.2</a></p>
<h2>v0.28.1</h2>
<h2>What's Changed</h2>
<ul>
<li>fix: in the swarm move Connectedness emit after releasing conns <a
href="https://redirect.github.com/libp2p/go-libp2p/pull/2373">libp2p/go-libp2p#2373</a></li>
<li>identify: set stream deadlines for Identify and Identify Push
streams <a
href="https://redirect.github.com/libp2p/go-libp2p/pull/2382">libp2p/go-libp2p#2382</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/libp2p/go-libp2p/compare/v0.28.0...v0.28.1">https://github.com/libp2p/go-libp2p/compare/v0.28.0...v0.28.1</a></p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/libp2p/go-libp2p/blob/master/CHANGELOG.md">github.com/libp2p/go-libp2p's
changelog</a>.</em></p>
<blockquote>
<h1>Table Of Contents <!-- raw HTML omitted --></h1>
<ul>
<li><a
href="https://github.com/libp2p/go-libp2p/blob/master/#v0280">v0.28.0</a></li>
<li><a
href="https://github.com/libp2p/go-libp2p/blob/master/#v0270">v0.27.0</a></li>
<li><a
href="https://github.com/libp2p/go-libp2p/blob/master/#v0264">v0.26.4</a></li>
<li><a
href="https://github.com/libp2p/go-libp2p/blob/master/#v0263">v0.26.3</a></li>
<li><a
href="https://github.com/libp2p/go-libp2p/blob/master/#v0262">v0.26.2</a></li>
<li><a
href="https://github.com/libp2p/go-libp2p/blob/master/#v0261">v0.26.1</a></li>
<li><a
href="https://github.com/libp2p/go-libp2p/blob/master/#v0260">v0.26.0</a></li>
<li><a
href="https://github.com/libp2p/go-libp2p/blob/master/#v0251">v0.25.1</a></li>
<li><a
href="https://github.com/libp2p/go-libp2p/blob/master/#v0250">v0.25.0</a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="256b838b55"><code>256b838</code></a>
release v0.28.2</li>
<li><a
href="cd68d43cbc"><code>cd68d43</code></a>
swarm: don't open new streams over transient connections (<a
href="https://redirect.github.com/libp2p/go-libp2p/issues/2450">#2450</a>)</li>
<li><a
href="71a4e3e70f"><code>71a4e3e</code></a>
manually bump qtls dependencies to fix RSA key size vulnerability</li>
<li><a
href="445be526ae"><code>445be52</code></a>
core/crypto: restrict RSA keys to &lt;= 8192 bits (<a
href="https://redirect.github.com/libp2p/go-libp2p/issues/2454">#2454</a>)</li>
<li><a
href="c358b81919"><code>c358b81</code></a>
release v0.28.1</li>
<li><a
href="f43f73e0c3"><code>f43f73e</code></a>
identify: set stream deadlines for Identify and Identify Push streams
(<a
href="https://redirect.github.com/libp2p/go-libp2p/issues/2382">#2382</a>)</li>
<li><a
href="7e046ce38a"><code>7e046ce</code></a>
fix: in the swarm move Connectedness emit after releasing conns (<a
href="https://redirect.github.com/libp2p/go-libp2p/issues/2373">#2373</a>)</li>
<li>See full diff in <a
href="https://github.com/libp2p/go-libp2p/compare/v0.28.0...v0.28.2">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=github.com/libp2p/go-libp2p&package-manager=go_modules&previous-version=0.28.0&new-version=0.28.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/ledgerwatch/erigon/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-09 18:24:51 +02:00
racytech
6785ff28e4
hive: minor fixes (EIP-4788) (#7985) 2023-08-09 13:44:21 +06:00
a
db5b348673
Caplin block persistence (#7941)
Co-authored-by: Giulio <giulio.rebuffo@gmail.com>
2023-08-09 01:21:19 +02:00
Mark Holt
6bd58f7c39
check difficulty for nil (#7978)
Fix checks `chainConfig.TerminalTotalDifficulty` for nil in
`isChainPoS`. Not doing so causes the Bor startup flow to panic.
2023-08-08 22:26:59 +01:00
Giulio rebuffo
6081fe01b8
fixed forkchoices (#7983) 2023-08-08 22:56:16 +02:00
Andrew Ashikhmin
72e7cda960
Disable TestBlockchainEIP with e3 (#7982)
as it doesn't work with e3 for some reason. Follow up to RP #7981
2023-08-08 21:11:22 +02:00
Andrew Ashikhmin
9b3f3bd118
EIP-4844: fix wiring of maxFeePerBlobGas (#7981)
Previously maxFeePerBlobGas was lost in the `BlobTx` -> `Message`
conversion.

Also added initial support of [EL
EIPTests](https://github.com/ethereum/tests/tree/develop/EIPTests).
2023-08-08 17:44:02 +02:00
Andrew Ashikhmin
ae76df1b8a
Update execution-spec-tests to v1.0.1 (#7980)
[v1.0.1](https://github.com/ethereum/execution-spec-tests/releases/tag/v1.0.1)
"Cancun Devnet-8 Pre-Release" adds some tests for Cancun. This PR only
fixes a couple of issues; the majority of the new tests are still
failing and thus are skipped in `TestExecutionSpec`.
2023-08-08 15:01:35 +02:00
Alex Sharov
23270eae58
tests: fix nil genesis panic (#7979) 2023-08-08 15:19:08 +06:00
Andrew Ashikhmin
a25f22a06c
Implement EIP-6780: SELFDESTRUCT only in same transaction (#7976)
Cherry pick https://github.com/ethereum/go-ethereum/pull/27189

---------

Co-authored-by: jwasinger <j-wasinger@hotmail.com>
2023-08-06 17:48:11 +02:00
Giulio rebuffo
e3d642d6a0
Fixed EL integration spectest (#7975) 2023-08-06 17:13:36 +02:00
Andrew Ashikhmin
d69b20bc4e
Support engine_forkchoiceUpdatedV3 with ParentBeaconBlockRoot (EIP-4788) (#7969)
Prerequisites: https://github.com/ledgerwatch/interfaces/pull/187 &
https://github.com/ledgerwatch/erigon-lib/pull/1069. Also implement
https://github.com/ethereum/execution-apis/pull/426.
2023-08-06 11:54:14 +02:00
Giulio rebuffo
b4057da8e6
removed missingHash (#7973) 2023-08-06 02:28:18 +02:00
banteg
63ecbf88ba
fix: show stack for push0 (#7970)
this fixes vmtrace after shanghai

before:
```python
VMOperation(pc=24, cost=2, ex=VMExecutedOperation(used=1942085, push=[], mem=None, store=None), sub=None, op='PUSH0', idx='14-644-13')
```

after:
```python
VMOperation(pc=24, cost=2, ex=VMExecutedOperation(used=1942085, push=[HexBytes('0x00')], mem=None, store=None), sub=None, op='PUSH0', idx='14-644-13')
```
2023-08-05 23:37:51 +02:00
Giulio rebuffo
0e4e36b142
Replaced old version of Engine API with newer version (#7972) 2023-08-05 23:33:10 +02:00
Giulio rebuffo
9730cc796a
Cleanup of consensus separation (#7971) 2023-08-05 02:26:53 +02:00
Giulio rebuffo
b09d90ee0e
Added in-memory flushing to execution.proto (#7968) 2023-08-04 14:42:35 +02:00
Giulio rebuffo
c08aa3ac03
fix undownloaded body (#7966) 2023-08-04 02:22:07 +02:00
Andrew Ashikhmin
d014da4dc0
Replace --override.shanghaiTime flag with --override.cancun (#7964)
Prerequisite: https://github.com/ledgerwatch/erigon-lib/pull/1067
2023-08-03 16:05:35 +02:00
racytech
2c2ccb6e27
dencun-devnet: --trusted-setup-file flag support (#7963) 2023-08-03 14:36:47 +02:00
Giulio rebuffo
29935a65f4
Fixed hive tests in consensus separation (#7961) 2023-08-03 03:39:47 +02:00
Andrew Ashikhmin
bd9e8b9b56
Fix eth_getTransactionByHash for EIP-4844 transactions (#7960)
Also pick https://github.com/ledgerwatch/erigon-lib/pull/1063 and
https://github.com/ledgerwatch/erigon-lib/pull/1065
2023-08-02 18:25:15 +02:00
Andrew Ashikhmin
e1f1c081fc
Remove failing TestGnosisForkDigest (#7959)
I'm not sure what caused this failure (for instance, CI for PR #7888 was
green), but currently we have the following test failure in `devel`:
```
--- FAIL: TestGnosisForkDigest (0.00s)
    fork_test.go:79: 
            Error Trace:    github.com/ledgerwatch/erigon/cl/fork/fork_test.go:79
            Error:          Not equal: 
                            expected: [4]uint8{0x82, 0x4b, 0xe4, 0x31}
                            actual  : [4]uint8{0x21, 0xa6, 0xf8, 0x36} 
```
2023-08-02 14:07:34 +02:00
Somnath Banerjee
5ddf122a19
Zero ParentBeaconBlockRoot in genesis (#7958)
See https://github.com/ethereum/EIPs/pull/7445
2023-08-02 17:02:01 +05:30
Andrew Ashikhmin
50579425d2
Introduce VerifyAbsenceOfCancunHeaderFields (#7953) 2023-08-02 09:34:30 +02:00
Somnath Banerjee
3e5b9d7490
Fix newPayload parentBeaconBlockRoot check (#7955) 2023-08-02 09:34:13 +02:00
오웬
3c62adcfe0
fix: prevent index out of range during call trace (#7951)
Previously the call tracer failed on this Ethereum transaction
[0xecfc724f75e39fa9e882ec44a4d0985e099b7a3ac9415466196128770def5bc2](https://etherscan.io/tx/0xecfc724f75e39fa9e882ec44a4d0985e099b7a3ac9415466196128770def5bc2)

Querying with this request
```shell
curl  http://localhost:8545  -X POST  -H "Content-Type: application/json"  --data '{"method":"debug_traceTransaction","params":["0xecfc724f75e39fa9e882ec44a4d0985e099b7a3ac9415466196128770def5bc2", {"tracer": "callTracer",  "tracerConfig": {"withLog": true}}],"id":1,"jsonrpc":"2.0"}
```

Resulted in this response
```json
{"jsonrpc":"2.0","id":1,"result":null,"error":{"code":-32000,"message":"method handler crashed"}}
```

With this error message in the console:
`RPC method debug_traceTransaction crashed: runtime error: index out of
range [-1]
[service.go:217 panic.go:884 panic.go:113 call.go:177 interpreter.go:234
interpreter.go:262 evm.go:55 evm.go:260 evm.go:303 instructions.go:800
interpreter.go:304 evm.go:55 evm.go:260 evm.go:283
state_transition.go:382 state_transition.go:186 tracing.go:206
tracing.go:263 value.go:584 value.go:368 service.go:222 handler.go:511
handler.go:444 handler.go:392 handler.go:223 handler.go:316
asm_arm64.s:1172]`
2023-08-02 08:09:28 +07:00
Andrew Ashikhmin
e4612fd6e6
EIP-4788: set nonce of beacon root history address to nonzero (#7952)
See https://github.com/ethereum/EIPs/pull/7431
2023-08-01 16:15:12 +02:00
Somnath Banerjee
d91f4263dc
EIP-4788: Beacon block root and stateful precompile (#7888) 2023-08-01 16:01:26 +05:30
Giulio rebuffo
1220ae659e
Most hive tests fixed in --experimental.modular (#7950)
Broken: 25/109
2023-08-01 02:08:15 +02:00
Andrew Ashikhmin
7ca0d2399a
Upgrade EL tests to v12.3 (#7949)
See https://github.com/ethereum/tests/releases/tag/v12.3
2023-07-31 12:30:53 +02:00
Andrew Ashikhmin
03ac80ad2d
EIP-4844: rename "data hash" to "blob hash" (#7947)
See https://github.com/ethereum/EIPs/pull/7001
2023-07-31 10:12:53 +02:00
Giulio rebuffo
443757edbd
Consensus separation for Engine API (Working on Sepolia) (#7945)
This makes the experimental consensus separation functional on sepolia.
2023-07-30 23:35:55 +02:00
Andrew Ashikhmin
5693439521
EIP-4844: Verify expectedBlobVersionedHashes (#7946)
See the
[engine_newpayloadv3](https://github.com/ethereum/execution-apis/blob/main/src/engine/cancun.md#engine_newpayloadv3)
spec
2023-07-30 17:10:54 +02:00
Andrew Ashikhmin
1776d28bb7
Fix TestBlobTxWrappedEncodeDecode (#7944)
Post-fix to PR #7943
2023-07-30 15:56:26 +02:00
racytech
af884204cb
eip-4844: hive tests: RLP decode order and newPayloadV3 to expect versionedHashes (#7943) 2023-07-30 15:49:31 +02:00