content: package org.aion.zero.impl.consensus;
  
  import static org.junit.Assert.assertArrayEquals;
  import static org.junit.Assert.assertEquals;
  
  import java.math.BigInteger;
  import java.util.ArrayList;
  import java.util.Collections;
  import java.util.List;
  import org.aion.base.AionTransaction;
  import org.aion.base.TransactionTypes;
  import org.aion.base.TxUtil;
  import org.aion.crypto.ECKey;
  import org.aion.crypto.ECKeyFac;
  import org.aion.zero.impl.types.Block;
  import org.aion.zero.impl.core.ImportResult;
  import org.aion.types.AionAddress;
  import org.aion.util.bytes.ByteUtil;
  import org.aion.util.conversions.Hex;
  import org.aion.util.types.AddressUtils;
  import org.aion.zero.impl.blockchain.StandaloneBlockchain;
  import org.aion.zero.impl.blockchain.StandaloneBlockchain.Builder;
  import org.aion.zero.impl.blockchain.StandaloneBlockchain.Bundle;
  import org.aion.zero.impl.types.MiningBlock;
  import org.aion.zero.impl.types.AionBlockSummary;
  import org.aion.base.AionTxReceipt;
  import org.aion.zero.impl.vm.AvmTestConfig;
  import org.apache.commons.lang3.tuple.Pair;
  import org.junit.AfterClass;
  import org.junit.BeforeClass;
  import org.junit.Ignore;
  import org.junit.Test;
  
  /**
   * This test is done against the contract: Wallet.sol
   *
   * <p>A very brief test on the fundamental aspects of consensus (root state, receipt hash, block
   * hash) to help us ensure that we are not doing something completely wrong.
   *
   * <p>The second block sends off 8 transactions in it. The following scenarios are covered: -
   * Rejected transaction (invalid nonce) - Failed transaction (out of energy) - Value transfer only -
   * Successes on different calls
   *
   * <p>If you believe you are modifying consensus-related aspects of the code that are more nuanced
   * then add the transactions that will exploit this and ideally add that transaction to the second
   * block of transactions.
   */
  
  /**
   * Ignore the test because the minimum energy price requirement changes the tx receipt and state.
   */
  @Ignore
  public class ConsensusTest {
      private static final AionAddress CONTRACT =
              AddressUtils.wrapAddress(
                      "a04272bb5f935fb170baf2998cb25dd15cc5794e7c5bac7241bec00c4971c7f8");
      private static final AionAddress OWNER =
              AddressUtils.wrapAddress(
                      "a05577af5a82aa86bb2f4247e3f809bd0d396d45ec3c4602d5824962d21b1679");
      private static final AionAddress OTHER =
              AddressUtils.wrapAddress(
                      "a05577af5a82aa86bb2f4247e3f809bd0d396d45ec3c4602d5824962d21b1678");
      private static final byte[] PRIVATE_KEY =
              Hex.decode(
                      "81e071e5bf2c155f641641d88b5956af52c768fbb90968979b20858d65d71f32aa935b67ac46480caaefcdd56dd31862e578694a99083e9fad88cb6df89fc7cb");
  
      private static final byte[] BLOCK_RECEIPT_ROOT1 =
              Hex.decode("811c0defa7f25e482bc7b096498fad1373d604c8689d8503e560ad5b7046823e");
      private static final byte[] RECEIPT_TRIE_ENCODING =
              Hex.decode(
                      "f90125a075645575ff4c30af1ad33d84b506a2ba0d751524086699b51e269910021aad02b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0");
      private static final byte[] RECEIPT_POST_TX_STATE =
              Hex.decode("75645575ff4c30af1ad33d84b506a2ba0d751524086699b51e269910021aad02");
      private static final byte[] STATE_ROOT1 =
              Hex.decode("394dc20b0f03a789b8944a48df0c6f51e2071d3b39d5bbc6f2e38319eb17e087");
      private static final byte[] BLOCK_RECEIPT_ROOT2 =
              Hex.decode("cb2744588cf0323bc28c17b77359b9455de1319244efa3b4dcc2d97cb777d263");
      private static final byte[] RECEIPT_TRIE_ENCODING1 =
              Hex.decode(
                      "f90213a0d403b892a9520ff492ced9bba4555f11d38140d5b1a22f84fd429f0c36d8e369b9010000000000000000000000000200000000000000008000100000000000000000000000000000000100000000000002000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f8edf885a0a04272bb5f935fb170baf2998cb25dd15cc5794e7c5bac7241bec00c4971c7f8e1a0e1c52dc63b719ade82e8bea94cc41a0d5d28e4aaf536adb5e9cccc9ff8c1aedab840a00a4175a89a6ffbfdc45782771fba3f5e9da36baa69444f8f95e325430463e751dc0db0c86b587373675ff30b803686ba7d7e1e94f25bd8a465dcb26ebc187ef864a0a04272bb5f935fb170baf2998cb25dd15cc5794e7c5bac7241bec00c4971c7f8e1a0994a936646fe87ffe4f1e469d3d6aa417d6b855598397f323de5b449f765f0c3a0a05577af5a82aa86bb2f4247e3f809bd0d396d45ec3c4602d5824962d21b1679");
      private static final byte[] RECEIPT_POST_TX_STATE1 =
              Hex.decode("d403b892a9520ff492ced9bba4555f11d38140d5b1a22f84fd429f0c36d8e369");
      private static final byte[] RECEIPT_TRIE_ENCODING2 =
              Hex.decode(
                      "f90125a0e093bb9a642ce89028d6ff91ef8327239af749cddace57b287916df8bb308135b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0");
      private static final byte[] RECEIPT_POST_TX_STATE2 =
              Hex.decode("e093bb9a642ce89028d6ff91ef8327239af749cddace57b287916df8bb308135");
      private static final byte[] RECEIPT_TRIE_ENCODING3 =
              Hex.decode(
                      "f90125a0553599812286be6365029319ea76e9c1cdfa3fdd7f8b9c735e12783e27a70815b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0");
      private static final byte[] RECEIPT_POST_TX_STATE3 =
              Hex.decode("553599812286be6365029319ea76e9c1cdfa3fdd7f8b9c735e12783e27a70815");
      private static final byte[] RECEIPT_TRIE_ENCODING4 =
              Hex.decode(
                      "f90125a0a52d8a089e7f5faa24dbd33ac1ccd9e80a0f8297860a78feccc888c3cb8e986fb9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0");
      private static final byte[] RECEIPT_POST_TX_STATE4 =
              Hex.decode("a52d8a089e7f5faa24dbd33ac1ccd9e80a0f8297860a78feccc888c3cb8e986f");
      private static final byte[] RECEIPT_TRIE_ENCODING5 =
              Hex.decode(
                      "f90125a0dde8e21bf1eaf0eee90240c4e3956d622eb078adf36446783b62396442e8c2b6b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0");
      private static final byte[] RECEIPT_POST_TX_STATE5 =
              Hex.decode("dde8e21bf1eaf0eee90240c4e3956d622eb078adf36446783b62396442e8c2b6");
      private static final byte[] RECEIPT_TRIE_ENCODING6 =
              Hex.decode(
                      "f90125a08abad33084afe31178a3a3939fda03cb949c9cc8cd1e667e3d24dfbf0f742a49b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0");
      private static final byte[] RECEIPT_POST_TX_STATE6 =
              Hex.decode("8abad33084afe31178a3a3939fda03cb949c9cc8cd1e667e3d24dfbf0f742a49");
      private static final byte[] RECEIPT_TRIE_ENCODING7 =
              Hex.decode(
                      "f90125a0c651d620c3a0a08a1fb24632c0fb2f1427451bb43653a87ad371ede994491161b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0");
      private static final byte[] RECEIPT_POST_TX_STATE7 =
              Hex.decode("c651d620c3a0a08a1fb24632c0fb2f1427451bb43653a87ad371ede994491161");
      private static final byte[] STATE_ROOT2 =
              Hex.decode("8657f3b3167a69a76f9a56006a653fcfd2b1118355f86bab7ad7bdacb8b73739");
  
      private static final String RECEIPT =
              "TransactionReceipt[\n"
                      + "  , postTxState=75645575ff4c30af1ad33d84b506a2ba0d751524086699b51e269910021aad02\n"
                      + "  , error=\n"
                      + "  , executionResult=60506040523615610096576000356c01000000000000000000000000900463ffffffff168063173825d91461009c5780632f54bf6e146100c857806335397dc01461010c5780634123cb6b1461014b5780637065cb4814610175578063746c9171146101a1578063b75c7dc6146101cb578063c2cf7326146101fd578063f00d4b5d14610258578063f1f06fb61461029557610096565b60006000fd5b34156100a85760006000fd5b6100c6600480808060100135903590916020019091929050506102b9565b005b34156100d45760006000fd5b6100f260048080806010013590359091602001909192905050610400565b604051808215151515815260100191505060405180910390f35b34156101185760006000fd5b61012e6004808035906010019091905050610435565b604051808383825281601001526020019250505060405180910390f35b34156101575760006000fd5b61015f61046e565b6040518082815260100191505060405180910390f35b34156101815760006000fd5b61019f60048080806010013590359091602001909192905050610477565b005b34156101ad5760006000fd5b6101b56105c9565b6040518082815260100191505060405180910390f35b34156101d75760006000fd5b6101fb600480808060100135903590600019169090916020019091929050506105d2565b005b34156102095760006000fd5b61023e6004808080601001359035906000191690909160200190919290808060100135903590916020019091929050506106e3565b604051808215151515815260100191505060405180910390f35b34156102645760006000fd5b610293600480808060100135903590916020019091929080806010013590359091602001909192905050610778565b005b34156102a15760006000fd5b6102b760048080359060100190919050506108ea565b005b60006000366040518083838082843782019150509250505060405180910390206102e9828261098e63ffffffff16565b15156102f55760006000fd5b610202600050600086868252816010015260200190815260100160002090506000505492506000831415610328576103f8565b6001600160005054036000600050541115610342576103f8565b600060006002600050856101008110151561035957fe5b90906002020160005b508282909180600101839055555050506000610202600050600087878252816010015260200190815260100160002090506000508190909055506103aa610c1963ffffffff16565b6103b8610d1a63ffffffff16565b7f58619076adf5bb0943d100ef88d52d7c3fd691b19d3a9071b555b651fbf418da8686604051808383825281601001526020019250505060405180910390a15b5b5050505050565b60006000610202600050600085858252816010015260200190815260100160002090506000505411905061042f565b92915050565b600060006002600050600184016101008110151561044f57fe5b90906002020160005b508060010154905491509150610469565b915091565b60016000505481565b6000366040518083838082843782019150509250505060405180910390206104a5828261098e63ffffffff16565b15156104b15760006000fd5b6104c1848461040063ffffffff16565b156104cb576105c2565b6104d9610c1963ffffffff16565b60fa6001600050541015156104f7576104f6610d1a63ffffffff16565b5b60fa60016000505410151561050b576105c2565b60016000818150548092919060010191905090905550838360026000506001600050546101008110151561053b57fe5b90906002020160005b50828290918060010183905555505050600160005054610202600050600086868252816010015260200190815260100160002090506000508190909055507f994a936646fe87ffe4f1e469d3d6aa417d6b855598397f323de5b449f765f0c38585604051808383825281601001526020019250505060405180910390a15b5b50505050565b60006000505481565b600060006000610202600050600033825281601001526020019081526010016000209050600050549250600083141561060a576106dc565b8260020a915061020360005060008686906000191690906000191690825281601001526020019081526010016000209050600050905060008282600101600050541611156106db57806000016000818150548092919060010191905090905550818160010160008282825054039250508190909055507fc7fb647e59b18047309aa15aad418e5d7ca96d173ad704f1031a2c3d7591734b3388886040518085858252816010015260200183839060001916909060001916908252816010015260200194505050505060405180910390a15b5b5050505050565b6000600060006000610203600050600089899060001916909060001916908252816010015260200190815260100160002090506000509250610202600050600087878252816010015260200190815260100160002090506000505491506000821415610752576000935061076d565b8160020a90506000818460010160005054161415935061076d565b505050949350505050565b60006000366040518083838082843782019150509250505060405180910390206107a8828261098e63ffffffff16565b15156107b45760006000fd5b6107c4858561040063ffffffff16565b156107ce576108e0565b610202600050600088888252816010015260200190815260100160002090506000505492506000831415610801576108e0565b61080f610c1963ffffffff16565b84846002600050856101008110151561082457fe5b90906002020160005b5082829091806001018390555550505060006102026000506000898982528160100152602001908152601001600020905060005081909090555082610202600050600087878252816010015260200190815260100160002090506000508190909055507fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c888888886040518085858252816010015260200183838252816010015260200194505050505060405180910390a15b5b50505050505050565b600036604051808383808284378201915050925050506040518091039020610918828261098e63ffffffff16565b15156109245760006000fd5b60016000505483111561093657610988565b826000600050819090905550610950610c1963ffffffff16565b7fd9a37dd2a911cc717a3127f430cde03b03bcf2694f289138cff455a5430ea9fd846040518082815260100191505060405180910390a15b5b505050565b600060006000600061020260005060003382528160100152602001908152601001600020905060005054925060008314156109c857610c10565b610203600050600087879060001916909060001916908252816010015260200190815260100160002090506000509150600082600001600050541415610a97576000600050548260000160005081909090555060008260010160005081909090555061020460005080548091906001019090610a449190610f48565b8260020160005081909090555085856102046000508460020160005054815481101515610a6d57fe5b9060005260106000209050906002020160005b508282906000191690909180600101839055555050505b8260020a90506000818360010160005054161415610c0f577fe1c52dc63b719ade82e8bea94cc41a0d5d28e4aaf536adb5e9cccc9ff8c1aeda3389896040518085858252816010015260200183839060001916909060001916908252816010015260200194505050505060405180910390a160018260000160005054111515610bde576102046000506102036000506000888890600019169090600019169082528160100152602001908152601001600020905060005060020160005054815481101515610b6157fe5b9060005260106000209050906002020160005b50806000905560010160009055610203600050600087879060001916909060001916908252816010015260200190815260100160002090506000600082016000506000905560018201600050600090556002820160005060009055505060019350610c1056610c0e565b81600001600081815054809291906001900391905090905550808260010160008282825054179250508190909055505b5b5b50505092915050565b60006000610204600050805490509150600090505b81811015610d06576000600061020460005083815481101515610c4d57fe5b9060005260106000209050906002020160005b5080600101549054906000191690909114919014161515610cf857610203600050600061020460005083815481101515610c9657fe5b9060005260106000209050906002020160005b5080600101549054906000191690906000191690825281601001526020019081526010016000209050600060008201600050600090556001820160005060009055600282016000506000905550505b5b8060010190508050610c2e565b6102046000610d159190610f7c565b5b5050565b6000600190505b600160005054811015610f44575b60016000505481108015610d6f57506000600060026000508361010081101515610d5557fe5b90906002020160005b508060010154905490911491901416155b15610d81578080600101915050610d2f565b5b6001600160005054118015610dc7575060006000600260005060016000505461010081101515610dae57fe5b90906002020160005b5080600101549054909114919014165b15610de8576001600081815054809291906001900391905090905550610d82565b60016000505481108015610e2d575060006000600260005060016000505461010081101515610e1357fe5b90906002020160005b508060010154905490911491901416155b8015610e6457506000600060026000508361010081101515610e4b57fe5b90906002020160005b5080600101549054909114919014165b15610f3f57600260005060016000505461010081101515610e8157fe5b90906002020160005b508060010154905460026000508361010081101515610ea557fe5b90906002020160005b5082829091806001018390555550505080610202600050600060026000508461010081101515610eda57fe5b90906002020160005b508060010154905482528160100152602001908152601001600020905060005081909090555060006000600260005060016000505461010081101515610f2557fe5b90906002020160005b508282909180600101839055555050505b610d21565b5b50565b815481835581811511610f77576002028160020283600052601060002090509182019101610f769190610fa3565b5b505050565b50805460008255600202906000526010600020905090810190610f9f9190610fa3565b5b50565b610fd39190610fad565b80821115610fcf57600081815080600090556001016000905550600201610fad565b5090565b905600a165627a7a723058200f78dff72db2669ce2b6766c46e53928ecb1c03dd142c7e8acaefe1145e080420029\n"
                      + "  , bloom=00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n"
                      + "  , logs=[]\n"
                      + "  , nrgUsed=574772]";
      private static final String RECEIPT1 =
              "TransactionReceipt[\n"
                      + "  , postTxState=d403b892a9520ff492ced9bba4555f11d38140d5b1a22f84fd429f0c36d8e369\n"
                      + "  , error=\n"
                      + "  , executionResult=\n"
                      + "  , bloom=00000000000000000000000200000000000000008000100000000000000000000000000000000100000000000002000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n"
                      + "  , logs=[Log { address = a04272bb5f935fb170baf2998cb25dd15cc5794e7c5bac7241bec00c4971c7f8, data = a00a4175a89a6ffbfdc45782771fba3f5e9da36baa69444f8f95e325430463e751dc0db0c86b587373675ff30b803686ba7d7e1e94f25bd8a465dcb26ebc187e, topics = [ e1c52dc63b719ade82e8bea94cc41a0d5d28e4aaf536adb5e9cccc9ff8c1aeda ]}, Log { address = a04272bb5f935fb170baf2998cb25dd15cc5794e7c5bac7241bec00c4971c7f8, data = a05577af5a82aa86bb2f4247e3f809bd0d396d45ec3c4602d5824962d21b1679, topics = [ 994a936646fe87ffe4f1e469d3d6aa417d6b855598397f323de5b449f765f0c3 ]}]\n"
                      + "  , nrgUsed=266641]";
      private static final String RECEIPT2 =
              "TransactionReceipt[\n"
                      + "  , postTxState=e093bb9a642ce89028d6ff91ef8327239af749cddace57b287916df8bb308135\n"
                      + "  , error=\n"
                      + "  , executionResult=00000000000000000000000000000001\n"
                      + "  , bloom=00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n"
                      + "  , logs=[]\n"
                      + "  , nrgUsed=24461]";
      private static final String RECEIPT3 =
              "TransactionReceipt[\n"
                      + "  , postTxState=553599812286be6365029319ea76e9c1cdfa3fdd7f8b9c735e12783e27a70815\n"
                      + "  , error=\n"
                      + "  , executionResult=00000000000000000000000000000000\n"
                      + "  , bloom=00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n"
                      + "  , logs=[]\n"
                      + "  , nrgUsed=24461]";
      private static final String RECEIPT4 =
              "TransactionReceipt[\n"
                      + "  , postTxState=a52d8a089e7f5faa24dbd33ac1ccd9e80a0f8297860a78feccc888c3cb8e986f\n"
                      + "  , error=OUT_OF_NRG\n"
                      + "  , executionResult=\n"
                      + "  , bloom=00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n"
                      + "  , logs=[]\n"
                      + "  , nrgUsed=24460]";
      private static final String RECEIPT5 =
              "TransactionReceipt[\n"
                      + "  , postTxState=dde8e21bf1eaf0eee90240c4e3956d622eb078adf36446783b62396442e8c2b6\n"
                      + "  , error=\n"
                      + "  , executionResult=00000000000000000000000000000002\n"
                      + "  , bloom=00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n"
                      + "  , logs=[]\n"
                      + "  , nrgUsed=22326]";
      private static final String RECEIPT6 =
              "TransactionReceipt[\n"
                      + "  , postTxState=8abad33084afe31178a3a3939fda03cb949c9cc8cd1e667e3d24dfbf0f742a49\n"
                      + "  , error=\n"
                      + "  , executionResult=00000000000000000000000000000001\n"
                      + "  , bloom=00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n"
                      + "  , logs=[]\n"
                      + "  , nrgUsed=24461]";
      private static final String RECEIPT7 =
              "TransactionReceipt[\n"
                      + "  , postTxState=c651d620c3a0a08a1fb24632c0fb2f1427451bb43653a87ad371ede994491161\n"
                      + "  , error=\n"
                      + "  , executionResult=\n"
                      + "  , bloom=00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n"
                      + "  , logs=[]\n"
                      + "  , nrgUsed=21000]";
      private static long energyPrice = 10_000_000_000L;
  
      @BeforeClass
      public static void setup() {
          AvmTestConfig.supportOnlyAvmVersion1();
      }
  
      @AfterClass
      public static void tearDown() {
          AvmTestConfig.clearConfigurations();
      }
  
      @Test
      public void testConsensus() {
          Bundle bundle =
                  new Builder()
                          .withDefaultAccounts(
                                  Collections.singletonList(ECKeyFac.inst().fromPrivate(PRIVATE_KEY)))
                          .withValidatorConfiguration("simple")
                          .build();
          StandaloneBlockchain blockchain = bundle.bc;
  
          AionTransaction deployTransaction = getDeployTransaction();
          assertEquals(CONTRACT, TxUtil.calculateContractAddress(deployTransaction));
  
          // Place the transaction in a block alone.
          Block parentBlock = blockchain.getRepository().getBestBlock();
          List<AionTransaction> transactions = Collections.singletonList(deployTransaction);
  
          // Run the transaction.
          MiningBlock block = blockchain.createNewMiningBlock(parentBlock, transactions, false);
          Pair<ImportResult, AionBlockSummary> results =
                  blockchain.tryToConnectAndFetchSummary(block);
          assertEquals(ImportResult.IMPORTED_BEST, results.getLeft());
          assertEquals(1, results.getRight().getSummaries().size());
  
          // Extract the results.
          AionBlockSummary blockSummary = results.getRight();
          AionTxReceipt receipt = blockSummary.getSummaries().get(0).getReceipt();
  
          byte[] stateRoot = blockSummary.getBlock().getStateRoot();
          byte[] blockReceiptsRoot = blockSummary.getBlock().getReceiptsRoot();
          byte[] receiptPostTransactionState = receipt.getPostTxState();
          byte[] receiptTrieEncoded = receipt.getReceiptTrieEncoded();
  
          parentBlock = blockchain.getRepository().getBestBlock();
  
          // Place the transactions all in a block.
          transactions = new ArrayList<>();
          transactions.add(getTransactionThatCallsAddOwner()); // success
          transactions.add(getTransactionThatCallsIsOwner(OWNER, 2)); // success
          transactions.add(getTransactionThatCallsIsOwner(OTHER, 3)); // success
          transactions.add(getTransactionThatCallsIsOwner(OWNER, 3)); // rejected: invalid nonce
          transactions.add(
                  getTransactionThatCallsIsOwnerAndRunOutOfEnergy()); // failed: out of energy
          transactions.add(getTransactionThatCallsNumOwners());
          transactions.add(getTransactionThatCallsIsOwner(OWNER, 6)); // success
          transactions.add(
                  getTransactionThatOnlyTransfersValue(BigInteger.valueOf(1_000_000_000))); // success
  
          // Runs the block of transactions.
          block = blockchain.createNewMiningBlock(parentBlock, transactions, false);
          results = blockchain.tryToConnectAndFetchSummary(block);
          assertEquals(ImportResult.IMPORTED_BEST, results.getLeft());
          assertEquals(7, results.getRight().getSummaries().size());
  
          // Extract results.
          blockSummary = results.getRight();
          AionTxReceipt receipt1 = blockSummary.getSummaries().get(0).getReceipt();
          AionTxReceipt receipt2 = blockSummary.getSummaries().get(1).getReceipt();
          AionTxReceipt receipt3 = blockSummary.getSummaries().get(2).getReceipt();
          AionTxReceipt receipt4 = blockSummary.getSummaries().get(3).getReceipt();
          AionTxReceipt receipt5 = blockSummary.getSummaries().get(4).getReceipt();
          AionTxReceipt receipt6 = blockSummary.getSummaries().get(5).getReceipt();
          AionTxReceipt receipt7 = blockSummary.getSummaries().get(6).getReceipt();
          byte[] stateRoot2 = blockSummary.getBlock().getStateRoot();
          byte[] blockReceiptsRoot2 = blockSummary.getBlock().getReceiptsRoot();
          byte[] receiptPostTransactionState1 = receipt1.getPostTxState();
          byte[] receiptPostTransactionState2 = receipt2.getPostTxState();
          byte[] receiptPostTransactionState3 = receipt3.getPostTxState();
          byte[] receiptPostTransactionState4 = receipt4.getPostTxState();
          byte[] receiptPostTransactionState5 = receipt5.getPostTxState();
          byte[] receiptPostTransactionState6 = receipt6.getPostTxState();
          byte[] receiptPostTransactionState7 = receipt7.getPostTxState();
          byte[] receiptTrieEncoded1 = receipt1.getReceiptTrieEncoded();
          byte[] receiptTrieEncoded2 = receipt2.getReceiptTrieEncoded();
          byte[] receiptTrieEncoded3 = receipt3.getReceiptTrieEncoded();
          byte[] receiptTrieEncoded4 = receipt4.getReceiptTrieEncoded();
          byte[] receiptTrieEncoded5 = receipt5.getReceiptTrieEncoded();
          byte[] receiptTrieEncoded6 = receipt6.getReceiptTrieEncoded();
          byte[] receiptTrieEncoded7 = receipt7.getReceiptTrieEncoded();
  
          System.out.println("Transaction: " + receipt.getTransaction());
          System.out.println();
          System.out.println("BLOCK RECEIPT ROOT: " + Hex.toHexString(blockReceiptsRoot));
          System.out.println("RECEIPT TRIE ENCODING: " + Hex.toHexString(receiptTrieEncoded));
          System.out.println(
                  "RECEIPT POST-TRANSACTION STATE: " + Hex.toHexString(receiptPostTransactionState));
          System.out.println("Receipt: " + receipt);
          System.out.println();
          System.out.println("STATE ROOT: " + Hex.toHexString(stateRoot));
          System.out.println(
                  "----------------------------------------------------------------------");
          System.out.println("Transaction (CALL #1): " + receipt1.getTransaction());
          System.out.println("Transaction (CALL #2): " + receipt2.getTransaction());
          System.out.println();
          System.out.println("BLOCK RECEIPT ROOT: " + Hex.toHexString(blockReceiptsRoot2));
          System.out.println(
                  "RECEIPT TRIE ENCODING (CALL #1): " + Hex.toHexString(receiptTrieEncoded1));
          System.out.println(
                  "RECEIPT POST-TRANSACTION STATE (CALL #1): "
                          + Hex.toHexString(receiptPostTransactionState1));
          System.out.println("Receipt (CALL #1): " + receipt1);
          System.out.println();
          System.out.println(
                  "RECEIPT TRIE ENCODING (CALL #2): " + Hex.toHexString(receiptTrieEncoded2));
          System.out.println(
                  "RECEIPT POST-TRANSACTION STATE (CALL #2): "
                          + Hex.toHexString(receiptPostTransactionState2));
          System.out.println("Receipt (CALL #2): " + receipt2);
          System.out.println();
          System.out.println(
                  "RECEIPT TRIE ENCODING (CALL #3): " + Hex.toHexString(receiptTrieEncoded3));
          System.out.println(
                  "RECEIPT POST-TRANSACTION STATE (CALL #3): "
                          + Hex.toHexString(receiptPostTransactionState3));
          System.out.println("Receipt (CALL #3): " + receipt3);
          System.out.println();
          System.out.println(
                  "RECEIPT TRIE ENCODING (CALL #4): " + Hex.toHexString(receiptTrieEncoded4));
          System.out.println(
                  "RECEIPT POST-TRANSACTION STATE (CALL #4): "
                          + Hex.toHexString(receiptPostTransactionState4));
          System.out.println("Receipt (CALL #4): " + receipt4);
          System.out.println();
          System.out.println(
                  "RECEIPT TRIE ENCODING (CALL #5): " + Hex.toHexString(receiptTrieEncoded5));
          System.out.println(
                  "RECEIPT POST-TRANSACTION STATE (CALL #5): "
                          + Hex.toHexString(receiptPostTransactionState5));
          System.out.println("Receipt (CALL #5): " + receipt5);
          System.out.println();
          System.out.println(
                  "RECEIPT TRIE ENCODING (CALL #6): " + Hex.toHexString(receiptTrieEncoded6));
          System.out.println(
                  "RECEIPT POST-TRANSACTION STATE (CALL #6): "
                          + Hex.toHexString(receiptPostTransactionState6));
          System.out.println("Receipt (CALL #6): " + receipt6);
          System.out.println();
          System.out.println(
                  "RECEIPT TRIE ENCODING (CALL #7): " + Hex.toHexString(receiptTrieEncoded7));
          System.out.println(
                  "RECEIPT POST-TRANSACTION STATE (CALL #7): "
                          + Hex.toHexString(receiptPostTransactionState7));
          System.out.println("Receipt (CALL #7): " + receipt7);
          System.out.println();
          System.out.println("STATE ROOT: " + Hex.toHexString(stateRoot2));
  
          // Check first block.
          assertEquals(RECEIPT, receipt.toString());
          assertArrayEquals(RECEIPT_TRIE_ENCODING, receiptTrieEncoded);
          assertArrayEquals(RECEIPT_POST_TX_STATE, receiptPostTransactionState);
          assertArrayEquals(BLOCK_RECEIPT_ROOT1, blockReceiptsRoot);
          assertArrayEquals(STATE_ROOT1, stateRoot);
  
          // Check second block.
          assertEquals(RECEIPT1, receipt1.toString());
          assertEquals(RECEIPT2, receipt2.toString());
          assertEquals(RECEIPT3, receipt3.toString());
          assertEquals(RECEIPT4, receipt4.toString());
          assertEquals(RECEIPT5, receipt5.toString());
          assertEquals(RECEIPT6, receipt6.toString());
          assertEquals(RECEIPT7, receipt7.toString());
          assertArrayEquals(RECEIPT_TRIE_ENCODING1, receiptTrieEncoded1);
          assertArrayEquals(RECEIPT_POST_TX_STATE1, receiptPostTransactionState1);
          assertArrayEquals(RECEIPT_TRIE_ENCODING2, receiptTrieEncoded2);
          assertArrayEquals(RECEIPT_POST_TX_STATE2, receiptPostTransactionState2);
          assertArrayEquals(RECEIPT_TRIE_ENCODING3, receiptTrieEncoded3);
          assertArrayEquals(RECEIPT_POST_TX_STATE3, receiptPostTransactionState3);
          assertArrayEquals(RECEIPT_TRIE_ENCODING4, receiptTrieEncoded4);
          assertArrayEquals(RECEIPT_POST_TX_STATE4, receiptPostTransactionState4);
          assertArrayEquals(RECEIPT_TRIE_ENCODING5, receiptTrieEncoded5);
          assertArrayEquals(RECEIPT_POST_TX_STATE5, receiptPostTransactionState5);
          assertArrayEquals(RECEIPT_TRIE_ENCODING6, receiptTrieEncoded6);
          assertArrayEquals(RECEIPT_POST_TX_STATE6, receiptPostTransactionState6);
          assertArrayEquals(RECEIPT_TRIE_ENCODING7, receiptTrieEncoded7);
          assertArrayEquals(RECEIPT_POST_TX_STATE7, receiptPostTransactionState7);
          assertArrayEquals(BLOCK_RECEIPT_ROOT2, blockReceiptsRoot2);
          assertArrayEquals(STATE_ROOT2, stateRoot2);
      }
  
      private static AionTransaction getDeployTransaction() {
          ECKey key = ECKeyFac.inst().fromPrivate(PRIVATE_KEY);
          return AionTransaction.create(
                  key,
                  BigInteger.ZERO.toByteArray(),
                  null,
                  BigInteger.ZERO.toByteArray(),
                  getContractCode(),
                  2_000_000,
                  energyPrice,
                  TransactionTypes.DEFAULT, null);
      }
  
      /** Calls the function: addOwner(Address) in Wallet.sol */
      private static AionTransaction getTransactionThatCallsAddOwner() {
          ECKey key = ECKeyFac.inst().fromPrivate(PRIVATE_KEY);
          byte[] callData = ByteUtil.merge(Hex.decode("7065cb48"), OWNER.toByteArray());
          return AionTransaction.create(
                  key,
                  BigInteger.ONE.toByteArray(),
                  CONTRACT,
                  BigInteger.ZERO.toByteArray(),
                  callData,
                  2_000_000,
                  energyPrice,
                  TransactionTypes.DEFAULT, null);
      }
  
      /**
       * Calls the function: isOwner(Address) in Wallet.sol
       *
       * <p>The Address that is being queried is 'owner'.
       */
      private static AionTransaction getTransactionThatCallsIsOwner(AionAddress owner, int nonce) {
          ECKey key = ECKeyFac.inst().fromPrivate(PRIVATE_KEY);
          byte[] callData = ByteUtil.merge(Hex.decode("2f54bf6e"), owner.toByteArray());
          return AionTransaction.create(
                  key,
                  BigInteger.valueOf(nonce).toByteArray(),
                  CONTRACT,
                  BigInteger.ZERO.toByteArray(),
                  callData,
                  2_000_000,
                  energyPrice,
                  TransactionTypes.DEFAULT, null);
      }
  
      /**
       * Calls the function: isOwner(Address) in Wallet.sol
       *
       * <p>The energy limit provided to this function is exactly 1 energy unit short of being able to
       * run the transaction. As such, it fails with an OUT_OF_NRG error.
       */
      private static AionTransaction getTransactionThatCallsIsOwnerAndRunOutOfEnergy() {
          ECKey key = ECKeyFac.inst().fromPrivate(PRIVATE_KEY);
          byte[] callData = ByteUtil.merge(Hex.decode("2f54bf6e"), OWNER.toByteArray());
          return AionTransaction.create(
                  key,
                  BigInteger.valueOf(4).toByteArray(),
                  CONTRACT,
                  BigInteger.ZERO.toByteArray(),
                  callData,
                  24_460,
                  energyPrice,
                  TransactionTypes.DEFAULT, null);
      }
  
      /**
       * Calls the function: m_numOwners() in Wallet.sol
       *
       * <p>The energy limit provided to this function is exactly what is required to run this
       * transaction, so it succeeds.
       */
      private static AionTransaction getTransactionThatCallsNumOwners() {
          ECKey key = ECKeyFac.inst().fromPrivate(PRIVATE_KEY);
          byte[] callData = ByteUtil.merge(Hex.decode("4123cb6b"));
          return AionTransaction.create(
                  key,
                  BigInteger.valueOf(5).toByteArray(),
                  CONTRACT,
                  BigInteger.ZERO.toByteArray(),
                  callData,
                  22_326,
                  energyPrice,
                  TransactionTypes.DEFAULT, null);
      }
  
      /** Transfers the specified amount of value from OWNER account to OTHER. */
      private static AionTransaction getTransactionThatOnlyTransfersValue(BigInteger amount) {
          ECKey key = ECKeyFac.inst().fromPrivate(PRIVATE_KEY);
          return AionTransaction.create(
                  key,
                  BigInteger.valueOf(7).toByteArray(),
                  OTHER,
                  amount.toByteArray(),
                  new byte[0],
                  21_000,
                  energyPrice,
                  TransactionTypes.DEFAULT, null);
      }
  
      /** The binary of the contract: Wallet.sol */
      private static byte[] getContractCode() {
          String code =
                  "605060405234156100105760006000fd5b604051611179380380611179833981016040528080518201919060100180519060100190919050505b60006001835101600160005081909090555033600260005060016101008110151561006057fe5b90906002020160005b508282909180600101839055555050506001610202600050600033825281601001526020019081526010016000209050600050819090905550600090505b82518110156101535782818151811015156100be57fe5b90601001906020020180601001519051600260005083600201610100811015156100e457fe5b90906002020160005b50828290918060010183905555505050806002016102026000506000858481518110151561011757fe5b906010019060200201806010015190518252816010015260200190815260100160002090506000508190909055505b80600101905080506100a7565b8160006000508190909055505b505050610168565b611002806101776000396000f30060506040523615610096576000356c01000000000000000000000000900463ffffffff168063173825d91461009c5780632f54bf6e146100c857806335397dc01461010c5780634123cb6b1461014b5780637065cb4814610175578063746c9171146101a1578063b75c7dc6146101cb578063c2cf7326146101fd578063f00d4b5d14610258578063f1f06fb61461029557610096565b60006000fd5b34156100a85760006000fd5b6100c6600480808060100135903590916020019091929050506102b9565b005b34156100d45760006000fd5b6100f260048080806010013590359091602001909192905050610400565b604051808215151515815260100191505060405180910390f35b34156101185760006000fd5b61012e6004808035906010019091905050610435565b604051808383825281601001526020019250505060405180910390f35b34156101575760006000fd5b61015f61046e565b6040518082815260100191505060405180910390f35b34156101815760006000fd5b61019f60048080806010013590359091602001909192905050610477565b005b34156101ad5760006000fd5b6101b56105c9565b6040518082815260100191505060405180910390f35b34156101d75760006000fd5b6101fb600480808060100135903590600019169090916020019091929050506105d2565b005b34156102095760006000fd5b61023e6004808080601001359035906000191690909160200190919290808060100135903590916020019091929050506106e3565b604051808215151515815260100191505060405180910390f35b34156102645760006000fd5b610293600480808060100135903590916020019091929080806010013590359091602001909192905050610778565b005b34156102a15760006000fd5b6102b760048080359060100190919050506108ea565b005b60006000366040518083838082843782019150509250505060405180910390206102e9828261098e63ffffffff16565b15156102f55760006000fd5b610202600050600086868252816010015260200190815260100160002090506000505492506000831415610328576103f8565b6001600160005054036000600050541115610342576103f8565b600060006002600050856101008110151561035957fe5b90906002020160005b508282909180600101839055555050506000610202600050600087878252816010015260200190815260100160002090506000508190909055506103aa610c1963ffffffff16565b6103b8610d1a63ffffffff16565b7f58619076adf5bb0943d100ef88d52d7c3fd691b19d3a9071b555b651fbf418da8686604051808383825281601001526020019250505060405180910390a15b5b5050505050565b60006000610202600050600085858252816010015260200190815260100160002090506000505411905061042f565b92915050565b600060006002600050600184016101008110151561044f57fe5b90906002020160005b508060010154905491509150610469565b915091565b60016000505481565b6000366040518083838082843782019150509250505060405180910390206104a5828261098e63ffffffff16565b15156104b15760006000fd5b6104c1848461040063ffffffff16565b156104cb576105c2565b6104d9610c1963ffffffff16565b60fa6001600050541015156104f7576104f6610d1a63ffffffff16565b5b60fa60016000505410151561050b576105c2565b60016000818150548092919060010191905090905550838360026000506001600050546101008110151561053b57fe5b90906002020160005b50828290918060010183905555505050600160005054610202600050600086868252816010015260200190815260100160002090506000508190909055507f994a936646fe87ffe4f1e469d3d6aa417d6b855598397f323de5b449f765f0c38585604051808383825281601001526020019250505060405180910390a15b5b50505050565b60006000505481565b600060006000610202600050600033825281601001526020019081526010016000209050600050549250600083141561060a576106dc565b8260020a915061020360005060008686906000191690906000191690825281601001526020019081526010016000209050600050905060008282600101600050541611156106db57806000016000818150548092919060010191905090905550818160010160008282825054039250508190909055507fc7fb647e59b18047309aa15aad418e5d7ca96d173ad704f1031a2c3d7591734b3388886040518085858252816010015260200183839060001916909060001916908252816010015260200194505050505060405180910390a15b5b5050505050565b6000600060006000610203600050600089899060001916909060001916908252816010015260200190815260100160002090506000509250610202600050600087878252816010015260200190815260100160002090506000505491506000821415610752576000935061076d565b8160020a90506000818460010160005054161415935061076d565b505050949350505050565b60006000366040518083838082843782019150509250505060405180910390206107a8828261098e63ffffffff16565b15156107b45760006000fd5b6107c4858561040063ffffffff16565b156107ce576108e0565b610202600050600088888252816010015260200190815260100160002090506000505492506000831415610801576108e0565b61080f610c1963ffffffff16565b84846002600050856101008110151561082457fe5b90906002020160005b5082829091806001018390555550505060006102026000506000898982528160100152602001908152601001600020905060005081909090555082610202600050600087878252816010015260200190815260100160002090506000508190909055507fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c888888886040518085858252816010015260200183838252816010015260200194505050505060405180910390a15b5b50505050505050565b600036604051808383808284378201915050925050506040518091039020610918828261098e63ffffffff16565b15156109245760006000fd5b60016000505483111561093657610988565b826000600050819090905550610950610c1963ffffffff16565b7fd9a37dd2a911cc717a3127f430cde03b03bcf2694f289138cff455a5430ea9fd846040518082815260100191505060405180910390a15b5b505050565b600060006000600061020260005060003382528160100152602001908152601001600020905060005054925060008314156109c857610c10565b610203600050600087879060001916909060001916908252816010015260200190815260100160002090506000509150600082600001600050541415610a97576000600050548260000160005081909090555060008260010160005081909090555061020460005080548091906001019090610a449190610f48565b8260020160005081909090555085856102046000508460020160005054815481101515610a6d57fe5b9060005260106000209050906002020160005b508282906000191690909180600101839055555050505b8260020a90506000818360010160005054161415610c0f577fe1c52dc63b719ade82e8bea94cc41a0d5d28e4aaf536adb5e9cccc9ff8c1aeda3389896040518085858252816010015260200183839060001916909060001916908252816010015260200194505050505060405180910390a160018260000160005054111515610bde576102046000506102036000506000888890600019169090600019169082528160100152602001908152601001600020905060005060020160005054815481101515610b6157fe5b9060005260106000209050906002020160005b50806000905560010160009055610203600050600087879060001916909060001916908252816010015260200190815260100160002090506000600082016000506000905560018201600050600090556002820160005060009055505060019350610c1056610c0e565b81600001600081815054809291906001900391905090905550808260010160008282825054179250508190909055505b5b5b50505092915050565b60006000610204600050805490509150600090505b81811015610d06576000600061020460005083815481101515610c4d57fe5b9060005260106000209050906002020160005b5080600101549054906000191690909114919014161515610cf857610203600050600061020460005083815481101515610c9657fe5b9060005260106000209050906002020160005b5080600101549054906000191690906000191690825281601001526020019081526010016000209050600060008201600050600090556001820160005060009055600282016000506000905550505b5b8060010190508050610c2e565b6102046000610d159190610f7c565b5b5050565b6000600190505b600160005054811015610f44575b60016000505481108015610d6f57506000600060026000508361010081101515610d5557fe5b90906002020160005b508060010154905490911491901416155b15610d81578080600101915050610d2f565b5b6001600160005054118015610dc7575060006000600260005060016000505461010081101515610dae57fe5b90906002020160005b5080600101549054909114919014165b15610de8576001600081815054809291906001900391905090905550610d82565b60016000505481108015610e2d575060006000600260005060016000505461010081101515610e1357fe5b90906002020160005b508060010154905490911491901416155b8015610e6457506000600060026000508361010081101515610e4b57fe5b90906002020160005b5080600101549054909114919014165b15610f3f57600260005060016000505461010081101515610e8157fe5b90906002020160005b508060010154905460026000508361010081101515610ea557fe5b90906002020160005b5082829091806001018390555550505080610202600050600060026000508461010081101515610eda57fe5b90906002020160005b508060010154905482528160100152602001908152601001600020905060005081909090555060006000600260005060016000505461010081101515610f2557fe5b90906002020160005b508282909180600101839055555050505b610d21565b5b50565b815481835581811511610f77576002028160020283600052601060002090509182019101610f769190610fa3565b5b505050565b50805460008255600202906000526010600020905090810190610f9f9190610fa3565b5b50565b610fd39190610fad565b80821115610fcf57600081815080600090556001016000905550600201610fad565b5090565b905600a165627a7a723058200f78dff72db2669ce2b6766c46e53928ecb1c03dd142c7e8acaefe1145e080420029";
          return Hex.decode(code);
      }
  }
  