Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
whqwjb
go-ethereum
提交
08f27428
G
go-ethereum
项目概览
whqwjb
/
go-ethereum
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
go-ethereum
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
08f27428
编写于
8月 25, 2017
作者:
P
Péter Szilágyi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
core, tests: implement Metropolis EIP 684
上级
27a5622e
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
18 addition
and
12 deletion
+18
-12
core/vm/errors.go
core/vm/errors.go
+6
-5
core/vm/evm.go
core/vm/evm.go
+11
-3
tests/state_test.go
tests/state_test.go
+0
-2
tests/testdata
tests/testdata
+1
-1
tests/vm_test.go
tests/vm_test.go
+0
-1
未找到文件。
core/vm/errors.go
浏览文件 @
08f27428
...
...
@@ -19,9 +19,10 @@ package vm
import
"errors"
var
(
ErrOutOfGas
=
errors
.
New
(
"out of gas"
)
ErrCodeStoreOutOfGas
=
errors
.
New
(
"contract creation code storage out of gas"
)
ErrDepth
=
errors
.
New
(
"max call depth exceeded"
)
ErrTraceLimitReached
=
errors
.
New
(
"the number of logs reached the specified limit"
)
ErrInsufficientBalance
=
errors
.
New
(
"insufficient balance for transfer"
)
ErrOutOfGas
=
errors
.
New
(
"out of gas"
)
ErrCodeStoreOutOfGas
=
errors
.
New
(
"contract creation code storage out of gas"
)
ErrDepth
=
errors
.
New
(
"max call depth exceeded"
)
ErrTraceLimitReached
=
errors
.
New
(
"the number of logs reached the specified limit"
)
ErrInsufficientBalance
=
errors
.
New
(
"insufficient balance for transfer"
)
ErrContractAddressCollision
=
errors
.
New
(
"contract address collision"
)
)
core/vm/evm.go
浏览文件 @
08f27428
...
...
@@ -25,6 +25,10 @@ import (
"github.com/ethereum/go-ethereum/params"
)
// emptyCodeHash is used by create to ensure deployment is disallowed to already
// deployed contract addresses (relevant after the account abstraction).
var
emptyCodeHash
=
crypto
.
Keccak256Hash
(
nil
)
type
(
CanTransferFunc
func
(
StateDB
,
common
.
Address
,
*
big
.
Int
)
bool
TransferFunc
func
(
StateDB
,
common
.
Address
,
common
.
Address
,
*
big
.
Int
)
...
...
@@ -307,13 +311,17 @@ func (evm *EVM) Create(caller ContractRef, code []byte, gas uint64, value *big.I
if
!
evm
.
CanTransfer
(
evm
.
StateDB
,
caller
.
Address
(),
value
)
{
return
nil
,
common
.
Address
{},
gas
,
ErrInsufficientBalance
}
// Create a new account on the state
// Ensure there's no existing contract already at the designated address
nonce
:=
evm
.
StateDB
.
GetNonce
(
caller
.
Address
())
evm
.
StateDB
.
SetNonce
(
caller
.
Address
(),
nonce
+
1
)
snapshot
:=
evm
.
StateDB
.
Snapshot
()
contractAddr
=
crypto
.
CreateAddress
(
caller
.
Address
(),
nonce
)
contractHash
:=
evm
.
StateDB
.
GetCodeHash
(
contractAddr
)
if
evm
.
StateDB
.
GetNonce
(
contractAddr
)
!=
0
||
(
contractHash
!=
(
common
.
Hash
{})
&&
contractHash
!=
emptyCodeHash
)
{
return
nil
,
common
.
Address
{},
0
,
ErrContractAddressCollision
}
// Create a new account on the state
snapshot
:=
evm
.
StateDB
.
Snapshot
()
evm
.
StateDB
.
CreateAccount
(
contractAddr
)
if
evm
.
ChainConfig
()
.
IsEIP158
(
evm
.
BlockNumber
)
{
evm
.
StateDB
.
SetNonce
(
contractAddr
,
1
)
...
...
tests/state_test.go
浏览文件 @
08f27428
...
...
@@ -37,10 +37,8 @@ func TestState(t *testing.T) {
// Expected failures:
st
.
fails
(
`^stCodeSizeLimit/codesizeOOGInvalidSize\.json/(Frontier|Homestead|EIP150)`
,
"code size limit implementation is not conditional on fork"
)
st
.
fails
(
`^stRevertTest/RevertDepthCreateAddressCollision\.json/EIP15[08]/[67]`
,
"bug in test"
)
st
.
fails
(
`^stRevertTest/RevertPrecompiledTouch\.json/EIP158`
,
"bug in test"
)
st
.
fails
(
`^stRevertTest/RevertPrefoundEmptyOOG\.json/EIP158`
,
"bug in test"
)
st
.
fails
(
`^stRevertTest/RevertDepthCreateAddressCollision\.json/Byzantium/[67]`
,
"bug in test"
)
st
.
fails
(
`^stRevertTest/RevertPrecompiledTouch\.json/Byzantium`
,
"bug in test"
)
st
.
fails
(
`^stRevertTest/RevertPrefoundEmptyOOG\.json/Byzantium`
,
"bug in test"
)
...
...
testdata
@
1d30b479
比较
cd2c3f1b
...
1d30b479
Subproject commit
cd2c3f1b3acb98c0d1501b06a4a54629d8794d79
Subproject commit
1d30b4795664f64b1b157971754e14a10cfd9115
tests/vm_test.go
浏览文件 @
08f27428
...
...
@@ -27,7 +27,6 @@ func TestVM(t *testing.T) {
vmt
:=
new
(
testMatcher
)
vmt
.
fails
(
"^vmSystemOperationsTest.json/createNameRegistrator$"
,
"fails without parallel execution"
)
vmt
.
skipLoad
(
`^vmPerformanceTest.json`
)
// log format broken
vmt
.
skipLoad
(
`^vmInputLimits(Light)?.json`
)
// log format broken
vmt
.
skipShortMode
(
"^vmPerformanceTest.json"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录