Search in sources :

Example 16 with CMAtomOS

use of com.radixdlt.atomos.CMAtomOS in project radixdlt by radixdlt.

the class MintTokensTest method setup.

@Before
public void setup() throws Exception {
    var cmAtomOS = new CMAtomOS();
    cmAtomOS.load(new SystemConstraintScrypt());
    cmAtomOS.load(scrypt);
    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.engine = new RadixEngine<>(parser, serialization, REConstructor.newBuilder().put(CreateSystem.class, new CreateSystemConstructorV2()).put(TransferToken.class, transferTokensConstructor).put(CreateMutableToken.class, new CreateMutableTokenConstructor(SystemConstraintScrypt.MAX_SYMBOL_LENGTH)).put(MintToken.class, new MintTokenConstructor()).build(), cm, store);
    var genesis = this.engine.construct(new CreateSystem(0)).buildWithoutSignature();
    this.engine.execute(List.of(genesis), null, PermissionLevel.SYSTEM);
}
Also used : SystemConstraintScrypt(com.radixdlt.application.system.scrypt.SystemConstraintScrypt) REParser(com.radixdlt.engine.parser.REParser) MintTokenConstructor(com.radixdlt.application.tokens.construction.MintTokenConstructor) CMAtomOS(com.radixdlt.atomos.CMAtomOS) ConstraintMachine(com.radixdlt.constraintmachine.ConstraintMachine) CreateMutableTokenConstructor(com.radixdlt.application.tokens.construction.CreateMutableTokenConstructor) CreateSystemConstructorV2(com.radixdlt.application.system.construction.CreateSystemConstructorV2) Before(org.junit.Before)

Example 17 with CMAtomOS

use of com.radixdlt.atomos.CMAtomOS in project radixdlt by radixdlt.

the class UniqueTest method setup.

@Before
public void setup() throws Exception {
    var cmAtomOS = new CMAtomOS();
    cmAtomOS.load(new MutexConstraintScrypt());
    cmAtomOS.load(new SystemConstraintScrypt());
    var cm = new ConstraintMachine(cmAtomOS.getProcedures(), cmAtomOS.buildSubstateDeserialization(), cmAtomOS.buildVirtualSubstateDeserialization());
    this.parser = new REParser(cmAtomOS.buildSubstateDeserialization());
    this.serialization = cmAtomOS.buildSubstateSerialization();
    this.store = new InMemoryEngineStore<>();
    this.sut = new RadixEngine<>(parser, serialization, REConstructor.newBuilder().put(CreateSystem.class, new CreateSystemConstructorV2()).build(), cm, store);
    this.genesis = this.sut.construct(TxnConstructionRequest.create().action(new CreateSystem(0))).buildWithoutSignature();
    this.sut.execute(List.of(genesis), null, PermissionLevel.SYSTEM);
}
Also used : SystemConstraintScrypt(com.radixdlt.application.system.scrypt.SystemConstraintScrypt) ConstraintMachine(com.radixdlt.constraintmachine.ConstraintMachine) MutexConstraintScrypt(com.radixdlt.application.unique.scrypt.MutexConstraintScrypt) CreateSystemConstructorV2(com.radixdlt.application.system.construction.CreateSystemConstructorV2) REParser(com.radixdlt.engine.parser.REParser) CMAtomOS(com.radixdlt.atomos.CMAtomOS) Before(org.junit.Before)

Example 18 with CMAtomOS

use of com.radixdlt.atomos.CMAtomOS 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 19 with CMAtomOS

use of com.radixdlt.atomos.CMAtomOS 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

CMAtomOS (com.radixdlt.atomos.CMAtomOS)19 Before (org.junit.Before)19 ConstraintMachine (com.radixdlt.constraintmachine.ConstraintMachine)18 REParser (com.radixdlt.engine.parser.REParser)18 CreateSystemConstructorV2 (com.radixdlt.application.system.construction.CreateSystemConstructorV2)17 SystemConstraintScrypt (com.radixdlt.application.system.scrypt.SystemConstraintScrypt)17 CreateMutableTokenConstructor (com.radixdlt.application.tokens.construction.CreateMutableTokenConstructor)12 MintTokenConstructor (com.radixdlt.application.tokens.construction.MintTokenConstructor)12 TokensConstraintScryptV3 (com.radixdlt.application.tokens.scrypt.TokensConstraintScryptV3)6 ValidatorConstraintScryptV2 (com.radixdlt.application.validators.scrypt.ValidatorConstraintScryptV2)5 EpochUpdateConstraintScrypt (com.radixdlt.application.system.scrypt.EpochUpdateConstraintScrypt)4 RoundUpdateConstraintScrypt (com.radixdlt.application.system.scrypt.RoundUpdateConstraintScrypt)4 TransferTokensConstructorV2 (com.radixdlt.application.tokens.construction.TransferTokensConstructorV2)4 FeeReservePutConstructor (com.radixdlt.application.system.construction.FeeReservePutConstructor)3 RegisterValidatorConstructor (com.radixdlt.application.validators.construction.RegisterValidatorConstructor)3 ValidatorUpdateRakeConstraintScrypt (com.radixdlt.application.validators.scrypt.ValidatorUpdateRakeConstraintScrypt)3 FeeReserveCompleteConstructor (com.radixdlt.application.system.construction.FeeReserveCompleteConstructor)2 NextEpochConstructorV3 (com.radixdlt.application.system.construction.NextEpochConstructorV3)2 MutexConstraintScrypt (com.radixdlt.application.unique.scrypt.MutexConstraintScrypt)2 UpdateRakeConstructor (com.radixdlt.application.validators.construction.UpdateRakeConstructor)2