区块链中文技术社区

EOS V2.0.x 部署eosio.bios合约,需先激活 WTMSIG_BLOCK_SIGNATURES 共识

问题

按v1.8.x部署的方式,启动链部署eosio.bios时报env.set_proposed_producers_ex unresolveable

$ cleos set contract eosio contracts/eosio.bios
Reading WASM from /mnt/d/github/contracts/eosio.bios/eosio.bios.wasm...
Publishing contract...
Error 3070000: WASM Exception
Error Details:
env.set_proposed_producers_ex unresolveable
pending console output:

测试环境

OS:Ubuntu 18.04 server
EOS: v2.0.1
合约:v1.9.1

刚启动时可以看到目前支持了以下新共识

info  2020-02-06T01:42:48.853 nodeos    chain_plugin.cpp:421          operator()           ] Support for builtin protocol feature 'PREACTIVATE_FEATURE' (with digest of '0ec7e080177b2c02b278d5088611686b49d739925a92d9bfcacd7fc6b74053bd') is enabled without activation restrictions
info  2020-02-06T01:42:48.854 nodeos    chain_plugin.cpp:408          operator()           ] Support for builtin protocol feature 'ONLY_LINK_TO_EXISTING_PERMISSION' (with digest of '1a99a59d87e06e09ec5b028a9cbb7749b4a5ad8819004365d02dc4379a8b7241') is enabled with preactivation required
info  2020-02-06T01:42:48.856 nodeos    chain_plugin.cpp:408          operator()           ] Support for builtin protocol feature 'FORWARD_SETCODE' (with digest of '2652f5f96006294109b3dd0bbde63693f55324af452b799ee137a81a905eed25') is enabled with preactivation required
info  2020-02-06T01:42:48.857 nodeos    chain_plugin.cpp:408          operator()           ] Support for builtin protocol feature 'WTMSIG_BLOCK_SIGNATURES' (with digest of '299dcb6af692324b899b39f16d5a530a33062804e41f09dc97e9f156b4476707') is enabled with preactivation required
info  2020-02-06T01:42:48.857 nodeos    chain_plugin.cpp:408          operator()           ] Support for builtin protocol feature 'REPLACE_DEFERRED' (with digest of 'ef43112c6543b88db2283a2e077278c315ae2c84719a8b25f25cc88565fbea99') is enabled with preactivation required
info  2020-02-06T01:42:48.858 nodeos    chain_plugin.cpp:408          operator()           ] Support for builtin protocol feature 'NO_DUPLICATE_DEFERRED_ID' (with digest of '4a90c00d55454dc5b059055ca213579c6ea856967712a56017487886a4d4cc0f') is enabled with preactivation required
info  2020-02-06T01:42:48.860 nodeos    chain_plugin.cpp:408          operator()           ] Support for builtin protocol feature 'RAM_RESTRICTIONS' (with digest of '4e7bf348da00a945489b2a681749eb56f5de00b900014e137ddae39f48f69d67') is enabled with preactivation required
info  2020-02-06T01:42:48.861 nodeos    chain_plugin.cpp:408          operator()           ] Support for builtin protocol feature 'WEBAUTHN_KEY' (with digest of '4fca8bd82bbd181e714e283f83e1b45d95ca5af40fb89ad3977b653c448f78c2') is enabled with preactivation required
info  2020-02-06T01:42:48.862 nodeos    chain_plugin.cpp:408          operator()           ] Support for builtin protocol feature 'DISALLOW_EMPTY_PRODUCER_SCHEDULE' (with digest of '68dcaa34c0517d19666e6b33add67351d8c5f69e999ca1e37931bc410a297428') is enabled with preactivation required
info  2020-02-06T01:42:48.863 nodeos    chain_plugin.cpp:408          operator()           ] Support for builtin protocol feature 'ONLY_BILL_FIRST_AUTHORIZER' (with digest of '8ba52fe7a3956c5cd3a656a3174b931d3bb2abb45578befc59f283ecd816a405') is enabled with preactivation required
info  2020-02-06T01:42:48.864 nodeos    chain_plugin.cpp:408          operator()           ] Support for builtin protocol feature 'RESTRICT_ACTION_TO_SELF' (with digest of 'ad9e3d8f650687709fd68f4b90b41f7d825a365b02c23a636cef88ac2ac00c43') is enabled with preactivation required
info  2020-02-06T01:42:48.864 nodeos    chain_plugin.cpp:408          operator()           ] Support for builtin protocol feature 'FIX_LINKAUTH_RESTRICTION' (with digest of 'e0fb64b1085cc5538970158d05a009c24e276fb94e1a0bf6a528b48fbc4ff526') is enabled with preactivation required
info  2020-02-06T01:42:48.865 nodeos    chain_plugin.cpp:408          operator()           ] Support for builtin protocol feature 'GET_SENDER' (with digest of 'f0af56d2c5a48d60a4a5b5c903edfb7db3a736a94ed589d0b797df33ff9d3e1d') is enabled with preactivation required

查询当前已激活共识

curl -X POST http://127.0.0.1:8888/v1/chain/get_activated_protocol_features -d '{}' | jq

查看代码 (github)
https://github.com/EOSIO/eos/blob/e73a43be09478ed3fe5d48071156e1b7caa0e3e1/libraries/chain/controller.cpp#L3330

template<>
void controller_impl::on_activation<builtin_protocol_feature_t::wtmsig_block_signatures>() {
   db.modify( db.get<protocol_state_object>(), [&]( auto& ps ) {
      add_intrinsic_to_whitelist( ps.whitelisted_intrinsics, "set_proposed_producers_ex" );
   } );
}

报错信息提示WTMSIG_BLOCK_SIGNATURES
查看合约更新日志
https://github.com/EOSIO/eosio.contracts/releases/tag/v1.9.1

The eosio.system and eosio.bios contracts contained in this release can only be deployed on an EOSIO blockchain after the activation of the WTMSIG_BLOCK_SIGNATURES consensus protocol upgrade.

只有开启WTMSIG_BLOCK_SIGNATURES共识才能使用此合约。
根据查看 https://github.com/EOSIO/eos/pull/7404

开启WTMSIG_BLOCK_SIGNATURES共识

目前开启WTMSIG_BLOCK_SIGNATURES共识,需要系统账户先部署eosio.boot,并且此合约在单独的合约分支(吐槽下EOSIO代码版本管理...)
先获取下add-boot-contract分支合约

git clone --branch add-boot-contract https://github.com/EOSIO/eosio.contracts.git
./[path]/eosio.contracts/build.sh

和之前部署一样先激活PREACTIVATE_FEATURE

curl -X POST http://127.0.0.1:8888/v1/producer/schedule_protocol_feature_activations -d '{"protocol_features_to_activate": ["0ec7e080177b2c02b278d5088611686b49d739925a92d9bfcacd7fc6b74053bd"]}' | jq

然后部署下eosio.boot合约

cleos set contract eosio [path]/eosio.contracts/build/contracts/eosio.boot -p eosio@active

激活WTMSIG_BLOCK_SIGNATURES协议

cleos -u http://127.0.0.1:8888 push transaction '{"delay_sec":0,"max_cpu_usage_ms":0,"actions":[{"account":"eosio","name":"activate","data":{"feature_digest":"299dcb6af692324b899b39f16d5a530a33062804e41f09dc97e9f156b4476707"},"authorization":[{"actor":"eosio","permission":"active"}]}]}'

最后查询下PREACTIVATE_FEATUREWTMSIG_BLOCK_SIGNATURES是否已成功激活

curl -X POST http://127.0.0.1:8888/v1/chain/get_activated_protocol_features -d '{}' | jq
{
  "activated_protocol_features": [
    {
      "feature_digest": "0ec7e080177b2c02b278d5088611686b49d739925a92d9bfcacd7fc6b74053bd",
      "activation_ordinal": 0,
      "activation_block_num": 1176,
      "description_digest": "64fe7df32e9b86be2b296b3f81dfd527f84e82b98e363bc97e40bc7a83733310",
      "dependencies": [],
      "protocol_feature_type": "builtin",
      "specification": [
        {
          "name": "builtin_feature_codename",
          "value": "PREACTIVATE_FEATURE"
        }
      ]
    },
    {
      "feature_digest": "299dcb6af692324b899b39f16d5a530a33062804e41f09dc97e9f156b4476707",
      "activation_ordinal": 1,
      "activation_block_num": 12770,
      "description_digest": "ab76031cad7a457f4fd5f5fca97a3f03b8a635278e0416f77dcc91eb99a48e10",
      "dependencies": [],
      "protocol_feature_type": "builtin",
      "specification": [
        {
          "name": "builtin_feature_codename",
          "value": "WTMSIG_BLOCK_SIGNATURES"
        }
      ]
    }
  ]
}

然后继续之前的步骤,继续部署eosio.bios合约,以及后面的步骤

cleos set contract eosio contracts/eosio.bios

参考
https://developers.eos.io/manuals/eos/latest/nodeos/upgrade-guides/1.8-upgrade-guide
https://eosio.stackexchange.com/questions/5241/how-to-activate-the-wtmsig-block-signatures-protocol-feature
https://eosio.stackexchange.com/questions/5235/error-while-deploying-eosio-system-contract-to-eosio-account-while-setting-up-a

当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »