Skip to content

Commit

Permalink
Merge pull request #354 from TheWaWaR/update-ckb-to-v0.39
Browse files Browse the repository at this point in the history
chore: Update ckb to v0.39
  • Loading branch information
TheWaWaR authored Dec 18, 2020
2 parents 7a74490 + abb370b commit 0a13cb3
Show file tree
Hide file tree
Showing 14 changed files with 373 additions and 175 deletions.
209 changes: 89 additions & 120 deletions Cargo.lock

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
[package]
name = "ckb-cli"
version = "0.38.0"
version = "0.39.0"
license = "MIT"
authors = ["Linfeng Qian <[email protected]>", "Nervos Core Dev <[email protected]>"]
edition = "2018"

[dependencies]
ckb-jsonrpc-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" }
ckb-hash = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" }
ckb-crypto = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1", features = ["secp"] }
ckb-build-info = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" }
ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" }
ckb-util = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" }
ckb-resource = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" }
ckb-dao-utils = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" }
ckb-chain-spec = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" }
ckb-jsonrpc-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" }
ckb-hash = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" }
ckb-crypto = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2", features = ["secp"] }
ckb-build-info = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" }
ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" }
ckb-util = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" }
ckb-resource = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" }
ckb-dao-utils = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" }
ckb-chain-spec = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" }
ckb-sdk = { path = "ckb-sdk" }
ckb-index = { path = "ckb-index" }
plugin-protocol = { path = "plugin-protocol", package = "ckb-cli-plugin-protocol" }
Expand All @@ -23,7 +23,7 @@ jsonrpc-core = "10.1"
jsonrpc-derive = "10.1"
jsonrpc-http-server = "10.1"
jsonrpc-server-utils = "10.1"
secp256k1 = {version = "0.17.0" }
secp256k1 = { version = "0.19", features = ["recovery"] }
faster-hex = "0.4"
env_logger = "0.6"
crossbeam-channel = "0.3"
Expand Down Expand Up @@ -57,7 +57,7 @@ tui = "0.6.0"
termion = "1.5"

[build-dependencies]
ckb-build-info = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" }
ckb-build-info = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" }

[workspace]
members = ["ckb-sdk", "ckb-index", "ckb-sdk-types", "plugin-protocol"]
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ci: fmt clippy test security-audit
git diff --exit-code Cargo.lock

integration:
bash devtools/ci/integration.sh v0.38.0-rc1
bash devtools/ci/integration.sh v0.39.0-rc2

prod: ## Build binary with release profile.
cargo build --release
Expand Down
4 changes: 2 additions & 2 deletions ckb-index/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ckb-index"
version = "0.38.0"
version = "0.39.0"
authors = ["Linfeng Qian <[email protected]>", "Nervos Core Dev <[email protected]>"]
edition = "2018"
license = "MIT"
Expand All @@ -11,6 +11,6 @@ serde_derive = "1.0"
bincode = "1.1.4"
log = "0.4.6"
failure = "0.1.5"
ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" }
ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" }
ckb-sdk = { path = "../ckb-sdk" }
rocksdb = { package = "ckb-rocksdb", version = "=0.13.0", features = ["snappy"] }
14 changes: 7 additions & 7 deletions ckb-sdk-types/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ckb-sdk-types"
version = "0.38.0"
version = "0.39.0"
authors = ["Linfeng Qian <[email protected]>", "Nervos Core Dev <[email protected]>"]
edition = "2018"
license = "MIT"
Expand All @@ -9,11 +9,11 @@ license = "MIT"
serde = { version = "1.0", features = ["rc"] }
serde_derive = "1.0"

ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" }
ckb-traits = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" }
ckb-jsonrpc-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" }
ckb-hash = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" }
ckb-error = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" }
ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" }
ckb-traits = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" }
ckb-jsonrpc-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" }
ckb-hash = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" }
ckb-error = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" }

[dev-dependencies]
ckb-crypto = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1", features = ["secp"] }
ckb-crypto = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2", features = ["secp"] }
10 changes: 8 additions & 2 deletions ckb-sdk-types/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,18 +221,24 @@ impl CellProvider for Resource {
}

impl CellDataProvider for Resource {
fn load_cell_data(&self, cell: &CellMeta) -> Option<(Bytes, Byte32)> {
fn load_cell_data(&self, cell: &CellMeta) -> Option<Bytes> {
cell.mem_cell_data
.as_ref()
.map(ToOwned::to_owned)
.or_else(|| self.get_cell_data(&cell.out_point))
}

fn get_cell_data(&self, out_point: &OutPoint) -> Option<(Bytes, Byte32)> {
fn get_cell_data(&self, out_point: &OutPoint) -> Option<Bytes> {
self.required_cells
.get(out_point)
.and_then(|cell_meta| cell_meta.mem_cell_data.clone())
}

fn get_cell_data_hash(&self, out_point: &OutPoint) -> Option<Byte32> {
self.required_cells
.get(out_point)
.and_then(|cell_meta| cell_meta.mem_cell_data_hash.clone())
}
}

impl HeaderProvider for Resource {
Expand Down
17 changes: 9 additions & 8 deletions ckb-sdk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ckb-sdk"
version = "0.38.0"
version = "0.39.0"
authors = ["Linfeng Qian <[email protected]>", "Nervos Core Dev <[email protected]>"]
edition = "2018"
license = "MIT"
Expand All @@ -12,7 +12,7 @@ serde_json = "1.0"
bech32 = "0.6.0"
log = "0.4.6"
reqwest = "0.9"
secp256k1 = "0.17.0"
secp256k1 = { version = "0.19", features = ["recovery"] }
faster-hex = "0.4"
fnv = "1.0.3"
aes-ctr = "0.3.0"
Expand All @@ -25,10 +25,11 @@ uuid = { version = "0.7.4", features = ["v4"] }
chrono = "0.4.6"
failure = "0.1.5"

ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" }
ckb-script = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" }
ckb-jsonrpc-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" }
ckb-hash = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" }
ckb-resource = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" }
ckb-crypto = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1", features = ["secp"] }
ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" }
ckb-error = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" }
ckb-script = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" }
ckb-jsonrpc-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" }
ckb-hash = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" }
ckb-resource = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" }
ckb-crypto = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2", features = ["secp"] }
ckb-sdk-types = { path = "../ckb-sdk-types" }
23 changes: 19 additions & 4 deletions ckb-sdk/src/rpc/client.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use ckb_jsonrpc_types::{
BannedAddr, Block, BlockNumber, BlockReward, BlockTemplate, BlockView, CellOutputWithOutPoint,
CellTransaction, CellWithStatus, ChainInfo, EpochNumber, EpochView, ExtraLoggerConfig,
HeaderView, JsonBytes, LiveCell, LocalNode, LockHashIndexState, MainLoggerConfig, OutPoint,
PeerState, RemoteNode, Script, Timestamp, Transaction, TransactionProof, TransactionWithStatus,
TxPoolInfo, Uint64, Version,
CellTransaction, CellWithStatus, ChainInfo, Consensus, EpochNumber, EpochView,
ExtraLoggerConfig, HeaderView, JsonBytes, LiveCell, LocalNode, LockHashIndexState,
MainLoggerConfig, OutPoint, PeerState, RawTxPool, RemoteNode, Script, Timestamp, Transaction,
TransactionProof, TransactionWithStatus, TxPoolInfo, Uint64, Version,
};

use super::types;
Expand Down Expand Up @@ -87,6 +87,7 @@ jsonrpc!(pub struct RawHttpRpcClient {
) -> TransactionProof;
pub fn verify_transaction_proof(&mut self, tx_proof: TransactionProof) -> Vec<H256>;
pub fn get_fork_block(&mut self, block_hash: H256) -> Option<BlockView>;
pub fn get_consensus(&mut self) -> Consensus;

// Indexer
pub fn deindex_lock_hash(&mut self, lock_hash: H256) -> ();
Expand Down Expand Up @@ -132,6 +133,7 @@ jsonrpc!(pub struct RawHttpRpcClient {
// Pool
pub fn send_transaction(&mut self, tx: Transaction) -> H256;
pub fn tx_pool_info(&mut self) -> TxPoolInfo;
pub fn get_raw_tx_pool(&mut self, verbose: Option<bool>) -> RawTxPool;

// Stats
pub fn get_blockchain_info(&mut self) -> ChainInfo;
Expand Down Expand Up @@ -294,6 +296,12 @@ impl HttpRpcClient {
.map(|opt| opt.map(Into::into))
.map_err(|err| err.to_string())
}
pub fn get_consensus(&mut self) -> Result<types::Consensus, String> {
self.client
.get_consensus()
.map(Into::into)
.map_err(|err| err.to_string())
}

// Indexer
#[deprecated(since = "0.36.0", note = "Use standalone ckb-indexer")]
Expand Down Expand Up @@ -424,6 +432,13 @@ impl HttpRpcClient {
.map_err(|err| err.to_string())
}

pub fn get_raw_tx_pool(&mut self, verbose: Option<bool>) -> Result<types::RawTxPool, String> {
self.client
.get_raw_tx_pool(verbose)
.map(Into::into)
.map_err(|err| err.to_string())
}

// Stats
pub fn get_blockchain_info(&mut self) -> Result<types::ChainInfo, String> {
self.client
Expand Down
Loading

0 comments on commit 0a13cb3

Please sign in to comment.