From 2fe0249b94d687c9295ce983ca82914ccc3f04b4 Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Fri, 17 Aug 2018 17:10:05 +0300 Subject: [PATCH 1/6] KIP-5: "gasleft" extern --- kip-5.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 kip-5.md diff --git a/kip-5.md b/kip-5.md new file mode 100644 index 0000000..5479c73 --- /dev/null +++ b/kip-5.md @@ -0,0 +1,34 @@ +--- +kip: 5 +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 `FORK_BLOCK`, allow a new function to be imported via `env`, with host function id `230`. + +``` +fn gasleft() -> i64; +``` + +This function will return gas left in the current execution context (non-adjusted for Wasm, since the following call destiation might be EVM or Wasm) + +## Implementation + +To be added. + +## Copyright + +Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). From 16fcb83f8f0386963d73c43f2fc7c431ede6b838 Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Mon, 20 Aug 2018 10:31:25 +0300 Subject: [PATCH 2/6] Update kip-5.md --- kip-5.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kip-5.md b/kip-5.md index 5479c73..cdf52fa 100644 --- a/kip-5.md +++ b/kip-5.md @@ -1,5 +1,5 @@ --- -kip: 5 +kip: 6 title: "gasleft" Host Function for pWASM author: Nikolay Volf (@NikVolf) discussions-to: - From 280d81010389273dbfc3878894c3da0ce29ac7dc Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Mon, 20 Aug 2018 10:31:39 +0300 Subject: [PATCH 3/6] Rename kip-5.md to kip-6.md --- kip-5.md => kip-6.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename kip-5.md => kip-6.md (100%) diff --git a/kip-5.md b/kip-6.md similarity index 100% rename from kip-5.md rename to kip-6.md From 29163e07fd47d387b2506dff8fcdc2976674dcdf Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Mon, 20 Aug 2018 15:48:24 +0300 Subject: [PATCH 4/6] Update kip-6.md --- kip-6.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kip-6.md b/kip-6.md index cdf52fa..726c6c1 100644 --- a/kip-6.md +++ b/kip-6.md @@ -17,7 +17,7 @@ For default calls with no gas costs specifed downstream, user code now cannot in ## Specification -After `FORK_BLOCK`, allow a new function to be imported via `env`, with host function id `230`. +After `FORK_BLOCK`, allow a new function to be imported from module "env" with the name "gasleft". ``` fn gasleft() -> i64; From 9c2e1387cd69e281c723d01084655da77cb7fa68 Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Mon, 20 Aug 2018 15:48:49 +0300 Subject: [PATCH 5/6] Update kip-6.md --- kip-6.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kip-6.md b/kip-6.md index 726c6c1..ec2fe9f 100644 --- a/kip-6.md +++ b/kip-6.md @@ -23,7 +23,7 @@ After `FORK_BLOCK`, allow a new function to be imported from module "env" with t fn gasleft() -> i64; ``` -This function will return gas left in the current execution context (non-adjusted for Wasm, since the following call destiation might be EVM or Wasm) +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 From 6ca6f922958c6c7435f9da97493121895a00594f Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Mon, 1 Oct 2018 20:12:25 +0100 Subject: [PATCH 6/6] Update kip-6.md --- kip-6.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kip-6.md b/kip-6.md index ec2fe9f..110d2e3 100644 --- a/kip-6.md +++ b/kip-6.md @@ -17,7 +17,7 @@ For default calls with no gas costs specifed downstream, user code now cannot in ## Specification -After `FORK_BLOCK`, allow a new function to be imported from module "env" with the name "gasleft". +After `9200000`, allow a new function to be imported from module "env" with the name "gasleft". ``` fn gasleft() -> i64;