Commit graph

11214 commits

Author SHA1 Message Date
wgr523
49cecaa9af
XIN-176 fix (#85)
* fix bug in isEpochSwitchAtRound, fix penalty test TestHookPenaltyV2Mining

* fix authorised test

* fix things

* revert a test
2022-05-02 22:46:55 -05:00
Liam Lai
5764dbc249 update test for RemoveItemFromArray 2022-04-14 02:17:30 -06:00
Liam Lai
d0cde5c51e fix new masternode bug 2022-04-14 02:07:26 -06:00
Liam
92857e50e5
xin-177 check penalty only on epoch switch block and Add Hook on initial (#78)
* check penalty only on epoch switch block

* skip calculate penalty on first v2 block

* clean code, its doing same thing
2022-04-02 22:59:39 -06:00
Jerome
0ded664f0c
add highestSelfMinedRound to make sure we mine once per round (#79) 2022-04-03 12:45:25 +10:00
Jerome
0241d40699
verify headers shall use parent block if not present in the chain (#77) 2022-04-01 00:11:04 -06:00
Jerome
cb67e8e26a
Xin 163 (#76)
* clean up the pool old round

* add unit test to cover the vote key format

* add gapNumber to the vote pool key

* fix race condition in pool

* remove verify gap number in vote handler
2022-04-01 14:59:16 +11:00
Jerome
b98005a8dd
Xin 166 (#75)
* typo and checkYourturnWithinFinalisedMasternodes func name to yourturn

* remove redundant code from verifyQC

* Verify QC to optionally pass parent header. This is used to help verifyHeaders

* move difficulty into its own file
2022-03-27 20:39:40 +11:00
wgr523
b790b077c9
XIN-164 add GapNumber inside Vote, and tests (#74) 2022-03-25 23:22:24 +08:00
Liam
a3d5d82722
xin-168 node stops because dead lock on timeout events (#73)
* fix race condition issue

* add test to prove
2022-03-25 21:24:35 +11:00
Jerome
ee025383c1
check yourturn again during prepare (#72) 2022-03-25 21:03:37 +11:00
Jerome
d55229677d
verify header including validator (#71)
* verify header including validator

* re-structure v1 v2 tests

* remove unused test function

* add test to check coinbase and validator address matches

* refactor engine v2 to group private functions into same file
2022-03-20 21:14:35 +11:00
Liam
fbb9e87251
fix error log (#70) 2022-03-14 00:14:47 +01:00
Jerome
9bb1a6e1b3
XIN-159, 160 and 161 (#69)
* XIN-159, 160 and 161

* update the bft handler to make sure we don't process dis-qualified messages

* add verify header missing checks and its tests
2022-03-13 22:00:26 +11:00
Liam
a4b362ae9a
Xin 147 initial for both first v2 block and further, also introduce getExtraField function (#64)
* refactor initial and introduce getExtraField function

* add test for initial

* refactor snapshot

* initial first snapshot only
2022-03-08 20:34:11 +01:00
Liam
7fca1a627a
xin-144 avoid duplicate messages (#68)
* avoid duplicate messages

* update comment
2022-03-08 19:36:02 +01:00
Jerome
8363641b2c
check against master node list before sending out anything (#67)
* check against master node list before sending out anything

* remove duplicated signatures from QC

* add break when checking allowed to send
2022-03-08 09:12:52 +11:00
Jerome
6090b7f02e
XIN-154 fix verify header bug on Validators (#66) 2022-03-07 18:53:55 +08:00
Liam
d975ba4014
xin-153 Broadcast syncInfo when consecutive timeouts of same round (#65)
* Broadcast syncInfo when consecutive timeouts of same round

* add test

* revert test period
2022-03-05 01:52:20 +01:00
Jerome
e493ddfd6d
add verifyTC and verifyTimeoutMessage (#63)
* add verifyTC and verifyTimeoutMessage

* remove v2 func from adaptor
2022-03-02 09:17:57 +11:00
Jerome
d773e15ca8
Xin 137 (#62)
* add GapNumber

* fix broken countdown test

* add gapNumber to existing tests
2022-02-28 18:51:42 +11:00
Jerome
97985fda85
move verify QC into verify header, fix broken tests etc (#61) 2022-02-27 10:25:26 +11:00
Jerome
431c870fa0
verify vote (#50)
* verify vote

* fix vote tests and add temporary solution for initialize

* remove the drop peer comment
2022-02-26 17:42:08 +11:00
Liam
0ab7bfbcbd
Merge pull request #58 from hash-laboratories-au/XIN-125-happy-path-fix
Xin 125 happy path fix
2022-02-21 02:51:48 +03:00
Liam Lai
491dc911f3 refactor big int compare and fix 1 bug on headers 2022-02-21 01:16:33 +03:00
Liam
18a64d36ba
Merge pull request #60 from hash-laboratories-au/XIN-136-verifyblockInfo
add verify blockInfo function
2022-02-21 00:51:19 +03:00
Jianrong
221326aafc remove isemptyhash 2022-02-20 22:10:23 +11:00
Jianrong
c77a641638 add verify blockInfo function 2022-02-20 21:06:05 +11:00
Jianrong
cddeaf2db1 add v2 verify header 2022-02-19 19:36:32 +11:00
Jianrong
5733474c14 add v1 snapshot fix 2022-02-19 16:50:00 +11:00
Jianrong
125f8a8957 Split initialise v2 into two scenarios 2022-02-19 16:17:27 +11:00
wgr523
89acbdd742
XIN-121 Reward hook (#57)
* v2 Hook Reward, need test

* test reward

* fix RewardHook due to modifying params config directly (#56)

* more test

* finish test

Co-authored-by: Jerome <wjrjerome@gmail.com>
2022-02-19 15:31:19 +11:00
wgr523
9b47146120
add calcMasternodes, HookPenalty for v2, tests (#52) 2022-02-13 22:15:23 +08:00
Liam
5a3acd173d
Xin-124 Deal with Block Time mine time (#55)
* add wait v2 period in miner

* add perido initial

* add mine and wait time

* update todo

* merge all xdc test config into 1
2022-02-13 11:40:47 +11:00
Liam
4424c7d01e
move config into code (#54)
* move config into code

* set devnet switch block number very high

* increase timeout and certThreshold for devnet config

Co-authored-by: Jianrong <wjrjerome@gmail.com>
2022-02-12 13:36:08 +11:00
Jerome
76724b06d7
only broadcast vote, timeout and syncinfo if the peer do not have it (#53) 2022-02-12 10:17:19 +11:00
Liam
da336f53b1
xin-95 add xdpos2 protocol (#47)
* add xdpos2 protocol

* update xdpos2 command
2022-02-05 23:25:23 +03:00
Jerome
23cbf68307
fix vote and block insertion race condition (#51)
* fix vote and block insertion race condition

* fix race condition in the vote handler using multiple go routine

* check go routine race condition during ci cd

* remove race check as there are eth code that is failing

* remove unused signature list variable
2022-02-03 23:27:50 +11:00
Jerome
7cc2bef2d3
update adaptor for verify headers and fix vote handler to include +1 distance when checking rounds (#48) 2022-01-30 14:26:05 +11:00
Jerome
328d555b9b
Xin 138 (#49)
* check block header after vote pool reached

* refactor test_helper to fix issues with tests randomly failing
2022-01-30 13:00:24 +11:00
Jerome
dc15891d1f
add comment for verify steps (#45) 2022-01-27 21:15:09 +11:00
Liam
ff0fcd3951
add test and fix issue on happy path (#46)
* add test and fix issue on happy path

* add prepare test

* update comment
2022-01-25 10:51:17 +03:00
wgr523
05d315d2e3
finish YourTurn handling v1->v2 switch, add test (#44) 2022-01-23 14:26:37 +11:00
Jerome
e063f67f34
implement verify functions (#43)
* implement verify functions

* Use go routine to call verifyMsgSignature

* verify timeout msg shall use round from the msg

* add comment for verifyQC
2022-01-21 21:10:44 +11:00
Liam
646042a651
Xin 127 initial v2 function and snapshot (#42)
* initial v2 and v2 snapshot

* update based on pr feedback

* add test for initial v2 parameters

* remove comment
2022-01-20 18:27:51 +08:00
Liam
e72d4866df
Xin 118 refactor yourturn in v1 and miner (#41)
* refactor wait log into adaptor

* refactor v1 yourturn
2022-01-20 02:28:15 +11:00
Liam
aab040fd55
adjust lock (#39)
* adjust lock

* change error log

* change error log
2022-01-16 13:31:23 +03:00
Jerome
38c3582841
Add v2 yourturn (#38)
* Add v2 yourturn

* add isEpochSwitchByRound into YourTurn

Co-authored-by: Gerui Wang <wgr523@gmail.com>
2022-01-16 19:18:01 +11:00
Jerome
f8d3f9f8c6
Xin 113 is epoch switch (#37)
* add isEpochSwitch function and refactor utils

* fix broken first v2 epoch switch block

* use adaptor epoch switch function to determine v1 v2 epoch swtich block

* add test for the GetMasternodesByNumber and GetCurrentEpochSwitchBlock function

* add v2 test for isAuthroisedAddress

* Use GetCurrentEpochSwitchBlock in findNearestSignedBlock api
2022-01-14 21:38:38 +11:00
Liam
3ac908be8d
xin-104 (#36)
* hand and vote self mined block

* add error log
2022-01-08 10:56:00 +11:00