Search in sources :

Example 46 with RskAddress

use of co.rsk.core.RskAddress in project rskj by rsksmart.

the class RemascStorageProviderTest method setAndGetBurnedBalance.

@Test
public void setAndGetBurnedBalance() {
    RskAddress accountAddress = randomAddress();
    Repository repository = new RepositoryImpl(config);
    RemascStorageProvider provider = new RemascStorageProvider(repository, accountAddress);
    provider.setBurnedBalance(Coin.valueOf(1));
    Assert.assertEquals(Coin.valueOf(1), provider.getBurnedBalance());
}
Also used : Repository(org.ethereum.core.Repository) RepositoryImpl(co.rsk.db.RepositoryImpl) RskAddress(co.rsk.core.RskAddress) Test(org.junit.Test)

Example 47 with RskAddress

use of co.rsk.core.RskAddress in project rskj by rsksmart.

the class RemascStorageProviderTest method randomAddress.

private RskAddress randomAddress() {
    byte[] bytes = new byte[20];
    new Random().nextBytes(bytes);
    return new RskAddress(bytes);
}
Also used : Random(java.util.Random) RskAddress(co.rsk.core.RskAddress)

Example 48 with RskAddress

use of co.rsk.core.RskAddress in project rskj by rsksmart.

the class RemascStorageProviderTest method setSaveRetrieveAndGetBurnedBalance.

@Test
public void setSaveRetrieveAndGetBurnedBalance() throws IOException {
    RskAddress accountAddress = randomAddress();
    Repository repository = new RepositoryImplForTesting();
    RemascStorageProvider provider = new RemascStorageProvider(repository, accountAddress);
    provider.setBurnedBalance(Coin.valueOf(255));
    provider.save();
    RemascStorageProvider newProvider = new RemascStorageProvider(repository, accountAddress);
    Assert.assertEquals(Coin.valueOf(255), newProvider.getBurnedBalance());
}
Also used : Repository(org.ethereum.core.Repository) RskAddress(co.rsk.core.RskAddress) RepositoryImplForTesting(co.rsk.db.RepositoryImplForTesting) Test(org.junit.Test)

Example 49 with RskAddress

use of co.rsk.core.RskAddress in project rskj by rsksmart.

the class RemascStorageProviderTest method getDefaultBrokenSelectionRule.

@Test
public void getDefaultBrokenSelectionRule() {
    RskAddress accountAddress = randomAddress();
    Repository repository = new RepositoryImpl(config);
    RemascStorageProvider provider = new RemascStorageProvider(repository, accountAddress);
    Assert.assertEquals(Boolean.FALSE, provider.getBrokenSelectionRule());
}
Also used : Repository(org.ethereum.core.Repository) RepositoryImpl(co.rsk.db.RepositoryImpl) RskAddress(co.rsk.core.RskAddress) Test(org.junit.Test)

Example 50 with RskAddress

use of co.rsk.core.RskAddress in project rskj by rsksmart.

the class RemascStorageProviderTest method setSaveRetrieveAndGetBrokenSelectionRule.

@Test
public void setSaveRetrieveAndGetBrokenSelectionRule() throws IOException {
    RskAddress accountAddress = randomAddress();
    Repository repository = new RepositoryImplForTesting();
    RemascStorageProvider provider = new RemascStorageProvider(repository, accountAddress);
    provider.setBrokenSelectionRule(Boolean.TRUE);
    provider.save();
    RemascStorageProvider newProvider = new RemascStorageProvider(repository, accountAddress);
    Assert.assertEquals(Boolean.TRUE, newProvider.getBrokenSelectionRule());
}
Also used : Repository(org.ethereum.core.Repository) RskAddress(co.rsk.core.RskAddress) RepositoryImplForTesting(co.rsk.db.RepositoryImplForTesting) Test(org.junit.Test)

Aggregations

RskAddress (co.rsk.core.RskAddress)174 Test (org.junit.Test)102 Repository (org.ethereum.core.Repository)60 BigInteger (java.math.BigInteger)47 Coin (co.rsk.core.Coin)38 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)29 DataWord (org.ethereum.vm.DataWord)27 TrieImplHashTest (co.rsk.trie.TrieImplHashTest)24 RepositoryImpl (co.rsk.db.RepositoryImpl)16 SimpleRskTransaction (co.rsk.peg.simples.SimpleRskTransaction)15 Transaction (org.ethereum.core.Transaction)15 Program (org.ethereum.vm.program.Program)15 InvocationOnMock (org.mockito.invocation.InvocationOnMock)14 AccountState (org.ethereum.core.AccountState)12 HashMapDB (org.ethereum.datasource.HashMapDB)11 ArrayList (java.util.ArrayList)10 ProgramInvokeMockImpl (org.ethereum.vm.program.invoke.ProgramInvokeMockImpl)10 BridgeConstants (co.rsk.config.BridgeConstants)8 RskSystemProperties (co.rsk.config.RskSystemProperties)8 TrieStoreImpl (co.rsk.trie.TrieStoreImpl)8