Skip to content

Commit

Permalink
general update + recompute request timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
madMAx43v3r committed May 16, 2023
1 parent f06414d commit 6869b46
Show file tree
Hide file tree
Showing 36 changed files with 45 additions and 25 deletions.
Binary file modified mmx-node/linux/x86_64/bin/ProofOfSpace
Binary file not shown.
Binary file modified mmx-node/linux/x86_64/bin/calc_test_rewards
Binary file not shown.
Binary file modified mmx-node/linux/x86_64/bin/chia_recompute_proxy
Binary file not shown.
Binary file modified mmx-node/linux/x86_64/bin/chia_recompute_server
Binary file not shown.
Binary file modified mmx-node/linux/x86_64/bin/dump_binary
Binary file not shown.
Binary file modified mmx-node/linux/x86_64/bin/mmx
Binary file not shown.
Binary file modified mmx-node/linux/x86_64/bin/mmx_compile
Binary file not shown.
Binary file modified mmx-node/linux/x86_64/bin/mmx_farmer
Binary file not shown.
Binary file modified mmx-node/linux/x86_64/bin/mmx_harvester
Binary file not shown.
Binary file modified mmx-node/linux/x86_64/bin/mmx_node
Binary file not shown.
Binary file modified mmx-node/linux/x86_64/bin/mmx_timelord
Binary file not shown.
Binary file modified mmx-node/linux/x86_64/bin/mmx_wallet
Binary file not shown.
Binary file modified mmx-node/linux/x86_64/bin/tx_bench
Binary file not shown.
Binary file modified mmx-node/linux/x86_64/bin/vnxclose
Binary file not shown.
Binary file modified mmx-node/linux/x86_64/bin/vnxdump
Binary file not shown.
Binary file modified mmx-node/linux/x86_64/bin/vnxgraph
Binary file not shown.
Binary file modified mmx-node/linux/x86_64/bin/vnxpasswd
Binary file not shown.
Binary file modified mmx-node/linux/x86_64/bin/vnxplay
Binary file not shown.
Binary file modified mmx-node/linux/x86_64/bin/vnxread
Binary file not shown.
Binary file modified mmx-node/linux/x86_64/bin/vnxreadcsv
Binary file not shown.
Binary file modified mmx-node/linux/x86_64/bin/vnxrecord
Binary file not shown.
Binary file modified mmx-node/linux/x86_64/bin/vnxrouter
Binary file not shown.
Binary file modified mmx-node/linux/x86_64/bin/vnxservice
Binary file not shown.
Binary file modified mmx-node/linux/x86_64/bin/vnxtimeserver
Binary file not shown.
Binary file modified mmx-node/linux/x86_64/bin/vnxtopic
Binary file not shown.
59 changes: 37 additions & 22 deletions mmx-node/linux/x86_64/include/vnx/Input.h
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,39 @@ void read(TypeInput& in, std::shared_ptr<T>& value, const TypeCode* type_code, c
template<typename T>
void read(TypeInput& in, vnx::optional<T>& value, const TypeCode* type_code, const uint16_t* code);

template<typename T>
void read_vector_data(TypeInput& in, T& vector, const TypeCode* type_code, const uint16_t* value_code, const uint32_t size) {
if(size > in.max_list_size) {
throw std::logic_error("vector size > max_list_size: " + std::to_string(size));
}
if(!in.safe_read) {
vector.resize(size);
}
if(is_equivalent<typename T::value_type>{}(value_code, type_code)) {
if(in.safe_read) {
for(uint32_t i = 0; i < size; i += VNX_BUFFER_SIZE) {
const auto chunk_size = std::min<uint32_t>(size - i, VNX_BUFFER_SIZE);
vector.resize(i + chunk_size);
in.read((char*)&vector[i], chunk_size);
}
} else {
in.read((char*)vector.data(), size * sizeof(typename T::value_type));
}
} else {
for(uint32_t i = 0; i < size; ++i) {
if(in.safe_read) {
typename T::value_type tmp;
vnx::type<typename T::value_type>().read(in, tmp, type_code, value_code);
vector.push_back(tmp);
} else {
vnx::type<typename T::value_type>().read(in, vector[i], type_code, value_code);
}
}
}
}

/// Returns dimension array and total size of a matrix (CODE_MATRIX)
size_t get_matrix_size(std::vector<size_t>& dims, const uint16_t* code);
size_t read_matrix_size(std::vector<size_t>& dims, const uint16_t* code);

/** \brief Reads a dynamically allocated N-dimensional matrix from the input stream.
*
Expand All @@ -341,15 +372,9 @@ size_t get_matrix_size(std::vector<size_t>& dims, const uint16_t* code);
*/
template<typename T>
void read_matrix(TypeInput& in, std::vector<T>& data, std::vector<size_t>& dims, const uint16_t* code) {
const auto total_size = get_matrix_size(dims, code);
if(total_size > in.max_list_size) {
throw std::logic_error("matrix size > max_list_size: " + std::to_string(total_size));
}
data.resize(total_size);
const auto total_size = read_matrix_size(dims, code);
const uint16_t* value_code = code + 2 + dims.size();
for(size_t i = 0; i < total_size; ++i) {
vnx::type<T>().read(in, data[i], nullptr, value_code);
}
read_vector_data(in, data, nullptr, value_code, total_size);
}

/**
Expand Down Expand Up @@ -389,7 +414,7 @@ void read_array(TypeInput& in, T& array, const TypeCode* type_code, const uint16
case CODE_MATRIX:
case CODE_ALT_MATRIX: {
std::vector<size_t> dims;
size = get_matrix_size(dims, code);
size = read_matrix_size(dims, code);
value_code = code + 2 + dims.size();
break;
}
Expand Down Expand Up @@ -457,7 +482,7 @@ void read_vector(TypeInput& in, T& vector, const TypeCode* type_code, const uint
case CODE_MATRIX:
case CODE_ALT_MATRIX: {
std::vector<size_t> dims;
size = get_matrix_size(dims, code);
size = read_matrix_size(dims, code);
value_code = code + 2 + dims.size();
break;
}
Expand All @@ -470,17 +495,7 @@ void read_vector(TypeInput& in, T& vector, const TypeCode* type_code, const uint
size = 1;
value_code = code;
}
if(size > in.max_list_size) {
throw std::logic_error("vector size > max_list_size: " + std::to_string(size));
}
vector.resize(size);
if(is_equivalent<typename T::value_type>{}(value_code, type_code)) {
in.read((char*)vector.data(), size * sizeof(typename T::value_type));
} else {
for(uint32_t i = 0; i < size; ++i) {
vnx::type<typename T::value_type>().read(in, vector[i], type_code, value_code);
}
}
read_vector_data(in, vector, type_code, value_code, size);
}

/// Same as read_vector<T>() with T = std::vector<T>
Expand Down
2 changes: 2 additions & 0 deletions mmx-node/linux/x86_64/include/vnx/InputStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,8 @@ class TypeInput : public InputBuffer {
*/
void clear();

bool safe_read = false; ///< to avoid pre-allocation of large buffers

size_t max_list_size = VNX_MAX_SIZE; ///< to limit maximum list size

std::unordered_map<Hash64, const TypeCode*> type_code_map; ///< for faster lock-free lookup
Expand Down
3 changes: 3 additions & 0 deletions mmx-node/linux/x86_64/include/vnx/ThreadPool.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ class ThreadPool {
/// Returns number of active non-idle threads (ie. which are doing some work)
size_t get_num_running() const;

/// Returns get_num_pending() + get_num_running()
size_t get_num_pending_total() const;

/// Trigger all threads to exit. (thread-safe)
void exit();

Expand Down
4 changes: 2 additions & 2 deletions mmx-node/linux/x86_64/include/vnx/Type.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ typedef SSIZE_T ssize_t;
* Applies to CODE_DYNAMIC.
* Absolute maximum is 255 to detect different byte order.
*/
#define VNX_MAX_BYTE_CODE_SIZE 32
#define VNX_MAX_BYTE_CODE_SIZE 32u

/** \brief The buffer size for InputBuffer and OutputBuffer.
*
* This is also the maximum combined size of all primitive fields in a struct or class.
*/
#define VNX_BUFFER_SIZE 16384
#define VNX_BUFFER_SIZE 16384u


/// VNX namespace
Expand Down
Binary file modified mmx-node/linux/x86_64/lib/libmmx_db.so
Binary file not shown.
Binary file modified mmx-node/linux/x86_64/lib/libmmx_iface.so
Binary file not shown.
Binary file modified mmx-node/linux/x86_64/lib/libmmx_modules.so
Binary file not shown.
Binary file modified mmx-node/linux/x86_64/lib/libmmx_vm.so
Binary file not shown.
Binary file modified mmx-node/linux/x86_64/lib/libvnx_addons.so
Binary file not shown.
Binary file modified mmx-node/linux/x86_64/lib/libvnx_base.so
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "GIT_COMMIT_HASH": "1bfa52a036bc9c52d801ad4085a21be6e9bfc636" }
{ "GIT_COMMIT_HASH": "48d2be445f3895d40fbe6b0db5345d494b88ea1f" }

0 comments on commit 6869b46

Please sign in to comment.