Example #1
0
 public BlockFixture()
 {
     Genesis = TestUtils.MineGenesis <PolymorphicAction <BaseAction> >(
         protocolVersion: ProtocolVersion
         );
     TxFixture = new TxFixture(Genesis.Hash);
     Next      = TestUtils.MineNext(
         Genesis,
         nonce: new byte[] { 0x02, 0x00, 0x00, 0x00 },
         protocolVersion: ProtocolVersion
         );
     byte[] hasTxNonce =
     {
         0x5c, 0x77, 0x74, 0xc2, 0x39, 0x69, 0x37, 0x51, 0x87, 0xa5,
     };
     HasTx = TestUtils.MineNext(
         Next,
         new List <Transaction <PolymorphicAction <BaseAction> > >
     {
         TxFixture.TxWithActions,
     },
         hasTxNonce,
         protocolVersion: ProtocolVersion
         );
 }
Example #2
0
        public BlockFixture()
        {
            var txFixture = new TxFixture();

            Genesis = TestUtils.MineGenesis <BaseAction>();
            Next    = TestUtils.MineNext(Genesis);
            HasTx   = TestUtils.MineNext(
                Next, new List <Transaction <BaseAction> >
            {
                txFixture.TxWithActions,
            });
        }
Example #3
0
        public ActionEvaluatorTest(ITestOutputHelper output)
        {
            Log.Logger = _logger = new LoggerConfiguration()
                                   .MinimumLevel.Verbose()
                                   .Enrich.WithThreadId()
                                   .WriteTo.TestOutput(output)
                                   .CreateLogger()
                                   .ForContext <ActionEvaluatorTest>();

            _policy = new BlockPolicy <DumbAction>(
                blockAction: new MinerReward(1),
                getMaxBlockBytes: _ => 50 * 1024);
            _storeFx = new DefaultStoreFixture(memory: true, blockAction: _policy.BlockAction);
            _txFx    = new TxFixture(null);
        }
Example #4
0
        public BlockFixture()
        {
            var txFixture = new TxFixture();

            Genesis = TestUtils.MineGenesis<BaseAction>();
            Next = TestUtils.MineNext(
                Genesis,
                nonce: new byte[] { 0x02, 0x00, 0x00, 0x00 }
            );
            HasTx = TestUtils.MineNext(
                Next,
                new List<Transaction<BaseAction>>
                {
                    txFixture.TxWithActions,
                },
                new byte[] { 0x02, 0x00, 0x00, 0x00 }
            );
        }
Example #5
0
 public BlockFixture()
 {
     Miner   = TestUtils.GenesisMiner;
     Genesis = TestUtils.MineGenesisBlock <PolymorphicAction <BaseAction> >(
         hashAlgorithmGetter: GetHashAlgorithm,
         protocolVersion: ProtocolVersion,
         miner: Miner,
         stateRootHash: HashDigest <SHA256> .FromString(
             "e2e938f9d8af0a20d16d1c233fc4e8f39157145d003565807e4055ce6b5a0121")
         );
     TxFixture = new TxFixture(Genesis.Hash);
     Next      = TestUtils.MineNextBlock(
         Genesis,
         miner: Miner,
         hashAlgorithmGetter: GetHashAlgorithm,
         nonce: new byte[] { 0x02, 0x00, 0x00, 0x00 },
         protocolVersion: ProtocolVersion,
         stateRootHash: HashDigest <SHA256> .FromString(
             "6a648da9e91c21aa22bdae4e35c338406392aad0db4a0f998c01a7d7973cb8aa")
         );
     byte[] hasTxNonce =
     {
         0x5c, 0x77, 0x74, 0xc2, 0x39, 0x69, 0x37, 0x51, 0x87, 0xa5,
     };
     HasTx = TestUtils.MineNextBlock(
         Next,
         miner: Miner,
         hashAlgorithmGetter: GetHashAlgorithm,
         txs: new List <Transaction <PolymorphicAction <BaseAction> > >
     {
         TxFixture.TxWithActions,
     },
         nonce: hasTxNonce,
         protocolVersion: ProtocolVersion,
         stateRootHash: HashDigest <SHA256> .FromString(
             "aaeda4f1a6a4aee7fc9a29014cff005109176e83a8e5d28876f2d889680e6421")
         );
 }