aboutsummaryrefslogtreecommitdiffstats
path: root/core/test
Commit message (Collapse)AuthorAgeFilesLines
* core: Add DKGSuccess (#569)Jimmy Hu2019-04-155-16/+120
| | | | | | * core: Add DKGSuccess * core: reset if not enough of dkg success
* core: add report bad peer interface to network (#559)Jimmy Hu2019-04-125-16/+60
|
* core/crypto/dkg: concurrent access for gpk (#548)Jimmy Hu2019-04-043-3/+3
| | | | | * core/crypto/dkg: add benchmark * core/crypto/dkg: concurrent access for gpk
* core: clean TODOs (#539)Mission Liao2019-04-017-288/+268
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * core: fix block timestamp (#529) * Remove TODO dMoment is still required when the block timestamp of the genesis block is still need to be verified. * Refine timestamp when preparing blocks * Add timestamp checking in sanity check * Revert code to patch position when preparing * Remove TODOs that seems meaningless now * Remove TODOs related to refactoring * core: remove finalization (#531) - Remove types.FinalizationResult, randomness field would be moved to `types.Block` directly. - Add a placeholder for types.Block.Randomness field for blocks proposed from round < DKGDelayRound. (refer to core.NoRand) - Make the height of the genesis block starts from 1. (refer to types.GenesisHeight) - The fullnode's behavior of core.Governance.GetRoundHeight is (assume round-length is 100): - round: 0 -> 0 (we need to workaround this) - round: 1 -> 101 - round: 2 -> 201 - test.Governance already simulate this behavior, and the workaround is wrapped at utils.GetRoundHeight. * core: fix issues (#536) fixing code in these condition: - assigning position without initializing them and expected it's for genesis - compare height with 0
* core: workaround for GetRoundHeight (#526)Jimmy Hu2019-03-281-0/+3
|
* core: workaround for GetRoundHeight (#523)Jimmy Hu2019-03-271-1/+2
| | | | | | | | * core: workaround for GetRoundHeight * update gopkg.lock * x
* core: bring back agreement result (#515)Jimmy Hu2019-03-271-5/+8
| | | | | | | | | | * core: bring back agreement result * add logger * Fix * fixup
* core: Remove agreement result (#514)Jimmy Hu2019-03-272-7/+168
| | | | | | | | | | | | * core: remove agreement result for round with randomness * remove agr test in syncer * fixup * remove randomness field from agreement result * modify test
* core: merge notarySet and DKGSet (#488)Jimmy Hu2019-03-2711-275/+85
| | | | | | | | | | | | | | * core: さよなら DKGSet * test logger * temporary fix before finalized * core: Sign psig on commit vote * Add syncer log * fixup
* core: remove initRoundBeginHeight paramenterMission Liao2019-03-225-15/+53
| | | | * Implement Governance.GetRoundHeight in test.Governance.
* core: height event handlers are not called (#509)Mission Liao2019-03-222-10/+6
| | | | | | | * Make utils.RoundEvent.ValidateNextRound non-blocking * Make NotifyHeight called blockingly * Trigger all height event handlers that should be triggered by initBlock * Fixup: forget the syncer part
* core: reset DKG (#502)Mission Liao2019-03-208-29/+55
| | | | | | | | | | | | | | * Allow utils.NodeSetCache to purge by rounds. * Purge utils.NodeSetCache when DKG reset. * Add a utils.RoundEvent handler to abort all previous running DKG * Fix test.App hangs in BlockDelivered when utils.RoundEvent is attached. ValidateNextRound is a blocking call and would block test.App.BlockDelivered.
* core: remove round from addDKG fuction (#501)Jimmy Hu2019-03-193-23/+9
|
* test: try to mitigate flaky tests (#498)Mission Liao2019-03-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add assertion to make sure all nodes are synced. * Retry round event with BA's interval We are about to modify lambdaDKG with block height, instead of timing. Therefore, the last interval we could use is BA's interval. * Check ctx in inifite loop * Disable this panic temporary If a fast sync triggered by receiving types.AgreementResult from later position, this panic would be triggered 100%, ex. current-round: 1, change-notary-height: 120, agreeemnt-result from round:2 height:121 However, I don't have easy way to fix it temporary. * Lower down the test size for TCP * Fix typo * Fixup: revert the removed panic
* test: fix data race (#497)bojie2019-03-181-9/+17
|
* dkg: add reset field (#492)Mission Liao2019-03-173-49/+122
| | | | | | | | | | | | | | | | | | | | | | | | * Add Reset fields to DKG types * Fix crypto part after adding Reset field * Prohibit DKG messages with different resetCount * Add TODO * Add reset parameter to dkgProtocol constructor * Add TODO * Fix inconsist hash to prepare CRS * Add reset parameter when runnning DKG * Fix test for utils.RoundEvent * Add dummy test to prohibit DKG messages with unexpected reset count * Fix test.App
* core: add GetRoundHeight interface (#493)Wei-Ning Huang2019-03-171-0/+5
| | | | Add GetRoundHeight interface for core to query the being height of a round.
* core, syncer: integrate utils.RoundEvent (#490)Mission Liao2019-03-161-2/+4
|
* core/syncer: add force sync (#468)Jimmy Hu2019-03-151-0/+9
| | | | | | | | | | | | | * core: Add Recovery Interface * core/syncer: modify recovery interface * core: fix Recovery interface * core/syncer: rename terminator to watchcat (#491) * core/syncer: rename terminator to watchcat * Add error log * Rename Pat to Feed * core/syncer: add force sync * run prepareRandomness if round >= DKGDelayRound * Add test for Forcsync
* test: prohibit dkg (#489)Mission Liao2019-03-145-16/+290
| | | | | * Allow to prohibit DKG changes at governance layer. * Allow test.App to broadcast RoundEvent
* core: first few round will not have DKG (#455)Jimmy Hu2019-03-044-25/+22
| | | | | | | | | | | | | | * core: Add DKGDelayRound constant * core: use constant value * core, utils: set DKGDelayRound for utils. * test: add dkgDelayRound to state * core: do not run dkg and crs for round < DKGDelayRound * fix test
* core: resetDKG interface (#461)Jimmy Hu2019-03-044-18/+123
| | | | | | | | | | * core: resetDKG skeleton * Add Equal test * Add TestLocal * Add TestPacking
* core: Change RoundInterval to RoundLength (#453)Jimmy Hu2019-02-263-10/+10
|
* core: remove acks (#451)Mission Liao2019-02-221-13/+0
|
* core: switch round by block height (#450)Mission Liao2019-02-209-108/+36
|
* big-bang: single chain (#446)Mission Liao2019-02-1913-2134/+124
|
* integration_test: Add a byzantine test (#447)Jimmy Hu2019-02-152-12/+12
| | | | | | * integration_test: Add a byzantine test * test: fix flaky TestPullVote tes
* core: Fix rlp encode/decode for DKGComplaint. (#441)Jimmy Hu2019-02-091-1/+4
| | | | | | | | * types: Add RLP Encode/Decode to DKGComplaint * Add test * fix state test
* core: remove Governance.NotifyRoundHeight (#431)Mission Liao2019-01-245-23/+37
|
* misc: Add gosec to check security issues (#424)Jimmy Hu2019-01-183-6/+18
| | | | | | | | * Add gosec to tools * Run security check to ci * Fix secrity issues
* core: Fix BA3.0 (#420)Jimmy Hu2019-01-151-1/+1
| | | | | | | | | | | | | | | | | | * Add Restart to Ticker * Change pre allocated size * Return NextTime from lattice * Few hacky fixes for BA * PullVote in FastRollback state * Add shallowBlock for agreementResult * Extend period * Fixup
* syncer: fix issues when switching to core.Consensus (#418)Mission Liao2019-01-111-19/+0
| | | | | | | | | | | | | | | | - when confirmed blocks passed to core.Consensus aren't continuous in position in some chain, the pulling would skip those missing blocks. - fix: when some block is missing, avoid adding it and all blocks after it to core.Consensus. - we need to avoid the receive channel of network module full. - fix: during switching to core.Consensus, we need to launch a dummy receiver to receive from receive channel of network module. - fix: between the period during core.Consensus created and before running, a dummy receiver is also required to receive from receive channel of network module.
* simulation: fix k8s dmoment issue (#416)Jimmy Hu2019-01-094-14/+72
| | | | | | * Handshake with server dmoment * Start simulation from dMoment * Update k8s config
* simulation: fix k8s simulation stuff (#410)Jimmy Hu2019-01-081-2/+2
| | | | | | * simulation: fix k8s simulation stuff * Default K to 0
* simulation: Fix simulation stuffs (#405)Jimmy Hu2019-01-071-0/+8
| | | | | | * test: fix marshal randomness pullrequest * Add result for witness latency
* core: add fork reporting interface to governance (#402)Wei-Ning Huang2019-01-051-0/+8
|
* test: allow empty change request (#398)Jimmy Hu2019-01-041-0/+3
| | | | | | * allow empty reqs * Fix license
* simulation: add latency for gossip (#389)Mission Liao2019-01-037-179/+191
|
* test: add witness preparation/verification (#386)Mission Liao2018-12-272-30/+194
|
* core: fix stuffs (#383)Mission Liao2018-12-261-0/+19
| | | | | | * Merge core.Consensus constructors * Downgrade severity of logs * Refine logic to add blocks from pool to lattice * Add test.LaunchDummyReceiver
* core: pull block random (#384)Jimmy Hu2018-12-261-39/+139
| | | | | | | | * Add PullRandomness to interface * Add pendingBlocksWithoutRandomness to compactionChain * Pull randomness every 1 second
* simulation: support config change (#381)Mission Liao2018-12-262-33/+60
|
* core: simulation: add throughput and block event monitoring (#380)haoping-ku2018-12-221-23/+105
| | | | | | | | | | | * core: simulation: add throughput and block event monitoring Added throughput and block event monitoring in TCP-local network. These data is collected by nodes and reported to peer server. * fix issues * fix sent time of throughput issue
* utils: move authenticator to utils package (#378)Mission Liao2018-12-227-73/+59
|
* core: Add a `MPKReady` so `MasterPublicKey` cannot be added afterwards (#375)Jimmy Hu2018-12-195-5/+155
| | | | | | | | | | | | | | | | * Add type DKGReady * Add DKGReady to interface and state * DKG will wait for MPK to be ready before running * Modify test * Check if self's MPK is registered * Add test for delay add MPK * Rename Ready to MPKReady
* test: check causality (#372)Mission Liao2018-12-173-5/+63
|
* core: cache dkg's private key in db (#371)Mission Liao2018-12-161-13/+5
|
* db: cache compaction chain tip in db (#369)Mission Liao2018-12-132-2/+31
| | | | | * Replace JSON with RLP in levelDB implementation. * Make sure blocks to sync following compaction chain tip
* db: rename blockdb to db (#367)Mission Liao2018-12-137-174/+177
| | | | | | | | | | * Rename blockdb package to db * Rename 'BlockDB' to 'DB' * Make all methods in db specific for ''block'. * Rename db.BlockDatabase to db.Database * Rename revealer to block-revealer * Rename test.Revealer to test.BlockRevealer
* core: fix bugs found when node-set is not equal to notary-set (#362)Mission Liao2018-12-072-2/+11
|
* test: allow to log in test.State (#359)Mission Liao2018-12-066-34/+86
|
* Haoping fix simulation (#356)haoping-ku2018-12-051-0/+6
| | | | | | | | | | | | | | | * simulation: add benchmark features * tmp * simulation: modify Debug interface * Added BlockReceived and BlockReady function to Debug interface. * Added Benchmark features. * fix * fix typos
* test: Fix for state (#349)Jimmy Hu2018-11-291-3/+23
| | | | | | * Only apply each requests once * Sort by time
* core: syncer: add syncer (#346)haoping-ku2018-11-297-56/+136
|
* core: remove StronglyAcked (#347)Mission Liao2018-11-293-52/+31
|
* core: support NumChains change for BA modules (#339)Mission Liao2018-11-203-4/+17
|
* core, test: Fix various issues (#337)Jimmy Hu2018-11-191-1/+1
|
* test: fix network (#328)Mission Liao2018-11-153-81/+176
| | | | * Broadcast to set of node instead of broadcasting when attaching cache. * Fix pull blocks
* core: expose implicit round shift (#321)Mission Liao2018-11-132-11/+26
|
* test: add integration test (#315)Mission Liao2018-11-113-9/+51
| | | | | | * Rename NonByzantineTestSuite to WithSchedulerTestsuite * Add a method to query the latest position delivered * Add integration test for core.Consensus * Show detailed list for test cases in CI
* test: implement pulling in network layer (#314)Mission Liao2018-11-094-43/+580
| | | | | | | * Add definition for test.PullRequest * Cache notary sets for each round in network module * Cache peers as nodeID in network module. * Implement pull blocks * Implement pull vote
* simulation: use test.Governacne in simulation (#311)Mission Liao2018-11-085-39/+123
| | | | | | | | | | | | * Move simulation.Network to test package * Use test.Governance in simulation * Pack/Apply state request in blocks payload * Add Governance.SwitchToRemoteMode This would trigger governance to broadcast pending state change requests when changes. * Allow to marshal/unmarshal packedStateChanges * Attach test.Network and test.State
* test: make StateChangeRequest broadcast-able (#305)Mission Liao2018-11-075-278/+445
| | | | | | | | | | | | | | | | | | | | | | | | | Make `test.StateChangeRequest` behaves like tx on ethereum: - Can be broadcasted and cached in a pool. - Uniquely indexed, and be removed after applied. Changes: - Make cloneDKGx functions in test.State as utilities. - Add hash and timestamp fields to test.StateChangeRequest. - Add two methods to test.State: - PackOwnRequests would pack all pending change requests owned by this instance as byte slice, and move them to global pending requests pool. - AddRequestsFromOthers would add pending change requests from others to global pending requests pool. - The method State.PackRequests now would pack requests in global pending requests pool. - The method State.Apply would remove corresponding StateChangeRequest by hash.
* core: Run DKG stuffs only if the node is in DKG set (#302)Jimmy Hu2018-11-064-8/+42
|
* test: move simulation.network to test package (#297)Mission Liao2018-11-052-0/+440
|
* core: block deliver with position (#289)Mission Liao2018-11-023-3/+4
| | | | | This info is required when application layer needs to do something related to the underlying DAG, not just compaction chain.
* core: Remove max block interval (#287)Jimmy Hu2018-11-025-25/+15
|
* Rename repo to dexon-consensusWei-Ning Huang2018-11-0221-169/+169
|
* core: core.Lattice supports config change (#276)Mission Liao2018-11-013-24/+50
| | | | | | | | | | | Besides making core.Lattice supports config change, This PR also include the first test for below scenario: - Configuration changes are registered before test running - Those changes are carried/broadcasted as payload of blocks - Only one node would initiate these changes, however, all nodes would finally receive/apply those changes to their own test.Governance instance.
* test: integrate state to gov (#275)Mission Liao2018-10-303-9/+113
| | | | | | * Fix dummy error * Check validity before apply state changes. * Add RegisterConfigChange method to test.Governance * Add SwitchToRemoteMode method to test.State
* test: clone types.Config, test.Governance, test.State (#262)Mission Liao2018-10-264-42/+544
|
* core: lattice sync (#257)Jimmy Hu2018-10-254-11/+138
|
* test: add test.Stopper to stop by round (#255)Mission Liao2018-10-252-32/+162
|
* core: Move dkg in types to types/dkg. (#253)Jimmy Hu2018-10-253-43/+46
|
* test: add test.State (#239)Mission Liao2018-10-244-115/+950
| | | | | | | | | * separate test utility and interface implementation for test.Governance. * add test.State. * integrate test.State to test.Governance. test.State is mainly used to emulate state propagation on fullnode.
* core: Change interface of Application.VerifyBlock (#246)Jimmy Hu2018-10-231-2/+2
| | | | * Change interface of Application.VerifyBlock
* core: add round parameter to ProposeCRS method (#244)Wei-Ning Huang2018-10-231-1/+1
| | | | | | | | Since all DKG set members may ProposeCRS, but only one will get through, we need to be able to tell which round the CRS is intended for in order to skip CRS submission of the same round. Also this commit add check to make sure we have enough master public key when initializing DKGGroupPublicKey.
* core: prepare empty block if null block is confirmed by BA. (#231)Jimmy Hu2018-10-232-14/+25
|
* core: total-ordering: add test TestRunFromNonGenesis (#226)Haoping Ku2018-10-221-2/+2
| | | | * core: total-ordering: add test TestRunFromNonGenesis
* misc: Fix simulation error (#230)Jimmy Hu2018-10-191-6/+6
|
* core: total-ordering: change early flag to mode (#227)Haoping Ku2018-10-193-13/+15
| | | * core: total-ordering: change early flag to mode
* crypto: ecdsa: make NodeID match dexon address (#229)Sonic2018-10-191-1/+4
| | | | | | | * Remove publicKey struct * PublicKey.Bytes() return uncompressed public key to match the address format of dexon (Keccak256(pubBytes[1:])[12:], where pubBytes is 65 bytes uncompressed public key.). * Rename ethcrypto to dexCrypto
* core: total ordering flush (#212)Mission Liao2018-10-183-19/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Implement flush * Panic for all errors from total-ordering * Fix test failure All DAGs generated by blocks-generator would trigger round switching. * Add NewBlocksGeneratorConfig * Add test caes for numChains changes * Resize internal structures * Perform total ordering based on current numChains * Fix not a valid DAG checking * Comparing blocks by height is not correct * Fix blocks from future round are delivered first by revealer * Make sure only picking one candidate in one chain. Blocks on the same chain in different rounds would not have acking relation. * Fix stuffs * Fix the issue that two candidates from the same chain are picked. * Rework candidateChainMapping * Add test case for phi, k changed * Refine testing code for round change * Add breakpoints in global vector * Remove not a valid dag checking. * Adding comments * Add check to forward acking * Fix vet failure * Prepareing height record with breakpoint * Fixup: add check to make sure delivered round IDs are increasing.
* core: blocks generation supports rounds (#196)Mission Liao2018-10-143-184/+403
| | | | | | | * Block proposing based on timestamp, instead of count of blocks generated. * Add method to find tips of each round in blockdb. * Block proposing based on tips of last round found on blockdb.
* core: modify interface (#194)Mission Liao2018-10-122-4/+8
| | | | * Add a new method to notify full node about round cutting. * Modify interface to return error when preparing block
* core: change interface (#193)Mission Liao2018-10-113-11/+11
| | | | | | | * Extract types.FinalizationResult * Change interface: - Application.BlockConfirmed returns whole block. - Application.BlockDelivered returns partial result.
* core: types: fix nodeID generation (#191)Wei-Ning Huang2018-10-111-1/+5
| | | | | Use ethereum style nodeID generation (keccak on compressed public key without the first byte).
* core: Add round to DKG methods in gov. Change network interface name (#185)Jimmy Hu2018-10-091-3/+13
|
* core: Add DKG final message. (#181)Jimmy Hu2018-10-091-0/+25
|
* core: update config variable name grammar and remove configuration (#184)Wei-Ning Huang2018-10-081-2/+2
|
* core: Remove round from gov.ProposeCRS (#183)Jimmy Hu2018-10-081-4/+11
|
* core: Check Witness height. Add ConsensusTime and ConsensusHeight to block. ↵Jimmy Hu2018-10-043-10/+16
| | | | (#170)
* core: remove NumWitnessSet in governance config (#167)Wei-Ning Huang2018-10-031-1/+0
| | | | NumWitnessSet is no longer required as we don't have witness set in the design anymore.
* core: publish round based config (#165)Mission Liao2018-10-031-1/+0
|
* core: Add unit test for DKG CRS in consensus (#163)Jimmy Hu2018-10-031-1/+13
|
* core: Prevent duplicated nack complaint (#162)Jimmy Hu2018-10-031-0/+5
|
* core: replace reliable-broadcast with shard (#159)Mission Liao2018-10-021-9/+9
|
* core: remove ProposeThresholdSignature/GetThresholdSignature (#158)Wei-Ning Huang2018-10-021-19/+2
| | | Also rename the argument name of ProposeCRS.
* core: run DKG and CRS at background. (#155)Jimmy Hu2018-10-021-4/+6
|
* core: update data model to reflect new model (#157)Wei-Ning Huang2018-10-012-41/+5
| | | | | | Update data model: 1) Remove witness ack. 2) Add round to block. 3) Update governance interface.
* core: use notarySet for BA module. (#153)Jimmy Hu2018-10-011-1/+8
|
* test: tcp handshake (#151)Jimmy Hu2018-09-301-49/+175
|
* core: Add sizes of various nodeSets (#148)Jimmy Hu2018-09-281-6/+18
|
* core: hide types.NodeID from full node. (#147)Mission Liao2018-09-286-71/+134
| | | | | | | | | * Refine core.Governance interface - Remove types.NodeID from interface declaration. - All parameter should be round based. * Add core.NodeSetCache * Agreement accepts map of nodeID directly. * test.Transport.Peers method return public keys.
* core: update governance interface and config (#145)Wei-Ning Huang2018-09-271-9/+13
| | | | | | 1) Remove RoundHeight from config. 2) NotarySet is not from governance contract, we get Node set intead. Notary set is caculated from the NodeSet using CRS. 3) CRS is not in the governance interface.
* core: rename crypto/eth to crypto/ecdsa (#144)Wei-Ning Huang2018-09-262-4/+4
|
* core: move crypto to core/crypto (#140)Mission Liao2018-09-262-4/+4
| | | | | | | | | - Move key-holder to authenticator Make core.keyHolder public as core.Authenticator, it is not required to make this part an interface. - Make private when there is no need to go public. - Fix data race
* Fix race (#138)Jimmy Hu2018-09-261-1/+16
|
* core: run TSIG for first configuration block at startup (#135)Jimmy Hu2018-09-261-0/+15
|
* core: update governance interface to consider genesis state (#136)Wei-Ning Huang2018-09-254-12/+13
|
* Fix naming of methods (#134)Mission Liao2018-09-253-18/+18
| | | | | | - BlockDeliver -> BlockDelivered - TotalOrderingDeliver -> TotalOrderingDelivered - WitnessAckDeliver -> WitnessAckDelivered - VerifyPayload -> VerifyPayloads
* core: add debug (#133)Mission Liao2018-09-253-13/+24
| | | | | | | | | | | | | | | | | | | | | * Split interface * Rename nonblocking-application to nonblocking Parts needs nonblocking gets more. * Implement core.nonBlocking based on interface split * Fix: the witness parent hash could be parent on compaction chain. * Rename Application.DeliverBlock to BlockDeliver To sync with naming of other methods. * Change methods' fingerprint - BlockConfirmed provides block hash only. - BlockDeliver provde a whole block.
* core: run first DKG at startup. (#129)Jimmy Hu2018-09-231-3/+6
|
* core: add shard (#127)Mission Liao2018-09-211-2/+7
| | | | | | | A shard is basically DEXON v1 components, except the strongly acked part, including: - maintaining lattice structure - total ordering - generate consensus timestamp
* test: fix block generator (#126)Mission Liao2018-09-213-45/+67
| | | | | | | | * Generate correct hash/signature when generating blocks. * Refine naming, types. - type of chainNum should be uint32 by default - rename blockCount to blockNum - rename nodeCount to chainNum
* core: refactor witness data processing flow (#124)Wei-Ning Huang2018-09-201-0/+8
| | | | | | | | | | | Since witness data need to include data from application after it processed a block (e.g. stateRoot). We should make the process of witness data asynchronous. An interface `BlockProcessedChan()` is added to the application interface to return a channel for notifying the consensus core when a block is processed. The notification object includes a byte slice (witenss data) which will be include in the final witness data object.
* Rename validator* to node* (#120)Mission Liao2018-09-2015-319/+322
|
* core: rename Notary (Acks) to Witness (#118)Wei-Ning Huang2018-09-192-21/+21
|
* core: refine governance interface to reduce Get* methods (#114)Wei-Ning Huang2018-09-181-49/+23
| | | | | Since we have a bunch of static configurations in the governance contract, instead of using a Get* method for each of them, we instead implement a GetConfiguration() method to return a structure of the configurations.
* core: remove ticker parameter from NewConsensusMission Liao2018-09-181-18/+18
| | | | | | | | | - remove BlockProposingInterval, it's replaced by lambda. - remove ticker parameter of NewConsensus, ticker would be derived from governance. - leave a backdoor to hook the construction of ticker. - move 'Lambda' config from to consensus.
* core: move blockdb into core package and minor change on governance ↵Wei-Ning Huang2018-09-178-9/+14
| | | | | | | interface (#110) Since third party apps will possibly implement their only blockdb class, it make sense for the interface to be in core. Also add GetNumShards into the governance interface.
* core: DKG interface (#108)Jimmy Hu2018-09-171-0/+35
|
* core: fix VerifyPayload argument (#103)Wei-Ning Huang2018-09-131-1/+1
| | | | Since we are using a byte slice for storing payload. VerifyPayload() should also accepts a byte slice.
* core: replace acks with slice (#102)Mission Liao2018-09-123-8/+8
|
* core: types: use []byte for block Payload type (#101)Wei-Ning Huang2018-09-121-3/+3
| | | | | Change payload type to []byte instead of [][]byte to make it more generic. The user of the consensus core should marshal the payload into a byte slice by themselves.
* simulation: integrate test.Transport (#99)Mission Liao2018-09-112-32/+115
| | | | | - Add marshaller for simulation by encoding/json - Implement peer server based on test.TranportServer - Remove network models, they are replaced with test.LatencyModel
* core: timestamp (#98)Jimmy Hu2018-09-111-17/+23
|
* test: add transport layer (#97)Mission Liao2018-09-105-0/+1142
| | | | | | | | | | The purpose of transport layer is to abstract the way to send messages and setup connections between peers in a p2p network. The peer discovery is simulated by a hosted server: every peer sends its address to a known server. Once collecting enough peers, respond the whole peers lists to all peers. Changes: - Add test.Trasnport interface - Add test.Transport implementation by golang channel. - Add test.transport implementation by TCP connection. - Move LatencyModel to core/test package - Add Marshaller interface
* Add GetChainNumber to Goverance (#92)Jimmy Hu2018-09-031-0/+5
|
* core: minor change to governance interface (#90)Wei-Ning Huang2018-09-031-5/+0
|
* core: Add a new structure `Position` and move `ShardID`, `ChainID` and ↵Jimmy Hu2018-09-033-7/+9
| | | | `Height` from `Block` (#89)
* Add methods to Application interface. (#86)Jimmy Hu2018-08-311-0/+9
|
* core: Add PreparePayloads to Application and Remove blockConverter ↵Jimmy Hu2018-08-303-3/+7
| | | | interface. (#84)
* core: Change the lattice key from validatorID to chainID. (#83)Jimmy Hu2018-08-301-0/+5
| | | | | * Add chainID in simulation.Validator * Change validatorid to chainID in rbModule
* core: tune total ordering performance (#81)Mission Liao2018-08-303-8/+15
| | | | | - Replace map with slice Compared to slice, accessing to map is slower and the memory usage is inefficient.
* core: Leader Selector. (#80)Jimmy Hu2018-08-301-0/+10
|
* core: tune performance (#73)Mission Liao2018-08-281-0/+26
| | | | | | | | | | | | | | | | | | | | | | - Avoid using recursive function in critical path. - Do not write through when using levelDB. Things put to levelDB would be safe from panic even we didn't force to write through every time. - Dump count of confirmed blocks proposed by self. - Avoid allocating variables in loop. - Return length of acking node set, we only need that when total ordering. - Fix potential bug: make sure win records updated when acking height vectors of candidates are changed. - Keep dirty validators in slice. - Add cache for objects to ease the pressure to garbage collector. - Cache global acking status when total ordering. - Add method to recycle blocks. - Marshal JSON should be called once for each broadcast. - Make updateWinRecord called in parallel. - Log average / deviation of latencies when simulation finished.
* core: Notary ack application. (#70)Jimmy Hu2018-08-222-0/+45
|
* simulation: add simulation with scheduler (#71)Mission Liao2018-08-215-40/+75
| | | | | | | | - Add new field in test.Event: HistoryIndex HistoryIndex allow us to access them by their position in event history. - Record local time in test.App when receiving events. - Add statisitics module for slices of test.Event. - add new command line utility *dexcon-simulation-with-scheduler to verify the execution time of core.Consensus.
* core: Notary ack (#69)Jimmy Hu2018-08-211-2/+2
|
* core: tune performance total ordering (#66)Mission Liao2018-08-212-0/+61
| | | | | | - the checking of `internal stability` is more expensive than checking `len(ANS) == validatorCount`. So only check it when `len(ANS) != validatorCount`. - cache the result of `grade` between candidates. - cache the `acking height vector` of each candidate. - add test on total ordering with different acking frequency between blocks.
* core: NotaryAck interfaces. (#67)Jimmy Hu2018-08-201-0/+5
|
* test: add test.Scheduler (#58)Mission Liao2018-08-158-5/+711
| | | | | | | | | | | When simulating execution of core.Consensus by passing packets through golang-channel or real-socket, we need to utilize time.Sleep and time.Now to simulate the required network/proposing latency. It's problematic when we try to test a simulation with long network latency. Instead, Scheduler would try to execute the event with minimum timestamp, thus time.Sleep is replaced with Scheduler.nextTick, and time.Now is replaced with Event.Time. Changes: - Add test.Scheduler. - Add test.Stopper interface to provide encapsulate different stop conditions for scheduler. - Add a reference implementation for test.Stopper, it will stop scheduler when all validators confirmed X blocks proposed from themselves. - Add a test scenario on core.Consensus that all validators are not byzantine.
* test: refine test utility (#61)Mission Liao2018-08-153-16/+293
| | | | | * Add functionality to test.App * Add test utility to generate slices of types.ValidatorID
* core: Prepare Genesis block. (#54)Jimmy Hu2018-08-141-5/+13
|
* core: add nack module (#41)Haoping Ku2018-08-131-1/+6
|
* core: Hash block in Consensus.PrepareBlock. (#46)Jimmy Hu2018-08-124-33/+61
| | | | | | | | * Add hash to block * Check block hash in Consensus.sanityCheck * Add hashBlockFn in block generator.go
* core: update governance interface and move K into config (#40)Wei-Ning Huang2018-08-101-14/+24
|
* core: Deliver only Hash to Application. (#43)Jimmy Hu2018-08-101-7/+2
|
* core: Add Block.IsGenesis() and set Block.ParentHash to 0 in genesis block. ↵Jimmy Hu2018-08-092-8/+25
| | | | (#37)
* core: Add Consensus to replace core.Blocklattice (#35)Mission Liao2018-08-082-0/+135
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Make Sequencer return slice of blocks. * Fix naming issue The function 'getHeightVecto' would return ackingStatusVector. * Fix comment error. * Add methods to collect info when proposing blocks. * Add test.App * Add test.Gov * Move this type to core.types to avoid cyclic import. * Add core.Consensus * Move getMedianTime, interpoTime to util These functions are not depending on members of core.consensusTimestamp and is required when testing core.Consensus. * Make sure types.Block.Clone would copy critical fields. * Remove core.blocklattice * Define 'infinity' in core/total-ordering This definition is defined in core/blocklattice originally. * Fix a bug when processing the same block twice. * Integrate simulation with core.Consensus core.Consensus is a replacement of core.Blocklattice * Fix the comment to use sigular form. * Move lock mechanism to sub modules. * phi should be 2*fmax+1 * Fixup: should aborting when the validator is added * Fix for new block fields * Fix the bug that the total ordering sequence is wrong.
* test: random blocks generator (#26)Mission Liao2018-08-035-0/+738
* Add blocks generator. This helper would randomly generate blocks that forms valid DAGs. * Add revealer Revealer is an extension of blockdb.BlockIterator. The block sequence from 'Next' method would be either randomly (see RandomRevealer) or meeting some specific condition (ex. forming a DAG, see RandomDAGRevealer). * Add test for sequencer based on random blocks. * core: refine Application interface and add Governance interface (#24) Add a new Governance interface for interaction with the governance contract. Also remove the ValidateBlock call in application interface as the application should validate it before putting it into the consensus module. A new BlockConverter interface is also added. The consensus module should accept the BlockConverter interface in future implementation, and use the Block() function to get the underlying block info.