Search in sources :

Example 1 with Seal

use of org.aion.zero.impl.types.BlockHeader.Seal in project aion by aionnetwork.

the class ChainConfiguration method createVRFValidator.

public GrandParentBlockHeaderValidator createVRFValidator() {
    List<GrandParentDependantBlockHeaderRule> posRules = Collections.singletonList(new VRFProofRule());
    Map<Seal, List<GrandParentDependantBlockHeaderRule>> vrfProofRules = new EnumMap<>(Seal.class);
    vrfProofRules.put(Seal.PROOF_OF_STAKE, posRules);
    return new GrandParentBlockHeaderValidator(vrfProofRules);
}
Also used : GreatGrandParentDependantBlockHeaderRule(org.aion.zero.impl.valid.GreatGrandParentDependantBlockHeaderRule) GrandParentDependantBlockHeaderRule(org.aion.zero.impl.valid.GrandParentDependantBlockHeaderRule) VRFProofRule(org.aion.zero.impl.valid.VRFProofRule) Seal(org.aion.zero.impl.types.BlockHeader.Seal) List(java.util.List) GreatGrandParentBlockHeaderValidator(org.aion.zero.impl.valid.GreatGrandParentBlockHeaderValidator) GrandParentBlockHeaderValidator(org.aion.zero.impl.valid.GrandParentBlockHeaderValidator) EnumMap(java.util.EnumMap)

Example 2 with Seal

use of org.aion.zero.impl.types.BlockHeader.Seal in project aion by aionnetwork.

the class ChainConfiguration method createBlockHeaderValidatorForImport.

public BlockHeaderValidator createBlockHeaderValidatorForImport() {
    List<BlockHeaderRule> powRules = Arrays.asList(new HeaderSealTypeRule(), new AionExtraDataRule(this.getConstants().getMaximumExtraDataSize()), new EnergyConsumedRule(), new AionPOWRule(), new EquihashSolutionRule(this.getEquihashValidator()));
    List<BlockHeaderRule> posRules = Arrays.asList(new HeaderSealTypeRule(), new AionExtraDataRule(this.getConstants().getMaximumExtraDataSize()), new EnergyConsumedRule(), new SignatureRule());
    Map<Seal, List<BlockHeaderRule>> unityRules = new EnumMap<>(Seal.class);
    unityRules.put(Seal.PROOF_OF_WORK, powRules);
    unityRules.put(Seal.PROOF_OF_STAKE, posRules);
    return new BlockHeaderValidator(unityRules);
}
Also used : GreatGrandParentBlockHeaderValidator(org.aion.zero.impl.valid.GreatGrandParentBlockHeaderValidator) ParentBlockHeaderValidator(org.aion.zero.impl.valid.ParentBlockHeaderValidator) GrandParentBlockHeaderValidator(org.aion.zero.impl.valid.GrandParentBlockHeaderValidator) BlockHeaderValidator(org.aion.zero.impl.valid.BlockHeaderValidator) EquihashSolutionRule(org.aion.zero.impl.valid.EquihashSolutionRule) SignatureRule(org.aion.zero.impl.valid.SignatureRule) EnergyConsumedRule(org.aion.zero.impl.valid.EnergyConsumedRule) HeaderSealTypeRule(org.aion.zero.impl.valid.HeaderSealTypeRule) AionExtraDataRule(org.aion.zero.impl.valid.AionExtraDataRule) Seal(org.aion.zero.impl.types.BlockHeader.Seal) List(java.util.List) DependentBlockHeaderRule(org.aion.zero.impl.valid.DependentBlockHeaderRule) BlockHeaderRule(org.aion.zero.impl.valid.BlockHeaderRule) GreatGrandParentDependantBlockHeaderRule(org.aion.zero.impl.valid.GreatGrandParentDependantBlockHeaderRule) GrandParentDependantBlockHeaderRule(org.aion.zero.impl.valid.GrandParentDependantBlockHeaderRule) AionPOWRule(org.aion.zero.impl.valid.AionPOWRule) EnumMap(java.util.EnumMap)

Example 3 with Seal

use of org.aion.zero.impl.types.BlockHeader.Seal in project aion by aionnetwork.

the class ChainConfiguration method createPreUnityGrandParentHeaderValidator.

public GrandParentBlockHeaderValidator createPreUnityGrandParentHeaderValidator() {
    List<GrandParentDependantBlockHeaderRule> powRules = Collections.singletonList(new AionDifficultyRule(this));
    Map<Seal, List<GrandParentDependantBlockHeaderRule>> unityRules = new EnumMap<>(Seal.class);
    unityRules.put(Seal.PROOF_OF_WORK, powRules);
    return new GrandParentBlockHeaderValidator(unityRules);
}
Also used : GreatGrandParentDependantBlockHeaderRule(org.aion.zero.impl.valid.GreatGrandParentDependantBlockHeaderRule) GrandParentDependantBlockHeaderRule(org.aion.zero.impl.valid.GrandParentDependantBlockHeaderRule) AionDifficultyRule(org.aion.zero.impl.valid.AionDifficultyRule) Seal(org.aion.zero.impl.types.BlockHeader.Seal) List(java.util.List) GreatGrandParentBlockHeaderValidator(org.aion.zero.impl.valid.GreatGrandParentBlockHeaderValidator) GrandParentBlockHeaderValidator(org.aion.zero.impl.valid.GrandParentBlockHeaderValidator) EnumMap(java.util.EnumMap)

Example 4 with Seal

use of org.aion.zero.impl.types.BlockHeader.Seal in project aion by aionnetwork.

the class ChainConfiguration method createUnityGreatGrandParentHeaderValidator.

public GreatGrandParentBlockHeaderValidator createUnityGreatGrandParentHeaderValidator() {
    List<GreatGrandParentDependantBlockHeaderRule> powRules = Collections.singletonList(new UnityDifficultyRule(this));
    List<GreatGrandParentDependantBlockHeaderRule> posRules = Arrays.asList(new UnityDifficultyRule(this), new StakingSeedRule());
    Map<Seal, List<GreatGrandParentDependantBlockHeaderRule>> unityRules = new EnumMap<>(Seal.class);
    unityRules.put(Seal.PROOF_OF_WORK, powRules);
    unityRules.put(Seal.PROOF_OF_STAKE, posRules);
    return new GreatGrandParentBlockHeaderValidator(unityRules);
}
Also used : UnityDifficultyRule(org.aion.zero.impl.valid.UnityDifficultyRule) StakingSeedRule(org.aion.zero.impl.valid.StakingSeedRule) GreatGrandParentDependantBlockHeaderRule(org.aion.zero.impl.valid.GreatGrandParentDependantBlockHeaderRule) GreatGrandParentBlockHeaderValidator(org.aion.zero.impl.valid.GreatGrandParentBlockHeaderValidator) Seal(org.aion.zero.impl.types.BlockHeader.Seal) List(java.util.List) EnumMap(java.util.EnumMap)

Example 5 with Seal

use of org.aion.zero.impl.types.BlockHeader.Seal in project aion by aionnetwork.

the class ChainConfiguration method createNonceSeedValidator.

public GreatGrandParentBlockHeaderValidator createNonceSeedValidator() {
    List<GreatGrandParentDependantBlockHeaderRule> posRules = Collections.singletonList(new StakingSeedCreationRule());
    Map<Seal, List<GreatGrandParentDependantBlockHeaderRule>> unityRules = new EnumMap<>(Seal.class);
    unityRules.put(Seal.PROOF_OF_STAKE, posRules);
    return new GreatGrandParentBlockHeaderValidator(unityRules);
}
Also used : GreatGrandParentDependantBlockHeaderRule(org.aion.zero.impl.valid.GreatGrandParentDependantBlockHeaderRule) GreatGrandParentBlockHeaderValidator(org.aion.zero.impl.valid.GreatGrandParentBlockHeaderValidator) Seal(org.aion.zero.impl.types.BlockHeader.Seal) List(java.util.List) StakingSeedCreationRule(org.aion.zero.impl.valid.StakingSeedCreationRule) EnumMap(java.util.EnumMap)

Aggregations

EnumMap (java.util.EnumMap)9 List (java.util.List)9 Seal (org.aion.zero.impl.types.BlockHeader.Seal)9 GreatGrandParentBlockHeaderValidator (org.aion.zero.impl.valid.GreatGrandParentBlockHeaderValidator)9 GreatGrandParentDependantBlockHeaderRule (org.aion.zero.impl.valid.GreatGrandParentDependantBlockHeaderRule)7 GrandParentBlockHeaderValidator (org.aion.zero.impl.valid.GrandParentBlockHeaderValidator)6 DependentBlockHeaderRule (org.aion.zero.impl.valid.DependentBlockHeaderRule)4 GrandParentDependantBlockHeaderRule (org.aion.zero.impl.valid.GrandParentDependantBlockHeaderRule)4 ParentBlockHeaderValidator (org.aion.zero.impl.valid.ParentBlockHeaderValidator)4 AionExtraDataRule (org.aion.zero.impl.valid.AionExtraDataRule)2 AionPOWRule (org.aion.zero.impl.valid.AionPOWRule)2 BlockHeaderRule (org.aion.zero.impl.valid.BlockHeaderRule)2 BlockHeaderValidator (org.aion.zero.impl.valid.BlockHeaderValidator)2 BlockNumberRule (org.aion.zero.impl.valid.BlockNumberRule)2 EnergyConsumedRule (org.aion.zero.impl.valid.EnergyConsumedRule)2 EnergyLimitRule (org.aion.zero.impl.valid.EnergyLimitRule)2 EquihashSolutionRule (org.aion.zero.impl.valid.EquihashSolutionRule)2 HeaderSealTypeRule (org.aion.zero.impl.valid.HeaderSealTypeRule)2 SignatureRule (org.aion.zero.impl.valid.SignatureRule)2 StakingBlockTimeStampRule (org.aion.zero.impl.valid.StakingBlockTimeStampRule)2