protected VmTestResultTracer Execute(UInt256 blockNumber, long gasLimit, byte[] code) { (var block, var transaction) = PrepareTx(blockNumber, gasLimit, code); VmTestResultTracer tracer = new VmTestResultTracer(); _processor.Execute(transaction, block.Header, tracer); return(tracer); }
protected VmTestResultTracer Execute(params byte[] code) { (var block, var transaction) = PrepareTx(BlockNumber, 100000, code); VmTestResultTracer tracer = new VmTestResultTracer(); _processor.Execute(transaction, block.Header, tracer); return(tracer); }
public void Shift_right(string a, string b, string result) { byte[] code = Prepare.EvmCode .PushData(a) .PushData(b) .Op(Instruction.SHR) .PushData(0) .Op(Instruction.SSTORE) .Done; VmTestResultTracer receipt = Execute(code); AssertEip145(receipt, result); }
private void AssertEip145(VmTestResultTracer receipt, byte[] result) { AssertStorage(0, result); AssertGas(receipt, result.IsZero() ? ZeroResultGas : NonZeroResultGas); }
private void AssertEip145(VmTestResultTracer receipt, string result) { AssertEip145(receipt, Bytes.FromHexString(result)); }
private void AssertEip145(VmTestResultTracer receipt, byte result) { AssertEip145(receipt, new[] { result }); }
protected void AssertGas(VmTestResultTracer receipt, long gas) { Assert.AreEqual(gas, receipt.GasUsed, "gas"); }