method2testcases stringlengths 118 3.08k |
|---|
### Question:
Uint8 { public byte asByte() { return (byte) intValue; } Uint8(int intValue); byte asByte(); byte[] encode(); int intValue(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static Uint8 decode(byte[] bytes, int offset); static final int BYTES; static final Uint8... |
### Question:
Uint8 { public int intValue() { return intValue; } Uint8(int intValue); byte asByte(); byte[] encode(); int intValue(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static Uint8 decode(byte[] bytes, int offset); static final int BYTES; static final Uint8 MAX_V... |
### Question:
Uint8 { public static Uint8 decode(byte[] bytes, int offset) { int intValue = bytes[offset] & 0xFF; return new Uint8(intValue); } Uint8(int intValue); byte asByte(); byte[] encode(); int intValue(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static Uint8 dec... |
### Question:
RskAddress { @Override public boolean equals(Object other) { if (this == other) { return true; } if (other == null || this.getClass() != other.getClass()) { return false; } RskAddress otherSender = (RskAddress) other; return Arrays.equals(bytes, otherSender.bytes); } RskAddress(DataWord address); RskAddr... |
### Question:
RskAddress { public static RskAddress nullAddress() { return NULL_ADDRESS; } RskAddress(DataWord address); RskAddress(String address); RskAddress(byte[] bytes); private RskAddress(); static RskAddress nullAddress(); byte[] getBytes(); String toHexString(); @Override boolean equals(Object other); @Overr... |
### Question:
RskAddress { public String toJsonString() { if (NULL_ADDRESS.equals(this)) { return null; } return TypeConverter.toUnformattedJsonHex(this.getBytes()); } RskAddress(DataWord address); RskAddress(String address); RskAddress(byte[] bytes); private RskAddress(); static RskAddress nullAddress(); byte[] get... |
### Question:
Coin implements Comparable<Coin> { public byte[] getBytes() { return value.toByteArray(); } Coin(byte[] value); Coin(BigInteger value); byte[] getBytes(); BigInteger asBigInteger(); Coin negate(); Coin add(Coin val); Coin subtract(Coin val); Coin multiply(BigInteger val); Coin divide(BigInteger val); Coi... |
### Question:
TrieKeySlice { public TrieKeySlice leftPad(int paddingLength) { if (paddingLength == 0) { return this; } int currentLength = length(); byte[] paddedExpandedKey = new byte[currentLength + paddingLength]; System.arraycopy(expandedKey, offset, paddedExpandedKey, paddingLength, currentLength); return new Trie... |
### Question:
TrieStoreImpl implements TrieStore { @Override public Optional<Trie> retrieve(byte[] hash) { byte[] message = this.store.get(hash); if (message == null) { return Optional.empty(); } Trie trie = Trie.fromMessage(message, this); savedTries.add(trie); return Optional.of(trie); } TrieStoreImpl(KeyValueDataSou... |
### Question:
PathEncoder { @Nonnull public static byte[] encode(byte[] path) { if (path == null) { throw new IllegalArgumentException("path"); } return encodeBinaryPath(path); } private PathEncoder(); @Nonnull static byte[] encode(byte[] path); @Nonnull static byte[] decode(byte[] encoded, int length); static int cal... |
### Question:
PathEncoder { @Nonnull private static byte[] encodeBinaryPath(byte[] path) { int lpath = path.length; int lencoded = calculateEncodedLength(lpath); byte[] encoded = new byte[lencoded]; int nbyte = 0; for (int k = 0; k < lpath; k++) { int offset = k % 8; if (k > 0 && offset == 0) { nbyte++; } if (path[k] =... |
### Question:
PathEncoder { @Nonnull private static byte[] decodeBinaryPath(byte[] encoded, int bitlength) { byte[] path = new byte[bitlength]; for (int k = 0; k < bitlength; k++) { int nbyte = k / 8; int offset = k % 8; if (((encoded[nbyte] >> (7 - offset)) & 0x01) != 0) { path[k] = 1; } } return path; } private Path... |
### Question:
MultiTrieStore implements TrieStore { @Override public void save(Trie trie) { getCurrentStore().save(trie); } MultiTrieStore(int currentEpoch, int liveEpochs, TrieStoreFactory trieStoreFactory, OnEpochDispose disposer); @Override void save(Trie trie); @Override void flush(); @Override Optional<Trie> retri... |
### Question:
MultiTrieStore implements TrieStore { @Override public void flush() { epochs.forEach(TrieStore::flush); } MultiTrieStore(int currentEpoch, int liveEpochs, TrieStoreFactory trieStoreFactory, OnEpochDispose disposer); @Override void save(Trie trie); @Override void flush(); @Override Optional<Trie> retrieve(... |
### Question:
MultiTrieStore implements TrieStore { @Override public void dispose() { epochs.forEach(TrieStore::dispose); } MultiTrieStore(int currentEpoch, int liveEpochs, TrieStoreFactory trieStoreFactory, OnEpochDispose disposer); @Override void save(Trie trie); @Override void flush(); @Override Optional<Trie> retri... |
### Question:
MultiTrieStore implements TrieStore { @Override public byte[] retrieveValue(byte[] hash) { for (TrieStore epochTrieStore : epochs) { byte[] value = epochTrieStore.retrieveValue(hash); if (value != null) { return value; } } return null; } MultiTrieStore(int currentEpoch, int liveEpochs, TrieStoreFactory tr... |
### Question:
BitSet { public boolean get(int position) { if (position < 0 || position >= this.size) { throw new IndexOutOfBoundsException(String.format("Index: %s, Size: %s", position, this.size)); } int offset = position / 8; int bitoffset = position % 8; return (this.bytes[offset] & 0xff & (1 << bitoffset)) != 0; } ... |
### Question:
BitSet { public void set(int position) { if (position < 0 || position >= this.size) { throw new IndexOutOfBoundsException(String.format("Index: %s, Size: %s", position, this.size)); } int offset = position / 8; int bitoffset = position % 8; this.bytes[offset] |= 1 << bitoffset; } BitSet(int size); void se... |
### Question:
ExtractPublicKeyFromExtendedPublicKey extends NativeMethod { @Override public CallTransaction.Function getFunction() { return function; } ExtractPublicKeyFromExtendedPublicKey(ExecutionEnvironment executionEnvironment, HDWalletUtilsHelper helper); @Override CallTransaction.Function getFunction(); @Overrid... |
### Question:
ExtractPublicKeyFromExtendedPublicKey extends NativeMethod { @Override public boolean isEnabled() { return true; } ExtractPublicKeyFromExtendedPublicKey(ExecutionEnvironment executionEnvironment, HDWalletUtilsHelper helper); @Override CallTransaction.Function getFunction(); @Override Object execute(Object... |
### Question:
ExtractPublicKeyFromExtendedPublicKey extends NativeMethod { @Override public boolean onlyAllowsLocalCalls() { return false; } ExtractPublicKeyFromExtendedPublicKey(ExecutionEnvironment executionEnvironment, HDWalletUtilsHelper helper); @Override CallTransaction.Function getFunction(); @Override Object ex... |
### Question:
ExtractPublicKeyFromExtendedPublicKey extends NativeMethod { @Override public long getGas(Object[] parsedArguments, byte[] originalData) { return 11_300L; } ExtractPublicKeyFromExtendedPublicKey(ExecutionEnvironment executionEnvironment, HDWalletUtilsHelper helper); @Override CallTransaction.Function getF... |
### Question:
GetMultisigScriptHash extends NativeMethod { @Override public CallTransaction.Function getFunction() { return function; } GetMultisigScriptHash(ExecutionEnvironment executionEnvironment); @Override CallTransaction.Function getFunction(); @Override Object execute(Object[] arguments); @Override long getGas(... |
### Question:
GetMultisigScriptHash extends NativeMethod { @Override public boolean isEnabled() { return true; } GetMultisigScriptHash(ExecutionEnvironment executionEnvironment); @Override CallTransaction.Function getFunction(); @Override Object execute(Object[] arguments); @Override long getGas(Object[] parsedArgument... |
### Question:
GetMultisigScriptHash extends NativeMethod { @Override public boolean onlyAllowsLocalCalls() { return false; } GetMultisigScriptHash(ExecutionEnvironment executionEnvironment); @Override CallTransaction.Function getFunction(); @Override Object execute(Object[] arguments); @Override long getGas(Object[] pa... |
### Question:
GetMultisigScriptHash extends NativeMethod { @Override public long getGas(Object[] parsedArguments, byte[] originalData) { Object[] keys = ((Object[]) parsedArguments[1]); if (keys == null || keys.length < 2) { return BASE_COST; } return BASE_COST + (keys.length - 2) * COST_PER_EXTRA_KEY; } GetMultisigScr... |
### Question:
DeriveExtendedPublicKey extends NativeMethod { @Override public CallTransaction.Function getFunction() { return function; } DeriveExtendedPublicKey(ExecutionEnvironment executionEnvironment, HDWalletUtilsHelper helper); @Override CallTransaction.Function getFunction(); @Override Object execute(Object[] ar... |
### Question:
DeriveExtendedPublicKey extends NativeMethod { @Override public boolean isEnabled() { return true; } DeriveExtendedPublicKey(ExecutionEnvironment executionEnvironment, HDWalletUtilsHelper helper); @Override CallTransaction.Function getFunction(); @Override Object execute(Object[] arguments); @Override boo... |
### Question:
DeriveExtendedPublicKey extends NativeMethod { @Override public boolean onlyAllowsLocalCalls() { return false; } DeriveExtendedPublicKey(ExecutionEnvironment executionEnvironment, HDWalletUtilsHelper helper); @Override CallTransaction.Function getFunction(); @Override Object execute(Object[] arguments); @... |
### Question:
DeriveExtendedPublicKey extends NativeMethod { @Override public long getGas(Object[] parsedArguments, byte[] originalData) { return 107_000L; } DeriveExtendedPublicKey(ExecutionEnvironment executionEnvironment, HDWalletUtilsHelper helper); @Override CallTransaction.Function getFunction(); @Override Object... |
### Question:
HDWalletUtilsHelper { public NetworkParameters validateAndExtractNetworkFromExtendedPublicKey(String xpub) { if (xpub == null) { throw new NativeContractIllegalArgumentException(String.format("Invalid extended public key '%s'", xpub)); } if (xpub.startsWith("xpub")) { return NetworkParameters.fromID(Netwo... |
### Question:
ToBase58Check extends NativeMethod { @Override public CallTransaction.Function getFunction() { return function; } ToBase58Check(ExecutionEnvironment executionEnvironment); @Override CallTransaction.Function getFunction(); @Override Object execute(Object[] arguments); @Override boolean isEnabled(); @Overri... |
### Question:
ToBase58Check extends NativeMethod { @Override public boolean isEnabled() { return true; } ToBase58Check(ExecutionEnvironment executionEnvironment); @Override CallTransaction.Function getFunction(); @Override Object execute(Object[] arguments); @Override boolean isEnabled(); @Override boolean onlyAllowsLo... |
### Question:
ToBase58Check extends NativeMethod { @Override public boolean onlyAllowsLocalCalls() { return false; } ToBase58Check(ExecutionEnvironment executionEnvironment); @Override CallTransaction.Function getFunction(); @Override Object execute(Object[] arguments); @Override boolean isEnabled(); @Override boolean ... |
### Question:
ToBase58Check extends NativeMethod { @Override public long getGas(Object[] parsedArguments, byte[] originalData) { return 13_000L; } ToBase58Check(ExecutionEnvironment executionEnvironment); @Override CallTransaction.Function getFunction(); @Override Object execute(Object[] arguments); @Override boolean i... |
### Question:
HDWalletUtils extends NativeContract { @Override public Optional<NativeMethod> getDefaultMethod() { return Optional.empty(); } HDWalletUtils(ActivationConfig config, RskAddress contractAddress); @Override List<NativeMethod> getMethods(); @Override Optional<NativeMethod> getDefaultMethod(); }### Answer:
@... |
### Question:
HDWalletUtils extends NativeContract { @Override public List<NativeMethod> getMethods() { return Arrays.asList( new ToBase58Check(getExecutionEnvironment()), new DeriveExtendedPublicKey(getExecutionEnvironment(), helper), new ExtractPublicKeyFromExtendedPublicKey(getExecutionEnvironment(), helper), new Ge... |
### Question:
BlockHeaderContract extends NativeContract { @Override public Optional<NativeMethod> getDefaultMethod() { return Optional.empty(); } BlockHeaderContract(ActivationConfig activationConfig, RskAddress contractAddress); @Override List<NativeMethod> getMethods(); @Override Optional<NativeMethod> getDefaultMet... |
### Question:
BlockHeaderContract extends NativeContract { @Override public List<NativeMethod> getMethods() { return Arrays.asList( new GetCoinbaseAddress(getExecutionEnvironment(), this.blockAccessor), new GetBlockHash(getExecutionEnvironment(), this.blockAccessor), new GetMergedMiningTags(getExecutionEnvironment(), t... |
### Question:
NativeMethod { public ExecutionEnvironment getExecutionEnvironment() { return executionEnvironment; } NativeMethod(ExecutionEnvironment executionEnvironment); ExecutionEnvironment getExecutionEnvironment(); abstract CallTransaction.Function getFunction(); abstract Object execute(Object[] arguments); long ... |
### Question:
NativeMethod { public long getGas(Object[] parsedArguments, byte[] originalData) { return originalData == null ? 0 : originalData.length * 2; } NativeMethod(ExecutionEnvironment executionEnvironment); ExecutionEnvironment getExecutionEnvironment(); abstract CallTransaction.Function getFunction(); abstract... |
### Question:
NativeMethod { public String getName() { return getFunction().name; } NativeMethod(ExecutionEnvironment executionEnvironment); ExecutionEnvironment getExecutionEnvironment(); abstract CallTransaction.Function getFunction(); abstract Object execute(Object[] arguments); long getGas(Object[] parsedArguments,... |
### Question:
NativeMethod { public abstract Object execute(Object[] arguments); NativeMethod(ExecutionEnvironment executionEnvironment); ExecutionEnvironment getExecutionEnvironment(); abstract CallTransaction.Function getFunction(); abstract Object execute(Object[] arguments); long getGas(Object[] parsedArguments, by... |
### Question:
NativeContract extends PrecompiledContracts.PrecompiledContract { public ExecutionEnvironment getExecutionEnvironment() { return executionEnvironment; } NativeContract(ActivationConfig activationConfig, RskAddress contractAddress); ExecutionEnvironment getExecutionEnvironment(); abstract List<NativeMethod... |
### Question:
Migrator { public String migrateConfiguration() throws IOException { return migrateConfiguration( Files.newBufferedReader(configuration.getSourceConfiguration(), StandardCharsets.UTF_8), configuration.getMigrationConfiguration() ); } Migrator(MigratorConfiguration configuration); String migrateConfigurati... |
### Question:
PeerScoringManager { public boolean hasGoodReputation(NodeID id) { synchronized (accessLock) { return this.getPeerScoring(id).hasGoodReputation(); } } PeerScoringManager(
PeerScoring.Factory peerScoringFactory,
int nodePeersSize,
PunishmentParameters nodeParameters,
... |
### Question:
PeerScoring { public boolean hasGoodReputation() { try { rwlock.writeLock().lock(); if (this.goodReputation) { return true; } if (this.punishmentTime > 0 && this.timeLostGoodReputation > 0 && this.punishmentTime + this.timeLostGoodReputation <= System.currentTimeMillis()) { this.endPunishment(); } return ... |
### Question:
PeerScoring { public int getScore() { try { rwlock.readLock().lock(); return score; } finally { rwlock.readLock().unlock(); } } PeerScoring(); PeerScoring(boolean punishmentEnabled); void recordEvent(EventType evt); int getScore(); int getEventCounter(EventType evt); int getTotalEventCounter(); boolean i... |
### Question:
PeerScoring { @VisibleForTesting public long getTimeLostGoodReputation() { return this.timeLostGoodReputation; } PeerScoring(); PeerScoring(boolean punishmentEnabled); void recordEvent(EventType evt); int getScore(); int getEventCounter(EventType evt); int getTotalEventCounter(); boolean isEmpty(); boole... |
### Question:
PeerScoring { public void recordEvent(EventType evt) { try { rwlock.writeLock().lock(); counters[evt.ordinal()]++; switch (evt) { case INVALID_NETWORK: case INVALID_BLOCK: case INVALID_TRANSACTION: case INVALID_MESSAGE: case INVALID_HEADER: if (score > 0) { score = 0; } score--; break; case UNEXPECTED_MES... |
### Question:
PeerScoring { @VisibleForTesting public void startPunishment(long expirationTime) { if (!punishmentEnabled) { return; } try { rwlock.writeLock().lock(); this.goodReputation = false; this.punishmentTime = expirationTime; this.punishmentCounter++; this.timeLostGoodReputation = System.currentTimeMillis(); } ... |
### Question:
InetAddressBlock { @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (!(obj instanceof InetAddressBlock)) { return false; } InetAddressBlock block = (InetAddressBlock)obj; return block.mask == this.mask && Arrays.equals(block.bytes, this.bytes); } InetAddressBlock(InetAdd... |
### Question:
InetAddressTable { public boolean contains(InetAddress address) { if (this.addresses.contains(address)) { return true; } if (this.blocks.isEmpty()) { return false; } InetAddressBlock[] bs = this.blocks.toArray(new InetAddressBlock[0]); for (InetAddressBlock mask : bs) { if (mask.contains(address)) { retur... |
### Question:
InetAddressUtils { public static boolean hasMask(String text) { if (text == null) { return false; } String[] parts = text.split("/"); return parts.length == 2 && parts[0].length() != 0 && parts[1].length() != 0; } private InetAddressUtils(); static boolean hasMask(String text); static InetAddress getAddr... |
### Question:
ScoringCalculator { public boolean hasGoodReputation(PeerScoring scoring) { return scoring.getEventCounter(EventType.INVALID_BLOCK) < 1 && scoring.getEventCounter(EventType.INVALID_MESSAGE) < 1 && scoring.getEventCounter(EventType.INVALID_HEADER) < 1; } boolean hasGoodReputation(PeerScoring scoring); }#... |
### Question:
Utils { public static boolean isHexadecimalString(String s) { return s.matches("^0x[\\da-fA-F]+$"); } static BigInteger unifiedNumericToBigInteger(String number); static String longToDateTime(long timestamp); static String getValueShortString(BigInteger number); static byte[] addressStringToBytes(String ... |
### Question:
Utils { public static boolean isDecimalString(String s) { return s.matches("^\\d+$"); } static BigInteger unifiedNumericToBigInteger(String number); static String longToDateTime(long timestamp); static String getValueShortString(BigInteger number); static byte[] addressStringToBytes(String hex); static b... |
### Question:
ByteArrayWrapper implements Comparable<ByteArrayWrapper>, Serializable { public boolean equals(Object other) { if (!(other instanceof ByteArrayWrapper)) { return false; } byte[] otherData = ((ByteArrayWrapper) other).data; return ByteUtil.fastEquals(data, otherData); } ByteArrayWrapper(byte[] data); boole... |
### Question:
ByteArrayWrapper implements Comparable<ByteArrayWrapper>, Serializable { @Override public int compareTo(ByteArrayWrapper o) { return FastByteComparisons.compareTo( data, 0, data.length, o.data, 0, o.data.length); } ByteArrayWrapper(byte[] data); boolean equals(Object other); @Override int hashCode(); @Ove... |
### Question:
ReceiptStoreImpl implements ReceiptStore { @Override public TransactionInfo get(byte[] transactionHash){ List<TransactionInfo> txs = getAll(transactionHash); if (txs.isEmpty()) { return null; } return txs.get(txs.size() - 1); } ReceiptStoreImpl(KeyValueDataSource receiptsDS); @Override void add(byte[] blo... |
### Question:
Node implements Serializable { public InetSocketAddress getAddress() { return new InetSocketAddress(this.getHost(), this.getPort()); } Node(String enodeURL); Node(byte[] id, String host, int port); Node(byte[] rlp); NodeID getId(); String getHexId(); String getHost(); int getPort(); byte[] getRLP(); Ine... |
### Question:
NodeManager { public NodeStatistics getNodeStatistics(Node n) { return discoveryEnabled ? getNodeHandler(n).getNodeStatistics() : DUMMY_STAT; } NodeManager(PeerExplorer peerExplorer, SystemProperties config); NodeStatistics getNodeStatistics(Node n); synchronized List<NodeHandler> getNodes(Set<String> nod... |
### Question:
ChannelManagerImpl implements ChannelManager { public boolean isAddressBlockAvailable(InetAddress inetAddress) { synchronized (activePeersLock) { return activePeers.values().stream() .map(ch -> new InetAddressBlock(ch.getInetSocketAddress().getAddress(), networkCIDR)) .filter(block -> block.contains(inetA... |
### Question:
DataSourceWithCache implements KeyValueDataSource { @Override public byte[] put(byte[] key, byte[] value) { ByteArrayWrapper wrappedKey = ByteUtil.wrap(key); return put(wrappedKey, value); } DataSourceWithCache(KeyValueDataSource base, int cacheSize); @Override byte[] get(byte[] key); @Override byte[] put... |
### Question:
DataSourceWithCache implements KeyValueDataSource { @Override public void delete(byte[] key) { delete(ByteUtil.wrap(key)); } DataSourceWithCache(KeyValueDataSource base, int cacheSize); @Override byte[] get(byte[] key); @Override byte[] put(byte[] key, byte[] value); @Override void delete(byte[] key); @Ov... |
### Question:
DataSourceWithCache implements KeyValueDataSource { @Override public void updateBatch(Map<ByteArrayWrapper, byte[]> rows, Set<ByteArrayWrapper> keysToRemove) { if (rows.containsKey(null) || rows.containsValue(null)) { throw new IllegalArgumentException("Cannot update null values"); } rows.keySet().removeA... |
### Question:
TransactionSet { public List<Transaction> getTransactions() { return transactionsByHash.values().stream() .collect(Collectors.collectingAndThen(Collectors.toList(), Collections::unmodifiableList)); } TransactionSet(); TransactionSet(TransactionSet transactionSet); TransactionSet(Map<Keccak256, Transacti... |
### Question:
TransactionSet { public boolean hasTransaction(Transaction transaction) { return this.transactionsByHash.containsKey(transaction.getHash()); } TransactionSet(); TransactionSet(TransactionSet transactionSet); TransactionSet(Map<Keccak256, Transaction> transactionsByHash, Map<RskAddress, List<Transaction>... |
### Question:
TransactionSet { public List<Transaction> getTransactionsWithSender(RskAddress senderAddress) { List<Transaction> list = this.transactionsByAddress.get(senderAddress); if (list == null) { return Collections.emptyList(); } return list; } TransactionSet(); TransactionSet(TransactionSet transactionSet); Tr... |
### Question:
AccountState { public byte[] getEncoded() { if (rlpEncoded == null) { byte[] anonce = RLP.encodeBigInteger(this.nonce); byte[] abalance = RLP.encodeSignedCoinNonNullZero(this.balance); if (stateFlags != 0) { byte[] astateFlags = RLP.encodeInt(this.stateFlags); this.rlpEncoded = RLP.encodeList(anonce, abal... |
### Question:
DifficultyRule extends DependentBlockHeaderRule { @Override public boolean validate(BlockHeader header, BlockHeader parent) { BlockDifficulty calcDifficulty = difficultyCalculator.calcDifficulty(header, parent); BlockDifficulty difficulty = header.getDifficulty(); if (!difficulty.equals(calcDifficulty)) {... |
### Question:
ParentNumberRule extends DependentBlockHeaderRule { @Override public boolean validate(BlockHeader header, BlockHeader parent) { if (header.getNumber() != (parent.getNumber() + 1)) { logger.error(String.format("#%d: block number is not parentBlock number + 1", header.getNumber())); return false; } return t... |
### Question:
CallArgumentsToByteArray { public byte[] getGasLimit() { String maxGasLimit = "0x5AF3107A4000"; byte[] gasLimit = stringHexToByteArray(maxGasLimit); if (args.gas != null && args.gas.length() != 0) { gasLimit = stringHexToByteArray(args.gas); } return gasLimit; } CallArgumentsToByteArray(Web3.CallArguments... |
### Question:
EthSubscriptionNotificationEmitter implements EthSubscribeParamsVisitor { @Override public SubscriptionId visit(EthSubscribeNewHeadsParams params, Channel channel) { SubscriptionId subscriptionId = new SubscriptionId(); blockHeader.subscribe(subscriptionId, channel); return subscriptionId; } EthSubscripti... |
### Question:
EthSubscriptionNotificationEmitter implements EthSubscribeParamsVisitor { public boolean unsubscribe(SubscriptionId subscriptionId) { boolean unsubscribedBlockHeader = blockHeader.unsubscribe(subscriptionId); boolean unsubscribedLogs = logs.unsubscribe(subscriptionId); return unsubscribedBlockHeader || un... |
### Question:
CallArgumentsToByteArray { public byte[] getToAddress() { byte[] toAddress = null; if (args.to != null) { toAddress = stringHexToByteArray(args.to); } return toAddress; } CallArgumentsToByteArray(Web3.CallArguments args); byte[] getGasPrice(); byte[] getGasLimit(); byte[] getToAddress(); byte[] getValue()... |
### Question:
DebugModuleImpl implements DebugModule { @Override public String wireProtocolQueueSize() { long n = messageHandler.getMessageQueueSize(); return TypeConverter.toQuantityJsonHex(n); } DebugModuleImpl(
BlockStore blockStore,
ReceiptStore receiptStore,
MessageHandler messa... |
### Question:
EthModule implements EthModuleWallet, EthModuleTransaction { public String chainId() { return TypeConverter.toJsonHex(new byte[] { chainId }); } EthModule(
BridgeConstants bridgeConstants,
byte chainId,
Blockchain blockchain,
TransactionPool transactionPool,... |
### Question:
EthUnsubscribeRequest extends RskJsonRpcRequest { @JsonInclude(JsonInclude.Include.NON_NULL) public EthUnsubscribeParams getParams() { return params; } @JsonCreator EthUnsubscribeRequest(
@JsonProperty("jsonrpc") JsonRpcVersion version,
@JsonProperty("method") RskJsonRpcMethod met... |
### Question:
LogsNotification implements EthSubscriptionNotificationDTO { public String getLogIndex() { if (lazyLogIndex == null) { lazyLogIndex = toQuantityJsonHex(logInfoIndex); } return lazyLogIndex; } LogsNotification(LogInfo logInfo, Block b, int txIndex, Transaction tx, int logIdx, boolean r); String getLogIndex... |
### Question:
LogsNotification implements EthSubscriptionNotificationDTO { public String getBlockNumber() { if (lazyBlockNumber == null) { lazyBlockNumber = toQuantityJsonHex(block.getNumber()); } return lazyBlockNumber; } LogsNotification(LogInfo logInfo, Block b, int txIndex, Transaction tx, int logIdx, boolean r); S... |
### Question:
LogsNotification implements EthSubscriptionNotificationDTO { public String getBlockHash() { if (lazyBlockHash == null) { lazyBlockHash = block.getHashJsonString(); } return lazyBlockHash; } LogsNotification(LogInfo logInfo, Block b, int txIndex, Transaction tx, int logIdx, boolean r); String getLogIndex()... |
### Question:
LogsNotification implements EthSubscriptionNotificationDTO { public String getTransactionHash() { if (lazyTransactionHash == null) { lazyTransactionHash = transaction.getHash().toJsonString(); } return lazyTransactionHash; } LogsNotification(LogInfo logInfo, Block b, int txIndex, Transaction tx, int logId... |
### Question:
LogsNotification implements EthSubscriptionNotificationDTO { public String getTransactionIndex() { if (lazyTransactionIndex == null) { lazyTransactionIndex = toQuantityJsonHex(transactionIndex); } return lazyTransactionIndex; } LogsNotification(LogInfo logInfo, Block b, int txIndex, Transaction tx, int lo... |
### Question:
LogsNotification implements EthSubscriptionNotificationDTO { public String getAddress() { if (lazyAddress == null) { lazyAddress = toJsonHex(logInfo.getAddress()); } return lazyAddress; } LogsNotification(LogInfo logInfo, Block b, int txIndex, Transaction tx, int logIdx, boolean r); String getLogIndex(); ... |
### Question:
LogsNotification implements EthSubscriptionNotificationDTO { public String getData() { if (lazyData == null) { lazyData = toJsonHex(logInfo.getData()); } return lazyData; } LogsNotification(LogInfo logInfo, Block b, int txIndex, Transaction tx, int logIdx, boolean r); String getLogIndex(); String getBlock... |
### Question:
LogsNotification implements EthSubscriptionNotificationDTO { public List<String> getTopics() { if (lazyTopics == null) { lazyTopics = logInfo.getTopics().stream() .map(t -> toJsonHex(t.getData())) .collect(Collectors.toList()); } return Collections.unmodifiableList(lazyTopics); } LogsNotification(LogInfo ... |
### Question:
BlockHeaderNotificationEmitter { public void subscribe(SubscriptionId subscriptionId, Channel channel) { subscriptions.put(subscriptionId, channel); } BlockHeaderNotificationEmitter(Ethereum ethereum, JsonRpcSerializer jsonRpcSerializer); void subscribe(SubscriptionId subscriptionId, Channel channel); boo... |
### Question:
TraceAddress { @JsonValue public int[] toAddress() { if (this.parent == null) { return EMPTY_ADDRESS; } int[] parentAddress = this.parent.toAddress(); int[] address = Arrays.copyOf(parentAddress, parentAddress.length + 1); address[address.length - 1] = this.index; return address; } TraceAddress(); TraceA... |
### Question:
JsonRpcMethodFilter implements RequestInterceptor { @Override public void interceptRequest(JsonNode node) throws IOException { if (node.hasNonNull(JsonRpcBasicServer.METHOD)) { checkMethod(node.get(JsonRpcBasicServer.METHOD).asText()); } } JsonRpcMethodFilter(List<ModuleDescription> modules); @Override vo... |
### Question:
OriginValidator { public boolean isValidReferer(String referer) { if (this.allowAllOrigins) { return true; } URL refererUrl = null; try { refererUrl = new URL(referer); } catch (MalformedURLException e) { return false; } String refererProtocol = refererUrl.getProtocol(); if (refererProtocol == null) { ret... |
### Question:
ModuleDescription { public boolean methodIsInModule(String methodName) { if (methodName == null) { return false; } if (!methodName.startsWith(this.name)) { return false; } if (methodName.length() == this.name.length()) { return false; } if (methodName.charAt(this.name.length()) != '_') { return false; } r... |
### Question:
EncryptedData { public EncryptedData(byte[] initialisationVector, byte[] encryptedBytes) { this.initialisationVector = Arrays.copyOf(initialisationVector, initialisationVector.length); this.encryptedBytes = Arrays.copyOf(encryptedBytes, encryptedBytes.length); } EncryptedData(byte[] initialisationVector, ... |
### Question:
AutoMinerClient implements MinerClient { @Override public boolean isMining() { return this.isMining; } AutoMinerClient(MinerServer minerServer); @Override void start(); @Override boolean isMining(); @Override boolean mineBlock(); @Override void stop(); }### Answer:
@Test public void byDefaultIsDisabled()... |
### Question:
CallArgumentsToByteArray { public byte[] getValue() { byte[] value = new byte[] { 0 }; if (args.value != null && args.value.length() != 0) { value = stringHexToByteArray(args.value); } return value; } CallArgumentsToByteArray(Web3.CallArguments args); byte[] getGasPrice(); byte[] getGasLimit(); byte[] get... |
### Question:
MinerClock { public long calculateTimestampForChild(BlockHeader parentHeader) { long previousTimestamp = parentHeader.getTimestamp(); if (isFixedClock) { return previousTimestamp + timeAdjustment; } long ret = clock.instant().plusSeconds(timeAdjustment).getEpochSecond(); return Long.max(ret, previousTimes... |
### Question:
HashRateCalculator { public BigInteger calculateNetHashRate(Duration period) { return calculateHashRate(b -> true, period); } HashRateCalculator(BlockStore blockStore, RskCustomCache<Keccak256, BlockHeaderElement> headerCache); void start(); void stop(); abstract BigInteger calculateNodeHashRate(Duration ... |
### Question:
ListArrayUtil { public static List<Byte> asByteList(byte[] primitiveByteArray) { Byte[] arrayObj = convertTo(primitiveByteArray); return Arrays.asList(arrayObj); } private ListArrayUtil(); static List<Byte> asByteList(byte[] primitiveByteArray); static boolean isEmpty(@Nullable byte[] array); static int ... |
### Question:
ListArrayUtil { public static boolean isEmpty(@Nullable byte[] array) { return array == null || array.length == 0; } private ListArrayUtil(); static List<Byte> asByteList(byte[] primitiveByteArray); static boolean isEmpty(@Nullable byte[] array); static int getLength(@Nullable byte[] array); static byte[... |
### Question:
ListArrayUtil { public static byte[] nullToEmpty(@Nullable byte[] array) { if (array == null) { return new byte[0]; } return array; } private ListArrayUtil(); static List<Byte> asByteList(byte[] primitiveByteArray); static boolean isEmpty(@Nullable byte[] array); static int getLength(@Nullable byte[] arr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.