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

Add eosio.sudo contract #4429

Merged
merged 9 commits into from
Jul 3, 2018
Merged

Add eosio.sudo contract #4429

merged 9 commits into from
Jul 3, 2018

Conversation

arhag
Copy link
Contributor

@arhag arhag commented Jun 30, 2018

Resolves #4142.

Adds a new contract (eosio.sudo) that is meant to be deployed to a privileged account eosio.sudo. This contract provides just one action exec which takes a transaction and schedules it as a deferred transaction while bypassing normal authorization checks (which it can do since it is on a privileged account).

It does however check for authorization of itself (as well as authorization of the executer). The idea is that the eosio.sudo account should have its permissions set up like all the other eosio.* accounts: satisfied entirely by the active permission of the eosio account, which in turn is fully satisfied by the active permission of the eosio.prods account. Effectively, it means that only a greater than two-thirds supermajority of the active block producers are able to use the eosio.sudo::exec action to execute any transaction while bypassing all regular authorization checks.

This PR also includes tests related to the eosio.sudo contract, including testing the ability to propose a transaction that uses eosio.sudo::exec via the eosio.msig contract.

Also, @moskvanaft's changes to cleos to add the cleos multisig propose_trx account were added into this PR as well (those changes were originally meant for the v1.1 release) because it would be infeasible to deploy and use the eosio.sudo contract without it.

@arhag arhag added this to the Version 1.0.8 milestone Jun 30, 2018
require_auth( executer );

size_t trx_pos = ds.tellp();
send_deferred( (uint128_t(executer) << 64) | current_time(), executer, buffer+trx_pos, size );
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't it be size-trx_pos ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It should be. Thanks.

In practice, send_deferred is pretty flexible about the size passed in as long as it isn't smaller than the actual size of the serialized transaction data, but indeed size-trx_pos is the correct expression for the argument to pass into this send_deferred call.

@arhag arhag merged commit 7e74df6 into release/1.0.x Jul 3, 2018
@arhag arhag deleted the 4142-eosio-sudo-simple branch July 3, 2018 18:07
@arhag arhag mentioned this pull request Jul 3, 2018
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