Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare release #685

Merged
merged 51 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
853c090
chore(deps): bump gson from 2.9.1 to 2.10.1
dependabot[bot] Jan 10, 2023
cb541e7
chore(deps): bump junitVersion from 5.9.0 to 5.9.2
dependabot[bot] Jan 10, 2023
bad2ded
chore(deps): bump junit-platform-runner from 1.9.0 to 1.9.2
dependabot[bot] Jan 10, 2023
ba262fb
chore(deps): bump com.github.johnrengelman.shadow from 6.1.0 to 8.1.1
dependabot[bot] Mar 21, 2023
a6819b3
chore(deps): bump org.slf4j:slf4j-api from 2.0.0 to 2.0.7
dependabot[bot] Mar 21, 2023
4e8a72f
chore(deps): bump com.squareup.okhttp3:okhttp from 4.10.0 to 4.11.0
dependabot[bot] Apr 25, 2023
ebdb81e
chore(deps): bump com.squareup.okhttp3:logging-interceptor
dependabot[bot] Apr 25, 2023
331fbb8
Merge branch 'develop' into dependabot/gradle/develop/com.squareup.ok…
Apr 26, 2023
6d1028c
Merge pull request #635 from nervosnetwork/dependabot/gradle/develop/…
Apr 26, 2023
2d0b098
chore(deps): bump junitVersion from 5.9.2 to 5.9.3
dependabot[bot] May 2, 2023
04a9871
Merge pull request #638 from nervosnetwork/dependabot/gradle/develop/…
May 3, 2023
f6fadd9
chore(deps): bump org.junit.platform:junit-platform-runner
dependabot[bot] May 2, 2023
27e22c5
fix: 🐛 Make dao handler get correct withdraw block hash
May 11, 2023
e2a7897
Merge pull request #642 from liuck8080/fix_dao_withdraw_phrase2
quake May 11, 2023
4279ed5
feat: 🎸 support type id handler
May 18, 2023
1b05e0b
chore(deps): bump com.google.guava:guava from 31.1-jre to 32.1.1-jre
dependabot[bot] Jul 4, 2023
f88cdfe
Merge pull request #646 from nervosnetwork/dependabot/gradle/develop/…
quake Jul 20, 2023
d4e298d
Merge pull request #643 from liuck8080/feat/type_id_20230517
quake Jul 20, 2023
7cefe1f
Merge branch 'master' into develop
blckngm Jul 20, 2023
6d8ae44
Fix guava dep for ckb
blckngm Jul 20, 2023
499f673
Fix TypeIdHandler name typo
blckngm Jul 20, 2023
cd11e1e
Merge pull request #647 from blckngm/develop
quake Jul 20, 2023
132cf3b
Merge pull request #648 from blckngm/fix-type-id-handler
quake Jul 20, 2023
90e8775
feat: force small change as fee
blckngm Jul 21, 2023
f4dd99e
Check that forceSmallChangeAsFee > 0
blckngm Jul 21, 2023
2718a24
feat!: add script hash type data2
blckngm Jul 21, 2023
4db8897
Allow both changeOutput and forceSmallChangeAsFee
blckngm Jul 24, 2023
311d410
feat!: rpc updates
blckngm Jul 21, 2023
d053055
chore(deps): bump org.jetbrains.kotlin.jvm from 1.8.21 to 1.9.0
dependabot[bot] Jul 25, 2023
d591da3
chore(deps): bump junitVersion from 5.9.0 to 5.10.0
dependabot[bot] Jul 25, 2023
203f7b9
chore(deps): bump org.junit.platform:junit-platform-runner
dependabot[bot] Jul 25, 2023
fad4d9b
Merge pull request #654 from nervosnetwork/dependabot/gradle/develop/…
blckngm Jul 26, 2023
881fefd
Merge pull request #657 from nervosnetwork/dependabot/gradle/develop/…
blckngm Jul 26, 2023
2f1df05
Merge pull request #658 from nervosnetwork/dependabot/gradle/develop/…
blckngm Jul 26, 2023
fc9f011
chore(deps): bump kotestVersion from 5.6.1 to 5.6.2
dependabot[bot] Jul 26, 2023
59bbce2
Merge pull request #652 from nervosnetwork/dependabot/gradle/develop/…
blckngm Jul 26, 2023
6f0906e
Merge pull request #650 from blckngm/ckb2023
quake Jul 27, 2023
0dba908
Allow changeCapacity <= forceSmallChangeAsFee
blckngm Jul 31, 2023
e1b1495
Merge pull request #649 from blckngm/force-small-fee-as-change
quake Jul 31, 2023
720ffa0
feat: support indexer filter script_len_range
blckngm Aug 24, 2023
d31b56f
Merge pull request #663 from blckngm/script-len-range
quake Aug 24, 2023
891e890
fix: value of data2 should be 4 instead of 3
blckngm Aug 24, 2023
4088dfa
Merge pull request #664 from blckngm/fix-data2-value
quake Aug 24, 2023
dccee83
chore(deps): bump org.jetbrains.kotlin.jvm from 1.9.0 to 1.9.10
dependabot[bot] Aug 29, 2023
0b53348
Merge pull request #665 from nervosnetwork/dependabot/gradle/develop/…
blckngm Aug 30, 2023
4f7b742
chore(deps): bump io.mockk:mockk from 1.13.5 to 1.13.7
dependabot[bot] Aug 30, 2023
b88e79d
Merge pull request #662 from nervosnetwork/dependabot/gradle/develop/…
blckngm Aug 30, 2023
fbf7383
Add support to v0.119.0
eval-exec Oct 27, 2024
615bf0e
Merge pull request #683 from eval-exec/exec/Update-to-119.0
quake Nov 25, 2024
b29e57a
Merge branch 'master' into exec/develop-merge-master
eval-exec Nov 26, 2024
53825e5
Merge pull request #684 from eval-exec/exec/develop-merge-master
quake Nov 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ buildscript {
ext.okhttpVersion = '4.10.0'
ext.loggingOkhttpVersion = '4.10.0'
ext.slf4jVersion = '2.0.0'
ext.guavaVersion = '31.1-jre'
ext.junitVersion = '5.9.0'
ext.kotestVersion = '5.6.1'
ext.kotlinVersion = "1.8.21"
ext.mockkVersion = "1.13.5"
ext.guavaVersion = '32.1.1-jre'
ext.junitVersion = '5.10.0'
ext.kotestVersion = '5.6.2'
ext.kotlinVersion = "1.9.10"
ext.mockkVersion = "1.13.7"

repositories {
mavenCentral()
Expand All @@ -23,7 +23,7 @@ buildscript {
}

plugins {
id 'com.github.johnrengelman.shadow' version '6.1.0'
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'java'
}

Expand Down
6 changes: 3 additions & 3 deletions ckb-indexer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ dependencies {

implementation "com.google.code.gson:gson:$gsonVersion"

testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.0'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.0'

// Enable use of the JUnitPlatform Runner within the IDE
testImplementation("org.junit.platform:junit-platform-runner:1.9.0")
testImplementation("org.junit.platform:junit-platform-runner:1.10.0")
}

test {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ public class Filter {
public List<Integer> outputDataLenRange;
public List<Long> outputCapacityRange;
public List<Integer> blockRange;
public List<Integer> scriptLenRange;
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ public SearchKeyBuilder filterBlockRange(int inclusive, int exclusive) {
return this;
}

public SearchKeyBuilder filterScriptLen(int inclusive, int exclusive) {
initFilter();
this.filter.scriptLenRange = new ArrayList<>(2);
this.filter.scriptLenRange.add(inclusive);
this.filter.scriptLenRange.add(exclusive);
return this;
}

private ScriptSearchMode _scriptSearchMode;

public SearchKeyBuilder scriptSearchMode(ScriptSearchMode scriptSearchMode) {
Expand Down
6 changes: 3 additions & 3 deletions ckb-mercury-sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ dependencies {
implementation "com.google.code.gson:gson:$gsonVersion"

testImplementation project(":ckb")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.0")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.0")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.0")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.10.0")
// Enable use of the JUnitPlatform Runner within the IDE
testImplementation("org.junit.platform:junit-platform-runner:1.9.0")
testImplementation("org.junit.platform:junit-platform-runner:1.10.0")
}

test {
Expand Down
46 changes: 42 additions & 4 deletions ckb/src/main/java/org/nervos/ckb/CkbRpcApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,55 @@
import org.nervos.indexer.model.SearchKey;
import org.nervos.indexer.model.resp.*;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.io.IOException;
import java.util.List;

public interface CkbRpcApi {
Block getBlock(byte[] blockHash) throws IOException;

BlockWithCycles getBlock(byte[] blockHash, boolean with_cycles) throws IOException;

PackedBlockWithCycles getPackedBlock(byte[] blockHash, boolean with_cycles) throws IOException;

Block getBlockByNumber(long blockNumber) throws IOException;

BlockWithCycles getBlockByNumber(long blockNumber, boolean with_cycles) throws IOException;

PackedBlockWithCycles getPackedBlockByNumber(long blockNumber, boolean with_cycles) throws IOException;

TransactionWithStatus getTransaction(byte[] transactionHash) throws IOException;
default TransactionWithStatus getTransaction(@Nonnull byte[] transactionHash) throws IOException {
return getTransaction(transactionHash, null);
}

TransactionWithStatus getTransaction(@Nonnull byte[] transactionHash, @Nullable Boolean onlyCommitted) throws IOException;

/**
* get transaction with verbosity value is 1
*
* @param transactionHash the transaction hash
* @return the RPC does not return the transaction content and the field transaction must be null.
* @throws IOException
*/
TransactionWithStatus getTransactionStatus(byte[] transactionHash) throws IOException;
PackedTransactionWithStatus getPackedTransaction(byte[] transactionHash) throws IOException;
default TransactionWithStatus getTransactionStatus(@Nonnull byte[] transactionHash) throws IOException {
return getTransactionStatus(transactionHash, null);
}

TransactionWithStatus getTransactionStatus(@Nonnull byte[] transactionHash, @Nullable Boolean onlyCommitted) throws IOException;

default PackedTransactionWithStatus getPackedTransaction(@Nonnull byte[] transactionHash) throws IOException {
return getPackedTransaction(transactionHash, null);
}

PackedTransactionWithStatus getPackedTransaction(@Nonnull byte[] transactionHash, @Nullable Boolean onlyCommitted) throws IOException;

byte[] getBlockHash(long blockNumber) throws IOException;

BlockEconomicState getBlockEconomicState(byte[] blockHash) throws IOException;

Header getTipHeader() throws IOException;

PackedHeader getPackedTipHeader() throws IOException;

CellWithStatus getLiveCell(OutPoint outPoint, boolean withData) throws IOException;
Expand All @@ -44,19 +66,25 @@ public interface CkbRpcApi {
Epoch getEpochByNumber(long epochNumber) throws IOException;

Header getHeader(byte[] blockHash) throws IOException;

PackedHeader getPackedHeader(byte[] blockHash) throws IOException;

Header getHeaderByNumber(long blockNumber) throws IOException;

PackedHeader getPackedHeaderByNumber(long blockNumber) throws IOException;

TransactionProof getTransactionProof(List<byte[]> txHashes) throws IOException;

TransactionProof getTransactionProof(List<byte[]> txHashes, byte[] blockHash) throws IOException;

List<byte[]> verifyTransactionProof(TransactionProof transactionProof) throws IOException;

TransactionAndWitnessProof getTransactionAndWitnessProof(List<byte[]> txHashes, byte[] blockHash) throws IOException;

List<byte[]> verifyTransactionAndWitnessProof(TransactionAndWitnessProof proof) throws IOException;

Block getForkBlock(byte[] blockHash) throws IOException;

PackedBlockWithCycles getPackedForkBlock(byte[] blockHash) throws IOException;

Consensus getConsensus() throws IOException;
Expand All @@ -78,6 +106,16 @@ public interface CkbRpcApi {
byte[] sendTransaction(Transaction transaction, OutputsValidator outputsValidator)
throws IOException;

byte[] sendTestTransaction(Transaction transaction) throws IOException;

byte[] sendTestTransaction(Transaction transaction, OutputsValidator outputsValidator)
throws IOException;

byte[] testTxPoolAccept(Transaction transaction) throws IOException;

byte[] testTxPoolAccept(Transaction transaction, OutputsValidator outputsValidator)
throws IOException;

NodeInfo localNodeInfo() throws IOException;

List<PeerNodeInfo> getPeers() throws IOException;
Expand Down Expand Up @@ -129,5 +167,5 @@ long calculateDaoMaximumWithdraw(OutPoint outPoint, byte[] withdrawBlockHash)
* @return Returns the fee_rate statistics of confirmed blocks on the chain.
* @throws IOException if error there is an error
*/
FeeRateStatics getFeeRateStatics(Integer target) throws IOException;
FeeRateStatistics getFeeRateStatistics(Integer target) throws IOException;
}
78 changes: 65 additions & 13 deletions ckb/src/main/java/org/nervos/ckb/service/Api.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package org.nervos.ckb.service;

import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Lists;
import com.google.gson.reflect.TypeToken;
import org.jetbrains.annotations.NotNull;
import org.nervos.ckb.CkbRpcApi;
import org.nervos.ckb.type.*;
import org.nervos.ckb.utils.Convert;
Expand All @@ -9,13 +12,14 @@
import org.nervos.indexer.model.resp.*;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class Api implements CkbRpcApi {

private RpcService rpcService;
private final RpcService rpcService;

public Api(String nodeUrl) {
this(nodeUrl, false);
Expand All @@ -29,6 +33,20 @@ public Api(RpcService rpcService) {
this.rpcService = rpcService;
}

// Remove trailing nulls for better backward compatibility.
@VisibleForTesting
public static List<Object> noTrailingNullParams(Object... ps) {
ArrayList<Object> params = Lists.newArrayList(ps);
for (int i = params.size() - 1; i >= 0; i--) {
if (params.get(i) == null) {
params.remove(i);
} else {
break;
}
}
return params;
}

@Override
public Block getBlock(byte[] blockHash) throws IOException {
return rpcService.post("get_block", Collections.singletonList(blockHash), Block.class);
Expand Down Expand Up @@ -95,19 +113,19 @@ public PackedBlockWithCycles getPackedBlockByNumber(long blockNumber, boolean wi
}

@Override
public TransactionWithStatus getTransaction(byte[] transactionHash) throws IOException {
public TransactionWithStatus getTransaction(@NotNull byte[] transactionHash, Boolean onlyCommitted) throws IOException {
return rpcService.post(
"get_transaction", Collections.singletonList(transactionHash), TransactionWithStatus.class);
"get_transaction", noTrailingNullParams(transactionHash, null, onlyCommitted), TransactionWithStatus.class);
}

@Override
public TransactionWithStatus getTransactionStatus(byte[] transactionHash) throws IOException {
return rpcService.post("get_transaction", Arrays.asList(transactionHash, 1), TransactionWithStatus.class);
public TransactionWithStatus getTransactionStatus(@NotNull byte[] transactionHash, Boolean onlyCommitted) throws IOException {
return rpcService.post("get_transaction", noTrailingNullParams(transactionHash, 1, onlyCommitted), TransactionWithStatus.class);
}

@Override
public PackedTransactionWithStatus getPackedTransaction(byte[] transactionHash) throws IOException {
return rpcService.post("get_transaction", Arrays.asList(transactionHash, 0), PackedTransactionWithStatus.class);
public PackedTransactionWithStatus getPackedTransaction(@NotNull byte[] transactionHash, Boolean onlyCommitted) throws IOException {
return rpcService.post("get_transaction", noTrailingNullParams(transactionHash, 0, onlyCommitted), PackedTransactionWithStatus.class);
}

@Override
Expand Down Expand Up @@ -215,7 +233,7 @@ public List<byte[]> verifyTransactionProof(TransactionProof transactionProof) th
public TransactionAndWitnessProof getTransactionAndWitnessProof(List<byte[]> txHashes, byte[] blockHash) throws IOException {
return rpcService.post(
"get_transaction_and_witness_proof",
blockHash == null ? Collections.singletonList(txHashes): Arrays.asList(txHashes, blockHash),
blockHash == null ? Collections.singletonList(txHashes) : Arrays.asList(txHashes, blockHash),
TransactionAndWitnessProof.class);
}

Expand Down Expand Up @@ -248,7 +266,7 @@ public Consensus getConsensus() throws IOException {

@Override
public long getBlockMedianTime(byte[] blockHash) throws IOException {
return rpcService.post("get_block_median_time", Arrays.asList(blockHash), Long.class);
return rpcService.post("get_block_median_time", Collections.singletonList(blockHash), Long.class);
}

/** Stats RPC */
Expand Down Expand Up @@ -279,6 +297,40 @@ public RawTxPoolVerbose getRawTxPoolVerbose() throws IOException {
"get_raw_tx_pool", Collections.singletonList(true), RawTxPoolVerbose.class);
}

@Override
public byte[] sendTestTransaction(Transaction transaction) throws IOException {
return rpcService.post(
"send_test_transaction",
Arrays.asList(Convert.parseTransaction(transaction), OutputsValidator.PASSTHROUGH),
byte[].class);
}

@Override
public byte[] sendTestTransaction(Transaction transaction, OutputsValidator outputsValidator)
throws IOException {
return rpcService.post(
"send_test_transaction",
Arrays.asList(Convert.parseTransaction(transaction), outputsValidator),
byte[].class);
}

@Override
public byte[] testTxPoolAccept(Transaction transaction) throws IOException {
return rpcService.post(
"test_tx_pool_accept",
Arrays.asList(Convert.parseTransaction(transaction), OutputsValidator.PASSTHROUGH),
byte[].class);
}

@Override
public byte[] testTxPoolAccept(Transaction transaction, OutputsValidator outputsValidator)
throws IOException {
return rpcService.post(
"test_tx_pool_accept",
Arrays.asList(Convert.parseTransaction(transaction), outputsValidator),
byte[].class);
}

@Override
public byte[] sendTransaction(Transaction transaction) throws IOException {
return rpcService.post(
Expand Down Expand Up @@ -410,7 +462,7 @@ public TxsWithCells getTransactionsGrouped(
@Override
public CellCapacityResponse getCellsCapacity(SearchKey searchKey) throws IOException {
return this.rpcService.post("get_cells_capacity",
Arrays.asList(searchKey),
Collections.singletonList(searchKey),
CellCapacityResponse.class);
}

Expand All @@ -437,10 +489,10 @@ public List<RpcResponse> batchRPC(List<List> requests) throws IOException {
}

@Override
public FeeRateStatics getFeeRateStatics(Integer target) throws IOException {
public FeeRateStatistics getFeeRateStatistics(Integer target) throws IOException {
return rpcService.post(
"get_fee_rate_statics",
"get_fee_rate_statistics",
target == null ? Collections.emptyList() : Collections.singletonList(target),
FeeRateStatics.class);
FeeRateStatistics.class);
}
}
Loading