Search in sources :

Example 46 with AionTxReceipt

use of org.aion.base.AionTxReceipt in project aion by aionnetwork.

the class MasteryConsensusTest method testImportBlock1023763.

/**
 * Tests importing block <a href="https://mastery.aion.network/#/block/1023763">1023763</a>.
 */
@Test
public void testImportBlock1023763() {
    TransactionTypeRule.disallowAVMContractTransaction();
    // data extracted from the mastery network
    Block block1023761 = BlockUtil.newBlockFromRlp(Hex.decode("f90836f9079001830f9f11a0e90116b4547877fac543c5cdb8c36c366368364c2258e47e888e7df3e3b1dc9ba0a0d75ca161e901ff63be33cc0ea3efda4a7609c74ba4bd1342db2a6edba5528ea096ed56f0053bde3118f727d288f7ee222c887ab922789f89b1f99c245f4c96f7a0b8c9a297c65bdf9ee3f3b6b8c3180e176c9ac2177ae2057631e98d3d9f7ffcb2a014d226e1d51580e92461e197604cb9a4f02d218e77868e0dd653e17d4845ea97b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000048a041494f4e000000000000000000000000000000000000000000000000000000008303aee183e5050f845bf4bd23a050233ad6eec83fae1af3e1384a1d1cd3ab10df835ffdf694ebf3dd2291de846fb90580001904416310dc851f92470ec609bf7ee858e7f6dad0001d615c2be4d4b264881c3f596ab0e39e2bd7fc9d3d061e5edd6623493c204f5e187e4eb626953980f3aff41aa05679d03618f3ef279c6221de0c0de6f744b65e0e040438a8fcd4f9545b2c6407d6bcd8e4855cb7640ef62025adda9be7b1b5b83c68300b429032f43e64e5322707a05579b38d34587d04bc604081bf4a06091777516b231a5222a0938d7355f94e52f6e2ed2e8670bff1556c0036508ded72570dbb793f8b8c625e0eed39a2bd4d99030e00eb5781c954b675501617d111a0a4b913237a2e086d6282a9e33ec4e0785215a1d4bbcdabb4a6ffbf1c19b526bb19fadcfdbd297255ace7e2e3aa04192d461e109f93b075b4a95479c13513722f65eae201731fe9961f8cab3b2fe5ce88b786306a734b09bf19cb3ab54ccd43bcb3a074d6e84da54816a1a487f2e6fe3eee7c162644072dc996cc73b278d33c6da29ea5a0ddcbcff8f51b091831183c754d323fdb7a3a7ae38da74742579effc3105e3a9f9611efffeac8ac4539c2c1891531c09ea2d621fbb70c75b86d18a26428482cad4d2ef960b6fd8e64373ef6f6701aa4d3efbe4ba9ca66f9af1c9f77782f840e69911df51b733af2a8317bf256ec626b1b40ba1e72494abd95cbec1b9774425189c24b8d03caa25e35603d1360c7ee787ecdcbfc7ce214d35b0c84c4afde70c26f15f6c4d49827d1f774958343d9eb3286ae7246fad2700b6072dfb934f04bb74f652c639e6cd7c84d2e63a83016df85e1c192d1c55f977a7c75038dc9a7d9df6679b810469293b0035dc1ae77e36a4b2e1894bce8f7751dd27408fed27f18ff7036a074ac430ed9db8bbe48f645051148a9f1b0796a05b35b25687153c22abbe4b4fab20715b302b234c2bd6fb81cdf6f05d6baf0e9ffc1716c612085ee8bf2d824837558e370b197900b5750cdbd4f894e480eacfe350a4cb3b9599ba803a5c0fc73a5ba8e9501411ad91ee0ea4591bfef086ddac43a4e75eebfb63a26cc0d26ad3aec5976798e3b4243d65ad8a05cb2c5d413c3bb6561794cd8705c468a70c2626d7c9f45366d343671a7da55c7375224b5a336c8897e71851721f2422d01421cdfa3a306f96d211a1eb7099b18d229bc3563a0111ef12243a62d20f1a0a62f829354de28537bf4ab900478f7e19a47ded9e42ceb2b10993287b4b3be5a90ab1da2a0aaef46ddd967577f2026c5f7f9c55430ecce3401646a5a289bd148329ebf1f562d86ebf6632fb644d815575b0338898481e96b1b877ef37ce70c1dd3b5c8ed2d2b10daef1d46ef36cbae5801f7b96b787881ede1a52eb6a3d990e93221287d2c5719ca62457e03e3fedb3f017ba75b91ff163d7d4b7c1607227aafb54de06e73130e2305a186eb8faa70727f460b9a9e49e5af01b8307d08a6fa1dfba595927d35cb200f15ea7915f6bf216dac238f5a1ee6d769976b14187f83ef0731681e337f64ad01b2fd586fe0b4cce5db10103a79be7a8f2a0efd7fdf36576b72167b283eb5fd3963d04ff0debd5df17921b51c97e92aa644601367a98843fa8fd9d3b541a7fdb7282f566d79ba35a69edf1295760296d4303c179bfc96b5022704217c94873bbd9d637f4d97e9c28ac87476a5fa02f48105c6dd1cfb3f240427e159fca32570d2e64ecb1504f2c14ac9e74bae8ab22d25339d1cb3306212575445f7578aadd701dcb788ad52fb0ec27de65175f48f330a2148b8deb48035726e981aa80940a1c1cdeaeac3ed435f91c6b9d7f5096223fe5538e26ed9b6cdd4dcd7571465c744b465802d6fff0d61ec8aa6a52e353f3f1b8b21beba74f44909e4bdbe9b3b9ef239e608e37ef6f41116808cde2b0224cd9208e22df6e62faab7fe58e63a04286486208e03c11b0f1eaa2dd462036b75490dd706702174364a83838b3cfbaf072f580138a127d4a676a32f2531e2e2d93e1eeb3a95d99644c3c15199745572a8e4f8a1f89f028080a27f0000000000000000000000000000000100000000000000000000000000000002558800057b23285c0c90830f42408800000002540be40001b860ac4f4597ef563d4302ca703c25719dd6ad159331c8cb7ee6199936aed92ae940feb2a6c6f8826f2f9e862ce241d5ca72d44c9acb1fa8b53705504a66eb87f781bf76c91e8fce3c7fb158847df2e8a8d053476db8e420fd38d9e4841ec1da0f04"));
    BigInteger tdAt1023761 = BigInteger.valueOf(62_284_797);
    Block block1023762 = BlockUtil.newBlockFromRlp(Hex.decode("f90791f9078d01830f9f12a099897e16c63c55be270639a462c5bf3a9248b0a407a9a6bbc9ec3ef99cc92819a0a0d75ca161e901ff63be33cc0ea3efda4a7609c74ba4bd1342db2a6edba5528ea0a0bc25eced56d45059167f493187c5b598c5e11fdb29ea14c8bdfdb0538f998fa045b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0a045b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000048a041494f4e000000000000000000000000000000000000000000000000000000008083e4cd09845bf4bd26a08555e3e6807bbf9d40b2808b8e2e9a52b7763be9352286c0cd5c00bc59079049b905800087acd294939168af04783e4f27db1744479c27b78916e267ff2d324a392b3c6c718071e6dcdabbb3fd5996023c6b216587a043e9fcf20fc0918f0ad7c520e24024185b38ac4675f90f5fb70740c7216b6fe560dbe42bfd0a670c7e3e24b535967c0f2ddf7df926797f9eeb492475be2a5605ad82b939578482708bacdf38e063f449bf0cd45a41f57a00576af7dc135bdcf35804c7b85567b81169949405b1f7569bd3d9148e7f02ead19b360c08da008fbbb12f5402b3dd04ed1184a61777e359bc3cb8051e3797937b2cd5ba3b56251f6f3cd0d275a4e5a0780a1e13fd551a9c8f833cb7197596fa4efd2a7784b6aa794ed7b6cf18e71d6a75a692529c1ec726ed9bebfc7ee901625287f1d53fbb9622e40e66834a9cec2b7c7697a10adbd2c0a101c6f733a5c528fe399d21c67dd76d13b9055d8c1f25257ffc68cfa683c166a04dfab72a74531a18c53e6cede64bd4bf485e239d418f5baa4b187f843000d0be277b4316bcb0ff2c3804cac055da313aff96f90a8758567c8263de79b7865058db6faaddc8847832760d0865018b26f8751f40a44bf8d24aeaf8dac6fd22381c102a35d1060d142dab386dd5ea2aaf6a732cfe03db05875bb99fa13e2859cce9196324cfc8549ab3b967da09e33357b7a705e9fb8b5037db9f202c661381dede93114d7bd6fd623ec9679dab2778a3ebf47a1dfb706c712fbfb390bb53ce3f78df31613dff4f43ed8cf93aa2980265b759ffc2660bb136ef11a29f0893d9b7c16beed10b28c7ad53e1bb892c91d2663836757866cb67f95a4211dbeea79b44a6f75b763e372c9b06126624e6d9788a3bb2a9633349a05d3d5a04a2133ff1238adcfafdd4bc0d5784d8b4210a165ef8ae195cb909c31a0e1dea6bf51f1e06fc8aa4ea835af56743773f02188c64b277550318bcfca24ca434db9c62ed909d4b759bb9d1a73f5b894fe62258e42a538ebec92a5cd75e54e206a213b1dc3e00f38fbf2e1287a64db1c83d08b6d648853eca6b8eda0523e917ca90b124e555c89b21ab02c8ff1bccfeea650e01b75749d81a3f3c9bf95c95119f445b5efb734f741374966f27e4ade0f1d89c1a9bd5988d821e5c74752d0b9bd9f89635433dbd0c8f22f5fa88a3a84fe9e405b00f176a6446c21475beda1b264b571f75237b7b3fc288136bd5064bd2eedf6d06622483a6469c14ff573972424954cd727cbaab646d906c7227e33d735dbd7efd11ce03eeeac0a80241717f3d6a22563210fcf5ba425fd3cf0b18fa44ac6862956489d128b2613489d3ea6f1442f223947ef01d260b586f5d585cb57b810d2888973a49144a0cdb3d53c718c7a30fac886f627968da77f879c9850f1e9aea1c2ca568f8c60e6d612634194a29d3381e24149143fd1226458e2b861f5d6dbe79add9c56075ef5217b83dd7f78961d2a7b23042521df30ab946fdfd1c2619b637b113cad00b7520402041ce3fc4d2eed0ed652201820e89c35e1c4ff9dbbe14da8185e3b33ac85ba698531cc3ae5ea88fc7ffd79888b3feb9aa0a15c1b37df7242652ed33c6daf9b111f573f9a25353e8c523f849f6349bff6f4594eee5ac1b59922c5bf029fed78e3d0fa9037e156b53e813303b3ac449cc0df58d1d1c0dba6c3316c9a35883b5d17f3f097a1ed417d3ce092a60e6d0f1048a87471e92b540ba01b22eaa20ec43d5e122bc0b874d8fafd4f5379b54bde4ae94bc37a3de1cbf223917f303720973f3012dd090cb9a207e19c2e6b7a6f860541e06840b06c97c34ecfacd7fa555bb3a0f9ef157bdfec10f4d7246ef3316f07731e32369114b40d458ab37439425219e9a5075cc9ca40734414d6628c6dbebd637bf80157254d91c6993f3ff21af32216299e118ed276be4446bd43677ed771a58a65bcd8ad9673997f98f6c76b4332880460137a68076392b0345c4726452c810a4f1735145aa4d7ed8b77ba6aded5c616e19ad8126aef4f4fecbc0"));
    BigInteger tdAt1023762 = BigInteger.valueOf(62_284_869);
    byte[] trieDataAt1023762 = Hex.decode(hexEncodedStateData("masteryStateAt1023762.txt"));
    // block to import
    Block block1023763 = BlockUtil.newBlockFromRlp(Hex.decode("f90837f9079001830f9f13a0d23ab2e61a9ef3f4d820a13bad7d6e0507139b0f6badebdd7a76f7dd2c07dc95a0a08fc457b39b03c30dc71bdb89a4d0409dd4fa42f6539a5c3ee4054af9b71f23a0e80d01bf7d1b76253e75c4fa1bf25295cfb743391e215c1d5208d2a3e1faed0ca02aef673169ab46917cde72e3ddc0ca2c30671ab73f2b78635f4423f73d987302a04463417d369f5d9a5798c15a691b8118b1a4951a9d50ae35e3a989eef2fcd6afb90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000049a041494f4e000000000000000000000000000000000000000000000000000000008303af2283e5063c845bf4bd34a09a84689aa205b90bf5e9733be1d8fdea97f979112bd25d191cd377f8217e745ab90580002aead215792f87b7c7de5535769a6e1800e371f8102a29a3415504fce41d51c5372222d906e8b8ff2ef086171f6d4673caaa50f5766d1c990fd57c9b71de6fefca724407d99e5b7c14f2c4cd879977875e7d66b03be6c6048897808ef17d5ee053d436e47b8171487e40a375b105222353bd023f3927555347c77ab6f887fb256398ee04d14cbb367223739f1e2013fb9672bcd1f358cbd6f821baaa928b664597a7101f3ee5091a8e4c655a73357e0141ef1d1b2a0894bf059d0b5723b5cfe9c05ced18b73f659dfaefd915722ea42f7a61fe7a62b938b0fa76c804f446e9267d865ebfff0837904ad71467796932ebf12b70acc50ca43106ffd95767ab47641fe872c7b286ae02a463b839aea2fb7c1b7b11ecb0907a411edd67e75c3ddc02497647d9bfb39c1265f9d6693f99bee669169f11617f1d4741936eff926d16c3af8c5d91df767f22c332bdb0e08cc36a639f15c94b73e2ef72a5f99d58b01d003648541b7cdd7c7a88272b7dade38c87470a7efca90ae589ba0202ba04bb00632797f1378d48c05f6cdf510aea3b4601d4c03ad679ea17832a26d232a0aa9452b53ccb87398b9431b0f464915bce3e6360fa4fd86d750c02b84142bc65f88f6afc9e1c8910d6b5d31e81d190d404051723ad76d955a35b4d29e3d662d9eb08a2eccb750872e1fbab15971121bef4a9996fb1664b131d718ea10ee55dfec784159c2153512a59e5518c999fc53c2e92032c7d2449242e0cb27068067ef9fe5479cce3f588ac03b63a9bb84a921039fc7f304f59ddf7d54ebc6020b3054ccfbfeb128efcd6c9c91c1df92cc74342c81a374a0b78f0acc2ac66ccba90ee76a16a2a02b7df902cebed114492c85102d5ee95f91f2e7e4d5f577d36e5bd34a64244c9c65199ad5bfcfe1650876dd33ef925c1bc05631c2817bca895b490701cc7397cebab34f5545c387cb635c66b9951a387d1fb1318521ab9dd79d68fc7ffe4e3002cce404a829410cae1204b0716d00c69ae857e8daa04e8923e3a353495700de2140a2df938b81e41b957ff0a5f1154a3a982a2aab2df0f12d08d1b03385871205918b4bcedbd39b4bae88a9e2a11a701630b0926b0260f015173938996498319f56707613ba818026b53ba9cdf4bcada79725b8e2afd822e73b423de17bd3d8975ebf32565777042b2fc70ff916e8d7202875f0d376037a91630213f14c9c85721efd15739e5575ac374113716dfe8016b2c481214fab023ff4076d346184a9bcfbb7bb5ff1d1470a7a327ef853e4c323fd76381d9697fc7b30a8f08a8743255d3985af14e420a5cdd2a060b8273ff63783d05cbde399607e623a05b5302fdf83449553c31c753083b63e3b9b215ac1d7be919b399f8fa14a3e8af169f110ec4fd53087ae76fa6159c8a5a97549cb08b78d88e24f0c6ff5e0ccad9f7e0512dd3bbfed1b416b3f93d586f751ee408ba896d31da6a8195633c5f8aefddf0af8904301d772f4251d5a517032266d927ce25afb5718cf81683c67362074ad87a9f46382e511697d8d775ae287d04f7bfd114d3b176bf490f803866a8a7298690a8eb4b08c308a0ef988133a4b4472236b7f03768f4782f3cc60dafef80c4a59e8b1f9a551a7838c04c73de41a63e0b729067a026e8b088ba2fad7f62a79bfe9a643eaffdcd0dee7581e3f4a444ed53b82f8843e548a309b52a8f9c142e610c20a160345a26c7b8a57b121fed0ec7fe66a90636a42215c15af76e2ad00eca7e3f9892e5be2b4da71f0479eb05c3c65fbac5866fe25ba15cf805c6228b3c10ccab90b4e94feaaf57854c4b9642d906f3f21be25920bb877f9a953235bf463b4372f3d5efe91a74f51c3a0bb7cab840c59f77deb3931616aa701a7292cb294d6f227bdff3652252859d188439d233cf1bcc5214b65b0b23bdc6bb9cd2db47fe3b95357c7deccd2eeb2cfe951b5a8f378c437a3ccda981d376d73623fcd7edd8b9ceabf8a2f8a0038080a37f000000000000000000000000000000010000000000000000000000000000000280558800057b23285c16a5830f42408800000002540be40001b860ac4f4597ef563d4302ca703c25719dd6ad159331c8cb7ee6199936aed92ae94049ee7d83aa0bba5d597259bd98049d628c5c1b87f6427f7716f8a0a4db578bb5c5ade67c6f803d885b941ba6305aa1517dddd84766ce1900e5efa7f0f5b3e40a"));
    BigInteger expectedTdAt1023763 = BigInteger.valueOf(62_284_942);
    // setup blockchain with state before imported block
    StandaloneBlockchain blockchain = new Builder().withState(block1023761, tdAt1023761, block1023762, tdAt1023762, trieDataAt1023762).withAvmEnabled().build().bc;
    // import block
    Pair<ImportResult, AionBlockSummary> results = blockchain.tryToConnectAndFetchSummary(block1023763);
    assertThat(results.getLeft()).isEqualTo(ImportResult.IMPORTED_BEST);
    // collect the consensus information from the block & receipt.
    AionBlockSummary blockSummary = results.getRight();
    // check the receipt
    AionTxReceipt receipt = blockSummary.getSummaries().get(0).getReceipt();
    assertThat(receipt.isSuccessful()).isTrue();
    assertThat(receipt.getEnergyUsed()).isEqualTo(241_442);
    assertThat(receipt.getPostTxState()).isEqualTo(Hex.decode("c5dc46570782ee487a614566ad2fdf7af42cd084ccdf39ff4d8cc1d5caf32937"));
    byte[] stateRoot = blockSummary.getBlock().getStateRoot();
    byte[] blockReceiptsRoot = blockSummary.getBlock().getReceiptsRoot();
    byte[] receiptTrieEncoded = receipt.getReceiptTrieEncoded();
    // verify the consensus information.
    String expectedRoot = "e80d01bf7d1b76253e75c4fa1bf25295cfb743391e215c1d5208d2a3e1faed0c";
    String expectedReceiptsRoot = "4463417d369f5d9a5798c15a691b8118b1a4951a9d50ae35e3a989eef2fcd6af";
    String expectedReceiptsTrie = "F90125A0C5DC46570782EE487A614566AD2FDF7AF42CD084CCDF39FF4D8CC1D5CAF32937B9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0";
    assertThat(stateRoot).isEqualTo(Hex.decode(expectedRoot));
    assertThat(blockReceiptsRoot).isEqualTo(Hex.decode(expectedReceiptsRoot));
    assertThat(receiptTrieEncoded).isEqualTo(Hex.decode(expectedReceiptsTrie));
    // checking repository state and total difficulty
    assertThat(blockchain.getRepository().getRoot()).isEqualTo(Hex.decode(expectedRoot));
    assertThat(blockchain.getTotalDifficulty()).isEqualTo(expectedTdAt1023763);
}
Also used : ImportResult(org.aion.zero.impl.core.ImportResult) AionBlockSummary(org.aion.zero.impl.types.AionBlockSummary) Builder(org.aion.zero.impl.blockchain.StandaloneBlockchain.Builder) Block(org.aion.zero.impl.types.Block) BigInteger(java.math.BigInteger) StandaloneBlockchain(org.aion.zero.impl.blockchain.StandaloneBlockchain) AionTxReceipt(org.aion.base.AionTxReceipt) Test(org.junit.Test)

Example 47 with AionTxReceipt

use of org.aion.base.AionTxReceipt in project aion by aionnetwork.

the class MasteryConsensusTest method testImportBlock1023849.

/**
 * Tests importing block <a href="https://mastery.aion.network/#/block/1023849">1023849</a>.
 */
@Test
public void testImportBlock1023849() {
    TransactionTypeRule.disallowAVMContractTransaction();
    // data extracted from the mastery network
    Block block1023847 = BlockUtil.newBlockFromRlp(Hex.decode("f9081bf9079001830f9f67a07d5bade42a7a540905fa003a414c44272c9634bba5b8e375727754d05c6d4ab0a0a0d75ca161e901ff63be33cc0ea3efda4a7609c74ba4bd1342db2a6edba5528ea0a7ef235254de5057039daf1426b1bdb6e8d2c743f0bc7661d7793a53cea1d36aa0277c93a2524a5caa2ffe4367eb7ea0b7792f6efb3e1cf0eb428dfcd3433e0e51a0f1c7408329cc7b61c4bbc19784e3ce29e7c31bd1bd3b989a0e20df8875c8c47eb90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000048a041494f4e0000000000000000000000000000000000000000000000000000000083066d9783e4b862845bf4c09ca0d8c7e4f7dc46c0a3924992f9c098660c3825a344163de16a278ff6ae75c54595b90580000b4c25a28a032d74bae923f5bad95eabcbcf331a2109aca0c0bc060bb533fdd44edc6706ea174e1efb69510e0ebe9bc28194b3b0117b14fd532fa3255ac3ff16534c2d42ab4687984c347eae691e9e71d8a76515fb4fe809dd698b96656dc89de8ac7497535f8b47c507bf626b0afda9b783e9c4c0adc18c154e28a56173cef3de126e09e4f0bfc4480df7be2add0e4c476de9b2aad71d401227992301d62d13b4fc54ed545c3f393315f768b1ae2c003badaeb3a0f81ae8dd933ac3b6e99dbd7dd67a5287242ff39492c985122dbf3a36d92798b53621bef3558507b806e5915267f52f137d1f0516ac5c460b02e4277009ad2187a519659bf4120c7b370b8951284eba3113071114be86cf6628fea86ea52c274df884b4ba12a0c2d31fd32cb7cb5c9839f3ca5a34cdc6726c8854b57ea418151f7ebadcb52ab5dda49e83c2d20fa05ca72d39dcbc1d7fb9eb1e641ef4b231e9263f5ad0cb7b47b3755c4603c57e7acba71143efbdb109e34be6f4f4e07557719f05b2dc7871a521cf1492703a4886974955f8a0a074c104000de4518197075dc6fe2d690fdbf3196699f9627c07c68e24bfb64cf91f40f345dd3b7f472833cfad0865132e49e2e096fc172da6703a2086363bcc034cf6cdde256001c7eb3cbb9333744837001f6e93643338d70a162f29d629e537ea0c292c2b3b3d7399d1f5660e75080c3b2f3140fb44aa4134e79a653cb62a23b7ecf731368508dbb178b0642ffafe4e4821a80fb23c09220abc57eb24bd4a80860313f9cf8ea456fa7f484ef8ef36f382970ab53849a14319358c9cfb2c05e21f1ef78474bd87d9253e873928c5cd1a373fe74b43c766035b2286f5a9b614be2efc113dea2839575f604b8aed69f7c4f8368f09497b91edd3ce17283f86af9329433f7efbce62b88501206a526e7fa7a570f73752679e636998b9ce15fac7435e63e704fc6914f76d9695819a82bb1808c367a338bf00f2c50e4d7287527080e3669dd70c8bf77f32ed796607ce2458cf85588c1b3cca3f765a312ee7202c3ed829106fb1900e0501ab1e456b5785cb654ccc51793a3e5012ffa4a20c51361450646d156fa612ab61c2b233ee43082a37d729c30d54b2067524da23e5ccf6d0b669796a2eea23084c43121aa057c47c262f8a777aa53aec530a150cd59a8cc51c7d3be8254bcfe3b587b64cb87a4d213560efa03e9fb0a9bfb67a5b3093e0c7ce02987bb55e01e05fe4da3f1d2afe779a0fbb921670041516ad4c0a2f9a5b65a473ccfba9f23b48c98aca5039b83cb11c62026e624af9a9f81d3787db161c253bacab5c13f424392f58a18123be60197a60f0395f0af68758f88bab3077096ee6ddc880dcfb3669982b3356f9abd49f06a275042de44956ada54b836547d03880396a6e544ae61661f5160986543a0162d9b78c884c4a32dd024a9159f2c7271d39ab2380d5af1e1999313bbdc748e825141435e14b03a8bc2832e31e59d7c8c96286719b8c9c7dc23ea396307696358546b92c1eafaf8ff97b89dd8a13256df93f0dce4d3517043c2a1873023921c91b7de627d9e56b442457ee0a44157869f6ff5f48f547f48d4b68f6bd53050ec9a21979c32c1fedfcc679075e554f5ed48efe12a0277a2abfd8e55a7d60e9865968a1880ea66000fed2e7183ebe0f3021c6d3572f1c19294f90249654a971fead27e10373960a31e0f3d9f12df9e98ca4df4fa03e4356061020b466109215da0dfa0f41318af1f3b67c523bfc0bbdb8f63e9909e1ff14563204c2712c94280bb7361612da3f2bed67870a32a6091cf9cce0fe19f7d5bcafad53adfa03e9b73863b10e7998f5a79a252b9bde766fda090210beffe5933d72c2fd0f3aa04aa911b5c8bb39dc0f912e4bac81b9448cab44540bddf63d88beb6f039651798fe864ea57ef7569e5b406c1b560287dcf92d80fc206e83db637a8f826eadfb23b7f30f7684db66d4516ff886f88440808087600060006000f08800057b23285f7c95830f42408800000002540be40001b860ac4f4597ef563d4302ca703c25719dd6ad159331c8cb7ee6199936aed92ae940e8c7eaeccdbb85a804b627f89860c308f86a790940755b0ce461b000619f62e69cf0717c4f6d143bb92135904dfc57f9286912a3edf774d40ada2d3a2628080c"));
    BigInteger tdAt1023847 = BigInteger.valueOf(62_291_162);
    Block block1023848 = BlockUtil.newBlockFromRlp(Hex.decode("f90bd5f9079001830f9f68a00fde547d8a92f9b7d2ff8e317bc816554cf3b7c49aa8410a41e560cf1fc61fc1a0a08fc457b39b03c30dc71bdb89a4d0409dd4fa42f6539a5c3ee4054af9b71f23a0fc5b9d41cfe64b9f04c3402263bfcefca862143dbb33216061f5da13f6fc00b9a06bb43ffd61ddd7b1e7a834f0e8d4f655feaa00f85aa498f7d61319710fc994c8a035d9bd374a96a3e820ea398b2ae335f3374b30b85c1d539a045cb2769bf48207b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000049a041494f4e000000000000000000000000000000000000000000000000000000008304d33c83e4f190845bf4c0aba0a70d6ab9b4d9f73419d4352a2ef28690c1cd752564fccfa059cd8e539f0d2730b90580003f6d6a0cacf4e0f4ef661c8180e9f212cacd25db8a1982592002d73f267e7e736232b5c9140a68e529def90cdd7c6734236aa46b99996b2216184329981faf559e1256e16e5c278482f1c7411ba89ac6b671f26771dc3723f8f7d05cc5fbd159c3ba3c49520019d403f626646924cc49da62f770eab682e651521e28fe4c7ed6f4b6622ac64a421f83da8cf28c4f2b3b2f2d1c19f588f38b9b43517b5a2b1a64e5bbcbe26150b3cf2d5641905d477306ca9a2d3d943f6b39fdc90d9d4a5b1d20e020b5cf7d23d38a23aeb2c866ac9ba43b6b55ab8ec9bf982925c21130f4bc57da34a6fd1a74231ea6232dd8ce0530e39118e9f0c4dd998f2a2f9f9d267f9de72496d3c0aba4ea070b3a38bc42bf9896bcc4279023e2efd34ac6aa9d5d0976eeca8eaad53e705b521d539e20c5f1dcf5ab28c10b336bfcb1d197516415d147a9d6d1f9062b24e559482183493a869ad77af0b98b801a0e64392a2495a9e4fa0147bb942310d1abd8110e63484e697ba87f007fed01149e0afb10c7c073b54ae8225c1640efd7e08fb1e98a1e52e74ae0e7b95de8669b5b9f078a69b7dad4b249283e6e62f48ec8629736c0215314b9ec5487615423fcc4027a318e52182f26b6edd599d5d314e46aa018b58a1608346f259852afb3254a1632eb1944a5e4dd9e72c3a4034b13d7e6065ec52f24ce040b74520a121152de4b771bcb99780d0ad9dbbd0e9b2f6393dc551db1467e44df06d8bfeb985a2fdd3408c620bc51b1063a2132b5c481129b452aeae58eb5af66f16816fdf270a834633724570bc303085bf35a0ef0c7eea68e13c83bfa7a76fc676d47a12206a648f3436c17d564ff9db5e3599c147ac2610cd2bd861d00d4688eb1fa2f9f635a3c57fd766afee818e6b3fa78ce12387c910585da9790fd8930ab27d03c254eb2e271bb439d3bf4f8599709a6b7877cbcec4d5b37f1e0f025ea6596b5f93d4b55b26dc1e5eec1b4e8200093e4310624391960d1474b20d7bf71367cffdeb704019aac9b161f8f493ea54254d12bad964c0e4c7691f80144736e80861b592a2ba82cf238d56a6371688e50950f75932c4a56d7c8f674f25fe0427afba700651e059c09a1b42d25d4f91fd8a7544af4194790ba904bfd474141539222120c9e32b9ff8d54505d7c88867bc824b8300d4a19af34b9241d3848e01176317f11228fde74bc0b24be567f81f5c38a3f18a438ef0a3ad425b6d157e4e20193ea22ca0293b77708750afe32f912acf338b8354721403f3736b7b520b492c94e35f6fa2295035e5eb2ee20b97d9301d3779f96536138f58f131b3bdd6631a93a29103a82f3b7b08d620d0648dc567ceced20b6ff4f7e090067b359b36b0e3b60ce5cc0bbaaa3ddaf213749121ffb5cb0573480b0f4ac283d3dbabb805a3ed3724c993f3c110ca7e813036107e151975723faf53b1998f06f5533d65e359d3536baf8cb668e8e0003877201bae514014cd2071cbabb04bea2f313f7e774b7f4027e6bb8ec241631a7cb760ea21eefac2d9674ffc3731f53ffdf3422b93f1b04b400d0ddf1ca32f1f37a70186915adbb324cf7e21842ca22e1fe517269a2b60db66a2669324e14049305e7523c7ed9b5b3de8cf202c850aae2c67a18101e0c17ecc0368a03b45355505a356f40699d69eca6b60a988e07ef468f365ac8713d81b550c478e880f5a6e8530a9b2db335660c75bc0278ad72b65e89f796f26d6c095e622c2bdd8809ff6c23143054c3091ce78579870d467c97ba1e6d76e33b6f65487993f952b6c595a5132f14f79cf380340eaa6f191c2a63298b9382c6e44db46d286d1d03e502fd3d27c18745eb0d3720e4874da3ccc611e94f8f47b5edc69b34002f6ded66049312b052997046c06711626f02377e79b24ad0ee73ff89982433fe2f152f72dfa31362e016708d7620aa78326bf621b793a352a3595b51654aa32d310b5bb4dbc43db68d76b60cdcf9043ff9043c418080b903bd605060405234156100105760006000fd5b5b3360006000508282909180600101839055555050505b61002c565b6103828061003b6000396000f30060506040526000356c01000000000000000000000000900463ffffffff1680634f2be91f14610049578063b4b65ae01461005f578063cd909c75146100cb57610043565b60006000fd5b34156100555760006000fd5b61005d6100e1565b005b341561006b5760006000fd5b6100736100e7565b6040518080601001828103825283818151815260100191508051906010019060200280838360005b838110156100b75780820151818401525b60108101905061009b565b505050509050019250505060405180910390f35b34156100d75760006000fd5b6100df61015d565b005b6002505b565b6100ef6101cf565b600260005080548060200260100160405190810160405280929190818152601001828054801561014e576020028201919060005260106000209050905b816000508060010154905482528160100152602001906002019080831161012c575b5050505050905061015a565b90565b600060006101696101e6565b604051809103906000f08015821516156101835760006000fd5b915091506002600050805480600101828161019e91906101f5565b91909060005260106000209050906002020160005b84849091929091925091909091806001018390555550505b5050565b601060405190810160405280600081526010015090565b60405160fa8061025d83390190565b8154818355818115116102245760020281600202836000526010600020905091820191016102239190610229565b5b505050565b6102599190610233565b8082111561025557600081815080600090556001016000905550600201610233565b5090565b905600605060405234156100105760006000fd5b5b4260006000508190909055507fd4fc977b8ac41e3fa318bb6650de6044046ea9e8cda72be27b6b0c458726c1666000600050546040518082815260100191505060405180910390a15b61005f565b608d8061006d6000396000f30060506040526000356c01000000000000000000000000900463ffffffff16806316ada54714603157602b565b60006000fd5b3415603c5760006000fd5b60426058565b6040518082815260100191505060405180910390f35b600060005054815600a165627a7a723058206919d683bc89f37f2bf6a52877fe0997e5d9b83057967fa1fd4a420b5da707b20029a165627a7a723058202d4cb48cf45eb1f4907e249b6060d84330669ff7f27d967554eb3a20e1c1f68400298800057b23285fa95f830f42408800000002540be40001b860ac4f4597ef563d4302ca703c25719dd6ad159331c8cb7ee6199936aed92ae94050b21a6a6526aa7647d6d0963c508e4d9fcd4d6e5ebe400b93c6926de4dfd2a2117f950c90d2949d0ac8d4e4b7f1d00a48962e53cbcb6fa3516d24db1667b30e"));
    BigInteger tdAt1023848 = BigInteger.valueOf(62_291_235);
    byte[] trieDataAt1023848 = Hex.decode(hexEncodedStateData("masteryStateAt1023848.txt"));
    // block to import
    Block block1023849 = BlockUtil.newBlockFromRlp(Hex.decode("f90838f9079001830f9f69a058d7ae97a5f9ea50188f6ca7efef98ed863357956961b69d04f83fac2e6206a9a0a08fc457b39b03c30dc71bdb89a4d0409dd4fa42f6539a5c3ee4054af9b71f23a0ccb31d8edd7a5c3e1e243605d0be34fad6715e30369817914b8dd185c0d41792a07d9fb93c2784e76f1a41fe5bf31229f66d1779f5bc3e1e153fe06b70158ee453a0ed569aa589ab5f5275e30b19bbb6fcf7ffbc12aa7dad39bfb96a47e4ab9c0277b90100000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000080000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000048a041494f4e000000000000000000000000000000000000000000000000000000008304ab1183e4b9f0845bf4c0b5a07f637bb95d7cdaab484af35c605d498f2aadb4ce990341a91c4e753b03b6a3bbb9058000526fc0f9fa31c73e104e0581787f4f8f159effade40f525ca66b86983ea119411a96ce9969f4f20f1e0b571054549faa152e982a509d7409edd3ad4864d7f648442a9f2bd595992f4cba2b4e7825477b4f57ab38e8431d08ee9a26845393a6219f854565767449c748d0a57c6608f9a73758b82c56e6a56d2737dda1713e05f47e8b3f171901425ac54dc96a00d02b3e839126ccb755396b8636afbb9d35541d61351fc1642f8ab397283d0eae6fb2019e5233f3199660bfd1581a8f0f181b131f6ab0fea203ddd0235c5676f06b89256fb7f270c0b97b23b4f6092b36ea2730cac921f0a14e33fa30de8c65a396384d2b3af672a05a24f3af356d076ca5dfc88f590659aef06c1fdf4e30bee8224fbea10b3783fb35d4381e0ae1a07a2e2ddb77075360499ef048838cda5e9a1b204f7dfaca20e64cd904f30728f1fd8476ca9a32ec697e63b5c0c62f29a96950541a6f72a7b02f34f614afe94c5768b5f3019988753e709a279ba6387208d79a2118977c31d71d0253a745f7a30f34a6608f389459f020fb6ea4f8f2a019c753792a28f372ef4ebb4fcfbe178a266e73bb616b1a8d2146d5c94151edb9972716c7e24f72f481a994840328a7a3310a89eef8c3c509d1e9118309b5772d1dcc1fd52df421a8df70f10fae2831d3e3c7755696f33a590d345731be027584bc790d24830ec38b531ef6ef9338173b1f9c908d8b60f879f123fcc967fb979e00f31c8402daf5a0ddb8eac4be87e6144c4e7cb8b5ca9bba989d4ecf8b20409a91cfb74787566da602f7f7bb235f459504519461c27434897745f42f3457e46f1a74853b24cf188c226267cbb06d7d5cb13a181ab9ad2ba1a57b14e10480515d3ac07c60d812ef2dd0a39df46535da7a318b38dbbbf092fb7475ba06886840dac59b87234c3f73481409dd1140f64c25a23beb7370ef290477e99f7199b363be5ffccac739de34774d99b8d78bf629b8f432e8f20060befe83b5e7e332a0f9821886849c6d5400fe0d64089c7bf55531c7ef0fc8354f251dd4a5183ce6ec326c2656174dca48f00a6b99c92a2e9bde463367dd121c403a5de33a9713d1396a5f064bb0ff0f92061a5fba948a0ca3ee0780e50f651d0f4948ab16dd01e96e1e6c759f3b1ba78fd91579f79aeeca671f3a995006c4b835b01019e4b5f725a1d3066884012d6f2ec89138db4cf8d242349e9a8ae7f54bca9671dd7925a3c74e3a23c7acc93b02b542138a293612346ecd366452aa69eb86b3f684dd2f87251b8f3b3c1338feb93055afd82bbb7b75fd6da113b6e5f6e692a2967c041c6073e99de93744586def69433f619e1a048e5eda37a686a9421db0ab57d034655f0af63f54310da7c7f901b650f1430df63856a73a42972d21aa229da6a641e8dd678e13931947ace5137756ab0dc37f384959e24f341e1a7e0e8b177958a81e2342e61fe928d82db23d6fd6b15c4b5d9a5b021a76897f34ef01e5f48d3171f0dbbbb33d3096cb299e29cddcb56a5d38edbe761e66192cf4c37147917779d0654f4fe19e350a4f0518ad6b1fff717b2914729fd51871c03c3d2285244966b7630c03d0312b2c2fd9ee3ca30acbefebf211036b6b0f89f68c37ff105f31eb714930c8148be863e811664203a194f708de0eed1f5d865be2d6d96ba9d97b17102dbe26fca3d83fc5304a41fb46a66d97f8ffcf7e27a9d78a39956453a223c98d8d5691dd89beee3f718f02dbc3864dfbc6cffbfc5c03791bebbad73d62a317bc03f295eae27e7efbfecbf20752de51e89cc87c3c5b5e1b5dd9fe3d5819946733cc49432690fbdc8f4cf8a25d2055508f29f24bd18a394b2fb225eae46a9047b1a3a504d8c1e00be103786e90f85e334bd9fa7a71196fdd762adfe53ff337272e7df6ff83211324baa94061f6c0ec15c4b7814c1394f1aca4ed38d975da88f3b68a6d77d64197ee9d3b3712912d9ab2580b87939da58185edee13f8a3f8a142a0a066db9691dffe45b9dfde4e18502c525e7e848d6c92b67a27888cbc4de04d3d8084cd909c758800057b23285fb6e0830f42408800000002540be40001b860ac4f4597ef563d4302ca703c25719dd6ad159331c8cb7ee6199936aed92ae940b450f4877c297eb1eb24e054fd6b25af02f4a85ee1d75cda9dd148865fffb87174c571cf173d32bd4127d0784091f341ea1e2e2de202fd9cd62d65b609893e02"));
    BigInteger expectedTdAt250718 = BigInteger.valueOf(62_291_307);
    // setup blockchain with state before imported block
    AionAddress contract = AddressUtils.wrapAddress("a066db9691dffe45b9dfde4e18502c525e7e848d6c92b67a27888cbc4de04d3d");
    StandaloneBlockchain blockchain = new Builder().withState(block1023847, tdAt1023847, block1023848, tdAt1023848, trieDataAt1023848).withDetails(contract, Hex.decode("f90ceda0a066db9691dffe45b9dfde4e18502c525e7e848d6c92b67a27888cbc4de04d3d8080b9093ff9093cb90240b6bd884def39cc288a0f6f556b890e2dd5386cc73025b9d8ef61d8cf32fa6421a73912abcbc3139f8543473df7c271ffc5354d206e0265339ae887823dcd51c103a95ee61ff1e41e2e859a07f2e252b79c6f5a3dc4ccaf54a9d72062b3a3497d6ab9486585f9b09d79a1beb020be17ea083bb39532be7ae5c866799d217e5deb86b5c20aa6bf7786ab4032ecd8100a7078831d76c42724ac7b0dae246bb8a8254a392cb28c9e0daabccd989c8ec52214c458f8b2e9f8fbb60aa0582c23b929e1b470b17fa0b452d327d2ad86ab6d034d2fca0bafeb7dbd682b82165e4d814d52c416dcc9685af7ed13dc9730907b19bab9a62ca7cc4246184fe9f6a2cf8a3b92d77072321a32183f10b943118c8f107c45632407b7811fc96449cd74bf1275922faf19d288a61caff7cbd8231a93091338f10d7a6a34cb11ced8abcbcfff0bb8475fbc477b90c2fb959633774969e382b0bc78aacd41e89e53e4000b7444196b486edb8bd601a441f5e1ea2e8de1a334ea0f75d9464b07358bba5ef179d324e9b83326c53b36d350537baf8831de8734f9efdaf22500c8ac991762cf449c38828405e38e05e2162acc418b8cbc9de951c87475ad2d1febf293fc6346f8db552b819f87639155793760f0fc0d9a054a38fc60d9bb6aba03b5e606d347a5ce76ca63c2044c5f9f6c8b4faff9baccde431787b692d50456942a5c063fa8c3479a31fcaf3868af86a840641db5a9893315301f0978576708eaf8812336f54fc69a8bece3cbe6f27732af023413f413c41bdea05598074cec76433978d06e6e669647f906b9b893f8918080808080a0c416dcc9685af7ed13dc9730907b19bab9a62ca7cc4246184fe9f6a2cf8a3b9280a003a95ee61ff1e41e2e859a07f2e252b79c6f5a3dc4ccaf54a9d72062b3a3497d80a0ece3cbe6f27732af023413f413c41bdea05598074cec76433978d06e6e669647808080a08405e38e05e2162acc418b8cbc9de951c87475ad2d1febf293fc6346f8db552b808080b4f3a020f2e9ef2c5d9a40f161fdd59776c3b63958087dbc70851f891e9b1c6c4690459190608d36834509e61dc1776f3b6535f234b4f3a0349bfda5d3daa9fc735ab356a3d26e9d0815dafade0b6461f79637757ef7f98791903eb45ccb2fd6fd2a91622a92ab77dbb9b853f8518080a0a73912abcbc3139f8543473df7c271ffc5354d206e0265339ae887823dcd51c180a02faf19d288a61caff7cbd8231a93091338f10d7a6a34cb11ced8abcbcfff0bb8808080808080808080808080b873f8718080808080a0c416dcc9685af7ed13dc9730907b19bab9a62ca7cc4246184fe9f6a2cf8a3b92808080a0ece3cbe6f27732af023413f413c41bdea05598074cec76433978d06e6e669647808080a08405e38e05e2162acc418b8cbc9de951c87475ad2d1febf293fc6346f8db552b808080b8b3f8b1a0486edb8bd601a441f5e1ea2e8de1a334ea0f75d9464b07358bba5ef179d324e980808080a0c416dcc9685af7ed13dc9730907b19bab9a62ca7cc4246184fe9f6a2cf8a3b9280a003a95ee61ff1e41e2e859a07f2e252b79c6f5a3dc4ccaf54a9d72062b3a3497d80a0ece3cbe6f27732af023413f413c41bdea05598074cec76433978d06e6e669647808080a08405e38e05e2162acc418b8cbc9de951c87475ad2d1febf293fc6346f8db552b808080b4f3a0353a78894c51161172ff39d9abded99d76f13a7e2bfb806e0d2d8f77be35deb09190a0ff1774896bb38b5c87c9118a17266cb4f3a035c749bcf708d70b69d4d2f4ebd726038bcbebf9ea7ce8481b6acc1e12014e4c9190b221c692e388052f345c628ebb028534b5f4a12094c1c088cc9453996779630ad3af45cbd92814828dd784cf2aa12df95d1b8afe9190a005bebbea7fc4475f2655cd3485f99db4f3a0209bfda5d3daa9fc735ab356a3d26e9d0815dafade0b6461f79637757ef7f98791903eb45ccb2fd6fd2a91622a92ab77dbb9b853f8518080808080a0c416dcc9685af7ed13dc9730907b19bab9a62ca7cc4246184fe9f6a2cf8a3b92808080a0ece3cbe6f27732af023413f413c41bdea05598074cec76433978d06e6e66964780808080808080a3e2a0329591f5e764398e2f85a631d09df021eeffaaaea7b1cf1ebcb4fc98d9e521a201a3e2a0329591f5e764398e2f85a631d09df021eeffaaaea7b1cf1ebcb4fc98d9e521a202b4f3a035c8dc66cc3d06101ea140688bc2c37da6d3259e468a1b56e7398ca8580fe6279190a054de45ab128965ade9ed832cea6f33b8b3f8b1a0b83326c53b36d350537baf8831de8734f9efdaf22500c8ac991762cf449c388280808080a0c416dcc9685af7ed13dc9730907b19bab9a62ca7cc4246184fe9f6a2cf8a3b9280a003a95ee61ff1e41e2e859a07f2e252b79c6f5a3dc4ccaf54a9d72062b3a3497d80a0ece3cbe6f27732af023413f413c41bdea05598074cec76433978d06e6e669647808080a08405e38e05e2162acc418b8cbc9de951c87475ad2d1febf293fc6346f8db552b808080b8d3f8d1a0b83326c53b36d350537baf8831de8734f9efdaf22500c8ac991762cf449c388280808080a0c416dcc9685af7ed13dc9730907b19bab9a62ca7cc4246184fe9f6a2cf8a3b9280a06ab9486585f9b09d79a1beb020be17ea083bb39532be7ae5c866799d217e5deb80a0ece3cbe6f27732af023413f413c41bdea05598074cec76433978d06e6e669647808080a08405e38e05e2162acc418b8cbc9de951c87475ad2d1febf293fc6346f8db552ba0b470b17fa0b452d327d2ad86ab6d034d2fca0bafeb7dbd682b82165e4d814d528080b8d3f8d1a0b83326c53b36d350537baf8831de8734f9efdaf22500c8ac991762cf449c388280808080a0c416dcc9685af7ed13dc9730907b19bab9a62ca7cc4246184fe9f6a2cf8a3b9280a003a95ee61ff1e41e2e859a07f2e252b79c6f5a3dc4ccaf54a9d72062b3a3497d80a0ece3cbe6f27732af023413f413c41bdea05598074cec76433978d06e6e669647808080a08405e38e05e2162acc418b8cbc9de951c87475ad2d1febf293fc6346f8db552ba0b470b17fa0b452d327d2ad86ab6d034d2fca0bafeb7dbd682b82165e4d814d528080b4f3a034c1c088cc9453996779630ad3af45cbd92814828dd784cf2aa12df95d1b8afe9190a005bebbea7fc4475f2655cd3485f99db83baced0005757200025b42acf317f8060854e0020000787000000020475fbc477b90c2fb959633774969e382b0bc78aacd41e89e53e4000b7444196bf90385b9038260506040526000356c01000000000000000000000000900463ffffffff1680634f2be91f14610049578063b4b65ae01461005f578063cd909c75146100cb57610043565b60006000fd5b34156100555760006000fd5b61005d6100e1565b005b341561006b5760006000fd5b6100736100e7565b6040518080601001828103825283818151815260100191508051906010019060200280838360005b838110156100b75780820151818401525b60108101905061009b565b505050509050019250505060405180910390f35b34156100d75760006000fd5b6100df61015d565b005b6002505b565b6100ef6101cf565b600260005080548060200260100160405190810160405280929190818152601001828054801561014e576020028201919060005260106000209050905b816000508060010154905482528160100152602001906002019080831161012c575b5050505050905061015a565b90565b600060006101696101e6565b604051809103906000f08015821516156101835760006000fd5b915091506002600050805480600101828161019e91906101f5565b91909060005260106000209050906002020160005b84849091929091925091909091806001018390555550505b5050565b601060405190810160405280600081526010015090565b60405160fa8061025d83390190565b8154818355818115116102245760020281600202836000526010600020905091820191016102239190610229565b5b505050565b6102599190610233565b8082111561025557600081815080600090556001016000905550600201610233565b5090565b905600605060405234156100105760006000fd5b5b4260006000508190909055507fd4fc977b8ac41e3fa318bb6650de6044046ea9e8cda72be27b6b0c458726c1666000600050546040518082815260100191505060405180910390a15b61005f565b608d8061006d6000396000f30060506040526000356c01000000000000000000000000900463ffffffff16806316ada54714603157602b565b60006000fd5b3415603c5760006000fd5b60426058565b6040518082815260100191505060405180910390f35b600060005054815600a165627a7a723058206919d683bc89f37f2bf6a52877fe0997e5d9b83057967fa1fd4a420b5da707b20029a165627a7a723058202d4cb48cf45eb1f4907e249b6060d84330669ff7f27d967554eb3a20e1c1f6840029")).withContractIndex(contract, ByteArrayWrapper.wrap(Hex.decode("94e6228062267b6b61bb6b7eb4b5f13ed939218890b7b9f54b6098a8bbdc8ad5")), ByteArrayWrapper.wrap(Hex.decode("58d7ae97a5f9ea50188f6ca7efef98ed863357956961b69d04f83fac2e6206a9")), InternalVmType.FVM).withAvmEnabled().build().bc;
    // import block
    Pair<ImportResult, AionBlockSummary> results = blockchain.tryToConnectAndFetchSummary(block1023849);
    assertThat(results.getLeft()).isEqualTo(ImportResult.IMPORTED_BEST);
    // collect the consensus information from the block & receipt.
    AionBlockSummary blockSummary = results.getRight();
    // check the receipt
    AionTxReceipt receipt = blockSummary.getSummaries().get(0).getReceipt();
    assertThat(receipt.isSuccessful()).isTrue();
    assertThat(receipt.getEnergyUsed()).isEqualTo(305_937);
    assertThat(receipt.getPostTxState()).isEqualTo(Hex.decode("193a3191d5784aaf26048cfe793d11ff31d24411876c332de248c430fd0bcfa3"));
    byte[] stateRoot = blockSummary.getBlock().getStateRoot();
    byte[] blockReceiptsRoot = blockSummary.getBlock().getReceiptsRoot();
    byte[] receiptTrieEncoded = receipt.getReceiptTrieEncoded();
    // verify the consensus information.
    String expectedRoot = "ccb31d8edd7a5c3e1e243605d0be34fad6715e30369817914b8dd185c0d41792";
    String expectedReceiptsRoot = "ed569aa589ab5f5275e30b19bbb6fcf7ffbc12aa7dad39bfb96a47e4ab9c0277";
    String expectedReceiptsTrie = "F9017CA0193A3191D5784AAF26048CFE793D11FF31D24411876C332DE248C430FD0BCFA3B9010000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000008000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000F856F854A0A054DE45AB128965ADE9ED832CEA6F333EB45CCB2FD6FD2A91622A92AB77DBB9E1A0D4FC977B8AC41E3FA318BB6650DE6044046EA9E8CDA72BE27B6B0C458726C166900000000000000000000000005BF4C0B5";
    assertThat(stateRoot).isEqualTo(Hex.decode(expectedRoot));
    assertThat(blockReceiptsRoot).isEqualTo(Hex.decode(expectedReceiptsRoot));
    assertThat(receiptTrieEncoded).isEqualTo(Hex.decode(expectedReceiptsTrie));
    // checking repository state and total difficulty
    assertThat(blockchain.getRepository().getRoot()).isEqualTo(Hex.decode(expectedRoot));
    assertThat(blockchain.getTotalDifficulty()).isEqualTo(expectedTdAt250718);
}
Also used : AionAddress(org.aion.types.AionAddress) ImportResult(org.aion.zero.impl.core.ImportResult) AionBlockSummary(org.aion.zero.impl.types.AionBlockSummary) Builder(org.aion.zero.impl.blockchain.StandaloneBlockchain.Builder) Block(org.aion.zero.impl.types.Block) BigInteger(java.math.BigInteger) StandaloneBlockchain(org.aion.zero.impl.blockchain.StandaloneBlockchain) AionTxReceipt(org.aion.base.AionTxReceipt) Test(org.junit.Test)

Example 48 with AionTxReceipt

use of org.aion.base.AionTxReceipt in project aion by aionnetwork.

the class MasteryConsensusTest method testImportBlock365432.

/**
 * Tests importing block <a href="https://mastery.aion.network/#/block/365432">365432</a>.
 */
@Test
public void testImportBlock365432() {
    TransactionTypeRule.disallowAVMContractTransaction();
    // data extracted from the mastery network
    Block block365430 = BlockUtil.newBlockFromRlp(Hex.decode("f90791f9078d0183059376a0737cdda511e1eb5567fc3eea277c91697c3d93453238018e0237bd5b3206fc88a0a0450c4333e72ed26552d7462c0b3669924eec816a219b3960d5b3f0b33f7444a0106dbe7bf85d3eb52c03fd0e7f89fdc753c4d767470b442ba510df97c6291793a045b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0a045b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000900000000000000000000000000000004ea041494f4e000000000000000000000000000000000000000000000000000000008083e4c999845b8e9a34a007eb2ced7d672107372260b1b0b9dc7106f82115809fb015919ddb6c3309871ab90580008688b89d06fe296d803d181b13384cc2e74029ba060da3b67372822eafbfe4695a0729bf28c66b132b4de61bdf9ed13548eb71355b5036e67a72cb0524efff2768437f5d25b0197bb178ee40bea13bab5a8e46f47e31d7053192583a2271a7505ff91a1dc74504270f312c8f300e3032a2b3caf2f476bb0c653043d4383bb8cc3d15840affb47181042a1f3420b5356faeb5b7041cee7f5e0c0d2cfe65be3a528e7d71001753799c5028d9162a68e9029a3824e6528febffb9da75d97b71030c27497d82301732d30a2cc26622998a5a2c9aedf40135c1a4f9ae3b0be94db37d73dc07642acd1fed822983465a7fa9906f0f7f3ffa4165486d98a0cd852dab6ceb992c4936416a0351997de9e46b555cb5270c0d12367915de6e212b72235ce1d8be54943c5bebfb2dff0bef8febb01db04e28395ffb7cb38bf624bf4ad93c12cb7818b684fcfc71bd5999e283184862d1e999577de38e5f3bab329f37162d04b0f31c4795807c7a90895341f7d1aba97e6670d3d70657794cf05195128e15426f7eeeee29dd20ad387bb20a4706a0222bd3d13325b24a8dbbcb0a07d168391ea20c7a7b1a1b267491a185a02008deef5f1b1b63b09eac149311c053e32ca5d47767406177873db81dedb8367921cab4d622f77d47e7aeef35d899e32d8641d2e48e822c36e615fbd60b553266bc2d0c4a075ed7ab89e5d3dc4aa913984c2b51f036f289af900bf87c7b6570fbbcf8071220cc14b1aaceec2476668caebf3e9a01be7cd8190ad53b4726d0ed02dc23ce37d767f7ecbb621278edaa106a9efa3ab39cf4f8ae364b06f55e20c514b759a30d22334f3c698957e0ad9c6063a337ebc869454534466d08944e1485ba40167387f033bfa5a406a8e9b924dab90f97cc5e1d5100fcfa0bf54032efc66215b59e37065110b7a461b3c2456be1d7051fc36a49a587831236c3b226487b1521f41c11a96ac643bddf4282fdb22a7c75400180a512defe27307b0e780634ca2d666c14d9346d0a0e1767582ef10f792f858037adc21733476716ee08a3057b957ade82f074d724696a6affb7cea8f04a37f28e10add261527c9df07d5dd74bfcfbf061181d61b512430ed52114e86315a96668916f5cb9e47ae7dfcfbbcde91fb1a2c5c3d64b4dd96b6834fb819015e53f5ff397ed17d4ceeae738ca587f41934523cbd2ba180b922c295525c3bf3452eeb8907cf8f45f2a2a9c1f481d983d5014034c3681c712342610412350391579758d03e57758b90386d3853587f906b4dcc03f4bb58bab38cbc8a5715a1ee83dd73a44b7389c758121ef8202952652d35a38504544d74035870f8df971635eaf962e764b62d33c02f405259b733850e041281b73aa2c0fd0941d5ea97d9f1c4131c7d2e456975ba8bd875889a69f6e6966937ad6a33181f68e05ac8cf0bcc2aa49f8167ab88625d0e718a13419d0eb7bd407cf74354e96b7c6d383ab543a360eb40358b7323b33819158b2910f6115795bdc3ab03781da3794cb7679ed5f247b1fa574724b580718405b7575580adfb24e693c354d79dcc8712e99f7b6f75fe362de8f4cad25cda5de51bc397be782f717e3051ce7da386ff903bffdd240c63b422be1ca48c39e44b904debe62406711240ce64f59ebdef49e754bf8fec95d2b57543f2aaa2716a3ea3ca5356cfcf5ec6ca8b32587cd5cdeff69322cdb276d174463bf2d662e64fffdfdb25b18827829fc04a99b4eb7e164df594fc008bb5869479b4fb12eff9815e63ef037a18e31aee4d427206ef0a006eefdb4c57811e299157476323633d3d0770c77a0860a680a3fc85c1d85836d8559aa61a71e9b354796d648e79d84b23ed31e3962a76af2e9597c44902c12a24b9489c9f5ba0fe5355a8538a9ace8d439f2bb8dddfea5d10e20d53a64583ba2dfe366b88fee7e1f1150111a40986b6841edb0aa72804686c0fa9daf785ec1a7a3d30d9a1b2cd82f5179c0"));
    BigInteger tdAt365430 = BigInteger.valueOf(13_722_035);
    Block block365431 = BlockUtil.newBlockFromRlp(Hex.decode("f90791f9078d0183059377a072a9432f16606a4df7e2e450a015cd51af62d57be35243072884c6ee86062b25a0a0450c4333e72ed26552d7462c0b3669924eec816a219b3960d5b3f0b33f7444a029aed00ad3e2a5fb5a9de50ed924d7890e48ca60fb0322ea64b8a6176dbb68d2a045b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0a045b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000900000000000000000000000000000004ca041494f4e000000000000000000000000000000000000000000000000000000008083e502cb845b8e9a3ba056e2b9ee387d4618d55ef58a8fd9ab475b0568e7700e258d42dd2e4625b91f44b9058000d0ab52953023b6eae16d02bbdc6616e2d81c2b1f280692923add56f68cf84a30426d5771758661746d15b52dee16049369a83cb07a33682ee5ab6a5a18f833155f486861a585c6939a66848d51554baba6492a06ffb95e10661cf950dd04fbb46d02555b721d4836d6aaec5f4b12a983facf9461c1ed81ae3621928c28e4f1a4b1c76f256d14b21d4a81a9733ee13bea8972bee5b35f20efb52dc23a3e50083241a649075254d16973a9a35d2a579703c946d0c3680c39fb3f7c1032e9676ef1df43e2452916102d0ec28b67f979db1d52420f237d284ff671b8de1d9f0fa35ed5857e611d7e4753b9776a58f0dd3b901055ea1d5ba56714709ddb9457b6a5fb304741a2ead58b068b3c54b3679cd437daa92ef33e25cd56cc5bb6b7a62622e5050f932bef13129b3da65f46b9ebf0107969de16a600cb97a712ce76b1911ad31e54bbb85353b3c71c4989b1b96f6b80ceff597f4bd56a3f1ae5e189ba968c04f63e6378734980b924d836cb6f5acc4d4c907b9a433a5e0b9226047e096fb07c4ebba2b7a4691cb677c055440baf9d464a35a82f7b5d4f4bef1c4eb617927011e9458f5a82d7269abc5b88f345dcba47dd3a1e8e290b40184dffcff377a570313d0892b89b24e5f9f3e9f1c94c4306528b56e7610529a15ba7afc739403c351c37830550d3f3c623ec4a61fe11ed521fb2fcb1578cff1fb47e63ee5bb6fba75842b4f8badb6563c0a15ea80fbaae9a07ebc1bfa565d86fea4f2a18624fcc0fa35b717bffaa11902ff08f97fa5f332fd92aa16e79bfe4a61dfc21360eeae192cc66b48a5cc3baae242b207bfc23683aea753f0d659aee75df6869290163b2478684e956287684390ad07a3e69937d75a1e3ae0c5f57e0b55d8ff7beba771041105f6ef545b5a86dbf5b305ac18d07a5f3ab0aa60be918952281611bc694b031f180d2b8a6a6165c6bdc40074a60a56b848bb8858447e86f74bdaa423375a68d018ea3770ca6b9011c5a136a621a739747890d5f0fa81d9bef97f5a1ebb57b166941b476cfe6fa51902f3ed4111afd9e5ab2a14fb0dd031e1bd8e2e5058e6b39179f41c3b151e0b5a6f116f74a470cdf5904d980a4765d9d06f23992097109b861eb7d23e02a66a103f95cf4caaa430541530517fc857635196ee58edc68394b25acc43c130939b04d7a6c4431eef62b851107c0e3b6eeb9cbf424044e06d4034febf9b16d9b62df4aba1cc482b573ee0970e5571fca37cbaa516e599beb8d7eeda55ab8a2171afe4d16d841d041b363b130a289a4a548044fba78682d44c9ace0459f6df3f00e34a559ed3e2610fb9c56fd2ef53f0f6b5b6ddcb80d27505133a84e785f6b76cc030f3cc72a2285765de5850b7e3f37565de8879b71d3dd30714a96b5e93fa92835ea5b13c6a0d31c1751ff81eb18b4fdb1acc3b2e5e114c52370b9a9e285d559a761fa27823cd2a4e6bf19a38bbe57298de1b2fb67fe3a9982048db48d85e0a7581c91fd727cce2b9f28a548adf17a0fda48bafce838f766b74d5266f399fb2c7b05786b9320385d3fb565c5db3274366a39fb226fab2f1b3f485f237b28ad48176b747fce0e391f126ebbe40c815c30e807ce084c30f54b94a98efa3d38ade7e59ed62ebec5f1248272c4291445cffdaf8b55b75ef8e4dd8e7f79b2c311550ed588d51128b0697d302702c736ca684cba33151fd511f3acd532bea1c26d26d26288220769719dd4f00e3e03f0a0a5baa6751cb860efbb6d82af4e4fbe4c1e67648bca51aaf80d6c0e04aee377e3db7bf35f39ab0d13f3c7204ab8458f73cae825e96b0ef0a2e4b036ff9249867b1b9589390737ff975b17ea987c1b5c38b62daf142b9b4fcfad083dffe21660c681a1c9d63739a6be942754a16f6c7469c8b4e0fa666c1a2759d676ba7cd126293b894b937b53e03cd4ab36a887e34596585a710b8c44e2a3b4323f4e85bef43badb67317112e87fb7bcc35c0"));
    BigInteger tdAt365431 = BigInteger.valueOf(13_722_111);
    byte[] trieDataAt365431 = Hex.decode(hexEncodedStateData("masteryStateAt365431.txt"));
    // block to import
    Block block365432 = BlockUtil.newBlockFromRlp(Hex.decode("f90839f9078f0183059378a094c401109986a9d054ecc730a08572453b51dfd0bdf155dfb5b1188585187608a0a08fc457b39b03c30dc71bdb89a4d0409dd4fa42f6539a5c3ee4054af9b71f23a0204b0b88ce011b0d3e351d1e1fdd6337338fb47d15401353e926ceb82d87efa3a044f852c7963f3c7e08c29979feb7adf9a828d73e215d355a22bc3142afb4edcea03c266609eb7f78264301a5aa138697b44d00dcc40bdab92a44d66ddc8f29c093b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000900000000000000000000000000000004ca041494f4e0000000000000000000000000000000000000000000000000000000082520883e4c98b845b8e9a3ea04040728811e02a0994d31b50cd69eece68a7f87085b0f937429bc80ab68204bab9058000a4cd21e9234ceb5ea9c43b0553768f53d4f125ddf411edeb2ae8e86d5371bdef5d79eaf0a5374d8eebc6d304d7fcfe72506e36cf6f2624ab6d235af4f962f3d85d0a2d32199af649adaa1db5afbf9f4b338be99db26f002246d534e17293f42afddb7dacc5ffcef91daf2d05612bb8f974b599b808b8a2b0361463982813c9a06e92be22b2d11db0289180b4b0638e9d33b32e0dddb1bbf5b1916b2e91473d4f1cf9d194bd001311bd4be9cdb5db6e0234def670a20d5bb8945510e37ffc939211cd6ce9b325c02bf49034c000aaef4e6ad825d7f46775c671fae01302417551b466bc2f422520e87f71a5ea9279703d3732966a97cf8bae3a7468cc402d5ea265369b95bd6e5708b986a65ddb737970a0b13ad6220d3ee680133c3e7f0ab1ee3ffd3361123fef6d483c2164d2b6763859e8a7396b97d1c1e7092774de933b93ca614c79d5a939bdb4742031d6604c5ef7f395b19126a73f903c39a5b59df800afa84cc9644674eb048010985f31a5f8b12dedd70b29c094e90387874c25f2d2617a6ba5bdfae1617cfeaa30a199f41a8841aa29ca2e688c71e026170446700e4f50fae23b96974f2e2dcce8a56e329d761c9da9377ff00110e1eba0c6a0e3a36e79036f2f8ae6639a4d2d60d64f4083c29a69560a2bfeb583aba35217f85efaf90a0c0d64c19f0f05c878a25f6851abb77d1d58c156b76c7422444b7d1b59d0753f082b462f6e298a4bc58abd43fc023d51a2ffc199c5a563a6377e62549df4cd7fa746182f25ed0fff2e3c2f7ecc2151d20a071f388916e40a390b3a649072d502df9d54a7303950fbfa19748da882db16c81fa592c6b4ecf2554a2f461e2fc5b937916645820b20efc970639ad03d370e4b4489a09789760e313911264837f56f2c37c3fc7a5754493f3ebb57f5ae37961332986a0f22a54730fb17244003e59bea3c099b76df12616a96c6681ad7986e5c5d8660663d8de9e14bb60f5101fc71dd87d5283077f2831e54f5e832c3caac9eac34090631a6e07c293db4a3eb264f2a4f2ba6174baf1478042c2235db9516ec155a4784d52385693d37057a1122126294b2a4255bd9dd504647472b14a17528599c3a6108d89dc2da632ed73fd37c7c2f428a945b7337719d073dfc77fdc5c5b505daa664860f8fa178186d48ffe3a727d1757e129554603fafc865df6772b28cbc28b529ad62c906927d0a288ebedea78de67767f34e2893b919ee052ab27de99c699bbe62766d218f72e6f7c935b63d1630e74cf71cb6c3cf242923908f2e6f902b8c6732f39d0ecc80d791c1ae1afc9ee417b18d167dab244db5c4341c1363eceab5c8436fcb7936442f0e4c846d696c35470afb9f1bb0649d3e3dc3a8362ee9a7106712fdeff4070ea8cc4bba984bfc7ae5274799e2ae85a819d37dbd350b007e2b34b564b0398f7b62083e28f877b1d2bfe0771657c51ee27bf3f57f22b62856f3487c934ca3ba0dc005c1cc6d665c129cf1363b07aab2b3d93ef8bfff8283265ad992ab177e53ae9c5e43a2e3ae9e2a3c9bbbf5210720829ba971698f7f68db1f878ba5c371fe5dfa63ae29796bd2a4e5a6faf4ae16381b7d2f6925e5cbbfbf2705f1af97c0993b267acf122584211ad8838c24d71feb0e8ef23d652603b232b1f06de8a9f1fd28f1abf87b521116ee2d2cb506faf5915b56310ae6412cf76d3f38c019bb85cf6d23fd89a945c13930492551b699fd2fa0160ad030cf7139306a6dc73b5ed4bdfe5bf714c1e9a43313fe09005fa4ac3ff4561c4a4155b64348b44bfd35310b3651e2fd3371acb0f34311952fb1d0b50397acc4e71b86e2f0a433c4d2b9b46554cd92dde94bd2d3b5f2af0d6d0e345386dbe0ec9e8925abf9b4c91450aa1ef47811805d08329c22e639873f15ed6df121420eab8a0ded137fee3ef574c5dabc2c793b031da62e44de2f5783a4472b4e0f1ac50fcefb94d8a6680ee0356aa457bf5ce8f8a5f8a300a0a0b88269779d225510ca880ed742e445db0c70efb1ee3159b6d56479ae3501f988b469471f80140000808705750cb0dee7e882d4318800000002540be40001b860b7dfe3a9fd46fbd034687a6c2a3ddfd61896b8e7521402369383d6a52a591a5ba8b96ade2d2e3eb46bb10a8472e7925e0133ddd20c04cd5c187fb5dcbc6b79bfaeda60a2c58dffbd516dcbdfa06f9309122cbef2fc7fd199b87b9df6f939480c"));
    BigInteger expectedTdAt365432 = BigInteger.valueOf(13_722_187);
    // setup blockchain with state before imported block
    StandaloneBlockchain blockchain = new Builder().withState(block365430, tdAt365430, block365431, tdAt365431, trieDataAt365431).withAvmEnabled().build().bc;
    // import block
    Pair<ImportResult, AionBlockSummary> results = blockchain.tryToConnectAndFetchSummary(block365432);
    assertThat(results.getLeft()).isEqualTo(ImportResult.IMPORTED_BEST);
    // collect the consensus information from the block & receipt.
    AionBlockSummary blockSummary = results.getRight();
    // check the receipt
    AionTxReceipt receipt = blockSummary.getSummaries().get(0).getReceipt();
    assertThat(receipt.isSuccessful()).isTrue();
    assertThat(receipt.getEnergyUsed()).isEqualTo(21000);
    assertThat(receipt.getPostTxState()).isEqualTo(Hex.decode("bd99ffaba6e054b0feffdda93b2364ecfc4914352a73425d2878a3aeb8fba7ed"));
    byte[] stateRoot = blockSummary.getBlock().getStateRoot();
    byte[] blockReceiptsRoot = blockSummary.getBlock().getReceiptsRoot();
    byte[] receiptTrieEncoded = receipt.getReceiptTrieEncoded();
    // verify the consensus information.
    String expectedRoot = "204b0b88ce011b0d3e351d1e1fdd6337338fb47d15401353e926ceb82d87efa3";
    String expectedReceiptsRoot = "3c266609eb7f78264301a5aa138697b44d00dcc40bdab92a44d66ddc8f29c093";
    String expectedReceiptsTrie = "F90125A0BD99FFABA6E054B0FEFFDDA93B2364ECFC4914352A73425D2878A3AEB8FBA7EDB9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0";
    assertThat(stateRoot).isEqualTo(Hex.decode(expectedRoot));
    assertThat(blockReceiptsRoot).isEqualTo(Hex.decode(expectedReceiptsRoot));
    assertThat(receiptTrieEncoded).isEqualTo(Hex.decode(expectedReceiptsTrie));
    // checking repository state and total difficulty
    assertThat(blockchain.getRepository().getRoot()).isEqualTo(Hex.decode(expectedRoot));
    assertThat(blockchain.getTotalDifficulty()).isEqualTo(expectedTdAt365432);
}
Also used : ImportResult(org.aion.zero.impl.core.ImportResult) AionBlockSummary(org.aion.zero.impl.types.AionBlockSummary) Builder(org.aion.zero.impl.blockchain.StandaloneBlockchain.Builder) Block(org.aion.zero.impl.types.Block) BigInteger(java.math.BigInteger) StandaloneBlockchain(org.aion.zero.impl.blockchain.StandaloneBlockchain) AionTxReceipt(org.aion.base.AionTxReceipt) Test(org.junit.Test)

Example 49 with AionTxReceipt

use of org.aion.base.AionTxReceipt in project aion by aionnetwork.

the class BalanceTransferConsensusTest method testTransactionTypeBeforeTheFork.

@Test
@Ignore
public void testTransactionTypeBeforeTheFork() {
    // ensure that the fork was not triggered
    TransactionTypeRule.disallowAVMContractTransaction();
    BigInteger amount = BigInteger.TEN.pow(12).add(BigInteger.valueOf(293_865));
    BigInteger initialBalance = getBalance(new AionAddress(SENDER_ADDR));
    assertThat(initialBalance).isEqualTo(SENDER_BALANCE);
    assertThat(this.blockchain.getMinerCoinbase().toByteArray()).isEqualTo(MINER);
    // get contract address from precompiled factory
    AionAddress to = AddressUtils.wrapAddress("a0123456a89a6ffbfdc45782771fba3f5e9da36baa69444f8f95e325430463e7");
    // Make balance transfer transaction to precompiled contract.
    ECKey key = org.aion.crypto.ECKeyFac.inst().fromPrivate(SENDER_KEY);
    AionTransaction transaction = AionTransaction.create(key, BigInteger.ZERO.toByteArray(), to, amount.toByteArray(), new byte[0], 2_000_000, ENERGY_PRICE, // legal type before the fork
    (byte) 11, null);
    // check that the transaction is valid
    assertThat(TransactionTypeValidator.isValid(transaction)).isTrue();
    // Process the transaction.
    Block parentBlock = this.blockchain.getRepository().getBestBlock();
    MiningBlock block = this.blockchain.createNewMiningBlock(parentBlock, Collections.singletonList(transaction), true);
    Pair<ImportResult, AionBlockSummary> results = this.blockchain.tryToConnectAndFetchSummary(block);
    assertThat(results.getLeft()).isEqualTo(ImportResult.IMPORTED_BEST);
    // ensure transaction and block were valid
    AionBlockSummary blockSummary = results.getRight();
    AionTxReceipt receipt = blockSummary.getSummaries().get(0).getReceipt();
    assertThat(receipt.isSuccessful()).isTrue();
    assertThat(receipt.getEnergyUsed()).isEqualTo(21000);
}
Also used : AionAddress(org.aion.types.AionAddress) ImportResult(org.aion.zero.impl.core.ImportResult) AionBlockSummary(org.aion.zero.impl.types.AionBlockSummary) BigInteger(java.math.BigInteger) MiningBlock(org.aion.zero.impl.types.MiningBlock) Block(org.aion.zero.impl.types.Block) ECKey(org.aion.crypto.ECKey) AionTransaction(org.aion.base.AionTransaction) AionTxReceipt(org.aion.base.AionTxReceipt) MiningBlock(org.aion.zero.impl.types.MiningBlock) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 50 with AionTxReceipt

use of org.aion.base.AionTxReceipt in project aion by aionnetwork.

the class FvmBalanceTransferConsensusTest method testTransferToPrecompiledContract.

@Test
public void testTransferToPrecompiledContract() {
    BigInteger amount = BigInteger.TEN.pow(12).add(BigInteger.valueOf(293_865));
    BigInteger initialBalance = getBalance(new AionAddress(SENDER_ADDR));
    assertThat(initialBalance).isEqualTo(SENDER_BALANCE);
    assertThat(this.blockchain.getMinerCoinbase().toByteArray()).isEqualTo(MINER);
    // ensure bridge is viewed as precompiled contract
    AionAddress bridge = AddressUtils.wrapAddress("0000000000000000000000000000000000000000000000000000000000000200");
    assertThat(ContractInfo.isPrecompiledContract(bridge)).isTrue();
    // Make balance transfer transaction to precompiled contract.
    ECKey key = org.aion.crypto.ECKeyFac.inst().fromPrivate(SENDER_KEY);
    AionTransaction transaction = AionTransaction.create(key, BigInteger.ZERO.toByteArray(), bridge, amount.toByteArray(), new byte[] {}, 2_000_000, ENERGY_PRICE, TransactionTypes.DEFAULT, null);
    // Process the transaction.
    Pair<ImportResult, AionBlockSummary> results = processTransaction(transaction, 1);
    // Collect the consensus information from the block & receipt.
    AionBlockSummary blockSummary = results.getRight();
    AionTxReceipt receipt = blockSummary.getSummaries().get(0).getReceipt();
    assertThat(receipt.isSuccessful()).isTrue();
    assertThat(receipt.getEnergyUsed()).isEqualTo(21000);
    byte[] stateRoot = blockSummary.getBlock().getStateRoot();
    byte[] blockReceiptsRoot = blockSummary.getBlock().getReceiptsRoot();
    byte[] receiptTrieEncoded = receipt.getReceiptTrieEncoded();
    // Verify the consensus information.
    String expectedRoot = "419F9A4C02612094A9B9A2EAC5CC6DF761214882C35267328297D09246206A9A";
    String expectedReceiptsRoot = "9A73184E9A5514164D980452E2283892D0487B6833D3F9F782C8686BFDA1B809";
    String expectedReceiptsTrie = "f90125a034b98e6a317bd93f39959d41cccafec864329cadfb0d8d7bfc5d30df5612e401b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0";
    assertThat(stateRoot).isEqualTo(Hex.decode(expectedRoot));
    assertThat(blockReceiptsRoot).isEqualTo(Hex.decode(expectedReceiptsRoot));
    assertThat(receiptTrieEncoded).isEqualTo(Hex.decode(expectedReceiptsTrie));
    // Verify that the sender has the expected balance.
    BigInteger expectedBalance = new BigInteger("999999999786407407137135");
    assertThat(getBalance(new AionAddress(SENDER_ADDR))).isEqualTo(expectedBalance);
    // Verify that the contract has the expected balance.
    BigInteger contractBalance = getBalance(bridge);
    assertThat(contractBalance).isEqualTo(amount);
    // Verify that the miner has the expected balance.
    BigInteger expectedMinerBalance = new BigInteger("749210123854045163");
    assertThat(getBalance(new AionAddress(MINER))).isEqualTo(expectedMinerBalance);
}
Also used : AionAddress(org.aion.types.AionAddress) ImportResult(org.aion.zero.impl.core.ImportResult) AionBlockSummary(org.aion.zero.impl.types.AionBlockSummary) BigInteger(java.math.BigInteger) ECKey(org.aion.crypto.ECKey) AionTransaction(org.aion.base.AionTransaction) AionTxReceipt(org.aion.base.AionTxReceipt) Test(org.junit.Test)

Aggregations

AionTxReceipt (org.aion.base.AionTxReceipt)111 Test (org.junit.Test)76 AionTransaction (org.aion.base.AionTransaction)74 AionBlockSummary (org.aion.zero.impl.types.AionBlockSummary)61 AionAddress (org.aion.types.AionAddress)56 BigInteger (java.math.BigInteger)53 ImportResult (org.aion.zero.impl.core.ImportResult)50 MiningBlock (org.aion.zero.impl.types.MiningBlock)43 ArrayList (java.util.ArrayList)24 Block (org.aion.zero.impl.types.Block)24 AionTxExecSummary (org.aion.base.AionTxExecSummary)17 RepositoryCache (org.aion.base.db.RepositoryCache)17 StandaloneBlockchain (org.aion.zero.impl.blockchain.StandaloneBlockchain)15 Builder (org.aion.zero.impl.blockchain.StandaloneBlockchain.Builder)14 ECKey (org.aion.crypto.ECKey)12 SolidityType (org.aion.solidity.SolidityType)10 AccountState (org.aion.base.AccountState)9 Log (org.aion.types.Log)9 AionTxInfo (org.aion.zero.impl.types.AionTxInfo)7 StakingBlock (org.aion.zero.impl.types.StakingBlock)7