From d4a9172c7907f1788d61a58110be113650e258a3 Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 13 Feb 2017 14:50:04 +0100 Subject: [PATCH] Add STATIC_CALL opcode. --- EIPS/static_call.md | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 EIPS/static_call.md diff --git a/EIPS/static_call.md b/EIPS/static_call.md new file mode 100644 index 00000000..7dd99bb8 --- /dev/null +++ b/EIPS/static_call.md @@ -0,0 +1,41 @@ +## Preamble +
+  EIP: to be assigned
+  Title: New opcode STATIC_CALL
+  Author: Vitalik Buterin <vitalik@ethereum.org>, Christian Reitwiessner <chris@ethereum.org>
+  Type: Standard Track
+  Category(*only required for Standard Track): Core
+  Status: Draft
+  Created: 2017-02-13
+
+ +## Simple Summary + +To increase smart contract security, this proposal adds a new opcode that can be used to call another contract (or itself) while disallowing any modifications to the state during the call (and its subcalls, if present). + +## Abstract + + +## Motivation + + +## Specification + +Opcode: `0xfa`. + +`STATIC_CALL` functions equivalently to a `CALL`, except it takes 6 arguments not including value, and calls the child with a `STATIC` flag on. Any calls, static or otherwise, made by an execution instance with a `STATIC` flag on will also have a `STATIC` flag on. Any attempts to make state-changing operations inside an execution instance with a `STATIC` flag on will instead throw an exception. These operations include nonzero-value calls, creates, `LOG` calls, `SSTORE`, `SSTOREBYTES` and `SUICIDE`. + +## Rationale + +This allows contracts to make calls that are clearly non-state-changing, reassuring developers and reviewers that re-entrancy bugs or other problems cannot possibly arise from that particular call; it is a pure function that returns an output and does nothing else. This may also make purely functional HLLs easier to implement. + +## Backwards Compatibility + +This proposal adds a new opcode but does not modify the behaviour of other opcodes and thus is backwards compatible for old contracts that do not use the new opcode. + +## Test Cases + +To be written. + +## Implementation +