protected (Block block, Transaction transaction) PrepareTx( long blockNumber, long gasLimit, byte[] code, SenderRecipientAndMiner senderRecipientAndMiner = null) { senderRecipientAndMiner ??= SenderRecipientAndMiner.Default; TestState.CreateAccount(senderRecipientAndMiner.Sender, 100.Ether()); TestState.CreateAccount(senderRecipientAndMiner.Recipient, 100.Ether()); Keccak codeHash = TestState.UpdateCode(code); TestState.UpdateCodeHash(senderRecipientAndMiner.Recipient, codeHash, SpecProvider.GenesisSpec); TestState.Commit(SpecProvider.GenesisSpec); TestState.CommitTree(); Transaction transaction = Build.A.Transaction .WithGasLimit(gasLimit) .WithGasPrice(1) .To(senderRecipientAndMiner.Recipient) .SignedAndResolved(_ethereumEcdsa, senderRecipientAndMiner.SenderKey) .TestObject; Block block = BuildBlock(blockNumber, senderRecipientAndMiner, transaction); return(block, transaction); }
protected override Block BuildBlock(long blockNumber, SenderRecipientAndMiner senderRecipientAndMiner) { Block block = base.BuildBlock(blockNumber, senderRecipientAndMiner); if (_setAuthor) { block.Header.Author = TestItem.AddressC; } block.Header.Beneficiary = TestItem.AddressB; return(block); }
protected override Block BuildBlock(long blockNumber, SenderRecipientAndMiner senderRecipientAndMiner, Transaction transaction, long blockGasLimit = DefaultBlockGasLimit) { Block block = base.BuildBlock(blockNumber, senderRecipientAndMiner, transaction, blockGasLimit); if (_setAuthor) { block.Header.Author = TestItem.AddressC; } block.Header.Beneficiary = TestItem.AddressB; return(block); }
protected override Block BuildBlock(long blockNumber, SenderRecipientAndMiner senderRecipientAndMiner, Transaction transaction) { senderRecipientAndMiner ??= new SenderRecipientAndMiner(); Block block = base.BuildBlock(blockNumber, senderRecipientAndMiner, transaction); if (_setAuthor) { block.Header.Author = TestItem.AddressC; } block.Header.Beneficiary = senderRecipientAndMiner.Recipient; return(block); }
protected virtual Block BuildBlock(long blockNumber, SenderRecipientAndMiner senderRecipientAndMiner, Transaction tx) { senderRecipientAndMiner ??= SenderRecipientAndMiner.Default; return(Build.A.Block.WithNumber(blockNumber).WithTransactions(tx == null ? new Transaction[0] : new[] { tx }).WithGasLimit(8000000).WithBeneficiary(senderRecipientAndMiner.Miner).TestObject); }
protected Block BuildBlock(long blockNumber, SenderRecipientAndMiner senderRecipientAndMiner) { return(BuildBlock(blockNumber, senderRecipientAndMiner, null)); }
protected (Block block, Transaction transaction) PrepareInitTx(long blockNumber, long gasLimit, byte[] code, SenderRecipientAndMiner senderRecipientAndMiner = null) { senderRecipientAndMiner ??= SenderRecipientAndMiner.Default; TestState.CreateAccount(senderRecipientAndMiner.Sender, 100.Ether()); TestState.Commit(SpecProvider.GenesisSpec); Transaction transaction = Build.A.Transaction .WithTo(null) .WithData(Array.Empty <byte>()) .WithGasLimit(gasLimit) .WithGasPrice(1) .WithInit(code) .SignedAndResolved(_ethereumEcdsa, senderRecipientAndMiner.SenderKey) .TestObject; Block block = BuildBlock(blockNumber, senderRecipientAndMiner); return(block, transaction); }
protected virtual Block BuildBlock(long blockNumber, SenderRecipientAndMiner senderRecipientAndMiner) { senderRecipientAndMiner ??= SenderRecipientAndMiner.Default; return(Build.A.Block.WithNumber(blockNumber).WithGasLimit(8000000).WithBeneficiary(senderRecipientAndMiner.Miner).TestObject); }