Skip to content

Oracles: on_new_data() improvements #937

Open
@lemunozm

Description

@lemunozm

Hi,

As a user of orml_oracle, we've found some limitations regarding the on_new_data() callback when the oracle is fed:

  1. on_new_data() should return a DispatchResult. A user could want to run custom logic that, if it fails, the oracle should not be fed. Right now, from the callback, we have no control over this situation.
  2. on_new_data() should be called once with the whole list instead of one time per value. In our case, we use this callback as a trigger to make some expensive computations. We would save a lot of computation if we could combine this for all values.
  3. on_new_data() should return the Weight. Because the user can run an expensive operation inside the callback, it will be awesome to reflect it to accurately the block time computation.

We can discuss any of the points. If you finally agree with them, I could also make a PR. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions