use of org.aion.mcf.trie.TrieImpl in project aion by aionnetwork.
the class TrieTestWithRootHashValues method testTesty.
@Test
public void testTesty() {
TrieImpl trie = new TrieImpl(mockDb);
trie.update("test", "test");
assertEquals("85d106d4edff3b7a4889e91251d0a87d7c17a1dda648ebdba8c6060825be23b8", Hex.toHexString(trie.getRootHash()));
trie.update("te", "testy");
assertEquals("8452568af70d8d140f58d941338542f645fcca50094b20f3c3d8c3df49337928", Hex.toHexString(trie.getRootHash()));
}
use of org.aion.mcf.trie.TrieImpl in project aion by aionnetwork.
the class TrieTestWithRootHashValues method testSingleItem.
@Test
public void testSingleItem() {
TrieImpl trie = new TrieImpl(mockDb);
trie.update("A", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
assertEquals("d23786fb4a010da3ce639d66d5e904a11dbc02746d1ce25029e53290cabf28ab", Hex.toHexString(trie.getRootHash()));
}
use of org.aion.mcf.trie.TrieImpl in project aion by aionnetwork.
the class TrieTestWithRootHashValues method storageHashCalc_1.
@Test
public void storageHashCalc_1() {
byte[] key1 = Hex.decode("0000000000000000000000000000000000000000000000000000000000000010");
byte[] key2 = Hex.decode("0000000000000000000000000000000000000000000000000000000000000014");
byte[] key3 = Hex.decode("0000000000000000000000000000000000000000000000000000000000000016");
byte[] key4 = Hex.decode("0000000000000000000000000000000000000000000000000000000000000017");
byte[] val1 = Hex.decode("947e70f9460402290a3e487dae01f610a1a8218fda");
byte[] val2 = Hex.decode("40");
byte[] val3 = Hex.decode("94412e0c4f0102f3f0ac63f0a125bce36ca75d4e0d");
byte[] val4 = Hex.decode("01");
TrieImpl storage = new TrieImpl(new MockDB("Test"));
storage.update(key1, val1);
storage.update(key2, val2);
storage.update(key3, val3);
storage.update(key4, val4);
String hash = Hex.toHexString(storage.getRootHash());
System.out.println(hash);
Assert.assertEquals("517eaccda568f3fa24915fed8add49d3b743b3764c0bc495b19a47c54dbc3d62", hash);
}
use of org.aion.mcf.trie.TrieImpl in project aion by aionnetwork.
the class TrieTestWithRootHashValues method testFoo.
@Test
public void testFoo() {
TrieImpl trie = new TrieImpl(null);
trie.update("foo", "bar");
trie.update("food", "bat");
trie.update("food", "bass");
assertEquals("17beaa1648bafa633cda809c90c04af50fc8aed3cb40d16efbddee6fdf63c4c3", Hex.toHexString(trie.getRootHash()));
}
use of org.aion.mcf.trie.TrieImpl in project aion by aionnetwork.
the class TrieTestWithRootHashValues method testTrieUndo.
@Test
public void testTrieUndo() {
TrieImpl trie = new TrieImpl(mockDb);
trie.update("doe", "reindeer");
assertEquals("11a0327cfcc5b7689b6b6d727e1f5f8846c1137caaa9fc871ba31b7cce1b703e", Hex.toHexString(trie.getRootHash()));
trie.sync();
trie.update("dog", "puppy");
assertEquals("05ae693aac2107336a79309e0c60b24a7aac6aa3edecaef593921500d33c63c4", Hex.toHexString(trie.getRootHash()));
trie.undo();
assertEquals("11a0327cfcc5b7689b6b6d727e1f5f8846c1137caaa9fc871ba31b7cce1b703e", Hex.toHexString(trie.getRootHash()));
}
Aggregations