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

KIP-6: "gasleft" extern #6

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions kip-6.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
kip: 6
title: "gasleft" Host Function for pWASM
author: Nikolay Volf (@NikVolf)
discussions-to: -
status: Draft
type: Standards Track
category: Core
created: 2018-08-17
---

# GASLEFT Host Function for pWASM

## Motivation

For default calls with no gas costs specifed downstream, user code now cannot infer how much gas left in the current context of execution. Proposed "gasleft" extern will allow this.

## Specification

After `9200000`, allow a new function to be imported from module "env" with the name "gasleft".

```
fn gasleft() -> i64;
```

This function will return gas left in the current execution context (non-adjusted for Wasm, since the following call destination might be EVM or Wasm)

## Implementation

To be added.

## Copyright

Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).