From 228a26f53e929d22d6c9b32b72a459fedfb5a0af Mon Sep 17 00:00:00 2001 From: Liam Date: Fri, 25 Aug 2023 23:53:28 +1000 Subject: [PATCH] Merge pull request #312 from XinFinOrg/dev-upgrade CI Upgrade --- .github/pull_request_template.md | 14 +++++++++----- cicd/.dockerignore | 1 + consensus/XDPoS/XDPoS.go | 3 +-- consensus/XDPoS/engines/engine_v2/utils.go | 6 ++++++ internal/ethapi/api.go | 3 +++ params/config.go | 13 ++++++------- 6 files changed, 26 insertions(+), 14 deletions(-) create mode 100644 cicd/.dockerignore diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index c03200b89..151a3fabe 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -6,10 +6,12 @@ Describe the big picture of your changes here to communicate to the maintainers What types of changes does your code introduce to XDC network? _Put an `✅` in the boxes that apply_ -- [ ] Bugfix -- [ ] New feature -- [ ] Documentation Update or any other KTLO -- [ ] Not sure (Please specify below) +- [ ] Bugfix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) +- [ ] Documentation Update (if none of the other choices apply) +- [ ] Regular KTLO or any of the maintaince work. e.g code style +- [ ] CICD Improvement ## Impacted Components Which part of the codebase this PR will touch base on, @@ -30,4 +32,6 @@ _Put an `✅` in the boxes once you have confirmed below actions (or provide rea - [ ] This PR has sufficient test coverage (unit/integration test) OR I have provided reason in the PR description for not having test coverage - [ ] Provide an end-to-end test plan in the PR description on how to manually test it on the devnet/testnet. - [ ] Tested the backwards compatibility. -- [ ] Relevant documentation has been updated as part of this PR \ No newline at end of file +- [ ] Tested with XDC nodes running this version co-exist with those running the previous version. +- [ ] Relevant documentation has been updated as part of this PR +- [ ] N/A diff --git a/cicd/.dockerignore b/cicd/.dockerignore new file mode 100644 index 000000000..1d1fe94df --- /dev/null +++ b/cicd/.dockerignore @@ -0,0 +1 @@ +Dockerfile \ No newline at end of file diff --git a/consensus/XDPoS/XDPoS.go b/consensus/XDPoS/XDPoS.go index ebb7bfaf7..b0a49b2ee 100644 --- a/consensus/XDPoS/XDPoS.go +++ b/consensus/XDPoS/XDPoS.go @@ -315,8 +315,7 @@ func (x *XDPoS) GetSnapshot(chain consensus.ChainReader, header *types.Header) ( } func (x *XDPoS) GetAuthorisedSignersFromSnapshot(chain consensus.ChainReader, header *types.Header) ([]common.Address, error) { - // Legacy V1 function - return []common.Address{}, nil + return x.EngineV2.GetSignersFromSnapshot(chain, header) } func (x *XDPoS) FindParentBlockToAssign(chain consensus.ChainReader, currentBlock *types.Block) *types.Block { diff --git a/consensus/XDPoS/engines/engine_v2/utils.go b/consensus/XDPoS/engines/engine_v2/utils.go index 7e396c2d5..bc2524727 100644 --- a/consensus/XDPoS/engines/engine_v2/utils.go +++ b/consensus/XDPoS/engines/engine_v2/utils.go @@ -6,6 +6,7 @@ import ( "github.com/XinFinOrg/XDC-Subnet/accounts" "github.com/XinFinOrg/XDC-Subnet/common" "github.com/XinFinOrg/XDC-Subnet/consensus/XDPoS/utils" + "github.com/XinFinOrg/XDC-Subnet/consensus" "github.com/XinFinOrg/XDC-Subnet/core/types" "github.com/XinFinOrg/XDC-Subnet/crypto" "github.com/XinFinOrg/XDC-Subnet/crypto/sha3" @@ -157,3 +158,8 @@ func (x *XDPoS_v2) GetRoundNumber(header *types.Header) (types.Round, error) { return decodedExtraField.Round, nil } } + +func (x *XDPoS_v2) GetSignersFromSnapshot(chain consensus.ChainReader, header *types.Header) ([]common.Address, error) { + snap, err := x.getSnapshot(chain, header.Number.Uint64(), false) + return snap.NextEpochMasterNodes, err +} diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index dc1b79ce8..9daf5875f 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -2967,6 +2967,9 @@ func GetSignersFromBlocks(b Backend, blockNumber uint64, blockHash common.Hash, return addrs, err } blockData, err := b.BlockByNumber(nil, rpc.BlockNumber(i)) + if err != nil { + return addrs, err + } signTxs := engine.CacheSigningTxs(header.Hash(), blockData.Transactions()) for _, signtx := range signTxs { blkHash := common.BytesToHash(signtx.Data()[len(signtx.Data())-32:]) diff --git a/params/config.go b/params/config.go index ebd9ea712..bf335dbe4 100644 --- a/params/config.go +++ b/params/config.go @@ -52,9 +52,9 @@ var ( TestnetV2Configs = map[uint64]*V2Config{ Default: { SwitchRound: 0, - CertThreshold: 3, - TimeoutSyncThreshold: 2, - TimeoutPeriod: 4, + CertThreshold: 7, + TimeoutSyncThreshold: 3, + TimeoutPeriod: 60, MinePeriod: 2, }, } @@ -159,10 +159,9 @@ var ( Gap: 450, FoudationWalletAddr: common.HexToAddress("xdc746249c61f5832c5eed53172776b460491bdcd5c"), V2: &V2{ - SwitchBlock: common.TIPV2SwitchBlock, - CurrentConfig: TestnetV2Configs[0], - AllConfigs: TestnetV2Configs, - SkipV2Validation: true, + SwitchBlock: common.TIPV2SwitchBlock, + CurrentConfig: TestnetV2Configs[0], + AllConfigs: TestnetV2Configs, }, }, }