Giter VIP home page Giter VIP logo

starcoin's Introduction

 ██████╗████████╗ █████╗ ██████╗  █████╗  █████╗ ██╗███╗  ██╗
██╔════╝╚══██╔══╝██╔══██╗██╔══██╗██╔══██╗██╔══██╗██║████╗ ██║
╚█████╗    ██║   ███████║██████╔╝██║  ╚═╝██║  ██║██║██╔██╗██║
 ╚═══██╗   ██║   ██╔══██║██╔══██╗██║  ██╗██║  ██║██║██║╚████║
██████╔╝   ██║   ██║  ██║██║  ██║╚█████╔╝╚█████╔╝██║██║ ╚███║
╚═════╝    ╚═╝   ╚═╝  ╚═╝╚═╝  ╚═╝ ╚════╝  ╚════╝ ╚═╝╚═╝  ╚══╝

Starcoin - a smart contract blockchain network that scales by layering

net proxima using move with table extension feature. If you want to use it, you should compile dev branch.

Report a Bug · Request a Feature . Ask a Question

Build and Test License codecov LoC

Binary file description

The starcoin project comes with several wrappers/executables, release indicates whether the binary is included in the release archive.

Command SRC Directory Release Description
starcoin cmd/starcoin true Our main Starcoin CLI client. It is the entry point into the Starcoin network. We can use it to run a node, or connect to a another node as an interactive console. starcoin --help and the CLI reference for command line options.
mpm vm/move-package-manager true Move Package Manager(mpm) is a command line tool to develop move projects, like Cargo for Rust, or NPM for NodeJS.
starcoin_miner cmd/miner_client true A CPU miner client for starcoin.
starcoin_db_exporter cmd/db-exporter true A tool for exporting or importing data from or to the starcoin database.
starcoin_generator cmd/generator true A tool for generate genesis file or mock data.
airdrop cmd/airdrop false A tool for batch transfer Token based on a csv file.
genesis-nft-miner cmd/genesis-nft-miner false A tool for claim the GenesisNFT, All address in the file contrib-contracts/src/genesis-nft-address.json.
starcoin-faucet cmd/faucet false A tool for providing a simple faucet web service
starcoin-indexer cmd/indexer false A tool for creating index on Elasticsearch for starcoin's block and transaction, etc.
merkle-generator cmd/merkle-generator false A tool for generating merkle data from a detail csv file of a distribution, for airdrop by merkle tree.
resource-exporter cmd/resource-exporter false A tool for export resource from starcoin state database.
tx-factory cmd/tx-factory false A tool used to generate transactions, generally for testing or benchmark.
starcoin-replay cmd/replay false A tool for replay block data from a database to a new database.
starcoin-peer-watcher cmd/peer-watcher false A sample app for join starcoin p2p network and print the discovered peer info.

Build from source

cargo build --release 

For prerequisites and detailed build instructions please read Build from source document.

Install binary

Download binary release from GitHub releases page.

Or install by one-line script:

curl --proto '=https' -O --tlsv1.2 -sSf https://raw.githubusercontent.com/starcoinorg/starcoin/master/scripts/install_starcoin_mpm.sh | sh install_starcoin_mpm.sh v1.11.12

Run dev node:

starcoin -n dev console

More detailed dev instructions please read Run starcoin dev network document.

Join a test network

starcoin -n barnard console

Join main network

starcoin -n main console

Connect to remote node

Connect to the main network seed nodes:

starcoin --connect ws://main.seed.starcoin.org:9870 console

note: Account-related commands cannot be used when connecting remotely

Connect to the main network seed nodes and use a local account database for using Account-related commands

starcoin --connect ws://main.seed.starcoin.org:9870 --local-account-dir ~/.starcoin/main/account_vaults console

More detailed test network info please read Join starcoin test network.

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

First off, thanks for taking the time to contribute! Contributions are what makes the open-source community such an amazing place to learn, inspire, and create. Any contributions you make will benefit everybody else and are greatly appreciated.

Please try to create bug reports that are:

  • Reproducible. Include steps to reproduce the problem.
  • Specific. Include as much detail as possible: which version, what environment, etc.
  • Unique. Do not duplicate existing opened issues.
  • Scoped to a Single Bug. One bug per report.

You can learn more about contributing to the Starcoin project by reading our Contribution Guide and by viewing our Code of Conduct.

Code Layout

You could find the introduction of each code directory here for helping to understand the organization of codes.

Support

Reach out to the maintainer at one of the following places:

License

Starcoin is licensed as Apache 2.0.

starcoin's People

Contributors

coldnight avatar dependabot-preview[bot] avatar dependabot[bot] avatar fanngyuan avatar geometryolife avatar guangyuz avatar jackzhhuang avatar jerrykwan avatar jiangying000 avatar jolestar avatar lemonhx avatar nanne007 avatar nkysg avatar nonsense0202 avatar pause125 avatar sanlee42 avatar simonjiao avatar ssyuan avatar templexxx avatar tiangong3624749 avatar uvd avatar welbon avatar wgb5445 avatar wk3368 avatar xfhxfh1212 avatar xudon9 avatar yourmoonlight avatar yuliyu123 avatar yusongwang avatar zhutoulala avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

starcoin's Issues

Miner Client refactor

Miner Client 的启动要在网络准备好之后,并且可以在运行中停止,所以需要重构一下。

  1. Miner Client 重构为 actor 模型,受统一的 actor 生命周期管理。
  2. 可以运行时启动以及暂停。

Dev network ondemand panic

Dev 网络下,如果是默认的按需出块,发送交易时会 panic

thread 'async-std/executor' panicked at 'Uniform::sample_single called with low >= high', <::std::macros::panic macros>:2:4
stack backtrace:
0: 0x10da3d615 - std::sys_common::at_exit_imp::push::hee3b7bd54798f075
1: 0x10da5dc4d - core::fmt::ArgumentV1::show_usize::h0555723a314a596c
2: 0x10da3603b - std::io::Write::write_fmt::ha39f6009af02b1d2
3: 0x10da3fa1a - std::panicking::default_hook::{{closure}}::h389f076017b5df43
4: 0x10da3f71a - std::panicking::default_hook::h04b06ec20c41bf02
5: 0x10da4006d - <std::panicking::begin_panic::PanicPayload as core::panic::BoxMeUp>::get::h9852a20ed702e745
6: 0x10da825ce - tokio::util::slab::page::Shared::alloc_page::h879bc0bb9ee9fa58
7: 0x10aac1ffe - <rand::distributions::uniform::UniformInt as rand::distributions::uniform::UniformSampler>::sample_single::hc47d0e97430bfd8d
at /Users/jolestar/opensource/src/github.com/starcoinorg/starcoin/<::std::macros::panic macros>:2
8: 0x10aac3135 - rand::Rng::gen_range::hfdbcb3f3c5550029
at /Users/jolestar/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.5/src/lib.rs:245
9: 0x10aac3645 - <starcoin_consensus::dummy::DummyConsensus as starcoin_traits::consensus::Consensus>::solve_consensus_header::h3220cebbfc9ce1b4
at consensus/src/dummy.rs:53
10: 0x10a5d2bee - starcoin_miner::miner_client::MinerClient::process_job::h21c947252887c9b7
at /Users/jolestar/opensource/src/github.com/starcoinorg/starcoin/miner/src/miner_client.rs:37
11: 0x10a5d7c48 - starcoin_miner::miner_client::MinerClient::run::{{closure}}::{{closure}}::h9ee0a7f22ab68403
at /Users/jolestar/opensource/src/github.com/starcoinorg/starcoin/miner/src/miner_client.rs:84
12: 0x10a6b8ca4 - <std::future::GenFuture as core::future::future::Future>::poll::h5edd8b6c52385f7f
at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libstd/future.rs:43
13: 0x10a6b3a5d - std::future::poll_with_tls_context::hf3f1f2416ba18e50
at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libstd/future.rs:98
14: 0x10a78cd64 - async_std::task::builder::Builder::spawn::{{closure}}::h9e0e259deb173bd8
at /Users/jolestar/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.5.0/src/task/builder.rs:64
15: 0x10a6b8aa4 - <std::future::GenFuture as core::future::future::Future>::poll::h5e3e3c58ee8be02a
at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libstd/future.rs:43
16: 0x10a6daeac - async_task::raw::RawTask<F,R,S,T>::run::h7f87681d7d1be40e
at /Users/jolestar/.cargo/registry/src/github.com-1ecc6299db9ec823/async-task-1.3.1/src/raw.rs:505
17: 0x10cde6c3f - async_task::task::Task::run::hb7f2057bea752b0f
at /Users/jolestar/.cargo/registry/src/github.com-1ecc6299db9ec823/async-task-1.3.1/src/task.rs:239
18: 0x10cdf57a5 - async_std::task::builder::Runnable::run::{{closure}}::{{closure}}::h0f4756b911e4d6d1
at /Users/jolestar/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.5.0/src/task/builder.rs:81
19: 0x10cdf53ed - async_std::utils::abort_on_panic::h363fb98f309dee49
at /Users/jolestar/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.5.0/src/utils.rs:16
20: 0x10cdf57cd - async_std::task::builder::Runnable::run::{{closure}}::h561e7c649620552c
at /Users/jolestar/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.5.0/src/task/builder.rs:81
21: 0x10ce04ae7 - async_std::task::task::Task::set_current::{{closure}}::h7a7f03e7d4aa27e5
at /Users/jolestar/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.5.0/src/task/task.rs:129
22: 0x10ce035ec - std::thread::local::LocalKey::try_with::h0b97486b36fa6c01
at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libstd/thread/local.rs:262
23: 0x10ce03405 - std::thread::local::LocalKey::with::h84896485c1e61c28
at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libstd/thread/local.rs:239
24: 0x10ce04a34 - async_std::task::task::Task::set_current::h07e8b2f03f7de57f
at /Users/jolestar/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.5.0/src/task/task.rs:124
25: 0x10cdf5767 - async_std::task::builder::Runnable::run::had014545e8f34050
at /Users/jolestar/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.5.0/src/task/builder.rs:81
26: 0x10cde8447 - async_std::task::executor::pool::main_loop::hd86a947e689c6f74
at /Users/jolestar/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.5.0/src/task/executor/pool.rs:114
27: 0x10cde94fd - core::ops::function::FnOnce::call_once::h064de4521c3cafd4
at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libcore/ops/function.rs:232
28: 0x10cdf5455 - async_std::utils::abort_on_panic::h794ace2ac9c7efb9
at /Users/jolestar/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.5.0/src/utils.rs:16
29: 0x10cde7b78 - async_std::task::executor::pool::POOL::{{closure}}::{{closure}}::hbf2ca8ddff4f508c
at /Users/jolestar/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.5.0/src/task/executor/pool.rs:46
30: 0x10cde47b1 - std::sys_common::backtrace::__rust_begin_short_backtrace::he9c903178c73f477
at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libstd/sys_common/backtrace.rs:129
31: 0x10ce05e51 - std::thread::Builder::spawn_unchecked::{{closure}}::{{closure}}::h60c7f2d60b3ea00e
at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libstd/thread/mod.rs:475
32: 0x10cddbde1 - <std::panic::AssertUnwindSafe as core::ops::function::FnOnce<()>>::call_once::h2586976ed7d9c582
at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libstd/panic.rs:318
33: 0x10cdfee23 - std::panicking::try::do_call::h539150d45c72f83c
at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libstd/panicking.rs:305
34: 0x10da4483b - panic_unwind::dwarf::eh::read_encoded_pointer::h71560c535c128232
35: 0x10cdfed2a - std::panicking::try::hbb21443501644276
at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libstd/panicking.rs:281
36: 0x10cddc471 - std::panic::catch_unwind::h05fa680800a02a6a
at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libstd/panic.rs:394
37: 0x10ce05a47 - std::thread::Builder::spawn_unchecked::{{closure}}::h4b88d13a9b97b511
at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libstd/thread/mod.rs:474
38: 0x10cde9485 - core::ops::function::FnOnce::call_once{{vtable.shim}}::ha4f9b73c0d40282d
at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libcore/ops/function.rs:232
39: 0x10da2df2e - <alloc::boxed::Box as core::ops::function::FnOnce>::call_once::h606f2dced48ff3c4
40: 0x10da43d7e - std::sys::unix::thread::Thread::new::thread_start::h7199626a1bd56873
41: 0x7fff67e5b109 -

Cli table display optimize

如果 Cli 要展示的字段比较多,用 table 横向展示会比较难看。

优化方案: 如果展示的内容是一个对象,则把该对象的熟悉通过 table 纵向展示,每个属性一列。

network test panic by accident

thread 'protocol::generic_proto::tests::reconnect_after_disconnect' panicked at 'explicit panic', network-p2p/src/protocol/generic_proto/tests.rs:404:57
stack backtrace:
0: 0x5568c20028e4 - backtrace::backtrace::libunwind::trace::heb43798aede8bd30
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
1: 0x5568c20028e4 - backtrace::backtrace::trace_unsynchronized::had2ba7dec4bd2732
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
2: 0x5568c20028e4 - std::sys_common::backtrace::_print_fmt::hda61f46e822731b2
at src/libstd/sys_common/backtrace.rs:84
3: 0x5568c20028e4 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hfe37fa5de6572965
at src/libstd/sys_common/backtrace.rs:61
4: 0x5568c2028e0c - core::fmt::write::h74887d18db27282c
at src/libcore/fmt/mod.rs:1025
5: 0x5568c1686005 - std::io::Write::write_fmt::h614a83dae7f00217
at /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libstd/io/mod.rs:1426
6: 0x5568c1ff9d11 - std::io::impls::<impl std::io::Write for alloc::boxed::Box>::write_fmt::h6085952b68669738

Poll::Ready(Some(GenericProtoOut::CustomProtocolClosed { .. })) => {
match service2_state {
ServiceState::FirstConnec => service2_state = ServiceState::Disconnected,
ServiceState::ConnectedAgain
| ServiceState::NotConnected
| ServiceState::Disconnected => panic!(),
}
}

Cli seeds command line option optimize

问题: 当前 seeds 参数接受多个输入,如果 seeds 是最后一个参数,subcommand 也会被认为是 seeds 的一个参数,导致解析报错。

方案1:通过代码解析参数,StructOpt 中只定义 String,比如多个用 , 号分割连接起来, seeds 作为一个参数输入。

方案2: 修改 seeds 为 seed,参数中只接受一个 seed,如果需要配置多个,可以通过配置文件进行修改。

CLI 输出标准化

Cli 输出标准化

  1. 支持文本输出,每列数据显示列名以及值
  2. 支持 json 输出

block executor & accumulator refactor

1、chain里面的create_block_template和apply方法合并抽成一个block executor
2、accumulator
支持根据root hash还原树
frozen node优化

NodeConfig refactor

  1. data-dir 路径下增加一层 net 目录,这样多个 net 的网络可以共享默认的 data-dir。
  2. 生成配置的时候可以根据 net 来进行特殊处理。

Total difficulty

Total difficulty 保存到 blockinfo 中,以及在 consensus 校验 difficulty 的时候使用。

Block Executor refactor

  1. 将 Block executor 逻辑从 Chain 拆分出来,BlockExecutor 提供两个方法: block_execute & block_construct,分别供 Chain apply 和 Chain create_block_template 使用。
  2. 考虑 create_block_template 时的错误处理,交易的状态,以及如何从 tx pool 中清理掉 discard 状态的交易。

reconnect_after_disconnect test random fail.

https://github.com/starcoinorg/starcoin/runs/567389125

---- protocol::generic_proto::tests::reconnect_after_disconnect stdout ----
thread 'protocol::generic_proto::tests::reconnect_after_disconnect' panicked at 'explicit panic', network-p2p/src/protocol/generic_proto/tests.rs:404:57
stack backtrace:
0: 0x556ca25cdff4 - backtrace::backtrace::libunwind::trace::h90669f559fb267f0
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
1: 0x556ca25cdff4 - backtrace::backtrace::trace_unsynchronized::hffde4e353d8f2f9a
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
2: 0x556ca25cdff4 - std::sys_common::backtrace::_print_fmt::heaf44068b7eaaa6a
at src/libstd/sys_common/backtrace.rs:77
3: 0x556ca25cdff4 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h88671019cf081de2
at src/libstd/sys_common/backtrace.rs:59
4: 0x556ca25f26cc - core::fmt::write::h4e6a29ee6319c9fd
at src/libcore/fmt/mod.rs:1052
5: 0x556ca1c3ac25 - std::io::Write::write_fmt::h0925d1b2b49a7c6d
at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libstd/io/mod.rs:1426
6: 0x556ca25c4161 - std::io::impls::<impl std::io::Write for alloc::boxed::Box>::write_fmt::h8750380b9d499e97
at src/libstd/io/impls.rs:156
7: 0x556ca25d0975 - std::sys_common::backtrace::_print::h404ff5f2b50cae09
at src/libstd/sys_common/backtrace.rs:62
8: 0x556ca25d0975 - std::sys_common::backtrace::print::hcc4377f1f882322e
at src/libstd/sys_common/backtrace.rs:49

Genesis Refactor

  1. 支持生成 Genesis Block 的二进制,并保持为文件。
  2. Genesis 中应该包含 chain network 相关信息。
  3. BlockExecutor 需要支持执行 Genesis Block,节点启动的时候,如果发现本地数据库为空,需要将 GenesisBlock 预先执行一下。 依赖 #65
  4. 生成 Genesis 的时候可以指定 faucet 账号地址,给该地址挖 coin。

service_test::tests::test_notify panic

---- service_test::tests::test_notify stdout ----
thread 'service_test::tests::test_notify' panicked at 'explicit panic', <::std::macros::panic macros>:2:4
stack backtrace:
0: 0x5603911a1a94 - backtrace::backtrace::libunwind::trace::h90669f559fb267f0
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
1: 0x5603911a1a94 - backtrace::backtrace::trace_unsynchronized::hffde4e353d8f2f9a
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
2: 0x5603911a1a94 - std::sys_common::backtrace::_print_fmt::heaf44068b7eaaa6a
at src/libstd/sys_common/backtrace.rs:77
3: 0x5603911a1a94 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h88671019cf081de2
at src/libstd/sys_common/backtrace.rs:59
4: 0x5603911c613c - core::fmt::write::h4e6a29ee6319c9fd
at src/libcore/fmt/mod.rs:1052
5: 0x5603907d80a5 - std::io::Write::write_fmt::h0925d1b2b49a7c6d
at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libstd/io/mod.rs:1426
6: 0x560391197b71 - std::io::impls::<impl std::io::Write for alloc::boxed::Box>::write_fmt::h8750380b9d499e97
at src/libstd/io/impls.rs:156
7: 0x5603911a4415 - std::sys_common::backtrace::_print::h404ff5f2b50cae09
at src/libstd/sys_common/backtrace.rs:62
8: 0x5603911a4415 - std::sys_common::backtrace::print::hcc4377f1f882322e
at src/libstd/sys_common/backtrace.rs:49
9: 0x5603911a4415 - std::panicking::default_hook::{{closure}}::hc172eff6f35b7f39
at src/libstd/panicking.rs:204
10: 0x5603911a40a8 - std::panicking::default_hook::h7a68887d113f8029
at src/libstd/panicking.rs:221
11: 0x5603911a4a7a - std::panicking::rust_panic_with_hook::hb7ad5693188bdb00

Node startup enhancement

Node 启动过程改进:

  • 等待网络初始化
  • 等待同步完成
  • 默认启动最基础的服务,必要时再启动网络和其他服务。

miner & consensus refactor

  • 不同的共识算法采用统一的策略, miner 不关心 dev mod,dev mod 只是选择一种特殊的共识算法。
  • difficult 的逻辑应该和共识算法相关,不同的共识用不同的逻辑。
  • Miner task 并发与异常处理(最好用 actor 管理)。
  • manager MinerClient with Actor tracked by #127
  • 拆分 API 与实现。

storage refactor

storage内部:
接口定义:
Store :替换 BlockChainStore
InnerStore
为codec提供存储,宏构建改造
封装实现:
Storage:替换StarcoinStorage,通用方法的封装
InnerStorage:
重构StorageDelegated,支持 db/cache/db+cache 多种实现

kv层 -> 逻辑层(带prefix支持,db/cache实现) -》 codedec

业务应用:
包名:
XXX_store
接口定义:
XXXStore
封装实现:
XXXStorage

check seed repeat

命令行的 seeds 参数会导致 network config 的 seeds 列表中出现重复内容,需要检查 seed 是否已经存在,避免重复的节点,同时需要检查 seed 参数的合法性,避免将错误的 address 格式写入配置。

RUSTSEC-2020-0008: Flaw in hyper allows request smuggling by sending a body in GET requests

Flaw in hyper allows request smuggling by sending a body in GET requests

Details
Package hyper
Version 0.10.16
URL hyperium/hyper#1925
Date 2020-03-19
Patched versions >= 0.12.34

Vulnerable versions of hyper allow GET requests to have bodies, even if there is
no Transfer-Encoding or Content-Length header. As per the HTTP 1.1
specification, such requests do not have bodies, so the body will be interpreted
as a separate HTTP request.

This allows an attacker who can control the body and method of an HTTP request
made by hyper to inject a request with headers that would not otherwise be
allowed, as demonstrated by sending a malformed HTTP request from a Substrate
runtime. This allows bypassing CORS restrictions. In combination with other
vulnerabilities, such as an exploitable web server listening on loopback, it may
allow remote code execution.

The flaw was corrected in hyper version 0.12.34.

See advisory page for additional details.

Code clean

  • Remove VMConfig
  • Remove MockTransactionExecutor
  • Remove TransactionExecutor Generic Parameter
  • Clear Consensus Api
  • Remove Consensus Header Generic Parameter.
  • Remove difficult from BlockTemplate.
  • Remove types/ByteArray

Subscribe and Watch API

实现 json rpc 的订阅接口

  1. 订阅区块 header
  2. 订阅交易
  3. 合约的事件(依赖虚拟机支持 #229

RPC error code

当前 cli 的参数如果有问题,服务器端报错,cli 直接收到的是

Server returned rpc error Internal error: Internal error

比如,未 unlock 账号的时候进行转账。需要通过错误码以及错误消息,给用户准确的错误提示。

Node refactor

  1. 支持启动部分的 Service Actor。
  2. 支持运行时停止或者启动某些服务,比如 miner。
  3. 支持一些 node 接口方便调试。

Genesis node connect error

如果两个节点都处于 Genesis 状态,尚未产生区块,无法组成网络。

复现方式:

starcoin -n dev console 启动一个节点,默认按需出块。

starcoin -n dev --seed $previous_node_address console 尝试连接到该节点,会一直等待。

LibraAccount's prologue assert failure - Invalid auth key

  1. Description
    after adapted to libra's new authentication interface, executor unit tests failed with "Invalid auth key"

  2. How to re-produce?

  1. in the feature/update_libra branch, revert below commit:

commit ea49523
Author: Guangyu Zhu [email protected]
Date: Sun Apr 12 21:02:36 2020 +0800

[vm] work around - disable auth key check in LibraAccount prologue
  1. cd vm/stdlib, run "cargo run" to re-generate stdlib
  2. cd executor, run "cargo test"

Chain API

  1. 设计和定义 Chain 相关 API
  2. Cmd 中支持查询 Chain/Block/Txn 的命令

move_vm_runtime startup ERROR

2020-04-16T15:03:05.929493+08:00 ERROR move_vm_runtime::code_cache::module_cache::/Users/jolestar/.cargo/git/checkouts/libra-05693b40248a74d2/a65fce0/language/move-vm/runtime/src/code_cache/module_cache.rs::277 - [VM] Error fetching module with id ModuleId { address: 00000000000000000000000000000000, name: Identifier("GasSchedule") }

Cli normal quit when node shutdown.

RPCClient 实现优雅关闭以及自动重连接。

当 node 关闭时, 正在通过 console 连接的 cli 会 panic :

starcoin% 2020-04-07T19:25:38.824683+08:00 WARN jsonrpc_client_transports::transports::ipc::/Users/jolestar/.cargo/registry/src/github.com-1ecc6299db9ec823/jsonrpc-client-transports-14.0.5/src/transports/ipc.rs::27 - IPC client error: Other(Custom { kind: Other, error: "bytes remaining on stream" }

需要改造为正常退出。

实现 init command

init command 用来初始化 data-dir,生成配置文件以及 genesis,创建基本的数据库(执行 genesis block 并写入数据)。

依赖 #68

TxFactory as independent Service

TxFactory 的作用是生成随机的交易用来测试。如果要部署测试网,需要将它拆分出去作为独立的服务,而不是内置到 Node 中。

TxFactory 作为独立的服务启动,类似于 faucet , 读取一个 wallet 作为账号来源,通过 rpc 发送交易。

Stdlib customization

  1. starcoin token & account #144
  2. Clear unused module
  3. Use StarcoinAccount to replace LibraAccount, etc.

metrics and monitor

  1. 提供 metrics 以及 monitor 的基础库。
  2. 设计需要监控的关键指标,给关键指标增加 metrics。
  • Chain and block process metrics #324
  • Mempool metrics #325
  • Miner metrics #326
  • Network metrics #327
  • Storage metrics #328
  • Actor and Tokio runtime metrics #329
  • VM metrics #330
  • JSONRpc metrics #352

sync panic

2020-04-08T22:17:37.739405+08:00 INFO starcoin_sync::download::sync/src/download.rs::796 - do block HashValue(3594927535d80ec147c43797362ca19af5d616cf13f87b8588867f23d762b980)
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: MailboxError(Mailbox has closed)', /Users/jolestar/opensource/src/github.com/starcoinorg/starcoin/chain/src/lib.rs:257:53
stack backtrace:
   0:        0x103b3db35 - backtrace::backtrace::libunwind::trace::h5c84db184dbe55ed
                               at /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1:        0x103b3db35 - backtrace::backtrace::trace_unsynchronized::hfabf504f184a4062
                               at /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
   2:        0x103b3db35 - std::sys_common::backtrace::_print_fmt::hb18545a457444b58
                               at src/libstd/sys_common/backtrace.rs:77
   3:        0x103b3db35 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hff7732c2e44ef8b9
                               at src/libstd/sys_common/backtrace.rs:59
   4:        0x103b5e16d - core::fmt::write::hd42cb3dea57bae40
                               at src/libcore/fmt/mod.rs:1052
   5:        0x103b3657b - std::io::Write::write_fmt::ha39f6009af02b1d2
                               at src/libstd/io/mod.rs:1426
   6:        0x103b3ff3a - std::sys_common::backtrace::_print::h5cfb8cdd320f1e64
                               at src/libstd/sys_common/backtrace.rs:62
   7:        0x103b3ff3a - std::sys_common::backtrace::print::hef683e3bc77ce269
                               at src/libstd/sys_common/backtrace.rs:49
   8:        0x103b3ff3a - std::panicking::default_hook::{{closure}}::h389f076017b5df43
                               at src/libstd/panicking.rs:204
   9:        0x103b3fc3a - std::panicking::default_hook::h04b06ec20c41bf02
                               at src/libstd/panicking.rs:224
  10:        0x103b4058d - std::panicking::rust_panic_with_hook::hccde7faed9a5c398
                               at src/libstd/panicking.rs:472
  11:        0x103b40152 - rust_begin_unwind
                               at src/libstd/panicking.rs:380
  12:        0x103b8d03f - std::panicking::begin_panic::hc520a8a43176ea4c
  13:        0x103b8cf45 - std::panicking::begin_panic::hc520a8a43176ea4c
  14:        0x1007cf6ab - core::result::Result<T,E>::unwrap::h33be302da77879a5
                               at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libcore/result.rs:963
  15:        0x1009b751c - <starcoin_chain::ChainActorRef<E,C> as starcoin_traits::chain_service::ChainAsyncService>::master_head_header::__master_head_header::{{closure}}::h0754095a64572c95
                               at /Users/jolestar/opensource/src/github.com/starcoinorg/starcoin/chain/src/lib.rs:257
  16:        0x100925e77 - <std::future::GenFuture<T> as core::future::future::Future>::poll::h16d8a007d949527e
                               at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libstd/future.rs:43
  17:        0x10065530a - <core::pin::Pin<P> as core::future::future::Future>::poll::h49efb6c98143beea
                               at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libcore/future/future.rs:119
  18:        0x100920d4c - std::future::poll_with_tls_context::h4fc89d5dfa919032
                               at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libstd/future.rs:98
  19:        0x10096ecad - starcoin_sync::download::DownloadActor<E,C>::sync_block_from_best_peer::{{closure}}::hd5535c5a5277cccf
                               at /Users/jolestar/opensource/src/github.com/starcoinorg/starcoin/sync/src/download.rs:325
  20:        0x100929964 - <std::future::GenFuture<T> as core::future::future::Future>::poll::h88d6d990058ae810
                               at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libstd/future.rs:43
  21:        0x1007eb654 - tokio::task::core::Core<T>::poll::h3d9d062e389c06ad
                               at /Users/jolestar/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.13/src/task/core.rs:128
  22:        0x1008f5072 - tokio::task::harness::Harness<T,S>::poll::{{closure}}::{{closure}}::hd2940e7ea3cf5321
                               at /Users/jolestar/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.13/src/task/harness.rs:119
  23:        0x100826f69 - core::ops::function::FnOnce::call_once::h864e3d6f4dcad6ab
                               at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libcore/ops/function.rs:232
  24:        0x1006c27fd - <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::hbb592650998b109f
                               at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libstd/panic.rs:318
  25:        0x1009db37a - std::panicking::try::do_call::hd0bfa2a4c3311531
                               at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libstd/panicking.rs:305
  26:        0x103b44d5b - __rust_maybe_catch_panic
                               at src/libpanic_unwind/lib.rs:86
  27:        0x1009d81db - std::panicking::try::hc03609a6afce14b2
                               at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libstd/panicking.rs:281
  28:        0x1006c3b14 - std::panic::catch_unwind::he1e9bb8985092ff1
                               at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libstd/panic.rs:394
  29:        0x1008f2338 - tokio::task::harness::Harness<T,S>::poll::{{closure}}::h029eabc3062eb851
                               at /Users/jolestar/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.13/src/task/harness.rs:100
  30:        0x1006d937a - tokio::loom::std::causal_cell::CausalCell<T>::with_mut::hedeb45e7a27b6896
                               at /Users/jolestar/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.13/src/loom/std/causal_cell.rs:41
  31:        0x1008e45a0 - tokio::task::harness::Harness<T,S>::poll::h0c9f2eeb35ef0ca3
                               at /Users/jolestar/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.13/src/task/harness.rs:99
  32:        0x100943fa2 - tokio::task::raw::poll::h23e336b234d7b068
                               at /Users/jolestar/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.13/src/task/raw.rs:162
  33:        0x102bd8caa - tokio::task::raw::RawTask::poll::h557a51c4c88ed975
                               at /Users/jolestar/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.13/src/task/raw.rs:113
  34:        0x102c40104 - tokio::task::Task<S>::into_raw::ha772909ef50eea09
  35:        0x102be19e4 - tokio::task::local::Scheduler::tick::h01c808f1753b87e6
                               at /Users/jolestar/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.13/src/task/local.rs:513
  36:        0x10080aa35 - <tokio::task::local::LocalFuture<F> as core::future::future::Future>::poll::{{closure}}::ha8d66abfd6c8f580
                               at /Users/jolestar/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.13/src/task/local.rs:407
  37:        0x10080a512 - tokio::task::local::Scheduler::with::{{closure}}::h88ab095b854a1ce9
                               at /Users/jolestar/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.13/src/task/local.rs:478
  38:        0x1009917d9 - std::thread::local::LocalKey<T>::try_with::hc81b71b110fdecf0
                               at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libstd/thread/local.rs:262
  39:        0x100981978 - std::thread::local::LocalKey<T>::with::hb993764b68bb5796
                               at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libstd/thread/local.rs:239
  40:        0x10080a45b - tokio::task::local::Scheduler::with::hf698de9aff06b0f5
                               at /Users/jolestar/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.13/src/task/local.rs:474
  41:        0x10080a86d - <tokio::task::local::LocalFuture<F> as core::future::future::Future>::poll::h9282787ff5f03c32
                               at /Users/jolestar/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.13/src/task/local.rs:402
  42:        0x100921cdd - std::future::poll_with_tls_context::h987f6b496920bc82
                               at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libstd/future.rs:98
  43:        0x100809f11 - tokio::task::local::LocalSet::run_until::{{closure}}::h1e544ea7b959a052
                               at /Users/jolestar/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.13/src/task/local.rs:358
  44:        0x100928af4 - <std::future::GenFuture<T> as core::future::future::Future>::poll::h72d6959c385129a4
                               at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libstd/future.rs:43
  45:        0x10086ef93 - tokio::runtime::basic_scheduler::BasicScheduler<P>::block_on::h86cb176d5e8455c0
                               at /Users/jolestar/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.13/src/runtime/basic_scheduler.rs:138
  46:        0x1009d3fe0 - tokio::runtime::Runtime::block_on::{{closure}}::he1c5cd1dbb6afd46
                               at /Users/jolestar/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.13/src/runtime/mod.rs:413
  47:        0x1008b8538 - tokio::runtime::context::enter::h857a87cb1f7962f1
                               at /Users/jolestar/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.13/src/runtime/context.rs:72
  48:        0x1007f31d4 - tokio::runtime::handle::Handle::enter::hea454b35ba729766
                               at /Users/jolestar/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.13/src/runtime/handle.rs:34
  49:        0x1009d3b2a - tokio::runtime::Runtime::block_on::ha45e59765440c993
                               at /Users/jolestar/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.13/src/runtime/mod.rs:410
  50:        0x100809be3 - tokio::task::local::LocalSet::block_on::hf68054fb363d8592
                               at /Users/jolestar/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.13/src/task/local.rs:321
  51:        0x100802b9e - actix_rt::runtime::Runtime::block_on::h22072d4823fa6a7d
                               at /Users/jolestar/.cargo/registry/src/github.com-1ecc6299db9ec823/actix-rt-1.0.0/src/runtime.rs:89
  52:        0x100930e86 - actix_rt::builder::SystemRunner::block_on::h15c56ee0908ebe63
                               at /Users/jolestar/.cargo/registry/src/github.com-1ecc6299db9ec823/actix-rt-1.0.0/src/builder.rs:187
  53:        0x1008c2123 - starcoin_node::run_node::{{closure}}::hddf8e29d88a86b1f
                               at node/src/lib.rs:82
  54:        0x1007faa28 - std::sys_common::backtrace::__rust_begin_short_backtrace::h4f6aaa3886f4450b
                               at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libstd/sys_common/backtrace.rs:129
  55:        0x100a01338 - std::thread::Builder::spawn_unchecked::{{closure}}::{{closure}}::h8a7eb9e3aa34396f
                               at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libstd/thread/mod.rs:475
  56:        0x1006c2208 - <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h59340807ab91e3ca
                               at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libstd/panic.rs:318
  57:        0x1009db43d - std::panicking::try::do_call::hd26cab9c5342d97a
                               at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libstd/panicking.rs:305
  58:        0x103b44d5b - __rust_maybe_catch_panic
                               at src/libpanic_unwind/lib.rs:86
  59:        0x1009d50c7 - std::panicking::try::h2bbd50108e0adad1
                               at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libstd/panicking.rs:281
  60:        0x1006c3488 - std::panic::catch_unwind::h86af887a1f21ccad
                               at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libstd/panic.rs:394
  61:        0x100a00e5e - std::thread::Builder::spawn_unchecked::{{closure}}::h283c0a1ce683af5b
                               at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libstd/thread/mod.rs:474
  62:        0x100825a95 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h219c2924e70b39d4
                               at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libcore/ops/function.rs:232
  63:        0x103b2e73e - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h606f2dced48ff3c4
                               at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/liballoc/boxed.rs:1015
  64:        0x103b4429e - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h0ece8cce658c93ae
                               at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/liballoc/boxed.rs:1015
  65:        0x103b4429e - std::sys_common::thread::start_thread::h30bbd9f3fb79e88c
                               at src/libstd/sys_common/thread.rs:13
  66:        0x103b4429e - std::sys::unix::thread::Thread::new::thread_start::h7199626a1bd56873
                               at src/libstd/sys/unix/thread.rs:80
  67:     0x7fff70186109 - <unknown>

Cli attach to exist node

cli 启动时,如果发现节点已经启动,则 attach 到已有节点,而不是重新启动一个节点。

starcoin_accumulator startup WARN

2020-04-16T15:03:05.951784+08:00 WARN starcoin_accumulator::core/accumulator/src/lib.rs::352 - HashValue(414343554d554c41544f525f504c414345484f4c4445525f4841534800000000) root hash is placeholder!

NetworkAsyncService as trait

  1. NetworkAsyncService 应该是一个 trait,并提供一个 Mock 的实现。
  2. 依赖 NetworkAsyncService 的 module 不需要依赖 NetworkAsyncService 的具体实现,可以通过 Mock 来测试。

[cmd] Debug & Node

增加一些命令用来查看 Node 的状态,方便 debug 以及问题排查。

node peer 设计一些命令,查看以及管理 peer。当前能想到的子命令

  • node info 查看当前 node 的信息,包括自己的 peer_info
  • node peer 查看当前的 peer 列表。
  • node ping 测试和某个 peer 的连通
  • node remove_peer/add_peer 手动删除或者增加 peer.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.