Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gnosis Shutter #7414

Merged
merged 368 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
368 commits
Select commit Hold shift + click to select a range
a6f92d6
use constants instead of specprovider txsource
Marchhill Jul 11, 2024
a7e7442
hardcode 10s block age cutoff
Marchhill Jul 11, 2024
1c23031
p2p logging shutter
ak88 Jul 16, 2024
ebdccb7
log when keys arrive
ak88 Jul 16, 2024
d48e8a0
configurable build window
ak88 Jul 17, 2024
e8c1a15
small changes
ak88 Jul 17, 2024
145ad61
Make slot seen thread safe
ak88 Jul 17, 2024
78f0dad
removed unneccesary
ak88 Jul 17, 2024
89f63dc
just use lock
ak88 Jul 17, 2024
7c6172b
delete for now
ak88 Jul 17, 2024
84a82e3
fix
ak88 Jul 17, 2024
4e2d707
wait inside tx source for keys
ak88 Jul 18, 2024
51554a9
cleanup Shutter improvements
Marchhill Jul 18, 2024
40f3899
use payload timestamp
Marchhill Jul 19, 2024
ad93543
optimse log fetching
Marchhill Jul 19, 2024
ef49ee1
remove unused stuff from chiado spec provider
Marchhill Jul 19, 2024
b2d1e26
merge master
Marchhill Jul 19, 2024
582e848
remove IsNullOrEmpty
Marchhill Jul 19, 2024
e1e15af
new wait pattern
ak88 Jul 26, 2024
f895392
Preparation service can wait for keys in shutter
ak88 Jul 27, 2024
23e853d
err msg
ak88 Jul 29, 2024
1a3e5a2
timestamp fix
ak88 Jul 29, 2024
d35b21e
slot calc fix
ak88 Jul 30, 2024
d035275
p2p race condition fix
ak88 Jul 30, 2024
1281569
increase no msg in p2p
ak88 Jul 30, 2024
0575310
calculate current time
ak88 Jul 30, 2024
d23bc4a
handle slot not started
ak88 Jul 30, 2024
a7e10a4
refactor
ak88 Jul 30, 2024
67b397c
shutter adjustments
ak88 Jul 31, 2024
4184302
minor refactors
Marchhill Jul 31, 2024
b463958
start key wait task
Marchhill Jul 31, 2024
d5677f8
don't keep improving block
Marchhill Jul 31, 2024
1062492
convert payload timestamp to ms to compare to genesis
Marchhill Jul 31, 2024
3d2f1ad
check cache first in wait
ak88 Jul 31, 2024
202a048
fix slot length, hardcode to gnosis
Marchhill Aug 1, 2024
6a80bfb
Merge branch 'feature/shutter-producer-wait' of github.com:Nethermind…
Marchhill Aug 1, 2024
d9da66e
rename option to MaxKeyDelay
Marchhill Aug 1, 2024
f13de6a
slotLength use totalMilliseconds
Marchhill Aug 1, 2024
22a9a9f
fix slot offset overflow
Marchhill Aug 1, 2024
841f625
make slot offset short
Marchhill Aug 1, 2024
660eceb
fix short
Marchhill Aug 1, 2024
404557d
use cancellation token for key timeout
Marchhill Aug 1, 2024
5191df4
add cancelation source to waitForTransactions
Marchhill Aug 1, 2024
55956dc
temp add logs
Marchhill Aug 1, 2024
07650ac
throw cancelled exception on wait cancel
Marchhill Aug 1, 2024
ba3a8c1
try setting taskcompletionsource exception for key wait task
Marchhill Aug 1, 2024
8dc0be3
add logs to key wait task
Marchhill Aug 2, 2024
7aa5c8c
don't check highest loaded slot
Marchhill Aug 2, 2024
bb1f137
key received offset log
Marchhill Aug 2, 2024
a355882
refactor waiting for transactions, allow longer offsets
Marchhill Aug 2, 2024
e34682c
remove syncobject
Marchhill Aug 2, 2024
1d4a066
fix logs
Marchhill Aug 2, 2024
4fced6f
small refactors in auramergeplugin
Marchhill Aug 2, 2024
242d75e
merge shutter-producer-wait
Marchhill Aug 2, 2024
9874417
merge master
Marchhill Aug 2, 2024
fdbc698
initial shutter plugin
Marchhill Aug 5, 2024
f5e70c9
correct plugin name
Marchhill Aug 5, 2024
9451d08
refactor Shutter config
Marchhill Aug 5, 2024
eeb0218
add back txSource lock
Marchhill Aug 5, 2024
35cc3b6
refactor new head block handling
Marchhill Aug 5, 2024
3e24b58
initial event collector
Marchhill Aug 5, 2024
4ce4b72
load log transactions to cache
Marchhill Aug 6, 2024
bed1803
add lock, track txIndex, improve logging
Marchhill Aug 6, 2024
98a5ac9
check block number
Marchhill Aug 6, 2024
67624f0
receipts cache
Marchhill Aug 7, 2024
f44f7f9
rename to loadfromreceipts
Marchhill Aug 7, 2024
55168c5
filter outdated Shutter events collected when keys missed
Marchhill Aug 7, 2024
4acd4bc
Merge remote-tracking branch 'upstream/master' into feature/gnosis-sh…
Marchhill Aug 7, 2024
aeee60b
set to txPointer+1 if nothing loaded from logs
Marchhill Aug 7, 2024
d8193a7
clearer logs and variable names
Marchhill Aug 7, 2024
3228d4b
fix typo
Marchhill Aug 7, 2024
4e22859
refactor as IConsensusWrapperPlugin
Marchhill Aug 8, 2024
b9cc828
move block improvement context factory to api
Marchhill Aug 8, 2024
90fcae5
fix Shutter plugin loading
Marchhill Aug 8, 2024
4d1dc90
use receipt finder
Marchhill Aug 8, 2024
6f6b2fd
fix typo
Marchhill Aug 8, 2024
75d11dd
merge event collector
Marchhill Aug 8, 2024
83a58f1
merge shutter plugin refactor
Marchhill Aug 8, 2024
3741d1b
whitespace fix
Marchhill Aug 8, 2024
74128b6
remove unnecessary logging condition
Marchhill Aug 8, 2024
b2ac600
isinfo
Marchhill Aug 8, 2024
e119f58
fix shutter plugin to use block handler
Marchhill Aug 8, 2024
7b636f4
remove loaded tx hash filter
Marchhill Aug 9, 2024
c75e225
comment reminders
Marchhill Aug 9, 2024
84da5da
Merge remote-tracking branch 'upstream/master' into feature/gnosis-sh…
Marchhill Aug 9, 2024
ed1a03d
lukasz comments
Marchhill Aug 12, 2024
effed37
rename LoggersAddress to Address
Marchhill Aug 12, 2024
06c34e9
finish replace LoggerAddress with Address
Marchhill Aug 12, 2024
9c3ffaa
add block improvement logs
Marchhill Aug 12, 2024
b982540
wait for block to load transaction
Marchhill Aug 12, 2024
9bf6472
decrease up to date block cutoff
Marchhill Aug 12, 2024
011e73a
wait in previous slot for block
Marchhill Aug 12, 2024
1c67bce
Merge remote-tracking branch 'upstream/master' into feature/gnosis-sh…
Marchhill Aug 12, 2024
795c003
add validated keys type
Marchhill Aug 12, 2024
8869f38
fix block timestamp by changing to ms
Marchhill Aug 12, 2024
d578c0a
fix multiple key validations, add locks
Marchhill Aug 12, 2024
ac7b98c
add logs for debugging
Marchhill Aug 13, 2024
7933545
try decreasing Shutter plugin priority
Marchhill Aug 13, 2024
b7914f7
revert plugin priorities, set api block producer in Shutter plugin
Marchhill Aug 13, 2024
0b07165
try wrapping BlockProducerEnvFactory
Marchhill Aug 13, 2024
01b0560
remove api block producer check
Marchhill Aug 13, 2024
9444e3d
block producer env logging
Marchhill Aug 13, 2024
5d526aa
try alt approach of adding txsource to blockproducer
Marchhill Aug 13, 2024
4723242
cleanup block production fix
Marchhill Aug 13, 2024
9c5d3e0
Merge remote-tracking branch 'upstream/master' into feature/gnosis-sh…
Marchhill Aug 13, 2024
86f9c87
cleanup and improve keepImproving
Marchhill Aug 13, 2024
1c0d3c0
fix head block number of 0
Marchhill Aug 13, 2024
98ec32c
log scanning / fetch to debug logs
Marchhill Aug 13, 2024
3c14a6e
don't retry block production if keys arrived first time
Marchhill Aug 13, 2024
5008b6e
increase block cutoff
Marchhill Aug 13, 2024
8cc955f
increase up to date cutoff more
Marchhill Aug 13, 2024
f2d8444
fix block up to date check
Marchhill Aug 13, 2024
61f6dec
move blssigner from Shutter
Marchhill Aug 14, 2024
de74968
add test package to nuget config
Marchhill Aug 14, 2024
912f535
update bls bindings package
Marchhill Aug 14, 2024
b3597da
Merge remote-tracking branch 'upstream/master' into feature/bls-sig
Marchhill Aug 14, 2024
0bf69eb
add bls tests from Shutter
Marchhill Aug 14, 2024
40065a7
improve tests, pass args by ref
Marchhill Aug 14, 2024
473188a
fix whitespace
Marchhill Aug 14, 2024
da55aa5
Merge remote-tracking branch 'upstream/master' into feature/bls-sig
Marchhill Aug 14, 2024
27713bd
start fixing unit tests
Marchhill Aug 15, 2024
434be24
fix whitespace
Marchhill Aug 15, 2024
d03e277
improve tests, tx loading tests
Marchhill Aug 16, 2024
4d5217e
improve load_transactions test
Marchhill Aug 16, 2024
9e83fd7
shutter event emitter
Marchhill Aug 16, 2024
001c473
finish tx loader can_load test, refactor tx filtering, remove some in…
Marchhill Aug 19, 2024
551b782
maintain slot to block hash mapping instead of blocks
Marchhill Aug 19, 2024
79bd991
Merge remote-tracking branch 'upstream/master' into feature/gnosis-sh…
Marchhill Aug 19, 2024
b996317
Merge branch 'feature/gnosis-shutter' into feature/shutter-tests
Marchhill Aug 19, 2024
d4503df
refactor and add to tx loader tests
Marchhill Aug 19, 2024
96d8fb2
cleanup and remove unused highest slot
Marchhill Aug 20, 2024
8b8093b
add block handler test, refactor shutter time, test common
Marchhill Aug 20, 2024
9ed3caf
refactor Shutter to use API
Marchhill Aug 20, 2024
078f831
use api in tests
Marchhill Aug 21, 2024
406f430
fix whitespace
Marchhill Aug 21, 2024
24d3c4a
Merge remote-tracking branch 'upstream/master' into feature/gnosis-sh…
Marchhill Aug 21, 2024
1d2e934
Merge branch 'feature/gnosis-shutter' into feature/shutter-tests
Marchhill Aug 21, 2024
123b1e1
block handler tests
Marchhill Aug 21, 2024
530cefe
move event simulation to api
Marchhill Aug 22, 2024
1f1b97b
e2e test
Marchhill Aug 23, 2024
b92bdcf
integration tests working
Marchhill Aug 24, 2024
4fcbeaf
missed keys test
Marchhill Aug 28, 2024
5036bee
add metrics
Marchhill Aug 28, 2024
445f8d2
more eon metrics
Marchhill Aug 28, 2024
eaa161d
tidy up PR
Marchhill Aug 28, 2024
fd10172
validator registration tuple
Marchhill Aug 28, 2024
898e9c1
fix outdated variable names
Marchhill Aug 28, 2024
6915526
fix scanning to genesis
Marchhill Aug 28, 2024
cb9a770
refactor log scanner into own component
Marchhill Aug 29, 2024
f195ce7
overlapping eons test
Marchhill Aug 29, 2024
b085c27
multiple event queues for different eons
Marchhill Aug 29, 2024
7fe0692
make keys missed test non parallelizable
Marchhill Aug 29, 2024
11adc39
fix whitespace
Marchhill Aug 29, 2024
b6da3e6
merge master
Marchhill Aug 29, 2024
c96702c
merge bls sig tests
Marchhill Aug 29, 2024
d99733f
add shutter tests to github actions
Marchhill Aug 29, 2024
d69ebc4
tidy up PR
Marchhill Aug 29, 2024
62a6b90
register New head block handler in plugin
Marchhill Aug 29, 2024
fe4ae70
fix offset calculation
Marchhill Aug 29, 2024
529b710
guard statements for logging
Marchhill Sep 2, 2024
36077b1
implement lukasz comments
Marchhill Sep 2, 2024
f3cf966
new head block register in api
Marchhill Sep 2, 2024
c350ce6
Merge remote-tracking branch 'upstream/master' into feature/gnosis-sh…
Marchhill Sep 2, 2024
ba16e3c
fix event triggering in tests
Marchhill Sep 2, 2024
397577a
Merge remote-tracking branch 'upstream/master' into feature/gnosis-sh…
Marchhill Sep 2, 2024
489f4be
readonlyblocktree use class directly
Marchhill Sep 2, 2024
9118cf7
BeaconChainGenesisTimestamp in specprovider and chainspec
Marchhill Sep 2, 2024
df86b11
return parallelquery of decrypted transactions
Marchhill Sep 3, 2024
69b253c
refactor to use less events
Marchhill Sep 3, 2024
37ed5fd
fix disposing sorted indexes arraypoollist
Marchhill Sep 3, 2024
d8869c0
update crypto to use spans
Marchhill Sep 5, 2024
dc1a9f7
fix crypto tests
Marchhill Sep 6, 2024
d3182fc
fix eon transition
Marchhill Sep 6, 2024
6bafdeb
Merge remote-tracking branch 'upstream/master' into feature/gnosis-sh…
Marchhill Sep 6, 2024
5e0c18a
fix bls signer
Marchhill Sep 6, 2024
777e43b
fix shutter tests by not inheriting EngineModuleTests
Marchhill Sep 6, 2024
c26481f
use span for rlp decoding
Marchhill Sep 6, 2024
d49e14d
fix type 2 transaction decoding
Marchhill Sep 6, 2024
d389b23
uncomment arraypoollist exception
Marchhill Sep 6, 2024
c1d448b
use vectorised xor for crypto
Marchhill Sep 6, 2024
e03e78a
remove unused changes
Marchhill Sep 6, 2024
deed087
move bls to stable package version
Marchhill Sep 6, 2024
a353b96
add shutter to metrics names
Marchhill Sep 6, 2024
9d31cf5
remove leftover bytes32
Marchhill Sep 6, 2024
2b16c3a
eon key bytes
Marchhill Sep 6, 2024
4415336
pass non readonly blocktree to shutter api
Marchhill Sep 6, 2024
2cba948
encrypted gas metric fix
Marchhill Sep 7, 2024
826d500
update libp2p to remove preview features and add ping
Marchhill Sep 9, 2024
3685b5a
Merge remote-tracking branch 'upstream/master' into feature/gnosis-sh…
Marchhill Sep 9, 2024
2c5c465
remove unused changes / tidy
Marchhill Sep 9, 2024
4666e48
new libp2p package
Marchhill Sep 11, 2024
ac24ebf
merge master
Marchhill Sep 11, 2024
dbf6fc8
yield break
Marchhill Sep 11, 2024
83fb1c5
simplify conditional
Marchhill Sep 12, 2024
063963b
payloadAttributes should never be null
Marchhill Sep 13, 2024
41dd9f0
remove unused using
Marchhill Sep 13, 2024
b865594
move more to p2p constructor, remove public from interfaces
Marchhill Sep 13, 2024
e3aa74d
check for blob tx earlier
Marchhill Sep 13, 2024
09b0505
Fix namespace
LukaszRozmej Sep 14, 2024
5d18c7b
Optimize keys
LukaszRozmej Sep 14, 2024
3f3507e
few more optimizations
LukaszRozmej Sep 14, 2024
fe1a906
whitespace
LukaszRozmej Sep 14, 2024
d51c917
fix Benchmarks.sln
LukaszRozmej Sep 14, 2024
219e011
optimisations
Marchhill Sep 16, 2024
1141bde
improve shutter config
Marchhill Sep 16, 2024
432ec90
improve tx filter test
Marchhill Sep 16, 2024
c39c798
move slot decryption identities
Marchhill Sep 16, 2024
1a39c1b
revert unused changes
Marchhill Sep 16, 2024
effbdb8
simplify decryptSequencedTransactions
Marchhill Sep 16, 2024
e1c83fa
use normal keccak hash instead of value
Marchhill Sep 16, 2024
8b4b2a0
revert valuehash to hash in hash4
Marchhill Sep 16, 2024
1917c90
hash4 return ValueHash256
Marchhill Sep 17, 2024
0902257
remove default BeaconChainGenesisTimestamp
Marchhill Sep 17, 2024
0ba6749
remove keys received event
Marchhill Sep 17, 2024
a01fd44
remove task.run p2p
Marchhill Sep 17, 2024
b2f0373
using cancellationtoken in tests
Marchhill Sep 17, 2024
15d8b54
start removing task delay from tests
Marchhill Sep 20, 2024
64bae96
revert previous block missed test to use timeout
Marchhill Sep 27, 2024
1f6753c
merge master
Marchhill Sep 27, 2024
fff7169
Merge remote-tracking branch 'upstream/master' into feature/gnosis-sh…
Marchhill Sep 27, 2024
41774a1
txsource list of wait tasks for each slot
Marchhill Sep 27, 2024
1e2a219
make key wait tasks non concurrent dictionary
Marchhill Sep 27, 2024
f41696f
cancel block wait tasks separately
Marchhill Sep 27, 2024
d7ed194
remove task.delay from previous block late integration test
Marchhill Sep 27, 2024
ef28860
rename block missed to late in test
Marchhill Sep 27, 2024
6a2b4e0
match other test naming
Marchhill Sep 27, 2024
9deb8ef
make timestamper readonly
Marchhill Sep 27, 2024
63125bb
whitespace
Marchhill Sep 27, 2024
14fc356
remove usings
Marchhill Sep 27, 2024
adef6a6
tests inherit enginemoduletests
Marchhill Sep 30, 2024
8aa8b46
Merge remote-tracking branch 'upstream/master' into feature/gnosis-sh…
Marchhill Sep 30, 2024
320d802
Merge remote-tracking branch 'upstream/master' into feature/gnosis-sh…
Marchhill Sep 30, 2024
4185459
Merge remote-tracking branch 'upstream/master' into feature/gnosis-sh…
Marchhill Sep 30, 2024
eb8bf1f
get CI tests to pass, set MaybeParent of LowestInsertedHeaders
Marchhill Sep 30, 2024
334e11c
allow block to keep improving
Marchhill Sep 30, 2024
252619f
make shutter blockchain api a property
Marchhill Sep 30, 2024
1fad36a
remove payloadimprovementdelay from test
Marchhill Sep 30, 2024
ddc8ec7
remove delay from block wait timeout test
Marchhill Sep 30, 2024
7eea1e7
whitespace
Marchhill Sep 30, 2024
5bf91cd
update chiado deployment
Marchhill Sep 30, 2024
bec5e21
merge master
Marchhill Oct 1, 2024
789f6d3
optimise crypto with new bls lib, remove unsafe stackallocs
Marchhill Oct 1, 2024
bc09e59
fix txloader crypto
Marchhill Oct 1, 2024
e31504a
stack alloc in checkdecryptionkeys
Marchhill Oct 1, 2024
362d6a2
tidy pr
Marchhill Oct 2, 2024
e028ea7
Merge remote-tracking branch 'upstream/master' into feature/gnosis-sh…
Marchhill Oct 2, 2024
988170e
bls stable package
Marchhill Oct 2, 2024
5af0188
remove test nuget
Marchhill Oct 3, 2024
301e30b
setup assertions
Marchhill Oct 3, 2024
2873360
add assertionssetup file
Marchhill Oct 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/nethermind-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ jobs:
- Nethermind.Overseer.Test
- Nethermind.Runner.Test
- Nethermind.Serialization.Ssz.Test
- Nethermind.Shutter.Test
- Nethermind.Sockets.Test
- Nethermind.Specs.Test
- Nethermind.State.Test
Expand Down
1 change: 1 addition & 0 deletions src/Nethermind/Chains/chiado.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"eip3529Transition": "0x0",
"eip3541Transition": "0x0",
"eip1559Transition": "0x0",
"beaconChainGenesisTimestamp": "0x6343ee4c",
"eip3651TransitionTimestamp": "0x646e0e4c",
"eip3855TransitionTimestamp": "0x646e0e4c",
"eip3860TransitionTimestamp": "0x646e0e4c",
Expand Down
1 change: 1 addition & 0 deletions src/Nethermind/Chains/foundation.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@
"eip3198Transition": "0xC5D488",
"eip3529Transition": "0xC5D488",
"eip3541Transition": "0xC5D488",
"beaconChainGenesisTimestamp": "0x5fc63057",
"eip3651TransitionTimestamp": "0x64373057",
"eip3855TransitionTimestamp": "0x64373057",
"eip3860TransitionTimestamp": "0x64373057",
Expand Down
1 change: 1 addition & 0 deletions src/Nethermind/Chains/gnosis.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"eip3529Transition": 19040000,
"eip3541Transition": 19040000,
"eip1559Transition": 19040000,
"beaconChainGenesisTimestamp": "0x61b10dbc",
"eip3651TransitionTimestamp": "0x64c8edbc",
"eip3855TransitionTimestamp": "0x64c8edbc",
"eip3860TransitionTimestamp": "0x64c8edbc",
Expand Down
1 change: 1 addition & 0 deletions src/Nethermind/Chains/holesky.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"eip3198Transition": "0x0",
"eip3529Transition": "0x0",
"eip3541Transition": "0x0",
"beaconChainGenesisTimestamp": "0x65156994",
"eip3651TransitionTimestamp": "0x6516eac0",
"eip3855TransitionTimestamp": "0x6516eac0",
"eip3860TransitionTimestamp": "0x6516eac0",
Expand Down
1 change: 1 addition & 0 deletions src/Nethermind/Chains/sepolia.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"eip3541Transition": "0x0",
"terminalTotalDifficulty": "3C6568F12E8000",
"mergeForkIdTransition": "0x1A7ACB",
"beaconChainGenesisTimestamp": "0x62b07d60",
"eip4895TransitionTimestamp": "0x63FD7D60",
"eip3855TransitionTimestamp": "0x63FD7D60",
"eip3651TransitionTimestamp": "0x63FD7D60",
Expand Down
6 changes: 4 additions & 2 deletions src/Nethermind/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
<PackageVersion Include="FastEnum" Version="1.8.0" />
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
<PackageVersion Include="FluentAssertions.Json" Version="6.1.0" />
<PackageVersion Include="Google.Protobuf" Version="3.27.2" />
<PackageVersion Include="Google.Protobuf.Tools" Version="3.27.2" />
<PackageVersion Include="Google.Protobuf" Version="3.28.0" />
<PackageVersion Include="Google.Protobuf.Tools" Version="3.28.0" />
<PackageVersion Include="Grpc" Version="2.46.6" />
<PackageVersion Include="Grpc.Tools" Version="2.65.0" />
<PackageVersion Include="HexMate" Version="0.0.3" />
Expand All @@ -44,12 +44,14 @@
<PackageVersion Include="Microsoft.IO.RecyclableMemoryStream" Version="3.0.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageVersion Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" />
<PackageVersion Include="Nethermind.Crypto.Bls" Version="1.0.1-preview.5" />
<PackageVersion Include="Nethermind.Crypto.Pairings" Version="1.1.1" />
<PackageVersion Include="Nethermind.Crypto.SecP256k1" Version="1.2.2" />
<PackageVersion Include="Nethermind.DotNetty.Buffers" Version="1.0.1" />
<PackageVersion Include="Nethermind.DotNetty.Handlers" Version="1.0.1" />
<PackageVersion Include="Nethermind.DotNetty.Transport" Version="1.0.1" />
<PackageVersion Include="Nethermind.Gmp" Version="1.0.1" />
<PackageVersion Include="Nethermind.Libp2p" Version="1.0.0-preview.33" />
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be moved to a stable package version once pubsub peer discovery and other improvements are implemented in dotnet libp2p.

<PackageVersion Include="Nethermind.Numerics.Int256" Version="1.2.0" />
<PackageVersion Include="Nito.Collections.Deque" Version="1.2.1" />
<PackageVersion Include="NLog" Version="5.3.2" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// SPDX-FileCopyrightText: 2022 Demerzel Solutions Limited
// SPDX-License-Identifier: LGPL-3.0-only

using System.Threading.Tasks;
using Nethermind.Consensus;
using Nethermind.Consensus.Transactions;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ namespace Nethermind.Api.Extensions;
[ConfigCategory(DisabledForCli = false, HiddenFromDocs = true)]
public interface IPluginConfig : IConfig
{
[ConfigItem(Description = "Order of plugin initialization", DefaultValue = "[Clique, Aura, Ethash, Optimism, AuRaMerge, Merge, MEV, HealthChecks, Hive]")]
[ConfigItem(Description = "Order of plugin initialization", DefaultValue = "[Clique, Aura, Ethash, Optimism, Shutter, AuRaMerge, Merge, MEV, HealthChecks, Hive]")]
string[] PluginOrder { get; set; }
}
2 changes: 1 addition & 1 deletion src/Nethermind/Nethermind.Api/Extensions/PluginConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ namespace Nethermind.Api.Extensions;

public class PluginConfig : IPluginConfig
{
public string[] PluginOrder { get; set; } = { "Clique", "Aura", "Ethash", "Optimism", "AuRaMerge", "Merge", "MEV", "HealthChecks", "Hive" };
public string[] PluginOrder { get; set; } = { "Clique", "Aura", "Ethash", "Optimism", "Shutter", "AuRaMerge", "Merge", "MEV", "HealthChecks", "Hive" };
}
1 change: 1 addition & 0 deletions src/Nethermind/Nethermind.Api/IApiWithBlockchain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public interface IApiWithBlockchain : IApiWithStores, IBlockchainBridgeFactory
IGasLimitCalculator? GasLimitCalculator { get; set; }

IBlockProducerEnvFactory? BlockProducerEnvFactory { get; set; }
IBlockImprovementContextFactory? BlockImprovementContextFactory { get; set; }

IGasPriceOracle? GasPriceOracle { get; set; }

Expand Down
1 change: 1 addition & 0 deletions src/Nethermind/Nethermind.Api/IApiWithStores.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Nethermind.Consensus;
using Nethermind.Crypto;
using Nethermind.Db.Blooms;
using Nethermind.Facade.Find;
using Nethermind.State.Repositories;
using Nethermind.TxPool;
using Nethermind.Wallet;
Expand Down
2 changes: 2 additions & 0 deletions src/Nethermind/Nethermind.Api/NethermindApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
using Nethermind.Sockets;
using Nethermind.Trie;
using Nethermind.Consensus.Processing.CensorshipDetector;
using Nethermind.Facade.Find;

namespace Nethermind.Api
{
Expand Down Expand Up @@ -214,6 +215,7 @@ public ISealEngine SealEngine
public IGasLimitCalculator? GasLimitCalculator { get; set; }

public IBlockProducerEnvFactory? BlockProducerEnvFactory { get; set; }
public IBlockImprovementContextFactory? BlockImprovementContextFactory { get; set; }
public IGasPriceOracle? GasPriceOracle { get; set; }

public IEthSyncingInfo? EthSyncingInfo { get; set; }
Expand Down
1 change: 1 addition & 0 deletions src/Nethermind/Nethermind.Api/PluginPriorities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ namespace Nethermind.Api;
public class PluginPriorities
{
public const int Merge = 1000;
public const int Shutter = 2000;
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
using Nethermind.Logging;
using Nethermind.Db.Blooms;
using Nethermind.Facade.Filters;
using Nethermind.Facade.Find;
using NSubstitute;
using NUnit.Framework;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ public bool Equals(LogEntry logEntry, LogEntry searchedEntryTemplate)
Hash256[] matchEntryTopics = searchedEntryTemplate?.Topics ?? Array.Empty<Hash256>();
return ReferenceEquals(logEntry, searchedEntryTemplate) || (
logEntry is not null
&& logEntry.LoggersAddress == searchedEntryTemplate?.LoggersAddress
&& logEntry.Address == searchedEntryTemplate?.Address
&& logEntry.Topics.Length >= matchEntryTopics.Length
&& logEntry.Topics.Take(matchEntryTopics.Length).SequenceEqual(matchEntryTopics)
);
}

public int GetHashCode(LogEntry obj)
{
return obj.Topics.Aggregate(obj.LoggersAddress.GetHashCode(), (i, keccak) => i ^ keccak.GetHashCode());
return obj.Topics.Aggregate(obj.Address.GetHashCode(), (i, keccak) => i ^ keccak.GetHashCode());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ public void UpdateMergeTransitionInfo(long? blockNumber, UInt256? terminalTotalD

public long? DaoBlockNumber => _specProvider.DaoBlockNumber;

public ulong? BeaconChainGenesisTimestamp => _specProvider.BeaconChainGenesisTimestamp;

public ulong NetworkId => _specProvider.NetworkId;

public ulong ChainId => _specProvider.ChainId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public interface IAuraConfig : IConfig

[ConfigItem(Description = "The address of the transaction priority contract to use when selecting transactions from the transaction pool.",
DefaultValue = "null")]

string TxPriorityContractAddress { get; set; }

[ConfigItem(Description = "The path to the transaction priority rules file to use when selecting transactions from the transaction pool.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Threading.Tasks;
using Nethermind.Core;

namespace Nethermind.Merge.Plugin.BlockProduction;
namespace Nethermind.Consensus.Producers;

public interface IBlockImprovementContext : IBlockProductionContext, IDisposable
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
// SPDX-License-Identifier: LGPL-3.0-only

using System;
using Nethermind.Consensus.Producers;
using Nethermind.Core;

namespace Nethermind.Merge.Plugin.BlockProduction;
namespace Nethermind.Consensus.Producers;

public interface IBlockImprovementContextFactory
{
Expand All @@ -14,4 +13,6 @@ IBlockImprovementContext StartBlockImprovementContext(
BlockHeader parentHeader,
PayloadAttributes payloadAttributes,
DateTimeOffset startDateTime);

bool KeepImproving { get => true; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Nethermind.Core;
using Nethermind.Int256;

namespace Nethermind.Merge.Plugin.BlockProduction;
namespace Nethermind.Consensus.Producers;

public interface IBlockProductionContext
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
using Nethermind.Db.Blooms;
using Nethermind.Evm;
using Nethermind.Evm.TransactionProcessing;
using Nethermind.Facade.Find;
using Nethermind.Int256;
using Nethermind.Logging;
using Nethermind.Serialization.Json;
Expand Down
52 changes: 52 additions & 0 deletions src/Nethermind/Nethermind.Core.Test/Crypto/BlsSignerTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// SPDX-FileCopyrightText: 2024 Demerzel Solutions Limited
// SPDX-License-Identifier: LGPL-3.0-only

using System;
using FluentAssertions;
using Nethermind.Crypto;
using NUnit.Framework;

namespace Nethermind.Core.Test.Crypto;

[TestFixture]
public class BlsTests
{
private static readonly byte[] _skBytes = [0x2c, 0xd4, 0xba, 0x40, 0x6b, 0x52, 0x24, 0x59, 0xd5, 0x7a, 0x0b, 0xed, 0x51, 0xa3, 0x97, 0x43, 0x5c, 0x0b, 0xb1, 0x1d, 0xd5, 0xf3, 0xca, 0x11, 0x52, 0xb3, 0x69, 0x4b, 0xb9, 0x1d, 0x7c, 0x22];
private static readonly byte[] _msgBytes = [0x3e, 0x00, 0xef, 0x2f, 0x89, 0x5f, 0x40, 0xd6, 0x7f, 0x5b, 0xb8, 0xe8, 0x1f, 0x09, 0xa5, 0xa1, 0x2c, 0x84, 0x0e, 0xc3, 0xce, 0x9a, 0x7f, 0x3b, 0x18, 0x1b, 0xe1, 0x88, 0xef, 0x71, 0x1a, 0x1e];

[Test]
public void Calculate_signature()
{
byte[] expected = [0xa5, 0xa0, 0x0d, 0xe9, 0x9d, 0x8f, 0xee, 0x7e, 0x28, 0x81, 0x1b, 0x2c, 0x08, 0xe0, 0xa7, 0xfc, 0x00, 0xa1, 0x10, 0x0c, 0x3d, 0x0f, 0x80, 0x51, 0x9d, 0x43, 0x24, 0x67, 0x1c, 0x29, 0x36, 0xb1, 0xe5, 0xa5, 0x87, 0x7d, 0x46, 0x7a, 0x6d, 0xc6, 0xf5, 0x92, 0xb2, 0x40, 0x7b, 0xcb, 0x12, 0x61, 0x0c, 0x18, 0x8a, 0x6c, 0xdf, 0x57, 0xd1, 0x77, 0x92, 0x00, 0x0f, 0xf7, 0x56, 0xf8, 0x0e, 0xbe, 0xd8, 0x00, 0x88, 0xab, 0x22, 0x9a, 0xa7, 0xe2, 0xc3, 0x24, 0x09, 0xec, 0xfe, 0x5a, 0x8d, 0x44, 0x73, 0xe9, 0x12, 0xfa, 0x19, 0x9e, 0xee, 0xa1, 0x8f, 0x3c, 0x79, 0x8d, 0xc5, 0x28, 0x64, 0x7d];
BlsSigner.Signature s = BlsSigner.Sign(new(_skBytes, Bls.ByteOrder.LittleEndian), _msgBytes);
s.Bytes.ToArray().Should().Equal(expected);
}

[Test]
public void Verify_signature()
{
Bls.SecretKey sk = new(_skBytes, Bls.ByteOrder.LittleEndian);
BlsSigner.Signature s = BlsSigner.Sign(sk, _msgBytes);
Assert.That(BlsSigner.Verify(BlsSigner.GetPublicKey(sk), s, _msgBytes));
}

[Test]
public void Rejects_bad_signature()
{
Bls.SecretKey sk = new(_skBytes, Bls.ByteOrder.LittleEndian);
BlsSigner.Signature s = BlsSigner.Sign(sk, _msgBytes);
Span<byte> bytes = stackalloc byte[96];
s.Bytes.CopyTo(bytes);
bytes[34] += 1;
BlsSigner.Signature bad = new(bytes);

Assert.That(BlsSigner.Verify(BlsSigner.GetPublicKey(sk), bad, _msgBytes), Is.False);
}

[Test]
public void Public_key_from_private_key()
{
byte[] expected = [0x95, 0x39, 0x27, 0x35, 0x0c, 0x35, 0x31, 0xb0, 0xbc, 0x58, 0x64, 0xcd, 0x9c, 0x5f, 0xe1, 0x34, 0x74, 0xca, 0x0c, 0x9b, 0x59, 0x99, 0x51, 0xa7, 0x76, 0xc4, 0xb9, 0x8d, 0xf6, 0x6a, 0x0e, 0x62, 0x07, 0xa8, 0x5c, 0x7f, 0x7a, 0x85, 0x1a, 0x0c, 0x02, 0x2a, 0x87, 0xc0, 0x29, 0xc3, 0x65, 0x61];
Assert.That(BlsSigner.GetPublicKey(new(_skBytes, Bls.ByteOrder.LittleEndian)).Compress(), Is.EqualTo(expected));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public void Can_do_roundtrip(bool valueDecode)
LogEntry decoded = valueDecode ? Rlp.Decode<LogEntry>(rlp.Bytes.AsSpan()) : Rlp.Decode<LogEntry>(rlp);

Assert.That(decoded.Data, Is.EqualTo(logEntry.Data), "data");
Assert.That(decoded.LoggersAddress, Is.EqualTo(logEntry.LoggersAddress), "address");
Assert.That(decoded.Address, Is.EqualTo(logEntry.Address), "address");
Assert.That(decoded.Topics, Is.EqualTo(logEntry.Topics), "topics");
}

Expand All @@ -36,7 +36,7 @@ public void Can_do_roundtrip_ref_struct()
LogEntryDecoder.DecodeStructRef(ref valueDecoderContext, RlpBehaviors.None, out LogEntryStructRef decoded);

Assert.That(Bytes.AreEqual(logEntry.Data, decoded.Data), "data");
Assert.That(logEntry.LoggersAddress == decoded.LoggersAddress, "address");
Assert.That(logEntry.Address == decoded.Address, "address");

Span<byte> buffer = stackalloc byte[32];
KeccaksIterator iterator = new(decoded.TopicsRlp, buffer);
Expand Down Expand Up @@ -65,7 +65,7 @@ public void Can_do_roundtrip_rlp_stream()
LogEntry deserialized = decoder.Decode(new RlpStream(encoded.Bytes))!;

Assert.That(deserialized.Data, Is.EqualTo(logEntry.Data), "data");
Assert.That(deserialized.LoggersAddress, Is.EqualTo(logEntry.LoggersAddress), "address");
Assert.That(deserialized.Address, Is.EqualTo(logEntry.Address), "address");
Assert.That(deserialized.Topics, Is.EqualTo(logEntry.Topics), "topics");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public void UpdateMergeTransitionInfo(long? blockNumber, UInt256? terminalTotalD

public long? DaoBlockNumber => specProvider.DaoBlockNumber;

public ulong? BeaconChainGenesisTimestamp => specProvider.BeaconChainGenesisTimestamp;

public ulong NetworkId => specProvider.NetworkId;
public ulong ChainId => specProvider.ChainId;

Expand Down
6 changes: 3 additions & 3 deletions src/Nethermind/Nethermind.Core/Bloom.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public void Add(LogEntry[] logEntries, Bloom? blockBloom = null)
for (int entryIndex = 0; entryIndex < logEntries.Length; entryIndex++)
{
LogEntry logEntry = logEntries[entryIndex];
byte[] addressBytes = logEntry.LoggersAddress.Bytes;
byte[] addressBytes = logEntry.Address.Bytes;
Set(addressBytes, blockBloom);
Hash256[] topics = logEntry.Topics;
for (int topicIndex = 0; topicIndex < topics.Length; topicIndex++)
Expand All @@ -147,7 +147,7 @@ public void Accumulate(Bloom? bloom)

public bool Matches(LogEntry logEntry)
{
if (Matches(logEntry.LoggersAddress))
if (Matches(logEntry.Address))
{
Hash256[] topics = logEntry.Topics;
for (int topicIndex = 0; topicIndex < topics.Length; topicIndex++)
Expand Down Expand Up @@ -285,7 +285,7 @@ public override readonly int GetHashCode()

public readonly bool Matches(LogEntry logEntry)
{
if (Matches(logEntry.LoggersAddress))
if (Matches(logEntry.Address))
{
Hash256[] topics = logEntry.Topics;
for (int topicIndex = 0; topicIndex < topics.Length; topicIndex++)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,26 @@ public static class EnumerableExtensions
{
public static void ForEach<T>(this IEnumerable<T> list, Action<T> action)
{
list.ToList().ForEach(action);
foreach (T element in list)
{
action(element);
}
}

public static bool NullableSequenceEqual<T>(this IEnumerable<T>? first, IEnumerable<T>? second) =>
first is not null ? second is not null && first.SequenceEqual(second) : second is null;

public static bool ContainsDuplicates<T>(this IEnumerable<T> list, int? count = null, IEqualityComparer<T>? comparer = null)
{
HashSet<T> hashSet = count is null ? new HashSet<T>(comparer) : new HashSet<T>(count.Value, comparer);
foreach (T element in list)
{
if (!hashSet.Add(element))
{
return true;
}
}

return false;
}
}
16 changes: 16 additions & 0 deletions src/Nethermind/Nethermind.Core/Collections/EnumerableWithCount.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// SPDX-FileCopyrightText: 2024 Demerzel Solutions Limited
// SPDX-License-Identifier: LGPL-3.0-only

using System.Collections;
using System.Collections.Generic;

namespace Nethermind.Core.Collections;

public readonly record struct EnumerableWithCount<T>(IEnumerable<T> Enumerable, int Count) : IEnumerable<T>
{
// ReSharper disable once NotDisposedResourceIsReturned
public IEnumerator<T> GetEnumerator() => Enumerable.GetEnumerator();

IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
}

Loading