Skip to content

Proposal for chain_getPossibleAuthors #1617

Closed

Description

@sgkim126

I want to propose the new RPC chain_getPossibleAuthors.
Currently, there is no way to get the validator list.
To generalize this, I want to add an RPC to get the authors that can be author of the block.

The purpose of this RPC is returning the sets of the account that can generate the blocks at the given block number.
It will return three of one.

  • []
    • It returns an empty list if anyone can be the block author.
    • PoW chain will return an empty list always.
  • PlatformAddress[]
    • Only some accounts can be the block author in PoA or Tendermint.
    • CodeChain will return the accounts that can be a block author in the given block number.
  • null
    • The node returns null if it cannot calculate the possible author set.
    • If the chain supports dynamic validators and the given block number is larger than the next block, the node cannot calculate the possible author set.

Params

  1. block number: number | null
    • null means the possible authors of the next block.

Returns

null | PlatformAddress[]

Activity

  1. sgkim126 commented on Jun 12, 2019

    @sgkim126
    ContributorAuthor

    @kseo @majecty @foriequal0 Please give your opinion.

  2. sgkim126 commented on Jun 12, 2019

    @sgkim126
    ContributorAuthor

    FYI, it cannot be an engine category since the dynamic validators of the tendermint depend on the chain states.

  3. sgkim126 commented on Jun 12, 2019

    @sgkim126
    ContributorAuthor

    I'm considering the RPC name between chain_getValidAuthors and chain_getPossibleAuthors.

  4. majecty commented on Jun 12, 2019

    @majecty

    LGTM I prefer chain_getPossibleAuthors to chain_getValidAuthors.

  5. foriequal0 commented on Jun 12, 2019

    @foriequal0
    Contributor

    How about returning "*" instead of []?
    AWS IAM JSON Policy Elements uses "*" for describing Role or Action.
    https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_action.html
    It is actually a string for single entry and a list of string for multiple entry with the wildcard support.
    However, to return multiple types makes me think of PHP (https://www.php.net/manual/en/function.array-search.php)

  6. sgkim126 commented on Jun 12, 2019

    @sgkim126
    ContributorAuthor

    @foriequal0 I don't think it's a good idea that the type of a JSON field is "*" or array of something.
    How about making it return null if it allows every accounts and returning the possible authors of the latest block if the block number is larger than the current best block number.

  7. changed the title [-]Proposal for chain_getValidAuthors[/-] [+]Proposal for chain_getPossibleAuthors[/+] on Jun 12, 2019
  8. foriequal0 commented on Jun 12, 2019

    @foriequal0
    Contributor

    I think we need to keep returning null when it cannot calculate authors for the consistancy with other APIs. Then we don't have much choices. [] for any or null for any. I think [] is better than null.

  9. sgkim126 commented on Jun 12, 2019

    @sgkim126
    ContributorAuthor

    As I discussed with @foriequal0 and @majecty, I'll make it return null if anyone can be authors and return an error if the block number is invalid.

  10. sgkim126 commented on Jun 14, 2019

    @sgkim126
    ContributorAuthor

    #1619 and #1618 closes it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions