Commit graph

11181 commits

Author SHA1 Message Date
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
wgr523
5c326961ce
isEpochSwitch, getMasternodes (#35)
* isEpochSwitch, getMasternodes

* recursive getEpochSwitchInfo, getMasternodes

* more log, make getEpochSwitchInfo clearer
2022-01-08 00:17:21 +08:00
Jerome
ebbbf26127
add isAuthorisedAddress function for v2 consensus (#34)
* add isAuthorisedAddress function for v2 consensus

* update isAuthorisedAddress log messages
2022-01-03 17:06:04 +11:00
Jerome
d43940a837
Merge pull request #33 from hash-laboratories-au/XIN-98-commit-workflow
Commit grand grand parent block(continous rounds) if enough votes or …
2022-01-01 16:21:19 +11:00
Jianrong
15275ded65 Commit grand grand parent block(continous rounds) if enough votes or by proposedBlockHandler 2022-01-01 16:20:33 +11:00
Liam
35eebabae0 xin-106 add generated message into its pool (#32)
* add debug log and change to contain or add for cache

* add generated message into its pool
2021-12-30 11:45:22 +11:00
Jianrong
e0d66d4ea8 add syncInfo test 2021-12-30 11:45:22 +11:00
Jianrong
5f9fd80733 add more propose block handler test 2021-12-30 11:45:22 +11:00
Jianrong
2a94cdebe5 XIN-109: Add more proposed block handler tests 2021-12-30 11:45:22 +11:00
Liam
6c5fe34615 v2 miner function implementation and happy path (#22)
* New struct in consensus/XDPoS/utils/types.go, util functions, and test. (#14)

* define vote, timeout, sync info, qc, tc, extra fields in types.go, add test in types_test.go

* add json tag in types.go, refine encoder decoder of extra fields

* refactor types.go utils.go

* re-write types, comments

* add Hash SigHash for types, and tests

* define Round type

* remove unnecessary logs

* add v2 engine functions placeholder

* typo fix on the consensus v2 function placeholders

* add countdown timer

* make initilised private to countdown

* add v2 specific config struct

* rename some config variables

* Implement BFT Message receiver (#13)

* fix or skip tests due to PR-136 changes

* add bft receiver functions

* add bft receiver functions

* rename tc to TimeoutCert

* implement more functions

* New struct in consensus/XDPoS/utils/types.go, util functions, and test. (#14)

* define vote, timeout, sync info, qc, tc, extra fields in types.go, add test in types_test.go

* add json tag in types.go, refine encoder decoder of extra fields

* refactor types.go utils.go

* re-write types, comments

* add Hash SigHash for types, and tests

* define Round type

* remove unnecessary logs

* add temp functions

* add v2 engine functions placeholder

* typo fix on the consensus v2 function placeholders

* add countdown timer

* make initilised private to countdown

* push verify function

* add test on receiving vote

* revert type change

* add async on broadcast function

* add quit initial

* fix test

Co-authored-by: Jianrong <wjrjerome@gmail.com>
Co-authored-by: wgr523 <wgr523@gmail.com>

* generate and verify timeout message

* Consensus V2 variable, timeout pool (#19)

* fill in XDPoS_v2 variables and processQC/TC

* add timeout pool, refine engine variables

* refactor type functions

* solve a small pointer bug

* create general pool and its test, refine engine

* refine pool, add xdpos v2 config cert threshold

* refine config

* vote and timeout handlers

* fix pool test

* bft miner preparation

* review comment improvement

* update

* relocate tests

* add and remove comment

* fix the syntax error

* update network layer and add handler functions (#23)

* update network layer and add handler functions

* fix test syntax error

* add ProcessQC implementation

* add ProcessQC tests

* add snapshot test

* add wait qc process

* remove testing files

* add route snapshot

* fix merge issue

* add default v2 behaviour (#24)

* add v2 ecrecover functions and refactor test

* fix all the tests

* put minimun lock variable

* debugging prepare and seal v2 blocks

* Trigger proposeBlockHandler after v2 block received and verified in fetcher

* skip snapshot apply related tests

* update test check

* rename bfter to bft handler and ignore normal behviour

* fix bugs during local 4 node run

* fix test

* fix sync info test

* fix bugs during local 4 node run

* rebase and fix bug

* remove hook validators function"

Co-authored-by: wgr523 <wgr523@gmail.com>
Co-authored-by: Jianrong <wjrjerome@gmail.com>
2021-12-30 11:45:18 +11:00
Jianrong
6e13b4d6a2 fix proposed block handler based on review comments 2021-12-30 11:12:21 +11:00
Jianrong
249d2b5b6d implemente proposeblock handler and SyncInfo handler 2021-12-30 11:12:21 +11:00
Liam
17eb4c6c65 add default v2 behaviour (#24) 2021-12-30 11:12:21 +11:00
Jianrong
163ed0fab3 add ProcessQC tests 2021-12-30 11:12:18 +11:00
Jianrong
bd60e1b0cf add ProcessQC implementation 2021-12-30 11:00:20 +11:00
Liam
b9068974f5 update network layer and add handler functions (#23)
* update network layer and add handler functions

* fix test syntax error
2021-12-30 11:00:20 +11:00
Jianrong
17f6e67f58 review comment improvement 2021-12-30 11:00:20 +11:00
Jianrong
98014936c3 fix pool test 2021-12-30 11:00:20 +11:00
Jianrong
a39612e540 vote and timeout handlers 2021-12-30 11:00:20 +11:00
wgr523
d47d9a2a99 Consensus V2 variable, timeout pool (#19)
* fill in XDPoS_v2 variables and processQC/TC

* add timeout pool, refine engine variables

* refactor type functions

* solve a small pointer bug

* create general pool and its test, refine engine

* refine pool, add xdpos v2 config cert threshold

* refine config
2021-12-30 11:00:20 +11:00
Jianrong
4addb69561 generate and verify timeout message 2021-12-30 11:00:20 +11:00
Liam
a1b77f3ca8 Implement BFT Message receiver (#13)
* fix or skip tests due to PR-136 changes

* add bft receiver functions

* add bft receiver functions

* rename tc to TimeoutCert

* implement more functions

* New struct in consensus/XDPoS/utils/types.go, util functions, and test. (#14)

* define vote, timeout, sync info, qc, tc, extra fields in types.go, add test in types_test.go

* add json tag in types.go, refine encoder decoder of extra fields

* refactor types.go utils.go

* re-write types, comments

* add Hash SigHash for types, and tests

* define Round type

* remove unnecessary logs

* add temp functions

* add v2 engine functions placeholder

* typo fix on the consensus v2 function placeholders

* add countdown timer

* make initilised private to countdown

* push verify function

* add test on receiving vote

* revert type change

* add async on broadcast function

* add quit initial

* fix test

Co-authored-by: Jianrong <wjrjerome@gmail.com>
Co-authored-by: wgr523 <wgr523@gmail.com>
2021-12-30 11:00:20 +11:00
Jianrong
521b703207 rename some config variables 2021-12-30 11:00:20 +11:00
Jianrong
1d48ed7d06 add v2 specific config struct 2021-12-30 11:00:20 +11:00
Jianrong
bf56a64fe0 make initilised private to countdown 2021-12-30 11:00:20 +11:00
Jianrong
bcb1fea280 add countdown timer 2021-12-30 11:00:20 +11:00
Jianrong
8891cd167b typo fix on the consensus v2 function placeholders 2021-12-30 11:00:20 +11:00
Jianrong
1da080a371 add v2 engine functions placeholder 2021-12-30 11:00:20 +11:00
wgr523
4453a1e257 New struct in consensus/XDPoS/utils/types.go, util functions, and test. (#14)
* define vote, timeout, sync info, qc, tc, extra fields in types.go, add test in types_test.go

* add json tag in types.go, refine encoder decoder of extra fields

* refactor types.go utils.go

* re-write types, comments

* add Hash SigHash for types, and tests

* define Round type

* remove unnecessary logs
2021-12-30 11:00:20 +11:00
Anil Chinchawale
7808840be0
Merge pull request #149 from XinFinOrg/address_prefix_fix
Fix Invalid address in XDC Console.
2021-12-27 13:01:43 +05:30
Jerome
69cadcc585
Merge pull request #153 from XinFinOrg/fix-block-write-read-race-condition
race condition caused by old eth bug where read before write. We fixi…
2021-12-22 14:47:39 +11:00
Gerui Wang
2969548f68 add warn for reorg 2021-12-21 16:06:16 +08:00
Anil Chinchawale
621555993e
Update version.go 2021-12-21 10:45:43 +04:00
Liam Lai
5061dd9841 add few comments in code 2021-12-21 08:47:23 +03:00