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

Add eth_simulate , support array of eth_call for simulation across multiple blocks #5530

Merged
merged 290 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from 46 commits
Commits
Show all changes
290 commits
Select commit Hold shift + click to select a range
abc59c3
finalising transfer to Env based approach
OlegJakushkin Jun 29, 2023
f682a72
fixing Benchmarks
OlegJakushkin Jun 29, 2023
1162cc3
Using eth_multicallV1 signature
OlegJakushkin Jun 30, 2023
72ac349
RPC test added
OlegJakushkin Jun 30, 2023
ecf2f55
Merge remote-tracking branch 'origin/master' into feature/eth_multicall
OlegJakushkin Jul 1, 2023
bf4c929
post merge fix
OlegJakushkin Jul 1, 2023
fc9b1c2
Merge remote-tracking branch 'origin/master' into feature/eth_multicall
OlegJakushkin Jul 3, 2023
8cdcb49
Merge remote-tracking branch 'origin/master' into feature/eth_multicall
OlegJakushkin Jul 4, 2023
472054b
Update src/Nethermind/Nethermind.Facade/Proxy/Models/MultiCall/MultiC…
OlegJakushkin Jul 4, 2023
80802c7
Merge remote-tracking branch 'origin/feature/eth_multicall' into feat…
OlegJakushkin Jul 4, 2023
63e361d
fixes upon first review
OlegJakushkin Jul 4, 2023
717e583
test fixes
OlegJakushkin Jul 31, 2023
9114610
Merge remote-tracking branch 'origin/master' into feature/eth_multicall
OlegJakushkin Jul 31, 2023
85e228b
Nonce and account checks
OlegJakushkin Jul 31, 2023
e196c2e
Merge remote-tracking branch 'origin/master' into feature/eth_multicall
OlegJakushkin Jul 31, 2023
8ab2090
Cleaning up tracers
OlegJakushkin Jul 31, 2023
e4b680f
Fixing tests
OlegJakushkin Aug 3, 2023
c2fb3ae
Merge remote-tracking branch 'origin/master' into feature/eth_multicall
OlegJakushkin Aug 3, 2023
c30bf1d
fixing benchmarks
OlegJakushkin Aug 3, 2023
4407a1b
minor protocol update
OlegJakushkin Aug 3, 2023
d4d8ba1
Merge remote-tracking branch 'origin/master' into feature/eth_multicall
OlegJakushkin Aug 3, 2023
9430acc
Fixing Nonce
OlegJakushkin Aug 3, 2023
fda6c87
Softer defaults
OlegJakushkin Sep 11, 2023
a3dc077
Merge remote-tracking branch 'origin/master' into feature/eth_multicall
OlegJakushkin Sep 11, 2023
58b1c75
Minor refactoring following the review
OlegJakushkin Sep 11, 2023
fb2d861
Fixing Spaces
OlegJakushkin Sep 11, 2023
9eaf7ce
Merge remote-tracking branch 'origin/master' into feature/eth_multicall
OlegJakushkin Sep 11, 2023
c893254
Spec ordering
OlegJakushkin Sep 11, 2023
43009d4
Added checked longs
OlegJakushkin Sep 11, 2023
c99343a
Moving stuff to initialiser
OlegJakushkin Sep 11, 2023
202484f
Account Overrides ordering
OlegJakushkin Sep 11, 2023
da4c347
fix spaces
OlegJakushkin Sep 11, 2023
1faa5b9
Restricting DB set operations to 32b
OlegJakushkin Sep 11, 2023
9771637
Merge remote-tracking branch 'origin/master' into feature/eth_multicall
OlegJakushkin Sep 11, 2023
d822593
enum only
OlegJakushkin Sep 11, 2023
00d4db3
Result structure reordering following the protocol
OlegJakushkin Sep 11, 2023
8bbe975
Ordering following protocoll
OlegJakushkin Sep 11, 2023
59de531
Minor naming refactoring
OlegJakushkin Sep 11, 2023
044bc93
Minor refactoring of a stub class unused fields
OlegJakushkin Sep 11, 2023
0b22f18
removed unused flag
OlegJakushkin Sep 11, 2023
d5e9ce5
removing some of the interfaces implemented only once
OlegJakushkin Sep 12, 2023
a6e1398
Spaces fixing
OlegJakushkin Sep 12, 2023
d05e466
inheritance into composition
OlegJakushkin Sep 12, 2023
730753b
Merge remote-tracking branch 'origin/master' into feature/eth_multicall
OlegJakushkin Sep 12, 2023
819d0c5
removing unused parameter
OlegJakushkin Sep 12, 2023
634e41e
minor clean up
OlegJakushkin Sep 12, 2023
f9a6e91
Use of IReadOnlyList of MultiCallBlockResults
OlegJakushkin Sep 12, 2023
62348dc
minor refactoring
OlegJakushkin Sep 12, 2023
8619dc5
minor clean-up
OlegJakushkin Sep 12, 2023
30f5743
Inheritance simplified
OlegJakushkin Sep 12, 2023
e09142d
Classes extraction
OlegJakushkin Sep 12, 2023
d72c8e6
important refactoring
OlegJakushkin Sep 12, 2023
fd5ce5d
extracting Multicall Bridge Helper
OlegJakushkin Sep 12, 2023
474066e
Publish draft releases as the latest (#6058)
rubo Sep 13, 2023
add699c
Change version suffix from unstable to rc
kamilchodola Sep 13, 2023
26189fe
minor refactorings
OlegJakushkin Sep 13, 2023
edb0490
using NullReceiptStorage
OlegJakushkin Sep 13, 2023
4c3fc92
Merge remote-tracking branch 'origin/master' into feature/eth_multicall
OlegJakushkin Sep 13, 2023
15a7bb1
Merge remote-tracking branch 'origin/master' into feature/eth_multicall
OlegJakushkin Sep 18, 2023
8a04905
minor test fixes
OlegJakushkin Sep 18, 2023
b30d377
minor test fixes
OlegJakushkin Sep 18, 2023
bce00e4
Setting correct Tx type defaults
OlegJakushkin Sep 18, 2023
20fade3
minor tests fix
OlegJakushkin Sep 18, 2023
95e7c09
Merge remote-tracking branch 'origin/master' into feature/eth_multicall
OlegJakushkin Sep 18, 2023
a142364
clean up txTypes diff
OlegJakushkin Sep 19, 2023
9454814
Merge remote-tracking branch 'origin/master' into feature/eth_multicall
OlegJakushkin Sep 27, 2023
81f52a2
fixing missing state on "latest"
OlegJakushkin Sep 27, 2023
f5e616e
updated interface
OlegJakushkin Sep 27, 2023
1c7c4bf
updating tests
OlegJakushkin Sep 27, 2023
2a70ac4
Change TuneDb default to HeavyWrite (#6136)
kamilchodola Sep 27, 2023
a785044
[Fix][Holesky] timestamps and genesis updates (#6112)
smartprogrammer93 Sep 21, 2023
f02c690
Fix PPA package post-install script (#5991)
rubo Sep 28, 2023
92c8f81
Update executable and networks (#6141)
rubo Sep 28, 2023
bb9b72c
Bump client version to 1.21.0
kamilchodola Sep 28, 2023
08c3890
Merge remote-tracking branch 'origin/release/1.21.0' into feature/eth…
OlegJakushkin Oct 2, 2023
42b2e3a
Minor test fixes
OlegJakushkin Oct 2, 2023
b6c3b21
Feature/eth multicall refactor (#6175)
LukaszRozmej Oct 11, 2023
0603dd7
Merge 1.22
OlegJakushkin Oct 11, 2023
dc43a3d
Merge remote-tracking branch 'origin/release/1.22.0' into feature/eth…
OlegJakushkin Oct 11, 2023
e81f015
Merge branch 'master' into feature/eth_multicall
OlegJakushkin Oct 11, 2023
201baeb
post merge conflict resolution
OlegJakushkin Oct 11, 2023
6c1cebc
benchmark fixes
OlegJakushkin Oct 11, 2023
26f17fa
Revert VirtualMachine code layout a bit
LukaszRozmej Oct 11, 2023
cedafab
Clear state storrage on accountOverride.State (not StateDiff)
LukaszRozmej Oct 11, 2023
00d0d49
Refactor to introduce overrides in eth_call
LukaszRozmej Oct 12, 2023
e6e5324
HiveTests Added
OlegJakushkin Oct 16, 2023
d180fb1
Uint256 hex parsing when it is inside dictionary
OlegJakushkin Oct 23, 2023
64b34b1
Fixing dictionary parsing
OlegJakushkin Oct 24, 2023
b38c1b5
spaces fix
OlegJakushkin Oct 24, 2023
c719612
fixing nonce, parsing and processing issues
OlegJakushkin Nov 1, 2023
f8ea79c
merge master
OlegJakushkin Nov 1, 2023
3b5ff68
post merge build fixes
OlegJakushkin Nov 1, 2023
0af77c7
most tests fixed
OlegJakushkin Nov 1, 2023
a3df479
fixing block gas calculation, block processing catch
OlegJakushkin Nov 1, 2023
43e5af9
hot fix
OlegJakushkin Nov 1, 2023
cb0c102
merge master into eth_multycall
OlegJakushkin Nov 6, 2023
08acb1e
Fix aAPI update related issues
OlegJakushkin Nov 6, 2023
8536de7
Unit tests fix
OlegJakushkin Nov 6, 2023
ee5e4f6
fixing state used in multicall
OlegJakushkin Nov 13, 2023
857f835
Gas cap limits enforcement
OlegJakushkin Nov 13, 2023
f2274a9
fix spacing
OlegJakushkin Nov 13, 2023
0518264
Merge master
OlegJakushkin Nov 13, 2023
6118b29
fixing local move test
OlegJakushkin Nov 14, 2023
bf944ed
Hunted down trie exception
OlegJakushkin Nov 20, 2023
0c04244
Merge remote-tracking branch 'origin/master' into feature/eth_multicall
OlegJakushkin Nov 20, 2023
19f075a
fix whitespace
OlegJakushkin Nov 20, 2023
f5907c3
merge
OlegJakushkin Jan 18, 2024
36a6785
Merge remote-tracking branch 'origin/master' into feature/eth_multicall
OlegJakushkin Jan 18, 2024
7cd7f58
merge hotfix
OlegJakushkin Jan 18, 2024
909f927
Tree State Failed example
OlegJakushkin Jan 18, 2024
465baee
reset submodule
LukaszRozmej Jan 18, 2024
a85c00d
fixed serialisation tests
OlegJakushkin Jan 19, 2024
6d53c57
Add OverlayTrieStore and OverlayWorldStateManager
LukaszRozmej Jan 19, 2024
08cf03b
Merge remote-tracking branch 'origin/feature/eth_multicall' into feat…
LukaszRozmej Jan 19, 2024
687a460
fix test
LukaszRozmej Jan 19, 2024
277cc4f
Add UInt256 property conversion (for Dictionary key)
LukaszRozmej Jan 19, 2024
4021aff
Optimize WriteAsPropertyName
benaadams Jan 19, 2024
92f5c7e
Revert ` Extract revert messages #6226`
OlegJakushkin Jan 22, 2024
b7983f6
Moving to eth_simulate
OlegJakushkin Jan 22, 2024
b3fa159
Merge latest
OlegJakushkin Jan 22, 2024
c322262
fixing post merge
OlegJakushkin Jan 22, 2024
a4ae238
Renaming to simulate missed stuff
OlegJakushkin Jan 22, 2024
ae1c561
Merge remote-tracking branch 'origin/master' into feature/eth_multicall
OlegJakushkin Jan 22, 2024
56960ae
Fixing tree access
OlegJakushkin Jan 23, 2024
f0cd700
basic hive updates
OlegJakushkin Feb 7, 2024
4dbe050
Merge remote-tracking branch 'origin/master' into feature/eth_multicall
OlegJakushkin Feb 7, 2024
df4aee1
MissingTrieNodeException fix
OlegJakushkin Feb 7, 2024
1d07f61
minor debuggability tree exploration fix
OlegJakushkin Feb 8, 2024
8126d5b
Hive like Prunning And Persistence in tests
OlegJakushkin Feb 8, 2024
9cb16b7
Merge remote-tracking branch 'origin/master' into feature/eth_multicall
OlegJakushkin Feb 8, 2024
8eefe3e
fixing most of the unit tests
OlegJakushkin Feb 9, 2024
585927f
Test fixes
OlegJakushkin Feb 12, 2024
ced6a1b
Getting ready for merge
OlegJakushkin Feb 12, 2024
7021aaf
Merge remote-tracking branch 'origin/master' into feature/eth_multicall
OlegJakushkin Feb 12, 2024
2eeb005
initialize overlay tree with main tree head
LukaszRozmej Feb 13, 2024
d6e339b
FIx managing state
LukaszRozmej Feb 20, 2024
6d9b0cb
Merge remote-tracking branch 'origin/master' into feature/eth_multicall
OlegJakushkin Feb 20, 2024
6626f1d
minor fix
OlegJakushkin Feb 20, 2024
7766aeb
minor bug fixes
OlegJakushkin Feb 21, 2024
7420391
minor trello fixes
OlegJakushkin Feb 21, 2024
feeadf6
Minor tests fix
OlegJakushkin Feb 21, 2024
dd9843a
fix serialization of Uint256 as dictionary property name
LukaszRozmej Feb 21, 2024
c4bd380
add leading zeros
LukaszRozmej Feb 21, 2024
e4a381c
minor CI fixes
OlegJakushkin Feb 21, 2024
bd5fc59
cleanup
LukaszRozmej Feb 21, 2024
7d7c499
More cleanups
LukaszRozmej Feb 21, 2024
9fde5e0
BlockHash refactor
LukaszRozmej Feb 21, 2024
4c2110e
BlockTree refactor
LukaszRozmej Feb 21, 2024
a03fc36
restoring hive tests
OlegJakushkin Feb 21, 2024
db876c1
minor blockHashProvider related fixes
OlegJakushkin Feb 21, 2024
6ef4946
fix tests
LukaszRozmej Feb 21, 2024
e083535
refactor EthCliModule
LukaszRozmej Feb 21, 2024
44e67c7
Fixing project build
OlegJakushkin Feb 21, 2024
31a4a47
Merge branch 'feature/eth_multicall' of https://github.com/Nethermind…
OlegJakushkin Feb 21, 2024
20605b5
Merge remote-tracking branch 'origin/master' into feature/eth_multicall
OlegJakushkin Feb 21, 2024
6bca09f
revert BlockHashProvider rename
LukaszRozmej Feb 21, 2024
64d3503
more revert
LukaszRozmej Feb 21, 2024
9431c73
fix
LukaszRozmej Feb 21, 2024
f9ec7d1
more revert
LukaszRozmej Feb 21, 2024
74b68ae
Merge branch 'feature/eth_multicall' of https://github.com/Nethermind…
OlegJakushkin Feb 21, 2024
be04bdf
minor trello fixes
OlegJakushkin Feb 21, 2024
6664f2f
status text issue fix
OlegJakushkin Feb 21, 2024
4cb263d
changing test that shall fail on current setup due to gas fees
OlegJakushkin Feb 21, 2024
0408f1d
Fixing project build
OlegJakushkin Feb 21, 2024
0df45dc
more revert
LukaszRozmej Feb 21, 2024
67425a6
fix CodeInfoRepository
LukaszRozmej Feb 21, 2024
cd8d307
more refactor
LukaszRozmej Feb 21, 2024
c7507db
majour protocol fixes
OlegJakushkin Mar 25, 2024
4373849
minor fixes
OlegJakushkin Mar 25, 2024
453b37c
merge
OlegJakushkin Mar 25, 2024
29ae661
post merge fixes
OlegJakushkin Mar 25, 2024
79e6a72
fixing hive tests
OlegJakushkin Mar 27, 2024
ce872a6
Merge remote-tracking branch 'origin/master' into feature/eth_multicall
OlegJakushkin Mar 27, 2024
069b452
merge
OlegJakushkin Apr 2, 2024
1614e12
fix formating
OlegJakushkin Apr 2, 2024
4472169
fixing protocol issues
OlegJakushkin Apr 3, 2024
be34ebe
Merge remote-tracking branch 'origin/master' into feature/eth_multicall
OlegJakushkin Apr 3, 2024
ef83e97
merge fix
OlegJakushkin Apr 29, 2024
2dc5513
Minor fixes
OlegJakushkin Apr 29, 2024
11d0e6a
Extra transfer Logs use eEE address
OlegJakushkin Apr 29, 2024
706aacf
manual diff merge with maser using araxis
OlegJakushkin Apr 29, 2024
3a3e115
fix formatting
OlegJakushkin Apr 29, 2024
1d6874d
Merge remote-tracking branch 'origin/master' into feature/eth_multicall
OlegJakushkin Apr 29, 2024
5b717b6
fix test
LukaszRozmej May 3, 2024
2665446
Revert "fix test"
LukaszRozmej May 3, 2024
932c615
Merge remote-tracking branch 'origin/master' into feature/eth_multicall
OlegJakushkin May 7, 2024
1a99a29
pre review fixes
OlegJakushkin May 7, 2024
ffbec51
merge and tests fix
OlegJakushkin May 7, 2024
c007a4e
post merge tests fixes
OlegJakushkin May 7, 2024
bf57556
automated cleanup of new files
OlegJakushkin May 8, 2024
3df6703
Merge branch 'feature/eth_multicall' of https://github.com/Nethermind…
OlegJakushkin May 8, 2024
5e22d16
Merge branch 'master' into feature/eth_multicall
OlegJakushkin May 8, 2024
183d303
Merge remote-tracking branch 'origin/master' into feature/eth_multicall
OlegJakushkin May 13, 2024
918e9fd
Minor bug fixes
OlegJakushkin May 13, 2024
37b52bb
refactors
LukaszRozmej May 14, 2024
5e7be69
Refactor ITxLogsTracer to ITxLogsMutator and introduce SimulateVirtua…
LukaszRozmej May 14, 2024
4ac4f6e
Merge remote-tracking branch 'origin/feature/eth_multicall' into feat…
LukaszRozmej May 14, 2024
b9be04d
Revert TxHashCalculator changes
LukaszRozmej May 14, 2024
57805bd
Move ErrorCodes,
LukaszRozmej May 14, 2024
d542546
Revert "Move ErrorCodes,"
LukaszRozmej May 14, 2024
e443f84
more refactors
LukaszRozmej May 14, 2024
fe87832
Big SimulateBridgeHelper refactor
LukaszRozmej May 14, 2024
b408aaf
minor issues fix
OlegJakushkin May 14, 2024
4740cc1
more refactor
LukaszRozmej May 14, 2024
9701065
not null
LukaszRozmej May 14, 2024
e4efdc6
minor Trello issues fixes
OlegJakushkin May 14, 2024
944566c
merge fixes
OlegJakushkin May 14, 2024
2343eb8
merge master
OlegJakushkin May 14, 2024
17fdf84
minor fix
OlegJakushkin May 14, 2024
d85bf1d
dotnet format
OlegJakushkin May 14, 2024
98f2a1f
Add SimulateTransactionProcessor
LukaszRozmej May 14, 2024
a9e1b70
Merge branch 'feature/eth_multicall' of github.com:NethermindEth/neth…
LukaszRozmej May 14, 2024
997ea55
Bring back AnalyseInBackgroundIfRequired
LukaszRozmej May 14, 2024
8b37572
fix
LukaszRozmej May 14, 2024
a72a6a8
revert format
LukaszRozmej May 14, 2024
0acf045
Review updates
OlegJakushkin May 16, 2024
67a4c43
Merge branch 'feature/eth_multicall' of https://github.com/Nethermind…
OlegJakushkin May 16, 2024
a201a10
merged
OlegJakushkin May 16, 2024
77fda4b
Minor fixes
OlegJakushkin May 16, 2024
1ac41f5
review RLP fixes
OlegJakushkin May 17, 2024
ea29971
Merge remote-tracking branch 'origin/master' into feature/eth_multicall
OlegJakushkin May 17, 2024
dc24c33
integrating SecondsPerSlot
OlegJakushkin May 17, 2024
ad2d7f9
merge fixes
OlegJakushkin May 23, 2024
c3923f3
merge fixes
OlegJakushkin May 23, 2024
f3c4056
minor review fixes
OlegJakushkin May 23, 2024
00c0bd7
Merge branch 'master' into feature/eth_multicall
OlegJakushkin May 23, 2024
37219c5
merge
OlegJakushkin May 28, 2024
88fea58
minor clean-up
OlegJakushkin May 28, 2024
9db6836
minor cleanup
LukaszRozmej May 29, 2024
57461c3
merge fix
LukaszRozmej May 29, 2024
c804851
fix
LukaszRozmej May 29, 2024
9adf550
fix
LukaszRozmej May 29, 2024
9613d30
Merge remote-tracking branch 'origin/master' into feature/eth_multicall
LukaszRozmej May 29, 2024
5f324a9
merge fix
LukaszRozmej May 29, 2024
dfd66a2
Merge branch 'master' into feature/eth_multicall
benaadams May 31, 2024
3ac4834
Merge remote-tracking branch 'origin/master' into feature/eth_multicall
OlegJakushkin Jun 3, 2024
f84c67b
Review based changes
OlegJakushkin Jun 3, 2024
53a79b1
Minor review fixes
OlegJakushkin Jun 3, 2024
d1cde8f
some minor fixes
OlegJakushkin Jun 3, 2024
9440eda
merge
OlegJakushkin Jun 10, 2024
aa6277b
new call result layout
OlegJakushkin Jun 10, 2024
3838f3e
move of RPC structures to Facade
OlegJakushkin Jun 10, 2024
69528a1
Merge remote-tracking branch 'origin/master' into feature/eth_multicall
OlegJakushkin Jun 10, 2024
b559c8c
Removing a flag
OlegJakushkin Jun 10, 2024
e1a1f93
minor fixes
OlegJakushkin Jun 10, 2024
9b8da71
minor fix
OlegJakushkin Jun 10, 2024
9ce74e7
minor fixes
OlegJakushkin Jun 10, 2024
c14d088
minor fixes
OlegJakushkin Jun 10, 2024
7a6eee2
merge
OlegJakushkin Jun 10, 2024
3acbf4a
merge fixes
OlegJakushkin Jun 10, 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
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ public UserOperationTxTracer(
public bool IsTracingBlockHash => false;
public bool IsTracingAccess => true;
public bool IsTracingFees => false;
public bool IsTracing => IsTracingReceipt || IsTracingActions || IsTracingOpLevelStorage || IsTracingMemory || IsTracingInstructions || IsTracingRefunds || IsTracingCode || IsTracingStack || IsTracingBlockHash || IsTracingAccess || IsTracingFees;
public bool IsTracing => IsTracingReceipt || IsTracingActions || IsTracingOpLevelStorage || IsTracingMemory || IsTracingInstructions || IsTracingRefunds || IsTracingCode || IsTracingStack || IsTracingBlockHash || IsTracingAccess || IsTracingFees || IsTracingEventLogs;
public bool IsTracingEventLogs => false;

public void MarkAsSuccess(Address recipient, long gasSpent, byte[] output, LogEntry[] logs,
Keccak? stateRoot = null)
Expand Down Expand Up @@ -335,5 +336,10 @@ public void ReportFees(UInt256 fees, UInt256 burntFees)
{
throw new NotImplementedException();
}

public void ReportEvent(LogEntry logEntry)
{
throw new NotImplementedException();
}
}
}
8 changes: 8 additions & 0 deletions src/Nethermind/Nethermind.Api/NethermindApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,13 @@ public NethermindApi(IConfigProvider configProvider, IJsonSerializer jsonSeriali
}

private IReadOnlyDbProvider? _readOnlyDbProvider;
private IReadOnlyDbProvider? _multiCallReadOnlyDbProvider;

public IBlockchainBridge CreateBlockchainBridge()
{
ReadOnlyBlockTree readOnlyTree = BlockTree!.AsReadOnly();
LazyInitializer.EnsureInitialized(ref _readOnlyDbProvider, () => new ReadOnlyDbProvider(DbProvider, false));
LazyInitializer.EnsureInitialized(ref _multiCallReadOnlyDbProvider, () => new ReadOnlyDbProvider(DbProvider, true));
LukaszRozmej marked this conversation as resolved.
Show resolved Hide resolved

// TODO: reuse the same trie cache here
ReadOnlyTxProcessingEnv readOnlyTxProcessingEnv = new(
Expand All @@ -84,12 +86,18 @@ public IBlockchainBridge CreateBlockchainBridge()
readOnlyTree,
SpecProvider,
LogManager);
IMultiCallBlocksProcessingEnv multiCallReadOnlyBlocksProcessingEnv = MultiCallReadOnlyBlocksProcessingEnv.Create(
_multiCallReadOnlyDbProvider,
SpecProvider,
LogManager);


IMiningConfig miningConfig = ConfigProvider.GetConfig<IMiningConfig>();
IBlocksConfig blocksConfig = ConfigProvider.GetConfig<IBlocksConfig>();

return new BlockchainBridge(
readOnlyTxProcessingEnv,
multiCallReadOnlyBlocksProcessingEnv,
TxPool,
ReceiptFinder,
FilterStore,
Expand Down
3 changes: 2 additions & 1 deletion src/Nethermind/Nethermind.Blockchain/BlockTree.cs
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,7 @@ public AddBlockResult Insert(Block block, BlockTreeInsertBlockOptions insertBloc
private AddBlockResult Suggest(Block? block, BlockHeader header, BlockTreeSuggestOptions options = BlockTreeSuggestOptions.ShouldProcess)
{
bool shouldProcess = options.ContainsFlag(BlockTreeSuggestOptions.ShouldProcess);
bool noPatentCheck = options.ContainsFlag(BlockTreeSuggestOptions.ForceDontValidateParent);
bool fillBeaconBlock = options.ContainsFlag(BlockTreeSuggestOptions.FillBeaconBlock);
bool setAsMain = options.ContainsFlag(BlockTreeSuggestOptions.ForceSetAsMain) ||
!options.ContainsFlag(BlockTreeSuggestOptions.ForceDontSetAsMain) && !shouldProcess;
Expand Down Expand Up @@ -722,7 +723,7 @@ private AddBlockResult Suggest(Block? block, BlockHeader header, BlockTreeSugges

bool parentExists = IsKnownBlock(header.Number - 1, header.ParentHash!) ||
IsKnownBeaconBlock(header.Number - 1, header.ParentHash!);
if (!header.IsGenesis && !parentExists)
if (!header.IsGenesis && !noPatentCheck && !parentExists)
OlegJakushkin marked this conversation as resolved.
Show resolved Hide resolved
{
if (_logger.IsTrace) _logger.Trace($"Could not find parent ({header.ParentHash}) of block {header.Hash}");
return AddBlockResult.UnknownParent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ public enum BlockTreeSuggestOptions
/// Force not to set as main block
/// </summary>
ForceDontSetAsMain = 8,

/// <summary>
/// Force skip parent number is known checks
/// </summary>
ForceDontValidateParent = 8,
OlegJakushkin marked this conversation as resolved.
Show resolved Hide resolved
}

public static class BlockTreeSuggestOptionsExtensions
Expand Down
13 changes: 13 additions & 0 deletions src/Nethermind/Nethermind.Cli/Modules/EthCliModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,19 @@ public JsValue GetProof(string address, string[] storageKeys, string? blockParam
return NodeManager.Post<string>("eth_call", tx, blockParameter ?? "latest").Result;
}

[CliFunction("eth", "multicall")]
public JsValue MultiCall(ulong version, object[] blockCalls, string? blockParameter = null, bool traceTransfers = true)
{
return NodeManager.PostJint("eth_multicall", version, blockCalls, blockParameter ?? "latest", traceTransfers).Result;
}

[CliFunction("eth", "multicallV1")]
public JsValue MultiCallV1(ulong version, object[] blockCalls, string? blockParameter = null, bool traceTransfers = true)
{
return NodeManager.PostJint("eth_multicallV1", 1, blockCalls, blockParameter ?? "latest", traceTransfers).Result;
}


[CliFunction("eth", "getBlockByHash")]
public JsValue GetBlockByHash(string hash, bool returnFullTransactionObjects)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ private ProcessingBranch PrepareProcessingBranch(Block suggestedBlock, Processin
private bool RunSimpleChecksAheadOfProcessing(Block suggestedBlock, ProcessingOptions options)
{
/* a bit hacky way to get the invalid branch out of the processing loop */
if (suggestedBlock.Number != 0 &&
if (!options.ContainsFlag(ProcessingOptions.NoValidation) && suggestedBlock.Number != 0 &&
OlegJakushkin marked this conversation as resolved.
Show resolved Hide resolved
!_blockTree.IsKnownBlock(suggestedBlock.Number - 1, suggestedBlock.ParentHash))
{
if (_logger.IsDebug)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// SPDX-FileCopyrightText: 2023 Demerzel Solutions Limited
// SPDX-License-Identifier: LGPL-3.0-only

using System;
using Nethermind.Core.Crypto;
using Nethermind.Core.Specs;
using Nethermind.Db;
using Nethermind.Evm;
using Nethermind.Logging;

namespace Nethermind.Consensus.Processing;

public interface IMultiCallBlocksProcessingEnv : IReadOnlyTxProcessingEnvBase, IDisposable
OlegJakushkin marked this conversation as resolved.
Show resolved Hide resolved
{
//Instance VM can be edited during processing
ISpecProvider SpecProvider { get; }
MultiCallVirtualMachine Machine { get; }

//We need abilety to get many instances that do not conflict in terms of editable tmp storage - thus we implement env cloning
IMultiCallBlocksProcessingEnv Clone();

//We keep original ProcessingEnv spirit with Build() that can start from any stateRoot
IBlockProcessor GetProcessor();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// SPDX-FileCopyrightText: 2023 Demerzel Solutions Limited
// SPDX-License-Identifier: LGPL-3.0-only

using Nethermind.Evm.TransactionProcessing;

namespace Nethermind.Consensus.Processing;

public interface IReadOnlyTxProcessingEnv : IReadOnlyTxProcessorSource, IReadOnlyTxProcessingEnvBase
OlegJakushkin marked this conversation as resolved.
Show resolved Hide resolved
{
ITransactionProcessor TransactionProcessor { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// SPDX-FileCopyrightText: 2023 Demerzel Solutions Limited
// SPDX-License-Identifier: LGPL-3.0-only

using Nethermind.Blockchain;
using Nethermind.State;

namespace Nethermind.Consensus.Processing;

public interface IReadOnlyTxProcessingEnvBase
OlegJakushkin marked this conversation as resolved.
Show resolved Hide resolved
{
IStateReader StateReader { get; }
IWorldState StateProvider { get; }
IBlockTree BlockTree { get; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// SPDX-FileCopyrightText: 2023 Demerzel Solutions Limited
// SPDX-License-Identifier: LGPL-3.0-only

using Nethermind.Core;
using Nethermind.Db;
using Nethermind.Evm.Tracing;

namespace Nethermind.Consensus.Processing;

public class MultiCallChainProcessor : OneTimeChainProcessor
OlegJakushkin marked this conversation as resolved.
Show resolved Hide resolved
{
public MultiCallChainProcessor(IReadOnlyDbProvider readOnlyDbProvider, IBlockchainProcessor processor) : base(readOnlyDbProvider, processor)
{
}

public override Block? Process(Block block, ProcessingOptions options, IBlockTracer tracer)
{
lock (_lock)
{
Block result;
result = _processor.Process(block, options, tracer);
return result;
}
}

public override void Dispose()
{
_readOnlyDbProvider.ClearTempChanges();
base.Dispose();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
// SPDX-FileCopyrightText: 2023 Demerzel Solutions Limited
// SPDX-License-Identifier: LGPL-3.0-only

using System;
using Nethermind.Blockchain;
using Nethermind.Blockchain.Receipts;
using Nethermind.Blockchain.Synchronization;
using Nethermind.Consensus.Comparers;
using Nethermind.Consensus.Rewards;
using Nethermind.Consensus.Validators;
using Nethermind.Core.Crypto;
using Nethermind.Core.Specs;
using Nethermind.Db;
using Nethermind.Db.Blooms;
using Nethermind.Evm;
using Nethermind.Evm.TransactionProcessing;
using Nethermind.Logging;
using Nethermind.State;
using Nethermind.State.Repositories;
using Nethermind.Trie.Pruning;

namespace Nethermind.Consensus.Processing;

public class MultiCallReadOnlyBlocksProcessingEnv : ReadOnlyTxProcessingEnvBase, IMultiCallBlocksProcessingEnv
{
private readonly ITrieStore? _trieStore;
private readonly ILogManager? _logManager;
private readonly IBlockValidator _blockValidator;
private readonly InMemoryReceiptStorage _receiptStorage;
public ITransactionProcessor TransactionProcessor { get; }
OlegJakushkin marked this conversation as resolved.
Show resolved Hide resolved
public ISpecProvider SpecProvider { get; }
public MultiCallVirtualMachine Machine { get; }

//We need ability to get many instances that do not conflict in terms of editable tmp storage - thus we implement env cloning
public static IMultiCallBlocksProcessingEnv Create(IReadOnlyDbProvider? readOnlyDbProvider,
ISpecProvider? specProvider,
ILogManager? logManager
)
{
ReadOnlyDbProvider? DbProvider = new(readOnlyDbProvider, true);
TrieStore trieStore = new(readOnlyDbProvider.StateDb, logManager);
OlegJakushkin marked this conversation as resolved.
Show resolved Hide resolved
BlockTree BlockTree = new(readOnlyDbProvider,
OlegJakushkin marked this conversation as resolved.
Show resolved Hide resolved
new ChainLevelInfoRepository(readOnlyDbProvider.BlockInfosDb),
specProvider,
NullBloomStorage.Instance,
new SyncConfig(),
logManager);

return new MultiCallReadOnlyBlocksProcessingEnv(
DbProvider,
trieStore,
BlockTree,
specProvider,
logManager);
}

public IMultiCallBlocksProcessingEnv Clone()
{
return Create(DbProvider, SpecProvider, _logManager);
}

private MultiCallReadOnlyBlocksProcessingEnv(
IReadOnlyDbProvider? readOnlyDbProvider,
ITrieStore? trieStore,
IBlockTree? blockTree,
ISpecProvider? specProvider,
ILogManager? logManager) : base(readOnlyDbProvider, trieStore, blockTree,
logManager)
{

_trieStore = trieStore;
_logManager = logManager;
SpecProvider = specProvider;
OlegJakushkin marked this conversation as resolved.
Show resolved Hide resolved


_receiptStorage = new InMemoryReceiptStorage();

Machine = new MultiCallVirtualMachine(BlockhashProvider, specProvider, logManager);

HeaderValidator headerValidator = new(
BlockTree,
Always.Valid,
SpecProvider,
_logManager);

_blockValidator = new MultiCallBlockValidator(new TxValidator(SpecProvider.ChainId),
headerValidator,
Always.Valid,
SpecProvider,
_logManager);

}

public IBlockProcessor GetProcessor()
{
var yransactionProcessor = new TransactionProcessor(SpecProvider, StateProvider, Machine, _logManager);
OlegJakushkin marked this conversation as resolved.
Show resolved Hide resolved

return new BlockProcessor(SpecProvider,
_blockValidator,
NoBlockRewards.Instance,
new BlockProcessor.BlockValidationTransactionsExecutor(yransactionProcessor, StateProvider),
StateProvider,
_receiptStorage,
OlegJakushkin marked this conversation as resolved.
Show resolved Hide resolved
NullWitnessCollector.Instance,
_logManager);
}

public void Dispose()
{
_trieStore?.Dispose();
DbProvider.Dispose();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ public class OneTimeChainProcessor : IBlockchainProcessor
{
public ITracerBag Tracers => _processor.Tracers;

private readonly IBlockchainProcessor _processor;
private readonly IReadOnlyDbProvider _readOnlyDbProvider;
protected readonly IBlockchainProcessor _processor;
protected readonly IReadOnlyDbProvider _readOnlyDbProvider;

private object _lock = new();
protected object _lock = new();

public OneTimeChainProcessor(IReadOnlyDbProvider readOnlyDbProvider, IBlockchainProcessor processor)
{
Expand All @@ -35,7 +35,7 @@ public Task StopAsync(bool processRemainingBlocks = false)
return _processor.StopAsync(processRemainingBlocks);
}

public Block? Process(Block block, ProcessingOptions options, IBlockTracer tracer)
public virtual Block? Process(Block block, ProcessingOptions options, IBlockTracer tracer)
{
lock (_lock)
{
Expand Down Expand Up @@ -64,7 +64,7 @@ public bool IsProcessingBlocks(ulong? maxProcessingInterval)
public event EventHandler<IBlockchainProcessor.InvalidBlockEventArgs>? InvalidBlock;
#pragma warning restore 67

public void Dispose()
public virtual void Dispose()
{
_processor?.Dispose();
_readOnlyDbProvider?.Dispose();
Expand Down
Loading