mirror of https://github.com/hyperledger/besu
Use Besu pipeline in trace_block, trace_filter and trace_replayBlockTransactions (#5131)
Use Besu pipeline in trace_block, trace_filter and trace_replayBlockTransactions (#5131) Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>pull/5252/head
parent
0f973373f3
commit
c4034f502e
@ -0,0 +1,37 @@ |
||||
/* |
||||
* Copyright contributors to Hyperledger Besu. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on |
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the |
||||
* specific language governing permissions and limitations under the License. |
||||
* |
||||
* SPDX-License-Identifier: Apache-2.0 |
||||
*/ |
||||
package org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods; |
||||
|
||||
import org.hyperledger.besu.ethereum.api.util.ArrayNodeWrapper; |
||||
|
||||
import java.util.function.Consumer; |
||||
|
||||
public class BuildArrayNodeCompleterStep implements Consumer<Object> { |
||||
|
||||
private final ArrayNodeWrapper resultArrayNode; |
||||
|
||||
public BuildArrayNodeCompleterStep(final ArrayNodeWrapper resultArrayNode) { |
||||
this.resultArrayNode = resultArrayNode; |
||||
} |
||||
|
||||
@Override |
||||
public void accept(final Object object) { |
||||
resultArrayNode.addPOJO(object); |
||||
} |
||||
|
||||
public ArrayNodeWrapper getResultArrayNode() { |
||||
return this.resultArrayNode; |
||||
} |
||||
} |
@ -0,0 +1,113 @@ |
||||
/* |
||||
* Copyright contributors to Hyperledger Besu.. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on |
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the |
||||
* specific language governing permissions and limitations under the License. |
||||
* |
||||
* SPDX-License-Identifier: Apache-2.0 |
||||
*/ |
||||
package org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods; |
||||
|
||||
import org.hyperledger.besu.datatypes.DataGas; |
||||
import org.hyperledger.besu.datatypes.Wei; |
||||
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.processor.TransactionTrace; |
||||
import org.hyperledger.besu.ethereum.chain.Blockchain; |
||||
import org.hyperledger.besu.ethereum.core.Block; |
||||
import org.hyperledger.besu.ethereum.core.BlockHeader; |
||||
import org.hyperledger.besu.ethereum.debug.TraceFrame; |
||||
import org.hyperledger.besu.ethereum.mainnet.MainnetTransactionProcessor; |
||||
import org.hyperledger.besu.ethereum.mainnet.ProtocolSpec; |
||||
import org.hyperledger.besu.ethereum.processing.TransactionProcessingResult; |
||||
import org.hyperledger.besu.ethereum.vm.BlockHashLookup; |
||||
import org.hyperledger.besu.ethereum.vm.CachingBlockHashLookup; |
||||
import org.hyperledger.besu.ethereum.vm.DebugOperationTracer; |
||||
|
||||
import java.util.List; |
||||
import java.util.Optional; |
||||
import java.util.function.Function; |
||||
|
||||
public class ExecuteTransactionStep implements Function<TransactionTrace, TransactionTrace> { |
||||
|
||||
private final TraceBlock.ChainUpdater chainUpdater; |
||||
private final DebugOperationTracer tracer; |
||||
private final MainnetTransactionProcessor transactionProcessor; |
||||
private final Blockchain blockchain; |
||||
private final ProtocolSpec protocolSpec; |
||||
private final Block block; |
||||
|
||||
public ExecuteTransactionStep( |
||||
final TraceBlock.ChainUpdater chainUpdater, |
||||
final MainnetTransactionProcessor transactionProcessor, |
||||
final Blockchain blockchain, |
||||
final DebugOperationTracer tracer, |
||||
final ProtocolSpec protocolSpec, |
||||
final Block block) { |
||||
this.chainUpdater = chainUpdater; |
||||
this.transactionProcessor = transactionProcessor; |
||||
this.blockchain = blockchain; |
||||
this.tracer = tracer; |
||||
this.protocolSpec = protocolSpec; |
||||
this.block = block; |
||||
} |
||||
|
||||
public ExecuteTransactionStep( |
||||
final TraceBlock.ChainUpdater chainUpdater, |
||||
final MainnetTransactionProcessor transactionProcessor, |
||||
final Blockchain blockchain, |
||||
final DebugOperationTracer tracer, |
||||
final ProtocolSpec protocolSpec) { |
||||
this(chainUpdater, transactionProcessor, blockchain, tracer, protocolSpec, null); |
||||
} |
||||
|
||||
@Override |
||||
public TransactionTrace apply(final TransactionTrace transactionTrace) { |
||||
Block block = this.block; |
||||
// case where transactionTrace is created only to trace a block reward
|
||||
if (block == null) { |
||||
block = |
||||
transactionTrace |
||||
.getBlock() |
||||
.orElseThrow( |
||||
() -> |
||||
new RuntimeException( |
||||
"Expecting reward block to be in transactionTrace but was empty")); |
||||
} |
||||
|
||||
List<TraceFrame> traceFrames = null; |
||||
TransactionProcessingResult result = null; |
||||
// If it is not a reward Block trace
|
||||
if (transactionTrace.getTransaction() != null) { |
||||
BlockHeader header = block.getHeader(); |
||||
final Optional<BlockHeader> maybeParentHeader = |
||||
blockchain.getBlockHeader(header.getParentHash()); |
||||
final Wei dataGasPrice = |
||||
protocolSpec |
||||
.getFeeMarket() |
||||
.dataPrice( |
||||
maybeParentHeader.flatMap(BlockHeader::getExcessDataGas).orElse(DataGas.ZERO)); |
||||
final BlockHashLookup blockHashLookup = new CachingBlockHashLookup(header, blockchain); |
||||
result = |
||||
transactionProcessor.processTransaction( |
||||
blockchain, |
||||
chainUpdater.getNextUpdater(), |
||||
header, |
||||
transactionTrace.getTransaction(), |
||||
header.getCoinbase(), |
||||
tracer, |
||||
blockHashLookup, |
||||
false, |
||||
dataGasPrice); |
||||
|
||||
traceFrames = tracer.copyTraceFrames(); |
||||
tracer.reset(); |
||||
} |
||||
return new TransactionTrace( |
||||
transactionTrace.getTransaction(), result, traceFrames, transactionTrace.getBlock()); |
||||
} |
||||
} |
@ -0,0 +1,82 @@ |
||||
/* |
||||
* Copyright contributors to Hyperledger Besu. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on |
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the |
||||
* specific language governing permissions and limitations under the License. |
||||
* |
||||
* SPDX-License-Identifier: Apache-2.0 |
||||
*/ |
||||
|
||||
package org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods; |
||||
|
||||
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.processor.TransactionTrace; |
||||
import org.hyperledger.besu.ethereum.api.util.ArrayNodeWrapper; |
||||
import org.hyperledger.besu.ethereum.core.Block; |
||||
import org.hyperledger.besu.ethereum.core.Transaction; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.Iterator; |
||||
import java.util.List; |
||||
import java.util.Optional; |
||||
|
||||
public class TraceFilterSource implements Iterator<TransactionTrace> { |
||||
|
||||
private final ArrayNodeWrapper resultArrayNode; |
||||
private final Iterator<Block> blockIterator; |
||||
private Iterator<TransactionTrace> transactionTraceIterator; |
||||
private Block currentBlock; |
||||
|
||||
public TraceFilterSource(final List<Block> blockList, final ArrayNodeWrapper resultArrayNode) { |
||||
this.resultArrayNode = resultArrayNode; |
||||
this.blockIterator = blockList.iterator(); |
||||
this.transactionTraceIterator = getNextTransactionIterator(); |
||||
} |
||||
|
||||
private Iterator<TransactionTrace> getNextTransactionIterator() { |
||||
if (!blockIterator.hasNext()) { |
||||
return null; |
||||
} |
||||
|
||||
currentBlock = blockIterator.next(); |
||||
List<Transaction> transactions = currentBlock.getBody().getTransactions(); |
||||
List<TransactionTrace> transactionTraces = new ArrayList<>(transactions.size() + 1); |
||||
|
||||
for (Transaction transaction : transactions) { |
||||
transactionTraces.add(new TransactionTrace(transaction, Optional.of(currentBlock))); |
||||
} |
||||
|
||||
transactionTraces.add(new TransactionTrace(Optional.of(currentBlock))); |
||||
return transactionTraces.iterator(); |
||||
} |
||||
|
||||
@Override |
||||
public boolean hasNext() { |
||||
if (resultArrayNode.isFull()) return false; |
||||
if (transactionTraceIterator == null) { |
||||
return false; |
||||
} |
||||
if (transactionTraceIterator.hasNext()) { |
||||
return true; |
||||
} |
||||
transactionTraceIterator = getNextTransactionIterator(); |
||||
return hasNext(); |
||||
} |
||||
|
||||
@Override |
||||
public TransactionTrace next() { |
||||
if (transactionTraceIterator == null) { |
||||
return null; |
||||
} |
||||
if (transactionTraceIterator.hasNext()) { |
||||
return transactionTraceIterator.next(); |
||||
} |
||||
transactionTraceIterator = getNextTransactionIterator(); |
||||
return next(); |
||||
} |
||||
} |
@ -0,0 +1,86 @@ |
||||
/* |
||||
* Copyright contributors to Hyperledger Besu. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on |
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the |
||||
* specific language governing permissions and limitations under the License. |
||||
* |
||||
* SPDX-License-Identifier: Apache-2.0 |
||||
*/ |
||||
package org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods; |
||||
|
||||
import org.hyperledger.besu.datatypes.Address; |
||||
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.FilterParameter; |
||||
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.processor.TransactionTrace; |
||||
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.tracing.Trace; |
||||
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.tracing.flat.FlatTrace; |
||||
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.tracing.flat.FlatTraceGenerator; |
||||
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.tracing.flat.RewardTraceGenerator; |
||||
import org.hyperledger.besu.ethereum.core.Block; |
||||
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule; |
||||
|
||||
import java.util.List; |
||||
import java.util.Optional; |
||||
import java.util.concurrent.CompletableFuture; |
||||
import java.util.function.Function; |
||||
import java.util.stream.Stream; |
||||
|
||||
public class TraceFlatTransactionStep |
||||
implements Function<TransactionTrace, CompletableFuture<Stream<FlatTrace>>> { |
||||
|
||||
private final ProtocolSchedule protocolSchedule; |
||||
private final Block block; |
||||
private final Optional<FilterParameter> filterParameter; |
||||
|
||||
public TraceFlatTransactionStep( |
||||
final ProtocolSchedule protocolSchedule, |
||||
final Block block, |
||||
final Optional<FilterParameter> filterParameter) { |
||||
this.protocolSchedule = protocolSchedule; |
||||
this.block = block; |
||||
this.filterParameter = filterParameter; |
||||
} |
||||
|
||||
@Override |
||||
public CompletableFuture<Stream<FlatTrace>> apply(final TransactionTrace transactionTrace) { |
||||
Stream<Trace> traceStream = null; |
||||
Block block = this.block; |
||||
if (block == null) block = transactionTrace.getBlock().get(); |
||||
if (transactionTrace.getTransaction() == null) { |
||||
traceStream = RewardTraceGenerator.generateFromBlock(protocolSchedule, block); |
||||
} else { |
||||
traceStream = |
||||
FlatTraceGenerator.generateFromTransactionTraceAndBlock( |
||||
protocolSchedule, transactionTrace, block); |
||||
} |
||||
if (filterParameter.isPresent()) { |
||||
final List<Address> fromAddress = filterParameter.get().getFromAddress(); |
||||
final List<Address> toAddress = filterParameter.get().getToAddress(); |
||||
return CompletableFuture.completedFuture( |
||||
traceStream |
||||
.map(FlatTrace.class::cast) |
||||
.filter( |
||||
trace -> |
||||
fromAddress.isEmpty() |
||||
|| Optional.ofNullable(trace.getAction().getFrom()) |
||||
.map(Address::fromHexString) |
||||
.map(fromAddress::contains) |
||||
.orElse(false)) |
||||
.filter( |
||||
trace -> |
||||
toAddress.isEmpty() |
||||
|| Optional.ofNullable(trace.getAction().getTo()) |
||||
.map(Address::fromHexString) |
||||
.map(toAddress::contains) |
||||
.orElse(false))); |
||||
|
||||
} else { |
||||
return CompletableFuture.completedFuture(traceStream.map(FlatTrace.class::cast)); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,78 @@ |
||||
/* |
||||
* Copyright Hyperledger Besu Contributors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on |
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the |
||||
* specific language governing permissions and limitations under the License. |
||||
* |
||||
* SPDX-License-Identifier: Apache-2.0 |
||||
*/ |
||||
package org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods; |
||||
|
||||
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.TraceTypeParameter.TraceType; |
||||
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.processor.TransactionTrace; |
||||
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.TraceReplayResult; |
||||
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.tracing.diff.StateDiffGenerator; |
||||
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.tracing.diff.StateDiffTrace; |
||||
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.tracing.flat.FlatTrace; |
||||
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.tracing.flat.FlatTraceGenerator; |
||||
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.tracing.vm.VmTrace; |
||||
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.tracing.vm.VmTraceGenerator; |
||||
import org.hyperledger.besu.ethereum.core.Block; |
||||
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule; |
||||
|
||||
import java.util.Set; |
||||
import java.util.concurrent.CompletableFuture; |
||||
import java.util.concurrent.atomic.AtomicInteger; |
||||
import java.util.function.Function; |
||||
|
||||
public class TraceReplayTransactionStep |
||||
implements Function<TransactionTrace, CompletableFuture<TraceReplayResult>> { |
||||
|
||||
private final ProtocolSchedule protocolSchedule; |
||||
private final Block block; |
||||
private final Set<TraceType> traceTypes; |
||||
|
||||
public TraceReplayTransactionStep( |
||||
final ProtocolSchedule protocolSchedule, final Block block, final Set<TraceType> traceTypes) { |
||||
this.protocolSchedule = protocolSchedule; |
||||
this.block = block; |
||||
this.traceTypes = traceTypes; |
||||
} |
||||
|
||||
@Override |
||||
public CompletableFuture<TraceReplayResult> apply(final TransactionTrace transactionTrace) { |
||||
final TraceReplayResult.Builder builder = TraceReplayResult.builder(); |
||||
transactionTrace |
||||
.getResult() |
||||
.getRevertReason() |
||||
.ifPresent(revertReason -> builder.revertReason(revertReason.toHexString())); |
||||
|
||||
builder.output(transactionTrace.getResult().getOutput().toString()); |
||||
builder.transactionHash(transactionTrace.getTransaction().getHash().toHexString()); |
||||
|
||||
if (traceTypes.contains(TraceType.STATE_DIFF)) { |
||||
new StateDiffGenerator() |
||||
.generateStateDiff(transactionTrace) |
||||
.forEachOrdered(stateDiff -> builder.stateDiff((StateDiffTrace) stateDiff)); |
||||
} |
||||
|
||||
if (traceTypes.contains(TraceType.TRACE)) { |
||||
FlatTraceGenerator.generateFromTransactionTrace( |
||||
protocolSchedule, transactionTrace, block, new AtomicInteger()) |
||||
.forEachOrdered(trace -> builder.addTrace((FlatTrace) trace)); |
||||
} |
||||
|
||||
if (traceTypes.contains(TraceType.VM_TRACE)) { |
||||
new VmTraceGenerator(transactionTrace) |
||||
.generateTraceStream() |
||||
.forEachOrdered(vmTrace -> builder.vmTrace((VmTrace) vmTrace)); |
||||
} |
||||
return CompletableFuture.completedFuture(builder.build()); |
||||
} |
||||
} |
@ -0,0 +1,47 @@ |
||||
/* |
||||
* Copyright contributors to Hyperledger Besu. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on |
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the |
||||
* specific language governing permissions and limitations under the License. |
||||
* |
||||
* SPDX-License-Identifier: Apache-2.0 |
||||
*/ |
||||
package org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods; |
||||
|
||||
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.processor.TransactionTrace; |
||||
import org.hyperledger.besu.ethereum.core.Block; |
||||
import org.hyperledger.besu.ethereum.core.Transaction; |
||||
|
||||
import java.util.Iterator; |
||||
import java.util.List; |
||||
import java.util.Optional; |
||||
import java.util.concurrent.atomic.AtomicInteger; |
||||
|
||||
public class TransactionSource implements Iterator<TransactionTrace> { |
||||
|
||||
private final List<Transaction> transactions; |
||||
private final AtomicInteger currentIndex = new AtomicInteger(0); |
||||
private final Block block; |
||||
|
||||
public TransactionSource(final Block block) { |
||||
this.block = block; |
||||
this.transactions = block.getBody().getTransactions(); |
||||
} |
||||
|
||||
@Override |
||||
public boolean hasNext() { |
||||
return currentIndex.get() < (transactions.size()); |
||||
} |
||||
|
||||
@Override |
||||
public TransactionTrace next() { |
||||
return new TransactionTrace( |
||||
transactions.get(currentIndex.getAndIncrement()), Optional.of(block)); |
||||
} |
||||
} |
@ -0,0 +1,125 @@ |
||||
/* |
||||
* Copyright Hyperledger Besu Contributors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on |
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the |
||||
* specific language governing permissions and limitations under the License. |
||||
* |
||||
* SPDX-License-Identifier: Apache-2.0 |
||||
*/ |
||||
package org.hyperledger.besu.ethereum.api.jsonrpc.internal.results; |
||||
|
||||
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.tracing.diff.StateDiffTrace; |
||||
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.tracing.flat.FlatTrace; |
||||
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.tracing.vm.VmTrace; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
import com.fasterxml.jackson.annotation.JsonGetter; |
||||
import com.fasterxml.jackson.annotation.JsonInclude; |
||||
import com.fasterxml.jackson.annotation.JsonInclude.Include; |
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder; |
||||
|
||||
@JsonPropertyOrder({"output", "revertReason", "stateDiff", "trace", "transactionHash", "vmTrace"}) |
||||
public class TraceReplayResult { |
||||
private final String output; |
||||
private final String revertReason; |
||||
private final StateDiffTrace stateDiff; |
||||
private final List<FlatTrace> traces; |
||||
private final VmTrace vmTrace; |
||||
private final String transactionHash; |
||||
|
||||
public TraceReplayResult( |
||||
final String output, |
||||
final String revertReason, |
||||
final StateDiffTrace stateDiff, |
||||
final List<FlatTrace> traces, |
||||
final String transactionHash, |
||||
final VmTrace vmTrace) { |
||||
this.output = output; |
||||
this.revertReason = revertReason; |
||||
this.stateDiff = stateDiff; |
||||
this.traces = traces; |
||||
this.transactionHash = transactionHash; |
||||
this.vmTrace = vmTrace; |
||||
} |
||||
|
||||
@JsonGetter(value = "output") |
||||
public String getOutput() { |
||||
return output; |
||||
} |
||||
|
||||
@JsonInclude(Include.NON_NULL) |
||||
@JsonGetter(value = "revertReason") |
||||
public String getRevertReason() { |
||||
return revertReason; |
||||
} |
||||
|
||||
@JsonGetter(value = "stateDiff") |
||||
public StateDiffTrace getStateDiff() { |
||||
return stateDiff; |
||||
} |
||||
|
||||
@JsonGetter(value = "trace") |
||||
public List<FlatTrace> getTraces() { |
||||
return traces; |
||||
} |
||||
|
||||
@JsonGetter(value = "vmTrace") |
||||
public VmTrace getVmTrace() { |
||||
return vmTrace; |
||||
} |
||||
|
||||
@JsonGetter(value = "transactionHash") |
||||
public String getTransactionHash() { |
||||
return transactionHash; |
||||
} |
||||
|
||||
public static Builder builder() { |
||||
return new Builder(); |
||||
} |
||||
|
||||
public static class Builder { |
||||
private String output; |
||||
private String revertReason; |
||||
private StateDiffTrace stateDiff; |
||||
private final List<FlatTrace> traces = new ArrayList<>(); |
||||
private VmTrace vmTrace; |
||||
private String transactionHash; |
||||
|
||||
public TraceReplayResult build() { |
||||
return new TraceReplayResult( |
||||
output, revertReason, stateDiff, traces, transactionHash, vmTrace); |
||||
} |
||||
|
||||
public void output(final String output) { |
||||
this.output = output; |
||||
} |
||||
|
||||
public void revertReason(final String revertReason) { |
||||
this.revertReason = revertReason; |
||||
} |
||||
|
||||
public void stateDiff(final StateDiffTrace stateDiff) { |
||||
this.stateDiff = stateDiff; |
||||
} |
||||
|
||||
public void transactionHash(final String transactionHash) { |
||||
this.transactionHash = transactionHash; |
||||
} |
||||
|
||||
public void addTrace(final FlatTrace trace) { |
||||
traces.add(trace); |
||||
} |
||||
|
||||
public void vmTrace(final VmTrace vmTrace) { |
||||
this.vmTrace = vmTrace; |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue