Example #1
0
 public GethLikeTxTrace[] GetBlockTrace(long blockNumber, GethTraceOptions gethTraceOptions = null)
 {
     return(_tracer.TraceBlock(blockNumber, gethTraceOptions ?? GethTraceOptions.Default));
 }
Example #2
0
 public GethLikeTxTrace[] GetBlockTrace(Rlp blockRlp, CancellationToken cancellationToken, GethTraceOptions gethTraceOptions = null)
 {
     return(_tracer.TraceBlock(blockRlp, gethTraceOptions ?? GethTraceOptions.Default, cancellationToken));
 }
Example #3
0
 public GethLikeTxTrace[] GetBlockTrace(Keccak blockHash, GethTraceOptions gethTraceOptions = null)
 {
     return(_tracer.TraceBlock(blockHash, gethTraceOptions ?? GethTraceOptions.Default));
 }
        private GethLikeTxTrace?Trace(Block block, Keccak?txHash, CancellationToken cancellationToken, GethTraceOptions options)
        {
            if (txHash == null)
            {
                throw new InvalidOperationException("Cannot trace transactions without tx hash set.");
            }

            GethLikeBlockTracer listener = new(txHash, options);

            _processor.Process(block, ProcessingOptions.Trace, listener.WithCancellation(cancellationToken));
            return(listener.BuildResult().SingleOrDefault());
        }
Example #5
0
        public GethLikeTxTrace[] TraceBlock(Keccak blockHash, GethTraceOptions options, CancellationToken cancellationToken)
        {
            Block block = _blockTree.FindBlock(blockHash, BlockTreeLookupOptions.None);

            return(TraceBlock(block, options, cancellationToken));
        }
Example #6
0
 public GethLikeTxTrace GetTransactionTrace(Keccak blockHash, int index, GethTraceOptions gethTraceOptions = null)
 {
     return(_tracer.Trace(blockHash, index, gethTraceOptions ?? GethTraceOptions.Default));
 }
        public GethLikeTxTrace[] TraceBlock(BlockParameter blockParameter, GethTraceOptions options, CancellationToken cancellationToken)
        {
            var block = _blockTree.FindBlock(blockParameter);

            return(TraceBlock(block, options, cancellationToken));
        }
Example #8
0
        public ResultWrapper <GethLikeTxTrace[]> debug_traceBlockByNumber(UInt256 blockNumber, GethTraceOptions options = null)
        {
            var blockTrace = _debugBridge.GetBlockTrace((long)blockNumber, options);

            if (blockTrace == null)
            {
                return(ResultWrapper <GethLikeTxTrace[]> .Fail($"Trace is null for block {blockNumber}", ErrorType.NotFound));
            }

            if (_logger.IsTrace)
            {
                _logger.Trace($"{nameof(debug_traceBlockByNumber)} request {blockNumber}, result: blockTrace");
            }
            return(ResultWrapper <GethLikeTxTrace[]> .Success(blockTrace));
        }
Example #9
0
        public ResultWrapper <GethLikeTxTrace[]> debug_traceBlockByHash(Keccak blockHash, GethTraceOptions options = null)
        {
            GethLikeTxTrace[] gethLikeBlockTrace = _debugBridge.GetBlockTrace(blockHash, options);
            if (gethLikeBlockTrace == null)
            {
                return(ResultWrapper <GethLikeTxTrace[]> .Fail($"Trace is null for block {blockHash}", ErrorType.NotFound));
            }

            if (_logger.IsTrace)
            {
                _logger.Trace($"{nameof(debug_traceBlockByHash)} request {blockHash}, result: blockTrace");
            }
            return(ResultWrapper <GethLikeTxTrace[]> .Success(gethLikeBlockTrace));
        }
Example #10
0
 public GethLikeTxTrace Trace(Rlp block, Keccak txHash, GethTraceOptions options)
 {
     return(TraceBlock(GetBlockToTrace(block), options, txHash).FirstOrDefault());
 }
Example #11
0
        public ResultWrapper <GethLikeTxTrace> debug_traceTransactionInBlockByIndex(byte[] blockRlp, int txIndex, GethTraceOptions options = null)
        {
            var blockTrace       = _debugBridge.GetBlockTrace(new Rlp(blockRlp), options);
            var transactionTrace = blockTrace?.ElementAtOrDefault(txIndex);

            if (transactionTrace == null)
            {
                return(ResultWrapper <GethLikeTxTrace> .Fail($"Trace is null for RLP {blockRlp.ToHexString()} and transaction index {txIndex}", ErrorType.NotFound));
            }

            return(ResultWrapper <GethLikeTxTrace> .Success(transactionTrace));
        }
Example #12
0
 public GethLikeTxTrace[] TraceBlock(Rlp blockRlp, GethTraceOptions options)
 {
     return(TraceBlock(GetBlockToTrace(blockRlp), options));
 }
Example #13
0
 public async Task CompareGethTxTrace(Uri uri1, Uri uri2, Keccak transactionHash = null, GethTraceOptions gethTraceOptions = null)
 {
     gethTraceOptions ??= GethTraceOptions.Default;
     using IConsensusDataSource <GethLikeTxTrace> receipt1Source = GetSource <GethLikeTxTrace>(uri1, DebugModuleFactory.Converters);
     using IConsensusDataSource <GethLikeTxTrace> receipt2Source = GetSource <GethLikeTxTrace>(uri2, DebugModuleFactory.Converters);
     TrySetData(transactionHash, receipt1Source, receipt2Source);
     TrySetData(gethTraceOptions, receipt1Source, receipt2Source);
     await Compare(receipt1Source, receipt2Source, true);
 }
Example #14
0
 public async Task CompareGethBlockTrace(Uri uri1, Uri uri2, Keccak blockHash = null, GethTraceOptions gethTraceOptions = null)
 {
     gethTraceOptions ??= GethTraceOptions.Default;
     using IConsensusDataSource <IEnumerable <GethLikeTxTrace> > receipt1Source = GetSource <IEnumerable <GethLikeTxTrace> >(uri1, DebugModuleFactory.Converters);
     using IConsensusDataSource <IEnumerable <GethLikeTxTrace> > receipt2Source = GetSource <IEnumerable <GethLikeTxTrace> >(uri2, DebugModuleFactory.Converters);
     TrySetData(blockHash, receipt1Source, receipt2Source);
     TrySetData(gethTraceOptions, receipt1Source, receipt2Source);
     await CompareCollection(receipt1Source, receipt2Source, true);
 }
Example #15
0
 public GethLikeTxTrace[] GetBlockTrace(Rlp blockRlp, GethTraceOptions gethTraceOptions = null)
 {
     return(_tracer.TraceBlock(blockRlp, gethTraceOptions ?? GethTraceOptions.Default));
 }
Example #16
0
 public ResultWrapper <GethLikeTxTrace[]> debug_traceBlockFromFile(string fileName, GethTraceOptions options = null)
 {
     throw new NotImplementedException();
 }
Example #17
0
 public GethLikeTxTrace GetTransactionTrace(long blockNumber, int index, GethTraceOptions gethTraceOptions = null)
 {
     return(_tracer.Trace(blockNumber, index, gethTraceOptions ?? GethTraceOptions.Default));
 }
Example #18
0
        public ResultWrapper <GethLikeTxTrace> debug_traceTransaction(Keccak transactionHash, GethTraceOptions options = null)
        {
            GethLikeTxTrace transactionTrace = _debugBridge.GetTransactionTrace(transactionHash, options);

            if (transactionTrace == null)
            {
                return(ResultWrapper <GethLikeTxTrace> .Fail($"Cannot find transactionTrace for hash: {transactionHash}", ErrorType.NotFound));
            }

            if (_logger.IsTrace)
            {
                _logger.Trace($"{nameof(debug_traceTransaction)} request {transactionHash}, result: trace");
            }
            return(ResultWrapper <GethLikeTxTrace> .Success(transactionTrace));
        }
Example #19
0
 public GethLikeTxTrace GetTransactionTrace(Rlp blockRlp, Keccak transactionHash, GethTraceOptions gethTraceOptions = null)
 {
     return(_tracer.Trace(blockRlp, transactionHash, gethTraceOptions ?? GethTraceOptions.Default));
 }
Example #20
0
        public ResultWrapper <GethLikeTxTrace> debug_traceTransactionByBlockhashAndIndex(Keccak blockhash, int index, GethTraceOptions options = null)
        {
            var transactionTrace = _debugBridge.GetTransactionTrace(blockhash, index, options);

            if (transactionTrace == null)
            {
                return(ResultWrapper <GethLikeTxTrace> .Fail($"Cannot find transactionTrace {blockhash}", ErrorType.NotFound));
            }

            if (_logger.IsTrace)
            {
                _logger.Trace($"{nameof(debug_traceTransactionByBlockhashAndIndex)} request {blockhash}, result: trace");
            }
            return(ResultWrapper <GethLikeTxTrace> .Success(transactionTrace));
        }
 public GethLikeTxTrace[] TraceBlock(Rlp blockRlp, GethTraceOptions options, CancellationToken cancellationToken)
 {
     return(TraceBlock(GetBlockToTrace(blockRlp), options, cancellationToken));
 }
Example #22
0
        public ResultWrapper <GethLikeTxTrace> debug_traceTransactionByBlockAndIndex(BlockParameter blockParameter, int index, GethTraceOptions options = null)
        {
            long?blockNo = blockParameter.BlockNumber;

            if (!blockNo.HasValue)
            {
                throw new InvalidDataException("Block number value incorrect");
            }

            var transactionTrace = _debugBridge.GetTransactionTrace(blockNo.Value, index, options);

            if (transactionTrace == null)
            {
                return(ResultWrapper <GethLikeTxTrace> .Fail($"Cannot find transactionTrace {blockNo}", ErrorType.NotFound));
            }

            if (_logger.IsTrace)
            {
                _logger.Trace($"{nameof(debug_traceTransactionByBlockAndIndex)} request {blockNo}, result: trace");
            }
            return(ResultWrapper <GethLikeTxTrace> .Success(transactionTrace));
        }
 public GethLikeTxTrace?Trace(Rlp block, Keccak txHash, GethTraceOptions options, CancellationToken cancellationToken)
 {
     return(TraceBlock(GetBlockToTrace(block), options, cancellationToken, txHash).FirstOrDefault());
 }
Example #24
0
        public ResultWrapper <GethLikeTxTrace> debug_traceTransactionInBlockByHash(byte[] blockRlp, Keccak transactionHash, GethTraceOptions options = null)
        {
            var transactionTrace = _debugBridge.GetTransactionTrace(new Rlp(blockRlp), transactionHash, options);

            if (transactionTrace == null)
            {
                return(ResultWrapper <GethLikeTxTrace> .Fail($"Trace is null for RLP {blockRlp.ToHexString()} and transactionTrace hash {transactionHash}", ErrorType.NotFound));
            }

            return(ResultWrapper <GethLikeTxTrace> .Success(transactionTrace));
        }
Example #25
0
        public GethLikeTxTrace[] TraceBlock(long blockNumber, GethTraceOptions options, CancellationToken cancellationToken)
        {
            Block block = _blockTree.FindBlock(blockNumber, BlockTreeLookupOptions.RequireCanonical);

            return(TraceBlock(block, options, cancellationToken));
        }
Example #26
0
 public GethLikeTxTrace GetTransactionTrace(Keccak transactionHash, CancellationToken cancellationToken, GethTraceOptions gethTraceOptions = null)
 {
     return(_tracer.Trace(transactionHash, gethTraceOptions ?? GethTraceOptions.Default, cancellationToken));
 }