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

update bios to have 'temporary' setpparams action #9734

Merged
merged 2 commits into from
Dec 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 15 additions & 0 deletions contracts/contracts/eosio.bios/bin/eosio.bios.abi
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,16 @@
}
]
},
{
"name": "setpparams",
"base": "",
"fields": [
{
"name": "bytes",
"type": "bytes"
}
]
},
{
"name": "setpriv",
"base": "",
Expand Down Expand Up @@ -545,6 +555,11 @@
"type": "setparams",
"ricardian_contract": ""
},
{
"name": "setpparams",
"type": "setpparams",
"ricardian_contract": ""
},
{
"name": "setpriv",
"type": "setpriv",
Expand Down
Binary file modified contracts/contracts/eosio.bios/bin/eosio.bios.wasm
Binary file not shown.
11 changes: 10 additions & 1 deletion contracts/contracts/eosio.bios/include/eosio.bios/eosio.bios.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ namespace eosiobios {

/**
* The `eosio.bios` is the first sample of system contract provided by `block.one` through the EOSIO platform. It is a minimalist system contract because it only supplies the actions that are absolutely critical to bootstrap a chain and nothing more. This allows for a chain agnostic approach to bootstrapping a chain.
*
*
* Just like in the `eosio.system` sample contract implementation, there are a few actions which are not implemented at the contract level (`newaccount`, `updateauth`, `deleteauth`, `linkauth`, `unlinkauth`, `canceldelay`, `onerror`, `setabi`, `setcode`), they are just declared in the contract so they will show in the contract's ABI and users will be able to push those actions to the chain via the account holding the `eosio.system` contract, but the implementation is at the EOSIO core level. They are referred to as EOSIO native actions.
*/
class [[eosio::contract("eosio.bios")]] bios : public eosio::contract {
Expand Down Expand Up @@ -228,6 +228,14 @@ namespace eosiobios {
[[eosio::action]]
void setparams( const eosio::blockchain_parameters& params );

/**
* Set params action, sets the blockchain parameters. By tuning these parameters, various degrees of customization can be achieved.
*
* @param params - New blockchain parameters to set
*/
[[eosio::action]]
void setpparams( const std::vector<char>& bytes);

/**
* Set KV params action, sets the KV parameters. By tuning these parameters, various degrees of customization can be achieved.
*
Expand Down Expand Up @@ -283,6 +291,7 @@ namespace eosiobios {
using setalimits_action = action_wrapper<"setalimits"_n, &bios::setalimits>;
using setprods_action = action_wrapper<"setprods"_n, &bios::setprods>;
using setparams_action = action_wrapper<"setparams"_n, &bios::setparams>;
using setpparams_action = action_wrapper<"setpparams"_n, &bios::setpparams>;
using setkvparams_action = action_wrapper<"setkvparams"_n, &bios::setkvparams>;
using reqauth_action = action_wrapper<"reqauth"_n, &bios::reqauth>;
using activate_action = action_wrapper<"activate"_n, &bios::activate>;
Expand Down
11 changes: 11 additions & 0 deletions contracts/contracts/eosio.bios/src/eosio.bios.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

namespace eosiobios {

// move this to CDT after this release
extern "C" {
__attribute__((eosio_wasm_import))
void set_parameters_packed(const char*, std::size_t);
}

void bios::setabi( name account, const std::vector<char>& abi ) {
abi_hash_table table(get_self(), get_self().value);
auto itr = table.find( account.value );
Expand Down Expand Up @@ -41,6 +47,11 @@ void bios::setparams( const eosio::blockchain_parameters& params ) {
set_blockchain_parameters( params );
}

void bios::setpparams( const std::vector<char>& params ) {
require_auth( get_self() );
set_parameters_packed( params.data(), params.size() );
}

void bios::setkvparams( const eosio::kv_parameters& params ) {
require_auth( get_self() );
set_kv_parameters( params );
Expand Down