Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
383d276c
Y
YTBP
项目概览
YottaChain
/
YTBP
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
YTBP
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
383d276c
编写于
8月 11, 2018
作者:
K
Kevin Heifner
提交者:
GitHub
8月 11, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5160 from EOSIO/no_cleos_wast
Remove WAST support from cleos set code/contract
上级
9a407321
52e066f2
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
35 addition
and
49 deletion
+35
-49
programs/cleos/main.cpp
programs/cleos/main.cpp
+13
-27
testnet.template
testnet.template
+1
-1
tests/Cluster.py
tests/Cluster.py
+6
-6
tests/Node.py
tests/Node.py
+2
-2
tests/consensus-validation-malicious-producers.py
tests/consensus-validation-malicious-producers.py
+2
-2
tests/nodeos_run_test.py
tests/nodeos_run_test.py
+6
-6
tests/nodeos_under_min_avail_ram.py
tests/nodeos_under_min_avail_ram.py
+2
-2
tests/p2p_network_test.py
tests/p2p_network_test.py
+3
-3
未找到文件。
programs/cleos/main.cpp
浏览文件 @
383d276c
...
...
@@ -114,7 +114,6 @@ Options:
#include <Inline/BasicTypes.h>
#include <IR/Module.h>
#include <IR/Validate.h>
#include <WAST/WAST.h>
#include <WASM/WASM.h>
#include <Runtime/Runtime.h>
...
...
@@ -2133,55 +2132,42 @@ int main( int argc, char** argv ) {
// set contract subcommand
string
account
;
string
contractPath
;
string
was
t
Path
;
string
was
m
Path
;
string
abiPath
;
bool
shouldSend
=
true
;
auto
codeSubcommand
=
setSubcommand
->
add_subcommand
(
"code"
,
localized
(
"Create or update the code on an account"
));
codeSubcommand
->
add_option
(
"account"
,
account
,
localized
(
"The account to set code for"
))
->
required
();
codeSubcommand
->
add_option
(
"code-file"
,
was
tPath
,
localized
(
"The fullpath containing the contract WAST or
WASM"
))
->
required
();
codeSubcommand
->
add_option
(
"code-file"
,
was
mPath
,
localized
(
"The fullpath containing the contract
WASM"
))
->
required
();
auto
abiSubcommand
=
setSubcommand
->
add_subcommand
(
"abi"
,
localized
(
"Create or update the abi on an account"
));
abiSubcommand
->
add_option
(
"account"
,
account
,
localized
(
"The account to set the ABI for"
))
->
required
();
abiSubcommand
->
add_option
(
"abi-file"
,
abiPath
,
localized
(
"The fullpath containing the contract
WAST or WASM
"
))
->
required
();
abiSubcommand
->
add_option
(
"abi-file"
,
abiPath
,
localized
(
"The fullpath containing the contract
ABI
"
))
->
required
();
auto
contractSubcommand
=
setSubcommand
->
add_subcommand
(
"contract"
,
localized
(
"Create or update the contract on an account"
));
contractSubcommand
->
add_option
(
"account"
,
account
,
localized
(
"The account to publish a contract for"
))
->
required
();
contractSubcommand
->
add_option
(
"contract-dir"
,
contractPath
,
localized
(
"The path containing the .was
t
and .abi"
))
contractSubcommand
->
add_option
(
"contract-dir"
,
contractPath
,
localized
(
"The path containing the .was
m
and .abi"
))
->
required
();
contractSubcommand
->
add_option
(
"was
t-file"
,
wastPath
,
localized
(
"The file containing the contract WAST or
WASM relative to contract-dir"
));
contractSubcommand
->
add_option
(
"was
m-file"
,
wasmPath
,
localized
(
"The file containing the contract
WASM relative to contract-dir"
));
// ->check(CLI::ExistingFile);
auto
abi
=
contractSubcommand
->
add_option
(
"abi-file,-a,--abi"
,
abiPath
,
localized
(
"The ABI for the contract relative to contract-dir"
));
// ->check(CLI::ExistingFile);
std
::
vector
<
chain
::
action
>
actions
;
auto
set_code_callback
=
[
&
]()
{
std
::
string
was
t
;
std
::
string
was
m
;
fc
::
path
cpath
(
contractPath
);
if
(
cpath
.
filename
().
generic_string
()
==
"."
)
cpath
=
cpath
.
parent_path
();
if
(
wastPath
.
empty
()
)
{
wastPath
=
(
cpath
/
(
cpath
.
filename
().
generic_string
()
+
".wasm"
)).
generic_string
();
if
(
!
fc
::
exists
(
wastPath
))
wastPath
=
(
cpath
/
(
cpath
.
filename
().
generic_string
()
+
".wast"
)).
generic_string
();
}
else
{
wastPath
=
(
cpath
/
wastPath
).
generic_string
();
}
if
(
wasmPath
.
empty
()
)
wasmPath
=
(
cpath
/
(
cpath
.
filename
().
generic_string
()
+
".wasm"
)).
generic_string
();
else
wasmPath
=
(
cpath
/
wasmPath
).
generic_string
();
std
::
cerr
<<
localized
((
"Reading WAST/WASM from "
+
wastPath
+
"..."
).
c_str
())
<<
std
::
endl
;
fc
::
read_file_contents
(
wastPath
,
wast
);
EOS_ASSERT
(
!
wast
.
empty
(),
wast_file_not_found
,
"no wast file found ${f}"
,
(
"f"
,
wastPath
)
);
vector
<
uint8_t
>
wasm
;
const
string
binary_wasm_header
(
"
\x00\x61\x73\x6d
"
,
4
);
if
(
wast
.
compare
(
0
,
4
,
binary_wasm_header
)
==
0
)
{
std
::
cerr
<<
localized
(
"Using already assembled WASM..."
)
<<
std
::
endl
;
wasm
=
vector
<
uint8_t
>
(
wast
.
begin
(),
wast
.
end
());
}
else
{
std
::
cerr
<<
localized
(
"Assembling WASM..."
)
<<
std
::
endl
;
wasm
=
wast_to_wasm
(
wast
);
}
std
::
cerr
<<
localized
((
"Reading WASM from "
+
wasmPath
+
"..."
).
c_str
())
<<
std
::
endl
;
fc
::
read_file_contents
(
wasmPath
,
wasm
);
EOS_ASSERT
(
!
wasm
.
empty
(),
wast_file_not_found
,
"no wasm file found ${f}"
,
(
"f"
,
wasmPath
)
);
actions
.
emplace_back
(
create_setcode
(
account
,
bytes
(
wasm
.
begin
(),
wasm
.
end
())
)
);
if
(
shouldSend
)
{
...
...
testnet.template
浏览文件 @
383d276c
...
...
@@ -75,7 +75,7 @@ wcmd create -n ignition
# ------ DO NOT ALTER THE NEXT LINE -------
###INSERT prodkeys
ecmd
set
contract eosio contracts/eosio.bios eosio.bios.was
t
eosio.bios.abi
ecmd
set
contract eosio contracts/eosio.bios eosio.bios.was
m
eosio.bios.abi
# Create required system accounts
ecmd create key
...
...
tests/Cluster.py
浏览文件 @
383d276c
...
...
@@ -726,10 +726,10 @@ class Cluster(object):
contract
=
"eosio.bios"
contractDir
=
"contracts/%s"
%
(
contract
)
was
tFile
=
"%s.wast
"
%
(
contract
)
was
mFile
=
"%s.wasm
"
%
(
contract
)
abiFile
=
"%s.abi"
%
(
contract
)
Utils
.
Print
(
"Publish %s contract"
%
(
contract
))
trans
=
biosNode
.
publishContract
(
eosioAccount
.
name
,
contractDir
,
was
t
File
,
abiFile
,
waitForTransBlock
=
True
)
trans
=
biosNode
.
publishContract
(
eosioAccount
.
name
,
contractDir
,
was
m
File
,
abiFile
,
waitForTransBlock
=
True
)
if
trans
is
None
:
Utils
.
Print
(
"ERROR: Failed to publish contract %s."
%
(
contract
))
return
None
...
...
@@ -850,10 +850,10 @@ class Cluster(object):
contract
=
"eosio.token"
contractDir
=
"contracts/%s"
%
(
contract
)
was
tFile
=
"%s.wast
"
%
(
contract
)
was
mFile
=
"%s.wasm
"
%
(
contract
)
abiFile
=
"%s.abi"
%
(
contract
)
Utils
.
Print
(
"Publish %s contract"
%
(
contract
))
trans
=
biosNode
.
publishContract
(
eosioTokenAccount
.
name
,
contractDir
,
was
t
File
,
abiFile
,
waitForTransBlock
=
True
)
trans
=
biosNode
.
publishContract
(
eosioTokenAccount
.
name
,
contractDir
,
was
m
File
,
abiFile
,
waitForTransBlock
=
True
)
if
trans
is
None
:
Utils
.
Print
(
"ERROR: Failed to publish contract %s."
%
(
contract
))
return
None
...
...
@@ -905,10 +905,10 @@ class Cluster(object):
contract
=
"eosio.system"
contractDir
=
"contracts/%s"
%
(
contract
)
was
tFile
=
"%s.wast
"
%
(
contract
)
was
mFile
=
"%s.wasm
"
%
(
contract
)
abiFile
=
"%s.abi"
%
(
contract
)
Utils
.
Print
(
"Publish %s contract"
%
(
contract
))
trans
=
biosNode
.
publishContract
(
eosioAccount
.
name
,
contractDir
,
was
t
File
,
abiFile
,
waitForTransBlock
=
True
)
trans
=
biosNode
.
publishContract
(
eosioAccount
.
name
,
contractDir
,
was
m
File
,
abiFile
,
waitForTransBlock
=
True
)
if
trans
is
None
:
Utils
.
Print
(
"ERROR: Failed to publish contract %s."
%
(
contract
))
return
None
...
...
tests/Node.py
浏览文件 @
383d276c
...
...
@@ -757,9 +757,9 @@ class Node(object):
return
None
# publish contract and return transaction as json object
def
publishContract
(
self
,
account
,
contractDir
,
was
t
File
,
abiFile
,
waitForTransBlock
=
False
,
shouldFail
=
False
):
def
publishContract
(
self
,
account
,
contractDir
,
was
m
File
,
abiFile
,
waitForTransBlock
=
False
,
shouldFail
=
False
):
cmd
=
"%s %s -v set contract -j %s %s"
%
(
Utils
.
EosClientPath
,
self
.
endpointArgs
,
account
,
contractDir
)
cmd
+=
""
if
was
tFile
is
None
else
(
" "
+
wast
File
)
cmd
+=
""
if
was
mFile
is
None
else
(
" "
+
wasm
File
)
cmd
+=
""
if
abiFile
is
None
else
(
" "
+
abiFile
)
if
Utils
.
Debug
:
Utils
.
Print
(
"cmd: %s"
%
(
cmd
))
trans
=
None
...
...
tests/consensus-validation-malicious-producers.py
浏览文件 @
383d276c
...
...
@@ -288,10 +288,10 @@ def myTest(transWillEnterBlock):
error
(
"Failed to create account %s"
%
(
currencyAccount
.
name
))
return
False
was
tFile
=
"currency.wast
"
was
mFile
=
"currency.wasm
"
abiFile
=
"currency.abi"
Print
(
"Publish contract"
)
trans
=
node
.
publishContract
(
currencyAccount
.
name
,
was
t
File
,
abiFile
,
waitForTransBlock
=
True
)
trans
=
node
.
publishContract
(
currencyAccount
.
name
,
was
m
File
,
abiFile
,
waitForTransBlock
=
True
)
if
trans
is
None
:
error
(
"Failed to publish contract."
)
return
False
...
...
tests/nodeos_run_test.py
浏览文件 @
383d276c
...
...
@@ -319,10 +319,10 @@ try:
errorExit
(
"FAILURE - get code currency1111 failed"
,
raw
=
True
)
contractDir
=
"contracts/eosio.token"
was
tFile
=
"eosio.token.wast
"
was
mFile
=
"eosio.token.wasm
"
abiFile
=
"eosio.token.abi"
Print
(
"Publish contract"
)
trans
=
node
.
publishContract
(
currencyAccount
.
name
,
contractDir
,
was
t
File
,
abiFile
,
waitForTransBlock
=
True
)
trans
=
node
.
publishContract
(
currencyAccount
.
name
,
contractDir
,
was
m
File
,
abiFile
,
waitForTransBlock
=
True
)
if
trans
is
None
:
cmdError
(
"%s set contract currency1111"
%
(
ClientName
))
errorExit
(
"Failed to publish contract."
)
...
...
@@ -605,20 +605,20 @@ try:
Print
(
"upload exchange contract"
)
contractDir
=
"contracts/exchange"
was
tFile
=
"exchange.wast
"
was
mFile
=
"exchange.wasm
"
abiFile
=
"exchange.abi"
Print
(
"Publish exchange contract"
)
trans
=
node
.
publishContract
(
exchangeAccount
.
name
,
contractDir
,
was
t
File
,
abiFile
,
waitForTransBlock
=
True
)
trans
=
node
.
publishContract
(
exchangeAccount
.
name
,
contractDir
,
was
m
File
,
abiFile
,
waitForTransBlock
=
True
)
if
trans
is
None
:
cmdError
(
"%s set contract exchange"
%
(
ClientName
))
errorExit
(
"Failed to publish contract."
)
contractDir
=
"contracts/simpledb"
was
tFile
=
"simpledb.wast
"
was
mFile
=
"simpledb.wasm
"
abiFile
=
"simpledb.abi"
Print
(
"Setting simpledb contract without simpledb account was causing core dump in %s."
%
(
ClientName
))
Print
(
"Verify %s generates an error, but does not core dump."
%
(
ClientName
))
retMap
=
node
.
publishContract
(
"simpledb"
,
contractDir
,
was
t
File
,
abiFile
,
shouldFail
=
True
)
retMap
=
node
.
publishContract
(
"simpledb"
,
contractDir
,
was
m
File
,
abiFile
,
shouldFail
=
True
)
if
retMap
is
None
:
errorExit
(
"Failed to publish, but should have returned a details map"
)
if
retMap
[
"returncode"
]
==
0
or
retMap
[
"returncode"
]
==
139
:
# 139 SIGSEGV
...
...
tests/nodeos_under_min_avail_ram.py
浏览文件 @
383d276c
...
...
@@ -138,10 +138,10 @@ try:
trans
=
nodes
[
0
].
delegatebw
(
contractAccount
,
1000000.0000
,
88000000.0000
,
exitOnError
=
True
)
contractDir
=
"contracts/integration_test"
was
tFile
=
"integration_test.wast
"
was
mFile
=
"integration_test.wasm
"
abiFile
=
"integration_test.abi"
Print
(
"Publish contract"
)
trans
=
nodes
[
0
].
publishContract
(
contractAccount
.
name
,
contractDir
,
was
t
File
,
abiFile
,
waitForTransBlock
=
True
)
trans
=
nodes
[
0
].
publishContract
(
contractAccount
.
name
,
contractDir
,
was
m
File
,
abiFile
,
waitForTransBlock
=
True
)
if
trans
is
None
:
cmdError
(
"%s set contract %s"
%
(
ClientName
,
contractAccount
.
name
))
errorExit
(
"Failed to publish contract."
)
...
...
tests/p2p_network_test.py
浏览文件 @
383d276c
...
...
@@ -144,10 +144,10 @@ for i in range(len(hosts)):
Print
(
"host %s: %s"
%
(
hosts
[
i
],
trans
))
was
tFile
=
"eosio.system.wast
"
was
mFile
=
"eosio.system.wasm
"
abiFile
=
"eosio.system.abi"
Print
(
"
\n
Push system contract %s %s"
%
(
was
t
File
,
abiFile
))
trans
=
node0
.
publishContract
(
eosio
.
name
,
was
t
File
,
abiFile
,
waitForTransBlock
=
True
)
Print
(
"
\n
Push system contract %s %s"
%
(
was
m
File
,
abiFile
))
trans
=
node0
.
publishContract
(
eosio
.
name
,
was
m
File
,
abiFile
,
waitForTransBlock
=
True
)
if
trans
is
None
:
Utils
.
errorExit
(
"Failed to publish eosio.system."
)
else
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录