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

Implement Gnosis beacon chain push withdrawals #5160

Merged
merged 58 commits into from
Apr 3, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
2080c2a
Add preliminary `WithdrawalProcessor` for Aura
rubo Jan 11, 2023
ac4f38e
Merge branch 'master' into feature/aura-withdrawals
rubo Jan 17, 2023
a35b5fc
Merge branch 'master' into feature/aura-withdrawals
rubo Jan 18, 2023
f473aca
Move `Nethermind.Merge.AuRa.Test` to `Tests`
rubo Jan 18, 2023
a27abbe
Implement withdrawal contract handling
rubo Jan 18, 2023
92c3198
Merge branch 'master' into feature/aura-withdrawals
rubo Jan 21, 2023
d7b23f6
Merge branch 'master' into feature/aura-withdrawals
rubo Jan 30, 2023
ce7d0a0
Revert withdrawals null check revision
rubo Jan 30, 2023
f512660
Introduce `NullWithdrawalProcessor` for pre-Merge Aura
rubo Jan 31, 2023
27970b4
Fix withdrawal array initialization
rubo Jan 31, 2023
b333924
Remove `WithdrawalContractTransition`
rubo Jan 31, 2023
bc324a0
Add withdrawals contract ABI
rubo Jan 31, 2023
c13709f
Fix formatting
rubo Jan 31, 2023
caf55e8
Merge branch 'master' into feature/aura-withdrawals
rubo Feb 6, 2023
71046ca
Move withdrawals to `Nethermind.Merge.AuRa`
rubo Feb 6, 2023
f38c4c1
Move withdrawal contract to `Netmermind.Merge.AuRa`
rubo Feb 6, 2023
3d28048
Merge branch 'master' into feature/aura-withdrawals
rubo Feb 14, 2023
7158bf8
Rename withdrawal contract method
rubo Feb 15, 2023
05bffa9
Add devnet configuration
rubo Feb 16, 2023
d5bf65e
Change validator address
rubo Feb 16, 2023
c80933e
Update chainspec
rubo Feb 17, 2023
e75806f
Merge branch 'master' into feature/aura-withdrawals
rubo Feb 21, 2023
e1e735f
Remove array pooling
rubo Feb 23, 2023
584378b
Update `executeSystemWithdrawals` signature
rubo Mar 1, 2023
1fb7a0f
Merge branch 'master' into feature/aura-withdrawals
rubo Mar 1, 2023
1a72078
Revise withdrawals contract address
rubo Mar 1, 2023
d70c230
Merge branch 'master' into feature/aura-withdrawals
rubo Mar 3, 2023
c7b201f
Merge branch 'master' into feature/aura-withdrawals
rubo Mar 6, 2023
c57de41
Merge branch 'master' into feature/aura-withdrawals
rubo Mar 7, 2023
3020507
Merge branch 'master' into feature/aura-withdrawals
rubo Mar 16, 2023
7fdfd07
Merge branch 'master' into feature/aura-withdrawals
rubo Mar 17, 2023
2797f8d
Refactor Engine API tests to support Aura
rubo Mar 21, 2023
00fd013
Merge branch 'master' into feature/aura-withdrawals
rubo Mar 21, 2023
9b87bde
Remove redundant comments
rubo Mar 21, 2023
d6273de
Remove Gnosis withdrawals devnet config
rubo Mar 21, 2023
9b56970
Rename `AuRaMergeEngineModuleTests`
rubo Mar 24, 2023
908c9ec
Add withdrawal processor tests
rubo Mar 24, 2023
7a29fce
Merge branch 'master' into feature/aura-withdrawals
rubo Mar 28, 2023
a1a82eb
Merge branch 'master' into feature/aura-withdrawals
rubo Mar 28, 2023
7464ff0
Revise tests
rubo Mar 28, 2023
0311b88
Revise withdrawal contract processing
rubo Mar 28, 2023
d6bf218
Remove devnet chain spec
rubo Mar 28, 2023
7cb0e9c
Revise withdrawal error handling
rubo Mar 29, 2023
296c1f1
add Can_load_chiado
MarekM25 Mar 30, 2023
5b8621e
Merge branch 'feature/aura-withdrawals' of https://github.com/netherm…
MarekM25 Mar 30, 2023
972f3c6
Remove redundant stuff
rubo Mar 30, 2023
8f475e2
Revise chain spec tests
rubo Mar 30, 2023
a3c1c63
Merge branch 'master' into feature/aura-withdrawals
rubo Mar 30, 2023
11bc42b
Remove outdated Chains folder
rubo Mar 30, 2023
211e443
Use `ArrayPoolList` for withdrawals (#5512)
LukaszRozmej Mar 30, 2023
682e434
Merge remote-tracking branch 'origin/feature/aura-withdrawals' into f…
rubo Mar 30, 2023
4bb5e4b
renamed WithdrawalProcessor -> ContractWithdrawalProcessor
MarekM25 Mar 31, 2023
594af29
Update withdrawal contract address
rubo Mar 31, 2023
8eb87ba
Rename `ContractWithdrawalProcessor` to `AuraWithdrawalProcessor`
rubo Mar 31, 2023
f190463
Merge branch 'master' into feature/aura-withdrawals
rubo Mar 31, 2023
52aa03a
Move to file scope namespaces
rubo Mar 31, 2023
2507ef5
Implement `IList` in `ArrayPoolList`
rubo Mar 31, 2023
ffc45f8
Implement `IList.Add` explicitly
rubo Apr 3, 2023
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
@@ -0,0 +1,53 @@
// SPDX-FileCopyrightText: 2023 Demerzel Solutions Limited
// SPDX-License-Identifier: LGPL-3.0-only

using System;
using System.Numerics;
using Nethermind.Consensus.Withdrawals;
using Nethermind.Core;
using Nethermind.Core.Specs;
using Nethermind.Logging;
using Nethermind.Specs.ChainSpecStyle;

namespace Nethermind.Consensus.AuRa.Withdrawals;

public class WithdrawalProcessor : IWithdrawalProcessor
{
private readonly ILogger _logger;
private readonly AuRaParameters _auraParams;

public WithdrawalProcessor(AuRaParameters auraParams, ILogManager logManager)
{
ArgumentNullException.ThrowIfNull(logManager);

_auraParams = auraParams ?? throw new ArgumentNullException(nameof(auraParams));
_logger = logManager.GetClassLogger();
}

public void ProcessWithdrawals(Block block, IReleaseSpec spec)
{
if (!spec.WithdrawalsEnabled)
return;

if (_logger.IsTrace) _logger.Trace($"Applying withdrawals for block {block}");

if (block.Withdrawals is not null)
{
foreach (var withdrawal in block.Withdrawals)
{
if (_logger.IsTrace) _logger.Trace($" {(BigInteger)withdrawal.AmountInWei / (BigInteger)Unit.Ether:N3}GNO to account {withdrawal.Address}");

//if (_auraParams.AccountExists(withdrawal.Address))
//{
// _auraParams.AddToBalance(withdrawal.Address, withdrawal.Amount, spec);
//}
//else
//{
// _auraParams.CreateAccount(withdrawal.Address, withdrawal.Amount);
//}
}
}

if (_logger.IsTrace) _logger.Trace($"Withdrawals applied for block {block}");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public void ProcessWithdrawals(Block block, IReleaseSpec spec)

if (spec.WithdrawalsEnabled)
{
block.Header.WithdrawalsRoot = block.Withdrawals is null || block.Withdrawals.Length == 0
block.Header.WithdrawalsRoot = block.Withdrawals!.Length == 0
rubo marked this conversation as resolved.
Show resolved Hide resolved
? Keccak.EmptyTreeHash
: new WithdrawalTrie(block.Withdrawals!).RootHash;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
using Nethermind.Config;
using Nethermind.Consensus.AuRa.Config;
using Nethermind.Consensus.AuRa.InitializationSteps;
using Nethermind.Consensus.AuRa.Withdrawals;
using Nethermind.Consensus.Comparers;
using Nethermind.Consensus.Processing;
using Nethermind.Consensus.Producers;
using Nethermind.Consensus.Rewards;
using Nethermind.Consensus.Validators;
using Nethermind.Consensus.Withdrawals;
using Nethermind.Core;
using Nethermind.Core.Specs;
using Nethermind.Db;
Expand Down Expand Up @@ -81,8 +81,8 @@ protected override BlockProcessor CreateBlockProcessor(
receiptStorage,
logManager,
_blockTree,
new BlockProductionWithdrawalProcessor(
new WithdrawalProcessor(readOnlyTxProcessingEnv.StateProvider, logManager))
new Consensus.Withdrawals.BlockProductionWithdrawalProcessor(
new WithdrawalProcessor(_auraApi.ChainSpec!.AuRa, logManager))
);
}

Expand Down