method2testcases stringlengths 118 6.63k |
|---|
### Question:
ByteUtils { public static byte[] shortToBytesBE(int i, byte[] bytes, int off) { bytes[off] = (byte) (i >> 8); bytes[off + 1] = (byte) i; return bytes; } static int bytesToVR(byte[] bytes, int off); static int bytesToUShort(byte[] bytes, int off, boolean bigEndian); static int bytesToUShortBE(byte[] bytes... |
### Question:
ByteUtils { public static byte[] shortToBytesLE(int i, byte[] bytes, int off) { bytes[off + 1] = (byte) (i >> 8); bytes[off] = (byte) i; return bytes; } static int bytesToVR(byte[] bytes, int off); static int bytesToUShort(byte[] bytes, int off, boolean bigEndian); static int bytesToUShortBE(byte[] bytes... |
### Question:
ByteUtils { public static byte[] tagToBytesBE(int i, byte[] bytes, int off) { return intToBytesBE(i, bytes, off); } static int bytesToVR(byte[] bytes, int off); static int bytesToUShort(byte[] bytes, int off, boolean bigEndian); static int bytesToUShortBE(byte[] bytes, int off); static int bytesToUShortL... |
### Question:
AttributeSelector implements Serializable { public static AttributeSelector valueOf(String s) { int fromIndex = s.lastIndexOf("DicomAttribute"); try { return new AttributeSelector( selectTag(s, fromIndex), selectPrivateCreator(s, fromIndex), itemPointersOf(s, fromIndex)); } catch (Exception e) { throw new... |
### Question:
WebConfigurer implements ServletContextInitializer, EmbeddedServletContainerCustomizer { @Override public void onStartup(ServletContext servletContext) throws ServletException { if (env.getActiveProfiles().length != 0) { log.info("Web application configuration, using profiles: {}", (Object[]) env.getActiv... |
### Question:
WebConfigurer implements ServletContextInitializer, EmbeddedServletContainerCustomizer { @Override public void customize(ConfigurableEmbeddedServletContainer container) { MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT); mappings.add("html", "text/html;charset=utf-8"); mappings.add("json", "... |
### Question:
WebConfigurer implements ServletContextInitializer, EmbeddedServletContainerCustomizer { @Override public void onStartup(ServletContext servletContext) throws ServletException { if (env.getActiveProfiles().length != 0) { log.info("Web application configuration, using profiles: {}", (Object[]) env.getActiv... |
### Question:
Post extends AuditableEntity { @PrePersist public void slugify(){ this.slug = new Slugify().slugify(this.title); } @PrePersist void slugify(); }### Answer:
@Test public void testSlug() { System.out.println("getSlug"); Post instance = new Post(); instance.setTitle("test post 1"); instance.slugify(); asse... |
### Question:
PostService { public Post createPost(PostForm form) { Post _post = Post.builder() .title(form.getTitle()) .content(form.getContent()) .build(); Post saved = this.postRepository.save(_post); return saved; } Post createPost(PostForm form); Post updatePost(String slug, PostForm form); void deletePost(String... |
### Question:
UserServiceClient { public User findByUsername(String username) { try { ResponseEntity<User> response = this.restTemplate.getForEntity(userServiceUrl + "/users/{username}", User.class, username); return response.getBody(); } catch (HttpClientErrorException e) { if (e.getStatusCode() == NOT_FOUND) { return... |
### Question:
GraphUIController { public void refresh() { if (dfa == null) { throw new IllegalStateException("Graph has not been built using start() yet."); } panel.renderGraph(dfa); if (!panel.isJumpToActionEnabled()) { updateStatePanel(); } } GraphUIController(VisualGraphPanel panel); void start(final DFAExecution<? ... |
### Question:
GraphUIController { public void start(final DFAExecution<? extends LatticeElement> dfa) { if (this.dfa != null) { throw new IllegalStateException("Visual graph was already built."); } this.dfa = dfa; ControlFlowGraph dfaGraph = dfa.getCFG(); List<BasicBlock> dfaBasicBlocks = dfaGraph.getBasicBlocks(); Map... |
### Question:
Tracing extends org.apache.cassandra.tracing.Tracing { Span spanFromPayload(Tracer tracer, @Nullable Map<String, ByteBuffer> payload) { ByteBuffer b3 = payload != null ? payload.get("b3") : null; if (b3 == null) return tracer.nextSpan(); TraceContextOrSamplingFlags extracted = B3SingleFormat.parseB3Single... |
### Question:
HashTableHipsterDirectedGraph extends HashTableHipsterGraph<V,E> implements HipsterDirectedGraph<V,E> { @Override public GraphEdge<V,E> connect(V v1, V v2, E value){ Preconditions.checkArgument(v1 != null && v2 != null, "Vertices cannot be null"); GraphEdge<V,E> edge = new DirectedEdge<V, E>(v1, v2, value... |
### Question:
HashBasedHipsterGraph implements HipsterMutableGraph<V,E> { @Override public boolean add(V v){ if(!connected.containsKey(v)){ connected.put(v, new LinkedHashSet<GraphEdge<V, E>>()); return true; } return false; } HashBasedHipsterGraph(); @Override boolean add(V v); @Override Set<V> add(V... vertices); @Ov... |
### Question:
HashBasedHipsterGraph implements HipsterMutableGraph<V,E> { @Override public boolean remove(V v){ Set<GraphEdge<V, E>> edges = this.connected.get(v); if (edges == null) return false; for(Iterator<GraphEdge<V,E>> it = edges.iterator(); it.hasNext(); ){ GraphEdge<V,E> edge = it.next(); it.remove(); V v2 = e... |
### Question:
HashBasedHipsterGraph implements HipsterMutableGraph<V,E> { @Override public GraphEdge<V,E> connect(V v1, V v2, E value){ if(v1 == null || v2 == null) throw new IllegalArgumentException("Invalid vertices. A vertex cannot be null"); if (!connected.containsKey(v1)) throw new IllegalArgumentException(v1 + " ... |
### Question:
HashBasedHipsterGraph implements HipsterMutableGraph<V,E> { @Override public Iterable<V> vertices() { return connected.keySet(); } HashBasedHipsterGraph(); @Override boolean add(V v); @Override Set<V> add(V... vertices); @Override boolean remove(V v); @Override Set<V> remove(V... vertices); @Override Grap... |
### Question:
HashBasedHipsterGraph implements HipsterMutableGraph<V,E> { @Override public Iterable<GraphEdge<V, E>> edgesOf(V vertex) { Set<GraphEdge<V, E>> set = connected.get(vertex); if (set == null) set = Collections.emptySet(); return set; } HashBasedHipsterGraph(); @Override boolean add(V v); @Override Set<V> ad... |
### Question:
HashBasedHipsterDirectedGraph extends HashBasedHipsterGraph<V, E> implements HipsterMutableGraph<V, E>, HipsterDirectedGraph<V, E> { @Override public Iterable<GraphEdge<V, E>> outgoingEdgesOf(final V vertex) { return F.filter(edgesOf(vertex), new Function<GraphEdge<V, E>, Boolean>() { @Override public Boo... |
### Question:
HashBasedHipsterDirectedGraph extends HashBasedHipsterGraph<V, E> implements HipsterMutableGraph<V, E>, HipsterDirectedGraph<V, E> { @Override public Iterable<GraphEdge<V, E>> incomingEdgesOf(final V vertex) { return F.filter(edgesOf(vertex), new Function<GraphEdge<V, E>, Boolean>() { @Override public Boo... |
### Question:
HashBasedHipsterDirectedGraph extends HashBasedHipsterGraph<V, E> implements HipsterMutableGraph<V, E>, HipsterDirectedGraph<V, E> { @Override public Iterable<GraphEdge<V, E>> edges() { return F.map( F.filter(HashBasedHipsterDirectedGraph.super.vedges(), new Function<Map.Entry<V, GraphEdge<V, E>>, Boolean... |
### Question:
HashTableHipsterDirectedGraph extends HashTableHipsterGraph<V,E> implements HipsterDirectedGraph<V,E> { @Override public Iterable<GraphEdge<V, E>> outgoingEdgesOf(V vertex) { return graphTable.row(vertex).values(); } @Override GraphEdge<V,E> connect(V v1, V v2, E value); @Override Iterable<GraphEdge<V, E... |
### Question:
HashTableHipsterDirectedGraph extends HashTableHipsterGraph<V,E> implements HipsterDirectedGraph<V,E> { @Override public Iterable<GraphEdge<V, E>> incomingEdgesOf(V vertex) { return graphTable.column(vertex).values(); } @Override GraphEdge<V,E> connect(V v1, V v2, E value); @Override Iterable<GraphEdge<V... |
### Question:
HashTableHipsterGraph implements HipsterGraph<V,E> { public void add(V v){ if (!graphTable.containsColumn(v) && !graphTable.containsRow(v)){ disconnected.add(v); } } void add(V v); void remove(V v); void remove(V v, GraphEdge<V,E> edge); GraphEdge<V,E> connect(V v1, V v2, E value); @Override Iterable<Gra... |
### Question:
HashTableHipsterGraph implements HipsterGraph<V,E> { public void remove(V v){ for(GraphEdge<V,E> edge : edgesOf(v)){ V connectedVertex = edge.getVertex1().equals(v) ? edge.getVertex2() : edge.getVertex1(); if (!greaterThan(1, edgesOf(connectedVertex))){ disconnected.add(connectedVertex); } } if (graphTabl... |
### Question:
HashTableHipsterGraph implements HipsterGraph<V,E> { public GraphEdge<V,E> connect(V v1, V v2, E value){ Preconditions.checkArgument(v1 != null && v2 != null, "Vertices cannot be null"); GraphEdge<V,E> edge = new UndirectedEdge<V, E>(v1, v2, value); graphTable.put(v1, v2, edge); graphTable.put(v2, v1, edg... |
### Question:
HashTableHipsterGraph implements HipsterGraph<V,E> { @Override public Iterable<GraphEdge<V, E>> edges() { return graphTable.values(); } void add(V v); void remove(V v); void remove(V v, GraphEdge<V,E> edge); GraphEdge<V,E> connect(V v1, V v2, E value); @Override Iterable<GraphEdge<V, E>> edges(); @Overri... |
### Question:
HashTableHipsterGraph implements HipsterGraph<V,E> { @Override public Iterable<V> vertices() { return Sets.union(Sets.union(graphTable.rowKeySet(), graphTable.columnKeySet()), disconnected); } void add(V v); void remove(V v); void remove(V v, GraphEdge<V,E> edge); GraphEdge<V,E> connect(V v1, V v2, E val... |
### Question:
HashTableHipsterGraph implements HipsterGraph<V,E> { @Override public Iterable<GraphEdge<V, E>> edgesOf(V vertex) { return Sets.union(Sets.newHashSet(graphTable.row(vertex).values()), Sets.newHashSet(graphTable.column(vertex).values())); } void add(V v); void remove(V v); void remove(V v, GraphEdge<V,E> ... |
### Question:
HashBasedHipsterGraph implements HipsterMutableGraph<V,E> { @Override public Iterable<GraphEdge<V, E>> edges() { return F.map(vedges(), new Function<Map.Entry<V, GraphEdge<V, E>>, GraphEdge<V, E>>() { @Override public GraphEdge<V, E> apply(Map.Entry<V, GraphEdge<V, E>> entry) { return entry.getValue(); } ... |
### Question:
CallArgumentsToByteArray { public byte[] getGasPrice() { byte[] gasPrice = new byte[] {0}; if (args.gasPrice != null && args.gasPrice.length() != 0) { gasPrice = stringHexToByteArray(args.gasPrice); } return gasPrice; } CallArgumentsToByteArray(Web3.CallArguments args); byte[] getGasPrice(); byte[] getGas... |
### Question:
BridgeSerializationUtils { public static ReleaseTransactionSet deserializeReleaseTransactionSet(byte[] data, NetworkParameters networkParameters) { return deserializeReleaseTransactionSet(data, networkParameters, false); } private BridgeSerializationUtils(); static byte[] serializeMap(SortedMap<Keccak256... |
### Question:
Value { public boolean isEmpty() { if (isNull()) { return true; } if (isBytes() && asBytes().length == 0) { return true; } if (isList() && asList().isEmpty()) { return true; } if (isString() && asString().equals("")) { return true; } return false; } Value(); Value(Object obj); static Value fromRlpEncoded... |
### Question:
BridgeSerializationUtils { public static byte[] serializeInteger(Integer value) { return RLP.encodeBigInteger(BigInteger.valueOf(value)); } private BridgeSerializationUtils(); static byte[] serializeMap(SortedMap<Keccak256, BtcTransaction> map); static SortedMap<Keccak256, BtcTransaction> deserializeMap(... |
### Question:
BridgeSerializationUtils { public static Integer deserializeInteger(byte[] data) { return RLP.decodeBigInteger(data, 0).intValue(); } private BridgeSerializationUtils(); static byte[] serializeMap(SortedMap<Keccak256, BtcTransaction> map); static SortedMap<Keccak256, BtcTransaction> deserializeMap(byte[]... |
### Question:
LockWhitelist { public Integer getSize() { return whitelistedAddresses.size(); } LockWhitelist(Map<Address, LockWhitelistEntry> whitelistedAddresses); LockWhitelist(Map<Address, LockWhitelistEntry> whitelistedAddresses, int disableBlockHeight); boolean isWhitelisted(Address address); boolean isWhiteliste... |
### Question:
LockWhitelist { public List<Address> getAddresses() { return new ArrayList<>(whitelistedAddresses.keySet()); } LockWhitelist(Map<Address, LockWhitelistEntry> whitelistedAddresses); LockWhitelist(Map<Address, LockWhitelistEntry> whitelistedAddresses, int disableBlockHeight); boolean isWhitelisted(Address ... |
### Question:
LockWhitelist { public boolean isWhitelisted(Address address) { return whitelistedAddresses.containsKey(address); } LockWhitelist(Map<Address, LockWhitelistEntry> whitelistedAddresses); LockWhitelist(Map<Address, LockWhitelistEntry> whitelistedAddresses, int disableBlockHeight); boolean isWhitelisted(Add... |
### Question:
LockWhitelist { public boolean put(Address address, LockWhitelistEntry entry) { if (whitelistedAddresses.containsKey(address)) { return false; } whitelistedAddresses.put(address, entry); return true; } LockWhitelist(Map<Address, LockWhitelistEntry> whitelistedAddresses); LockWhitelist(Map<Address, LockWh... |
### Question:
LockWhitelist { public boolean remove(Address address) { return whitelistedAddresses.remove(address) != null; } LockWhitelist(Map<Address, LockWhitelistEntry> whitelistedAddresses); LockWhitelist(Map<Address, LockWhitelistEntry> whitelistedAddresses, int disableBlockHeight); boolean isWhitelisted(Address... |
### Question:
LockWhitelist { public void consume(Address address) { LockWhitelistEntry entry = whitelistedAddresses.get(address); if (entry == null) { return; } entry.consume(); if (entry.isConsumed()) { this.remove(address); } } LockWhitelist(Map<Address, LockWhitelistEntry> whitelistedAddresses); LockWhitelist(Map<... |
### Question:
RLP { public static byte[] decodeIP4Bytes(byte[] data, int index) { int offset = 1; final byte[] result = new byte[4]; for (int i = 0; i < 4; i++) { result[i] = decodeOneByteItem(data, index + offset); if ((data[index + offset] & 0xFF) > OFFSET_SHORT_ITEM) { offset += 2; } else { offset += 1; } } return r... |
### Question:
LockWhitelist { public <T extends LockWhitelistEntry> List<T> getAll(Class<T> type) { return whitelistedAddresses.values().stream() .filter(e -> e.getClass() == type) .map(type::cast) .collect(Collectors.toList()); } LockWhitelist(Map<Address, LockWhitelistEntry> whitelistedAddresses); LockWhitelist(Map<... |
### Question:
CoinbaseInformation { public Sha256Hash getWitnessMerkleRoot() { return witnessMerkleRoot; } CoinbaseInformation(Sha256Hash witnessMerkleRoot); Sha256Hash getWitnessMerkleRoot(); }### Answer:
@Test public void getWitnessMerkleRoot() { Sha256Hash secondHashTx = Sha256Hash.wrap(Hex.decode("e3d0840a0825fb7d... |
### Question:
RLP { public static int decodeInt(byte[] data, int index) { int value = 0; if ((data[index] & 0xFF) < OFFSET_SHORT_ITEM) { return data[index]; } else if ((data[index] & 0xFF) >= OFFSET_SHORT_ITEM && (data[index] & 0xFF) < OFFSET_LONG_ITEM) { byte length = (byte) (data[index] - OFFSET_SHORT_ITEM); byte pow... |
### Question:
RLP { public static byte[] encodeByte(byte singleByte) { if ((singleByte & 0xFF) == 0) { return new byte[]{(byte) OFFSET_SHORT_ITEM}; } else if ((singleByte & 0xFF) <= 0x7F) { return new byte[]{singleByte}; } else { return new byte[]{(byte) (OFFSET_SHORT_ITEM + 1), singleByte}; } } static int decodeInt(b... |
### Question:
BridgeStorageProvider { public Coin getLockingCap() { if (activations.isActive(RSKIP134)) { if (this.lockingCap == null) { this.lockingCap = safeGetFromRepository(LOCKING_CAP_KEY, BridgeSerializationUtils::deserializeCoin); } return this.lockingCap; } return null; } BridgeStorageProvider(Repository reposi... |
### Question:
RLP { public static byte[] encodeShort(short singleShort) { if ((singleShort & 0xFF) == singleShort) { return encodeByte((byte) singleShort); } else { return new byte[]{(byte) (OFFSET_SHORT_ITEM + 2), (byte) (singleShort >> 8 & 0xFF), (byte) (singleShort >> 0 & 0xFF)}; } } static int decodeInt(byte[] dat... |
### Question:
BridgeStorageProvider { public void saveHeightBtcTxHashAlreadyProcessed() { if (btcTxHashesToSave == null) { return; } btcTxHashesToSave.forEach((btcTxHash, height) -> safeSaveToRepository(getStorageKeyForBtcTxHashAlreadyProcessed(btcTxHash), height, BridgeSerializationUtils::serializeLong) ); } BridgeSto... |
### Question:
BridgeStorageProvider { public CoinbaseInformation getCoinbaseInformation(Sha256Hash blockHash) { if (!activations.isActive(RSKIP143)) { return null; } if (coinbaseInformationMap == null) { coinbaseInformationMap = new HashMap<>(); } if (coinbaseInformationMap.containsKey(blockHash)) { return coinbaseInfo... |
### Question:
Federation { public List<FederationMember> getMembers() { return members; } Federation(List<FederationMember> members, Instant creationTime, long creationBlockNumber, NetworkParameters btcParams); List<FederationMember> getMembers(); List<BtcECKey> getBtcPublicKeys(); int getNumberOfSignaturesRequired();... |
### Question:
Federation { public Integer getBtcPublicKeyIndex(BtcECKey key) { for (int i = 0; i < members.size(); i++) { if (Arrays.equals(key.getPubKey(), members.get(i).getBtcPublicKey().getPubKey())) { return i; } } return null; } Federation(List<FederationMember> members, Instant creationTime, long creationBlockNu... |
### Question:
Federation { public boolean hasBtcPublicKey(BtcECKey key) { return getBtcPublicKeyIndex(key) != null; } Federation(List<FederationMember> members, Instant creationTime, long creationBlockNumber, NetworkParameters btcParams); List<FederationMember> getMembers(); List<BtcECKey> getBtcPublicKeys(); int getN... |
### Question:
Federation { public boolean hasMemberWithRskAddress(byte[] address) { return members.stream() .anyMatch(m -> Arrays.equals(m.getRskPublicKey().getAddress(), address)); } Federation(List<FederationMember> members, Instant creationTime, long creationBlockNumber, NetworkParameters btcParams); List<Federatio... |
### Question:
Federation { @Override public String toString() { return String.format("%d of %d signatures federation", getNumberOfSignaturesRequired(), members.size()); } Federation(List<FederationMember> members, Instant creationTime, long creationBlockNumber, NetworkParameters btcParams); List<FederationMember> getM... |
### Question:
Federation { public boolean isMember(FederationMember federationMember){ return this.members.contains(federationMember); } Federation(List<FederationMember> members, Instant creationTime, long creationBlockNumber, NetworkParameters btcParams); List<FederationMember> getMembers(); List<BtcECKey> getBtcPub... |
### Question:
RLP { public static byte[] encodeBigInteger(BigInteger srcBigInteger) { if (srcBigInteger.equals(BigInteger.ZERO)) { return encodeByte((byte) 0); } else { return encodeElement(asUnsignedByteArray(srcBigInteger)); } } static int decodeInt(byte[] data, int index); static BigInteger decodeBigInteger(byte[] ... |
### Question:
BridgeUtils { public static boolean txIsProcessable(BtcLockSender.TxType txType, ActivationConfig.ForBlock activations) { return txType == BtcLockSender.TxType.P2PKH || activations.isActive(ConsensusRule.RSKIP143); } static Wallet getFederationNoSpendWallet(Context btcContext, Federation federation); sta... |
### Question:
BridgeUtils { public static Address recoverBtcAddressFromEthTransaction(org.ethereum.core.Transaction tx, NetworkParameters networkParameters) { org.ethereum.crypto.ECKey key = tx.getKey(); byte[] pubKey = key.getPubKey(true); return BtcECKey.fromPublicOnly(pubKey).toAddress(networkParameters); } static ... |
### Question:
BridgeUtils { public static Wallet getFederationNoSpendWallet(Context btcContext, Federation federation) { return getFederationsNoSpendWallet(btcContext, Collections.singletonList(federation)); } static Wallet getFederationNoSpendWallet(Context btcContext, Federation federation); static Wallet getFederat... |
### Question:
BridgeUtils { private static boolean isReleaseTx(BtcTransaction tx, Federation federation) { return isReleaseTx(tx, Collections.singletonList(federation)); } static Wallet getFederationNoSpendWallet(Context btcContext, Federation federation); static Wallet getFederationsNoSpendWallet(Context btcContext, ... |
### Question:
BridgeUtils { public static boolean isContractTx(Transaction rskTx) { return rskTx.getClass() == org.ethereum.vm.program.InternalTransaction.class; } static Wallet getFederationNoSpendWallet(Context btcContext, Federation federation); static Wallet getFederationsNoSpendWallet(Context btcContext, List<Fed... |
### Question:
BridgeUtils { public static Coin getCoinFromBigInteger(BigInteger value) { if (value == null) { throw new BridgeIllegalArgumentException("value cannot be null"); } try { return Coin.valueOf(value.longValueExact()); } catch(ArithmeticException e) { throw new BridgeIllegalArgumentException(e.getMessage(), e... |
### Question:
BridgeUtils { public static boolean validateHeightAndConfirmations(int height, int btcBestChainHeight, int acceptableConfirmationsAmount, Sha256Hash btcTxHash) throws Exception { if (height < 0) { throw new Exception("Height can't be lower than 0"); } int confirmations = btcBestChainHeight - height + 1; i... |
### Question:
BridgeUtils { public static void validateInputsCount(byte[] btcTxSerialized, boolean isActiveRskip) throws VerificationException.EmptyInputsOrOutputs { if (BtcTransactionFormatUtils.getInputsCount(btcTxSerialized) == 0) { if (isActiveRskip) { if (BtcTransactionFormatUtils.getInputsCountForSegwit(btcTxSeri... |
### Question:
MerkleTreeUtils { public static Sha256Hash combineLeftRight(Sha256Hash left, Sha256Hash right) { byte[] leftBytes = left.getBytes(); byte[] rightBytes = right.getBytes(); checkNotAValid64ByteTransaction(leftBytes, rightBytes); return Sha256Hash.wrapReversed( Sha256Hash.hashTwice( reverseBytes(leftBytes), ... |
### Question:
PartialMerkleTreeFormatUtils { public static VarInt getHashesCount(byte[] pmtSerialized) { return new VarInt(pmtSerialized, BLOCK_TRANSACTION_COUNT_LENGTH); } static VarInt getHashesCount(byte[] pmtSerialized); static VarInt getFlagBitsCount(byte[] pmtSerialized); static boolean hasExpectedSize(byte[] pm... |
### Question:
PartialMerkleTreeFormatUtils { public static VarInt getFlagBitsCount(byte[] pmtSerialized) { VarInt hashesCount = getHashesCount(pmtSerialized); return new VarInt( pmtSerialized, Math.addExact( BLOCK_TRANSACTION_COUNT_LENGTH + hashesCount.getOriginalSizeInBytes(), Math.multiplyExact(Math.toIntExact(hashes... |
### Question:
PartialMerkleTreeFormatUtils { public static boolean hasExpectedSize(byte[] pmtSerialized) { try { VarInt hashesCount = getHashesCount(pmtSerialized); VarInt flagBitsCount = getFlagBitsCount(pmtSerialized); int declaredSize = Math.addExact(Math.addExact(BLOCK_TRANSACTION_COUNT_LENGTH + hashesCount.getOrig... |
### Question:
BridgeEventLoggerImpl implements BridgeEventLogger { public void logUpdateCollections(Transaction rskTx) { if (activations.isActive(ConsensusRule.RSKIP146)) { logUpdateCollectionsInSolidityFormat(rskTx); } else { logUpdateCollectionsInRLPFormat(rskTx); } } BridgeEventLoggerImpl(BridgeConstants bridgeConst... |
### Question:
BridgeEventLoggerImpl implements BridgeEventLogger { public void logReleaseBtc(BtcTransaction btcTx, byte[] rskTxHash) { if (activations.isActive(ConsensusRule.RSKIP146)) { logReleaseBtcInSolidityFormat(btcTx, rskTxHash); } else { logReleaseBtcInRLPFormat(btcTx); } } BridgeEventLoggerImpl(BridgeConstants ... |
### Question:
BridgeEventLoggerImpl implements BridgeEventLogger { public void logReleaseBtcRequested(byte[] rskTransactionHash, BtcTransaction btcTx, Coin amount) { CallTransaction.Function event = BridgeEvents.RELEASE_REQUESTED.getEvent(); byte[][] encodedTopicsInBytes = event.encodeEventTopics(rskTransactionHash, bt... |
### Question:
ReleaseRequestQueue { public void add(Address destination, Coin amount, Keccak256 rskTxHash) { entries.add(new Entry(destination, amount, rskTxHash)); } ReleaseRequestQueue(List<Entry> entries); List<Entry> getEntriesWithoutHash(); List<Entry> getEntriesWithHash(); List<Entry> getEntries(); void add(Addre... |
### Question:
ReleaseRequestQueue { public void process(int maxIterations, Processor processor) { ListIterator<Entry> iterator = entries.listIterator(); List<Entry> toRetry = new ArrayList<>(); int i = 0; while (iterator.hasNext() && i < maxIterations) { Entry entry = iterator.next(); iterator.remove(); ++i; if (!proce... |
### Question:
P2shMultisigBtcLockSender implements BtcLockSender { public boolean tryParse(BtcTransaction btcTx) { if (btcTx == null) { return false; } if (btcTx.getInputs().size() == 0) { return false; } if (btcTx.getInput(0).getScriptBytes() == null) { return false; } Script scriptSig = btcTx.getInput(0).getScriptSig... |
### Question:
P2pkhBtcLockSender implements BtcLockSender { public boolean tryParse (BtcTransaction btcTx) { if (btcTx == null) { return false; } if (btcTx.getInputs().size() == 0) { return false; } if (btcTx.getInput(0).getScriptBytes() == null) { return false; } Script scriptSig = btcTx.getInput(0).getScriptSig(); if... |
### Question:
RepositoryBtcBlockStoreWithCache implements BtcBlockStoreWithCache { @Override public synchronized StoredBlock getChainHead() { byte[] ba = repository.getStorageBytes(contractAddress, DataWord.fromString(BLOCK_STORE_CHAIN_HEAD_KEY)); if (ba == null) { return null; } return byteArrayToStoredBlock(ba); } Re... |
### Question:
RepositoryBtcBlockStoreWithCache implements BtcBlockStoreWithCache { @Override public NetworkParameters getParams() { return btcNetworkParams; } RepositoryBtcBlockStoreWithCache(NetworkParameters btcNetworkParams, Repository repository, Map<Sha256Hash, StoredBlock> cacheBlocks, RskAddress contractAddress)... |
### Question:
FederationSupport { public Federation getActiveFederation() { switch (getActiveFederationReference()) { case NEW: return provider.getNewFederation(); case OLD: return provider.getOldFederation(); case GENESIS: default: return bridgeConstants.getGenesisFederation(); } } FederationSupport(BridgeConstants br... |
### Question:
FederationSupport { public byte[] getMemberPublicKeyOfType(List<FederationMember> members, int index, FederationMember.KeyType keyType, String errorPrefix) { if (index < 0 || index >= members.size()) { throw new IndexOutOfBoundsException(String.format("%s index must be between 0 and %d", errorPrefix, memb... |
### Question:
FederationMember { @Override public boolean equals(Object other) { if (this == other) { return true; } if (other == null || this.getClass() != other.getClass()) { return false; } FederationMember otherFederationMember = (FederationMember) other; return Arrays.equals(btcPublicKey.getPubKey(), otherFederati... |
### Question:
RemascFeesPayer { public void payMiningFees(byte[] blockHash, Coin value, RskAddress toAddress, List<LogInfo> logs) { this.transferPayment(value, toAddress); this.logPayment(blockHash, value, toAddress, logs); } RemascFeesPayer(Repository repository, RskAddress contractAddress); List<ProgramSubtrace> getS... |
### Question:
RemascStorageProvider { public Coin getRewardBalance() { if (rewardBalance != null) { return rewardBalance; } DataWord address = DataWord.fromString(REWARD_BALANCE_KEY); DataWord value = this.repository.getStorageValue(this.contractAddress, address); if (value == null) { return Coin.ZERO; } return new Coi... |
### Question:
RemascStorageProvider { public Coin getBurnedBalance() { if (burnedBalance != null) { return burnedBalance; } DataWord address = DataWord.fromString(BURNED_BALANCE_KEY); DataWord value = this.repository.getStorageValue(this.contractAddress, address); if (value == null) { return Coin.ZERO; } return new Coi... |
### Question:
RemascStorageProvider { public Boolean getBrokenSelectionRule() { if (brokenSelectionRule!= null) { return brokenSelectionRule; } DataWord address = DataWord.fromString(BROKEN_SELECTION_RULE_KEY); byte[] bytes = this.repository.getStorageBytes(this.contractAddress, address); if (bytes == null || bytes.len... |
### Question:
RemascFederationProvider { public int getFederationSize() { return this.federationSupport.getFederationSize(); } RemascFederationProvider(
ActivationConfig activationConfig,
BridgeConstants bridgeConstants,
Repository repository,
Block processingBlock); int ... |
### Question:
RemascFederationProvider { public RskAddress getFederatorAddress(int n) { byte[] publicKey = this.federationSupport.getFederatorBtcPublicKey(n); return new RskAddress(ECKey.fromPublicOnly(publicKey).getAddress()); } RemascFederationProvider(
ActivationConfig activationConfig,
Bridg... |
### Question:
BlockDifficulty implements Comparable<BlockDifficulty>, Serializable { public BlockDifficulty add(BlockDifficulty other) { return new BlockDifficulty(value.add(other.value)); } BlockDifficulty(BigInteger value); byte[] getBytes(); BigInteger asBigInteger(); @Override boolean equals(Object other); @Overrid... |
### Question:
BlockDifficulty implements Comparable<BlockDifficulty>, Serializable { @Override public int compareTo(@Nonnull BlockDifficulty other) { return value.compareTo(other.value); } BlockDifficulty(BigInteger value); byte[] getBytes(); BigInteger asBigInteger(); @Override boolean equals(Object other); @Override ... |
### Question:
Wallet { public List<byte[]> getAccountAddresses() { List<byte[]> addresses = new ArrayList<>(); Set<RskAddress> keys = new HashSet<>(); synchronized(accessLock) { for (RskAddress addr: this.initialAccounts) { addresses.add(addr.getBytes()); } for (byte[] address: keyDS.keys()) { keys.add(new RskAddress(a... |
### Question:
Wallet { public byte[] addAccountWithSeed(String seed) { return addAccountWithPrivateKey(Keccak256Helper.keccak256(seed.getBytes(StandardCharsets.UTF_8))); } Wallet(KeyValueDataSource keyDS); List<byte[]> getAccountAddresses(); String[] getAccountAddressesAsHex(); RskAddress addAccount(); RskAddress addAc... |
### Question:
Wallet { public boolean unlockAccount(RskAddress addr, String passphrase, long duration) { long ending = System.currentTimeMillis() + duration; boolean unlocked = unlockAccount(addr, passphrase); if (unlocked) { synchronized (accessLock) { unlocksTimeouts.put(addr, ending); } } return unlocked; } Wallet(K... |
### Question:
Wallet { public boolean lockAccount(RskAddress addr) { synchronized (accessLock) { if (!accounts.containsKey(addr)) { return false; } accounts.remove(addr); return true; } } Wallet(KeyValueDataSource keyDS); List<byte[]> getAccountAddresses(); String[] getAccountAddressesAsHex(); RskAddress addAccount(); ... |
### Question:
Wallet { public Account getAccount(RskAddress addr) { synchronized (accessLock) { if (!accounts.containsKey(addr)) { return null; } if (unlocksTimeouts.containsKey(addr)) { long ending = unlocksTimeouts.get(addr); long time = System.currentTimeMillis(); if (ending < time) { unlocksTimeouts.remove(addr); a... |
### Question:
Wallet { public byte[] addAccountWithPrivateKey(byte[] privateKeyBytes) { Account account = new Account(ECKey.fromPrivate(privateKeyBytes)); synchronized (accessLock) { RskAddress addr = addAccount(account); if (!this.initialAccounts.contains(addr)) { this.initialAccounts.add(addr); } return addr.getBytes... |
### Question:
SnapshotManager { @VisibleForTesting public List<Long> getSnapshots() { return this.snapshots; } SnapshotManager(
Blockchain blockchain,
BlockStore blockStore,
TransactionPool transactionPool,
MinerServer minerServer); int takeSnapshot(); boolean resetSnapsh... |
### Question:
SnapshotManager { public boolean revertToSnapshot(int snapshotId) { if (snapshotId <= 0 || snapshotId > this.snapshots.size()) { return false; } long newBestBlockNumber = this.snapshots.get(snapshotId - 1); this.snapshots = this.snapshots.stream().limit(snapshotId).collect(Collectors.toList()); long curre... |
### Question:
ReversibleTransactionExecutor { public ProgramResult executeTransaction( Block executionBlock, RskAddress coinbase, byte[] gasPrice, byte[] gasLimit, byte[] toAddress, byte[] value, byte[] data, RskAddress fromAddress) { return executeTransaction_workaround( repositoryLocator.snapshotAt(executionBlock.get... |
### Question:
ConsensusValidationMainchainViewImpl implements ConsensusValidationMainchainView { @Override public synchronized List<BlockHeader> get(Keccak256 startingHashToGetMainchainFrom, int height) { List<BlockHeader> headers = new ArrayList<>(); Keccak256 currentHash = startingHashToGetMainchainFrom; for(int i = ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.