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

Make it a general tool to generate Iroha Transactions for testing and development purposes #30

Open
8 of 51 tasks
0x009922 opened this issue Sep 2, 2022 · 0 comments
Open
8 of 51 tasks

Comments

@0x009922
Copy link

0x009922 commented Sep 2, 2022

Requirements

  • Having a set of accounts and their keys, do some operations

  • Operation is a submitting of a transaction(s) to the Iroha Peer. Each operation should have a unique key, like MintOwnAsset. Different operations might have different complexity.

  • The set of operations should cover all possible Instructions, Expressions and Values. Each operation separately shouldn't necessarily cover all of them, but the whole set of operations should.

    Note: the set of operations should be wisely constrained - we don't actually need to check all possible combinations, because their amount seems vast.

    Advanced: cover WASM executables, triggers registration and execution. Since it looks more complex than "just generate random transaction" and may require to store intermediate state, it could be stored via Metadata of some entities I guess.

  • It is fine if some of the generated transactions will be rejected - it is important to handle failure cases during development as well.

  • The tool might be run as a long-running process that does operations with a specified interval. In this case, each operation should have its own probability weight which affects the probability of operation occurring. They should have it due to the difference between their complexity and probability in the "real world". Also it should be possible to override weights on startup via CLI arguments and/or configuration file.

    Weights design proposal: lets assume we have a set of operations:

    • MintOwnAsset - 5
    • RegisterAccount - 1
    • AllowOtherAccountToTransferMyAssets - 0.2

    In this case, the actual probability for MintOwnAsset will be 5 / (5 + 1 + 0.2) ~= 80.6%, for RegisterAccount - 1 / (5 + 1 + 0.2) ~= 16%, and so on.

    Call sample:

    ./iroha2_longevity long-running \
      --config ./config.json \
      --interval 2.5s \
      # override probability of some operation
      --probability:MintOwnAsset 0
  • The tool might be run to perform the only one specified operation. During development of Iroha-related tools, we might need to generate some specific action instead of bombing Iroha with all kinds of stuff.

    Call sample:

    ./iroha2_longevity once --config ./config.json --operation MintOwnAsset

Nice to have

  • Documentation for each operation and a list of entities it covers. For example, MintOrBurnAssetDependingOnValue might touch Instruction::If, Value::Query, Expression::Less entities. It might be useful to search for the exact operation by the entity it covers. The documentation might have any format, even CLI would be nice.

Checklist

Here is the checklist of different entities that should be covered. It might be used as an on-going TODO list during development of the tool.

Please write the operation key near the entity so it will be easier to track them.

  • Instruction:

    • Register
    • Unregister
    • Mint
    • Burn
    • Transfer
    • If
    • Pair
    • Sequence
    • Fail
    • SetKeyValue
    • RemoveKeyValue
    • Grant
    • Revoke
    • ExecuteTrigger
  • Expression:

    • Add
    • Subtract
    • Multiply
    • Divide
    • Mod
    • RaiseTo
    • Greater
    • Less
    • Equal
    • Not
    • And
    • Or
    • If
    • Raw
    • Query
    • Contains
    • ContainsAll
    • ContainsAny
    • Where
    • ContextValue
  • Value:

    • U32
    • U128
    • Bool
    • String
    • Name
    • Fixed
    • Vec
    • LimitedMetadata
    • Id
    • Identifiable
    • PublicKey
    • Parameter
    • SignatureCheckCondition
    • TransactionValue
    • PermissionToken
    • Hash
    • Block

Some cases

Additional context

We develop https://github.com/soramitsu/iroha2-block-explorer-backend & https://github.com/soramitsu/iroha2-block-explorer-web. We struggle with a lack of data within Iroha. There are so many cases and possible data we should consider. We cannot continue development without a tool described in this issue.

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

No branches or pull requests

1 participant