From cf76bba44421c611fd27d9e6c1ce1d381dc12977 Mon Sep 17 00:00:00 2001 From: alex-forshtat-tbk Date: Wed, 16 Jan 2019 16:24:00 +0200 Subject: [PATCH] Apply the gasleft check before any of the branches are applied --- EIPS/eip-1283.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/EIPS/eip-1283.md b/EIPS/eip-1283.md index 00902b7bf8d2cc..264c27512cc137 100644 --- a/EIPS/eip-1283.md +++ b/EIPS/eip-1283.md @@ -53,6 +53,8 @@ Definitions of terms are as below: Replace SSTORE opcode gas cost calculation (including refunds) with the following logic: +* If *gasleft* is less then or equal 2300, fail the transaction + with 'out of gas' exception. * If *current value* equals *new value* (this is a no-op), 200 gas is deducted. * If *current value* does not equal *new value* @@ -63,8 +65,7 @@ the following logic: gas to refund counter. * If *original value* does not equal *current value* (this storage slot is dirty), 200 gas is deducted. Apply both of the following - clauses. If *gasleft* is less then or equal 2300, fail the transaction - with 'out of gas' exception. + clauses. * If *original value* is not 0 * If *current value* is 0 (also means that *new value* is not 0), remove 15000 gas from refund counter. We can prove that