Skip to content

[ Stabilize ] Optimization and bug fixes #1312

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 131 commits into from
Nov 13, 2020
Merged

[ Stabilize ] Optimization and bug fixes #1312

merged 131 commits into from
Nov 13, 2020

Conversation

astaphobia
Copy link
Contributor

@astaphobia astaphobia commented Oct 22, 2020

Description

Start from Sep 10 - Oct 22 2020 we had alot bug fixes and enhancements to optimizing speed and memory usages.

Enhancements:

  • Account type format, this is the biggest one 1204 account type bytes in db #1245
  • Refactor signature bytes:
    • Remove 4 bytes before signature: signature length is now a property of (sender) account type
    • Remove first 4 bytes 'in' the signature: signature type is now a property of (sender) account type
  • Cache storage of some part/data that can speed up thread and some process in zoobc-core, some of them is:
    1. Last block state
    2. Mempool transactions
    3. Scrambled nodes
    4. Block objects only some fields that needed
    5. Backup mempool when rollback happened
    6. Node shards snapshot process part
    7. Node registries
    8. Node address infos
    9. Receipts pool that was received
    10. Last Merkle Root
  • Merkle root in SpineBlock
  • Allow all transaction types with escrow part, added new event ledgers as well.
  • Enhancement receipt validation
  • SpineBlock - completing validate merkle root
  • New coinbase winner selection algorithm
  • Add metric for time consumed by PushBlock
  • Transaction has message fields:
    • tx message is expressed in bytes, not as string: core node is agnostic about the message encoding and stores tx messages as BLOB in db
    • to build/parse a transaction:
      • add 4 bytes before transaction signature (message length) when creating a transaction and read them to get the message length when parsing transaction bytes into a transaction object/model
      • write the message as bytes (when creating a transaction) and read them as bytes when parsing (logic to encode the message into its original format is demanded to the client application)
  • Sync node address info send addresses in bulk
  • Optimize nodeAddressInfo validation by avoiding signature check before other light validation done.
  • Validate NodePublicKey on decrypting certificate.json file
  • MerkleTree now accept any n > 1 number of variable.
  • GetNodeTime API for checking time between client and node.
  • Remove BadgerDB, shrink down memory usages
  • Reduce workload when checking length & existing peers node on P2P
  • Remove package github.com/mohae/deepcopy and use marshal from encoding/json as a substitute

Bug fixes:

  • Fix ticker leaks on the scheduler
  • Node receipts query rollback
  • Fix database transaction called in a big loop
  • Security-Fix: use zed for a block seed value.
  • Fix: sort Spinechain genesis spine public keys
  • Fix: remove backup mempool when fail to restore

Reference schema

zoobc/zoobc-schema#167

andy-shi88 and others added 30 commits September 10, 2020 09:45
* #1145 inject nodeAuthValidation to typeSwitcher

* #1145 remove duplicate initialization

* #1145 call transaction general validation in multisig inner transaction

* #1145 add missing feescale division
* initiate receipt reminder storage

* remove unused codes

* fix nil allocation of map

* receipt reminder only need receipt key and chaintype

* fnished mempool backup and receipt reminder cache storage

* fnished mempool backup and receipt reminder cache storage

* remove println code and remove badger db from go.mod

* fix warning line exceded

* remove badger key from config.toml

* Update loadConfig to let nomad pass a full path to resource folder

* Node status (#1170)

* update healthcheck service : add node status endpoint

* Fix case query between usage (#1173)

* sort genesis transactions for consistent genesis block hash and id (#1174)

* Genesis generate command refactoring (#1169)


* Add genesisTimestamp flag and updated genesis templates
* Add logic to validate input data files used to generate genesis.go
* Exclude from node seed verification all entries that don't have a node seed, but only node public key and account address (we can't verify them using genesis generate)
* #1160 finish preparation for scramble node storage

* #1160 handle scramble node stack limit

* #1160 push scramble information by value instead of reference

* #1160 add EmptyCache blocker

* #1160 add GetTop method for stack storage

* #1160 initialize scramble list on startup

* #1160 initialize scramble list on finish applying snapshot

* #1160 add database lookup in case looking for scramble outside of cache
* move batch receipt to cache storage

* initiate batch receipt cache on main in a correct way

* check duplicated batch receipt send or receipt tx and block

* reminder batch receipt

* remove not used fields on p2p service client
* initialize Node Address Info cache

* implement node address info cache

* fix wrong use address info service

* add node Address info on Block main service & fix test

* add check error on SetItem storage

* fix parameter NewBlockMainService on unite test

* add error handler
fix failed st receipt reminders (#1185)
* #1186 rename mempool storage file

* #1186 validate receipt based on cached result

* #1186 remove dead code
* add cache storage metrics

* update mutex mechanism on get size

* better usage gauge vector metrics

* add node address info cache into metrics
* get size in safety way, no more game
* Remove NodeAddress from node registration tx generator (cmd)

* Remove (unused) NodeAddress from struct in genesis generator (cmd)

* Fixed escrow=false in generate register node tx command
* Updated readme.md

Co-authored-by: stefano galassi <stefano.galassi@blockchainzoo.com>
* move function from node registry service to node address info

* remove unused mock variable
* #1189 add node registry cache layer

* #1189 handle reset index when resorting pending node
* update node proto to have node public key
andy-shi88 and others added 20 commits October 26, 2020 11:00
* fix: returning wrong address update status

* fix: concurent read-write map in storage transactional

* log node_id-address:port of failed nodeAddressInfo update
* do not update nodeAddress info if less than or same as latest height in database;

* avoid updating multiple node address info that could cause unique constraint error by adding extra status filter

* fix unit tests
* fix collide naming and no need to req txs when peer nil

* fix posible to nil pointer

* need to clearing receipt cache when rollback happened

* fix failed test cases that was affected
* Update well known peers for beta

Co-authored-by: stefano galassi <stefano.galassi@blockchainzoo.com>
* remove active node registry when participation score reach 0

* calculateNodeOrder divide by 1, it is not used anymore, will be removed in new blocksmith selection implementation #1190

* omit division

* fix tests

* remove outdated test
* Add arm architecture in Makefile for cross compiling with xgo

Co-authored-by: stefano galassi <stefano.galassi@blockchainzoo.com>
* add missing reinitialize cache on import & insert snapshot

* remove unneeded intilize snapshot
* fix missing dependencies on node address info

* add missing depedencies on cmd
…- this fix will be omitted in next beta since blocksmith strategy will be revamped in #1190 (#1334)
* update readme after enhancement
* add checker for Node ID 0 & Implement blocks storage on generate node address info

* use cache to get activeRegisteredNode in InsertNextNodeAdmissionTimestamp
* use BlocksStorage in  mempool & optimeze validate request p2p

* remove priority peers from blacklist
…mat in Blocks Service (#1341)

* add GetBlockByHeightCacheFormat & implement more blocks cache
* fix double import package
@abiman7u abiman7u modified the milestones: Milestone 20, V.0.0.2.W.02 Nov 12, 2020
@andy-shi88 andy-shi88 merged commit e1fc323 into develop Nov 13, 2020
@andy-shi88 andy-shi88 removed their assignment Dec 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants