MCPcopy Create free account
hub / github.com/Jesserc/gevm / Gas

Method Gas

gevm/opcodes.go:522–610  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

520}
521
522func (op Opcode) Gas() uint64 {
523 switch op {
524 case STOP:
525 return 0
526 case ADD, SUB, LT, GT, SLT, SGT, EQ, ISZERO, AND, OR, XOR, NOT, BYTE, SHL, SHR, SAR:
527 return 3
528 case MUL, DIV, SDIV, MOD, SMOD, SIGNEXTEND:
529 return 5
530 case ADDMOD, MULMOD:
531 return 8
532 case EXP:
533 return 10
534 case KECCAK256: // If supported, the actual gas cost will be stored in the dgMap (dynamic gas map) in evm.go
535 return 30
536 case ADDRESS, ORIGIN, CALLER, CALLVALUE, CALLDATASIZE, CODESIZE, GASPRICE, RETURNDATASIZE, EXTCODESIZE, BLOCKHASH, COINBASE, TIMESTAMP, NUMBER, PREVRANDAO, GASLIMIT, CHAINID, SELFBALANCE, BASEFEE:
537 return 2
538 case BALANCE:
539 return 2600
540 case CALLDATALOAD, CALLDATACOPY, CODECOPY, RETURNDATACOPY, EXTCODECOPY:
541 return 3
542 case EXTCODEHASH:
543 return 400
544 case POP:
545 return 2
546 case MLOAD, MSTORE: // If supported, the actual gas cost will be stored in the dgMap (dynamic gas map) in evm.go
547 return 3
548 case MSTORE8:
549 return 3 // If supported, the actual gas cost will be stored in the dgMap (dynamic gas map) in evm.go
550 case SLOAD:
551 return 800
552 case SSTORE:
553 return 21000 // If supported, the actual gas cost will be stored in the dgMap (dynamic gas map) in evm.go
554 case TLOAD:
555 return 100
556 case TSTORE:
557 return 100
558 case JUMP:
559 return 8
560 case JUMPI:
561 return 10
562 case PC, MSIZE, GAS:
563 return 2
564 case JUMPDEST:
565 return 1
566 case PUSH1, PUSH2, PUSH3, PUSH4, PUSH5, PUSH6, PUSH7, PUSH8, PUSH9, PUSH10, PUSH11, PUSH12, PUSH13, PUSH14, PUSH15, PUSH16, PUSH17, PUSH18, PUSH19, PUSH20, PUSH21, PUSH22, PUSH23, PUSH24, PUSH25, PUSH26, PUSH27, PUSH28, PUSH29, PUSH30, PUSH31, PUSH32:
567 return 3
568 case DUP1, DUP2, DUP3, DUP4, DUP5, DUP6, DUP7, DUP8, DUP9, DUP10, DUP11, DUP12, DUP13, DUP14, DUP15, DUP16:
569 return 3
570 case SWAP1, SWAP2, SWAP3, SWAP4, SWAP5, SWAP6, SWAP7, SWAP8, SWAP9, SWAP10, SWAP11, SWAP12, SWAP13, SWAP14, SWAP15, SWAP16:
571 return 3
572 case LOG0:
573 return 375
574 case LOG1:
575 return 750
576 case LOG2:
577 return 1125
578 case LOG3:
579 return 1500

Callers 2

TestOpcodeGasFunction · 0.80
RunMethod · 0.80

Calls

no outgoing calls

Tested by 1

TestOpcodeGasFunction · 0.64