Add Tuweni to Plugin-APIs (#295)

Generally, byte[] -> Bytes of some form.  Most of the changes are the
side effect of the type changes or chaning to the names of Tuweni
equivilant calls (getHexString->toHexString, etc).

UnformattedData -> Bytes
Log Topics went from Hash to Bytes32
Difficulty went to UInt256 to match core impl.
Quantity lost BinaryData and is just getValue() and toHexString()

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
pull/299/head
Danno Ferrin 5 years ago committed by GitHub
parent 8675a6632a
commit 66a4cd8bf9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 17
      besu/src/main/java/org/hyperledger/besu/services/BesuEventsImpl.java
  2. 4
      besu/src/test/java/org/hyperledger/besu/services/BesuEventsImplTest.java
  3. 2
      consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/IbftBlockInterface.java
  4. 2
      consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/queries/IbftQueryServiceImpl.java
  5. 3
      ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcResponseUtils.java
  6. 3
      ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/PrivGetPrivateTransactionIntegrationTest.java
  7. 2
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/graphql/internal/pojoadapter/LogAdapter.java
  8. 2
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/Action.java
  9. 11
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/FlatTraceGenerator.java
  10. 2
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/query/TransactionLogsIndexer.java
  11. 3
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/SimpleTestTransactionBuilder.java
  12. 3
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/filter/FilterManagerLogFilterTest.java
  13. 3
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetFilterChangesTest.java
  14. 3
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetFilterLogsTest.java
  15. 2
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthSubmitWorkTest.java
  16. 6
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/privacy/methods/priv/PrivGetPrivateTransactionTest.java
  17. 6
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/query/BlockchainQueriesLogCacheTest.java
  18. 2
      ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/AbstractMinerExecutor.java
  19. 2
      ethereum/core/src/integration-test/java/org/hyperledger/besu/ethereum/worldstate/PrunerIntegrationTest.java
  20. 12
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/Address.java
  21. 20
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/BlockHeader.java
  22. 14
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/Difficulty.java
  23. 14
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/Hash.java
  24. 11
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/Log.java
  25. 17
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/LogTopic.java
  26. 5
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/LogWithMetadata.java
  27. 13
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/LogsBloomFilter.java
  28. 6
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/SealableBlockHeader.java
  29. 11
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/Transaction.java
  30. 40
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/UnformattedDataImpl.java
  31. 19
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/Wei.java
  32. 2
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/headervalidationrules/ProofOfWorkValidationRule.java
  33. 2
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/privacy/storage/PrivateStateKeyValueStorage.java
  34. 11
      ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/NonBesuBlockHeader.java
  35. 2
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/chain/GenesisStateTest.java
  36. 2
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/headervalidationrules/ProofOfWorkValidationRuleTest.java
  37. 4
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/worldstate/MarkSweepPrunerTest.java
  38. 2
      ethereum/retesteth/src/test/java/org/hyperledger/besu/ethereum/retesteth/methods/TestSetChainParamsTest.java
  39. 7
      plugin-api/build.gradle
  40. 6
      plugin-api/src/main/java/org/hyperledger/besu/plugin/data/Address.java
  41. 48
      plugin-api/src/main/java/org/hyperledger/besu/plugin/data/BinaryData.java
  42. 8
      plugin-api/src/main/java/org/hyperledger/besu/plugin/data/BlockHeader.java
  43. 9
      plugin-api/src/main/java/org/hyperledger/besu/plugin/data/Hash.java
  44. 7
      plugin-api/src/main/java/org/hyperledger/besu/plugin/data/Log.java
  45. 7
      plugin-api/src/main/java/org/hyperledger/besu/plugin/data/LogWithMetadata.java
  46. 6
      plugin-api/src/main/java/org/hyperledger/besu/plugin/data/PropagatedBlockContext.java
  47. 9
      plugin-api/src/main/java/org/hyperledger/besu/plugin/data/Quantity.java
  48. 8
      plugin-api/src/main/java/org/hyperledger/besu/plugin/data/Transaction.java
  49. 21
      plugin-api/src/main/java/org/hyperledger/besu/plugin/data/UnformattedData.java
  50. 5
      plugin-api/src/main/java/org/hyperledger/besu/plugin/services/BesuEvents.java

@ -26,16 +26,14 @@ import org.hyperledger.besu.ethereum.eth.sync.state.SyncState;
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool;
import org.hyperledger.besu.plugin.data.Address;
import org.hyperledger.besu.plugin.data.BlockHeader;
import org.hyperledger.besu.plugin.data.Hash;
import org.hyperledger.besu.plugin.data.PropagatedBlockContext;
import org.hyperledger.besu.plugin.data.Quantity;
import org.hyperledger.besu.plugin.data.UnformattedData;
import org.hyperledger.besu.plugin.services.BesuEvents;
import java.util.List;
import java.util.function.Supplier;
import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.Bytes32;
import org.apache.tuweni.units.bigints.UInt256;
public class BesuEventsImpl implements BesuEvents {
private final Blockchain blockchain;
@ -101,7 +99,9 @@ public class BesuEventsImpl implements BesuEvents {
@Override
public long addLogListener(
final List<Address> addresses, final List<List<Hash>> topics, final LogListener logListener) {
final List<Address> addresses,
final List<List<Bytes32>> topics,
final LogListener logListener) {
final List<org.hyperledger.besu.ethereum.core.Address> besuAddresses =
addresses.stream()
.map(org.hyperledger.besu.ethereum.core.Address::fromPlugin)
@ -111,8 +111,7 @@ public class BesuEventsImpl implements BesuEvents {
.map(
subList ->
subList.stream()
.map(UnformattedData::getByteArray)
.map(bytes -> LogTopic.wrap(Bytes.wrap(bytes)))
.map(bytes -> LogTopic.wrap(bytes))
.collect(toUnmodifiableList()))
.collect(toUnmodifiableList());
@ -141,8 +140,8 @@ public class BesuEventsImpl implements BesuEvents {
}
@Override
public Quantity getTotalDifficulty() {
return totalDifficultySupplier.get();
public UInt256 getTotalDifficulty() {
return totalDifficultySupplier.get().toUInt256();
}
};
}

@ -187,7 +187,7 @@ public class BesuEventsImplTest {
assertThat(result.get()).isNotNull();
assertThat(result.get().getBlockHeader()).isEqualTo(block.getHeader());
assertThat(result.get().getTotalDifficulty().getValue()).isEqualTo(BigInteger.ONE);
assertThat(result.get().getTotalDifficulty().toBigInteger()).isEqualTo(BigInteger.ONE);
}
@Test
@ -201,7 +201,7 @@ public class BesuEventsImplTest {
assertThat(result.get()).isNotNull();
assertThat(result.get().getBlockHeader()).isEqualTo(block.getHeader());
assertThat(result.get().getTotalDifficulty().getValue()).isEqualTo(BigInteger.valueOf(2L));
assertThat(result.get().getTotalDifficulty().toBigInteger()).isEqualTo(BigInteger.valueOf(2L));
serviceImpl.removeBlockPropagatedListener(id);
result.set(null);

@ -35,7 +35,7 @@ public class IbftBlockInterface implements BlockInterface {
@Override
public Address getProposerOfBlock(final org.hyperledger.besu.plugin.data.BlockHeader header) {
return Address.fromHexString(header.getCoinbase().getHexString());
return Address.fromHexString(header.getCoinbase().toHexString());
}
@Override

@ -60,7 +60,7 @@ public class IbftQueryServiceImpl extends PoaQueryServiceImpl implements IbftQue
return (BlockHeader) header;
}
final Hash blockHash = Hash.wrap(Bytes32.wrap(header.getBlockHash().getByteArray()));
final Hash blockHash = Hash.wrap(Bytes32.wrap(header.getBlockHash().toArray()));
return getBlockchain().getBlockHeader(blockHash).orElseThrow();
}
}

@ -48,7 +48,6 @@ import org.hyperledger.besu.ethereum.core.Difficulty;
import org.hyperledger.besu.ethereum.core.Hash;
import org.hyperledger.besu.ethereum.core.LogsBloomFilter;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.UnformattedDataImpl;
import org.hyperledger.besu.ethereum.core.Wei;
import org.hyperledger.besu.ethereum.mainnet.MainnetBlockHeaderFunctions;
@ -165,7 +164,7 @@ public class JsonRpcResponseUtils {
when(transaction.getHash()).thenReturn(hash(hash));
when(transaction.getTo()).thenReturn(Optional.ofNullable(address(toAddress)));
when(transaction.getSender()).thenReturn(address(fromAddress));
when(transaction.getPayload()).thenReturn(new UnformattedDataImpl(bytes(input)));
when(transaction.getPayload()).thenReturn(bytes(input));
when(transaction.getValue()).thenReturn(wei(value));
when(transaction.getGasLimit()).thenReturn(unsignedLong(gas));

@ -36,7 +36,6 @@ import org.hyperledger.besu.ethereum.core.Address;
import org.hyperledger.besu.ethereum.core.Hash;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.UnformattedDataImpl;
import org.hyperledger.besu.ethereum.core.Wei;
import org.hyperledger.besu.ethereum.privacy.PrivacyController;
import org.hyperledger.besu.ethereum.privacy.PrivateTransaction;
@ -165,7 +164,7 @@ public class PrivGetPrivateTransactionIntegrationTest {
final SendResponse sendResponse = enclave.send(payload, ENCLAVE_PUBLIC_KEY, to);
final Bytes hexKey = Bytes.fromBase64String(sendResponse.getKey());
when(justTransaction.getPayload()).thenReturn(new UnformattedDataImpl(hexKey));
when(justTransaction.getPayload()).thenReturn(hexKey);
final Object[] params = new Object[] {Hash.ZERO};

@ -45,7 +45,7 @@ public class LogAdapter extends AdapterBase {
}
public Optional<Bytes> getData() {
return Optional.of(Bytes.wrap(logWithMetadata.getData().getByteArray()));
return Optional.of(logWithMetadata.getData());
}
public Optional<TransactionAdapter> getTransaction(final DataFetchingEnvironment environment) {

@ -179,7 +179,7 @@ public class Action {
public static Builder from(final TransactionTrace trace) {
return new Builder()
.from(trace.getTransaction().getSender().getHexString())
.from(trace.getTransaction().getSender().toHexString())
.gas(trace.getTraceFrames().get(0).getGasRemaining().toHexString())
.value(Quantity.create(trace.getTransaction().getValue()));
}

@ -20,7 +20,6 @@ import org.hyperledger.besu.ethereum.core.Gas;
import org.hyperledger.besu.ethereum.core.Wei;
import org.hyperledger.besu.ethereum.debug.TraceFrame;
import org.hyperledger.besu.ethereum.vm.GasCalculator;
import org.hyperledger.besu.plugin.data.UnformattedData;
import java.util.ArrayDeque;
import java.util.ArrayList;
@ -58,7 +57,7 @@ public class FlatTraceGenerator {
final GasCalculator gasCalculator) {
final FlatTrace.Builder firstFlatTraceBuilder = FlatTrace.freshBuilder(transactionTrace);
final String lastContractAddress =
transactionTrace.getTransaction().getTo().orElse(Address.ZERO).getHexString();
transactionTrace.getTransaction().getTo().orElse(Address.ZERO).toHexString();
final Optional<String> smartContractCode =
transactionTrace.getTransaction().getInit().isPresent()
@ -70,7 +69,7 @@ public class FlatTraceGenerator {
Address.contractAddress(
transactionTrace.getTransaction().getSender(),
transactionTrace.getTransaction().getNonce())
.getHexString())
.toHexString())
: Optional.empty();
// set code field in result node
smartContractCode.ifPresent(firstFlatTraceBuilder.getResultBuilder()::code);
@ -78,7 +77,7 @@ public class FlatTraceGenerator {
transactionTrace
.getTransaction()
.getInit()
.map(UnformattedData::getHexString)
.map(Bytes::toHexString)
.ifPresent(firstFlatTraceBuilder.getActionBuilder()::init);
// set to, input and callType fields if not a smart contract
transactionTrace
@ -94,12 +93,12 @@ public class FlatTraceGenerator {
transactionTrace
.getTransaction()
.getData()
.map(UnformattedData::getHexString)
.map(Bytes::toHexString)
.orElse(
transactionTrace
.getTransaction()
.getInit()
.map(UnformattedData::getHexString)
.map(Bytes::toHexString)
.orElse(Bytes.EMPTY.toHexString()))));
// declare a queue of transactionTrace contexts
final Deque<FlatTrace.Context> tracesContexts = new ArrayDeque<>();

@ -117,7 +117,7 @@ public class TransactionLogsIndexer {
if (maybeHeader.isEmpty()) {
break;
}
final byte[] logs = maybeHeader.get().getLogsBloom().getByteArray();
final byte[] logs = maybeHeader.get().getLogsBloom().toArray();
checkNotNull(logs);
checkState(logs.length == 256, "BloomBits are not the correct length");
fos.write(logs);

@ -20,7 +20,6 @@ import static org.mockito.Mockito.when;
import org.hyperledger.besu.ethereum.core.Address;
import org.hyperledger.besu.ethereum.core.Hash;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.UnformattedDataImpl;
import org.hyperledger.besu.ethereum.core.Wei;
import java.math.BigInteger;
@ -69,7 +68,7 @@ public class SimpleTestTransactionBuilder {
when(transaction.getS()).thenReturn(bigInteger(s));
when(transaction.getTo()).thenReturn(Optional.ofNullable(address(toAddress)));
when(transaction.getSender()).thenReturn(address(fromAddress));
when(transaction.getPayload()).thenReturn(new UnformattedDataImpl(Bytes.fromHexString(input)));
when(transaction.getPayload()).thenReturn(Bytes.fromHexString(input));
when(transaction.getValue()).thenReturn(wei(value));
when(transaction.getGasLimit()).thenReturn(unsignedLong(gas));
return transaction;

@ -35,7 +35,6 @@ import org.hyperledger.besu.ethereum.core.Block;
import org.hyperledger.besu.ethereum.core.BlockDataGenerator;
import org.hyperledger.besu.ethereum.core.Hash;
import org.hyperledger.besu.ethereum.core.LogWithMetadata;
import org.hyperledger.besu.ethereum.core.UnformattedDataImpl;
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool;
import java.util.List;
@ -200,7 +199,7 @@ public class FilterManagerLogFilterTest {
Hash.ZERO,
0,
Address.fromHexString("0x0"),
new UnformattedDataImpl(Bytes.EMPTY),
Bytes.EMPTY,
Lists.newArrayList(),
false);
}

@ -34,7 +34,6 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.LogsResult;
import org.hyperledger.besu.ethereum.core.Address;
import org.hyperledger.besu.ethereum.core.Hash;
import org.hyperledger.besu.ethereum.core.LogWithMetadata;
import org.hyperledger.besu.ethereum.core.UnformattedDataImpl;
import java.util.List;
import java.util.stream.Collectors;
@ -203,7 +202,7 @@ public class EthGetFilterChangesTest {
Hash.ZERO,
0,
Address.fromHexString("0x0"),
new UnformattedDataImpl(Bytes.EMPTY),
Bytes.EMPTY,
Lists.newArrayList(),
false);
}

@ -32,7 +32,6 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.LogsResult;
import org.hyperledger.besu.ethereum.core.Address;
import org.hyperledger.besu.ethereum.core.Hash;
import org.hyperledger.besu.ethereum.core.LogWithMetadata;
import org.hyperledger.besu.ethereum.core.UnformattedDataImpl;
import java.util.ArrayList;
import java.util.Collections;
@ -137,7 +136,7 @@ public class EthGetFilterLogsTest {
Hash.ZERO,
0,
Address.fromHexString("0x0"),
new UnformattedDataImpl(Bytes.EMPTY),
Bytes.EMPTY,
Lists.newArrayList(),
false));
}

@ -104,7 +104,7 @@ public class EthSubmitWorkTest {
requestWithParams(
Bytes.ofUnsignedLong(expectedFirstOutput.getNonce()).trimLeadingZeros().toHexString(),
Bytes.wrap(expectedFirstOutput.getPowHash()).toHexString(),
expectedFirstOutput.getMixHash().getHexString());
expectedFirstOutput.getMixHash().toHexString());
final JsonRpcResponse expectedResponse =
new JsonRpcSuccessResponse(request.getRequest().getId(), true);
when(miningCoordinator.getWorkDefinition()).thenReturn(Optional.of(firstInputs));

@ -38,7 +38,6 @@ import org.hyperledger.besu.ethereum.core.Address;
import org.hyperledger.besu.ethereum.core.Hash;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.UnformattedDataImpl;
import org.hyperledger.besu.ethereum.core.Wei;
import org.hyperledger.besu.ethereum.privacy.PrivacyController;
import org.hyperledger.besu.ethereum.privacy.PrivateTransaction;
@ -121,7 +120,7 @@ public class PrivGetPrivateTransactionTest {
when(blockchain.transactionByHash(any(Hash.class)))
.thenReturn(Optional.of(returnedTransaction));
when(returnedTransaction.getTransaction()).thenReturn(justTransaction);
when(justTransaction.getPayload()).thenReturn(new UnformattedDataImpl(ENCLAVE_KEY));
when(justTransaction.getPayload()).thenReturn(ENCLAVE_KEY);
final PrivateTransaction privateTransaction =
privateTransactionBuilder
@ -158,8 +157,7 @@ public class PrivGetPrivateTransactionTest {
when(blockchain.transactionByHash(any(Hash.class)))
.thenReturn(Optional.of(returnedTransaction));
when(returnedTransaction.getTransaction()).thenReturn(justTransaction);
when(justTransaction.getPayload())
.thenReturn(new UnformattedDataImpl(Bytes.fromBase64String("")));
when(justTransaction.getPayload()).thenReturn(Bytes.fromBase64String(""));
final PrivateTransaction privateTransaction =
privateTransactionBuilder

@ -85,9 +85,9 @@ public class BlockchainQueriesLogCacheTest {
private static void writeThreeEntries(final LogsBloomFilter filter, final RandomAccessFile file)
throws IOException {
file.write(filter.getByteArray());
file.write(filter.getByteArray());
file.write(filter.getByteArray());
file.write(filter.toArray());
file.write(filter.toArray());
file.write(filter.toArray());
}
@Before

@ -106,7 +106,7 @@ public abstract class AbstractMinerExecutor<
}
public void setMinTransactionGasPrice(final Wei minTransactionGasPrice) {
this.minTransactionGasPrice = minTransactionGasPrice.copy();
this.minTransactionGasPrice = minTransactionGasPrice;
}
public Wei getMinTransactionGasPrice() {

@ -201,7 +201,7 @@ public class PrunerIntegrationTest {
final StateTrieAccountValue accountValue =
StateTrieAccountValue.readFrom(RLP.input(val));
stateStorage
.get(accountValue.getCodeHash().getByteArray())
.get(accountValue.getCodeHash().toArray())
.ifPresent(v -> collector.add(Bytes.wrap(v)));
storageRoots.add(accountValue.getStorageRoot());
});

@ -180,16 +180,6 @@ public class Address extends DelegatingBytes implements org.hyperledger.besu.plu
}
public static Address fromPlugin(final org.hyperledger.besu.plugin.data.Address logger) {
return logger instanceof Address ? (Address) logger : wrap(Bytes.wrap(logger.getByteArray()));
}
@Override
public byte[] getByteArray() {
return toArrayUnsafe();
}
@Override
public String getHexString() {
return toHexString();
return logger instanceof Address ? (Address) logger : wrap(logger.copy());
}
}

@ -215,21 +215,21 @@ public class BlockHeader extends SealableBlockHeader
final org.hyperledger.besu.plugin.data.BlockHeader pluginBlockHeader,
final BlockHeaderFunctions blockHeaderFunctions) {
return new org.hyperledger.besu.ethereum.core.BlockHeader(
Hash.fromHexString(pluginBlockHeader.getParentHash().getHexString()),
Hash.fromHexString(pluginBlockHeader.getOmmersHash().getHexString()),
Hash.fromHexString(pluginBlockHeader.getParentHash().toHexString()),
Hash.fromHexString(pluginBlockHeader.getOmmersHash().toHexString()),
org.hyperledger.besu.ethereum.core.Address.fromHexString(
pluginBlockHeader.getCoinbase().getHexString()),
Hash.fromHexString(pluginBlockHeader.getStateRoot().getHexString()),
Hash.fromHexString(pluginBlockHeader.getTransactionsRoot().getHexString()),
Hash.fromHexString(pluginBlockHeader.getReceiptsRoot().getHexString()),
LogsBloomFilter.fromHexString(pluginBlockHeader.getLogsBloom().getHexString()),
Difficulty.fromHexString(pluginBlockHeader.getDifficulty().getHexString()),
pluginBlockHeader.getCoinbase().toHexString()),
Hash.fromHexString(pluginBlockHeader.getStateRoot().toHexString()),
Hash.fromHexString(pluginBlockHeader.getTransactionsRoot().toHexString()),
Hash.fromHexString(pluginBlockHeader.getReceiptsRoot().toHexString()),
LogsBloomFilter.fromHexString(pluginBlockHeader.getLogsBloom().toHexString()),
Difficulty.fromHexString(pluginBlockHeader.getDifficulty().toHexString()),
pluginBlockHeader.getNumber(),
pluginBlockHeader.getGasLimit(),
pluginBlockHeader.getGasUsed(),
pluginBlockHeader.getTimestamp(),
Bytes.wrap(pluginBlockHeader.getExtraData().getByteArray()),
Hash.fromHexString(pluginBlockHeader.getMixHash().getHexString()),
pluginBlockHeader.getExtraData(),
Hash.fromHexString(pluginBlockHeader.getMixHash().toHexString()),
pluginBlockHeader.getNonce(),
blockHeaderFunctions);
}

@ -73,18 +73,8 @@ public final class Difficulty extends BaseUInt256Value<Difficulty> implements Qu
}
@Override
public byte[] getByteArray() {
return toBytes().toArray();
}
@Override
public String getHexString() {
return toHexString();
}
@Override
public int size() {
return toMinimalBytes().size();
public String toHexString() {
return super.toHexString();
}
@Override

@ -69,18 +69,6 @@ public class Hash extends DelegatingBytes32 implements org.hyperledger.besu.plug
}
public static Hash fromPlugin(final org.hyperledger.besu.plugin.data.Hash blockHash) {
return blockHash instanceof Hash
? (Hash) blockHash
: wrap(Bytes32.wrap(blockHash.getByteArray()));
}
@Override
public byte[] getByteArray() {
return toArrayUnsafe();
}
@Override
public String getHexString() {
return toHexString();
return blockHash instanceof Hash ? (Hash) blockHash : wrap(blockHash);
}
}

@ -16,7 +16,6 @@ package org.hyperledger.besu.ethereum.core;
import org.hyperledger.besu.ethereum.rlp.RLPInput;
import org.hyperledger.besu.ethereum.rlp.RLPOutput;
import org.hyperledger.besu.plugin.data.UnformattedData;
import java.util.List;
import java.util.Objects;
@ -32,7 +31,7 @@ import org.apache.tuweni.bytes.Bytes;
public class Log implements org.hyperledger.besu.plugin.data.Log {
private final Address logger;
private final UnformattedData data;
private final Bytes data;
private final ImmutableList<LogTopic> topics;
/**
@ -41,10 +40,6 @@ public class Log implements org.hyperledger.besu.plugin.data.Log {
* @param topics Indexable topics associated with this log.
*/
public Log(final Address logger, final Bytes data, final List<LogTopic> topics) {
this(logger, (UnformattedData) new UnformattedDataImpl(data), topics);
}
protected Log(final Address logger, final UnformattedData data, final List<LogTopic> topics) {
this.logger = logger;
this.data = data;
this.topics = ImmutableList.copyOf(topics);
@ -59,7 +54,7 @@ public class Log implements org.hyperledger.besu.plugin.data.Log {
out.startList();
out.writeBytes(logger);
out.writeList(topics, (topic, listOut) -> listOut.writeBytes(topic));
out.writeBytes(Bytes.wrap(data.getByteArray()));
out.writeBytes(data);
out.endList();
}
@ -84,7 +79,7 @@ public class Log implements org.hyperledger.besu.plugin.data.Log {
}
@Override
public UnformattedData getData() {
public Bytes getData() {
return data;
}

@ -16,21 +16,16 @@ package org.hyperledger.besu.ethereum.core;
import org.hyperledger.besu.ethereum.rlp.RLPInput;
import org.hyperledger.besu.ethereum.rlp.RLPOutput;
import org.hyperledger.besu.plugin.data.UnformattedData;
import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.DelegatingBytes32;
public class LogTopic extends DelegatingBytes32 implements UnformattedData {
public class LogTopic extends DelegatingBytes32 {
protected LogTopic(final Bytes bytes) {
super(bytes);
}
public static LogTopic create(final UnformattedData data) {
return create(Bytes.wrap(data.getByteArray()));
}
public static LogTopic create(final Bytes bytes) {
return new LogTopic(bytes);
}
@ -65,14 +60,4 @@ public class LogTopic extends DelegatingBytes32 implements UnformattedData {
public void writeTo(final RLPOutput out) {
out.writeBytes(this);
}
@Override
public byte[] getByteArray() {
return toArray();
}
@Override
public String getHexString() {
return toHexString();
}
}

@ -16,13 +16,12 @@
*/
package org.hyperledger.besu.ethereum.core;
import org.hyperledger.besu.plugin.data.UnformattedData;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import com.google.common.base.MoreObjects;
import org.apache.tuweni.bytes.Bytes;
public class LogWithMetadata extends Log
implements org.hyperledger.besu.plugin.data.LogWithMetadata {
@ -41,7 +40,7 @@ public class LogWithMetadata extends Log
final Hash transactionHash,
final int transactionIndex,
final Address address,
final UnformattedData data,
final Bytes data,
final List<LogTopic> topics,
final boolean removed) {
super(address, data, topics);

@ -19,7 +19,6 @@ import static org.hyperledger.besu.crypto.Hash.keccak256;
import org.hyperledger.besu.ethereum.rlp.RLPException;
import org.hyperledger.besu.ethereum.rlp.RLPInput;
import org.hyperledger.besu.plugin.data.UnformattedData;
import java.util.Collection;
@ -36,7 +35,7 @@ import org.apache.tuweni.bytes.MutableBytes;
* corresponding double-bytes are: bd2b, 01af, cd27, corresponding to the following bits in the
* bloom filter: 1323, 431, 1319
*/
public class LogsBloomFilter extends DelegatingBytes implements UnformattedData {
public class LogsBloomFilter extends DelegatingBytes {
public static final int BYTE_SIZE = 256;
private static final int LEAST_SIGNIFICANT_BYTE = 0xFF;
@ -100,16 +99,6 @@ public class LogsBloomFilter extends DelegatingBytes implements UnformattedData
return true;
}
@Override
public byte[] getByteArray() {
return toArray();
}
@Override
public String getHexString() {
return toHexString();
}
public static Builder builder() {
return new Builder();
}

@ -30,7 +30,7 @@ public class SealableBlockHeader extends ProcessableBlockHeader {
protected final long gasUsed;
protected final UnformattedDataImpl extraData;
protected final Bytes extraData;
protected SealableBlockHeader(
final Hash parentHash,
@ -53,7 +53,7 @@ public class SealableBlockHeader extends ProcessableBlockHeader {
this.receiptsRoot = receiptsRoot;
this.logsBloom = logsBloom;
this.gasUsed = gasUsed;
this.extraData = new UnformattedDataImpl(extraData);
this.extraData = extraData;
}
/**
@ -115,7 +115,7 @@ public class SealableBlockHeader extends ProcessableBlockHeader {
*
* @return the raw bytes of the extra data field
*/
public UnformattedDataImpl getExtraData() {
public Bytes getExtraData() {
return extraData;
}
}

@ -22,7 +22,6 @@ import org.hyperledger.besu.ethereum.rlp.RLP;
import org.hyperledger.besu.ethereum.rlp.RLPException;
import org.hyperledger.besu.ethereum.rlp.RLPInput;
import org.hyperledger.besu.ethereum.rlp.RLPOutput;
import org.hyperledger.besu.plugin.data.UnformattedData;
import java.math.BigInteger;
import java.util.Objects;
@ -60,7 +59,7 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
private final SECP256K1.Signature signature;
private final UnformattedDataImpl payload;
private final Bytes payload;
private final Optional<BigInteger> chainId;
@ -147,7 +146,7 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
this.to = to;
this.value = value;
this.signature = signature;
this.payload = new UnformattedDataImpl(payload);
this.payload = payload;
this.sender = sender;
this.chainId = chainId;
}
@ -220,7 +219,7 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
* @return the transaction payload
*/
@Override
public UnformattedDataImpl getPayload() {
public Bytes getPayload() {
return payload;
}
@ -230,7 +229,7 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
* @return if present the init code
*/
@Override
public Optional<UnformattedData> getInit() {
public Optional<Bytes> getInit() {
return getTo().isPresent() ? Optional.empty() : Optional.of(payload);
}
@ -240,7 +239,7 @@ public class Transaction implements org.hyperledger.besu.plugin.data.Transaction
* @return if present the init code
*/
@Override
public Optional<UnformattedData> getData() {
public Optional<Bytes> getData() {
return getTo().isPresent() ? Optional.of(payload) : Optional.empty();
}

@ -1,40 +0,0 @@
/*
*
* Copyright ConsenSys AG.
*
* 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.core;
import org.hyperledger.besu.plugin.data.UnformattedData;
import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.DelegatingBytes;
/** Wrapper for a Bytes value to be exposed as UnformattedData. */
public class UnformattedDataImpl extends DelegatingBytes implements UnformattedData {
public UnformattedDataImpl(final Bytes value) {
super(value);
}
@Override
public byte[] getByteArray() {
return toArray();
}
@Override
public String getHexString() {
return toHexString();
}
}

@ -73,22 +73,7 @@ public final class Wei extends BaseUInt256Value<Wei> implements Quantity {
}
@Override
public byte[] getByteArray() {
return toBytes().toArray();
}
@Override
public String getHexString() {
return toHexString();
}
@Override
public int size() {
return toMinimalBytes().size();
}
@Override
public Wei copy() {
return super.copy();
public String toHexString() {
return super.toHexString();
}
}

@ -40,7 +40,7 @@ public final class ProofOfWorkValidationRule implements DetachedBlockHeaderValid
public boolean validate(final BlockHeader header, final BlockHeader parent) {
final byte[] hashBuffer = new byte[64];
final Hash headerHash = hashHeader(header);
HASHER.hash(hashBuffer, header.getNonce(), header.getNumber(), headerHash.getByteArray());
HASHER.hash(hashBuffer, header.getNonce(), header.getNumber(), headerHash.toArray());
if (header.getDifficulty().isZero()) {
LOG.trace("Rejecting header because difficulty is 0");

@ -120,7 +120,7 @@ public class PrivateStateKeyValueStorage implements PrivateStateStorage {
@Override
public Updater putLatestStateRoot(final Bytes privacyId, final Hash privateStateHash) {
transaction.put(privacyId.toArrayUnsafe(), privateStateHash.getByteArray());
transaction.put(privacyId.toArrayUnsafe(), privateStateHash.toArray());
return this;
}

@ -18,14 +18,15 @@ import org.hyperledger.besu.plugin.data.Address;
import org.hyperledger.besu.plugin.data.BlockHeader;
import org.hyperledger.besu.plugin.data.Hash;
import org.hyperledger.besu.plugin.data.Quantity;
import org.hyperledger.besu.plugin.data.UnformattedData;
import org.apache.tuweni.bytes.Bytes;
public class NonBesuBlockHeader implements BlockHeader {
final Hash blockHash;
final UnformattedData extraData;
final Bytes extraData;
public NonBesuBlockHeader(final Hash blockHash, final UnformattedData extraData) {
public NonBesuBlockHeader(final Hash blockHash, final Bytes extraData) {
this.blockHash = blockHash;
this.extraData = extraData;
}
@ -61,7 +62,7 @@ public class NonBesuBlockHeader implements BlockHeader {
}
@Override
public UnformattedData getLogsBloom() {
public Bytes getLogsBloom() {
return null;
}
@ -91,7 +92,7 @@ public class NonBesuBlockHeader implements BlockHeader {
}
@Override
public UnformattedData getExtraData() {
public Bytes getExtraData() {
return extraData;
}

@ -148,7 +148,7 @@ public final class GenesisStateTest {
MainnetProtocolSchedule.create());
final BytesValueRLPOutput tmp = new BytesValueRLPOutput();
genesisState.getBlock().writeTo(tmp);
assertThat(Hex.toHexString(genesisState.getBlock().getHeader().getHash().getByteArray()))
assertThat(Hex.toHexString(genesisState.getBlock().getHeader().getHash().toArray()))
.isEqualTo(OLYMPIC_HASH);
assertThat(Hex.toHexString(tmp.encoded().toArray())).isEqualTo(OLYMPIC_RLP);
}

@ -91,7 +91,7 @@ public class ProofOfWorkValidationRuleTest {
final byte[] hashBuffer = new byte[64];
final Hash headerHash = validationRule.hashHeader(preHeader);
ProofOfWorkValidationRule.HASHER.hash(
hashBuffer, preHeader.getNonce(), preHeader.getNumber(), headerHash.getByteArray());
hashBuffer, preHeader.getNonce(), preHeader.getNumber(), headerHash.toArray());
final BlockHeader header =
headerBuilder

@ -178,7 +178,7 @@ public class MarkSweepPrunerTest {
}
inOrder.verify(stateStorage).removeAllKeysUnless(any());
assertThat(stateStorage.containsKey(markedRoot.getByteArray())).isTrue();
assertThat(stateStorage.containsKey(markedRoot.toArray())).isTrue();
}
private void generateBlockchainData(final int numBlocks, final int numAccounts) {
@ -219,7 +219,7 @@ public class MarkSweepPrunerTest {
final StateTrieAccountValue accountValue =
StateTrieAccountValue.readFrom(RLP.input(val));
stateStorage
.get(accountValue.getCodeHash().getByteArray())
.get(accountValue.getCodeHash().toArray())
.ifPresent(v -> collector.add(Bytes.wrap(v)));
storageRoots.add(accountValue.getStorageRoot());
});

@ -66,7 +66,7 @@ public class TestSetChainParamsTest {
assertThat(blockHeader.getCoinbase().toString())
.isEqualTo("0x8888f1f195afa192cfee860698584c030f4c9db1");
assertThat(blockHeader.getDifficulty()).isEqualTo(UInt256.fromHexString("0x20000"));
assertThat(blockHeader.getExtraData().getHexString()).isEqualTo("0x42");
assertThat(blockHeader.getExtraData().toHexString()).isEqualTo("0x42");
assertThat(blockHeader.getGasLimit()).isEqualTo(3141592);
assertThat(blockHeader.getGasUsed()).isEqualTo(0);
assertThat(blockHeader.getMixHash().toString())

@ -26,6 +26,11 @@ jar {
}
}
dependencies {
api 'org.apache.tuweni:tuweni-bytes'
api 'org.apache.tuweni:tuweni-units'
}
configurations { testArtifacts }
artifacts { testSupportArtifacts testSupportJar }
@ -56,7 +61,7 @@ Calculated : ${currentHash}
tasks.register('checkAPIChanges', FileStateChecker) {
description = "Checks that the API for the Plugin-API project does not change without deliberate thought"
files = sourceSets.main.allJava.files
knownHash = 'RyRjdM7X/tI1D45+dmcPoQpjLHkrHNO/V5jIyRnttCk='
knownHash = 'YO7d5nJU6EmP4udlXtsmufW56YHylt9WR5p6qxsXasY='
}
check.dependsOn('checkAPIChanges')

@ -16,6 +16,8 @@ package org.hyperledger.besu.plugin.data;
import org.hyperledger.besu.plugin.Unstable;
/** An interface for {@link BinaryData} that also represents an Ethereum account address. */
import org.apache.tuweni.bytes.Bytes;
/** An interface for {@link Bytes} that also represents an Ethereum account address. */
@Unstable
public interface Address extends UnformattedData {}
public interface Address extends Bytes {}

@ -1,48 +0,0 @@
/*
* Copyright ConsenSys AG.
*
* 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.plugin.data;
import org.hyperledger.besu.plugin.Unstable;
/** Super class for all types that are ultimately represented by binary data. */
@Unstable
public interface BinaryData {
/**
* The byte level representation of the binary data. This array should be treated as read only
* constant data as any changes will not be reflected in the source.
*
* @return a read-only array of the bytes of the binary data.
*/
byte[] getByteArray();
/**
* A hex string representation of the data. This hex string will represent the hex of the entire
* binary data and will be "<code>0x</code>" prefixed. APIs that depend on shortend forms will
* need to process the string.
*
* @return A string repsenting the hex encodeing of the data.
*/
String getHexString();
/**
* The size, in bytes, of the contained binary data. Because {@link #getByteArray()} may cause the
* underlying data to be copied using this size method is preferred when such a check would avoid
* a call to {@link #getByteArray()} or {@link #getHexString()}.
*
* @return The length of the binary data in bytes.
*/
int size();
}

@ -16,6 +16,8 @@ package org.hyperledger.besu.plugin.data;
import org.hyperledger.besu.plugin.Unstable;
import org.apache.tuweni.bytes.Bytes;
/**
* The minimum set of data for a BlockHeader, as defined in the <a href=
* "https://ethereum.github.io/yellowpaper/paper.pdf">Ethereum Yellow Paper</a>.
@ -82,13 +84,13 @@ public interface BlockHeader {
* @return The Bloom filter composed from indexable information (logger address and log topics)
* contained in each log entry from the receipt of each transaction in the transactions list.
*/
UnformattedData getLogsBloom();
Bytes getLogsBloom();
/**
* A scalar value corresponding to the difficulty level of this block. This can be calculated from
* the previous blocks difficulty level and the timestamp.
*
* @return A scalar value corresponding to the difficulty level of this block. This can be
* @return A UInt256 value corresponding to the difficulty level of this block. This can be
* calculated from the previous blocks difficulty level and the timestamp.
*/
Quantity getDifficulty();
@ -129,7 +131,7 @@ public interface BlockHeader {
* @return An arbitrary byte array containing data relevant to this block. This must be 32 bytes
* or fewer.
*/
UnformattedData getExtraData();
Bytes getExtraData();
/**
* A 256-bit hash which, combined with the nonce, proves that a sufficient amount of computation

@ -16,10 +16,11 @@ package org.hyperledger.besu.plugin.data;
import org.hyperledger.besu.plugin.Unstable;
import org.apache.tuweni.bytes.Bytes32;
/**
* A marker interface indicating that this {@link UnformattedData} represents a hash of some sort.
* The particular algorithm depends on the source, it may be ripemd, keccak, or some other
* algorithm.
* A marker interface indicating that this {@link Bytes32} represents a hash of some sort. The
* particular algorithm depends on the source, it may be ripemd, keccak, or some other algorithm.
*/
@Unstable
public interface Hash extends UnformattedData {}
public interface Hash extends Bytes32 {}

@ -18,6 +18,9 @@ import org.hyperledger.besu.plugin.Unstable;
import java.util.List;
import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.Bytes32;
/** A Log entry from a transaction execution. */
@Unstable
public interface Log {
@ -34,12 +37,12 @@ public interface Log {
*
* @return The list, possibly zero length, of log topics.
*/
List<? extends UnformattedData> getTopics();
List<? extends Bytes32> getTopics();
/**
* The data, of possibly unlimited length, for this log entry.
*
* @return The log data.
*/
UnformattedData getData();
Bytes getData();
}

@ -18,6 +18,9 @@ import org.hyperledger.besu.plugin.Unstable;
import java.util.List;
import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.Bytes32;
/** A Log entry from a transaction execution. */
@Unstable
public interface LogWithMetadata {
@ -34,14 +37,14 @@ public interface LogWithMetadata {
*
* @return The list, possibly zero length, of log topics.
*/
List<? extends UnformattedData> getTopics();
List<? extends Bytes32> getTopics();
/**
* The data, of possibly unlimited length, for this log entry.
*
* @return The log data.
*/
UnformattedData getData();
Bytes getData();
int getLogIndex();

@ -16,6 +16,8 @@ package org.hyperledger.besu.plugin.data;
import org.hyperledger.besu.plugin.Unstable;
import org.apache.tuweni.units.bigints.UInt256;
/** The minimum set of data for a PropagatedBlockContext. */
@Unstable
public interface PropagatedBlockContext {
@ -30,7 +32,7 @@ public interface PropagatedBlockContext {
/**
* A scalar value corresponding to the total difficulty.
*
* @return A scalar value corresponding to the total difficulty.
* @return A UInt256 value corresponding to the total difficulty.
*/
Quantity getTotalDifficulty();
UInt256 getTotalDifficulty();
}

@ -17,11 +17,11 @@ package org.hyperledger.besu.plugin.data;
import org.hyperledger.besu.plugin.Unstable;
/**
* An interface to mark the {@link BinaryData} that also represents a disceete quantity, such as an
* unsigned integer value.
* An interface to mark objects that also represents a disceete quantity, such as an unsigned
* integer value.
*/
@Unstable
public interface Quantity extends BinaryData {
public interface Quantity {
/**
* Returns the numeric value of the quantity.
@ -34,4 +34,7 @@ public interface Quantity extends BinaryData {
* @return The boxed or object based value of the quantity.
*/
Number getValue();
/** @return This value represented as hexadecimal, starting with "0x". */
String toHexString();
}

@ -19,6 +19,8 @@ import org.hyperledger.besu.plugin.Unstable;
import java.math.BigInteger;
import java.util.Optional;
import org.apache.tuweni.bytes.Bytes;
/**
* A transaction is a single cryptographically-signed instruction constructed by an actor externally
* to the scope of Ethereum. While it is assumed that the ultimate external actor will be human in
@ -125,7 +127,7 @@ public interface Transaction {
*
* @return if present, the contract init code.
*/
Optional<? extends UnformattedData> getInit();
Optional<Bytes> getInit();
/**
* An unlimited size byte array specifying theinput data of the message call.
@ -135,7 +137,7 @@ public interface Transaction {
*
* @return if present, the message call data
*/
Optional<? extends UnformattedData> getData();
Optional<Bytes> getData();
/**
* The data payload of this transaction.
@ -147,5 +149,5 @@ public interface Transaction {
*
* @return the transaction payload
*/
UnformattedData getPayload();
Bytes getPayload();
}

@ -1,21 +0,0 @@
/*
* Copyright ConsenSys AG.
*
* 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.plugin.data;
import org.hyperledger.besu.plugin.Unstable;
/** An interface to mark BinaryData that is not a scalar {@link Quantity}. */
@Unstable
public interface UnformattedData extends BinaryData {}

@ -16,7 +16,6 @@ package org.hyperledger.besu.plugin.services;
import org.hyperledger.besu.plugin.Unstable;
import org.hyperledger.besu.plugin.data.Address;
import org.hyperledger.besu.plugin.data.Hash;
import org.hyperledger.besu.plugin.data.LogWithMetadata;
import org.hyperledger.besu.plugin.data.PropagatedBlockContext;
import org.hyperledger.besu.plugin.data.SyncStatus;
@ -25,6 +24,8 @@ import org.hyperledger.besu.plugin.data.Transaction;
import java.util.List;
import java.util.Optional;
import org.apache.tuweni.bytes.Bytes32;
/**
* This service allows plugins to attach to various events during the normal operation of Besu.
*
@ -114,7 +115,7 @@ public interface BesuEvents {
* @param logListener The listener that will accept the log.
* @return The id of the listener to be referred to used to remove the listener.
*/
long addLogListener(List<Address> addresses, List<List<Hash>> topics, LogListener logListener);
long addLogListener(List<Address> addresses, List<List<Bytes32>> topics, LogListener logListener);
/**
* Remove the log listener with the associated id.

Loading…
Cancel
Save