Skip to content

Commit

Permalink
Merge pull request #392 from TheWaWaR/update-ckb-to-v0.42
Browse files Browse the repository at this point in the history
chore: Update ckb to v0.42
  • Loading branch information
TheWaWaR authored May 25, 2021
2 parents 7c5c03a + 1ce53a0 commit 565b3d9
Show file tree
Hide file tree
Showing 12 changed files with 342 additions and 317 deletions.
517 changes: 283 additions & 234 deletions Cargo.lock

Large diffs are not rendered by default.

29 changes: 15 additions & 14 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
[package]
name = "ckb-cli"
version = "0.41.0"
version = "0.42.1"
license = "MIT"
authors = ["Linfeng Qian <[email protected]>", "Nervos Core Dev <[email protected]>"]
edition = "2018"
description = "ckb command line interface"

[dependencies]
ckb-jsonrpc-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.41.0-rc1" }
ckb-hash = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.41.0-rc1" }
ckb-crypto = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.41.0-rc1", features = ["secp"] }
ckb-build-info = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.41.0-rc1" }
ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.41.0-rc1" }
ckb-util = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.41.0-rc1" }
ckb-resource = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.41.0-rc1" }
ckb-dao-utils = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.41.0-rc1" }
ckb-chain-spec = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.41.0-rc1" }
ckb-sdk = { path = "ckb-sdk" }
ckb-index = { path = "ckb-index" }
plugin-protocol = { path = "plugin-protocol", package = "ckb-cli-plugin-protocol" }
ckb-jsonrpc-types = "=0.42.0"
ckb-hash = "=0.42.0"
ckb-crypto = { version = "=0.42.0", features = ["secp"] }
ckb-build-info = "=0.42.0"
ckb-types = "=0.42.0"
ckb-util = "=0.42.0"
ckb-resource = "=0.42.0"
ckb-dao-utils = "=0.42.0"
ckb-chain-spec = "=0.42.0"
ckb-sdk = { path = "ckb-sdk", version = "=0.42.1" }
ckb-index = { path = "ckb-index", version = "=0.42.1" }
plugin-protocol = { path = "plugin-protocol", package = "ckb-cli-plugin-protocol", version = "=0.42.1" }
jsonrpc-core-client = "17"
jsonrpc-core = "17"
jsonrpc-derive = "17"
Expand Down Expand Up @@ -60,7 +61,7 @@ tui = "0.6.0"
termion = "1.5"

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

[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.41.0-rc1
bash devtools/ci/integration.sh v0.42.0-rc1

prod: ## Build binary with release profile.
cargo build --release
Expand Down
9 changes: 5 additions & 4 deletions ckb-index/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
[package]
name = "ckb-index"
version = "0.41.0"
version = "0.42.1"
authors = ["Linfeng Qian <[email protected]>", "Nervos Core Dev <[email protected]>"]
edition = "2018"
license = "MIT"
description = "ckb-cli index database"

[dependencies]
serde = { version = "1.0", features = ["rc"] }
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.41.0-rc1" }
ckb-sdk = { path = "../ckb-sdk" }
rocksdb = { package = "ckb-rocksdb", version = "=0.13.0", features = ["snappy"] }
ckb-types = "=0.42.0"
ckb-sdk = { path = "../ckb-sdk", version = "=0.42.1" }
rocksdb = { package = "ckb-rocksdb", version = "=0.15.1", features = ["snappy"] }
2 changes: 1 addition & 1 deletion ckb-index/src/kvdb/rocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ impl<'a> KVTxn<'a> for RocksTxn<'a> {
.expect("Put kv to rocks batch failed")
}
self.db
.write(batch)
.write(&batch)
.expect("Commit rocks txn transaction failed");
log::debug!("Rocks txn commited!");
}
Expand Down
15 changes: 8 additions & 7 deletions ckb-sdk-types/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
[package]
name = "ckb-sdk-types"
version = "0.41.0"
version = "0.42.1"
authors = ["Linfeng Qian <[email protected]>", "Nervos Core Dev <[email protected]>"]
edition = "2018"
license = "MIT"
description = "ckb-cli sdk common types"

[dependencies]
serde = { version = "1.0", features = ["rc"] }
serde_derive = "1.0"

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

[dev-dependencies]
ckb-crypto = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.41.0-rc1", features = ["secp"] }
ckb-crypto = { version = "=0.42.0", features = ["secp"] }
19 changes: 10 additions & 9 deletions ckb-sdk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
[package]
name = "ckb-sdk"
version = "0.41.0"
version = "0.42.1"
authors = ["Linfeng Qian <[email protected]>", "Nervos Core Dev <[email protected]>"]
edition = "2018"
license = "MIT"
description = "ckb-cli sdk"

[dependencies]
serde = { version = "1.0", features = ["rc"] }
Expand All @@ -29,11 +30,11 @@ tokio = { version = "1" }
bytes = "1"
futures = "0.3"

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

use super::primitive;
Expand Down Expand Up @@ -115,7 +115,6 @@ jsonrpc!(pub struct RawHttpRpcClient {

// Stats
pub fn get_blockchain_info(&mut self) -> ChainInfo;
pub fn get_peers_state(&mut self) -> Vec<PeerState>;

// Miner
pub fn get_block_template(&mut self, bytes_limit: Option<Uint64>, proposals_limit: Option<Uint64>, max_version: Option<Version>) -> BlockTemplate;
Expand Down Expand Up @@ -367,9 +366,6 @@ impl HttpRpcClient {
.map(Into::into)
.map_err(|err| err.to_string())
}
pub fn get_peers_state(&mut self) -> Result<Vec<PeerState>, String> {
self.client.get_peers_state().map_err(|err| err.to_string())
}

// Miner
pub fn get_block_template(
Expand Down
24 changes: 0 additions & 24 deletions ckb-sdk/src/rpc/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1133,27 +1133,3 @@ impl From<rpc_types::RawTxPool> for RawTxPool {
}
}
}

// =========
// sync.rs
// =========
//// TODO make PeerState fields public
// #[derive(Deserialize, Serialize, Debug)]
// pub struct PeerState {
// // TODO use peer_id
// // peer session id
// pub peer: Uint32,
// // last updated timestamp
// pub last_updated: Timestamp,
// // blocks count has request but not receive response yet
// pub blocks_in_flight: Uint32,
// }
// impl From<rpc_types::PeerState> for PeerState {
// fn from(json: rpc_types::PeerState) -> PeerState {
// PeerState {
// peer: json.peer.into(),
// last_updated: json.last_updated.into(),
// blocks_in_flight: json.blocks_in_flight.into()
// }
// }
// }
10 changes: 6 additions & 4 deletions plugin-protocol/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
[package]
name = "ckb-cli-plugin-protocol"
version = "0.1.0"
version = "0.42.1"
authors = ["Nervos Core Dev <[email protected]>"]
edition = "2018"
license = "MIT"
description = "ckb-cli plugin protocol"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
ckb-index = { path = "../ckb-index" }
ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.41.0-rc1" }
ckb-jsonrpc-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.41.0-rc1" }
ckb-index = { path = "../ckb-index", version = "=0.42.1" }
ckb-types = "=0.42.0"
ckb-jsonrpc-types = "=0.42.0"
serde = { version = "1.0", features = ["rc"] }
serde_derive = "1.0"
serde_json = "1.0"
Expand Down
10 changes: 4 additions & 6 deletions src/subcommands/rpc.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use ckb_jsonrpc_types::{
self as rpc_types, BlockNumber, EpochNumber, JsonBytes, PeerState, Script, Transaction,
self as rpc_types, BlockNumber, EpochNumber, JsonBytes, Script, Transaction,
};
use ckb_sdk::{
rpc::{
Expand Down Expand Up @@ -240,7 +240,7 @@ impl<'a> RpcSubCommand<'a> {
.required(true)
.about("The cycles of the transaction")
)
.about("Broadcast transaction without verify"),
.about("[TEST ONLY] Broadcast transaction without verify"),
App::new("truncate")
.arg(
Arg::with_name("tip-hash")
Expand All @@ -250,7 +250,7 @@ impl<'a> RpcSubCommand<'a> {
.required(true)
.about("Target tip block hash")
)
.about("Truncate blocks to target tip block"),
.about("[TEST ONLY] Truncate blocks to target tip block"),
App::new("generate_block")
.arg(
Arg::with_name("json-path")
Expand All @@ -266,6 +266,7 @@ impl<'a> RpcSubCommand<'a> {
.validator(|input| HexParser.validate(input))
.about("Block assembler message (hex format)")
)
.about("[TEST ONLY] Generate an empty block")
])
}
}
Expand Down Expand Up @@ -758,9 +759,6 @@ pub struct OptionH256(pub Option<H256>);
#[derive(Serialize, Deserialize)]
pub struct OptionEpochView(pub Option<EpochView>);

#[derive(Serialize, Deserialize)]
pub struct PeerStates(pub Vec<PeerState>);

#[derive(Serialize, Deserialize)]
pub struct BannedAddrList(pub Vec<BannedAddr>);

Expand Down
14 changes: 7 additions & 7 deletions test/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cli-test"
version = "0.41.0"
version = "0.42.0"
authors = ["Linfeng Qian <[email protected]>"]
edition = "2018"

Expand All @@ -13,12 +13,12 @@ log = "0.4"
env_logger = "0.6"
toml = "0.5.0"
serde_yaml = "0.8.9"
ckb-sdk = { path = "../ckb-sdk" }
ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.41.0-rc1" }
ckb-app-config = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.41.0-rc1" }
ckb-chain-spec = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.41.0-rc1" }
ckb-crypto = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.41.0-rc1", features = ["secp"] }
ckb-hash = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.41.0-rc1" }
ckb-sdk = { path = "../ckb-sdk", version = "0.42.1" }
ckb-types = "=0.42.0"
ckb-app-config = "=0.42.0"
ckb-chain-spec = "=0.42.0"
ckb-crypto = { version = "=0.42.0", features = ["secp"] }
ckb-hash = "=0.42.0"
regex = "1.1.6"

# Prevent this from interfering with workspaces
Expand Down

0 comments on commit 565b3d9

Please sign in to comment.