Search in sources :

Example 1 with ValidatorUpdateOwnerConstraintScrypt

use of com.radixdlt.application.validators.scrypt.ValidatorUpdateOwnerConstraintScrypt in project radixdlt by radixdlt.

the class NextViewV2Test method setup.

@Before
public void setup() throws Exception {
    var cmAtomOS = new CMAtomOS();
    cmAtomOS.load(new SystemConstraintScrypt());
    scrypts.forEach(cmAtomOS::load);
    cmAtomOS.load(new StakingConstraintScryptV4(Amount.ofTokens(10).toSubunits()));
    cmAtomOS.load(new TokensConstraintScryptV3(Set.of(), Pattern.compile("[a-z0-9]+")));
    cmAtomOS.load(new ValidatorConstraintScryptV2());
    cmAtomOS.load(new ValidatorRegisterConstraintScrypt());
    cmAtomOS.load(new ValidatorUpdateRakeConstraintScrypt(2));
    cmAtomOS.load(new ValidatorUpdateOwnerConstraintScrypt());
    var cm = new ConstraintMachine(cmAtomOS.getProcedures(), cmAtomOS.buildSubstateDeserialization(), cmAtomOS.buildVirtualSubstateDeserialization());
    var parser = new REParser(cmAtomOS.buildSubstateDeserialization());
    var serialization = cmAtomOS.buildSubstateSerialization();
    this.store = new InMemoryEngineStore<>();
    this.sut = new RadixEngine<>(parser, serialization, REConstructor.newBuilder().put(NextEpoch.class, new NextEpochConstructorV3(Amount.ofTokens(10).toSubunits(), 9800, 1, 10)).put(CreateSystem.class, new CreateSystemConstructorV2()).put(CreateMutableToken.class, new CreateMutableTokenConstructor(SystemConstraintScrypt.MAX_SYMBOL_LENGTH)).put(MintToken.class, new MintTokenConstructor()).put(StakeTokens.class, new StakeTokensConstructorV3(Amount.ofTokens(10).toSubunits())).put(NextRound.class, nextViewConstructor).put(RegisterValidator.class, new RegisterValidatorConstructor()).build(), cm, store);
    this.key = ECKeyPair.generateNew();
    var accountAddr = REAddr.ofPubKeyAccount(key.getPublicKey());
    var txn = this.sut.construct(TxnConstructionRequest.create().action(new CreateSystem(0)).action(new CreateMutableToken(REAddr.ofNativeToken(), "xrd", "xrd", "", "", "", null)).action(new MintToken(REAddr.ofNativeToken(), accountAddr, Amount.ofTokens(10).toSubunits())).action(new StakeTokens(accountAddr, key.getPublicKey(), Amount.ofTokens(10).toSubunits())).action(new RegisterValidator(key.getPublicKey())).action(new NextEpoch(0))).buildWithoutSignature();
    this.sut.execute(List.of(txn), null, PermissionLevel.SYSTEM);
}
Also used : StakingConstraintScryptV4(com.radixdlt.application.tokens.scrypt.StakingConstraintScryptV4) SystemConstraintScrypt(com.radixdlt.application.system.scrypt.SystemConstraintScrypt) StakeTokensConstructorV3(com.radixdlt.application.tokens.construction.StakeTokensConstructorV3) REParser(com.radixdlt.engine.parser.REParser) RegisterValidatorConstructor(com.radixdlt.application.validators.construction.RegisterValidatorConstructor) ValidatorConstraintScryptV2(com.radixdlt.application.validators.scrypt.ValidatorConstraintScryptV2) MintTokenConstructor(com.radixdlt.application.tokens.construction.MintTokenConstructor) CMAtomOS(com.radixdlt.atomos.CMAtomOS) ValidatorUpdateOwnerConstraintScrypt(com.radixdlt.application.validators.scrypt.ValidatorUpdateOwnerConstraintScrypt) ValidatorRegisterConstraintScrypt(com.radixdlt.application.validators.scrypt.ValidatorRegisterConstraintScrypt) NextEpochConstructorV3(com.radixdlt.application.system.construction.NextEpochConstructorV3) CreateSystemConstructorV2(com.radixdlt.application.system.construction.CreateSystemConstructorV2) TokensConstraintScryptV3(com.radixdlt.application.tokens.scrypt.TokensConstraintScryptV3) ConstraintMachine(com.radixdlt.constraintmachine.ConstraintMachine) ValidatorUpdateRakeConstraintScrypt(com.radixdlt.application.validators.scrypt.ValidatorUpdateRakeConstraintScrypt) CreateMutableTokenConstructor(com.radixdlt.application.tokens.construction.CreateMutableTokenConstructor) Before(org.junit.Before)

Example 2 with ValidatorUpdateOwnerConstraintScrypt

use of com.radixdlt.application.validators.scrypt.ValidatorUpdateOwnerConstraintScrypt 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 3 with ValidatorUpdateOwnerConstraintScrypt

use of com.radixdlt.application.validators.scrypt.ValidatorUpdateOwnerConstraintScrypt in project radixdlt by radixdlt.

the class StakeTokensTest method parameters.

@Parameterized.Parameters
public static Collection<Object[]> parameters() {
    var startAmounts = List.of(10);
    var stakeAmounts = List.of(10, 6);
    var scrypts = List.of(Pair.of(List.of(new SystemConstraintScrypt(), 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 : StakingConstraintScryptV4(com.radixdlt.application.tokens.scrypt.StakingConstraintScryptV4) SystemConstraintScrypt(com.radixdlt.application.system.scrypt.SystemConstraintScrypt) 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)

Aggregations

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