-
Notifications
You must be signed in to change notification settings - Fork 430
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 System Transactions to mainnet #6206
Closed
Closed
Changes from 111 commits
Commits
Show all changes
116 commits
Select commit
Hold shift + click to select a range
7dafa25
resolved conflicts
Demuirgos 06cb959
fix ethereum tests
MarekM25 4205ff5
whitespace fix
MarekM25 18e0a6e
Benchmarks.sln
MarekM25 3965ea5
test working fine
MarekM25 a1cebce
a few fixes
MarekM25 899547f
a few more cleanups
MarekM25 6814bf7
cosmetic
MarekM25 ae3a469
fix tests
MarekM25 bc8df77
cosmetic
MarekM25 9a2dfc6
Revert volta.cfg
MarekM25 5f709f0
fix build
MarekM25 e1aa156
Merge branch 'master' into 4788_systemTx
MarekM25 0e0ae94
WIP
MarekM25 1527828
Special handling for System account
MarekM25 3e595d3
better solution?
MarekM25 ef38eab
fix
MarekM25 008abef
even better solution?
MarekM25 3b03a83
alternative solution
MarekM25 a2bae6e
final solution?
MarekM25 67df5df
one more try
MarekM25 bb5b89c
revert volta.cfg
MarekM25 1df46d0
cleanup
MarekM25 95a9b4a
cosmetic
MarekM25 a8366dd
Merge master
Demuirgos 4a7d599
apply suggestions
Demuirgos ded036e
further experiments
MarekM25 84892e7
Resolved conflict
MarekM25 c037823
IgnoredAccount
MarekM25 a62aee4
MainnetSystemCalls in chainspec
MarekM25 7258c88
cosmetic fixes
MarekM25 664e095
cosmetic
MarekM25 129fbfb
fix
MarekM25 9f48de9
Merge branch 'master' into 4788_systemTx
MarekM25 0ff3605
fix rest of the tests
MarekM25 d5bdb07
test system tx
MarekM25 b13fefe
adjust address to tests
MarekM25 54073e8
change address for experiments
MarekM25 7d96dec
resolve conflicts, updated address
MarekM25 65bb610
Resolved conflicts
MarekM25 3e4aad7
one more experiment
MarekM25 6348277
experiments
MarekM25 dce9c1c
more cosmetic
MarekM25 33de708
refactoring
MarekM25 30bacdd
fix
MarekM25 12bfa82
Update address
MarekM25 f80ed7b
cosmetic changes
MarekM25 f6cd317
cosmetic
MarekM25 43e307e
cosmetic
MarekM25 32722b9
conflicts
MarekM25 88e0214
adjust ProofRpcModuleTests expected values
Demuirgos 65c0384
Revert "adjust ProofRpcModuleTests expected values"
Demuirgos bd955d8
adjust ProofRPC tests
Demuirgos ff0d882
Merge remote-tracking branch 'origin/master' into systemTx_experiment
Demuirgos a1fdcd3
update spec tests
Demuirgos 6660f9e
Merge remote-tracking branch 'origin/master' into systemTx_experiment
Demuirgos 95fc31f
Merge master and resolve conflicts
Demuirgos facf07c
minor refactor + fix
Demuirgos 883c9ef
extract systemTxProcessor selection into method
Demuirgos f9b8725
Merge remote-tracking branch 'origin/master' into systemTx_experiment
Demuirgos f67633a
attempt to fix failing tests
Demuirgos c061d9c
Merge remote-tracking branch 'origin/master' into systemTx_experiment
Demuirgos c139e06
geth like tx processor experiment
Demuirgos 73090d1
Merged master
Demuirgos 55c4a13
simplified attempt at separating txProcessor and systxProcessor
Demuirgos 2aad40c
Merge remote-tracking branch 'origin/master' into systemTx_experiment
Demuirgos 4414ade
fix build
Demuirgos 570b064
fix most faling tests
Demuirgos 9a20cd3
fix 1 extra test
Demuirgos 7d56a52
attempt #1
Demuirgos 7695942
merged master
Demuirgos 62776c1
Merge master
Demuirgos 4ab7379
fix merge issue
Demuirgos 5575a6e
expose IsSystemEnv deep in EVM stackcalls
Demuirgos a8ef491
disallow createTx from targeting systemAddress
Demuirgos eba84d8
fix build issue
Demuirgos eaf42f2
merge master
Demuirgos 99d7456
test fix attempt, ws fix
Demuirgos 1895940
merge master
Demuirgos e9d21b9
* merge master
Demuirgos 80ce2ed
Merge branch 'master' into systemTx_experiment
Demuirgos c966cf0
fix comment duplicate
Demuirgos 4a16e48
Merge branch 'master' into systemTx_experiment
kamilchodola 0102295
merged master, resolved conflicts
Demuirgos eaf7041
merge master and resolve conflicts
Demuirgos 676c2dd
Merge branch 'master' into systemTx_experiment
kamilchodola deea212
Merge branch 'systemTx_experiment' of https:/NethermindEt…
kamilchodola 9fa73bf
Perf/somepath hashdb (#6798)
kamilchodola 48be801
Merge branch 'release/1.26.0-exp.3-halfPath' into systemTx_experiment
kamilchodola d8570ba
initial master merge
Demuirgos 68aba28
fix build issues
Demuirgos e1ced0e
Merge branch 'master' into systemTx_experiment
MarekM25 f08df88
removed problematic methods
Demuirgos bbf421f
Merge branch 'master' into systemTx_experiment
Demuirgos bf09e5b
changed IBlockProcessor dependencies in ctor
Demuirgos 8a3a481
Merge branch 'systemTx_experiment' of https:/NethermindEt…
Demuirgos 11dc882
fix build issues
Demuirgos a644a80
fix failing build test
Demuirgos 6dbd5e9
ws fixes
Demuirgos 27dfaf5
Merge master, resolve conflitct, resolve build issues
Demuirgos 1e208f0
experiment 1 : if system call altering system account abort state mod…
Demuirgos 2f01efb
undo last change
Demuirgos de470e8
Merge master
Demuirgos ce75a7d
fix build issue
Demuirgos b926560
merge master
Demuirgos df92bce
remove isSystemCall from IWorldState Interface
Demuirgos c0f6ad3
mistake fix
Demuirgos 0344b57
Merge branch 'master' into systemTx_experiment
Demuirgos 7881cb5
Merge branch 'systemTx_experiment' of https:/NethermindEt…
Demuirgos 53c01ef
fix build issues
Demuirgos ba196ec
fix failing test, and minor cleanup
Demuirgos 2f1e06a
Merge branch 'master' into systemTx_experiment
rjnrohit 6569494
Merge branch 'master' into systemTx_experiment
rjnrohit 0c357ed
cosmetics
rjnrohit b625aa4
Merge branch 'master' into systemTx_experiment
rjnrohit 999021a
Merge branch 'master' into systemTx_experiment
rjnrohit 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
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
70 changes: 44 additions & 26 deletions
70
src/Nethermind/Nethermind.Blockchain/BeaconBlockRoot/BeaconBlockRootHandler.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 |
---|---|---|
@@ -1,39 +1,57 @@ | ||
// SPDX-FileCopyrightText: 2023 Demerzel Solutions Limited | ||
// SPDX-License-Identifier: LGPL-3.0-only | ||
|
||
using Nethermind.Core.Specs; | ||
using System; | ||
using Nethermind.Core; | ||
using Nethermind.Int256; | ||
using Nethermind.State; | ||
using Nethermind.Core.Crypto; | ||
using Nethermind.Core.Extensions; | ||
using Nethermind.Core.Specs; | ||
using Nethermind.Crypto; | ||
using Nethermind.Evm.Tracing; | ||
using Nethermind.Evm.TransactionProcessing; | ||
using Nethermind.Int256; | ||
using Nethermind.Logging; | ||
using Nethermind.State; | ||
|
||
namespace Nethermind.Consensus.BeaconBlockRoot; | ||
|
||
namespace Nethermind.Blockchain.BeaconBlockRoot; | ||
public class BeaconBlockRootHandler : IBeaconBlockRootHandler | ||
{ | ||
public void ApplyContractStateChanges(Block block, IReleaseSpec spec, IWorldState stateProvider) | ||
private readonly ITransactionProcessor _processor; | ||
private static Address Default4788Address = new Address("0x000f3df6d732807ef1319fb7b8bb8522d0beac02"); | ||
private readonly ILogger _logger; | ||
private const long GasLimit = 30_000_000L; | ||
public BeaconBlockRootHandler( | ||
ITransactionProcessor processor, | ||
ILogManager logManager) | ||
{ | ||
_processor = processor; | ||
_logger = logManager.GetClassLogger(); | ||
} | ||
public void ExecuteSystemCall(Block block, IReleaseSpec spec) | ||
{ | ||
BlockHeader? header = block.Header; | ||
if (!spec.IsBeaconBlockRootAvailable || | ||
block.IsGenesis || | ||
block.Header.ParentBeaconBlockRoot is null) | ||
return; | ||
|
||
Address eip4788Account = spec.Eip4788ContractAddress ?? Eip4788Constants.BeaconRootsAddress; | ||
|
||
if (!stateProvider.AccountExists(eip4788Account)) | ||
return; | ||
|
||
UInt256 timestamp = (UInt256)block.Timestamp; | ||
Hash256 parentBeaconBlockRoot = block.ParentBeaconBlockRoot; | ||
|
||
UInt256.Mod(timestamp, Eip4788Constants.HistoryBufferLength, out UInt256 timestampReduced); | ||
UInt256 rootIndex = timestampReduced + Eip4788Constants.HistoryBufferLength; | ||
|
||
StorageCell tsStorageCell = new(eip4788Account, timestampReduced); | ||
StorageCell brStorageCell = new(eip4788Account, rootIndex); | ||
|
||
stateProvider.Set(tsStorageCell, Bytes.WithoutLeadingZeros(timestamp.ToBigEndian()).ToArray()); | ||
stateProvider.Set(brStorageCell, Bytes.WithoutLeadingZeros(parentBeaconBlockRoot.Bytes).ToArray()); | ||
header.IsGenesis || | ||
header.ParentBeaconBlockRoot is null) return; | ||
|
||
Transaction? transaction = new() | ||
{ | ||
Value = UInt256.Zero, | ||
Data = header.ParentBeaconBlockRoot.Bytes.ToArray(), | ||
Demuirgos marked this conversation as resolved.
Show resolved
Hide resolved
|
||
To = spec.Eip4788ContractAddress ?? Default4788Address, | ||
SenderAddress = Address.SystemUser, | ||
GasLimit = GasLimit, | ||
GasPrice = UInt256.Zero, | ||
}; | ||
transaction.Hash = transaction.CalculateHash(); | ||
|
||
try | ||
{ | ||
_processor.Execute(transaction, header, NullTxTracer.Instance); | ||
} | ||
catch (Exception e) | ||
{ | ||
if (_logger.IsError) _logger.Error("Error during calling BeaconBlockRoot contract", e); | ||
} | ||
} | ||
} |
6 changes: 3 additions & 3 deletions
6
src/Nethermind/Nethermind.Blockchain/BeaconBlockRoot/IBeaconBlockRootHandler.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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
// SPDX-FileCopyrightText: 2023 Demerzel Solutions Limited | ||
// SPDX-License-Identifier: LGPL-3.0-only | ||
|
||
using Nethermind.Core.Specs; | ||
using Nethermind.Core; | ||
using Nethermind.Core.Specs; | ||
using Nethermind.State; | ||
|
||
namespace Nethermind.Consensus.BeaconBlockRoot; | ||
namespace Nethermind.Blockchain.BeaconBlockRoot; | ||
public interface IBeaconBlockRootHandler | ||
{ | ||
void ApplyContractStateChanges(Block block, IReleaseSpec spec, IWorldState state); | ||
void ExecuteSystemCall(Block block, IReleaseSpec spec); | ||
} |
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
Empty file modified
0
src/Nethermind/Nethermind.Blockchain/FullPruning/FullPruner.cs
100755 → 100644
Empty file.
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
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.
Can we produce block at all if we have no ParentBeaconBlockRoot post-Cancun?