diff options
author | gary rong <garyrong0905@gmail.com> | 2018-07-24 22:22:03 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2018-07-24 22:22:03 +0800 |
commit | cab1cff11cbcd4ff60f1a149deb71ec87413b487 (patch) | |
tree | 2e7c89b0a541a03e23294d4b444892a9420cbc9c /core/vm/gas_table.go | |
parent | 2909f6d7a2ceb5b1cdeb4cc3966531018a0b8334 (diff) | |
download | go-tangerine-cab1cff11cbcd4ff60f1a149deb71ec87413b487.tar.gz go-tangerine-cab1cff11cbcd4ff60f1a149deb71ec87413b487.tar.zst go-tangerine-cab1cff11cbcd4ff60f1a149deb71ec87413b487.zip |
core, crypto, params: implement CREATE2 evm instrction (#17196)
* core, crypto, params: implement CREATE2 evm instrction
* core/vm: add opcode to string mapping
* core: remove past fork checking
* core, crypto: use option2 to generate new address
Diffstat (limited to 'core/vm/gas_table.go')
-rw-r--r-- | core/vm/gas_table.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/core/vm/gas_table.go b/core/vm/gas_table.go index 0764c67a4..e130406ec 100644 --- a/core/vm/gas_table.go +++ b/core/vm/gas_table.go @@ -289,6 +289,18 @@ func gasCreate(gt params.GasTable, evm *EVM, contract *Contract, stack *Stack, m return gas, nil } +func gasCreate2(gt params.GasTable, evm *EVM, contract *Contract, stack *Stack, mem *Memory, memorySize uint64) (uint64, error) { + var overflow bool + gas, err := memoryGasCost(mem, memorySize) + if err != nil { + return 0, err + } + if gas, overflow = math.SafeAdd(gas, params.Create2Gas); overflow { + return 0, errGasUintOverflow + } + return gas, nil +} + func gasBalance(gt params.GasTable, evm *EVM, contract *Contract, stack *Stack, mem *Memory, memorySize uint64) (uint64, error) { return gt.Balance, nil } |