cita-cloud / cloud-cli Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
偶尔报错:
thread 'cmd::admin::tests::test_admin_subcmds' panicked at 'MockControllerClient::connect_lazy(?, ?): No matching expectation found', src/core/mock.rs:41:1
$ cldi system-config
{
"admin": "0xae069e1925a1dad2a1f4c7034d87258dfd9b6532",
"block_interval": 3,
"chain_id": "0x26b0b83e7281be3b117658b6f2636d0368cad3d74f22243428f5401a4b70897e",
"validators": [
"0x724f28ac8d069f150d541a07235ebc2363ae9b2a",
"0x1e0427b2a2ba34dceda5788d98f59aef0eb92f8e",
"0x868a116bd018c3ed0facb4a761829485f03c2f73",
"0xc35b3b7437a31b4d0a737041a17a8e181ae25ba5"
],
"version": 0
}
typemap is Unmaintained
Details | |
---|---|
Status | unmaintained |
Package | typemap |
Version | 0.3.3 |
URL | reem/rust-typemap#45 |
Date | 2019-04-06 |
The maintainer seems unreachable.
The crate may or may not be usable as-is despite no maintenance and may not work in future versions of Rust.
The last release seems to have been seven years ago.
The below list has not been vetted in any way and may or may not contain alternatives;
See advisory page for additional details.
https://github.com/cita-cloud/cloud-cli/blob/main/src/cmd/bench.rs#L124
可能会导致性能压测的时候被block quota limit限制。
Lines 255 to 259 in c909e9b
This should be if !m.is_present("file")
.
Potential segfault in the time crate
Details | |
---|---|
Package | time |
Version | 0.1.43 |
URL | time-rs/time#293 |
Date | 2020-11-18 |
Patched versions | >=0.2.23 |
Unaffected versions | =0.2.0,=0.2.1,=0.2.2,=0.2.3,=0.2.4,=0.2.5,=0.2.6 |
Unix-like operating systems may segfault due to dereferencing a dangling pointer in specific circumstances. This requires an environment variable to be set in a different thread than the affected functions. This may occur without the user's knowledge, notably in a third-party library.
The affected functions from time 0.2.7 through 0.2.22 are:
time::UtcOffset::local_offset_at
time::UtcOffset::try_local_offset_at
time::UtcOffset::current_local_offset
time::UtcOffset::try_current_local_offset
time::OffsetDateTime::now_local
time::OffsetDateTime::try_now_local
The affected functions in time 0.1 (all versions) are:
at
at_utc
now
Non-Unix targets (including Windows and wasm) are unaffected.
Pending a proper fix, the internal method that determines the local offset has been modified to always return None
on the affected operating systems. This has the effect of returning an Err
on the try_*
methods and UTC
on the non-try_*
methods.
Users and library authors with time in their dependency tree should perform cargo update
, which will pull in the updated, unaffected code.
Users of time 0.1 do not have a patch and should upgrade to an unaffected version: time 0.2.23 or greater or the 0.3 series.
No workarounds are known.
See advisory page for additional details.
https://docs.citahub.com/zh-CN/cita2.0/rpc-guide/rpc
文档中对于复杂架构的输出采用了 json 格式,而 peer-count
, block-number
, block-hash
等等采用了字符串输出
$ cldi peer-count
peer_count: 2
还有 GetTransaction
采用了两者的兼容:
$ cldi get-tx 0x22ce8fe4e68e791825edad6cd7a944e77eba3e8d41fe582bcbf7d3b06fb17623
tx: {
"transaction": {
"transaction": {
"chain_id": "0x22ae4cd3acabd1f259e255dba07a2e463cea57cf7d2802ebc399330f0bb18b02",
"data": "0x4f2be91f",
"nonce": "727992510686994504",
"quota": 3000000,
"to": "0x253479ef7f0209ad761960e9f41bb18d1113b2bb",
"valid_until_block": 22629,
"value": "0x0000000000000000000000000000000000000000000000000000000000000000",
"version": 0
},
"transaction_hash": "0x22ce8fe4e68e791825edad6cd7a944e77eba3e8d41fe582bcbf7d3b06fb17623",
"witness": {
"sender": "0x415f568207900b6940477396fcd2c201efe49beb",
"signature": "0x947ce32efb441bb9a8240f256700df69fb8ea71af94f5a93bf31a0171fbd72b07999d30d0b076c2ecaa19d0327673cae4ac75e7526ba83f2bbb6d5f5657877e66dd968546f2af3053be1d31aed723b58bf5380884ec5f2d41e8156dcc17c1317456c2cc9fb28290d7da0e606267ec1b00bfe54bb214ba5d6c2831c8211e9f343"
}
},
"type": "Normal"
}
代码中看到很多类似的打印:
println!("block_number: {}", block_number);
为了 cloud-cli
未来更强的通用性,我建议将所有输出统一成 json 的格式输出,也可以作为未来 SDK 的设计标准
$ cldi account -h
cldi-account
Manage account
USAGE:
cldi account [SUBCOMMAND]
OPTIONS:
-h, --help Print help information
SUBCOMMANDS:
create Create an account
delete Delete an account
export Export an account
help Print this message or the help of the given subcommand(s)
import Import an account
login Login to use the user's account as default
CLI will use the account has login, but we can't show current log account.
traitobject is Unmaintained
Details | |
---|---|
Status | unmaintained |
Package | traitobject |
Version | 0.1.0 |
URL | reem/rust-traitobject#7 |
Date | 2021-10-04 |
Crate traitobject
has not had a release for over five years.
In addition there is an existing security advisory that has not been addressed:
The below list has not been vetted in any way and may or may not contain alternatives;
See advisory page for additional details.
$ cldi admin update-validators -h
Update validators of the chain
Usage: cldi admin update-validators <validators>...
Arguments:
<validators>... a space-separated list of the new validator addresses, e.g. `cldi update-validators 0x12..34 0xab..cd`
最后 e.g. 这里少了一层 admin 子命令
Potential segfault in
localtime_r
invocations
Details | |
---|---|
Package | chrono |
Version | 0.4.19 |
URL | chronotope/chrono#499 |
Date | 2020-11-10 |
Unix-like operating systems may segfault due to dereferencing a dangling pointer in specific circumstances. This requires an environment variable to be set in a different thread than the affected functions. This may occur without the user's knowledge, notably in a third-party library.
No workarounds are known.
See advisory page for additional details.
$ cldi update-validators -h
cldi-update-validators
Update validators of the chain
USAGE:
cldi update-validators <validators>...
ARGS:
<validators>... the new validator list
这里没明确说明validators的格式是什么样的?
我尝试了好几次,才发现是用空格隔开的:
$ cldi update-validators 0x724f28ac8d069f150d541a07235ebc2363ae9b2a 0x1e0427b2a2ba34dceda5788d98f59aef0eb92f8e 0x868a116bd018c3ed0facb4a761829485f03c2f73 0xc35b3b7437a31b4d0a737041a17a8e181ae25ba5
tx_hash: 0x54f9ebdb3d5e52b80cad92c7551a706a4ae20aecd7cde88c167f8659bec4a4b4
最好能给个例子。
查询创世块的timestamp
cldi> get block 0
{
"height": 0,
"prev_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"proposer": "0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp": "2022-07-22 04:09:56 +00:00",
"transaction_root": "0x0000000000000000000000000000000000000000000000000000000000000000",
"tx_count": 0,
"tx_hashes": [],
"version": 0
}
但是为了易读性,这里转换成了年月日的格式。
最好把原始的timestamp也显示出来。
支持最新的riverspace的TLS双向认证方式
$ cldi bench send -c 1 -t 0x0a2d38fad976b007e62d140393d331bf7de10bef -d 0x4f2be91f -q 800000 100000
Preparing connections and transactions..
Sending transactions..
[00:04:47] [===============================================================================================================================================================================================================================================================] 100000/100000 `100000` tasks finished in `285483` ms
`100000` success, `0` failure
bench isn't completed successfully, the first reported error is `status: InvalidArgument, message: "InvalidValidUntilBlock", details: [], metadata: MetadataMap { headers: {"content-type": "application/grpc", "date": "Thu, 24 Nov 2022 05:22:20 GMT", "content-length": "0"} }`
Error: bench failed
bench 发送交易过程中没有更新当前高度,导致发送交易时间超过5分钟的时候,报错InvalidValidUntilBlock。
branch send-with-detail
$ cldi get-block 100
thread 'main' panicked at 'invalid timestamp: ComponentRange { name: "timestamp", minimum: -377705116800, maximum: 253402300799, value: 1642269836979, conditional_range: false }', src/utils.rs:39:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
- time::OffsetDateTime::from_unix_timestamp(timestamp as i64)
+ time::OffsetDateTime::from_unix_timestamp((timestamp / 1000) as i64)
timestamp is ms, should div 1000.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.