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