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