aboutsummaryrefslogtreecommitdiffstats
path: root/core/test
Commit message (Collapse)AuthorAgeFilesLines
* 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.