예제 #1
0
        public void Handles_well_serial_calls()
        {
            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.ReportActionEnd(400, Array.Empty <byte>());
            tracer.ReportAction(400, 0, Address.Zero, Address.Zero, Array.Empty <byte>(), _executionType, false);
            if (_executionType.IsAnyCreate())
            {
                tracer.ReportActionEnd(200, Address.Zero, Array.Empty <byte>());
                tracer.ReportActionEnd(300, Array.Empty <byte>());
            }
            else
            {
                tracer.ReportActionEnd(200, Array.Empty <byte>());
                tracer.ReportActionEnd(300, Array.Empty <byte>()); // should not happen
            }

            tracer.CalculateEstimate(Build.A.Transaction.WithGasLimit(1000).TestObject).Should().Be(14L);
        }