Search in sources :

Example 1 with EpochUpdateConstraintScrypt

use of com.radixdlt.application.system.scrypt.EpochUpdateConstraintScrypt in project radixdlt by radixdlt.

the class UpdateValidatorFeeTest method setup.

@Before
public void setup() throws Exception {
    var cmAtomOS = new CMAtomOS();
    cmAtomOS.load(new SystemConstraintScrypt());
    cmAtomOS.load(new RoundUpdateConstraintScrypt(1));
    cmAtomOS.load(new EpochUpdateConstraintScrypt(1, UInt256.TEN, 0, 1, 100));
    cmAtomOS.load(new ValidatorConstraintScryptV2());
    cmAtomOS.load(new ValidatorUpdateRakeConstraintScrypt(2));
    var cm = new ConstraintMachine(cmAtomOS.getProcedures(), cmAtomOS.buildSubstateDeserialization(), cmAtomOS.buildVirtualSubstateDeserialization());
    var parser = new REParser(cmAtomOS.buildSubstateDeserialization());
    this.serialization = cmAtomOS.buildSubstateSerialization();
    this.store = new InMemoryEngineStore<>();
    this.engine = new RadixEngine<>(parser, serialization, REConstructor.newBuilder().put(CreateSystem.class, new CreateSystemConstructorV2()).put(UpdateValidatorFee.class, new UpdateRakeConstructor(2, ValidatorUpdateRakeConstraintScrypt.MAX_RAKE_INCREASE)).build(), cm, store);
    var txn = this.engine.construct(new CreateSystem(0)).buildWithoutSignature();
    this.engine.execute(List.of(txn), null, PermissionLevel.SYSTEM);
}
Also used : EpochUpdateConstraintScrypt(com.radixdlt.application.system.scrypt.EpochUpdateConstraintScrypt) SystemConstraintScrypt(com.radixdlt.application.system.scrypt.SystemConstraintScrypt) REParser(com.radixdlt.engine.parser.REParser) ValidatorConstraintScryptV2(com.radixdlt.application.validators.scrypt.ValidatorConstraintScryptV2) CMAtomOS(com.radixdlt.atomos.CMAtomOS) UpdateRakeConstructor(com.radixdlt.application.validators.construction.UpdateRakeConstructor) RoundUpdateConstraintScrypt(com.radixdlt.application.system.scrypt.RoundUpdateConstraintScrypt) ConstraintMachine(com.radixdlt.constraintmachine.ConstraintMachine) ValidatorUpdateRakeConstraintScrypt(com.radixdlt.application.validators.scrypt.ValidatorUpdateRakeConstraintScrypt) CreateSystemConstructorV2(com.radixdlt.application.system.construction.CreateSystemConstructorV2) Before(org.junit.Before)

Example 2 with EpochUpdateConstraintScrypt

use of com.radixdlt.application.system.scrypt.EpochUpdateConstraintScrypt in project radixdlt by radixdlt.

the class UpdateValidatorMetadataTest method setup.

@Before
public void setup() throws Exception {
    var cmAtomOS = new CMAtomOS();
    cmAtomOS.load(new SystemConstraintScrypt());
    cmAtomOS.load(new RoundUpdateConstraintScrypt(2));
    cmAtomOS.load(new EpochUpdateConstraintScrypt(2, UInt256.NINE, 1, 1, 100));
    cmAtomOS.load(new ValidatorConstraintScryptV2());
    var cm = new ConstraintMachine(cmAtomOS.getProcedures(), cmAtomOS.buildSubstateDeserialization(), cmAtomOS.buildVirtualSubstateDeserialization());
    var parser = new REParser(cmAtomOS.buildSubstateDeserialization());
    this.serialization = cmAtomOS.buildSubstateSerialization();
    this.store = new InMemoryEngineStore<>();
    this.engine = new RadixEngine<>(parser, serialization, REConstructor.newBuilder().put(UpdateValidatorMetadata.class, new UpdateValidatorMetadataConstructor()).put(CreateSystem.class, new CreateSystemConstructorV2()).build(), cm, store);
    var txn = this.engine.construct(new CreateSystem(0)).buildWithoutSignature();
    this.engine.execute(List.of(txn), null, PermissionLevel.SYSTEM);
}
Also used : EpochUpdateConstraintScrypt(com.radixdlt.application.system.scrypt.EpochUpdateConstraintScrypt) SystemConstraintScrypt(com.radixdlt.application.system.scrypt.SystemConstraintScrypt) UpdateValidatorMetadataConstructor(com.radixdlt.application.validators.construction.UpdateValidatorMetadataConstructor) REParser(com.radixdlt.engine.parser.REParser) ValidatorConstraintScryptV2(com.radixdlt.application.validators.scrypt.ValidatorConstraintScryptV2) CMAtomOS(com.radixdlt.atomos.CMAtomOS) RoundUpdateConstraintScrypt(com.radixdlt.application.system.scrypt.RoundUpdateConstraintScrypt) ConstraintMachine(com.radixdlt.constraintmachine.ConstraintMachine) CreateSystemConstructorV2(com.radixdlt.application.system.construction.CreateSystemConstructorV2) Before(org.junit.Before)

Example 3 with EpochUpdateConstraintScrypt

use of com.radixdlt.application.system.scrypt.EpochUpdateConstraintScrypt in project radixdlt by radixdlt.

the class DelegationFlagTest method parameters.

@Parameterized.Parameters
public static Collection<Object[]> parameters() {
    var startAmounts = List.of(10);
    var stakeAmounts = List.of(10);
    var scrypts = List.of(Pair.of(List.of(new RoundUpdateConstraintScrypt(10), new EpochUpdateConstraintScrypt(10, UInt256.NINE, 1, 1, 10), new TokensConstraintScryptV3(Set.of(), Pattern.compile("[a-z0-9]+")), new StakingConstraintScryptV4(Amount.ofTokens(10).toSubunits()), new ValidatorConstraintScryptV2(), new ValidatorUpdateOwnerConstraintScrypt()), new StakeTokensConstructorV3(Amount.ofTokens(10).toSubunits())));
    var parameters = new ArrayList<Object[]>();
    for (var scrypt : scrypts) {
        for (var startAmount : startAmounts) {
            for (var stakeAmount : stakeAmounts) {
                var param = new Object[] { startAmount, stakeAmount, scrypt.getFirst(), scrypt.getSecond() };
                parameters.add(param);
            }
        }
    }
    return parameters;
}
Also used : EpochUpdateConstraintScrypt(com.radixdlt.application.system.scrypt.EpochUpdateConstraintScrypt) StakingConstraintScryptV4(com.radixdlt.application.tokens.scrypt.StakingConstraintScryptV4) RoundUpdateConstraintScrypt(com.radixdlt.application.system.scrypt.RoundUpdateConstraintScrypt) ArrayList(java.util.ArrayList) StakeTokensConstructorV3(com.radixdlt.application.tokens.construction.StakeTokensConstructorV3) ValidatorConstraintScryptV2(com.radixdlt.application.validators.scrypt.ValidatorConstraintScryptV2) TokensConstraintScryptV3(com.radixdlt.application.tokens.scrypt.TokensConstraintScryptV3) ValidatorUpdateOwnerConstraintScrypt(com.radixdlt.application.validators.scrypt.ValidatorUpdateOwnerConstraintScrypt)

Example 4 with EpochUpdateConstraintScrypt

use of com.radixdlt.application.system.scrypt.EpochUpdateConstraintScrypt in project radixdlt by radixdlt.

the class RegisterValidatorTest method setup.

@Before
public void setup() throws Exception {
    var cmAtomOS = new CMAtomOS();
    cmAtomOS.load(new SystemConstraintScrypt());
    cmAtomOS.load(new RoundUpdateConstraintScrypt(2));
    cmAtomOS.load(new EpochUpdateConstraintScrypt(2, UInt256.NINE, 1, 1, 100));
    cmAtomOS.load(new ValidatorConstraintScryptV2());
    cmAtomOS.load(new ValidatorRegisterConstraintScrypt());
    cmAtomOS.load(new ValidatorUpdateRakeConstraintScrypt(2));
    var cm = new ConstraintMachine(cmAtomOS.getProcedures(), cmAtomOS.buildSubstateDeserialization(), cmAtomOS.buildVirtualSubstateDeserialization());
    var parser = new REParser(cmAtomOS.buildSubstateDeserialization());
    this.serialization = cmAtomOS.buildSubstateSerialization();
    this.store = new InMemoryEngineStore<>();
    this.engine = new RadixEngine<>(parser, serialization, REConstructor.newBuilder().put(RegisterValidator.class, new RegisterValidatorConstructor()).put(CreateSystem.class, new CreateSystemConstructorV2()).put(UpdateValidatorMetadata.class, new UpdateValidatorMetadataConstructor()).put(UpdateValidatorSystemMetadata.class, new UpdateValidatorSystemMetadataConstructor()).put(UpdateValidatorFee.class, new UpdateRakeConstructor(2, 2000)).build(), cm, store);
    var txn = this.engine.construct(new CreateSystem(0)).buildWithoutSignature();
    this.engine.execute(List.of(txn), null, PermissionLevel.SYSTEM);
}
Also used : EpochUpdateConstraintScrypt(com.radixdlt.application.system.scrypt.EpochUpdateConstraintScrypt) SystemConstraintScrypt(com.radixdlt.application.system.scrypt.SystemConstraintScrypt) UpdateValidatorMetadataConstructor(com.radixdlt.application.validators.construction.UpdateValidatorMetadataConstructor) UpdateValidatorSystemMetadataConstructor(com.radixdlt.application.validators.construction.UpdateValidatorSystemMetadataConstructor) REParser(com.radixdlt.engine.parser.REParser) RegisterValidatorConstructor(com.radixdlt.application.validators.construction.RegisterValidatorConstructor) ValidatorConstraintScryptV2(com.radixdlt.application.validators.scrypt.ValidatorConstraintScryptV2) CMAtomOS(com.radixdlt.atomos.CMAtomOS) UpdateRakeConstructor(com.radixdlt.application.validators.construction.UpdateRakeConstructor) RoundUpdateConstraintScrypt(com.radixdlt.application.system.scrypt.RoundUpdateConstraintScrypt) ConstraintMachine(com.radixdlt.constraintmachine.ConstraintMachine) ValidatorUpdateRakeConstraintScrypt(com.radixdlt.application.validators.scrypt.ValidatorUpdateRakeConstraintScrypt) ValidatorRegisterConstraintScrypt(com.radixdlt.application.validators.scrypt.ValidatorRegisterConstraintScrypt) CreateSystemConstructorV2(com.radixdlt.application.system.construction.CreateSystemConstructorV2) Before(org.junit.Before)

Example 5 with EpochUpdateConstraintScrypt

use of com.radixdlt.application.system.scrypt.EpochUpdateConstraintScrypt in project radixdlt by radixdlt.

the class UpdateValidatorSystemMetadataTest method setup.

@Before
public void setup() throws Exception {
    var cmAtomOS = new CMAtomOS();
    cmAtomOS.load(new SystemConstraintScrypt());
    cmAtomOS.load(new RoundUpdateConstraintScrypt(2));
    cmAtomOS.load(new EpochUpdateConstraintScrypt(2, UInt256.NINE, 1, 1, 100));
    cmAtomOS.load(new ValidatorConstraintScryptV2());
    var cm = new ConstraintMachine(cmAtomOS.getProcedures(), cmAtomOS.buildSubstateDeserialization(), cmAtomOS.buildVirtualSubstateDeserialization());
    var parser = new REParser(cmAtomOS.buildSubstateDeserialization());
    this.store = new InMemoryEngineStore<>();
    this.engine = new RadixEngine<>(parser, cmAtomOS.buildSubstateSerialization(), REConstructor.newBuilder().put(UpdateValidatorSystemMetadata.class, new UpdateValidatorSystemMetadataConstructor()).put(CreateSystem.class, new CreateSystemConstructorV2()).build(), cm, store);
    var txn = this.engine.construct(new CreateSystem(0)).buildWithoutSignature();
    this.engine.execute(List.of(txn), null, PermissionLevel.SYSTEM);
}
Also used : EpochUpdateConstraintScrypt(com.radixdlt.application.system.scrypt.EpochUpdateConstraintScrypt) SystemConstraintScrypt(com.radixdlt.application.system.scrypt.SystemConstraintScrypt) UpdateValidatorSystemMetadataConstructor(com.radixdlt.application.validators.construction.UpdateValidatorSystemMetadataConstructor) REParser(com.radixdlt.engine.parser.REParser) ValidatorConstraintScryptV2(com.radixdlt.application.validators.scrypt.ValidatorConstraintScryptV2) CMAtomOS(com.radixdlt.atomos.CMAtomOS) RoundUpdateConstraintScrypt(com.radixdlt.application.system.scrypt.RoundUpdateConstraintScrypt) ConstraintMachine(com.radixdlt.constraintmachine.ConstraintMachine) CreateSystemConstructorV2(com.radixdlt.application.system.construction.CreateSystemConstructorV2) Before(org.junit.Before)

Aggregations

EpochUpdateConstraintScrypt (com.radixdlt.application.system.scrypt.EpochUpdateConstraintScrypt)5 RoundUpdateConstraintScrypt (com.radixdlt.application.system.scrypt.RoundUpdateConstraintScrypt)5 ValidatorConstraintScryptV2 (com.radixdlt.application.validators.scrypt.ValidatorConstraintScryptV2)5 CreateSystemConstructorV2 (com.radixdlt.application.system.construction.CreateSystemConstructorV2)4 SystemConstraintScrypt (com.radixdlt.application.system.scrypt.SystemConstraintScrypt)4 CMAtomOS (com.radixdlt.atomos.CMAtomOS)4 ConstraintMachine (com.radixdlt.constraintmachine.ConstraintMachine)4 REParser (com.radixdlt.engine.parser.REParser)4 Before (org.junit.Before)4 UpdateRakeConstructor (com.radixdlt.application.validators.construction.UpdateRakeConstructor)2 UpdateValidatorMetadataConstructor (com.radixdlt.application.validators.construction.UpdateValidatorMetadataConstructor)2 UpdateValidatorSystemMetadataConstructor (com.radixdlt.application.validators.construction.UpdateValidatorSystemMetadataConstructor)2 ValidatorUpdateRakeConstraintScrypt (com.radixdlt.application.validators.scrypt.ValidatorUpdateRakeConstraintScrypt)2 StakeTokensConstructorV3 (com.radixdlt.application.tokens.construction.StakeTokensConstructorV3)1 StakingConstraintScryptV4 (com.radixdlt.application.tokens.scrypt.StakingConstraintScryptV4)1 TokensConstraintScryptV3 (com.radixdlt.application.tokens.scrypt.TokensConstraintScryptV3)1 RegisterValidatorConstructor (com.radixdlt.application.validators.construction.RegisterValidatorConstructor)1 ValidatorRegisterConstraintScrypt (com.radixdlt.application.validators.scrypt.ValidatorRegisterConstraintScrypt)1 ValidatorUpdateOwnerConstraintScrypt (com.radixdlt.application.validators.scrypt.ValidatorUpdateOwnerConstraintScrypt)1 ArrayList (java.util.ArrayList)1