Ravidu Lashan 1238e96423 State synchronization logic (#67)
* Added flat buffer state message request

* Added state vote

* Added state to ledger history and did necessary changes

* Completed receiveing state request

* State read/write helpers.

* Added new fbs schema

* Added more state_store helper methods.

* Started processing response

* Fixed compile errors

* Added get file length.

* Handled state content response

* Statefs code cleanup and fixes.

* Completed response handling

* Completed changes in handling state response

* State sync integration fixes.

* Fuse mount waiting logic.

* Fixed state syncing issues

* state sync fixes

* fixes

* State sync fixes.

* Fixed fs entries retrieval issues.

* changed desync logic

* Added directory helper functions.

* Handled return statemetns from statefs

* Fixed state folder deletion.

* handled errors from statefs

* Working for small files

* Got state sync working.

* Removed cout.

* Fixed catering for stae issue

* Fixed block hash map flatbuf issue.

* Added expected hash

* Added helpers for expected hash comparison.

* Improved state req/resp awaiting logic.

* Fixes.

* Fixes.

* Block request ordering fix.

* Removed couts

* Closed non-closed file descriptors

* Minor fixes.

* Cluster create script changes.

* Fixed reset time off issue.
2019-12-13 10:20:41 +05:30
2019-12-13 10:20:41 +05:30
2019-12-13 10:20:41 +05:30
2019-12-13 10:20:41 +05:30
2019-12-13 10:20:41 +05:30
2019-12-13 10:20:41 +05:30

Hot Pocket Consensus Engine

What's here?

In development

A C++ version of hotpocket designed for production envrionments, original prototype here: https://github.com/codetsunami/hotpocket

Hot Pocket Wiki

Libraries

Steps to setup Hot Pocket

Install CMAKE 3.16

  1. Download and extract cmake-3.16.0-rc3-Linux-x86_64.tar.gz
  2. Navigate into the extracted directory in a terminal.
  3. Run sudo cp -r bin/* /usr/local/bin/
  4. Run sudo cp -r share/* /usr/local/share/

Install Libsodium

Instructions are based on this.

  1. Download and extract Libsodium 1.0.18 from here.
  2. Navigate to the extracted libsodium directory in a terminal.
  3. Run ./configure && make && make check
  4. Run sudo make install

Install Boost

Following Instructions are based on Boost getting started

  1. Download and extract boost 1.71 package from here.
  2. Navigate to the extracted boost directory in a terminal.
  3. Run ./bootstrap.sh
  4. Run sudo ./b2 install (This will compile and install boost libraries into your /usr/local/lib)

Install RapidJSON

  1. Download and extract RapidJSON 1.1 source from here.
  2. Navigate to the extracted directory.
  3. Run sudo cp -r include/rapidjson /usr/local/include/

Install FlatBuffers

Instructions are based on this.

  1. Clone the git respository into a new directory from here.
  2. Build with CMake
git clone https://github.com/google/flatbuffers.git
cd flatbuffers
cmake -G "Unix Makefiles"
make
  1. Run sudo cp -r include/flatbuffers /usr/local/include/
  2. Run sudo snap install flatbuffers --edge
Compiling FlatBuffers message definitions

Example: When you make a change to p2pmsg_content_.fbc defnition file, you need to run this:

flatc -o src/fbschema/ --gen-mutable --cpp src/fbschema/p2pmsg_content.fbs

Install OpenSSL

  1. Download and extract OpenSSL-1.1.1d source from here.
  2. Navigate to the extracted directory.
  3. Run ./config && make
  4. Run sudo make install

Install libfuse

  1. sudo apt-get install -y meson ninja-build pkg-config
  2. Download libfuse 3.8 and extract.
  3. mkdir build; cd build
  4. meson .. && ninja
  5. sudo ninja install

Run ldconfig

sudo ldconfig

This will update your linker library cache and avoid potential issues when running your compiled C++ program which links to newly installed libraries.

Build and run Hot Pocket

  1. Navigate to hotpocket repo root.
  2. Run cmake . (You only have to do this once)
  3. Run make (Hot Pocket binary will be created as ./build/hpcore)
  4. Refer to Running Hot Pocket in the Wiki.

Refer to Hot Pocket Wiki for more info.

Code structure

Code is divided into subsystems via namespaces.

conf:: Handles contract configuration. Loads and holds the central configuration object. Used by most of the subsystems.

crypto:: Handles cryptographic activities. Wraps libsodium and offers convenience functions.

proc:: Handles contract process execution and managing user/SC I/O and npl I/O. Makes use of usr and p2p.

usr:: Handles user connections. Makes use of crypto and sock.

p2p:: Handles peer-to-peer connections and message exchange between nodes. Makes use of crypto and sock.

cons:: Handles consensus and proposal rounds. Makes use of usr, p2p and proc

sock:: Handles generic web sockets functionality. Mainly acts as a wrapper for boost/beast.

util:: Contains shared data structures/helper functions used by multiple subsystems.

statefs:: Fuse-based state filesystem monitoring and contract state maintenence subsystem.

Description
Consensus Engine for Codius, Linux and Mac Hosts
Readme 19 MiB
Languages
C++ 92.9%
Shell 4.5%
JavaScript 2%
CMake 0.4%
C 0.1%