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

[3.2] cleos: add get supported_protocol_features and system activate subcommands #663

Merged
merged 13 commits into from
Jul 19, 2022

Conversation

linh2931
Copy link
Member

@linh2931 linh2931 commented Jul 13, 2022

Backport EOSIO/eos#10036 spiritually. Resolve #462

Add get supported_protocol_features and system activate to cleos such that protocol features can be activated by using their names; no feature digests are needed.

The feature was totally rewritten. Hardcodied protocol feature names and digests are removed. User can use get supported_protocol_features to find a list of supported feature names. Command description was cleaned up and PREACTIVATE_FEATURE was removed as it is not possible to activate it using activate action from eosio.boot (RPC schedule_protocol_feature_activations must be used).

  1. Find supported protocol features
./cleos get supported_protocol_features
ONLY_LINK_TO_EXISTING_PERMISSION
FORWARD_SETCODE
WTMSIG_BLOCK_SIGNATURES
GET_BLOCK_NUM
REPLACE_DEFERRED
NO_DUPLICATE_DEFERRED_ID
RAM_RESTRICTIONS
WEBAUTHN_KEY
BLOCKCHAIN_PARAMETERS
DISALLOW_EMPTY_PRODUCER_SCHEDULE
CRYPTO_PRIMITIVES
ONLY_BILL_FIRST_AUTHORIZER
RESTRICT_ACTION_TO_SELF
GET_CODE_HASH
ACTION_RETURN_VALUE
CONFIGURABLE_WASM_LIMITS2
FIX_LINKAUTH_RESTRICTION
GET_SENDER
  1. Activate a protocol feature
./cleos system activate WTMSIG_BLOCK_SIGNATURES
executed transaction: 667479cd2280739b21b925c1c9cddc2d8dc46626f0ecc61173aec5f092431c61  128 bytes  179 us
#         eosio <= eosio::activate              {"feature_digest":"299dcb6af692324b899b39f16d5a530a33062804e41f09dc97e9f156b4476707"}
warn  2022-07-16T01:51:13.001 cleos     main.cpp:665                  print_result       warning: transaction executed locally, but may not be confirmed by the network yet
  1. Activate an unknown protocol feature
./cleos system activate ABCD
ABCD is unknown. Following protocol features are supported

ONLY_LINK_TO_EXISTING_PERMISSION
FORWARD_SETCODE
WTMSIG_BLOCK_SIGNATURES
GET_BLOCK_NUM
REPLACE_DEFERRED
NO_DUPLICATE_DEFERRED_ID
RAM_RESTRICTIONS
WEBAUTHN_KEY
BLOCKCHAIN_PARAMETERS
DISALLOW_EMPTY_PRODUCER_SCHEDULE
CRYPTO_PRIMITIVES
ONLY_BILL_FIRST_AUTHORIZER
RESTRICT_ACTION_TO_SELF
GET_CODE_HASH
ACTION_RETURN_VALUE
CONFIGURABLE_WASM_LIMITS2
FIX_LINKAUTH_RESTRICTION
GET_SENDER

softprofe and others added 3 commits July 12, 2022 10:15
…ch as: cleos system activate kv_database. don't need using digest.
…ve PREACTIVATE_FEATURE as it cannot be activated via activate action
@linh2931 linh2931 requested review from heifner and spoonincode July 13, 2022 01:08
@linh2931 linh2931 self-assigned this Jul 13, 2022
activate_subcommand(CLI::App* actionRoot) {
auto activate = actionRoot->add_subcommand("activate", localized("Activate protocol feature by name"));
activate->add_option("feature", feature_name_str, localized("The name, one of below (lowercase also works):\n"
"ONLY_LINK_TO_EXISTING_PERMISSION\n"
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we have a way of generating these from parsing the protocol_feature_manager.cpp? We have this pattern in quite a few places as is where we have hard-coded the protocol feature names and digests. It ultimately makes it incredibly difficult to add new protocol features as all the places you have to go and fix are not connected and usually won't break certain tests, etc.

Copy link
Member

Choose a reason for hiding this comment

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

This right here please.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks @larryk85 and @spoonincode I will call get_supported_protocol_features to get a list. This code will never change again when protocol features change.

string action="activate";
string data;
std::locale loc;
vector<std::string> permissions = {"eosio"};
Copy link
Member

Choose a reason for hiding this comment

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

Would be nice to provide an option to override the default permission.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks @heifner . Will add an option to provide more flexibility.

linh2931 and others added 6 commits July 14, 2022 21:37
…g get_supported_protocol_features RPC; provide account and permission options
…o contact the chain in the constructor of activate_subcommand which causes problems for cleos problem initialzation when the chain is offline, and a seperate get supported_protocol_features is clearer
@linh2931 linh2931 changed the title [3.2] cleos: add protocol feature activation subcommand [3.2] cleos: add get supported_protocol_features and system activate subcommands Jul 16, 2022
@linh2931 linh2931 merged commit d6c3e25 into main Jul 19, 2022
@linh2931 linh2931 deleted the cleos_activate_subcommand branch July 19, 2022 01:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Backport: add cleos system activate subcommand
5 participants