Fabcoin Core  0.16.2
P2P Digital Currency
EVMSchedule.h
Go to the documentation of this file.
1 /*
2  This file is part of cpp-ethereum.
3 
4  cpp-ethereum is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  cpp-ethereum is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
16 */
23 #pragma once
24 
25 #include <libevmcore/Instruction.h>
26 #include <libdevcore/Common.h>
27 
28 namespace dev
29 {
30 namespace eth
31 {
32 
34 {
35  EVMSchedule(): tierStepGas(std::array<unsigned, 8>{{0, 2, 3, 5, 8, 10, 20, 0}}) {}
36  EVMSchedule(bool _efcd, bool _hdc, unsigned const& _txCreateGas): exceptionalFailedCodeDeposit(_efcd), haveDelegateCall(_hdc), tierStepGas(std::array<unsigned, 8>{{0, 2, 3, 5, 8, 10, 20, 0}}), txCreateGas(_txCreateGas) {}
38  bool haveDelegateCall = true;
39  bool eip150Mode = false;
40  bool eip158Mode = false;
41  std::array<unsigned, 8> tierStepGas;
42  unsigned expGas = 10;
43  unsigned expByteGas = 10;
44  unsigned sha3Gas = 30;
45  unsigned sha3WordGas = 6;
46  unsigned sloadGas = 50;
47  unsigned sstoreSetGas = 20000;
48  unsigned sstoreResetGas = 5000;
49  unsigned sstoreRefundGas = 15000;
50  unsigned jumpdestGas = 1;
51  unsigned logGas = 375;
52  unsigned logDataGas = 8;
53  unsigned logTopicGas = 375;
54  unsigned createGas = 32000;
55  unsigned callGas = 40;
56  unsigned callStipend = 2300;
57  unsigned callValueTransferGas = 9000;
58  unsigned callNewAccountGas = 25000;
59  unsigned suicideRefundGas = 24000;
60  unsigned memoryGas = 3;
61  unsigned quadCoeffDiv = 512;
62  unsigned createDataGas = 200;
63  unsigned txGas = 21000;
64  unsigned txCreateGas = 53000;
65  unsigned txDataZeroGas = 4;
66  unsigned txDataNonZeroGas = 68;
67  unsigned copyGas = 3;
68 
69  unsigned extcodesizeGas = 20;
70  unsigned extcodecopyGas = 20;
71  unsigned balanceGas = 20;
72  unsigned suicideGas = 0;
73  unsigned maxCodeSize = unsigned(-1);
74 
75  bool staticCallDepthLimit() const { return !eip150Mode; }
76  bool suicideChargesNewAccountGas() const { return eip150Mode; }
77  bool emptinessIsNonexistence() const { return eip158Mode; }
79 };
80 
81 static const EVMSchedule DefaultSchedule = EVMSchedule();
82 static const EVMSchedule FrontierSchedule = EVMSchedule(false, false, 21000);
83 static const EVMSchedule HomesteadSchedule = EVMSchedule(true, true, 53000);
84 
85 static const EVMSchedule EIP150Schedule = []
86 {
87  EVMSchedule schedule = HomesteadSchedule;
88  schedule.eip150Mode = true;
89  schedule.extcodesizeGas = 700;
90  schedule.extcodecopyGas = 700;
91  schedule.balanceGas = 400;
92  schedule.sloadGas = 200;
93  schedule.callGas = 700;
94  schedule.suicideGas = 5000;
95  schedule.maxCodeSize = 0x6000;
96  return schedule;
97 }();
98 
99 static const EVMSchedule EIP158Schedule = []
100 {
101  EVMSchedule schedule = EIP150Schedule;
102  schedule.expByteGas = 50;
103  schedule.eip158Mode = true;
104  return schedule;
105 }();
106 
107 static const EVMSchedule MetropolisSchedule = []
108 {
109  EVMSchedule schedule = EIP158Schedule;
110  return schedule;
111 }();
112 
113 }
114 }
bool emptinessIsNonexistence() const
Definition: EVMSchedule.h:77
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
Definition: Arith256.cpp:15
std::hash for asio::adress
Definition: Common.h:323
unsigned txDataNonZeroGas
Definition: EVMSchedule.h:66
bool exceptionalFailedCodeDeposit
Definition: EVMSchedule.h:37
std::array< unsigned, 8 > tierStepGas
Definition: EVMSchedule.h:41
unsigned suicideRefundGas
Definition: EVMSchedule.h:59
unsigned callValueTransferGas
Definition: EVMSchedule.h:57
bool zeroValueTransferChargesNewAccountGas() const
Definition: EVMSchedule.h:78
unsigned sstoreRefundGas
Definition: EVMSchedule.h:49
EVMSchedule(bool _efcd, bool _hdc, unsigned const &_txCreateGas)
Definition: EVMSchedule.h:36
unsigned callNewAccountGas
Definition: EVMSchedule.h:58
bool suicideChargesNewAccountGas() const
Definition: EVMSchedule.h:76
bool staticCallDepthLimit() const
Definition: EVMSchedule.h:75