public void Should_create_tracer_correctly() { Keccak txHash = TestItem.KeccakA; GethLikeBlockTracer gethLikeBlockTracer = new(txHash, GethTraceOptions.Default); ParityLikeBlockTracer parityLikeBlockTracer = new(txHash, ParityTraceTypes.All); CompositeBlockTracer compositeBlockTracer = new CompositeBlockTracer(); compositeBlockTracer.AddRange(gethLikeBlockTracer, parityLikeBlockTracer); compositeBlockTracer.IsTracingRewards.Should().Be(true); }
public void Should_trace_properly() { Block block = Build.A.Block.TestObject; Transaction tx1 = Build.A.Transaction.TestObject; Transaction tx2 = Build.A.Transaction.TestObject; Transaction tx3 = Build.A.Transaction.TestObject; block = block.WithReplacedBody(new BlockBody(new [] { tx1, tx2, tx3 }, new BlockHeader[0])); GethLikeBlockTracer gethLikeBlockTracer = new(GethTraceOptions.Default); ParityLikeBlockTracer parityLikeBlockTracer = new(ParityTraceTypes.All); NullBlockTracer nullBlockTracer = NullBlockTracer.Instance; AlwaysCancelBlockTracer alwaysCancelBlockTracer = AlwaysCancelBlockTracer.Instance; CompositeBlockTracer blockTracer = new CompositeBlockTracer(); blockTracer.AddRange(gethLikeBlockTracer, parityLikeBlockTracer, nullBlockTracer, alwaysCancelBlockTracer); blockTracer.StartNewBlockTrace(block); blockTracer.StartNewTxTrace(tx1); blockTracer.EndTxTrace(); blockTracer.StartNewTxTrace(tx2); blockTracer.EndTxTrace(); blockTracer.StartNewTxTrace(tx3); blockTracer.EndTxTrace(); blockTracer.EndBlockTrace(); IReadOnlyCollection <GethLikeTxTrace> gethResult = gethLikeBlockTracer.BuildResult(); gethResult.Count.Should().Be(3); IReadOnlyCollection <ParityLikeTxTrace> parityResult = parityLikeBlockTracer.BuildResult(); parityResult.Count.Should().Be(3); }