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

release v1.0.3 to master #15

Merged
merged 24 commits into from
Dec 17, 2018
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
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
10 changes: 6 additions & 4 deletions libraries/chain/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,11 @@ struct controller_impl {
ilog( "database initialized with hash: ${hash}", ("hash", hash) );
}


//*bos begin*
sync_name_list(list_type::actor_blacklist_type,true);
sync_name_list(list_type::contract_blacklist_type,true);
sync_name_list(list_type::resource_greylist_type,true);
//*bos end*
}

~controller_impl() {
Expand Down Expand Up @@ -649,9 +653,7 @@ struct controller_impl {
gpo.gmr.ram_byte = config::default_gmr_ram_limit;
});

sync_name_list(list_type::actor_blacklist_type,true);
sync_name_list(list_type::contract_blacklist_type,true);
sync_name_list(list_type::resource_greylist_type,true);

// *bos end*

authorization.initialize_database();
Expand Down
1 change: 1 addition & 0 deletions plugins/kafka_plugin/kafka.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ void kafka::push_action(const chain::action_trace& action_trace, uint64_t parent
a->code_seq = action_trace.receipt.code_sequence;
a->abi_seq = action_trace.receipt.abi_sequence;
a->block_num = action_trace.block_num;
a->block_time = action_trace.block_time;
a->tx_id = checksum_bytes(action_trace.trx_id);
if (not action_trace.console.empty()) a->console = action_trace.console;

Expand Down
31 changes: 31 additions & 0 deletions plugins/kafka_plugin/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Kafka Plugin 说明

### 一、Topic

默认开启以下4个topic

1. blocks // 其中block字段是由完整区块数据持久化的json结构,是一份全量数据。
2. transaction
3. transaction_trace
4. action

transaction、transaction_trace、action为nodeos中数据解析所得,提取了主要的可能使用的字段(相当于推荐配置),业务使用者可根据需要适当增减字段。 另,也可以删除这三个topic,仅依赖blocks中的全量数据。

详见:`plugins/kafka_plugin/types.hpp `


### 二、常见问题

#### bos在Mac上编译常见报错
```
Could not find a package configuration file provided by "RdKafka" with any of the following names:
RdKafkaConfig.cmake
rdkafka-config.cmake
```

原因:系统安装的kafka版本太低

解决方法:

删除`/usr/local/include/cppkafka` , `/usr/local/include/librdkafka`两个目录
重新开始bos编译(会自动下载安装适配的kafka版本)
3 changes: 2 additions & 1 deletion plugins/kafka_plugin/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ struct Action {
unsigned abi_seq;

uint32_t block_num;
block_timestamp_type block_time;
bytes tx_id; // the transaction that generated this action

string console;
Expand All @@ -90,4 +91,4 @@ FC_REFLECT_ENUM(kafka::TransactionStatus, (executed)(soft_fail)(hard_fail)(delay
FC_REFLECT(kafka::Block, (id)(num)(timestamp)(lib)(block)(tx_count)(action_count)(context_free_action_count))
FC_REFLECT(kafka::Transaction, (id)(block_id)(block_num)(block_time)(block_seq)(action_count)(context_free_action_count))
FC_REFLECT(kafka::TransactionTrace, (id)(block_num)(scheduled)(status)(net_usage_words)(cpu_usage_us)(exception))
FC_REFLECT(kafka::Action, (global_seq)(recv_seq)(parent_seq)(account)(name)(auth)(data)(receiver)(auth_seq)(code_seq)(abi_seq)(block_num)(tx_id)(console))
FC_REFLECT(kafka::Action, (global_seq)(recv_seq)(parent_seq)(account)(name)(auth)(data)(receiver)(auth_seq)(code_seq)(abi_seq)(block_num)(block_time)(tx_id)(console))
22 changes: 11 additions & 11 deletions plugins/notify_plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Add some configs to your `config.ini` just as follows:
plugin = eosio::notify_plugin
# notify-filter-on = account:action
notify-filter-on = b1:
notify-filter-on = noprom:transfer
notify-filter-on = b1:transfer
notify-filter-on = eosio:delegatebw
# http endpoint for each action seen on the chain.
notify-receive-url = http://127.0.0.1:8080/notify
Expand All @@ -32,38 +32,38 @@ And you can receive the actions on chain by watching your server endpoint: `http
"account": "eosio.token",
"name": "transfer",
"seq_num": 1,
"receiver": "noprom",
"receiver": "b1",
"block_time": "2018-09-29T11:51:06.000",
"block_num": 127225,
"authorization": [{
"actor": "noprom",
"actor": "b1",
"permission": "active"
}
],
"action_data": {
"from": "noprom",
"to": "noprom1",
"from": "b1",
"to": "b11",
"quantity": "0.0001 EOS",
"memo": "Transfer from noprom to xiaoming"
"memo": "Transfer from b1 to b11"
}
},{
"tx_id": "b31885bada6c2d5e71b1302e87d4006c59ff2a40a12108559d76142548d8cf79",
"account": "eosio.token",
"name": "transfer",
"seq_num": 2,
"receiver": "noprom1",
"receiver": "b11",
"block_time": "2018-09-29T11:51:06.000",
"block_num": 127225,
"authorization": [{
"actor": "noprom",
"actor": "b1",
"permission": "active"
}
],
"action_data": {
"from": "noprom",
"to": "noprom1",
"from": "b1",
"to": "b11",
"quantity": "0.0001 EOS",
"memo": "Transfer from noprom to xiaoming"
"memo": "Transfer from b1 to b11"
}
}
]
Expand Down
11 changes: 10 additions & 1 deletion plugins/notify_plugin/notify_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ fc::variant notify_plugin_impl::deserialize_action_data(action act)

void notify_plugin_impl::build_message(message &msg, const block_state_ptr &block, const transaction_id_type &tx_id, const bool irreversible)
{
// dlog("irreversible: ${a}", ("a", fc::json::to_pretty_string(irreversible)));
auto range = irreversible ? irreversible_action_queue.equal_range(tx_id) : action_queue.equal_range(tx_id);

msg.irreversible = irreversible;
Expand Down Expand Up @@ -163,6 +164,7 @@ action_seq_type notify_plugin_impl::on_action_trace(const action_trace &act, con
const auto pair = std::make_pair(tx_id, sequenced_action(act.act, act_s, act.receipt.receiver));
action_queue.insert(pair);
irreversible_action_queue.insert(pair);
// dlog("on_action_trace: ${a}", ("a", fc::json::to_pretty_string(act.act)));
}
act_s++;

Expand Down Expand Up @@ -195,6 +197,7 @@ void notify_plugin_impl::on_accepted_block(const block_state_ptr &block_state)
{
message msg;
transaction_id_type tx_id;
// dlog("block_state->block->transactions: ${a}", ("a", fc::json::to_pretty_string(block_state->block->transactions)));
for (const auto &trx : block_state->block->transactions)
{
if (trx.trx.contains<transaction_id_type>())
Expand All @@ -206,11 +209,14 @@ void notify_plugin_impl::on_accepted_block(const block_state_ptr &block_state)
tx_id = trx.trx.get<packed_transaction>().id();
}

// dlog("tx_id: ${a}", ("a", fc::json::to_pretty_string(tx_id)));
// dlog("action_queue.size(): ${a}", ("a", fc::json::to_pretty_string(action_queue.size())));
if (action_queue.count(tx_id))
{
build_message(msg, block_state, tx_id, false);
}
}
// dlog("msg: ${a}", ("a", msg));
if (msg.actions.size() > 0)
{
send_message(msg);
Expand All @@ -226,6 +232,7 @@ void notify_plugin_impl::on_irreversible_block(const block_state_ptr &block_stat
{
message msg;
transaction_id_type tx_id;
// dlog("block_state->block->transactions: ${a}", ("a", fc::json::to_pretty_string(block_state->block->transactions)));
for (const auto &trx : block_state->block->transactions)
{
if (trx.trx.contains<transaction_id_type>())
Expand All @@ -236,12 +243,14 @@ void notify_plugin_impl::on_irreversible_block(const block_state_ptr &block_stat
{
tx_id = trx.trx.get<packed_transaction>().id();
}

// dlog("tx_id: ${a}", ("a", fc::json::to_pretty_string(tx_id)));
// dlog("irreversible_action_queue.size(): ${a}", ("a", fc::json::to_pretty_string(irreversible_action_queue.size())));
if (irreversible_action_queue.count(tx_id))
{
build_message(msg, block_state, tx_id, true);
}
}
// dlog("msg: ${a}", ("a", msg));
if (msg.actions.size() > 0)
{
send_message(msg);
Expand Down