Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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 @@ -11,7 +11,6 @@
using Nethermind.Consensus.AuRa.Config;
using Nethermind.Consensus.AuRa.InitializationSteps;
using Nethermind.Consensus.AuRa.Validators;
using Nethermind.Consensus.Processing;
using Nethermind.Consensus.Producers;
using Nethermind.Consensus.Withdrawals;
using Nethermind.Core;
Expand All @@ -29,6 +28,7 @@
using Nethermind.Specs.ChainSpecStyle;
using Nethermind.Specs.Test;
using Nethermind.Specs.Test.ChainSpecStyle;
using Nethermind.TxPool;
using NSubstitute;
using NUnit.Framework;

Expand Down Expand Up @@ -139,9 +139,16 @@ protected override ContainerBuilder ConfigureContainer(ContainerBuilder builder,
})

// Aura uses `AuRaNethermindApi` for initialization, so need to do some additional things here
// as normally, test blockchain don't use INethermindApi at all. Note: This test does not
// seems to use aura block processor which means a lot of aura things is not available here.
// as normally, test blockchain don't use INethermindApi at all.
.AddModule(new AuRaModule(ChainSpec))

.AddDecorator<AuRaNethermindApi>((_, api) =>
{
api.EngineSigner = NullSigner.Instance;
api.NonceManager = Substitute.For<INonceManager>();
return api;
})

.AddModule(new AuRaMergeModule())
.AddSingleton<NethermindApi.Dependencies>()
.AddSingleton<IReportingValidator>(NullReportingValidator.Instance)
Expand All @@ -154,9 +161,6 @@ protected override ContainerBuilder ConfigureContainer(ContainerBuilder builder,
.AddSingleton<IBlockImprovementContextFactory, IBlockProducer, IMergeConfig>((blockProducer,
mergeConfig) => new BlockImprovementContextFactory(blockProducer, TimeSpan.FromSeconds(mergeConfig.SecondsPerSlot)))

// AuRa was never configured correctly in test.
.AddScoped<IBlockProcessor, BlockProcessor>()

.AddDecorator<AuRaNethermindApi>((_, api) =>
{
// Yes getting from `TestBlockchain` itself, since steps are not run
Expand All @@ -171,11 +175,16 @@ protected override ContainerBuilder ConfigureContainer(ContainerBuilder builder,
protected override ChainSpec CreateChainSpec()
{
ChainSpec baseChainSpec = base.CreateChainSpec();
AuRaChainSpecEngineParameters.AuRaValidatorJson validatorsJson = new()
{
List = [Address.Zero]
};
baseChainSpec.EngineChainSpecParametersProvider = new TestChainSpecParametersProvider(
new AuRaChainSpecEngineParameters
{
WithdrawalContractAddress = new(_auraWithdrawalContractAddress),
StepDuration = { { 0, 3 } }
StepDuration = { { 0, 3 } },
ValidatorsJson = validatorsJson
});
baseChainSpec.Parameters = new ChainParameters();
return baseChainSpec;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -857,14 +857,16 @@ public async Task executePayloadV1_on_top_of_terminal_block(CancellationToken ca
.WithNonce(0)
.WithDifficulty(1000000)
.WithTotalDifficulty(2000000L)
.WithStateRoot(new Hash256("0x1ef7300d8961797263939a3d29bbba4ccf1702fabf02d8ad7a20b454edb6fd2f")).TestObject;
.WithStateRoot(new Hash256("0x1ef7300d8961797263939a3d29bbba4ccf1702fabf02d8ad7a20b454edb6fd2f"))
.WithAura(0, []).TestObject;
Comment thread
Marchhill marked this conversation as resolved.
Outdated
newBlock.CalculateHash();
Block oneMoreTerminalBlock = Build.A.Block.WithNumber(chain.BlockTree.Head!.Number)
.WithParent(chain.BlockTree.Head!)
.WithNonce(0)
.WithDifficulty(900000)
.WithTotalDifficulty(1900000L)
.WithStateRoot(new Hash256("0x1ef7300d8961797263939a3d29bbba4ccf1702fabf02d8ad7a20b454edb6fd2f")).TestObject;
.WithStateRoot(new Hash256("0x1ef7300d8961797263939a3d29bbba4ccf1702fabf02d8ad7a20b454edb6fd2f"))
.WithAura(0, []).TestObject;

using SemaphoreSlim bestBlockProcessed = new(0);
chain.BlockTree.NewHeadBlock += (s, e) =>
Expand Down Expand Up @@ -903,14 +905,16 @@ public async Task executePayloadV1_on_top_of_not_processed_invalid_terminal_bloc
.WithNonce(0)
.WithDifficulty(1000000)
.WithTotalDifficulty(2000000L)
.WithStateRoot(new Hash256("0x1ef7300d8961797263939a3d29bbba4ccf1702fabf02d8ad7a20b454edb6fd2f")).TestObject;
.WithStateRoot(new Hash256("0x1ef7300d8961797263939a3d29bbba4ccf1702fabf02d8ad7a20b454edb6fd2f"))
.WithAura(0, []).TestObject;
newBlock.CalculateHash();
Block oneMoreTerminalBlock = Build.A.Block.WithNumber(chain.BlockTree.Head!.Number)
.WithParent(chain.BlockTree.Head!)
.WithNonce(0)
.WithDifficulty(900000)
.WithTotalDifficulty(1900000L)
.WithStateRoot(new Hash256("0x1ef7300d8961797263939a3d29bfba4ccf1702fabf02d8ad7a20b454edb6fd2f")).TestObject; //incorrect state root
.WithStateRoot(new Hash256("0x1ef7300d8961797263939a3d29bfba4ccf1702fabf02d8ad7a20b454edb6fd2f")) //incorrect state root
.WithAura(0, []).TestObject;

using SemaphoreSlim bestBlockProcessed = new(0);
chain.BlockTree.NewHeadBlock += (s, e) =>
Expand Down
Loading