Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
034679e3
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,发现更多精彩内容 >>
提交
034679e3
编写于
2月 15, 2018
作者:
B
Bucky Kittinger
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Cleaned up a bit
上级
a59f2ca1
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
27 addition
and
92 deletion
+27
-92
contracts/eosiolib/account.hpp
contracts/eosiolib/account.hpp
+1
-1
contracts/test_api/test_api.cpp
contracts/test_api/test_api.cpp
+4
-1
contracts/test_api/test_api.hpp
contracts/test_api/test_api.hpp
+4
-0
contracts/test_api/test_privileged.cpp
contracts/test_api/test_privileged.cpp
+0
-0
libraries/chain/wasm_interface.cpp
libraries/chain/wasm_interface.cpp
+4
-45
tests/api_tests/api_tests.cpp
tests/api_tests/api_tests.cpp
+14
-45
未找到文件。
contracts/eosiolib/account.hpp
浏览文件 @
034679e3
...
...
@@ -72,7 +72,7 @@ struct PACKED(account_balance) {
* @param account_balance stream to write
* @ret true if account's balance is found
*/
bool
get
(
account_balance
&
b
)
{
bool
get
(
account_name
currency
,
account_balance
&
b
)
{
// return account_balance_get(&b, sizeof(account_balance));
}
...
...
contracts/test_api/test_api.cpp
浏览文件 @
034679e3
...
...
@@ -16,7 +16,7 @@
#include "test_crypto.cpp"
#include "test_chain.cpp"
#include "test_transaction.cpp"
//#include "test_priviled
ged.cpp"
#include "test_privile
ged.cpp"
#include "test_checktime.cpp"
extern
"C"
{
...
...
@@ -138,6 +138,9 @@ extern "C" {
// test checktime
WASM_TEST_HANDLER
(
test_checktime
,
checktime_pass
);
WASM_TEST_HANDLER
(
test_checktime
,
checktime_failure
);
//test privileged
WASM_TEST_HANDLER
(
test_privileged
,
test_is_privileged
);
#if 0
// test account
WASM_TEST_HANDLER(test_account, test_balance_acc1);
...
...
contracts/test_api/test_api.hpp
浏览文件 @
034679e3
...
...
@@ -237,3 +237,7 @@ struct test_checktime {
static
void
checktime_pass
();
static
void
checktime_failure
();
};
struct
test_privileged
{
static
void
test_is_privileged
();
};
contracts/test_api/test_privile
d
ged.cpp
→
contracts/test_api/test_privileged.cpp
浏览文件 @
034679e3
文件已移动
libraries/chain/wasm_interface.cpp
浏览文件 @
034679e3
...
...
@@ -1242,39 +1242,6 @@ class compiler_builtins : public context_aware_api {
static
constexpr
uint32_t
SHIFT_WIDTH
=
(
sizeof
(
uint64_t
)
*
8
)
-
1
;
};
#if 0
class account_api : public context_aware_api {
public:
using context_aware_api::context_aware_api;
PACKED_STRUCT (
account_balance {
account_name account;
asset balance;
})
bool account_balance_get(array_ptr<const char> balance, uint32_t len) {
account_balance* acc_balance = (account_balance*)balance.value();
const auto* tbl = context.db.find<contracts::table_id_object, contracts::by_code_scope_table>(boost::make_tuple(code, acc_balance.account, N(account)));
share_type result = 0;
// the balance is implied to be 0 if either the table or row does not exist
if (tbl) {
const auto *obj = context.db.find<contracts::key_value_object, contracts::by_scope_primary>(boost::make_tuple(tbl->id, asset_symbol.value()));
if (obj) {
fc::datastream<const char *> ds(obj->value.data(), obj->value.size());
fc::raw::unpack(ds, result);
}
}
return true; //asset(result, asset_symbol);
/*
const uint32_t account_balance_size = sizeof(account_balance);
auto mem = Runtime::getDefaultMemory(code.instance);
FC_ASSERT(len == account_balance_size, "passed in len ${len} is not equal to the size of an account_balance struct == ${real_len}", ("len",len)("real_len",account_balance_size));
account_balance& total_balance = memoryRef<account_balance>(mem, balance);
*/
}
};
#endif
class
math_api
:
public
context_aware_api
{
public:
using
context_aware_api
::
context_aware_api
;
...
...
@@ -1427,10 +1394,10 @@ REGISTER_INTRINSICS( database_api,
REGISTER_INTRINSICS
(
crypto_api
,
(
assert_recover_key
,
void
(
int
,
int
,
int
,
int
,
int
)
)
(
recover_key
,
int
(
int
,
int
,
int
,
int
,
int
)
)
(
assert_sha256
,
void
(
int
,
int
,
int
)
)
(
assert_sha1
,
void
(
int
,
int
,
int
)
)
(
assert_sha512
,
void
(
int
,
int
,
int
)
)
(
assert_ripemd160
,
void
(
int
,
int
,
int
)
)
(
assert_sha256
,
void
(
int
,
int
,
int
)
)
(
assert_sha1
,
void
(
int
,
int
,
int
)
)
(
assert_sha512
,
void
(
int
,
int
,
int
)
)
(
assert_ripemd160
,
void
(
int
,
int
,
int
)
)
(
sha1
,
void
(
int
,
int
,
int
)
)
(
sha256
,
void
(
int
,
int
,
int
)
)
(
sha512
,
void
(
int
,
int
,
int
)
)
...
...
@@ -1447,12 +1414,6 @@ REGISTER_INTRINSICS(system_api,
(
now
,
int
())
);
/*
REGISTER_INTRINSICS(account_api,
(account_balance_get, int(int, int32_t) )
);
*/
REGISTER_INTRINSICS
(
action_api
,
(
read_action
,
int
(
int
,
int
)
)
(
action_size
,
int
()
)
...
...
@@ -1497,8 +1458,6 @@ REGISTER_INTRINSICS(memory_api,
(
sbrk
,
int
(
int
)
)
);
#define DB_METHOD_SEQ(SUFFIX) \
(store, int32_t(int64_t, int64_t, int64_t, int, int), "store_"#SUFFIX ) \
(update, int32_t(int64_t, int64_t, int64_t, int, int), "update_"#SUFFIX ) \
...
...
tests/api_tests/api_tests.cpp
浏览文件 @
034679e3
...
...
@@ -202,51 +202,6 @@ uint32_t last_fnc_err = 0;
}
#if 0
// TODO missing intrinsic account_balance_get
/*************************************************************************************
* account_tests test case
*************************************************************************************/
BOOST_FIXTURE_TEST_CASE(account_tests, tester) { try {
produce_blocks(2);
create_account( N(testapi), asset::from_string("1000.0000 EOS") );
create_account( N(acc1), asset::from_string("0.0000 EOS") );
create_account( N(acc2), asset::from_string("0.0000 EOS") );
produce_blocks(1000);
transfer( N(inita), N(testapi), "100.0000 EOS", "memo" );
//transfer( N(inita), N(acc1), "1000.0000 EOS", "test");
#if 0
eosio::chain::signed_transaction trx;
trx.write_scope = { N(acc1), N(inita) };
trx.actions.emplace_back(vector<permission_level>{{N(inita), config::active_name}},
contracts::transfer{N(inita), N(acc1), 1000, "memo"});
trx.expiration = control->head_block_time() + fc::seconds(100);
trx.set_reference_block(control->head_block_id());
trx.sign(get_private_key(N(inita), "active"), chain_id_type());
push_transaction(trx);
#endif
produce_blocks(1000);
set_code( N(testapi), test_api_wast );
produce_blocks(1);
transfer( N(inita), N(acc1), "24.0000 EOS", "memo" );
produce_blocks(1000);
BOOST_CHECK_EQUAL(get_balance(N(acc1)), 240000);
transfer( N(inita), N(acc1), "1.0000 EOS", "memo" );
produce_blocks(1000);
BOOST_CHECK_EQUAL(get_balance(N(acc1)), 250000);
transfer( N(inita), N(acc1), "5000.0000 EOS", "memo" );
BOOST_CHECK_EQUAL(get_balance(N(acc1)), 50250000);
} FC_LOG_AND_RETHROW() }
#endif
/*************************************************************************************
* action_tests test case
*************************************************************************************/
...
...
@@ -1015,5 +970,19 @@ BOOST_FIXTURE_TEST_CASE(types_tests, tester) { try {
CALL_TEST_FUNCTION
(
*
this
,
"test_types"
,
"name_class"
,
{});
}
FC_LOG_AND_RETHROW
()
}
/*************************************************************************************
* privileged_tests test case
*************************************************************************************/
BOOST_FIXTURE_TEST_CASE
(
privileged_tests
,
tester
)
{
try
{
produce_blocks
(
2
);
create_account
(
N
(
testapi
)
);
create_account
(
N
(
acc1
)
);
produce_blocks
(
100
);
set_code
(
N
(
testapi
),
test_api_wast
);
produce_blocks
(
1
);
CALL_TEST_FUNCTION
(
*
this
,
"test_privileged"
,
"test_is_privileged"
,
{});
}
FC_LOG_AND_RETHROW
()
}
BOOST_AUTO_TEST_SUITE_END
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录