aboutsummaryrefslogtreecommitdiffstats
path: root/core/consensus_test.go
Commit message (Collapse)AuthorAgeFilesLines
* core: fix flaky testJimmy Hu2019-04-141-0/+7
|
* core: add report bad peer interface to network (#559)Jimmy Hu2019-04-121-13/+45
|
* core: clean TODOs (#539)Mission Liao2019-04-011-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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: run dkg by height (#527)Jimmy Hu2019-03-291-5/+17
| | | | | | | | * core: run dkg by height * core: check cc.dkgCtx before running each dkg phases * fix
* core: merge notarySet and DKGSet (#488)Jimmy Hu2019-03-271-9/+4
| | | | | | | | | | | | | | * core: さよなら DKGSet * test logger * temporary fix before finalized * core: Sign psig on commit vote * Add syncer log * fixup
* core: remove initRoundBeginHeight paramenterMission Liao2019-03-221-2/+2
| | | | * Implement Governance.GetRoundHeight in test.Governance.
* core: abort hang DKG (#508)Mission Liao2019-03-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | * Capitalize log * Fix DKG aborting hangs Make sure reset cc.dkg to nil in runDKG * Remember to purge tsig verfier too * Replace abortCh with context.Context * Fix obvious bug * Fixup: forever blockin at Wait method when runDKG is not called * Fixup: fix corner case If the Add(1) moved to runDKG under cc.dkgLock, we may not catch it after unlocking cc.dkgLock. * fixup
* core: height event handlers are not called (#509)Mission Liao2019-03-221-0/+50
| | | | | | | * 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-201-1/+1
| | | | | | | | | | | | | | * 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: snapshot DKG protocol struct when finish any phase (#496)bojie2019-03-181-0/+2
|
* dkg: add reset field (#492)Mission Liao2019-03-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | * 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, syncer: integrate utils.RoundEvent (#490)Mission Liao2019-03-161-1/+1
|
* test: prohibit dkg (#489)Mission Liao2019-03-141-2/+2
| | | | | * Allow to prohibit DKG changes at governance layer. * Allow test.App to broadcast RoundEvent
* core: recover DKG master private shares (#487)bojie2019-03-131-0/+40
|
* core: first few round will not have DKG (#455)Jimmy Hu2019-03-041-2/+2
| | | | | | | | | | | | | | * 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: Change RoundInterval to RoundLength (#453)Jimmy Hu2019-02-261-1/+1
|
* core: switch round by block height (#450)Mission Liao2019-02-201-14/+3
|
* core: fix stuffs (#448)Jimmy Hu2019-02-191-0/+1
| | | | | | | | | | * Add log * core: delay first dkg * Fix test * core: only runDKG in prepare at round 0
* big-bang: single chain (#446)Mission Liao2019-02-191-321/+1
|
* core: remove Governance.NotifyRoundHeight (#431)Mission Liao2019-01-241-1/+1
|
* core: Fix stuffs (#422)Jimmy Hu2019-01-181-28/+1
| | | | | | * core: reduce syncing ba msg * core: fix checking period of agreement result
* syncer: fix issues when switching to core.Consensus (#418)Mission Liao2019-01-111-0/+1
| | | | | | | | | | | | | | | | - 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.
* core: BA 3.0 (#408)Jimmy Hu2019-01-071-8/+4
| | | | | | | | | | | | | | * Add v3 enum * Add BA leader calculation * Fast BA * Add unittest for Fast BA * Add comment * Select leader in notarySet
* test: add witness preparation/verification (#386)Mission Liao2018-12-271-1/+1
|
* core: pull block random (#384)Jimmy Hu2018-12-261-0/+4
| | | | | | | | * Add PullRandomness to interface * Add pendingBlocksWithoutRandomness to compactionChain * Pull randomness every 1 second
* utils: move authenticator to utils package (#378)Mission Liao2018-12-221-7/+8
|
* core: Add a `MPKReady` so `MasterPublicKey` cannot be added afterwards (#375)Jimmy Hu2018-12-191-1/+0
| | | | | | | | | | | | | | | | * 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
* db: cache compaction chain tip in db (#369)Mission Liao2018-12-131-0/+1
| | | | | * 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-131-3/+3
| | | | | | | | | | * 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
* syncer: fix stuffs (#366)Mission Liao2018-12-121-5/+6
| | | | | | | | | | * return delivered blocks when processing finalized blocks * check deliver sequence when processing finalized blocks * skip delivery of finalized blocks * remove duplicated calls to BlockConfirmed * add numChains change in test scenario * fix the bug that restartNotary is triggered by older block than current aID.
* core: Longer lambda for TravisCI (#365)Jimmy Hu2018-12-101-1/+4
| | | | | | * Longer time for TravisCI. * Update CI setting for PR
* ci: Add TravisCI setting. (#363)Jimmy Hu2018-12-081-24/+48
| | | | | | | | | | | | | | * Update Gopkg.lock * Fix test * Add travisCI setting * Print log using fmt * Update GNUmakefile * Use single go rountine for consensus_test
* core: fix bugs found when node-set is not equal to notary-set (#362)Mission Liao2018-12-071-0/+1
|
* test: allow to log in test.State (#359)Mission Liao2018-12-061-5/+10
|
* core: construct consensus from syncer (#352)Mission Liao2018-12-041-1/+1
|
* core: Fix stuffs (#351)Jimmy Hu2018-11-301-0/+3
| | | | | | * Use non-blocking app in consensus core * Prevent panic when getting nextHeight
* core: remove StronglyAcked (#347)Mission Liao2018-11-291-9/+8
|
* core: support NumChains change for BA modules (#339)Mission Liao2018-11-201-17/+20
|
* core: Handle issues if DKG/CRS is already finished (#334)Jimmy Hu2018-11-181-1/+1
|
* core: expose implicit round shift (#321)Mission Liao2018-11-131-5/+5
|
* core: Extract VoteHeader (#313)Mission Liao2018-11-091-10/+4
|
* core: revert the revert for broken commit and fix (#309)Mission Liao2018-11-081-2/+2
| | | | | | | | * Revert "Revert "core: unbind global round in Consensus (#304)" (#306)" This reverts commit 33d9311270414d8911122a4c7354773786df7f85. * Remove TODO After verified with full node, this call to VerifyBlock is not required.
* Revert "core: unbind global round in Consensus (#304)" (#306)Mission Liao2018-11-081-2/+2
| | | This reverts commit 3714ebf2f1054d9984d37b89cf17e885a5856532.
* core: unbind global round in Consensus (#304)Mission Liao2018-11-061-2/+2
|
* core: reset CRS in leader selector by round (#286)Mission Liao2018-11-021-1/+1
|
* Rename repo to dexon-consensusWei-Ning Huang2018-11-021-11/+11
|
* core: core.Lattice supports config change (#276)Mission Liao2018-11-011-1/+1
| | | | | | | | | | | 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.
* core: Add PullVotes to Network. (#281)Jimmy Hu2018-10-311-0/+4
|
* core: Unit test for BA sync (#265)Jimmy Hu2018-10-261-0/+73
|
* core: sync BA (#264)Jimmy Hu2018-10-261-0/+15
|
* core: Pull block (#263)Jimmy Hu2018-10-261-0/+4
|
* core: Move dkg in types to types/dkg. (#253)Jimmy Hu2018-10-251-5/+6
|
* test: Fix datarace in test (#251)Jimmy Hu2018-10-241-6/+12
|
* test: add test.State (#239)Mission Liao2018-10-241-22/+27
| | | | | | | | | * 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: disable nonblocking temporarily (#249)Mission Liao2018-10-241-1/+0
|
* core: initial commit for logger (#228)Mission Liao2018-10-191-2/+2
| | | | | | | | | | | | | * Replace "log.*" with logger. * Add simple logger to log with log package. * Add debug logs to all calls to these interfaces: - core.Application - core.Governance - core.Network * Add Stringer to these types: - types.DKGComplaint - types.AgreementResult - types.DKGMasterPublicKey - types.DKGFinalize
* core: total-ordering: change early flag to mode (#227)Haoping Ku2018-10-191-4/+4
| | | * core: total-ordering: change early flag to mode
* core: Add init block to Run() (#221)Jimmy Hu2018-10-181-0/+1
|
* core: genesis consensus timestamp (#217)Mission Liao2018-10-171-9/+16
| | | | | | | | | | * Refine the initial value for empty time slot. * Fix DATA RACE netowrkConnection is reset for each test, however, our Consensus instance is not stopped after one test is finished, they might continue use network interface for a while.
* core: Add stop function to all components (#216)Jimmy Hu2018-10-171-21/+35
|
* core: Change First round dkg timing (#209)Jimmy Hu2018-10-161-0/+1
|
* core: Fix simulation errors. (#202)Jimmy Hu2018-10-151-1/+1
|
* core: fix simulation error (#201)Jimmy Hu2018-10-151-6/+11
| | | | | * Sync dMoment for all consensus core * App check for randomness ignore round 0
* core: change interface (#193)Mission Liao2018-10-111-1/+1
| | | | | | | * Extract types.FinalizationResult * Change interface: - Application.BlockConfirmed returns whole block. - Application.BlockDelivered returns partial result.
* core: Add round to DKG methods in gov. Change network interface name (#185)Jimmy Hu2018-10-091-2/+2
|
* core: Add block randomness in compaction-chain module (#179)Jimmy Hu2018-10-081-0/+3
|
* core: General tsig (#177)Jimmy Hu2018-10-051-0/+12
|
* core: Use event to run DKG and CRS in Consensus. (#171)Jimmy Hu2018-10-041-5/+0
|
* core: Add unit test for DKG CRS in consensus (#163)Jimmy Hu2018-10-031-3/+102
|
* core: remove shard (#161)Mission Liao2018-10-021-1/+1
|
* core: replace reliable-broadcast with shard (#159)Mission Liao2018-10-021-93/+62
|
* core: update data model to reflect new model (#157)Wei-Ning Huang2018-10-011-4/+0
| | | | | | Update data model: 1) Remove witness ack. 2) Add round to block. 3) Update governance interface.
* core: check block timestamp (#156)Jimmy Hu2018-10-011-29/+54
|
* core: hide types.NodeID from full node. (#147)Mission Liao2018-09-281-26/+18
| | | | | | | | | * 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-3/+3
| | | | | | 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.
* crypto: sigtopub to crypto package. remove SigToPubFn (#141)Jimmy Hu2018-09-261-2/+1
|
* core: move crypto to core/crypto (#140)Mission Liao2018-09-261-1/+1
| | | | | | | | | - 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
* core: run TSIG for first configuration block at startup (#135)Jimmy Hu2018-09-261-0/+6
|
* core: update governance interface to consider genesis state (#136)Wei-Ning Huang2018-09-251-3/+3
|
* core: add debug (#133)Mission Liao2018-09-251-31/+17
| | | | | | | | | | | | | | | | | | | | | * 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-0/+5
|
* core: add shard (#127)Mission Liao2018-09-211-18/+18
| | | | | | | A shard is basically DEXON v1 components, except the strongly acked part, including: - maintaining lattice structure - total ordering - generate consensus timestamp
* Rename validator* to node* (#120)Mission Liao2018-09-201-55/+55
|
* core: rename Notary (Acks) to Witness (#118)Wei-Ning Huang2018-09-191-2/+2
|
* core: refine governance interface to reduce Get* methods (#114)Wei-Ning Huang2018-09-181-5/+5
| | | | | 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-5/+4
| | | | | | | | | - 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-171-1/+1
| | | | | | | 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/+5
|
* core: timestamp (#98)Jimmy Hu2018-09-111-3/+8
|
* core: Add a new structure `Position` and move `ShardID`, `ChainID` and ↵Jimmy Hu2018-09-031-17/+35
| | | | `Height` from `Block` (#89)
* Use Network in Consensus core (#85)Jimmy Hu2018-08-311-1/+22
|
* core: Change the lattice key from validatorID to chainID. (#83)Jimmy Hu2018-08-301-8/+18
| | | | | * Add chainID in simulation.Validator * Change validatorid to chainID in rbModule
* simulation: add simulation with scheduler (#71)Mission Liao2018-08-211-1/+1
| | | | | | | | - 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: Add a nonBlockingApplication. (#62)Jimmy Hu2018-08-151-7/+14
|
* core: Prepare Genesis block. (#54)Jimmy Hu2018-08-141-40/+62
|
* core: Sign block in Consensus.PrepareBlock. (#50)Jimmy Hu2018-08-131-1/+4
|
* core: Hash block in Consensus.PrepareBlock. (#46)Jimmy Hu2018-08-121-5/+11
| | | | | | | | * Add hash to block * Check block hash in Consensus.sanityCheck * Add hashBlockFn in block generator.go
* core: Modify Consensus interface (#45)Jimmy Hu2018-08-101-10/+10
|
* core: update governance interface and move K into config (#40)Wei-Ning Huang2018-08-101-3/+3
|
* core: Add Block.IsGenesis() and set Block.ParentHash to 0 in genesis block. ↵Jimmy Hu2018-08-091-1/+1
| | | | (#37)
* core: Add Consensus to replace core.Blocklattice (#35)Mission Liao2018-08-081-0/+305
* 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.