Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
4f37b2f7
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,发现更多精彩内容 >>
提交
4f37b2f7
编写于
4月 30, 2018
作者:
K
Kevin Heifner
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'slim' of
https://github.com/EOSIO/eos
into slim
上级
fbe09bb7
62af4e2d
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
63 addition
and
140 deletion
+63
-140
contracts/eosio.system/delegate_bandwidth.cpp
contracts/eosio.system/delegate_bandwidth.cpp
+6
-1
contracts/eosio.system/eosio.system.abi
contracts/eosio.system/eosio.system.abi
+6
-0
contracts/eosio.system/voting.cpp
contracts/eosio.system/voting.cpp
+0
-96
libraries/chain/include/eosio/chain/transaction_metadata.hpp
libraries/chain/include/eosio/chain/transaction_metadata.hpp
+2
-2
libraries/testing/include/eosio/testing/tester.hpp
libraries/testing/include/eosio/testing/tester.hpp
+49
-41
未找到文件。
contracts/eosio.system/delegate_bandwidth.cpp
浏览文件 @
4f37b2f7
...
...
@@ -80,16 +80,21 @@ namespace eosiosystem {
const
asset
&
stake_net_quantity
,
const
asset
&
stake_cpu_quantity
,
const
asset
&
stake_storage_quantity
)
{
require_auth
(
from
);
eosio_assert
(
stake_cpu_quantity
.
amount
>=
0
,
"must stake a positive amount"
);
eosio_assert
(
stake_net_quantity
.
amount
>=
0
,
"must stake a positive amount"
);
eosio_assert
(
stake_storage_quantity
.
amount
>=
0
,
"must stake a positive amount"
);
if
(
stake_storage_quantity
.
amount
>
0
)
{
eosio_assert
(
from
==
receiver
,
"you may only stake storage to yourself"
);
}
print
(
"adding stake..."
,
stake_net_quantity
,
" "
,
stake_cpu_quantity
,
" "
,
stake_storage_quantity
);
asset
total_stake
=
stake_cpu_quantity
+
stake_net_quantity
+
stake_storage_quantity
;
print
(
"
\n
total stake: "
,
total_stake
);
eosio_assert
(
total_stake
.
amount
>
0
,
"must stake a positive amount"
);
require_auth
(
from
);
//eosio_assert( is_account( receiver ), "can only delegate resources to an existing account" );
int64_t
storage_bytes
=
0
;
...
...
contracts/eosio.system/eosio.system.abi
浏览文件 @
4f37b2f7
...
...
@@ -269,6 +269,12 @@
"index_type": "i64",
"key_names" : ["owner"],
"key_types" : ["uint64"]
},{
"name": "global",
"type": "eosio_global_state",
"index_type": "i64",
"key_names" : [],
"key_types" : []
},{
"name": "voters",
"type": "voter_info",
...
...
contracts/eosio.system/voting.cpp
浏览文件 @
4f37b2f7
...
...
@@ -203,37 +203,6 @@ namespace eosiosystem {
producers_table
producers_tbl
(
_self
,
_self
);
auto
idx
=
producers_tbl
.
template
get_index
<
N
(
prototalvote
)>();
/*
std::array<uint64_t, 21> max_block_net_usage;
std::array<uint32_t, 21> target_block_net_usage_pct;
std::array<uint32_t, 21> base_per_transaction_net_usage;
std::array<uint32_t, 21> max_transaction_net_usage;
std::array<uint64_t, 21> context_free_discount_net_usage_num;
std::array<uint64_t, 21> context_free_discount_net_usage_den;
std::array<uint64_t, 21> max_block_cpu_usage;
std::array<uint32_t, 21> target_block_cpu_usage_pct;
std::array<uint32_t, 21> max_transaction_cpu_usage;
std::array<uint32_t, 21> base_per_transaction_cpu_usage;
std::array<uint32_t, 21> base_per_action_cpu_usage;
std::array<uint32_t, 21> base_setcode_cpu_usage;
std::array<uint32_t, 21> per_signature_cpu_usage;
std::array<uint64_t, 21> context_free_discount_cpu_usage_num;
std::array<uint64_t, 21> context_free_discount_cpu_usage_den;
std::array<uint32_t, 21> max_transaction_lifetime;
std::array<uint32_t, 21> deferred_trx_expiration_window;
std::array<uint32_t, 21> max_transaction_delay;
std::array<uint32_t, 21> max_inline_action_size;
std::array<uint16_t, 21> max_inline_action_depth;
std::array<uint16_t, 21> max_authority_depth;
std::array<uint32_t, 21> max_generated_transaction_count;
std::array<uint32_t, 21> max_storage_size;
std::array<uint32_t, 21> percent_of_max_inflation_rate;
std::array<uint32_t, 21> storage_reserve_ratio;
*/
eosio
::
producer_schedule
schedule
;
schedule
.
producers
.
reserve
(
21
);
size_t
n
=
0
;
...
...
@@ -241,40 +210,7 @@ namespace eosiosystem {
if
(
it
->
active
()
)
{
schedule
.
producers
.
emplace_back
();
schedule
.
producers
.
back
().
producer_name
=
it
->
owner
;
//eosio_assert( sizeof(schedule.producers.back().block_signing_key) == it->packed_key.size(), "size mismatch" );
schedule
.
producers
.
back
().
block_signing_key
=
it
->
producer_key
;
//std::copy( it->packed_key.begin(), it->packed_key.end(), schedule.producers.back().block_signing_key.data.data() );
/*
max_block_net_usage[n] = it->prefs.max_block_net_usage;
target_block_net_usage_pct[n] = it->prefs.target_block_net_usage_pct;
max_transaction_net_usage[n] = it->prefs.max_transaction_net_usage;
base_per_transaction_net_usage[n] = it->prefs.base_per_transaction_net_usage;
context_free_discount_net_usage_num[n] = it->prefs.context_free_discount_net_usage_num;
context_free_discount_net_usage_den[n] = it->prefs.context_free_discount_net_usage_den;
max_block_cpu_usage[n] = it->prefs.max_block_cpu_usage;
target_block_cpu_usage_pct[n] = it->prefs.target_block_cpu_usage_pct;
max_transaction_cpu_usage[n] = it->prefs.max_transaction_cpu_usage;
base_per_transaction_cpu_usage[n] = it->prefs.base_per_transaction_cpu_usage;
base_per_action_cpu_usage[n] = it->prefs.base_per_action_cpu_usage;
base_setcode_cpu_usage[n] = it->prefs.base_setcode_cpu_usage;
per_signature_cpu_usage[n] = it->prefs.per_signature_cpu_usage;
context_free_discount_cpu_usage_num[n] = it->prefs.context_free_discount_cpu_usage_num;
context_free_discount_cpu_usage_den[n] = it->prefs.context_free_discount_cpu_usage_den;
max_transaction_lifetime[n] = it->prefs.max_transaction_lifetime;
deferred_trx_expiration_window[n] = it->prefs.deferred_trx_expiration_window;
max_transaction_delay[n] = it->prefs.max_transaction_delay;
max_inline_action_size[n] = it->prefs.max_inline_action_size;
max_inline_action_depth[n] = it->prefs.max_inline_action_depth;
max_authority_depth[n] = it->prefs.max_authority_depth;
max_generated_transaction_count[n] = it->prefs.max_generated_transaction_count;
max_storage_size[n] = it->prefs.max_storage_size;
storage_reserve_ratio[n] = it->prefs.storage_reserve_ratio;
percent_of_max_inflation_rate[n] = it->prefs.percent_of_max_inflation_rate;
*/
++
n
;
}
}
...
...
@@ -285,42 +221,10 @@ namespace eosiosystem {
// should use producer_schedule_type from libraries/chain/include/eosio/chain/producer_schedule.hpp
bytes
packed_schedule
=
pack
(
schedule
);
set_active_producers
(
packed_schedule
.
data
(),
packed_schedule
.
size
()
);
// size_t median = n/2;
global_state_singleton
gs
(
_self
,
_self
);
auto
parameters
=
gs
.
exists
()
?
gs
.
get
()
:
get_default_parameters
();
/*
parameters.max_block_net_usage = max_block_net_usage[median];
parameters.target_block_net_usage_pct = target_block_net_usage_pct[median];
parameters.max_transaction_net_usage = max_transaction_net_usage[median];
parameters.base_per_transaction_net_usage = base_per_transaction_net_usage[median];
parameters.context_free_discount_net_usage_num = context_free_discount_net_usage_num[median];
parameters.context_free_discount_net_usage_den = context_free_discount_net_usage_den[median];
parameters.max_block_cpu_usage = max_block_cpu_usage[median];
parameters.target_block_cpu_usage_pct = target_block_cpu_usage_pct[median];
parameters.max_transaction_cpu_usage = max_transaction_cpu_usage[median];
parameters.base_per_transaction_cpu_usage = base_per_transaction_cpu_usage[median];
parameters.base_per_action_cpu_usage = base_per_action_cpu_usage[median];
parameters.base_setcode_cpu_usage = base_setcode_cpu_usage[median];
parameters.per_signature_cpu_usage = per_signature_cpu_usage[median];
parameters.context_free_discount_cpu_usage_num = context_free_discount_cpu_usage_num[median];
parameters.context_free_discount_cpu_usage_den = context_free_discount_cpu_usage_den[median];
parameters.max_transaction_lifetime = max_transaction_lifetime[median];
parameters.deferred_trx_expiration_window = deferred_trx_expiration_window[median];
parameters.max_transaction_delay = max_transaction_delay[median];
parameters.max_inline_action_size = max_inline_action_size[median];
parameters.max_inline_action_depth = max_inline_action_depth[median];
parameters.max_authority_depth = max_authority_depth[median];
parameters.max_generated_transaction_count = max_generated_transaction_count[median];
parameters.max_storage_size = max_storage_size[median];
parameters.storage_reserve_ratio = storage_reserve_ratio[median];
parameters.percent_of_max_inflation_rate = percent_of_max_inflation_rate[median];
*/
// not voted on
parameters
.
first_block_time_in_cycle
=
cycle_time
;
...
...
libraries/chain/include/eosio/chain/transaction_metadata.hpp
浏览文件 @
4f37b2f7
...
...
@@ -24,8 +24,8 @@ class transaction_metadata {
std
::
function
<
void
(
const
transaction_trace_ptr
&
)
>
on_result
;
transaction_metadata
(
const
signed_transaction
&
t
)
:
trx
(
t
),
packed_trx
(
t
,
packed_transaction
::
zlib
)
{
transaction_metadata
(
const
signed_transaction
&
t
,
packed_transaction
::
compression_type
c
=
packed_transaction
::
none
)
:
trx
(
t
),
packed_trx
(
t
,
c
)
{
id
=
trx
.
id
();
//raw_packed = fc::raw::pack( static_cast<const transaction&>(trx) );
signed_id
=
digest_type
::
hash
(
packed_trx
);
...
...
libraries/testing/include/eosio/testing/tester.hpp
浏览文件 @
4f37b2f7
...
...
@@ -155,10 +155,6 @@ namespace eosio { namespace testing {
void
set_code
(
account_name
name
,
const
vector
<
uint8_t
>
wasm
);
void
set_abi
(
account_name
name
,
const
char
*
abi_json
);
unique_ptr
<
controller
>
control
;
std
::
map
<
chain
::
public_key_type
,
chain
::
private_key_type
>
block_signing_private_keys
;
bool
chain_has_transaction
(
const
transaction_id_type
&
txid
)
const
;
const
transaction_receipt
&
get_transaction_receipt
(
const
transaction_id_type
&
txid
)
const
;
...
...
@@ -166,59 +162,71 @@ namespace eosio { namespace testing {
const
symbol
&
asset_symbol
,
const
account_name
&
account
)
const
;
vector
<
char
>
get_row_by_account
(
uint64_t
code
,
uint64_t
scope
,
uint64_t
table
,
const
account_name
&
act
);
vector
<
char
>
get_row_by_account
(
uint64_t
code
,
uint64_t
scope
,
uint64_t
table
,
const
account_name
&
act
);
static
vector
<
uint8_t
>
to_uint8_vector
(
const
string
&
s
);
static
vector
<
uint8_t
>
to_uint8_vector
(
const
string
&
s
);
static
vector
<
uint8_t
>
to_uint8_vector
(
uint64_t
x
);
static
vector
<
uint8_t
>
to_uint8_vector
(
uint64_t
x
);
static
uint64_t
to_uint64
(
fc
::
variant
x
);
static
uint64_t
to_uint64
(
fc
::
variant
x
);
static
string
to_string
(
fc
::
variant
x
);
static
string
to_string
(
fc
::
variant
x
);
static
action_result
success
()
{
return
string
();
}
static
action_result
success
()
{
return
string
();
}
static
action_result
error
(
const
string
&
msg
)
{
return
msg
;
}
static
action_result
error
(
const
string
&
msg
)
{
return
msg
;
}
auto
get_resolver
()
{
return
[
this
](
const
account_name
&
name
)
->
optional
<
abi_serializer
>
{
try
{
const
auto
&
accnt
=
control
->
db
().
get
<
account_object
,
by_name
>
(
name
);
abi_def
abi
;
if
(
abi_serializer
::
to_abi
(
accnt
.
abi
,
abi
))
{
return
abi_serializer
(
abi
);
}
return
optional
<
abi_serializer
>
();
}
FC_RETHROW_EXCEPTIONS
(
error
,
"Failed to find or parse ABI for ${name}"
,
(
"name"
,
name
))
};
}
auto
get_resolver
()
{
return
[
this
](
const
account_name
&
name
)
->
optional
<
abi_serializer
>
{
try
{
const
auto
&
accnt
=
control
->
db
().
get
<
account_object
,
by_name
>
(
name
);
abi_def
abi
;
if
(
abi_serializer
::
to_abi
(
accnt
.
abi
,
abi
))
{
return
abi_serializer
(
abi
);
}
return
optional
<
abi_serializer
>
();
}
FC_RETHROW_EXCEPTIONS
(
error
,
"Failed to find or parse ABI for ${name}"
,
(
"name"
,
name
))
};
}
void
sync_with
(
base_tester
&
other
);
void
sync_with
(
base_tester
&
other
);
const
table_id_object
*
find_table
(
name
code
,
name
scope
,
name
table
);
const
table_id_object
*
find_table
(
name
code
,
name
scope
,
name
table
);
// method treats key as a name type, if this is not appropriate in your case, pass require == false and report the correct behavior
template
<
typename
Object
>
bool
get_table_entry
(
Object
&
obj
,
account_name
code
,
account_name
scope
,
account_name
table
,
uint64_t
key
,
bool
require
=
true
)
{
auto
*
maybe_tid
=
find_table
(
code
,
scope
,
table
);
if
(
maybe_tid
==
nullptr
)
BOOST_FAIL
(
"table for code=
\"
"
+
code
.
to_string
()
+
"
\"
scope=
\"
"
+
scope
.
to_string
()
+
"
\"
table=
\"
"
+
table
.
to_string
()
+
"
\"
does not exist"
);
// method treats key as a name type, if this is not appropriate in your case, pass require == false and report the correct behavior
template
<
typename
Object
>
bool
get_table_entry
(
Object
&
obj
,
account_name
code
,
account_name
scope
,
account_name
table
,
uint64_t
key
,
bool
require
=
true
)
{
auto
*
maybe_tid
=
find_table
(
code
,
scope
,
table
);
if
(
maybe_tid
==
nullptr
)
{
BOOST_FAIL
(
"table for code=
\"
"
+
code
.
to_string
()
+
"
\"
scope=
\"
"
+
scope
.
to_string
()
+
"
\"
table=
\"
"
+
table
.
to_string
()
+
"
\"
does not exist"
);
}
auto
*
o
=
control
->
db
().
find
<
key_value_object
,
by_scope_primary
>
(
boost
::
make_tuple
(
maybe_tid
->
id
,
key
));
if
(
o
==
nullptr
)
{
if
(
require
)
BOOST_FAIL
(
"object does not exist for primary_key=
\"
"
+
name
(
key
).
to_string
()
+
"
\"
"
);
auto
*
o
=
control
->
db
().
find
<
key_value_object
,
by_scope_primary
>
(
boost
::
make_tuple
(
maybe_tid
->
id
,
key
));
if
(
o
==
nullptr
)
{
if
(
require
)
BOOST_FAIL
(
"object does not exist for primary_key=
\"
"
+
name
(
key
).
to_string
()
+
"
\"
"
);
return
false
;
}
return
false
;
}
fc
::
raw
::
unpack
(
o
->
value
.
data
(),
o
->
value
.
size
(),
obj
);
return
true
;
}
fc
::
raw
::
unpack
(
o
->
value
.
data
(),
o
->
value
.
size
(),
obj
);
return
true
;
}
protected:
protected:
signed_block_ptr
_produce_block
(
fc
::
microseconds
skip_time
,
bool
skip_pending_trxs
=
false
,
uint32_t
skip_flag
=
0
);
// Fields:
protected:
// tempdir field must come before control so that during destruction the tempdir is deleted only after controller finishes
fc
::
temp_directory
tempdir
;
public:
unique_ptr
<
controller
>
control
;
std
::
map
<
chain
::
public_key_type
,
chain
::
private_key_type
>
block_signing_private_keys
;
protected:
controller
::
config
cfg
;
map
<
transaction_id_type
,
transaction_receipt
>
chain_transactions
;
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录