public void Handles_well_errors() { EstimateGasTracer tracer = new EstimateGasTracer(); tracer.ReportAction(1000, 0, Address.Zero, Address.Zero, Array.Empty <byte>(), ExecutionType.Transaction, false); tracer.ReportAction(1000, 0, Address.Zero, Address.Zero, Array.Empty <byte>(), _executionType, false); tracer.ReportAction(400, 0, Address.Zero, Address.Zero, Array.Empty <byte>(), _executionType, false); if (_executionType.IsAnyCreate()) { tracer.ReportActionError(EvmExceptionType.Other); tracer.ReportActionEnd(400, Address.Zero, Array.Empty <byte>()); tracer.ReportActionEnd(500, Array.Empty <byte>()); // should not happen } else { tracer.ReportActionError(EvmExceptionType.Other); tracer.ReportActionEnd(400, Array.Empty <byte>()); tracer.ReportActionEnd(500, Array.Empty <byte>()); // should not happen } tracer.CalculateEstimate(Build.A.Transaction.WithGasLimit(1000).TestObject).Should().Be(24L); }
public void Handles_well_errors() { EstimateGasTracer tracer = new EstimateGasTracer(); tracer.ReportAction(1000, 0, Address.Zero, Address.Zero, Bytes.Empty, ExecutionType.Transaction, false); tracer.ReportAction(1000, 0, Address.Zero, Address.Zero, Bytes.Empty, _executionType, false); tracer.ReportAction(400, 0, Address.Zero, Address.Zero, Bytes.Empty, _executionType, false); if (_executionType == ExecutionType.Create) { tracer.ReportActionError(EvmExceptionType.Other); tracer.ReportActionEnd(400, Address.Zero, Bytes.Empty); tracer.ReportActionEnd(500, Bytes.Empty); // should not happen } else { tracer.ReportActionError(EvmExceptionType.Other); tracer.ReportActionEnd(400, Bytes.Empty); tracer.ReportActionEnd(500, Bytes.Empty); // should not happen } tracer.ExcessiveGas.Should().Be(406L); }