Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Some trivial externalities added #1450

Merged
merged 2 commits into from
Jan 19, 2019
Merged

Conversation

pepyakin
Copy link
Contributor

@pepyakin pepyakin commented Jan 15, 2019

This PR adds a several trivial to implement externality functions:

  • ext_value_transferred
  • ext_gas_price
  • ext_gas_left
  • ext_balance

They are all similar in the sense that they return some property of a execution context. In each case the value is returned via the scratch buffer. This works, but is little awkward for gas_left in particular since some amount of noise might be introduced by the high-level language compiler between calling gas_left and actually getting a value from it. It was discussed that we can actually constrain Gas type to a u64 and just return it via a regular return value rather than (un)marshalling it through the scratch buffer but we decided to delay it for now.

cc @Robbepop

@pepyakin pepyakin added A3-in_progress Pull request is in progress. No review needed at this stage. A0-please_review Pull request needs code review. and removed A3-in_progress Pull request is in progress. No review needed at this stage. labels Jan 15, 2019
@gavofyork
Copy link
Member

seems ok, but we'll want to do a proper audit of all this usage of scratch buffers.

@gavofyork gavofyork added A6-seemsok and removed A0-please_review Pull request needs code review. labels Jan 17, 2019
@gavofyork gavofyork merged commit 381a47e into master Jan 19, 2019
@gavofyork gavofyork deleted the ser-a-bunch-of-externalities branch January 19, 2019 11:33
MTDK1 pushed a commit to bdevux/substrate that referenced this pull request Apr 12, 2019
* Add gas_left, gas_price and balance externalities

* Add a value_transferred externality
liuchengxu pushed a commit to liuchengxu/substrate that referenced this pull request May 31, 2023
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