Ethereum  PoC-8
The C++ Implementation of Ethereum
LegacyVM.cpp
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 */
17 
18 #include "LegacyVM.h"
19 
20 using namespace std;
21 using namespace dev;
22 using namespace dev::eth;
23 
24 uint64_t LegacyVM::memNeed(u256 const& _offset, u256 const& _size)
25 {
26  return toInt63(_size ? u512(_offset) + _size : u512(0));
27 }
28 
29 template <class S> S divWorkaround(S const& _a, S const& _b)
30 {
31  return (S)(s512(_a) / s512(_b));
32 }
33 
34 template <class S> S modWorkaround(S const& _a, S const& _b)
35 {
36  return (S)(s512(_a) % s512(_b));
37 }
38 
39 
40 //
41 // for decoding destinations of JUMPTO, JUMPV, JUMPSUB and JUMPSUBV
42 //
43 
44 uint64_t LegacyVM::decodeJumpDest(const byte* const _code, uint64_t& _pc)
45 {
46  // turn 2 MSB-first bytes in the code into a native-order integer
47  uint64_t dest = _code[_pc++];
48  dest = (dest << 8) | _code[_pc++];
49  return dest;
50 }
51 
52 uint64_t LegacyVM::decodeJumpvDest(const byte* const _code, uint64_t& _pc, byte _voff)
53 {
54  // Layout of jump table in bytecode...
55  // byte opcode
56  // byte n_jumps
57  // byte table[n_jumps][2]
58  //
59  uint64_t pc = _pc;
60  byte n = _code[++pc]; // byte after opcode is number of jumps
61  if (_voff >= n) _voff = n - 1; // if offset overflows use default jump
62  pc += _voff * 2; // adjust inout pc before index destination in table
63 
64  uint64_t dest = decodeJumpDest(_code, pc);
65 
66  _pc += 1 + n * 2; // adust inout _pc to opcode after table
67  return dest;
68 }
69 
70 
71 //
72 // for tracing, checking, metering, measuring ...
73 //
74 void LegacyVM::onOperation()
75 {
76  if (m_onOp)
77  (m_onOp)(++m_nSteps, m_PC, m_OP,
78  m_newMemSize > m_mem.size() ? (m_newMemSize - m_mem.size()) / 32 : uint64_t(0),
79  m_runGas, m_io_gas, this, m_ext);
80 }
81 
82 //
83 // set current SP to SP', adjust SP' per _removed and _added items
84 //
85 void LegacyVM::adjustStack(unsigned _removed, unsigned _added)
86 {
87  m_SP = m_SPP;
88 
89  // adjust stack and check bounds
90  m_SPP += _removed;
91  if (m_stackEnd < m_SPP)
92  throwBadStack(_removed, _added);
93  m_SPP -= _added;
94  if (m_SPP < m_stack)
95  throwBadStack(_removed, _added);
96 }
97 
98 void LegacyVM::updateSSGas()
99 {
100  u256 const currentValue = m_ext->store(m_SP[0]);
101  u256 const newValue = m_SP[1];
102 
103  if (m_schedule->eip1283Mode)
104  updateSSGasEIP1283(currentValue, newValue);
105  else
106  updateSSGasPreEIP1283(currentValue, newValue);
107 }
108 
109 void LegacyVM::updateSSGasPreEIP1283(u256 const& _currentValue, u256 const& _newValue)
110 {
111  if (!_currentValue && _newValue)
112  m_runGas = toInt63(m_schedule->sstoreSetGas);
113  else if (_currentValue && !_newValue)
114  {
115  m_runGas = toInt63(m_schedule->sstoreResetGas);
116  m_ext->sub.refunds += m_schedule->sstoreRefundGas;
117  }
118  else
119  m_runGas = toInt63(m_schedule->sstoreResetGas);
120 }
121 
122 void LegacyVM::updateSSGasEIP1283(u256 const& _currentValue, u256 const& _newValue)
123 {
124  if (_currentValue == _newValue)
125  m_runGas = m_schedule->sstoreUnchangedGas;
126  else
127  {
128  u256 const originalValue = m_ext->originalStorageValue(m_SP[0]);
129  if (originalValue == _currentValue)
130  {
131  if (originalValue == 0)
132  m_runGas = m_schedule->sstoreSetGas;
133  else
134  {
135  m_runGas = m_schedule->sstoreResetGas;
136  if (_newValue == 0)
137  m_ext->sub.refunds += m_schedule->sstoreRefundGas;
138  }
139  }
140  else
141  {
142  m_runGas = m_schedule->sstoreUnchangedGas;
143  if (originalValue != 0)
144  {
145  if (_currentValue == 0)
146  m_ext->sub.refunds -= m_schedule->sstoreRefundGas; // Can go negative.
147  if (_newValue == 0)
148  m_ext->sub.refunds += m_schedule->sstoreRefundGas;
149  }
150  if (originalValue == _newValue)
151  {
152  if (originalValue == 0)
153  m_ext->sub.refunds +=
154  m_schedule->sstoreRefundGas + m_schedule->sstoreRefundNonzeroGas;
155  else
156  m_ext->sub.refunds += m_schedule->sstoreRefundNonzeroGas;
157  }
158  }
159  }
160 }
161 
162 
163 uint64_t LegacyVM::gasForMem(u512 const& _size)
164 {
165  u512 s = _size / 32;
166  return toInt63((u512)m_schedule->memoryGas * s + s * s / m_schedule->quadCoeffDiv);
167 }
168 
169 void LegacyVM::updateIOGas()
170 {
171  if (m_io_gas < m_runGas)
172  throwOutOfGas();
173  m_io_gas -= m_runGas;
174 }
175 
176 void LegacyVM::updateGas()
177 {
178  if (m_newMemSize > m_mem.size())
179  m_runGas += toInt63(gasForMem(m_newMemSize) - gasForMem(m_mem.size()));
180  m_runGas += (m_schedule->copyGas * ((m_copyMemSize + 31) / 32));
181  if (m_io_gas < m_runGas)
182  throwOutOfGas();
183 }
184 
185 void LegacyVM::updateMem(uint64_t _newMem)
186 {
187  m_newMemSize = (_newMem + 31) / 32 * 32;
188  updateGas();
189  if (m_newMemSize > m_mem.size())
190  m_mem.resize(m_newMemSize);
191 }
192 
193 void LegacyVM::logGasMem()
194 {
195  unsigned n = (unsigned)m_OP - (unsigned)Instruction::LOG0;
196  m_runGas = toInt63(m_schedule->logGas + m_schedule->logTopicGas * n + u512(m_schedule->logDataGas) * m_SP[1]);
197  updateMem(memNeed(m_SP[0], m_SP[1]));
198 }
199 
200 void LegacyVM::fetchInstruction()
201 {
202  m_OP = Instruction(m_code[m_PC]);
203  const InstructionMetric& metric = c_metrics[static_cast<size_t>(m_OP)];
204  adjustStack(metric.args, metric.ret);
205 
206  // FEES...
207  m_runGas = toInt63(m_schedule->tierStepGas[static_cast<unsigned>(metric.gasPriceTier)]);
208  m_newMemSize = m_mem.size();
209  m_copyMemSize = 0;
210 }
211 
212 
214 //
215 // interpreter entry point
216 
217 owning_bytes_ref LegacyVM::exec(u256& _io_gas, ExtVMFace& _ext, OnOpFunc const& _onOp)
218 {
219  m_io_gas_p = &_io_gas;
220  m_io_gas = uint64_t(_io_gas);
221  m_ext = &_ext;
222  m_schedule = &m_ext->evmSchedule();
223  m_onOp = _onOp;
224  m_onFail = &LegacyVM::onOperation; // this results in operations that fail being logged twice in the trace
225  m_PC = 0;
226 
227  try
228  {
229  // trampoline to minimize depth of call stack when calling out
230  m_bounce = &LegacyVM::initEntry;
231  do
232  (this->*m_bounce)();
233  while (m_bounce);
234 
235  }
236  catch (...)
237  {
238  *m_io_gas_p = m_io_gas;
239  throw;
240  }
241 
242  *m_io_gas_p = m_io_gas;
243  return std::move(m_output);
244 }
245 
246 //
247 // main interpreter loop and switch
248 //
249 void LegacyVM::interpretCases()
250 {
251  INIT_CASES
252  DO_CASES
253  {
254  //
255  // Call-related instructions
256  //
257 
258  CASE(CREATE2)
259  {
260  ON_OP();
261  if (!m_schedule->haveCreate2)
262  throwBadInstruction();
263  if (m_ext->staticCall)
264  throwDisallowedStateChange();
265 
266  m_bounce = &LegacyVM::caseCreate;
267  }
268  BREAK
269 
270  CASE(CREATE)
271  {
272  ON_OP();
273  if (m_ext->staticCall)
274  throwDisallowedStateChange();
275 
276  m_bounce = &LegacyVM::caseCreate;
277  }
278  BREAK
279 
280  CASE(DELEGATECALL)
281  CASE(STATICCALL)
282  CASE(CALL)
283  CASE(CALLCODE)
284  {
285  ON_OP();
286  if (m_OP == Instruction::DELEGATECALL && !m_schedule->haveDelegateCall)
287  throwBadInstruction();
288  if (m_OP == Instruction::STATICCALL && !m_schedule->haveStaticCall)
289  throwBadInstruction();
290  if (m_OP == Instruction::CALL && m_ext->staticCall && m_SP[2] != 0)
291  throwDisallowedStateChange();
292  m_bounce = &LegacyVM::caseCall;
293  }
294  BREAK
295 
296  CASE(RETURN)
297  {
298  ON_OP();
299  m_copyMemSize = 0;
300  updateMem(memNeed(m_SP[0], m_SP[1]));
301  updateIOGas();
302 
303  uint64_t b = (uint64_t)m_SP[0];
304  uint64_t s = (uint64_t)m_SP[1];
305  m_output = owning_bytes_ref{std::move(m_mem), b, s};
306  m_bounce = 0;
307  }
308  BREAK
309 
310  CASE(REVERT)
311  {
312  // Pre-byzantium
313  if (!m_schedule->haveRevert)
314  throwBadInstruction();
315 
316  ON_OP();
317  m_copyMemSize = 0;
318  updateMem(memNeed(m_SP[0], m_SP[1]));
319  updateIOGas();
320 
321  uint64_t b = (uint64_t)m_SP[0];
322  uint64_t s = (uint64_t)m_SP[1];
323  owning_bytes_ref output{move(m_mem), b, s};
324  throwRevertInstruction(move(output));
325  }
326  BREAK;
327 
328  CASE(SUICIDE)
329  {
330  ON_OP();
331  if (m_ext->staticCall)
332  throwDisallowedStateChange();
333 
334  m_runGas = toInt63(m_schedule->suicideGas);
335  Address dest = asAddress(m_SP[0]);
336 
337  // After EIP158 zero-value suicides do not have to pay account creation gas.
338  if (m_ext->balance(m_ext->myAddress) > 0 || m_schedule->zeroValueTransferChargesNewAccountGas())
339  // After EIP150 hard fork charge additional cost of sending
340  // ethers to non-existing account.
341  if (m_schedule->suicideChargesNewAccountGas() && !m_ext->exists(dest))
342  m_runGas += m_schedule->callNewAccountGas;
343 
344  updateIOGas();
345  m_ext->suicide(dest);
346  m_bounce = 0;
347  }
348  BREAK
349 
350  CASE(STOP)
351  {
352  ON_OP();
353  updateIOGas();
354  m_bounce = 0;
355  }
356  BREAK
357 
358 
359  //
360  // instructions potentially expanding memory
361  //
362 
363  CASE(MLOAD)
364  {
365  ON_OP();
366  updateMem(toInt63(m_SP[0]) + 32);
367  updateIOGas();
368 
369  m_SPP[0] = (u256)*(h256 const*)(m_mem.data() + (unsigned)m_SP[0]);
370  }
371  NEXT
372 
373  CASE(MSTORE)
374  {
375  ON_OP();
376  updateMem(toInt63(m_SP[0]) + 32);
377  updateIOGas();
378 
379  *(h256*)&m_mem[(unsigned)m_SP[0]] = (h256)m_SP[1];
380  }
381  NEXT
382 
383  CASE(MSTORE8)
384  {
385  ON_OP();
386  updateMem(toInt63(m_SP[0]) + 1);
387  updateIOGas();
388 
389  m_mem[(unsigned)m_SP[0]] = (byte)(m_SP[1] & 0xff);
390  }
391  NEXT
392 
393  CASE(SHA3)
394  {
395  ON_OP();
396  m_runGas = toInt63(m_schedule->sha3Gas + (u512(m_SP[1]) + 31) / 32 * m_schedule->sha3WordGas);
397  updateMem(memNeed(m_SP[0], m_SP[1]));
398  updateIOGas();
399 
400  uint64_t inOff = (uint64_t)m_SP[0];
401  uint64_t inSize = (uint64_t)m_SP[1];
402  m_SPP[0] = (u256)sha3(bytesConstRef(m_mem.data() + inOff, inSize));
403  }
404  NEXT
405 
406  CASE(LOG0)
407  {
408  ON_OP();
409  if (m_ext->staticCall)
410  throwDisallowedStateChange();
411 
412  logGasMem();
413  updateIOGas();
414 
415  m_ext->log({}, bytesConstRef(m_mem.data() + (uint64_t)m_SP[0], (uint64_t)m_SP[1]));
416  }
417  NEXT
418 
419  CASE(LOG1)
420  {
421  ON_OP();
422  if (m_ext->staticCall)
423  throwDisallowedStateChange();
424 
425  logGasMem();
426  updateIOGas();
427 
428  m_ext->log({m_SP[2]}, bytesConstRef(m_mem.data() + (uint64_t)m_SP[0], (uint64_t)m_SP[1]));
429  }
430  NEXT
431 
432  CASE(LOG2)
433  {
434  ON_OP();
435  if (m_ext->staticCall)
436  throwDisallowedStateChange();
437 
438  logGasMem();
439  updateIOGas();
440 
441  m_ext->log({m_SP[2], m_SP[3]}, bytesConstRef(m_mem.data() + (uint64_t)m_SP[0], (uint64_t)m_SP[1]));
442  }
443  NEXT
444 
445  CASE(LOG3)
446  {
447  ON_OP();
448  if (m_ext->staticCall)
449  throwDisallowedStateChange();
450 
451  logGasMem();
452  updateIOGas();
453 
454  m_ext->log({m_SP[2], m_SP[3], m_SP[4]}, bytesConstRef(m_mem.data() + (uint64_t)m_SP[0], (uint64_t)m_SP[1]));
455  }
456  NEXT
457 
458  CASE(LOG4)
459  {
460  ON_OP();
461  if (m_ext->staticCall)
462  throwDisallowedStateChange();
463 
464  logGasMem();
465  updateIOGas();
466 
467  m_ext->log({m_SP[2], m_SP[3], m_SP[4], m_SP[5]}, bytesConstRef(m_mem.data() + (uint64_t)m_SP[0], (uint64_t)m_SP[1]));
468  }
469  NEXT
470 
471  CASE(EXP)
472  {
473  u256 expon = m_SP[1];
474  m_runGas = toInt63(m_schedule->expGas + m_schedule->expByteGas * (32 - (h256(expon).firstBitSet() / 8)));
475  ON_OP();
476  updateIOGas();
477 
478  u256 base = m_SP[0];
479  m_SPP[0] = exp256(base, expon);
480  }
481  NEXT
482 
483  //
484  // ordinary instructions
485  //
486 
487  CASE(ADD)
488  {
489  ON_OP();
490  updateIOGas();
491 
492  //pops two items and pushes their sum mod 2^256.
493  m_SPP[0] = m_SP[0] + m_SP[1];
494  }
495  NEXT
496 
497  CASE(MUL)
498  {
499  ON_OP();
500  updateIOGas();
501 
502  //pops two items and pushes their product mod 2^256.
503  m_SPP[0] = m_SP[0] * m_SP[1];
504  }
505  NEXT
506 
507  CASE(SUB)
508  {
509  ON_OP();
510  updateIOGas();
511 
512  m_SPP[0] = m_SP[0] - m_SP[1];
513  }
514  NEXT
515 
516  CASE(DIV)
517  {
518  ON_OP();
519  updateIOGas();
520 
521  m_SPP[0] = m_SP[1] ? divWorkaround(m_SP[0], m_SP[1]) : 0;
522  }
523  NEXT
524 
525  CASE(SDIV)
526  {
527  ON_OP();
528  updateIOGas();
529 
530  m_SPP[0] = m_SP[1] ? s2u(divWorkaround(u2s(m_SP[0]), u2s(m_SP[1]))) : 0;
531  --m_SP;
532  }
533  NEXT
534 
535  CASE(MOD)
536  {
537  ON_OP();
538  updateIOGas();
539 
540  m_SPP[0] = m_SP[1] ? modWorkaround(m_SP[0], m_SP[1]) : 0;
541  }
542  NEXT
543 
544  CASE(SMOD)
545  {
546  ON_OP();
547  updateIOGas();
548 
549  m_SPP[0] = m_SP[1] ? s2u(modWorkaround(u2s(m_SP[0]), u2s(m_SP[1]))) : 0;
550  }
551  NEXT
552 
553  CASE(NOT)
554  {
555  ON_OP();
556  updateIOGas();
557 
558  m_SPP[0] = ~m_SP[0];
559  }
560  NEXT
561 
562  CASE(LT)
563  {
564  ON_OP();
565  updateIOGas();
566 
567  m_SPP[0] = m_SP[0] < m_SP[1] ? 1 : 0;
568  }
569  NEXT
570 
571  CASE(GT)
572  {
573  ON_OP();
574  updateIOGas();
575 
576  m_SPP[0] = m_SP[0] > m_SP[1] ? 1 : 0;
577  }
578  NEXT
579 
580  CASE(SLT)
581  {
582  ON_OP();
583  updateIOGas();
584 
585  m_SPP[0] = u2s(m_SP[0]) < u2s(m_SP[1]) ? 1 : 0;
586  }
587  NEXT
588 
589  CASE(SGT)
590  {
591  ON_OP();
592  updateIOGas();
593 
594  m_SPP[0] = u2s(m_SP[0]) > u2s(m_SP[1]) ? 1 : 0;
595  }
596  NEXT
597 
598  CASE(EQ)
599  {
600  ON_OP();
601  updateIOGas();
602 
603  m_SPP[0] = m_SP[0] == m_SP[1] ? 1 : 0;
604  }
605  NEXT
606 
607  CASE(ISZERO)
608  {
609  ON_OP();
610  updateIOGas();
611 
612  m_SPP[0] = m_SP[0] ? 0 : 1;
613  }
614  NEXT
615 
616  CASE(AND)
617  {
618  ON_OP();
619  updateIOGas();
620 
621  m_SPP[0] = m_SP[0] & m_SP[1];
622  }
623  NEXT
624 
625  CASE(OR)
626  {
627  ON_OP();
628  updateIOGas();
629 
630  m_SPP[0] = m_SP[0] | m_SP[1];
631  }
632  NEXT
633 
634  CASE(XOR)
635  {
636  ON_OP();
637  updateIOGas();
638 
639  m_SPP[0] = m_SP[0] ^ m_SP[1];
640  }
641  NEXT
642 
643  CASE(BYTE)
644  {
645  ON_OP();
646  updateIOGas();
647 
648  m_SPP[0] = m_SP[0] < 32 ? (m_SP[1] >> (unsigned)(8 * (31 - m_SP[0]))) & 0xff : 0;
649  }
650  NEXT
651 
652  CASE(SHL)
653  {
654  // Pre-constantinople
655  if (!m_schedule->haveBitwiseShifting)
656  throwBadInstruction();
657 
658  ON_OP();
659  updateIOGas();
660 
661  if (m_SP[0] >= 256)
662  m_SPP[0] = 0;
663  else
664  m_SPP[0] = m_SP[1] << unsigned(m_SP[0]);
665  }
666  NEXT
667 
668  CASE(SHR)
669  {
670  // Pre-constantinople
671  if (!m_schedule->haveBitwiseShifting)
672  throwBadInstruction();
673 
674  ON_OP();
675  updateIOGas();
676 
677  if (m_SP[0] >= 256)
678  m_SPP[0] = 0;
679  else
680  m_SPP[0] = m_SP[1] >> unsigned(m_SP[0]);
681  }
682  NEXT
683 
684  CASE(SAR)
685  {
686  // Pre-constantinople
687  if (!m_schedule->haveBitwiseShifting)
688  throwBadInstruction();
689 
690  ON_OP();
691  updateIOGas();
692 
693  static u256 const hibit = u256(1) << 255;
694  static u256 const allbits =
695  u256("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
696 
697  u256 shiftee = m_SP[1];
698  if (m_SP[0] >= 256)
699  {
700  if (shiftee & hibit)
701  m_SPP[0] = allbits;
702  else
703  m_SPP[0] = 0;
704  }
705  else
706  {
707  unsigned amount = unsigned(m_SP[0]);
708  m_SPP[0] = shiftee >> amount;
709  if (shiftee & hibit)
710  m_SPP[0] |= allbits << (256 - amount);
711  }
712  }
713  NEXT
714 
715  CASE(ADDMOD)
716  {
717  ON_OP();
718  updateIOGas();
719 
720  m_SPP[0] = m_SP[2] ? u256((u512(m_SP[0]) + u512(m_SP[1])) % m_SP[2]) : 0;
721  }
722  NEXT
723 
724  CASE(MULMOD)
725  {
726  ON_OP();
727  updateIOGas();
728 
729  m_SPP[0] = m_SP[2] ? u256((u512(m_SP[0]) * u512(m_SP[1])) % m_SP[2]) : 0;
730  }
731  NEXT
732 
733  CASE(SIGNEXTEND)
734  {
735  ON_OP();
736  updateIOGas();
737 
738  if (m_SP[0] < 31)
739  {
740  unsigned testBit = static_cast<unsigned>(m_SP[0]) * 8 + 7;
741  u256& number = m_SP[1];
742  u256 mask = ((u256(1) << testBit) - 1);
743  if (boost::multiprecision::bit_test(number, testBit))
744  number |= ~mask;
745  else
746  number &= mask;
747  }
748  }
749  NEXT
750 
751 #if EIP_615
752  CASE(JUMPTO)
753  {
754  ON_OP();
755  updateIOGas();
756 
757  m_PC = decodeJumpDest(m_code.data(), m_PC);
758  }
759  CONTINUE
760 
761  CASE(JUMPIF)
762  {
763  ON_OP();
764  updateIOGas();
765 
766  if (m_SP[0])
767  m_PC = decodeJumpDest(m_code.data(), m_PC);
768  else
769  ++m_PC;
770  }
771  CONTINUE
772 
773  CASE(JUMPV)
774  {
775  ON_OP();
776  updateIOGas();
777  m_PC = decodeJumpvDest(m_code.data(), m_PC, byte(m_SP[0]));
778  }
779  CONTINUE
780 
781  CASE(JUMPSUB)
782  {
783  ON_OP();
784  updateIOGas();
785  *m_RP++ = m_PC++;
786  m_PC = decodeJumpDest(m_code.data(), m_PC);
787  }
788  CONTINUE
789 
790  CASE(JUMPSUBV)
791  {
792  ON_OP();
793  updateIOGas();
794  *m_RP++ = m_PC;
795  m_PC = decodeJumpvDest(m_code.data(), m_PC, byte(m_SP[0]));
796  }
797  CONTINUE
798 
799  CASE(RETURNSUB)
800  {
801  ON_OP();
802  updateIOGas();
803 
804  m_PC = *m_RP--;
805  }
806  NEXT
807 
808  CASE(BEGINSUB)
809  {
810  ON_OP();
811  updateIOGas();
812  }
813  NEXT
814 
815 
816  CASE(BEGINDATA)
817  {
818  ON_OP();
819  updateIOGas();
820  }
821  NEXT
822 
823  CASE(GETLOCAL)
824  {
825  ON_OP();
826  updateIOGas();
827  }
828  NEXT
829 
830  CASE(PUTLOCAL)
831  {
832  ON_OP();
833  updateIOGas();
834  }
835  NEXT
836 
837 #else
838  CASE(JUMPTO)
839  CASE(JUMPIF)
840  CASE(JUMPV)
841  CASE(JUMPSUB)
842  CASE(JUMPSUBV)
843  CASE(RETURNSUB)
844  CASE(BEGINSUB)
845  CASE(BEGINDATA)
846  CASE(GETLOCAL)
847  CASE(PUTLOCAL)
848  {
849  throwBadInstruction();
850  }
851  CONTINUE
852 #endif
853 
854 #if EIP_616
855 
856  CASE(XADD)
857  {
858  ON_OP();
859  updateIOGas();
860 
861  xadd(simdType());
862  }
863  CONTINUE
864 
865  CASE(XMUL)
866  {
867  ON_OP();
868  updateIOGas();
869 
870  xmul(simdType());
871  }
872  CONTINUE
873 
874  CASE(XSUB)
875  {
876  ON_OP();
877  updateIOGas();
878 
879  xsub(simdType());
880  }
881  CONTINUE
882 
883  CASE(XDIV)
884  {
885  ON_OP();
886  updateIOGas();
887 
888  xdiv(simdType());
889  }
890  CONTINUE
891 
892  CASE(XSDIV)
893  {
894  ON_OP();
895  updateIOGas();
896 
897  xsdiv(simdType());
898  }
899  CONTINUE
900 
901  CASE(XMOD)
902  {
903  ON_OP();
904  updateIOGas();
905 
906  xmod(simdType());
907  }
908  CONTINUE
909 
910  CASE(XSMOD)
911  {
912  ON_OP();
913  updateIOGas();
914 
915  xsmod(simdType());
916  }
917  CONTINUE
918 
919  CASE(XLT)
920  {
921  ON_OP();
922  updateIOGas();
923 
924  xlt(simdType());
925  }
926  CONTINUE
927 
928  CASE(XGT)
929  {
930  ON_OP();
931  updateIOGas();
932 
933  xgt(simdType());
934  }
935  CONTINUE
936 
937  CASE(XSLT)
938  {
939  ON_OP();
940  updateIOGas();
941 
942  xslt(simdType());
943  }
944  CONTINUE
945 
946  CASE(XSGT)
947  {
948  ON_OP();
949  updateIOGas();
950 
951  xsgt(simdType());
952  }
953  CONTINUE
954 
955  CASE(XEQ)
956  {
957  ON_OP();
958  updateIOGas();
959 
960  xeq(simdType());
961  }
962  CONTINUE
963 
964  CASE(XISZERO)
965  {
966  ON_OP();
967  updateIOGas();
968 
969  xzero(simdType());
970  }
971  CONTINUE
972 
973  CASE(XAND)
974  {
975  ON_OP();
976  updateIOGas();
977 
978  xand(simdType());
979  }
980  CONTINUE
981 
982  CASE(XOOR)
983  {
984  ON_OP();
985  updateIOGas();
986 
987  xoor(simdType());
988  }
989  CONTINUE
990 
991  CASE(XXOR)
992  {
993  ON_OP();
994  updateIOGas();
995 
996  xxor(simdType());
997  }
998  CONTINUE
999 
1000  CASE(XNOT)
1001  {
1002  ON_OP();
1003  updateIOGas();
1004 
1005  xnot(simdType());
1006  }
1007  CONTINUE
1008 
1009  CASE(XSHL)
1010  {
1011  ON_OP();
1012  updateIOGas();
1013 
1014  xshl(simdType());
1015  }
1016  CONTINUE
1017 
1018  CASE(XSHR)
1019  {
1020  ON_OP();
1021  updateIOGas();
1022 
1023  xshr(simdType());
1024  }
1025  CONTINUE
1026 
1027  CASE(XSAR)
1028  {
1029  ON_OP();
1030  updateIOGas();
1031 
1032  xsar(simdType());
1033  }
1034  CONTINUE
1035 
1036  CASE(XROL)
1037  {
1038  ON_OP();
1039  updateIOGas();
1040 
1041  xrol(simdType());
1042  }
1043  CONTINUE
1044 
1045  CASE(XROR)
1046  {
1047  ON_OP();
1048  updateIOGas();
1049 
1050  xror(simdType());
1051  }
1052  CONTINUE
1053 
1054  CASE(XMLOAD)
1055  {
1056  updateMem(toInt63(m_SP[0]) + 32);
1057  ON_OP();
1058  updateIOGas();
1059 
1060  xmload(simdType());
1061  }
1062  CONTINUE
1063 
1064  CASE(XMSTORE)
1065  {
1066  updateMem(toInt63(m_SP[0]) + 32);
1067  ON_OP();
1068  updateIOGas();
1069 
1070  xmstore(simdType());
1071  }
1072  CONTINUE
1073 
1074  CASE(XSLOAD)
1075  {
1076  m_runGas = toInt63(m_schedule->sloadGas);
1077  ON_OP();
1078  updateIOGas();
1079 
1080  xsload(simdType());
1081  }
1082  CONTINUE
1083 
1084  CASE(XSSTORE)
1085  {
1086  if (m_ext->staticCall)
1087  throwDisallowedStateChange();
1088 
1089  updateSSGas();
1090  ON_OP();
1091  updateIOGas();
1092 
1093  xsstore(simdType());
1094  }
1095  CONTINUE
1096 
1097  CASE(XVTOWIDE)
1098  {
1099  ON_OP();
1100  updateIOGas();
1101 
1102  xvtowide(simdType());
1103  }
1104  CONTINUE
1105 
1106  CASE(XWIDETOV)
1107  {
1108  ON_OP();
1109  updateIOGas();
1110 
1111  xwidetov(simdType());
1112  }
1113  CONTINUE
1114 
1115  CASE(XPUSH)
1116  {
1117  ON_OP();
1118  updateIOGas();
1119 
1120  xpush(simdType());
1121  }
1122  CONTINUE
1123 
1124  CASE(XPUT)
1125  {
1126  ON_OP();
1127  updateIOGas();
1128 
1129  uint8_t b = ++m_PC;
1130  uint8_t c = ++m_PC;
1131  xput(m_code[b], m_code[c]);
1132  ++m_PC;
1133  }
1134  CONTINUE
1135 
1136  CASE(XGET)
1137  {
1138  ON_OP();
1139  updateIOGas();
1140 
1141  uint8_t b = ++m_PC;
1142  uint8_t c = ++m_PC;
1143  xget(m_code[b], m_code[c]);
1144  ++m_PC;
1145  }
1146  CONTINUE
1147 
1148  CASE(XSWIZZLE)
1149  {
1150  ON_OP();
1151  updateIOGas();
1152 
1153  xswizzle(simdType());
1154  }
1155  CONTINUE
1156 
1157  CASE(XSHUFFLE)
1158  {
1159  ON_OP();
1160  updateIOGas();
1161 
1162  xshuffle(simdType());
1163  }
1164  CONTINUE
1165 #else
1166  CASE(XADD)
1167  CASE(XMUL)
1168  CASE(XSUB)
1169  CASE(XDIV)
1170  CASE(XSDIV)
1171  CASE(XMOD)
1172  CASE(XSMOD)
1173  CASE(XLT)
1174  CASE(XGT)
1175  CASE(XSLT)
1176  CASE(XSGT)
1177  CASE(XEQ)
1178  CASE(XISZERO)
1179  CASE(XAND)
1180  CASE(XOOR)
1181  CASE(XXOR)
1182  CASE(XNOT)
1183  CASE(XSHL)
1184  CASE(XSHR)
1185  CASE(XSAR)
1186  CASE(XROL)
1187  CASE(XROR)
1188  CASE(XMLOAD)
1189  CASE(XMSTORE)
1190  CASE(XSLOAD)
1191  CASE(XSSTORE)
1192  CASE(XVTOWIDE)
1193  CASE(XWIDETOV)
1194  CASE(XPUSH)
1195  CASE(XPUT)
1196  CASE(XGET)
1197  CASE(XSWIZZLE)
1198  CASE(XSHUFFLE)
1199  {
1200  throwBadInstruction();
1201  }
1202  CONTINUE
1203 #endif
1204 
1205  CASE(ADDRESS)
1206  {
1207  ON_OP();
1208  updateIOGas();
1209 
1210  m_SPP[0] = fromAddress(m_ext->myAddress);
1211  }
1212  NEXT
1213 
1214  CASE(ORIGIN)
1215  {
1216  ON_OP();
1217  updateIOGas();
1218 
1219  m_SPP[0] = fromAddress(m_ext->origin);
1220  }
1221  NEXT
1222 
1223  CASE(BALANCE)
1224  {
1225  m_runGas = toInt63(m_schedule->balanceGas);
1226  ON_OP();
1227  updateIOGas();
1228 
1229  m_SPP[0] = m_ext->balance(asAddress(m_SP[0]));
1230  }
1231  NEXT
1232 
1233 
1234  CASE(CALLER)
1235  {
1236  ON_OP();
1237  updateIOGas();
1238 
1239  m_SPP[0] = fromAddress(m_ext->caller);
1240  }
1241  NEXT
1242 
1243  CASE(CALLVALUE)
1244  {
1245  ON_OP();
1246  updateIOGas();
1247 
1248  m_SPP[0] = m_ext->value;
1249  }
1250  NEXT
1251 
1252 
1253  CASE(CALLDATALOAD)
1254  {
1255  ON_OP();
1256  updateIOGas();
1257 
1258  if (u512(m_SP[0]) + 31 < m_ext->data.size())
1259  m_SP[0] = (u256)*(h256 const*)(m_ext->data.data() + (size_t)m_SP[0]);
1260  else if (m_SP[0] >= m_ext->data.size())
1261  m_SP[0] = u256(0);
1262  else
1263  { h256 r;
1264  for (uint64_t i = (uint64_t)m_SP[0], e = (uint64_t)m_SP[0] + (uint64_t)32, j = 0; i < e; ++i, ++j)
1265  r[j] = i < m_ext->data.size() ? m_ext->data[i] : 0;
1266  m_SP[0] = (u256)r;
1267  };
1268  }
1269  NEXT
1270 
1271 
1272  CASE(CALLDATASIZE)
1273  {
1274  ON_OP();
1275  updateIOGas();
1276 
1277  m_SPP[0] = m_ext->data.size();
1278  }
1279  NEXT
1280 
1281  CASE(RETURNDATASIZE)
1282  {
1283  if (!m_schedule->haveReturnData)
1284  throwBadInstruction();
1285 
1286  ON_OP();
1287  updateIOGas();
1288 
1289  m_SPP[0] = m_returnData.size();
1290  }
1291  NEXT
1292 
1293  CASE(CODESIZE)
1294  {
1295  ON_OP();
1296  updateIOGas();
1297 
1298  m_SPP[0] = m_ext->code.size();
1299  }
1300  NEXT
1301 
1302  CASE(EXTCODESIZE)
1303  {
1304  m_runGas = toInt63(m_schedule->extcodesizeGas);
1305  ON_OP();
1306  updateIOGas();
1307 
1308  m_SPP[0] = m_ext->codeSizeAt(asAddress(m_SP[0]));
1309  }
1310  NEXT
1311 
1312  CASE(CALLDATACOPY)
1313  {
1314  ON_OP();
1315  m_copyMemSize = toInt63(m_SP[2]);
1316  updateMem(memNeed(m_SP[0], m_SP[2]));
1317  updateIOGas();
1318 
1319  copyDataToMemory(m_ext->data, m_SP);
1320  }
1321  NEXT
1322 
1323  CASE(RETURNDATACOPY)
1324  {
1325  ON_OP();
1326  if (!m_schedule->haveReturnData)
1327  throwBadInstruction();
1328  bigint const endOfAccess = bigint(m_SP[1]) + bigint(m_SP[2]);
1329  if (m_returnData.size() < endOfAccess)
1330  throwBufferOverrun(endOfAccess);
1331 
1332  m_copyMemSize = toInt63(m_SP[2]);
1333  updateMem(memNeed(m_SP[0], m_SP[2]));
1334  updateIOGas();
1335 
1336  copyDataToMemory(&m_returnData, m_SP);
1337  }
1338  NEXT
1339 
1340  CASE(EXTCODEHASH)
1341  {
1342  ON_OP();
1343  if (!m_schedule->haveExtcodehash)
1344  throwBadInstruction();
1345 
1346  m_runGas = toInt63(m_schedule->extcodehashGas);
1347  updateIOGas();
1348 
1349  m_SPP[0] = u256{m_ext->codeHashAt(asAddress(m_SP[0]))};
1350  }
1351  NEXT
1352 
1353  CASE(CODECOPY)
1354  {
1355  ON_OP();
1356  m_copyMemSize = toInt63(m_SP[2]);
1357  updateMem(memNeed(m_SP[0], m_SP[2]));
1358  updateIOGas();
1359 
1360  copyDataToMemory(&m_ext->code, m_SP);
1361  }
1362  NEXT
1363 
1364  CASE(EXTCODECOPY)
1365  {
1366  ON_OP();
1367  m_runGas = toInt63(m_schedule->extcodecopyGas);
1368  m_copyMemSize = toInt63(m_SP[3]);
1369  updateMem(memNeed(m_SP[1], m_SP[3]));
1370  updateIOGas();
1371 
1372  Address a = asAddress(m_SP[0]);
1373  copyDataToMemory(&m_ext->codeAt(a), m_SP + 1);
1374  }
1375  NEXT
1376 
1377 
1378  CASE(GASPRICE)
1379  {
1380  ON_OP();
1381  updateIOGas();
1382 
1383  m_SPP[0] = m_ext->gasPrice;
1384  }
1385  NEXT
1386 
1387  CASE(BLOCKHASH)
1388  {
1389  ON_OP();
1390  m_runGas = toInt63(m_schedule->blockhashGas);
1391  updateIOGas();
1392 
1393  m_SPP[0] = (u256)m_ext->blockHash(m_SP[0]);
1394  }
1395  NEXT
1396 
1397  CASE(COINBASE)
1398  {
1399  ON_OP();
1400  updateIOGas();
1401 
1402  m_SPP[0] = (u160)m_ext->envInfo().author();
1403  }
1404  NEXT
1405 
1406  CASE(TIMESTAMP)
1407  {
1408  ON_OP();
1409  updateIOGas();
1410 
1411  m_SPP[0] = m_ext->envInfo().timestamp();
1412  }
1413  NEXT
1414 
1415  CASE(NUMBER)
1416  {
1417  ON_OP();
1418  updateIOGas();
1419 
1420  m_SPP[0] = m_ext->envInfo().number();
1421  }
1422  NEXT
1423 
1424  CASE(DIFFICULTY)
1425  {
1426  ON_OP();
1427  updateIOGas();
1428 
1429  m_SPP[0] = m_ext->envInfo().difficulty();
1430  }
1431  NEXT
1432 
1433  CASE(GASLIMIT)
1434  {
1435  ON_OP();
1436  updateIOGas();
1437 
1438  m_SPP[0] = m_ext->envInfo().gasLimit();
1439  }
1440  NEXT
1441 
1442  CASE(POP)
1443  {
1444  ON_OP();
1445  updateIOGas();
1446 
1447  --m_SP;
1448  }
1449  NEXT
1450 
1451  CASE(PUSHC)
1452  {
1453 #if EVM_USE_CONSTANT_POOL
1454  ON_OP();
1455  updateIOGas();
1456 
1457  // get val at two-byte offset into const pool and advance pc by one-byte remainder
1458  TRACE_OP(2, m_PC, m_OP);
1459  unsigned off;
1460  ++m_PC;
1461  off = m_code[m_PC++] << 8;
1462  off |= m_code[m_PC++];
1463  m_PC += m_code[m_PC];
1464  m_SPP[0] = m_pool[off];
1465  TRACE_VAL(2, "Retrieved pooled const", m_SPP[0]);
1466 #else
1467  throwBadInstruction();
1468 #endif
1469  }
1470  CONTINUE
1471 
1472  CASE(PUSH1)
1473  {
1474  ON_OP();
1475  updateIOGas();
1476  ++m_PC;
1477  m_SPP[0] = m_code[m_PC];
1478  ++m_PC;
1479  }
1480  CONTINUE
1481 
1482  CASE(PUSH2)
1483  CASE(PUSH3)
1484  CASE(PUSH4)
1485  CASE(PUSH5)
1486  CASE(PUSH6)
1487  CASE(PUSH7)
1488  CASE(PUSH8)
1489  CASE(PUSH9)
1490  CASE(PUSH10)
1491  CASE(PUSH11)
1492  CASE(PUSH12)
1493  CASE(PUSH13)
1494  CASE(PUSH14)
1495  CASE(PUSH15)
1496  CASE(PUSH16)
1497  CASE(PUSH17)
1498  CASE(PUSH18)
1499  CASE(PUSH19)
1500  CASE(PUSH20)
1501  CASE(PUSH21)
1502  CASE(PUSH22)
1503  CASE(PUSH23)
1504  CASE(PUSH24)
1505  CASE(PUSH25)
1506  CASE(PUSH26)
1507  CASE(PUSH27)
1508  CASE(PUSH28)
1509  CASE(PUSH29)
1510  CASE(PUSH30)
1511  CASE(PUSH31)
1512  CASE(PUSH32)
1513  {
1514  ON_OP();
1515  updateIOGas();
1516 
1517  int numBytes = (int)m_OP - (int)Instruction::PUSH1 + 1;
1518  m_SPP[0] = 0;
1519  // Construct a number out of PUSH bytes.
1520  // This requires the code has been copied and extended by 32 zero
1521  // bytes to handle "out of code" push data here.
1522  for (++m_PC; numBytes--; ++m_PC)
1523  m_SPP[0] = (m_SPP[0] << 8) | m_code[m_PC];
1524  }
1525  CONTINUE
1526 
1527  CASE(JUMP)
1528  {
1529  ON_OP();
1530  updateIOGas();
1531  m_PC = verifyJumpDest(m_SP[0]);
1532  }
1533  CONTINUE
1534 
1535  CASE(JUMPI)
1536  {
1537  ON_OP();
1538  updateIOGas();
1539  if (m_SP[1])
1540  m_PC = verifyJumpDest(m_SP[0]);
1541  else
1542  ++m_PC;
1543  }
1544  CONTINUE
1545 
1546  CASE(JUMPC)
1547  {
1548 #if EVM_REPLACE_CONST_JUMP
1549  ON_OP();
1550  updateIOGas();
1551 
1552  m_PC = uint64_t(m_SP[0]);
1553 #else
1554  throwBadInstruction();
1555 #endif
1556  }
1557  CONTINUE
1558 
1559  CASE(JUMPCI)
1560  {
1561 #if EVM_REPLACE_CONST_JUMP
1562  ON_OP();
1563  updateIOGas();
1564 
1565  if (m_SP[1])
1566  m_PC = uint64_t(m_SP[0]);
1567  else
1568  ++m_PC;
1569 #else
1570  throwBadInstruction();
1571 #endif
1572  }
1573  CONTINUE
1574 
1575  CASE(DUP1)
1576  CASE(DUP2)
1577  CASE(DUP3)
1578  CASE(DUP4)
1579  CASE(DUP5)
1580  CASE(DUP6)
1581  CASE(DUP7)
1582  CASE(DUP8)
1583  CASE(DUP9)
1584  CASE(DUP10)
1585  CASE(DUP11)
1586  CASE(DUP12)
1587  CASE(DUP13)
1588  CASE(DUP14)
1589  CASE(DUP15)
1590  CASE(DUP16)
1591  {
1592  ON_OP();
1593  updateIOGas();
1594 
1595  unsigned n = (unsigned)m_OP - (unsigned)Instruction::DUP1;
1596  *(uint64_t*)m_SPP = *(uint64_t*)(m_SP + n);
1597 
1598  // the stack slot being copied into may no longer hold a u256
1599  // so we construct a new one in the memory, rather than assign
1600  new(m_SPP) u256(m_SP[n]);
1601  }
1602  NEXT
1603 
1604 
1605  CASE(SWAP1)
1606  CASE(SWAP2)
1607  CASE(SWAP3)
1608  CASE(SWAP4)
1609  CASE(SWAP5)
1610  CASE(SWAP6)
1611  CASE(SWAP7)
1612  CASE(SWAP8)
1613  CASE(SWAP9)
1614  CASE(SWAP10)
1615  CASE(SWAP11)
1616  CASE(SWAP12)
1617  CASE(SWAP13)
1618  CASE(SWAP14)
1619  CASE(SWAP15)
1620  CASE(SWAP16)
1621  {
1622  ON_OP();
1623  updateIOGas();
1624 
1625  unsigned n = (unsigned)m_OP - (unsigned)Instruction::SWAP1 + 1;
1626  std::swap(m_SP[0], m_SP[n]);
1627  }
1628  NEXT
1629 
1630 
1631  CASE(SLOAD)
1632  {
1633  m_runGas = toInt63(m_schedule->sloadGas);
1634  ON_OP();
1635  updateIOGas();
1636 
1637  m_SPP[0] = m_ext->store(m_SP[0]);
1638  }
1639  NEXT
1640 
1641  CASE(SSTORE)
1642  {
1643  ON_OP();
1644  if (m_ext->staticCall)
1645  throwDisallowedStateChange();
1646 
1647  updateSSGas();
1648  updateIOGas();
1649 
1650  m_ext->setStore(m_SP[0], m_SP[1]);
1651  }
1652  NEXT
1653 
1654  CASE(PC)
1655  {
1656  ON_OP();
1657  updateIOGas();
1658 
1659  m_SPP[0] = m_PC;
1660  }
1661  NEXT
1662 
1663  CASE(MSIZE)
1664  {
1665  ON_OP();
1666  updateIOGas();
1667 
1668  m_SPP[0] = m_mem.size();
1669  }
1670  NEXT
1671 
1672  CASE(GAS)
1673  {
1674  ON_OP();
1675  updateIOGas();
1676 
1677  m_SPP[0] = m_io_gas;
1678  }
1679  NEXT
1680 
1681  CASE(JUMPDEST)
1682  {
1683  m_runGas = 1;
1684  ON_OP();
1685  updateIOGas();
1686  }
1687  NEXT
1688 
1689  CASE(INVALID)
1690  DEFAULT
1691  {
1692  throwBadInstruction();
1693  }
1694  }
1695  WHILE_CASES
1696 }
dev::eth::OnOpFunc
std::function< void(uint64_t, uint64_t, Instruction, bigint, bigint, bigint, VMFace const *, ExtVMFace const *)> OnOpFunc
Definition: ExtVMFace.h:115
TRACE_OP
#define TRACE_OP(level, pc, op)
Definition: LegacyVMConfig.h:112
dev::sha3
bool sha3(bytesConstRef _input, bytesRef o_output) noexcept
Definition: SHA3.cpp:28
std::swap
void swap(dev::eth::Watch &_a, dev::eth::Watch &_b)
Definition: Interface.h:282
dev::h256
FixedHash< 32 > h256
Definition: FixedHash.h:356
ON_OP
#define ON_OP()
Definition: LegacyVMConfig.h:115
dev::u512
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 512, 512, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void > > u512
Definition: Common.h:125
dev::eth::owning_bytes_ref
Definition: ExtVMFace.h:58
dev::eth
Definition: BasicAuthority.h:32
dev::eth::ExtVMFace
Interface and null implementation of the class for specifying VM externalities.
Definition: ExtVMFace.h:204
dev::FixedHash< 20 >
dev::s2u
u256 s2u(s256 _u)
Definition: Common.h:161
dev::eth::InstructionMetric::ret
int ret
Definition: Instruction.h:260
dev::u2s
s256 u2s(u256 _u)
Interprets _u as a two's complement signed number and returns the resulting s256.
Definition: Common.h:151
dev::bytesConstRef
vector_ref< byte const > bytesConstRef
Definition: Common.h:74
dev::u160
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 160, 160, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void > > u160
Definition: Common.h:123
dev::eth::InstructionMetric::gasPriceTier
Tier gasPriceTier
Definition: Instruction.h:258
divWorkaround
S divWorkaround(S const &_a, S const &_b)
Definition: LegacyVM.cpp:29
dev::eth::fromAddress
u256 fromAddress(Address _a)
Definition: VMFace.h:84
dev::eth::InstructionMetric::args
int args
Definition: Instruction.h:259
dev::eth::Instruction
Instruction
Virtual machine bytecode instruction.
Definition: Instruction.h:29
dev::bigint
boost::multiprecision::number< boost::multiprecision::cpp_int_backend<> > bigint
Definition: Common.h:118
dev::eth::ExtVMFace::evmSchedule
virtual EVMSchedule const & evmSchedule() const
Return the EVM gas-price schedule for this execution context.
Definition: ExtVMFace.h:259
dev::FixedHash::size
@ size
Definition: FixedHash.h:53
LegacyVM.h
std
Definition: FixedHash.h:393
dev::eth::asAddress
Address asAddress(u256 _item)
Helpers:
Definition: VMFace.h:79
dev::u256
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void > > u256
Definition: Common.h:121
dev
Definition: Address.cpp:21
TRACE_VAL
#define TRACE_VAL(level, name, val)
Definition: LegacyVMConfig.h:111
dev::eth::InstructionMetric
Definition: Instruction.h:257
modWorkaround
S modWorkaround(S const &_a, S const &_b)
Definition: LegacyVM.cpp:34
dev::s512
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 512, 512, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, void > > s512
Definition: Common.h:126