Skip to content

Commit

Permalink
Find issue with tracer logs/trace rpc
Browse files Browse the repository at this point in the history
/debug_trace call. this commit is temp and would be force removed on next push.
  • Loading branch information
obasekiosa committed Sep 23, 2024
1 parent 50420be commit d198704
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,13 @@ protected override void AddTrace(GethLikeTxTrace trace) { }
protected override GethLikeTxTrace OnEnd(GethLikeTxFileTracer txTracer)
{
var trace = txTracer.BuildResult();
var returnValue = trace.ReturnValue.ToHexString(true);

JsonSerializer.Serialize(_jsonWriter,
new
{
output = trace.ReturnValue.ToHexString(true),
gasUsed = $"0x{trace.Gas:x}"
output = returnValue == "0x" ? "" : returnValue, // empty on null return value? if so move this into "ToHexString" using emptyIfZero parameter?
gasUsed = trace.Gas.ToString()
},
_serializerOptions);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public override void Write(
GethLikeTxTrace value,
JsonSerializerOptions options)
{
if (value is null)
if (value is null) // remove, value isn't nullable?
{
writer.WriteNullValue();
}
Expand Down Expand Up @@ -47,6 +47,8 @@ public override void Write(
}
}
}

// remove this?
/*
public class GethLikeTxTraceConverter : JsonConverter<GethLikeTxTrace>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public ResultWrapper<IReadOnlyCollection<GethLikeTxTrace>> debug_traceBlock(byte
{
var blockTrace = _debugBridge.GetBlockTrace(new Rlp(blockRlp), cancellationToken, options);

if (blockTrace is null)
if (blockTrace is null) // remove?
return ResultWrapper<IReadOnlyCollection<GethLikeTxTrace>>.Fail($"Trace is null for RLP {blockRlp.ToHexString()}", ErrorCodes.ResourceNotFound);

if (_logger.IsTrace) _logger.Trace($"{nameof(debug_traceBlock)} request {blockRlp.ToHexString()}, result: {blockTrace}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private static JsonSerializerOptions CreateOptions(bool indented, IEnumerable<Js
MaxDepth = maxDepth,
Converters =
{
new LongConverter(),
// new LongConverter(), // cause of issue, now refactor so specific tracers don't use this! then update tests!
new UInt256Converter(),
new ULongConverter(),
new IntConverter(),
Expand Down

0 comments on commit d198704

Please sign in to comment.