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 250 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
3 changes: 3 additions & 0 deletions src/Nethermind/Ethereum.Test.Base/BlockchainTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,11 @@ protected async Task<EthereumTestResult> RunTest(BlockchainTest test, Stopwatch?
IHeaderValidator headerValidator = new HeaderValidator(blockTree, Sealer, specProvider, _logManager);
IUnclesValidator unclesValidator = new UnclesValidator(blockTree, headerValidator, _logManager);
IBlockValidator blockValidator = new BlockValidator(txValidator, headerValidator, unclesValidator, specProvider, _logManager);
CodeInfoRepository codeInfoRepository = new();
IVirtualMachine virtualMachine = new VirtualMachine(
blockhashProvider,
specProvider,
codeInfoRepository,
_logManager);

IBlockProcessor blockProcessor = new BlockProcessor(
Expand All @@ -162,6 +164,7 @@ protected async Task<EthereumTestResult> RunTest(BlockchainTest test, Stopwatch?
specProvider,
stateProvider,
virtualMachine,
codeInfoRepository,
_logManager),
stateProvider),
stateProvider,
Expand Down
3 changes: 3 additions & 0 deletions src/Nethermind/Ethereum.Test.Base/GeneralTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,18 @@ protected EthereumTestResult RunTest(GeneralStateTest test, ITxTracer txTracer)
TrieStore trieStore = new(stateDb, _logManager);
WorldState stateProvider = new(trieStore, codeDb, _logManager);
IBlockhashProvider blockhashProvider = new TestBlockhashProvider();
CodeInfoRepository codeInfoRepository = new();
IVirtualMachine virtualMachine = new VirtualMachine(
blockhashProvider,
specProvider,
codeInfoRepository,
_logManager);

TransactionProcessor transactionProcessor = new(
specProvider,
stateProvider,
virtualMachine,
codeInfoRepository,
_logManager);

InitializeTestState(test, stateProvider, specProvider);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ private UserOperationSimulator UserOperationSimulator(Address entryPoint)

ReadOnlyTxProcessingEnvFactory readOnlyTxProcessingEnvFactory = new(
getFromApi.WorldStateManager!,
getFromApi.BlockTree,
getFromApi.BlockTree!,
getFromApi.SpecProvider,
getFromApi.LogManager);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ResultWrapper<Hash256> Simulate(UserOperation userOperation,
UInt256? timestamp = null,
CancellationToken cancellationToken = default);

BlockchainBridge.CallOutput EstimateGas(BlockHeader header, Transaction tx,
CallOutput EstimateGas(BlockHeader header, Transaction tx,
CancellationToken cancellationToken);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ private Transaction BuildSimulateValidationTransaction(
}

[Todo("Refactor once BlockchainBridge is separated")]
public BlockchainBridge.CallOutput EstimateGas(BlockHeader header, Transaction tx, CancellationToken cancellationToken)
public CallOutput EstimateGas(BlockHeader header, Transaction tx, CancellationToken cancellationToken)
{
ReadOnlyTxProcessingEnv txProcessingEnv = _readOnlyTxProcessingEnvFactory.Create();
using IReadOnlyTransactionProcessor transactionProcessor = txProcessingEnv.Build(header.StateRoot!);
Expand All @@ -202,7 +202,7 @@ public BlockchainBridge.CallOutput EstimateGas(BlockHeader header, Transaction t
GasEstimator gasEstimator = new(transactionProcessor, _stateProvider, _specProvider, _blocksConfig);
long estimate = gasEstimator.Estimate(tx, header, estimateGasTracer, GasEstimator.DefaultErrorMargin, cancellationToken);

return new BlockchainBridge.CallOutput
return new CallOutput
{
Error = tryCallResult.Success ? estimateGasTracer.Error : tryCallResult.Error,
GasSpent = estimate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public IEnumerable<Transaction> GetTransactions(BlockHeader parent, long gasLimi
// TODO: Remove logging, just for testing
_logger.Info($"Constructed tx from {userOperationsToInclude!.Count} userOperations: {userOperationTransaction.Hash}");

BlockchainBridge.CallOutput callOutput = _userOperationSimulators[entryPoint].EstimateGas(parent, userOperationTransaction, CancellationToken.None);
CallOutput callOutput = _userOperationSimulators[entryPoint].EstimateGas(parent, userOperationTransaction, CancellationToken.None);
FailedOp? failedOp = txBuilder.DecodeEntryPointOutputError(callOutput.OutputData);
if (failedOp is not null)
{
Expand Down
10 changes: 10 additions & 0 deletions src/Nethermind/Nethermind.Api/NethermindApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
using Nethermind.Evm.TransactionProcessing;
using Nethermind.Facade;
using Nethermind.Facade.Eth;
using Nethermind.Facade.Simulate;
using Nethermind.Grpc;
using Nethermind.JsonRpc;
using Nethermind.JsonRpc.Modules;
Expand Down Expand Up @@ -81,11 +82,20 @@ public IBlockchainBridge CreateBlockchainBridge()
SpecProvider,
LogManager);

SimulateReadOnlyBlocksProcessingEnvFactory simulateReadOnlyBlocksProcessingEnvFactory =
new SimulateReadOnlyBlocksProcessingEnvFactory(
WorldStateManager!,
readOnlyTree,
DbProvider!,
SpecProvider!,
LogManager);

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

return new BlockchainBridge(
readOnlyTxProcessingEnv,
simulateReadOnlyBlocksProcessingEnvFactory,
TxPool,
ReceiptFinder,
FilterStore,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,17 @@ public void Test()
LimboLogs.Instance);
StateReader stateReader = new(trieStore, dbProvider.GetDb<IDb>(DbNames.State), LimboLogs.Instance);
BlockhashProvider blockhashProvider = new(blockTree, specProvider, stateProvider, LimboLogs.Instance);
CodeInfoRepository codeInfoRepository = new();
VirtualMachine virtualMachine = new(
blockhashProvider,
specProvider,
codeInfoRepository,
LimboLogs.Instance);
TransactionProcessor txProcessor = new(
specProvider,
stateProvider,
virtualMachine,
codeInfoRepository,
LimboLogs.Instance);
BlockProcessor blockProcessor = new(
specProvider,
Expand Down
3 changes: 3 additions & 0 deletions src/Nethermind/Nethermind.Blockchain.Test/ReorgTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,17 @@ public void Setup()
LimboLogs.Instance,
transactionComparerProvider.GetDefaultComparer());
BlockhashProvider blockhashProvider = new(_blockTree, specProvider, stateProvider, LimboLogs.Instance);
CodeInfoRepository codeInfoRepository = new();
VirtualMachine virtualMachine = new(
blockhashProvider,
specProvider,
codeInfoRepository,
LimboLogs.Instance);
TransactionProcessor transactionProcessor = new(
specProvider,
stateProvider,
virtualMachine,
codeInfoRepository,
LimboLogs.Instance);

BlockProcessor blockProcessor = new(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public void Proper_transactions_selected(ProperTransactionsSelectedTestCase test
MemDb stateDb = new();
MemDb codeDb = new();
TrieStore trieStore = new(stateDb, LimboLogs.Instance);
WorldState stateProvider = new(trieStore, codeDb, LimboLogs.Instance);
IWorldState stateProvider = new WorldState(trieStore, codeDb, LimboLogs.Instance);
StateReader _ = new(new TrieStore(stateDb, LimboLogs.Instance), codeDb, LimboLogs.Instance);
ISpecProvider specProvider = Substitute.For<ISpecProvider>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ public void Proper_transactions_selected(TransactionSelectorTests.ProperTransact
MemDb stateDb = new();
MemDb codeDb = new();
TrieStore trieStore = new(stateDb, LimboLogs.Instance);
WorldState stateProvider = new(trieStore, codeDb, LimboLogs.Instance);
IWorldState stateProvider = new WorldState(trieStore, codeDb, LimboLogs.Instance);
ISpecProvider specProvider = Substitute.For<ISpecProvider>();

IReleaseSpec spec = testCase.ReleaseSpec;
Expand Down
21 changes: 8 additions & 13 deletions src/Nethermind/Nethermind.Blockchain/BlockTree.cs
Original file line number Diff line number Diff line change
Expand Up @@ -801,22 +801,17 @@ private void DeleteBlocks(Hash256 deletePointer)
return childHash;
}

public bool IsMainChain(BlockHeader blockHeader)
{
ChainLevelInfo? chainLevelInfo = LoadLevel(blockHeader.Number);
bool isMain = chainLevelInfo is not null && chainLevelInfo.MainChainBlock?.BlockHash.Equals(blockHeader.Hash) == true;
return isMain;
}
public bool IsMainChain(BlockHeader blockHeader) =>
LoadLevel(blockHeader.Number)?.MainChainBlock?.BlockHash.Equals(blockHeader.Hash) == true;

public bool IsMainChain(Hash256 blockHash)
public bool IsMainChain(Hash256 blockHash, bool throwOnMissingHash = true)
{
BlockHeader? header = FindHeader(blockHash, BlockTreeLookupOptions.TotalDifficultyNotNeeded);
if (header is null)
{
throw new InvalidOperationException($"Not able to retrieve block number for an unknown block {blockHash}");
}

return IsMainChain(header);
return header is not null
? IsMainChain(header)
: throwOnMissingHash
? throw new InvalidOperationException($"Not able to retrieve block number for an unknown block {blockHash}")
: false;
}

public BlockHeader? FindBestSuggestedHeader() => BestSuggestedHeader;
Expand Down
Loading
Loading