diff --git a/EIPS/eip-3.mediawiki b/EIPS/eip-3.mediawiki index 3ec961b4..6e5c28ba 100644 --- a/EIPS/eip-3.mediawiki +++ b/EIPS/eip-3.mediawiki @@ -9,7 +9,7 @@ ==Abstract== -This is a proposal to add a new opcode, `CALLDEPTH`. The `CALLDEPTH` opcode would return the remaining available call stack depth. +This is a proposal to add a new opcode, CALLDEPTH. The CALLDEPTH opcode would return the remaining available call stack depth. ==Motivation== @@ -19,14 +19,14 @@ This behaviour makes it possible to subject a contract to a "call stack attack" Example: -1. Contract `A` want's to be invoked regularly, and pays Ether to the invoker in every block. -2. When contract `A` is invoked, it calls contracts `B` and `C`, which consumes a lot of gas. After invocation, contract `A` pays Ether to the caller. -3. Malicious user `X` ensures that the stack depth is shallow before invoking A. Both calls to `B` and `C` fail, but `X` can still collect the reward. +# Contract `A` want's to be invoked regularly, and pays Ether to the invoker in every block. +# When contract `A` is invoked, it calls contracts `B` and `C`, which consumes a lot of gas. After invocation, contract `A` pays Ether to the caller. +# Malicious user `X` ensures that the stack depth is shallow before invoking A. Both calls to `B` and `C` fail, but `X` can still collect the reward. It is possible to defend against this in two ways: -1. Check return value after invocation. -2. Check call stack depth experimentally. A library [2] by Piper Merriam exists for this purpose. This method is quite costly in gas. +# Check return value after invocation. +# Check call stack depth experimentally. A library [2] by Piper Merriam exists for this purpose. This method is quite costly in gas. [1] a.k.a "shallow stack attack" and "stack attack". However, to be precise, the word `stack` has a different meaning within the EVM, and is not to be confused with the _call stack_. @@ -34,7 +34,7 @@ It is possible to defend against this in two ways: ==Specification== -The opcode `CALLDEPTH` should return the remaining call stack depth. A value of `0` means that the call stack is exhausted, and no further calls can be made. +The opcode CALLDEPTH should return the remaining call stack depth. A value of `0` means that the call stack is exhausted, and no further calls can be made. ==Rationale==