mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Various changes in TVM, github builds and tests (#793)
* Bugfixes in TVM and node * Upgrade to C++17 * Improve GitHub builds * Fix existing tests and partially integrate them into builds --------- Co-authored-by: neodiX42 <namlem@gmail.com> Co-authored-by: EmelyanenkoK <emelyanenko.kirill@gmail.com>
This commit is contained in:
parent
89700cb2aa
commit
5847897b37
122 changed files with 2889 additions and 4100 deletions
|
@ -33,7 +33,7 @@ std::string load_test(std::string name) {
|
|||
return td::read_file_str(current_dir() + "fift/" + name).move_as_ok();
|
||||
}
|
||||
|
||||
td::Status run_fift(std::string name, bool expect_error = false, bool preload_fift = true) {
|
||||
td::Status run_fift(std::string name, bool expect_error = false) {
|
||||
auto res = fift::mem_run_fift(load_test(name));
|
||||
if (expect_error) {
|
||||
res.ensure_error();
|
||||
|
|
|
@ -9,6 +9,9 @@
|
|||
[[ <{ RIST255_MULBASE DUP RIST255_VALIDATE }>s ]] 0 runvmx abort"Exitcode != 0"
|
||||
@' n . dup (x.) type cr
|
||||
@' ans <> abort"Invalid result"
|
||||
@' n
|
||||
[[ <{ 1 INT RIST255_MULBASE SWAP RIST255_MUL DUP RIST255_VALIDATE }>s ]] 0 runvmx abort"Exitcode != 0"
|
||||
@' ans <> abort"Invalid result"
|
||||
} : test-basepoint
|
||||
|
||||
0 0x0000000000000000000000000000000000000000000000000000000000000000 test-basepoint
|
||||
|
|
|
@ -180,7 +180,7 @@ struct MixedRadix {
|
|||
|
||||
template <int M>
|
||||
const MixedRadix<M>& as_shorter() const {
|
||||
static_assert(M <= N);
|
||||
static_assert(M <= N,"error");
|
||||
return *reinterpret_cast<const MixedRadix<M>*>(this);
|
||||
}
|
||||
|
||||
|
@ -458,7 +458,7 @@ struct ModArray {
|
|||
}
|
||||
template <int M>
|
||||
ModArray(const ModArray<M>& other) {
|
||||
static_assert(M >= N);
|
||||
static_assert(M >= N,"error");
|
||||
std::copy(other.a, other.a + N, a);
|
||||
}
|
||||
ModArray(const int* p) : a(p) {
|
||||
|
@ -819,7 +819,7 @@ struct ModArray {
|
|||
|
||||
template <int M>
|
||||
const ModArray<M>& as_shorter() const {
|
||||
static_assert(M <= N);
|
||||
static_assert(M <= N,"error");
|
||||
return *reinterpret_cast<const ModArray<M>*>(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,12 +16,12 @@
|
|||
*/
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <array>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <random>
|
||||
#include <getopt.h>
|
||||
#include "common/refcnt.hpp"
|
||||
#include "common/bigint.hpp"
|
||||
#include "common/refint.h"
|
||||
|
@ -211,7 +211,7 @@ bool coin() {
|
|||
|
||||
// returns 0 with probability 1/2, 1 with prob. 1/4, ..., k with prob. 1/2^(k+1)
|
||||
int randexp(int max = 63, int min = 0) {
|
||||
return min + __builtin_clzll(Random() | (1ULL << (63 - max + min)));
|
||||
return min + td::count_leading_zeroes64(Random() | (1ULL << (63 - max + min)));
|
||||
}
|
||||
|
||||
void bin_add_small(unsigned char bin[64], long long val, int shift = 0) {
|
||||
|
@ -363,7 +363,7 @@ void check_one_int_repr(td::RefInt256 x, int mode, int in_range, const BInt* val
|
|||
if (is_small) {
|
||||
// special check for small (64-bit) values
|
||||
CHECK(x->to_long() == xval);
|
||||
CHECK((long long)__builtin_bswap64(*(long long*)(bytes + 64 - 8)) == xval);
|
||||
CHECK((long long)td::bswap64(*(long long*)(bytes + 64 - 8)) == xval);
|
||||
CHECK(in_range);
|
||||
// check sign
|
||||
CHECK(x->sgn() == (xval > 0 ? 1 : (xval < 0 ? -1 : 0)));
|
||||
|
|
|
@ -127,12 +127,12 @@ class BenchSha256Low : public td::Benchmark {
|
|||
|
||||
void run(int n) override {
|
||||
int res = 0;
|
||||
SHA256_CTX ctx;
|
||||
td::Sha256State ctx;
|
||||
for (int i = 0; i < n; i++) {
|
||||
SHA256_Init(&ctx);
|
||||
SHA256_Update(&ctx, "abcd", 4);
|
||||
ctx.init();
|
||||
ctx.feed("abcd");
|
||||
unsigned char buf[32];
|
||||
SHA256_Final(buf, &ctx);
|
||||
ctx.extract(td::MutableSlice{buf, 32});
|
||||
res += buf[0];
|
||||
}
|
||||
td::do_not_optimize_away(res);
|
||||
|
|
|
@ -958,7 +958,7 @@ class MapDns {
|
|||
}
|
||||
return;
|
||||
}
|
||||
if (!actions.category.is_zero()) {
|
||||
if (actions.category.is_zero()) {
|
||||
entries_.erase(actions.name);
|
||||
LOG(ERROR) << "CLEAR " << actions.name;
|
||||
if (!actions.actions) {
|
||||
|
@ -1003,7 +1003,7 @@ class CheckedDns {
|
|||
explicit CheckedDns(bool check_smc = true, bool check_combine = true) {
|
||||
if (check_smc) {
|
||||
key_ = td::Ed25519::generate_private_key().move_as_ok();
|
||||
dns_ = ManualDns::create(ManualDns::create_init_data_fast(key_.value().get_public_key().move_as_ok(), 123));
|
||||
dns_ = ManualDns::create(ManualDns::create_init_data_fast(key_.value().get_public_key().move_as_ok(), 123), -1);
|
||||
}
|
||||
if (check_combine) {
|
||||
combined_map_dns_ = MapDns();
|
||||
|
@ -1094,9 +1094,10 @@ class CheckedDns {
|
|||
}
|
||||
};
|
||||
|
||||
static td::Bits256 intToCat(int x) {
|
||||
td::Bits256 cat = td::Bits256::zero();
|
||||
cat.as_slice().copy_from(td::Slice((char*)&x, sizeof(x)));
|
||||
static td::Bits256 intToCat(td::uint32 x) {
|
||||
auto y = td::make_refint(x);
|
||||
td::Bits256 cat;
|
||||
y->export_bytes(cat.data(), 32, false);
|
||||
return cat;
|
||||
}
|
||||
|
||||
|
@ -1182,7 +1183,7 @@ TEST(Smartcont, DnsManual) {
|
|||
|
||||
auto key = td::Ed25519::generate_private_key().move_as_ok();
|
||||
|
||||
auto manual = ManualDns::create(ManualDns::create_init_data_fast(key.get_public_key().move_as_ok(), 123));
|
||||
auto manual = ManualDns::create(ManualDns::create_init_data_fast(key.get_public_key().move_as_ok(), 123), -1);
|
||||
CHECK(manual->get_wallet_id().move_as_ok() == 123);
|
||||
auto init_query = manual->create_init_query(key).move_as_ok();
|
||||
LOG(ERROR) << "A";
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "td/utils/StringBuilder.h"
|
||||
|
||||
std::string run_vm(td::Ref<vm::Cell> cell) {
|
||||
vm::init_op_cp0();
|
||||
vm::init_vm().ensure();
|
||||
vm::DictionaryBase::get_empty_dictionary();
|
||||
|
||||
class Logger : public td::LogInterface {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue