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

EPE-1708 cleos sorts keys/permission_levels/waits for "cleos set account permission" - release/2.2.x #10911

Merged
merged 1 commit into from
Dec 9, 2021

Conversation

zma
Copy link
Collaborator

@zma zma commented Nov 26, 2021

The same change to release/2.2.x branch for #10903 .

The keys/permissions/waits to eosio::updateauth action must be ordered. The order is not simply the string order.

At current, cleos can validate the authority data structure. But when there are multiple keys or multiple permission_levels, it is hard to figure out how to order the keys/permissions/waits. There are N! number of combinations to try for N keys/permission_levels.

It will be convenient if cleos set account permission can automatically sort the keys, permission_levels and waits for users.

One example:

./bin/cleos -u https://eos.greymass.com set account permission eosio active -sdj -x 3600 '{
  "threshold": 1,
  "keys": [
    {
      "key": "EOS8YWkQM9bcwHUSjEfZVAb7cDoQNAwikYvJXrAbQya2hhdDz7KSR",
      "weight": 1
    },
    {
      "key": "EOS7QvhpiF4uWTrjCgyJz2mV13mhdCwzNLNXSGn6npK87Ymz56Mip",
      "weight": 1
    }
  ],
  "accounts": [
    {
      "permission": {
          "actor": "eosio.token",
          "permission": "owner"
        },
        "weight": 1
    },
    {
      "permission": {
          "actor": "eosio.token",
          "permission": "active"
        },
        "weight": 1
    },
    {
      "permission": {
          "actor": "eosio.saving",
          "permission": "active"
        },
        "weight": 1
    }
  ],
  "waits": [
    {
      "wait_sec": 10,
      "weight": 2
    },
    {
      "wait_sec": 5,
      "weight": 1
    }
  ]
}' -p eosio@active
{
  "expiration": "2021-11-24T10:27:24",
  "ref_block_num": 46078,
  "ref_block_prefix": 3678459831,
  "max_net_usage_words": 0,
  "max_cpu_usage_ms": 0,
  "delay_sec": 0,
  "context_free_actions": [],
  "actions": [{
      "account": "eosio",
      "name": "updateauth",
      "authorization": [{
          "actor": "eosio",
          "permission": "active"
        }
      ],
      "data": {
        "account": "eosio",
        "permission": "active",
        "parent": "owner",
        "auth": {
          "threshold": 1,
          "keys": [{
              "key": "EOS7QvhpiF4uWTrjCgyJz2mV13mhdCwzNLNXSGn6npK87Ymz56Mip",
              "weight": 1
            },{
              "key": "EOS8YWkQM9bcwHUSjEfZVAb7cDoQNAwikYvJXrAbQya2hhdDz7KSR",
              "weight": 1
            }
          ],
          "accounts": [{
              "permission": {
                "actor": "eosio.saving",
                "permission": "active"
              },
              "weight": 1
            },{
              "permission": {
                "actor": "eosio.token",
                "permission": "active"
              },
              "weight": 1
            },{
              "permission": {
                "actor": "eosio.token",
                "permission": "owner"
              },
              "weight": 1
            }
          ],
          "waits": [{
              "wait_sec": 5,
              "weight": 1
            },{
              "wait_sec": 10,
              "weight": 2
            }
          ]
        }
      },
      "hex_data": "0000000000ea305500000000a8ed32320000000080ab26a7010000000200034c80d981ee83fd82089672e361102b87f561f2f07fc51fd10bbda24471072c6d01000003e16d3374ee29cf0b794df19dd0919ee309cf4e500e1f71c4c866884a32ae9f67010003c0a6db0603ea305500000000a8ed3232010000a6823403ea305500000000a8ed3232010000a6823403ea30550000000080ab26a70100020500000001000a0000000200"
    }
  ],
  "signatures": [],
  "context_free_data": []
}

Change Description

Change Type

Select ONE:

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

Testing Changes

Select ANY that apply:

  • New Tests
  • Existing Tests
  • Test Framework
  • CI System
  • Other

Consensus Changes

  • Consensus Changes

API Changes

  • API Changes

Documentation Additions

  • Documentation Additions

@zma zma requested review from heifner and taokayan November 26, 2021 08:40
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.

3 participants