Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
5430011b
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,发现更多精彩内容 >>
提交
5430011b
编写于
5月 30, 2018
作者:
B
Bill Hamilton
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' into eosio_build_amazon
Merging master into eosio_build_amazon
上级
6b9a6334
2ce5b800
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
92 addition
and
108 deletion
+92
-108
contracts/eosio.system/eosio.system.abi
contracts/eosio.system/eosio.system.abi
+3
-14
contracts/eosio.system/eosio.system.cpp
contracts/eosio.system/eosio.system.cpp
+15
-20
contracts/eosio.system/eosio.system.hpp
contracts/eosio.system/eosio.system.hpp
+7
-14
contracts/eosio.system/native.hpp
contracts/eosio.system/native.hpp
+2
-11
plugins/producer_plugin/producer_plugin.cpp
plugins/producer_plugin/producer_plugin.cpp
+1
-1
programs/eosio-launcher/main.cpp
programs/eosio-launcher/main.cpp
+1
-1
tests/distributed-transactions-remote-test.py
tests/distributed-transactions-remote-test.py
+4
-2
tests/distributed-transactions-test.py
tests/distributed-transactions-test.py
+7
-5
tests/nodeos_run_remote_test.py
tests/nodeos_run_remote_test.py
+4
-2
tests/nodeos_run_test.py
tests/nodeos_run_test.py
+7
-5
tests/restart-scenarios-test.py
tests/restart-scenarios-test.py
+6
-4
tests/testUtils.py
tests/testUtils.py
+25
-12
unittests/eosio.system_tests.cpp
unittests/eosio.system_tests.cpp
+10
-17
未找到文件。
contracts/eosio.system/eosio.system.abi
浏览文件 @
5430011b
...
...
@@ -242,16 +242,11 @@
{"name":"max_authority_depth", "type":"uint16"}
]
},{
"name": "eosio_parameters",
"base": "blockchain_parameters",
"fields": [
{"name":"max_ram_size", "type":"uint64"}
]
},{
"name": "eosio_global_state",
"base": "
eosio
_parameters",
"base": "
blockchain
_parameters",
"fields": [
{"name":"max_ram_size", "type":"uint64"},
{"name":"total_ram_bytes_reserved", "type":"uint64"},
{"name":"total_ram_stake", "type":"int64"},
{"name":"last_producer_schedule_update", "type":"time_point_sec"},
...
...
@@ -384,7 +379,7 @@
"name": "setparams",
"base": "",
"fields": [
{"name":"params", "type":"
eosio
_parameters"}
{"name":"params", "type":"
blockchain
_parameters"}
]
}
],
...
...
@@ -525,12 +520,6 @@
"index_type": "i64",
"key_names" : ["owner"],
"key_types" : ["uint64"]
},{
"name": "totalband",
"type": "total_resources",
"index_type": "i64",
"key_names" : ["owner"],
"key_types" : ["uint64"]
},{
"name": "delband",
"type": "delegated_bandwidth",
...
...
contracts/eosio.system/eosio.system.cpp
浏览文件 @
5430011b
...
...
@@ -73,6 +73,13 @@ namespace eosiosystem {
_global
.
set
(
_gstate
,
_self
);
}
void
system_contract
::
setparams
(
const
eosio
::
blockchain_parameters
&
params
)
{
require_auth
(
N
(
eosio
)
);
(
eosio
::
blockchain_parameters
&
)(
_gstate
)
=
params
;
eosio_assert
(
3
<=
_gstate
.
max_authority_depth
,
"max_authority_depth should be at least 3"
);
set_blockchain_parameters
(
params
);
}
void
system_contract
::
setpriv
(
account_name
account
,
uint8_t
ispriv
)
{
require_auth
(
_self
);
set_privileged
(
account
,
ispriv
);
...
...
@@ -165,30 +172,18 @@ namespace eosiosystem {
set_resource_limits
(
newact
,
0
,
0
,
0
);
}
void
system_contract
::
setparams
(
const
eosio_parameters
&
params
)
{
require_auth
(
N
(
eosio
)
);
(
eosiosystem
::
eosio_parameters
&
)(
_gstate
)
=
params
;
eosio_assert
(
3
<=
_gstate
.
max_authority_depth
,
"max_authority_depth should be at least 3"
);
set_blockchain_parameters
(
params
);
}
}
/// eosio.system
EOSIO_ABI
(
eosiosystem
::
system_contract
,
(
setram
)
// delegate_bandwith.cpp
(
delegatebw
)(
undelegatebw
)(
refund
)
(
buyram
)(
buyrambytes
)(
sellram
)
// native.hpp (newaccount definition is actually in eosio.system.cpp)
(
newaccount
)(
updateauth
)(
deleteauth
)(
linkauth
)(
unlinkauth
)(
canceldelay
)(
onerror
)
// eosio.system.cpp
(
setram
)(
setparams
)(
setpriv
)(
bidname
)
// delegate_bandwidth.cpp
(
buyrambytes
)(
buyram
)(
sellram
)(
delegatebw
)(
undelegatebw
)(
refund
)
// voting.cpp
(
regproducer
)(
unregprod
)(
voteproducer
)(
regproxy
)
// producer_pay.cpp
(
regproxy
)(
regproducer
)(
unregprod
)(
voteproducer
)
(
claimrewards
)
// native.hpp
(
onblock
)
(
newaccount
)(
updateauth
)(
deleteauth
)(
linkauth
)(
unlinkauth
)(
postrecovery
)(
passrecovery
)(
vetorecovery
)(
onerror
)(
canceldelay
)
//this file
(
bidname
)
(
setpriv
)
(
setparams
)
(
onblock
)(
claimrewards
)
)
contracts/eosio.system/eosio.system.hpp
浏览文件 @
5430011b
...
...
@@ -20,13 +20,6 @@ namespace eosiosystem {
using
eosio
::
const_mem_fun
;
using
eosio
::
block_timestamp
;
struct
eosio_parameters
:
eosio
::
blockchain_parameters
{
uint64_t
max_ram_size
=
64ll
*
1024
*
1024
*
1024
;
// explicit serialization macro is not necessary, used here only to improve compilation time
EOSLIB_SERIALIZE_DERIVED
(
eosio_parameters
,
eosio
::
blockchain_parameters
,
(
max_ram_size
)
)
};
struct
name_bid
{
account_name
newname
;
account_name
high_bidder
;
...
...
@@ -42,11 +35,10 @@ namespace eosiosystem {
>
name_bid_table
;
struct
eosio_global_state
:
eosio_parameters
{
struct
eosio_global_state
:
eosio
::
blockchain_parameters
{
uint64_t
free_ram
()
const
{
return
max_ram_size
-
total_ram_bytes_reserved
;
}
uint64_t
max_ram_size
=
64ll
*
1024
*
1024
*
1024
;
uint64_t
total_ram_bytes_reserved
=
0
;
int64_t
total_ram_stake
=
0
;
...
...
@@ -64,7 +56,8 @@ namespace eosiosystem {
block_timestamp
last_name_close
;
// explicit serialization macro is not necessary, used here only to improve compilation time
EOSLIB_SERIALIZE_DERIVED
(
eosio_global_state
,
eosio_parameters
,
(
total_ram_bytes_reserved
)(
total_ram_stake
)
EOSLIB_SERIALIZE_DERIVED
(
eosio_global_state
,
eosio
::
blockchain_parameters
,
(
max_ram_size
)(
total_ram_bytes_reserved
)(
total_ram_stake
)
(
last_producer_schedule_update
)(
last_pervote_bucket_fill
)
(
pervote_bucket
)(
perblock_bucket
)(
savings
)(
total_unpaid_blocks
)(
total_activated_stake
)(
thresh_activated_stake_time
)
(
last_producer_schedule_id
)(
last_producer_schedule_size
)(
total_producer_vote_weight
)(
last_name_close
)
)
...
...
@@ -157,7 +150,7 @@ namespace eosiosystem {
// functions defined in delegate_bandwidth.cpp
/**
* Stakes SYS from the balance of 'from' for the benfit of 'receiver'.
* Stakes SYS from the balance of 'from' for the benfit of 'receiver'.
* If transfer == true, then 'receiver' can unstake to their account
* Else 'from' can unstake at any time.
*/
...
...
@@ -171,7 +164,7 @@ namespace eosiosystem {
* left to delegate.
*
* This will cause an immediate reduction in net/cpu bandwidth of the
* receiver.
* receiver.
*
* A transaction is scheduled to send the tokens back to 'from' after
* the staking period has passed. If existing transaction is scheduled, it
...
...
@@ -217,7 +210,7 @@ namespace eosiosystem {
void
regproxy
(
const
account_name
proxy
,
bool
isproxy
);
void
setparams
(
const
eosio_parameters
&
params
);
void
setparams
(
const
eosio
::
blockchain
_parameters
&
params
);
// functions defined in producer_pay.cpp
void
claimrewards
(
const
account_name
&
owner
);
...
...
contracts/eosio.system/native.hpp
浏览文件 @
5430011b
...
...
@@ -79,7 +79,7 @@ namespace eosiosystem {
*
* 2. new accounts must stake a minimal number of tokens (as set in system parameters)
* therefore, this method will execute an inline buyram from receiver for newacnt in
* an amount equal to the current new account creation fee.
* an amount equal to the current new account creation fee.
*/
void
newaccount
(
account_name
creator
,
account_name
newact
...
...
@@ -104,18 +104,9 @@ namespace eosiosystem {
account_name code,
action_name type*/
)
{}
void
postrecovery
(
/*account_name account,
const authority& data,
const std::string& memo*/
)
{}
void
passrecovery
(
/*account_name account*/
)
{}
void
vetorecovery
(
/*account_name account*/
)
{}
void
onerror
(
/*const bytes&*/
)
{}
void
canceldelay
(
/*permission_level canceling_auth, transaction_id_type trx_id*/
)
{}
void
onerror
(
/*const bytes&*/
)
{}
};
}
plugins/producer_plugin/producer_plugin.cpp
浏览文件 @
5430011b
...
...
@@ -685,7 +685,7 @@ producer_plugin_impl::start_block_result producer_plugin_impl::start_block() {
}
else
if
(
_pause_production
)
{
elog
(
"Not producing block because production is explicitly paused"
);
_pending_block_mode
=
pending_block_mode
::
speculating
;
}
else
if
(
irreversible_block_age
>=
_max_irreversible_block_age_us
)
{
}
else
if
(
_max_irreversible_block_age_us
.
count
()
>=
0
&&
irreversible_block_age
>=
_max_irreversible_block_age_us
)
{
elog
(
"Not producing block because the irreversible block is too old [age:${age}s, max:${max}s]"
,
(
"age"
,
irreversible_block_age
.
count
()
/
1'000'000
)(
"max"
,
_max_irreversible_block_age_us
.
count
()
/
1'000'000
));
_pending_block_mode
=
pending_block_mode
::
speculating
;
}
...
...
programs/eosio-launcher/main.cpp
浏览文件 @
5430011b
...
...
@@ -978,7 +978,6 @@ launcher_def::write_config_file (tn_node_def &node) {
exit
(
-
1
);
}
cfg
<<
"genesis-json = "
<<
host
->
genesis
<<
"
\n
"
;
cfg
<<
"blocks-dir = "
<<
block_dir
<<
"
\n
"
;
cfg
<<
"readonly = 0
\n
"
;
cfg
<<
"send-whole-blocks = true
\n
"
;
...
...
@@ -1462,6 +1461,7 @@ launcher_def::launch (eosd_def &instance, string >s) {
}
eosdcmd
+=
" --config-dir "
+
instance
.
config_dir_name
+
" --data-dir "
+
instance
.
data_dir_name
;
eosdcmd
+=
" --genesis-json "
+
genesis
.
string
();
if
(
gts
.
length
())
{
eosdcmd
+=
" --genesis-timestamp "
+
gts
;
}
...
...
tests/distributed-transactions-remote-test.py
浏览文件 @
5430011b
...
...
@@ -22,6 +22,7 @@ parser.add_argument("--dont-kill", help="Leave cluster running after test finish
parser
.
add_argument
(
"--dump-error-details"
,
help
=
"Upon error print etc/eosio/node_*/config.ini and var/lib/node_*/stderr.log to stdout"
,
action
=
'store_true'
)
parser
.
add_argument
(
"--kill-all"
,
help
=
"Kill all nodeos and kleos instances"
,
action
=
'store_true'
)
args
=
parser
.
parse_args
()
pnodes
=
args
.
p
...
...
@@ -29,6 +30,7 @@ pnodes=args.p
debug
=
args
.
v
dontKill
=
args
.
dont_kill
dumpErrorDetails
=
args
.
dump_error_details
killAll
=
args
.
kill_all
testUtils
.
Utils
.
Debug
=
debug
...
...
@@ -58,7 +60,7 @@ cluster=testUtils.Cluster()
(
fd
,
nodesFile
)
=
tempfile
.
mkstemp
()
try
:
Print
(
"BEGIN"
)
cluster
.
killall
()
cluster
.
killall
(
allInstances
=
killAll
)
cluster
.
cleanup
()
Print
(
"producing nodes: %s, non-producing nodes: %d, topology: %s, delay between nodes launch(seconds): %d"
%
...
...
@@ -98,7 +100,7 @@ finally:
if
killEosInstances
:
Print
(
"Shut down the cluster and cleanup."
)
cluster
.
killall
()
cluster
.
killall
(
allInstances
=
killAll
)
cluster
.
cleanup
()
exit
(
0
)
tests/distributed-transactions-test.py
浏览文件 @
5430011b
...
...
@@ -25,6 +25,7 @@ parser.add_argument("--dont-kill", help="Leave cluster running after test finish
parser
.
add_argument
(
"--dump-error-details"
,
help
=
"Upon error print etc/eosio/node_*/config.ini and var/lib/node_*/stderr.log to stdout"
,
action
=
'store_true'
)
parser
.
add_argument
(
"--kill-all"
,
help
=
"Kill all nodeos and kleos instances"
,
action
=
'store_true'
)
args
=
parser
.
parse_args
()
pnodes
=
args
.
p
...
...
@@ -36,6 +37,7 @@ nodesFile=args.nodes_file
seed
=
args
.
seed
dontKill
=
args
.
dont_kill
dumpErrorDetails
=
args
.
dump_error_details
killAll
=
args
.
kill_all
killWallet
=
not
dontKill
killEosInstances
=
not
dontKill
...
...
@@ -60,9 +62,9 @@ try:
errorExit
(
"Failed to initilize nodes from Json string."
)
total_nodes
=
len
(
cluster
.
getNodes
())
else
:
cluster
.
killall
()
cluster
.
killall
(
allInstances
=
killAll
)
cluster
.
cleanup
()
walletMgr
.
killall
()
walletMgr
.
killall
(
allInstances
=
killAll
)
walletMgr
.
cleanup
()
Print
(
"producing nodes: %s, non-producing nodes: %d, topology: %s, delay between nodes launch(seconds): %d"
%
...
...
@@ -78,7 +80,7 @@ try:
errorExit
(
"Cluster never stabilized"
)
Print
(
"Stand up EOS wallet keosd"
)
walletMgr
.
killall
()
walletMgr
.
killall
(
allInstances
=
killAll
)
walletMgr
.
cleanup
()
if
walletMgr
.
launch
()
is
False
:
errorExit
(
"Failed to stand up keosd."
)
...
...
@@ -116,11 +118,11 @@ finally:
if
killEosInstances
:
Print
(
"Shut down the cluster and cleanup."
)
cluster
.
killall
()
cluster
.
killall
(
allInstances
=
killAll
)
cluster
.
cleanup
()
if
killWallet
:
Print
(
"Shut down the wallet and cleanup."
)
walletMgr
.
killall
()
walletMgr
.
killall
(
allInstances
=
killAll
)
walletMgr
.
cleanup
()
exit
(
0
)
tests/nodeos_run_remote_test.py
浏览文件 @
5430011b
...
...
@@ -18,12 +18,14 @@ parser.add_argument("--only-bios", help="Limit testing to bios node.", action='s
parser
.
add_argument
(
"--dump-error-details"
,
help
=
"Upon error print etc/eosio/node_*/config.ini and var/lib/node_*/stderr.log to stdout"
,
action
=
'store_true'
)
parser
.
add_argument
(
"--kill-all"
,
help
=
"Kill all nodeos and kleos instances"
,
action
=
'store_true'
)
args
=
parser
.
parse_args
()
debug
=
args
.
v
dontKill
=
args
.
dont_kill
dumpErrorDetails
=
args
.
dump_error_details
onlyBios
=
args
.
only_bios
killAll
=
args
.
kill_all
testUtils
.
Utils
.
Debug
=
debug
...
...
@@ -39,7 +41,7 @@ testSuccessful=False
cluster
=
testUtils
.
Cluster
()
try
:
Print
(
"BEGIN"
)
cluster
.
killall
()
cluster
.
killall
(
allInstances
=
killAll
)
cluster
.
cleanup
()
Print
(
"producing nodes: %s, non-producing nodes: %d, topology: %s, delay between nodes launch(seconds): %d"
%
...
...
@@ -76,7 +78,7 @@ finally:
if
killEosInstances
:
Print
(
"Shut down the cluster and cleanup."
)
cluster
.
killall
()
cluster
.
killall
(
allInstances
=
killAll
)
cluster
.
cleanup
()
exit
(
0
)
tests/nodeos_run_test.py
浏览文件 @
5430011b
...
...
@@ -51,6 +51,7 @@ parser.add_argument("--keep-logs", help="Don't delete var/lib/node_* folders upo
parser
.
add_argument
(
"-v"
,
help
=
"verbose logging"
,
action
=
'store_true'
)
parser
.
add_argument
(
"--dont-kill"
,
help
=
"Leave cluster running after test finishes"
,
action
=
'store_true'
)
parser
.
add_argument
(
"--only-bios"
,
help
=
"Limit testing to bios node."
,
action
=
'store_true'
)
parser
.
add_argument
(
"--kill-all"
,
help
=
"Kill all nodeos and kleos instances"
,
action
=
'store_true'
)
args
=
parser
.
parse_args
()
testOutputFile
=
args
.
output
...
...
@@ -66,6 +67,7 @@ dontLaunch=args.dont_launch
dontKill
=
args
.
dont_kill
prodCount
=
args
.
prod_count
onlyBios
=
args
.
only_bios
killAll
=
args
.
kill_all
testUtils
.
Utils
.
Debug
=
debug
localTest
=
True
if
server
==
LOCAL_HOST
else
False
...
...
@@ -88,11 +90,11 @@ try:
if
enableMongo
and
not
cluster
.
isMongodDbRunning
():
errorExit
(
"MongoDb doesn't seem to be running."
)
walletMgr
.
killall
()
walletMgr
.
killall
(
allInstances
=
killAll
)
walletMgr
.
cleanup
()
if
localTest
and
not
dontLaunch
:
cluster
.
killall
()
cluster
.
killall
(
allInstances
=
killAll
)
cluster
.
cleanup
()
Print
(
"Stand up cluster"
)
if
cluster
.
launch
(
prodCount
=
prodCount
,
onlyBios
=
onlyBios
,
dontKill
=
dontKill
)
is
False
:
...
...
@@ -129,7 +131,7 @@ try:
exchangeAccount
.
ownerPublicKey
=
PUB_KEY2
Print
(
"Stand up walletd"
)
walletMgr
.
killall
()
walletMgr
.
killall
(
allInstances
=
killAll
)
walletMgr
.
cleanup
()
if
walletMgr
.
launch
()
is
False
:
cmdError
(
"%s"
%
(
WalletdName
))
...
...
@@ -700,14 +702,14 @@ finally:
if
killEosInstances
:
Print
(
"Shut down the cluster."
)
cluster
.
killall
()
cluster
.
killall
(
allInstances
=
killAll
)
if
testSuccessful
and
not
keepLogs
:
Print
(
"Cleanup cluster data."
)
cluster
.
cleanup
()
if
killWallet
:
Print
(
"Shut down the wallet."
)
walletMgr
.
killall
()
walletMgr
.
killall
(
allInstances
=
killAll
)
if
testSuccessful
and
not
keepLogs
:
Print
(
"Cleanup wallet data."
)
walletMgr
.
cleanup
()
...
...
tests/restart-scenarios-test.py
浏览文件 @
5430011b
...
...
@@ -44,6 +44,7 @@ parser.add_argument("--dump-error-details",
action
=
'store_true'
)
parser
.
add_argument
(
"--keep-logs"
,
help
=
"Don't delete var/lib/node_* folders upon test completion"
,
action
=
'store_true'
)
parser
.
add_argument
(
"--kill-all"
,
help
=
"Kill all nodeos and kleos instances"
,
action
=
'store_true'
)
args
=
parser
.
parse_args
()
pnodes
=
args
.
p
...
...
@@ -57,6 +58,7 @@ killSignal=args.kill_sig
killEosInstances
=
not
args
.
dont_kill
dumpErrorDetails
=
args
.
dump_error_details
keepLogs
=
args
.
keep_logs
killAll
=
args
.
kill_all
seed
=
1
testUtils
.
Utils
.
Debug
=
debug
...
...
@@ -71,7 +73,7 @@ try:
cluster
.
setChainStrategy
(
chainSyncStrategyStr
)
cluster
.
setWalletMgr
(
walletMgr
)
cluster
.
killall
()
cluster
.
killall
(
allInstances
=
killAll
)
cluster
.
cleanup
()
Print
(
"producing nodes: %d, topology: %s, delay between nodes launch(seconds): %d, chain sync strategy: %s"
%
(
...
...
@@ -87,7 +89,7 @@ try:
errorExit
(
"Cluster never stabilized"
)
Print
(
"Stand up EOS wallet keosd"
)
walletMgr
.
killall
()
walletMgr
.
killall
(
allInstances
=
killAll
)
walletMgr
.
cleanup
()
if
walletMgr
.
launch
()
is
False
:
errorExit
(
"Failed to stand up keosd."
)
...
...
@@ -173,8 +175,8 @@ finally:
if
killEosInstances
:
Print
(
"Shut down the cluster%s"
%
(
" and cleanup."
if
(
testSuccessful
and
not
keepLogs
)
else
"."
))
cluster
.
killall
()
walletMgr
.
killall
()
cluster
.
killall
(
allInstances
=
killAll
)
walletMgr
.
killall
(
allInstances
=
killAll
)
if
testSuccessful
and
not
keepLogs
:
Print
(
"Cleanup cluster and wallet data."
)
cluster
.
cleanup
()
...
...
tests/testUtils.py
浏览文件 @
5430011b
...
...
@@ -1297,11 +1297,22 @@ class WalletMgr(object):
with
open
(
WalletMgr
.
__walletLogFile
,
"r"
)
as
f
:
shutil
.
copyfileobj
(
f
,
sys
.
stdout
)
@
staticmethod
def
killall
():
cmd
=
"pkill -9 %s"
%
(
Utils
.
EosWalletName
)
if
Utils
.
Debug
:
Utils
.
Print
(
"cmd: %s"
%
(
cmd
))
subprocess
.
call
(
cmd
.
split
())
# @staticmethod
# def killall():
# cmd="pkill -9 %s" % (Utils.EosWalletName)
# if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
# subprocess.call(cmd.split())
def
killall
(
self
,
allInstances
=
False
):
"""Kill keos instances. allInstances will kill all keos instances running on the system."""
if
self
.
__walletPid
:
os
.
kill
(
self
.
__walletPid
,
signal
.
SIGKILL
)
if
allInstances
:
cmd
=
"pkill -9 %s"
%
(
Utils
.
EosWalletName
)
if
Utils
.
Debug
:
Utils
.
Print
(
"cmd: %s"
%
(
cmd
))
subprocess
.
call
(
cmd
.
split
())
@
staticmethod
def
cleanup
():
...
...
@@ -2210,17 +2221,19 @@ class Cluster(object):
fileName
=
"var/lib/node_%02d/stderr.txt"
%
(
i
)
Cluster
.
dumpErrorDetailImpl
(
fileName
)
def
killall
(
self
,
silent
=
True
):
cmd
=
"%s -k 15"
%
(
Utils
.
EosLauncherPath
)
def
killall
(
self
,
silent
=
True
,
allInstances
=
False
):
"""Kill cluster nodeos instances. allInstances will kill all nodeos instances running on the system."""
cmd
=
"%s -k 9"
%
(
Utils
.
EosLauncherPath
)
if
Utils
.
Debug
:
Utils
.
Print
(
"cmd: %s"
%
(
cmd
))
if
0
!=
subprocess
.
call
(
cmd
.
split
(),
stdout
=
Utils
.
FNull
):
if
not
silent
:
Utils
.
Print
(
"Launcher failed to shut down eos cluster."
)
# ocassionally the launcher cannot kill the eos server
cmd
=
"pkill -9 %s"
%
(
Utils
.
EosServerName
)
if
Utils
.
Debug
:
Utils
.
Print
(
"cmd: %s"
%
(
cmd
))
if
0
!=
subprocess
.
call
(
cmd
.
split
(),
stdout
=
Utils
.
FNull
):
if
not
silent
:
Utils
.
Print
(
"Failed to shut down eos cluster."
)
if
allInstances
:
# ocassionally the launcher cannot kill the eos server
cmd
=
"pkill -9 %s"
%
(
Utils
.
EosServerName
)
if
Utils
.
Debug
:
Utils
.
Print
(
"cmd: %s"
%
(
cmd
))
if
0
!=
subprocess
.
call
(
cmd
.
split
(),
stdout
=
Utils
.
FNull
):
if
not
silent
:
Utils
.
Print
(
"Failed to shut down eos cluster."
)
# another explicit nodes shutdown
for
node
in
self
.
nodes
:
...
...
unittests/eosio.system_tests.cpp
浏览文件 @
5430011b
...
...
@@ -10,12 +10,6 @@
using
namespace
eosio_system
;
struct
eosio_parameters
:
eosio
::
chain
::
chain_config
{
uint64_t
max_ram_size
;
};
FC_REFLECT_DERIVED
(
eosio_parameters
,
(
eosio
::
chain
::
chain_config
),
(
max_ram_size
));
BOOST_AUTO_TEST_SUITE
(
eosio_system_tests
)
BOOST_FIXTURE_TEST_CASE
(
buysell
,
eosio_system_tester
)
try
{
...
...
@@ -32,7 +26,7 @@ BOOST_FIXTURE_TEST_CASE( buysell, eosio_system_tester ) try {
const
asset
initial_ramfee_balance
=
get_balance
(
N
(
eosio
.
ramfee
));
BOOST_REQUIRE_EQUAL
(
success
(),
buyram
(
"alice1111111"
,
"alice1111111"
,
core_from_string
(
"200.0000"
)
)
);
BOOST_REQUIRE_EQUAL
(
core_from_string
(
"800.0000"
),
get_balance
(
"alice1111111"
)
);
BOOST_REQUIRE_EQUAL
(
initial_ram_balance
+
core_from_string
(
"199.0000"
),
get_balance
(
N
(
eosio
.
ram
))
);
BOOST_REQUIRE_EQUAL
(
initial_ram_balance
+
core_from_string
(
"199.0000"
),
get_balance
(
N
(
eosio
.
ram
))
);
BOOST_REQUIRE_EQUAL
(
initial_ramfee_balance
+
core_from_string
(
"1.0000"
),
get_balance
(
N
(
eosio
.
ramfee
))
);
total
=
get_total_stake
(
"alice1111111"
);
...
...
@@ -1494,7 +1488,7 @@ BOOST_FIXTURE_TEST_CASE(multiple_producer_pay, eosio_system_tester, * boost::uni
const
int64_t
from_pervote_bucket
=
int64_t
(
vote_shares
[
prod_index
]
*
expected_pervote_bucket
);
BOOST_REQUIRE
(
1
>=
abs
(
int32_t
(
initial_tot_unpaid_blocks
-
tot_unpaid_blocks
)
-
int32_t
(
initial_unpaid_blocks
-
unpaid_blocks
))
);
if
(
from_pervote_bucket
>=
100
*
10000
)
{
BOOST_REQUIRE
(
within_one
(
from_perblock_bucket
+
from_pervote_bucket
,
balance
.
get_amount
()
-
initial_balance
.
get_amount
()
)
);
BOOST_REQUIRE
(
within_one
(
expected_pervote_bucket
-
from_pervote_bucket
,
pervote_bucket
)
);
...
...
@@ -1504,7 +1498,7 @@ BOOST_FIXTURE_TEST_CASE(multiple_producer_pay, eosio_system_tester, * boost::uni
BOOST_REQUIRE
(
within_one
(
expected_pervote_bucket
,
vpay_balance
.
get_amount
()
)
);
BOOST_REQUIRE
(
within_one
(
perblock_bucket
,
bpay_balance
.
get_amount
()
)
);
}
produce_blocks
(
5
);
BOOST_REQUIRE_EQUAL
(
wasm_assert_msg
(
"already claimed rewards within past day"
),
...
...
@@ -2560,9 +2554,8 @@ BOOST_FIXTURE_TEST_CASE( setparams, eosio_system_tester ) try {
prod_perms
.
push_back
(
{
name
(
x
),
config
::
active_name
}
);
}
eosio_parameters
params
;
(
eosio
::
chain
::
chain_config
&
)
params
=
control
->
get_global_properties
().
configuration
;
params
.
max_ram_size
=
65ll
*
1024
*
1024
*
1024
;
eosio
::
chain
::
chain_config
params
;
params
=
control
->
get_global_properties
().
configuration
;
//change some values
params
.
max_block_net_usage
+=
10
;
params
.
max_transaction_lifetime
+=
1
;
...
...
@@ -2646,7 +2639,7 @@ BOOST_FIXTURE_TEST_CASE( setram_effect, eosio_system_tester ) try {
BOOST_REQUIRE_EQUAL
(
success
(),
buyram
(
name_a
,
name_a
,
core_from_string
(
"300.0000"
)
)
);
BOOST_REQUIRE_EQUAL
(
core_from_string
(
"700.0000"
),
get_balance
(
name_a
)
);
const
uint64_t
bought_bytes_a
=
get_total_stake
(
name_a
)[
"ram_bytes"
].
as_uint64
()
-
init_bytes_a
;
// after buying and selling balance should be 700 + 300 * 0.995 * 0.995 = 997.0075
BOOST_REQUIRE_EQUAL
(
success
(),
sellram
(
name_a
,
bought_bytes_a
)
);
BOOST_REQUIRE_EQUAL
(
core_from_string
(
"997.0075"
),
get_balance
(
name_a
)
);
...
...
@@ -2661,13 +2654,13 @@ BOOST_FIXTURE_TEST_CASE( setram_effect, eosio_system_tester ) try {
BOOST_REQUIRE_EQUAL
(
success
(),
buyram
(
name_b
,
name_b
,
core_from_string
(
"300.0000"
)
)
);
BOOST_REQUIRE_EQUAL
(
core_from_string
(
"700.0000"
),
get_balance
(
name_b
)
);
const
uint64_t
bought_bytes_b
=
get_total_stake
(
name_b
)[
"ram_bytes"
].
as_uint64
()
-
init_bytes_b
;
// increase max_ram_size, ram bought by name_b loses part of its value
// increase max_ram_size, ram bought by name_b loses part of its value
BOOST_REQUIRE_EQUAL
(
wasm_assert_msg
(
"ram may only be increased"
),
push_action
(
config
::
system_account_name
,
N
(
setram
),
mvo
()(
"max_ram_size"
,
64ll
*
1024
*
1024
*
1024
))
);
BOOST_REQUIRE_EQUAL
(
success
(),
BOOST_REQUIRE_EQUAL
(
success
(),
push_action
(
config
::
system_account_name
,
N
(
setram
),
mvo
()(
"max_ram_size"
,
80ll
*
1024
*
1024
*
1024
))
);
BOOST_REQUIRE_EQUAL
(
success
(),
sellram
(
name_b
,
bought_bytes_b
)
);
BOOST_REQUIRE
(
core_from_string
(
"900.0000"
)
<
get_balance
(
name_b
)
);
BOOST_REQUIRE
(
core_from_string
(
"950.0000"
)
>
get_balance
(
name_b
)
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录