Commit Graph

310 Commits

Author SHA1 Message Date
Chalith Desaman
05e8077e5b Persisting hpfs log responses to the hpfs (#291)
Fixing the in memory raw shard hash update.
Passing the seq_no of index update to verify that the index records are consistent.
Restart rw session after completing last primary shard sync.
Fixed issue in fs read write by multiple threads.
Hpfs log sync modifications.
2021-04-16 20:06:20 +05:30
Ravin Perera
2283d2bf89 Performed ledger input output writing inside a transaction. (#290) 2021-04-13 12:34:38 +05:30
Ravin Perera
7a837ede7c Supported not storing raw data shards. (#289) 2021-04-13 11:11:37 +05:30
Ravin Perera
77279dc6ac Updated proposal time checks. (#288) 2021-04-13 11:06:58 +05:30
Ravin Perera
83bb158dd3 Fixed integer serialization issue with bson. (#287) 2021-04-12 07:15:57 +05:30
Ravin Perera
370e03fe84 Switched user input nonce from string to uint64. (#286) 2021-04-11 14:51:57 +05:30
Ravin Perera
3941f5f6c6 Revamped ledger input/output storage and query execution. (#285)
- Ledger sqlite db improvements.
- Removed flatbuffers from ledger blob data storage.
- Added consensus private mode blob data filtration.
2021-04-11 11:45:14 +05:30
Ravin Perera
0a3183a3d6 Included output hash and ledger info in output return message. (#284) 2021-04-08 10:42:33 +05:30
Ravin Perera
d4646179c2 Returned input hash and ledger info for input submissions. (#283)
- Introduced input hash which can later be used to query the ledger.
- Returned input hash and ledger info at input submission.
- Updated js client lib to support input hash.
- Updated consensus proposal candidate expiration rules.
2021-04-07 21:22:29 +05:30
Savinda Senevirathne
137d7633e0 Updated hpfs binary and its relevant hpcore changes. (#282)
* Hpfs index file is updated to match the file with the hpfs version.
* Added updated hpfs binary.
* Version log changes because Plog is not initialized at the time of version init.
2021-04-02 10:36:29 +05:30
Chalith Desaman
5833431157 hpfs binary update, hpfs log serving and passing to hpfs (#281)
* full history announcement in peer challenge and ability to send random messages only to full history nodes.

* log sync infrastructure codes.

* Resolving merge conflict  induced errors.

* Fork detection implementation.

* Cleanup.

* Resolving PR comments.

* hpfs binary update, hpfs log serving and persisting

* Fixed merge conflict and added missing log

Co-authored-by: Savinda Senevirathne <savindadilsara@gmail.com>
2021-04-01 17:13:58 +05:30
Ravin Perera
bba5266f5d Fixed consensus issues with large no. of users and inputs. (#280)
* Fixed issue in consensus contract output  sorting.

* Improved load test script.

* Removed flatbuffer verifier restrictions to support large no. of users and inputs.

* Improved consensus proposal cleanup.

* Restored the earlier proposal cleanup logic.

* Minor fixes.

* const fix.
2021-04-01 17:12:39 +05:30
Savinda Senevirathne
af48f3b01f Hpfs log file sync and fork detection. (#279)
Basic infrastructure for log file sync.
A fork is detected by comparing the hpfs log index file against the ledger.
Min and max ledger sequence hashes are sent to a full history node to request log history.
2021-04-01 13:08:29 +05:30
Ravin Perera
99c5912f14 Version management refactor. (#278)
- Introduced separate versioning for ledger file storage.
- Refactored versioning information code base.
2021-03-31 10:19:12 +05:30
Ravin Perera
ef42d4c986 Ledger query results raw input/output support. (#277) 2021-03-30 15:44:20 +05:30
Savinda Senevirathne
140b2f80fd Truncate log and hpfs index file from given sequence number. (#276)
- Truncation is invoked by making truncate system call on /hpfs::index.<seq_no> file.
- Updating hpfs binary.
- Truncation waits until any active RW and RO sessions are finished.
2021-03-29 13:22:55 +05:30
Ravin Perera
948113398c Ledger query infrastructure. (#275)
* Added json ledger query param parser.

* Added initial query response creation.

* Updated client lib.

* Implemented get ledger by seq no.

* Added ledger query execution wrappers.

* Included log record info.

* Fixed empty output hash issue.

* Added bson support.

* Added db file existance check.

* Added requesy/reply tracking for queries in client lib.

* Improved multi connection usage in client lib.

* Added genesis ledger query support.

* Updated naming convention of query result fields.

* Comments.

* Used sqlite bind() for query param.

* Used binary hashes in ledger sqlite db.

* Missing const.
2021-03-29 11:20:15 +05:30
Chalith Desaman
44fa3134ea Updating hpfs log index on ledger creation (#274) 2021-03-24 16:49:38 +05:30
Savinda Senevirathne
7cec6d01c1 Changes for unstable consensus. (#272)
* Return empty hash when set or vector is empty in crypto.

* Changing <operator in sequence_hash struct.

* Fixing vm script and allowing only single sync target per vpath.

* Making vm cluster log level to debug.

* Increasing hpws max message size and fixing lcl mode in vm cluster scripts.

* lcl block fix.
2021-03-17 12:17:50 +05:30
Chalith Desaman
b7e9301797 Formatting the hp config validation error message (#271)
* Formatting config validation error

* Camel case typo in js client lib

* Changed error message
2021-03-16 18:40:18 +05:30
Savinda Senevirathne
a3775c6864 Include failed server name and port number (Peer/user) in hpws server creation fail error (#270)
* Adding name and server name to port binding error message.

* Resolving PR comments.
2021-03-14 19:12:32 +05:30
Chalith Desaman
9999c28a37 Remove self connection on peer discovery (#269)
* Resetting last shard syncing flags when sync is abandoned. (#268)

* Remove self loopback connection when self is added by peer discovery

* Resolved PR comments

Co-authored-by: Savinda Senevirathne <savindadilsara@gmail.com>
2021-03-12 19:01:58 +05:30
Savinda Senevirathne
af4c9df9dc Resetting last shard syncing flags when sync is abandoned. 2021-03-12 17:31:57 +05:30
Savinda Senevirathne
b6a69e5824 Refresh consensus context when a roundtime change happens. (#267) 2021-03-12 16:39:26 +05:30
Chalith Desaman
00a3da9a2b Request historical shards when max shard range is increased (#266)
* Remove and request historical shards at the startup

* Shard history requesting only at the first consensus round

* Removed test log

* Skip max shard seq no file in removing loop

* Updated the code comments

* Persisting condition changed

* Fixed code comment typos

* Fixed code comment typos

* Resolved PR comments

* Halt consensus until completing only the latest shard sync

* Added meaningful comments

* Resolved PR comments and updated hpfs binary

* Logic enhancement and cleanup

* Cleanup the code comment
2021-03-12 12:13:46 +05:30
Savinda Senevirathne
b45cdb999d Include hp version number on all required places. (#265)
* Adding HP version header to binary files and adding hp table to ledger.sqlite.

* Updating hp_version in user challenge message.

* Minor improvement.
2021-03-10 20:08:04 +05:30
Chalith Desaman
1eabe7db4a Changed historical shard removing logic and removing historical shards on startup (#264)
* Changed historical shard deletion logic

* Undo a change

* Resolved PR comments
2021-03-08 17:08:02 +05:30
adheeb-adb
473fd4183c User message with more details (#263)
* user message with more details

* PR fixes
2021-03-08 12:25:29 +05:30
Chalith Desaman
2522a363c9 Changed the validation for max_connections and max_known_connections when reading the cfg (#262)
* Changed the validation for max_con and max_known_con when reading the config

* Minor comment fix

* Improved a code comment
2021-03-08 09:36:33 +05:30
Savinda Senevirathne
70a83893b0 Fixing connection not closing when threshold exceeded from a single attempt. (#261)
* Fixing connection not closing when threshold exceeded from a sigle message.

* Updated hpws binary.
2021-03-05 16:58:41 +05:30
Chalith Desaman
c426e2a30e Accept proposals and npl messages from unl nodes only (#260)
* Skip proposal and npl messages from non unl nodes

* Minor code comment change

* Resolved PR comments and Changed weakly connected status check

* Changed weakly connected status counter

* Added a comment
2021-03-05 16:42:39 +05:30
Savinda Senevirathne
1ca4784688 Updating the self pubkey in the unl list when rekey the contract. (#259)
PR approved
2021-03-05 13:49:20 +05:30
Ravin Perera
1cebcb1c35 Config runtime re-save refactor. (#258)
* Check peer discovery config when persisting peers.

* Refactored config persistance.

* Fixed config read offset issue.

* Refactored peer list structs.

* Minor constexpr.
2021-02-25 14:25:12 +05:30
Ravin Perera
5b56d9c1b3 Updated hpfs hash verification with file mode checks. (#257)
* Added file mode to hpfs responses.

* Parse file mode on hpfs response read.

* Apply file/dir mode.

* Fixed mode apply logic.

* Fixed code review comments.

* Additional fix.
2021-02-24 11:13:28 +05:30
Chalith Desaman
363116fc2a Added user input max ledger seq offset limit config (#256)
- Added new config for max input ledger offset inside contract section.
- Updated implementation of getting and updating patch config inside node and c contracts.
- Skip inputs if max ledger offset exceeds, when handling user inputs and nup messages.
2021-02-24 09:19:36 +05:30
Ravin Perera
137c199b07 P2P Flatbuffers schema refactor. (#255) 2021-02-23 13:15:03 +05:30
Chalith Desaman
312713c296 Fixed disk io error - set fds to -1 when closing in hpws parent process (#254) 2021-02-23 12:23:55 +05:30
Savinda Senevirathne
ff197a8bb6 Optimizing finding last shard sequence number. (#253)
* Optimizing finding last shard in primary and blob.

* Resolving PR comments and bug fix.

* Resolving PR comments.
2021-02-22 10:47:55 +05:30
Savinda Senevirathne
a775b0e419 Configs to support full history mode. (#252)
* Adding full history mode and max shard configs for primary and blob shards.

* Commenting validation checks for hpfs responses until bug is fixed.

* Comment update.
2021-02-19 14:45:25 +05:30
Ravin Perera
6b8d60a404 Separated lcl string usage to sequence no and hash. (#251) 2021-02-18 18:28:38 +05:30
Ravin Perera
8eac87fb85 Added smart contract upgrade support. (#250)
Supports smart contract self-upgrades by allowing "post_exec.sh" script to be executed after consensus contract execution.
2021-02-18 17:25:42 +05:30
Chalith Desaman
7059f68f11 Removed legacy lcl code and dependencies (#249) 2021-02-18 17:07:50 +05:30
Savinda Senevirathne
16c5b3fae2 Introducing ledger shards and new ledger syncing logic. (#247)
- The ledgers are stored in a sqlite database in ledger file system.
- Ledgers are organized in shards inside primary folder.
- Raw inputs are saved as shards inside blob folder. No input files are created if neither inputs nor outputs are available.
- Both last primary shard hash and last blob shard hashes are subjected to consensus and necessary sync operations are performed if out of sync.
- Hpfs sync support setting single sync targets from both ends of the list. (Targets set from front are prioritized).
- Contract and ledger syncs and serving are performed independently.
2021-02-18 11:24:05 +05:30
Ravin Perera
e394497698 Used uint32 for roundtime and timeout fields. (#248) 2021-02-17 12:21:51 +05:30
Ravin Perera
90641e0849 Persist discovered peers to config. (#246) 2021-02-16 16:20:19 +05:30
Ravin Perera
9d1163c8c3 Config flag to disable peer port listening. (#245) 2021-02-16 14:27:03 +05:30
Ravin Perera
9f4499653a Dynamic roundtime detection. (#244)
When consensus is unreliable detect roundtime based on roundtime reported by peers.
2021-02-16 13:34:29 +05:30
Ravin Perera
4c4e109233 Contract process resource limits. (#243) 2021-02-15 16:36:10 +05:30
ravinsp
3783c687a2 Improved missing config field error reporting. 2021-02-15 15:10:44 +05:30
Ravin Perera
0937ca0bbe Npl outputs round limit. (#242) 2021-02-15 14:50:03 +05:30