Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

eosio-bios and eosio-boot contracts support for KV inside eosio #9716

Merged
merged 4 commits into from
Dec 1, 2020

Conversation

linhuang-blockone
Copy link
Contributor

@linhuang-blockone linhuang-blockone commented Nov 30, 2020

Change Description

This PR provides eosio-bios and eosio-boot contracts to support users to boot up a minimal chain with KV features in it.

  • If EOSIO_COMPILE_TEST_CONTRACTS is set, eosio-bios and eosio-boot are dynamically built from source.

  • If EOSIO_COMPILE_TEST_CONTRACTS is not set, pre-built eosio-bios and eosio-boot are used.

Those contracts are installed in <install-dir>/etc/eosio/contracts and packaged in ${EOS_PREFIX}/etc/eosio/contracts in in brew and deb.

The PR also fixes compilation errors of unittests/test-contracts/kv_addr_book/kv_addr_book.cpp, unittests/test-contracts/kv_bios/kv_bios.cp, unittests/test-contracts/kv_test/kv_test.cpp when EOSIO_COMPILE_TEST_CONTRACTS is set.

The PR has been tested with EOSIO_COMPILE_TEST_CONTRACTS on and off, and running make install and <build-dir>/packages/generate_package.sh brew

Change Type

Select ONE

  • Documentation
  • Stability bug fix
  • Other
  • Other - special case

Consensus Changes

  • Consensus Changes

API Changes

  • API Changes

Documentation Additions

  • Documentation Additions

Ovi, could you convert the following script as step by step instructions for user to boot up a basic chain with KV features enabled?

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

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

cleos push action eosio activate '["299dcb6af692324b899b39f16d5a530a33062804e41f09dc97e9f156b4476707"]' -p eosio@active

cleos push action eosio activate '["825ee6288fb1373eab1b5187ec2f04f6eacb39cb3a97f356a07c91622dd61d16"]' -p eosio@active
cleos push action eosio activate '["c3a6138c5061cf291310887c0b5c71fcaffeab90d5deb50d3b9e687cead45071"]' -p eosio@active
cleos push action eosio activate '["4e7bf348da00a945489b2a681749eb56f5de00b900014e137ddae39f48f69d67"]' -p eosio@active
cleos push action eosio activate '["f0af56d2c5a48d60a4a5b5c903edfb7db3a736a94ed589d0b797df33ff9d3e1d"]' -p eosio@active
cleos push action eosio activate '["2652f5f96006294109b3dd0bbde63693f55324af452b799ee137a81a905eed25"]' -p eosio@active
cleos push action eosio activate '["8ba52fe7a3956c5cd3a656a3174b931d3bb2abb45578befc59f283ecd816a405"]' -p eosio@active
cleos push action eosio activate '["ad9e3d8f650687709fd68f4b90b41f7d825a365b02c23a636cef88ac2ac00c43"]' -p eosio@active
cleos push action eosio activate '["68dcaa34c0517d19666e6b33add67351d8c5f69e999ca1e37931bc410a297428"]' -p eosio@active
cleos push action eosio activate '["e0fb64b1085cc5538970158d05a009c24e276fb94e1a0bf6a528b48fbc4ff526"]' -p eosio@active
cleos push action eosio activate '["ef43112c6543b88db2283a2e077278c315ae2c84719a8b25f25cc88565fbea99"]' -p eosio@active
cleos push action eosio activate '["4a90c00d55454dc5b059055ca213579c6ea856967712a56017487886a4d4cc0f"]' -p eosio@active
cleos push action eosio activate '["1a99a59d87e06e09ec5b028a9cbb7749b4a5ad8819004365d02dc4379a8b7241"]' -p eosio@active
cleos push action eosio activate '["bf61537fd21c61a60e542a5d66c3f6a78da0589336868307f94a82bccea84e88"]' -p eosio@active

find_package(eosio.cdt)
endif()

add_subdirectory(eosio.bios)
Copy link
Contributor

@larryk85 larryk85 Dec 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should be CMake External projects. If you look at the way eosio.contracts is setup and the way building the test contracts are. They don't include directly.

The reason for this is two fold. The old behavior that you are relying on, is a kludge of CMake to hack in CDT's toolchain. This is problematic for a couple of reasons, it can corrupt the cmake cache and fails for certain OSes and the behavior from doing the 'raw' find_package(eosio.cdt) will be gone after this release of CDT.

It has been left in CDT to build very legacy versions of eosio.contracts, but that no longer makes much sense.

You can steal the CMake from /unittests/CMakeLists.txt for setting the toolchain file and the external project.

This will also remove the issue where it is building as a 'generic' target and forcing you have to manually append the .wasm on to the binary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you Bucky very much for your comments! I have made the changes. Now the names are perfect.

@linhuang-blockone linhuang-blockone merged commit bab20a2 into develop Dec 1, 2020
@linhuang-blockone linhuang-blockone deleted the prebuild_bios_boot_contracts branch December 1, 2020 15:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants