From 0222ce7479bd1a3d929d967c549699bf2bcf3577 Mon Sep 17 00:00:00 2001 From: lx <92799281+brilliant-lx@users.noreply.github.com> Date: Fri, 21 Apr 2023 17:07:11 +0800 Subject: [PATCH 1/6] upgrade: rename hardfork to Luban & Plato (#1504) --- CHANGELOG.md | 3 +- consensus/parlia/abi.go | 2 +- .../parlia/{bonehFork.go => lubanFork.go} | 6 +- consensus/parlia/parlia.go | 52 ++++++++-------- consensus/parlia/snapshot.go | 16 ++--- core/forkchoice.go | 4 +- core/systemcontracts/upgrade.go | 18 +++--- core/vm/contracts.go | 16 ++--- core/vm/evm.go | 4 +- eth/gasprice/gasprice_test.go | 4 +- eth/handler_eth_test.go | 4 +- params/config.go | 62 +++++++++---------- 12 files changed, 95 insertions(+), 96 deletions(-) rename consensus/parlia/{bonehFork.go => lubanFork.go} (87%) diff --git a/CHANGELOG.md b/CHANGELOG.md index e8075e6ce..780fe2e16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ FEATURE * [\#1325](https://github.com/bnb-chain/bsc/pull/1325) genesis: add BEP174 changes to relayer contract * [\#1357](https://github.com/bnb-chain/bsc/pull/1357) Integration API for EIP-4337 bundler with an L2 validator/sequencer * [\#1463](https://github.com/bnb-chain/bsc/pull/1463) BEP-221: implement cometBFT light block validation -* [\#1493](https://github.com/bnb-chain/bsc/pull/1493) bep: update the bytecode of boneh fork after the contract release +* [\#1493](https://github.com/bnb-chain/bsc/pull/1493) bep: update the bytecode of luban fork after the contract release IMPROVEMENT * [\#1486](https://github.com/bnb-chain/bsc/pull/1486) feature: remove diff protocol registration @@ -91,7 +91,6 @@ BUGFIX ## v1.1.18 IMPROVEMENT - * [\#1209](https://github.com/bnb-chain/bsc/pull/1209) metrics: add build info into metrics server * [\#1204](https://github.com/bnb-chain/bsc/pull/1204) worker: NewTxsEvent and triePrefetch reuse in mining task * [\#1195](https://github.com/bnb-chain/bsc/pull/1195) hardfork: update Gibbs fork height and system contract code diff --git a/consensus/parlia/abi.go b/consensus/parlia/abi.go index 16ddb1eab..ffe97a45c 100644 --- a/consensus/parlia/abi.go +++ b/consensus/parlia/abi.go @@ -1,6 +1,6 @@ package parlia -const validatorSetABIBeforeBoneh = ` +const validatorSetABIBeforeLuban = ` [ { "anonymous": false, diff --git a/consensus/parlia/bonehFork.go b/consensus/parlia/lubanFork.go similarity index 87% rename from consensus/parlia/bonehFork.go rename to consensus/parlia/lubanFork.go index f8a262b40..6ce14364c 100644 --- a/consensus/parlia/bonehFork.go +++ b/consensus/parlia/lubanFork.go @@ -13,7 +13,7 @@ import ( "github.com/ethereum/go-ethereum/rpc" ) -func (p *Parlia) getCurrentValidatorsBeforeBoneh(blockHash common.Hash, blockNumber *big.Int) ([]common.Address, error) { +func (p *Parlia) getCurrentValidatorsBeforeLuban(blockHash common.Hash, blockNumber *big.Int) ([]common.Address, error) { blockNr := rpc.BlockNumberOrHashWithHash(blockHash, false) // prepare different method @@ -25,7 +25,7 @@ func (p *Parlia) getCurrentValidatorsBeforeBoneh(blockHash common.Hash, blockNum ctx, cancel := context.WithCancel(context.Background()) // cancel when we are finished consuming integers defer cancel() - data, err := p.validatorSetABIBeforeBoneh.Pack(method) + data, err := p.validatorSetABIBeforeLuban.Pack(method) if err != nil { log.Error("Unable to pack tx for getValidators", "error", err) return nil, err @@ -44,6 +44,6 @@ func (p *Parlia) getCurrentValidatorsBeforeBoneh(blockHash common.Hash, blockNum } var valSet []common.Address - err = p.validatorSetABIBeforeBoneh.UnpackIntoInterface(&valSet, method, result) + err = p.validatorSetABIBeforeLuban.UnpackIntoInterface(&valSet, method, result) return valSet, err } diff --git a/consensus/parlia/parlia.go b/consensus/parlia/parlia.go index aaa2f32cb..9fc0a0fcf 100644 --- a/consensus/parlia/parlia.go +++ b/consensus/parlia/parlia.go @@ -56,9 +56,9 @@ const ( extraSeal = 65 // Fixed number of extra-data suffix bytes reserved for signer seal nextForkHashSize = 4 // Fixed number of extra-data suffix bytes reserved for nextForkHash. - validatorBytesLengthBeforeBoneh = common.AddressLength + validatorBytesLengthBeforeLuban = common.AddressLength validatorBytesLength = common.AddressLength + types.BLSPublicKeyLength - validatorNumberSize = 1 // Fixed number of extra prefix bytes reserved for validator number after Boneh + validatorNumberSize = 1 // Fixed number of extra prefix bytes reserved for validator number after Luban wiggleTime = uint64(1) // second, Random delay (per signer) to allow concurrent signers initialBackOffTime = uint64(1) // second @@ -217,7 +217,7 @@ type Parlia struct { ethAPI *ethapi.PublicBlockChainAPI VotePool consensus.VotePool - validatorSetABIBeforeBoneh abi.ABI + validatorSetABIBeforeLuban abi.ABI validatorSetABI abi.ABI slashABI abi.ABI @@ -249,7 +249,7 @@ func New( if err != nil { panic(err) } - vABIBeforeBoneh, err := abi.JSON(strings.NewReader(validatorSetABIBeforeBoneh)) + vABIBeforeLuban, err := abi.JSON(strings.NewReader(validatorSetABIBeforeLuban)) if err != nil { panic(err) } @@ -269,7 +269,7 @@ func New( ethAPI: ethAPI, recentSnaps: recentSnaps, signatures: signatures, - validatorSetABIBeforeBoneh: vABIBeforeBoneh, + validatorSetABIBeforeLuban: vABIBeforeLuban, validatorSetABI: vABI, slashABI: sABI, signer: types.NewEIP155Signer(chainConfig.ChainID), @@ -333,16 +333,16 @@ func (p *Parlia) VerifyHeaders(chain consensus.ChainHeaderReader, headers []*typ // getValidatorBytesFromHeader returns the validators bytes extracted from the header's extra field if exists. // The validators bytes would be contained only in the epoch block's header, and its each validator bytes length is fixed. -// On boneh fork, we introduce vote attestation into the header's extra field, so extra format is different from before. -// Before boneh fork: |---Extra Vanity---|---Validators Bytes (or Empty)---|---Extra Seal---| -// After boneh fork: |---Extra Vanity---|---Validators Number and Validators Bytes (or Empty)---|---Vote Attestation (or Empty)---|---Extra Seal---| +// On luban fork, we introduce vote attestation into the header's extra field, so extra format is different from before. +// Before luban fork: |---Extra Vanity---|---Validators Bytes (or Empty)---|---Extra Seal---| +// After luban fork: |---Extra Vanity---|---Validators Number and Validators Bytes (or Empty)---|---Vote Attestation (or Empty)---|---Extra Seal---| func getValidatorBytesFromHeader(header *types.Header, chainConfig *params.ChainConfig, parliaConfig *params.ParliaConfig) []byte { if len(header.Extra) <= extraVanity+extraSeal { return nil } - if !chainConfig.IsBoneh(header.Number) { - if header.Number.Uint64()%parliaConfig.Epoch == 0 && (len(header.Extra)-extraSeal-extraVanity)%validatorBytesLengthBeforeBoneh != 0 { + if !chainConfig.IsLuban(header.Number) { + if header.Number.Uint64()%parliaConfig.Epoch == 0 && (len(header.Extra)-extraSeal-extraVanity)%validatorBytesLengthBeforeLuban != 0 { return nil } return header.Extra[extraVanity : len(header.Extra)-extraSeal] @@ -366,7 +366,7 @@ func getVoteAttestationFromHeader(header *types.Header, chainConfig *params.Chai return nil, nil } - if !chainConfig.IsBoneh(header.Number) { + if !chainConfig.IsLuban(header.Number) { return nil, nil } @@ -596,7 +596,7 @@ func (p *Parlia) verifyCascadingFields(chain consensus.ChainHeaderReader, header // Verify vote attestation for fast finality. if err := p.verifyVoteAttestation(chain, header, parents); err != nil { - if chain.Config().IsLynn(header.Number) { + if chain.Config().IsPlato(header.Number) { return err } log.Warn("Verify vote attestation failed", "error", err, "hash", header.Hash(), "number", header.Number, @@ -691,9 +691,9 @@ func (p *Parlia) snapshot(chain consensus.ChainHeaderReader, number uint64, hash verifiedAttestations := make(map[common.Hash]struct{}, len(headers)) for index, header := range headers { - // vote attestation should be checked here to decide whether to update attestation of snapshot between [Boneh,Lynn) - // because err of verifyVoteAttestation is ignored when importing blocks and headers before Lynn. - if p.chainConfig.IsBoneh(header.Number) && !p.chainConfig.IsLynn(header.Number) && p.verifyVoteAttestation(chain, header, headers[:index]) == nil { + // vote attestation should be checked here to decide whether to update attestation of snapshot between [Luban,Plato) + // because err of verifyVoteAttestation is ignored when importing blocks and headers before Plato. + if p.chainConfig.IsLuban(header.Number) && !p.chainConfig.IsPlato(header.Number) && p.verifyVoteAttestation(chain, header, headers[:index]) == nil { verifiedAttestations[header.Hash()] = struct{}{} } } @@ -792,7 +792,7 @@ func (p *Parlia) prepareValidators(header *types.Header) error { } // sort validator by address sort.Sort(validatorsAscending(newValidators)) - if !p.chainConfig.IsBoneh(header.Number) { + if !p.chainConfig.IsLuban(header.Number) { for _, validator := range newValidators { header.Extra = append(header.Extra, validator.Bytes()...) } @@ -807,7 +807,7 @@ func (p *Parlia) prepareValidators(header *types.Header) error { } func (p *Parlia) assembleVoteAttestation(chain consensus.ChainHeaderReader, header *types.Header) error { - if !p.chainConfig.IsBoneh(header.Number) || header.Number.Uint64() < 2 { + if !p.chainConfig.IsLuban(header.Number) || header.Number.Uint64() < 2 { return nil } @@ -942,10 +942,10 @@ func (p *Parlia) verifyValidators(header *types.Header) error { sort.Sort(validatorsAscending(newValidators)) var validatorsBytes []byte validatorsNumber := len(newValidators) - if !p.chainConfig.IsBoneh(header.Number) { - validatorsBytes = make([]byte, validatorsNumber*validatorBytesLengthBeforeBoneh) + if !p.chainConfig.IsLuban(header.Number) { + validatorsBytes = make([]byte, validatorsNumber*validatorBytesLengthBeforeLuban) for i, validator := range newValidators { - copy(validatorsBytes[i*validatorBytesLengthBeforeBoneh:], validator.Bytes()) + copy(validatorsBytes[i*validatorBytesLengthBeforeLuban:], validator.Bytes()) } } else { if uint8(validatorsNumber) != header.Extra[extraVanity] { @@ -1090,7 +1090,7 @@ func (p *Parlia) Finalize(chain consensus.ChainHeaderReader, header *types.Heade return err } - if p.chainConfig.IsLynn(header.Number) { + if p.chainConfig.IsPlato(header.Number) { if err := p.distributeFinalityReward(chain, state, header, cx, txs, receipts, systemTxs, usedGas, false); err != nil { return err } @@ -1147,7 +1147,7 @@ func (p *Parlia) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header * return nil, nil, err } - if p.chainConfig.IsLynn(header.Number) { + if p.chainConfig.IsPlato(header.Number) { if err := p.distributeFinalityReward(chain, state, header, cx, &txs, &receipts, nil, &header.GasUsed, true); err != nil { return nil, nil, err } @@ -1479,8 +1479,8 @@ func (p *Parlia) getCurrentValidators(blockHash common.Hash, blockNum *big.Int) // block blockNr := rpc.BlockNumberOrHashWithHash(blockHash, false) - if !p.chainConfig.IsBoneh(blockNum) { - validators, err := p.getCurrentValidatorsBeforeBoneh(blockHash, blockNum) + if !p.chainConfig.IsLuban(blockNum) { + validators, err := p.getCurrentValidatorsBeforeLuban(blockHash, blockNum) return validators, nil, err } @@ -1723,7 +1723,7 @@ func (p *Parlia) GetJustifiedNumberAndHash(chain consensus.ChainHeaderReader, he } if snap.Attestation == nil { - if p.chainConfig.IsBoneh(header.Number) { + if p.chainConfig.IsLuban(header.Number) { log.Debug("once one attestation generated, attestation of snap would not be nil forever basically") } return 0, chain.GetHeaderByNumber(0).Hash(), nil @@ -1739,7 +1739,7 @@ func (p *Parlia) GetFinalizedHeader(chain consensus.ChainHeaderReader, header *t if chain == nil || header == nil { return nil } - if !chain.Config().IsLynn(header.Number) { + if !chain.Config().IsPlato(header.Number) { return chain.GetHeaderByNumber(0) } if header.Number.Uint64() < backward { diff --git a/consensus/parlia/snapshot.go b/consensus/parlia/snapshot.go index 7be414421..ccc81d7f6 100644 --- a/consensus/parlia/snapshot.go +++ b/consensus/parlia/snapshot.go @@ -74,7 +74,7 @@ func newSnapshot( Validators: make(map[common.Address]*ValidatorInfo), } for idx, v := range validators { - // The boneh fork from the genesis block + // The luban fork from the genesis block if len(voteAddrs) == len(validators) { snap.Validators[v] = &ValidatorInfo{ VoteAddress: voteAddrs[idx], @@ -84,7 +84,7 @@ func newSnapshot( } } - // The boneh fork from the genesis block + // The luban fork from the genesis block if len(voteAddrs) == len(validators) { validators := snap.validators() for idx, v := range validators { @@ -249,7 +249,7 @@ func (s *Snapshot) apply(headers []*types.Header, chain consensus.ChainHeaderRea } newVals := make(map[common.Address]*ValidatorInfo, len(newValArr)) for idx, val := range newValArr { - if !chainConfig.IsBoneh(header.Number) { + if !chainConfig.IsLuban(header.Number) { newVals[val] = &ValidatorInfo{} } else { newVals[val] = &ValidatorInfo{ @@ -272,7 +272,7 @@ func (s *Snapshot) apply(headers []*types.Header, chain consensus.ChainHeaderRea } } snap.Validators = newVals - if chainConfig.IsBoneh(header.Number) { + if chainConfig.IsLuban(header.Number) { validators := snap.validators() for idx, val := range validators { snap.Validators[val].Index = idx + 1 // offset by 1 @@ -281,7 +281,7 @@ func (s *Snapshot) apply(headers []*types.Header, chain consensus.ChainHeaderRea } _, voteAssestationNoErr := verifiedAttestations[header.Hash()] - if chainConfig.IsLynn(header.Number) || (chainConfig.IsBoneh(header.Number) && voteAssestationNoErr) { + if chainConfig.IsPlato(header.Number) || (chainConfig.IsLuban(header.Number) && voteAssestationNoErr) { snap.updateAttestation(header, chainConfig, s.config) } @@ -355,11 +355,11 @@ func parseValidators(header *types.Header, chainConfig *params.ChainConfig, parl return nil, nil, errors.New("invalid validators bytes") } - if !chainConfig.IsBoneh(header.Number) { - n := len(validatorsBytes) / validatorBytesLengthBeforeBoneh + if !chainConfig.IsLuban(header.Number) { + n := len(validatorsBytes) / validatorBytesLengthBeforeLuban result := make([]common.Address, n) for i := 0; i < n; i++ { - result[i] = common.BytesToAddress(validatorsBytes[i*validatorBytesLengthBeforeBoneh : (i+1)*validatorBytesLengthBeforeBoneh]) + result[i] = common.BytesToAddress(validatorsBytes[i*validatorBytesLengthBeforeLuban : (i+1)*validatorBytesLengthBeforeLuban]) } return result, nil, nil } diff --git a/core/forkchoice.go b/core/forkchoice.go index da32ccce6..452c084ee 100644 --- a/core/forkchoice.go +++ b/core/forkchoice.go @@ -122,10 +122,10 @@ func (f *ForkChoice) ReorgNeededWithFastFinality(current *types.Header, header * } justifiedNumber, curJustifiedNumber := uint64(0), uint64(0) - if f.chain.Config().IsLynn(header.Number) { + if f.chain.Config().IsPlato(header.Number) { justifiedNumber = f.chain.GetJustifiedNumber(header) } - if f.chain.Config().IsLynn(current.Number) { + if f.chain.Config().IsPlato(current.Number) { curJustifiedNumber = f.chain.GetJustifiedNumber(current) } if justifiedNumber == curJustifiedNumber { diff --git a/core/systemcontracts/upgrade.go b/core/systemcontracts/upgrade.go index 6de100951..e323035b2 100644 --- a/core/systemcontracts/upgrade.go +++ b/core/systemcontracts/upgrade.go @@ -52,7 +52,7 @@ var ( planckUpgrade = make(map[string]*Upgrade) - bonehUpgrade = make(map[string]*Upgrade) + lubanUpgrade = make(map[string]*Upgrade) ) func init() { @@ -553,8 +553,8 @@ func init() { }, } - bonehUpgrade[mainNet] = &Upgrade{ - UpgradeName: "boneh", + lubanUpgrade[mainNet] = &Upgrade{ + UpgradeName: "luban", Configs: []*UpgradeConfig{ { ContractAddr: common.HexToAddress(ValidatorContract), @@ -584,8 +584,8 @@ func init() { }, } - bonehUpgrade[chapelNet] = &Upgrade{ - UpgradeName: "boneh", + lubanUpgrade[chapelNet] = &Upgrade{ + UpgradeName: "luban", Configs: []*UpgradeConfig{ { ContractAddr: common.HexToAddress(ValidatorContract), @@ -615,8 +615,8 @@ func init() { }, } - bonehUpgrade[rialtoNet] = &Upgrade{ - UpgradeName: "boneh", + lubanUpgrade[rialtoNet] = &Upgrade{ + UpgradeName: "luban", Configs: []*UpgradeConfig{ { ContractAddr: common.HexToAddress(ValidatorContract), @@ -697,8 +697,8 @@ func UpgradeBuildInSystemContract(config *params.ChainConfig, blockNumber *big.I applySystemContractUpgrade(planckUpgrade[network], blockNumber, statedb, logger) } - if config.IsOnBoneh(blockNumber) { - applySystemContractUpgrade(bonehUpgrade[network], blockNumber, statedb, logger) + if config.IsOnLuban(blockNumber) { + applySystemContractUpgrade(lubanUpgrade[network], blockNumber, statedb, logger) } /* diff --git a/core/vm/contracts.go b/core/vm/contracts.go index 91b03dfac..acdf9e7cf 100644 --- a/core/vm/contracts.go +++ b/core/vm/contracts.go @@ -141,9 +141,9 @@ var PrecompiledContractsBerlin = map[common.Address]PrecompiledContract{ common.BytesToAddress([]byte{9}): &blake2F{}, } -// PrecompiledContractsBoneh contains the default set of pre-compiled Ethereum -// contracts used in the Boneh release. -var PrecompiledContractsBoneh = map[common.Address]PrecompiledContract{ +// PrecompiledContractsLuban contains the default set of pre-compiled Ethereum +// contracts used in the Luban release. +var PrecompiledContractsLuban = map[common.Address]PrecompiledContract{ common.BytesToAddress([]byte{1}): &ecrecover{}, common.BytesToAddress([]byte{2}): &sha256hash{}, common.BytesToAddress([]byte{3}): &ripemd160hash{}, @@ -175,7 +175,7 @@ var PrecompiledContractsBLS = map[common.Address]PrecompiledContract{ } var ( - PrecompiledAddressesBoneh []common.Address + PrecompiledAddressesLuban []common.Address PrecompiledAddressesPlanck []common.Address PrecompiledAddressesMoran []common.Address PrecompiledAddressesNano []common.Address @@ -207,16 +207,16 @@ func init() { for k := range PrecompiledContractsPlanck { PrecompiledAddressesPlanck = append(PrecompiledAddressesPlanck, k) } - for k := range PrecompiledContractsBoneh { - PrecompiledAddressesBoneh = append(PrecompiledAddressesBoneh, k) + for k := range PrecompiledContractsLuban { + PrecompiledAddressesLuban = append(PrecompiledAddressesLuban, k) } } // ActivePrecompiles returns the precompiles enabled with the current configuration. func ActivePrecompiles(rules params.Rules) []common.Address { switch { - case rules.IsBoneh: - return PrecompiledAddressesBoneh + case rules.IsLuban: + return PrecompiledAddressesLuban case rules.IsPlanck: return PrecompiledAddressesPlanck case rules.IsMoran: diff --git a/core/vm/evm.go b/core/vm/evm.go index 7ad12a825..440c47fab 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -52,8 +52,8 @@ type ( func (evm *EVM) precompile(addr common.Address) (PrecompiledContract, bool) { var precompiles map[common.Address]PrecompiledContract switch { - case evm.chainRules.IsBoneh: - precompiles = PrecompiledContractsBoneh + case evm.chainRules.IsLuban: + precompiles = PrecompiledContractsLuban case evm.chainRules.IsPlanck: precompiles = PrecompiledContractsPlanck case evm.chainRules.IsMoran: diff --git a/eth/gasprice/gasprice_test.go b/eth/gasprice/gasprice_test.go index a6f0f5364..2820cc683 100644 --- a/eth/gasprice/gasprice_test.go +++ b/eth/gasprice/gasprice_test.go @@ -136,8 +136,8 @@ func newTestBackend(t *testing.T, londonBlock *big.Int, pending bool) *testBacke config.LondonBlock = londonBlock config.ArrowGlacierBlock = londonBlock config.GibbsBlock = nil - config.BonehBlock = nil - config.LynnBlock = nil + config.LubanBlock = nil + config.PlatoBlock = nil engine := ethash.NewFaker() db := rawdb.NewMemoryDatabase() genesis, err := gspec.Commit(db) diff --git a/eth/handler_eth_test.go b/eth/handler_eth_test.go index de57e475c..0144332e1 100644 --- a/eth/handler_eth_test.go +++ b/eth/handler_eth_test.go @@ -108,8 +108,8 @@ func testForkIDSplit(t *testing.T, protocol uint) { GibbsBlock: big.NewInt(5), NanoBlock: big.NewInt(5), MoranBlock: big.NewInt(5), - BonehBlock: big.NewInt(6), - LynnBlock: big.NewInt(6), + LubanBlock: big.NewInt(6), + PlatoBlock: big.NewInt(6), } dbNoFork = rawdb.NewMemoryDatabase() dbProFork = rawdb.NewMemoryDatabase() diff --git a/params/config.go b/params/config.go index ce03668b2..da7f40128 100644 --- a/params/config.go +++ b/params/config.go @@ -192,8 +192,8 @@ var ( // TODO modify blockNumber, make sure the blockNumber is not an integer multiple of 200 (epoch number) // TODO Caution !!! it should be very careful !!! - BonehBlock: nil, - LynnBlock: nil, + LubanBlock: nil, + PlatoBlock: nil, Parlia: &ParliaConfig{ Period: 3, @@ -224,8 +224,8 @@ var ( // TODO modify blockNumber, make sure the blockNumber is not an integer multiple of 200 (epoch number) // TODO Caution !!! it should be very careful !!! - BonehBlock: big.NewInt(29295050), - LynnBlock: nil, + LubanBlock: big.NewInt(29295050), + PlatoBlock: nil, Parlia: &ParliaConfig{ Period: 3, @@ -255,8 +255,8 @@ var ( PlanckBlock: nil, // TODO - BonehBlock: nil, - LynnBlock: nil, + LubanBlock: nil, + PlatoBlock: nil, Parlia: &ParliaConfig{ Period: 3, @@ -376,8 +376,8 @@ type ChainConfig struct { NanoBlock *big.Int `json:"nanoBlock,omitempty" toml:",omitempty"` // nanoBlock switch block (nil = no fork, 0 = already activated) MoranBlock *big.Int `json:"moranBlock,omitempty" toml:",omitempty"` // moranBlock switch block (nil = no fork, 0 = already activated) PlanckBlock *big.Int `json:"planckBlock,omitempty" toml:",omitempty"` // planckBlock switch block (nil = no fork, 0 = already activated) - BonehBlock *big.Int `json:"bonehBlock,omitempty" toml:",omitempty"` // bonehBlock switch block (nil = no fork, 0 = already activated) - LynnBlock *big.Int `json:"lynnBlock,omitempty" toml:",omitempty"` // lynnBlock switch block (nil = no fork, 0 = already activated) + LubanBlock *big.Int `json:"lubanBlock,omitempty" toml:",omitempty"` // lubanBlock switch block (nil = no fork, 0 = already activated) + PlatoBlock *big.Int `json:"platoBlock,omitempty" toml:",omitempty"` // platoBlock switch block (nil = no fork, 0 = already activated) // Various consensus engines Ethash *EthashConfig `json:"ethash,omitempty" toml:",omitempty"` @@ -429,7 +429,7 @@ func (c *ChainConfig) String() string { engine = "unknown" } - return fmt.Sprintf("{ChainID: %v Homestead: %v DAO: %v DAOSupport: %v EIP150: %v EIP155: %v EIP158: %v Byzantium: %v Constantinople: %v Petersburg: %v Istanbul: %v, Muir Glacier: %v, Ramanujan: %v, Niels: %v, MirrorSync: %v, Bruno: %v, Berlin: %v, YOLO v3: %v, CatalystBlock: %v, London: %v, ArrowGlacier: %v, MergeFork:%v, Euler: %v, Gibbs: %v, Nano: %v, Moran: %v, Planck: %v,Boneh: %v, Lynn: %v, Engine: %v}", + return fmt.Sprintf("{ChainID: %v Homestead: %v DAO: %v DAOSupport: %v EIP150: %v EIP155: %v EIP158: %v Byzantium: %v Constantinople: %v Petersburg: %v Istanbul: %v, Muir Glacier: %v, Ramanujan: %v, Niels: %v, MirrorSync: %v, Bruno: %v, Berlin: %v, YOLO v3: %v, CatalystBlock: %v, London: %v, ArrowGlacier: %v, MergeFork:%v, Euler: %v, Gibbs: %v, Nano: %v, Moran: %v, Planck: %v,Luban: %v, Plato: %v, Engine: %v}", c.ChainID, c.HomesteadBlock, c.DAOForkBlock, @@ -457,8 +457,8 @@ func (c *ChainConfig) String() string { c.NanoBlock, c.MoranBlock, c.PlanckBlock, - c.BonehBlock, - c.LynnBlock, + c.LubanBlock, + c.PlatoBlock, engine, ) } @@ -548,24 +548,24 @@ func (c *ChainConfig) IsOnEuler(num *big.Int) bool { return configNumEqual(c.EulerBlock, num) } -// IsBoneh returns whether num is either equal to the first fast finality fork block or greater. -func (c *ChainConfig) IsBoneh(num *big.Int) bool { - return isForked(c.BonehBlock, num) +// IsLuban returns whether num is either equal to the first fast finality fork block or greater. +func (c *ChainConfig) IsLuban(num *big.Int) bool { + return isForked(c.LubanBlock, num) } -// IsOnBoneh returns whether num is equal to the first fast finality fork block. -func (c *ChainConfig) IsOnBoneh(num *big.Int) bool { - return configNumEqual(c.BonehBlock, num) +// IsOnLuban returns whether num is equal to the first fast finality fork block. +func (c *ChainConfig) IsOnLuban(num *big.Int) bool { + return configNumEqual(c.LubanBlock, num) } -// IsLynn returns whether num is either equal to the second fast finality fork block or greater. -func (c *ChainConfig) IsLynn(num *big.Int) bool { - return isForked(c.LynnBlock, num) +// IsPlato returns whether num is either equal to the second fast finality fork block or greater. +func (c *ChainConfig) IsPlato(num *big.Int) bool { + return isForked(c.PlatoBlock, num) } -// IsOnLynn returns whether num is equal to the second fast finality fork block. -func (c *ChainConfig) IsOnLynn(num *big.Int) bool { - return configNumEqual(c.LynnBlock, num) +// IsOnPlato returns whether num is equal to the second fast finality fork block. +func (c *ChainConfig) IsOnPlato(num *big.Int) bool { + return configNumEqual(c.PlatoBlock, num) } // IsMuirGlacier returns whether num is either equal to the Muir Glacier (EIP-2384) fork block or greater. @@ -674,8 +674,8 @@ func (c *ChainConfig) CheckConfigForkOrder() error { {name: "brunoBlock", block: c.BrunoBlock}, {name: "eulerBlock", block: c.EulerBlock}, {name: "gibbsBlock", block: c.GibbsBlock}, - {name: "bonehBlock", block: c.BonehBlock}, - {name: "lynnBlock", block: c.LynnBlock}, + {name: "lubanBlock", block: c.LubanBlock}, + {name: "platoBlock", block: c.PlatoBlock}, } { if lastFork.name != "" { // Next one must be higher number @@ -775,11 +775,11 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, head *big.Int) *Confi if isForkIncompatible(c.PlanckBlock, newcfg.PlanckBlock, head) { return newCompatError("planck fork block", c.PlanckBlock, newcfg.PlanckBlock) } - if isForkIncompatible(c.BonehBlock, newcfg.BonehBlock, head) { - return newCompatError("boneh fork block", c.BonehBlock, newcfg.BonehBlock) + if isForkIncompatible(c.LubanBlock, newcfg.LubanBlock, head) { + return newCompatError("luban fork block", c.LubanBlock, newcfg.LubanBlock) } - if isForkIncompatible(c.LynnBlock, newcfg.LynnBlock, head) { - return newCompatError("lynn fork block", c.LynnBlock, newcfg.LynnBlock) + if isForkIncompatible(c.PlatoBlock, newcfg.PlatoBlock, head) { + return newCompatError("plato fork block", c.PlatoBlock, newcfg.PlatoBlock) } return nil } @@ -853,7 +853,7 @@ type Rules struct { IsNano bool IsMoran bool IsPlanck bool - IsBoneh bool + IsLuban bool } // Rules ensures c's ChainID is not nil. @@ -878,6 +878,6 @@ func (c *ChainConfig) Rules(num *big.Int, isMerge bool) Rules { IsNano: c.IsNano(num), IsMoran: c.IsMoran(num), IsPlanck: c.IsPlanck(num), - IsBoneh: c.IsBoneh(num), + IsLuban: c.IsLuban(num), } } From fb0893a631c6669ac76354ceb74f0c386d5876ae Mon Sep 17 00:00:00 2001 From: NathanBSC <122502194+NathanBSC@users.noreply.github.com> Date: Mon, 24 Apr 2023 14:28:28 +0800 Subject: [PATCH 2/6] fix: all votes rejected for span voting caused by reorg (#1510) * fix: all votes rejected for span voting caused by reorg * fix: change internal for recover voting to 256 from 512 --- core/vote/vote_journal.go | 3 ++- core/vote/vote_manager.go | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/core/vote/vote_journal.go b/core/vote/vote_journal.go index 3fede2407..c11c754e3 100644 --- a/core/vote/vote_journal.go +++ b/core/vote/vote_journal.go @@ -12,7 +12,8 @@ import ( ) const ( - maxSizeOfRecentEntry = 512 + maxSizeOfRecentEntry = 512 + maliciousVoteSlashScope = 256 ) type VoteJournal struct { diff --git a/core/vote/vote_manager.go b/core/vote/vote_manager.go index c35245694..fe99418e9 100644 --- a/core/vote/vote_manager.go +++ b/core/vote/vote_manager.go @@ -180,7 +180,11 @@ func (voteManager *VoteManager) UnderRules(header *types.Header) (bool, uint64, } //Rule 2: A validator must not vote within the span of its other votes. - for blockNumber := sourceNumber + 1; blockNumber < targetNumber; blockNumber++ { + blockNumber := sourceNumber + 1 + if blockNumber+maliciousVoteSlashScope < targetNumber { + blockNumber = targetNumber - maliciousVoteSlashScope + } + for ; blockNumber < targetNumber; blockNumber++ { if voteDataBuffer.Contains(blockNumber) { voteData, ok := voteDataBuffer.Get(blockNumber) if !ok { @@ -188,7 +192,8 @@ func (voteManager *VoteManager) UnderRules(header *types.Header) (bool, uint64, continue } if voteData.(*types.VoteData).SourceNumber > sourceNumber { - log.Debug("error: cur vote is within the span of other votes") + log.Debug(fmt.Sprintf("error: cur vote %d-->%d is within the span of other votes %d-->%d", + sourceNumber, targetNumber, voteData.(*types.VoteData).SourceNumber, voteData.(*types.VoteData).TargetNumber)) return false, 0, common.Hash{} } } From 265dca1a20aa47d21797b26a491e96af23f00eff Mon Sep 17 00:00:00 2001 From: NathanBSC <122502194+NathanBSC@users.noreply.github.com> Date: Mon, 24 Apr 2023 14:47:17 +0800 Subject: [PATCH 3/6] fix: simplify update of attestation (#1514) * fix: simplify update of attestation * metrics: trace verifyVoteAttestationFailed and updateAttestationFailed --- consensus/parlia/parlia.go | 16 ++++++---------- consensus/parlia/snapshot.go | 24 +++++++++++++++++++----- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/consensus/parlia/parlia.go b/consensus/parlia/parlia.go index 9fc0a0fcf..a1eaf83a3 100644 --- a/consensus/parlia/parlia.go +++ b/consensus/parlia/parlia.go @@ -39,6 +39,7 @@ import ( "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/internal/ethapi" "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/metrics" "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rpc" @@ -74,7 +75,9 @@ var ( diffInTurn = big.NewInt(2) // Block difficulty for in-turn signatures diffNoTurn = big.NewInt(1) // Block difficulty for out-of-turn signatures // 100 native token - maxSystemBalance = new(big.Int).Mul(big.NewInt(100), big.NewInt(params.Ether)) + maxSystemBalance = new(big.Int).Mul(big.NewInt(100), big.NewInt(params.Ether)) + verifyVoteAttestationFailedGauge = metrics.NewRegisteredGauge("parlia/verifyVoteAttestationFailed", nil) + updateAttestationFailedGauge = metrics.NewRegisteredGauge("parlia/updateAttestationFailed", nil) systemContracts = map[common.Address]bool{ common.HexToAddress(systemcontracts.ValidatorContract): true, @@ -596,6 +599,7 @@ func (p *Parlia) verifyCascadingFields(chain consensus.ChainHeaderReader, header // Verify vote attestation for fast finality. if err := p.verifyVoteAttestation(chain, header, parents); err != nil { + verifyVoteAttestationFailedGauge.Inc(1) if chain.Config().IsPlato(header.Number) { return err } @@ -689,15 +693,7 @@ func (p *Parlia) snapshot(chain consensus.ChainHeaderReader, number uint64, hash headers[i], headers[len(headers)-1-i] = headers[len(headers)-1-i], headers[i] } - verifiedAttestations := make(map[common.Hash]struct{}, len(headers)) - for index, header := range headers { - // vote attestation should be checked here to decide whether to update attestation of snapshot between [Luban,Plato) - // because err of verifyVoteAttestation is ignored when importing blocks and headers before Plato. - if p.chainConfig.IsLuban(header.Number) && !p.chainConfig.IsPlato(header.Number) && p.verifyVoteAttestation(chain, header, headers[:index]) == nil { - verifiedAttestations[header.Hash()] = struct{}{} - } - } - snap, err := snap.apply(headers, chain, parents, p.chainConfig, verifiedAttestations) + snap, err := snap.apply(headers, chain, parents, p.chainConfig) if err != nil { return nil, err } diff --git a/consensus/parlia/snapshot.go b/consensus/parlia/snapshot.go index ccc81d7f6..c065606ce 100644 --- a/consensus/parlia/snapshot.go +++ b/consensus/parlia/snapshot.go @@ -21,6 +21,7 @@ import ( "encoding/hex" "encoding/json" "errors" + "fmt" "sort" "github.com/ethereum/go-ethereum/common" @@ -28,6 +29,7 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/internal/ethapi" + "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/params" lru "github.com/hashicorp/golang-lru" ) @@ -174,12 +176,27 @@ func (s *Snapshot) isMajorityFork(forkHash string) bool { } func (s *Snapshot) updateAttestation(header *types.Header, chainConfig *params.ChainConfig, parliaConfig *params.ParliaConfig) { + if !chainConfig.IsLuban(header.Number) { + return + } + // The attestation should have been checked in verify header, update directly attestation, _ := getVoteAttestationFromHeader(header, chainConfig, parliaConfig) if attestation == nil { return } + // Headers with bad attestation are accepted before Plato upgrade, + // but Attestation of snapshot is only updated when the target block is direct parent of the header + targetNumber := attestation.Data.TargetNumber + targetHash := attestation.Data.TargetHash + if targetHash != header.ParentHash || targetNumber+1 != header.Number.Uint64() { + log.Warn("updateAttestation failed", "error", fmt.Errorf("invalid attestation, target mismatch, expected block: %d, hash: %s; real block: %d, hash: %s", + header.Number.Uint64()-1, header.ParentHash, targetNumber, targetHash)) + updateAttestationFailedGauge.Inc(1) + return + } + // Update attestation s.Attestation = &types.VoteData{ SourceNumber: attestation.Data.SourceNumber, @@ -189,7 +206,7 @@ func (s *Snapshot) updateAttestation(header *types.Header, chainConfig *params.C } } -func (s *Snapshot) apply(headers []*types.Header, chain consensus.ChainHeaderReader, parents []*types.Header, chainConfig *params.ChainConfig, verifiedAttestations map[common.Hash]struct{}) (*Snapshot, error) { +func (s *Snapshot) apply(headers []*types.Header, chain consensus.ChainHeaderReader, parents []*types.Header, chainConfig *params.ChainConfig) (*Snapshot, error) { // Allow passing in no headers for cleaner code if len(headers) == 0 { return s, nil @@ -280,10 +297,7 @@ func (s *Snapshot) apply(headers []*types.Header, chain consensus.ChainHeaderRea } } - _, voteAssestationNoErr := verifiedAttestations[header.Hash()] - if chainConfig.IsPlato(header.Number) || (chainConfig.IsLuban(header.Number) && voteAssestationNoErr) { - snap.updateAttestation(header, chainConfig, s.config) - } + snap.updateAttestation(header, chainConfig, s.config) snap.RecentForkHashes[number] = hex.EncodeToString(header.Extra[extraVanity-nextForkHashSize : extraVanity]) } From 129bcfe7de85d711471615403b122ff11566cad0 Mon Sep 17 00:00:00 2001 From: NathanBSC <122502194+NathanBSC@users.noreply.github.com> Date: Mon, 24 Apr 2023 14:53:51 +0800 Subject: [PATCH 4/6] fix: memory leak of receivedVotes (#1516) --- core/vote/vote_pool.go | 1 + 1 file changed, 1 insertion(+) diff --git a/core/vote/vote_pool.go b/core/vote/vote_pool.go index 0e12855b6..664f12f76 100644 --- a/core/vote/vote_pool.go +++ b/core/vote/vote_pool.go @@ -257,6 +257,7 @@ func (pool *VotePool) transfer(blockHash common.Hash) { for _, vote := range voteBox.voteMessages { // Verify if the vote comes from valid validators based on voteAddress (BLSPublicKey). if pool.engine.VerifyVote(pool.chain, vote) != nil { + pool.receivedVotes.Remove(vote.Hash()) continue } From 282ef8952d0196c6e4176db51e8be4e875e267e8 Mon Sep 17 00:00:00 2001 From: dylanhuang Date: Mon, 24 Apr 2023 22:30:27 +0800 Subject: [PATCH 5/6] ci: fix release job (#1519) * ci: remove CGO_ENABLE=0 due to blst package * ci: fix arm binary build * ci: remove arm5-7 version * ci: fix arm64 build script * ci: fix generate_change_log.sh --- .github/generate_change_log.sh | 22 ++++------- .github/workflows/pre-release.yml | 62 +++++++++---------------------- .github/workflows/release.yml | 62 +++++++++---------------------- Dockerfile | 8 ++-- Dockerfile.alltools | 4 ++ Makefile | 18 --------- README.md | 10 +++++ build/ci.go | 37 ++++++++++-------- 8 files changed, 81 insertions(+), 142 deletions(-) diff --git a/.github/generate_change_log.sh b/.github/generate_change_log.sh index 9caf6f202..b50893ddf 100755 --- a/.github/generate_change_log.sh +++ b/.github/generate_change_log.sh @@ -24,26 +24,20 @@ TESTNET_ZIP_SUM="$(checksum ./testnet.zip)" LINUX_BIN_SUM="$(checksum ./linux/geth)" MAC_BIN_SUM="$(checksum ./macos/geth)" WINDOWS_BIN_SUM="$(checksum ./windows/geth.exe)" -ARM5_BIN_SUM="$(checksum ./arm5/geth-linux-arm-5)" -ARM6_BIN_SUM="$(checksum ./arm6/geth-linux-arm-6)" -ARM7_BIN_SUM="$(checksum ./arm7/geth-linux-arm-7)" ARM64_BIN_SUM="$(checksum ./arm64/geth-linux-arm64)" OUTPUT=$(cat <<-END ## Changelog\n ${CHANGE_LOG}\n ## Assets\n -| Assets | Sha256 Checksum |\n -| :-----------: |------------|\n -| mainnet.zip | ${MAINNET_ZIP_SUM} |\n -| testnet.zip | ${TESTNET_ZIP_SUM} |\n -| geth_linux | ${LINUX_BIN_SUM} |\n -| geth_mac | ${MAC_BIN_SUM} |\n -| geth_windows | ${WINDOWS_BIN_SUM} |\n -| geth_linux_arm-5 | ${ARM5_BIN_SUM} |\n -| geth_linux_arm-6 | ${ARM6_BIN_SUM} |\n -| geth_linux_arm-7 | ${ARM7_BIN_SUM} |\n +| Assets | Sha256 Checksum | +| :-----------: |------------| +| mainnet.zip | ${MAINNET_ZIP_SUM} | +| testnet.zip | ${TESTNET_ZIP_SUM} | +| geth_linux | ${LINUX_BIN_SUM} | +| geth_mac | ${MAC_BIN_SUM} | +| geth_windows | ${WINDOWS_BIN_SUM} | | geth_linux_arm64 | ${ARM64_BIN_SUM} |\n END ) -echo -e ${OUTPUT} \ No newline at end of file +echo -e "${OUTPUT}" \ No newline at end of file diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index df63b64ca..e9979b069 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -44,8 +44,17 @@ jobs: # ============================== - name: Build Binary for ${{matrix.os}} - env: - CGO_ENABLED: "0" + if: matrix.os == 'ubuntu-latest' + run: | + go mod download + wget https://musl.cc/x86_64-linux-musl-cross.tgz + tar -xvf ./x86_64-linux-musl-cross.tgz + GIT_COMMIT=$(git rev-parse HEAD) + GIT_COMMIT_DATE=$(git log -n1 --pretty='format:%cd' --date=format:'%Y%m%d') + GOOS=linux GOARCH=amd64 CGO_ENABLED=1 CC=$(pwd)/x86_64-linux-musl-cross/bin/x86_64-linux-musl-gcc go build -ldflags "-X main.gitCommit=$GIT_COMMIT -X main.gitDate=$GIT_COMMIT_DATE -extldflags=-static" -o ./build/bin/geth -a ./cmd/geth + + - name: Build Binary for ${{matrix.os}} + if: matrix.os != 'ubuntu-latest' run: | go mod download make geth @@ -58,7 +67,12 @@ jobs: if: matrix.os == 'ubuntu-latest' run: | go mod download - make geth-linux-arm + wget https://musl.cc/aarch64-linux-musl-cross.tgz + tar -xvf ./aarch64-linux-musl-cross.tgz + GIT_COMMIT=$(git rev-parse HEAD) + GIT_COMMIT_DATE=$(git log -n1 --pretty='format:%cd' --date=format:'%Y%m%d') + GOOS=linux GOARCH=arm64 CGO_ENABLED=1 CC=$(pwd)/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc go build -ldflags "-X main.gitCommit=$GIT_COMMIT -X main.gitDate=$GIT_COMMIT_DATE -extldflags=-static" -o ./build/bin/geth-linux-arm64 -a ./cmd/geth + # ============================== # Upload artifacts # ============================== @@ -84,27 +98,6 @@ jobs: name: windows path: ./build/bin/geth.exe - - name: Upload ARM-5 Build - uses: actions/upload-artifact@v3 - if: matrix.os == 'ubuntu-latest' - with: - name: arm5 - path: ./build/bin/geth-linux-arm-5 - - - name: Upload ARM-6 Build - uses: actions/upload-artifact@v3 - if: matrix.os == 'ubuntu-latest' - with: - name: arm6 - path: ./build/bin/geth-linux-arm-6 - - - name: Upload ARM-7 Build - uses: actions/upload-artifact@v3 - if: matrix.os == 'ubuntu-latest' - with: - name: arm7 - path: ./build/bin/geth-linux-arm-7 - - name: Upload ARM-64 Build uses: actions/upload-artifact@v3 if: matrix.os == 'ubuntu-latest' @@ -145,24 +138,6 @@ jobs: name: windows path: ./windows - - name: Download Artifacts - uses: actions/download-artifact@v3 - with: - name: arm5 - path: ./arm5 - - - name: Download Artifacts - uses: actions/download-artifact@v3 - with: - name: arm6 - path: ./arm6 - - - name: Download Artifacts - uses: actions/download-artifact@v3 - with: - name: arm7 - path: ./arm7 - - name: Download Artifacts uses: actions/download-artifact@v3 with: @@ -204,7 +179,4 @@ jobs: ./linux/geth_linux ./macos/geth_macos ./windows/geth_windows.exe - ./arm5/geth-linux-arm-5 - ./arm6/geth-linux-arm-6 - ./arm7/geth-linux-arm-7 ./arm64/geth-linux-arm64 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5fd5ecf23..e771923e5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -44,8 +44,17 @@ jobs: # ============================== - name: Build Binary for ${{matrix.os}} - env: - CGO_ENABLED: "0" + if: matrix.os == 'ubuntu-latest' + run: | + go mod download + wget https://musl.cc/x86_64-linux-musl-cross.tgz + tar -xvf ./x86_64-linux-musl-cross.tgz + GIT_COMMIT=$(git rev-parse HEAD) + GIT_COMMIT_DATE=$(git log -n1 --pretty='format:%cd' --date=format:'%Y%m%d') + GOOS=linux GOARCH=amd64 CGO_ENABLED=1 CC=$(pwd)/x86_64-linux-musl-cross/bin/x86_64-linux-musl-gcc go build -ldflags "-X main.gitCommit=$GIT_COMMIT -X main.gitDate=$GIT_COMMIT_DATE -extldflags=-static" -o ./build/bin/geth -a ./cmd/geth + + - name: Build Binary for ${{matrix.os}} + if: matrix.os != 'ubuntu-latest' run: | go mod download make geth @@ -58,7 +67,12 @@ jobs: if: matrix.os == 'ubuntu-latest' run: | go mod download - make geth-linux-arm + wget https://musl.cc/aarch64-linux-musl-cross.tgz + tar -xvf ./aarch64-linux-musl-cross.tgz + GIT_COMMIT=$(git rev-parse HEAD) + GIT_COMMIT_DATE=$(git log -n1 --pretty='format:%cd' --date=format:'%Y%m%d') + GOOS=linux GOARCH=arm64 CGO_ENABLED=1 CC=$(pwd)/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc go build -ldflags "-X main.gitCommit=$GIT_COMMIT -X main.gitDate=$GIT_COMMIT_DATE -extldflags=-static" -o ./build/bin/geth-linux-arm64 -a ./cmd/geth + # ============================== # Upload artifacts # ============================== @@ -84,27 +98,6 @@ jobs: name: windows path: ./build/bin/geth.exe - - name: Upload ARM-5 Build - uses: actions/upload-artifact@v3 - if: matrix.os == 'ubuntu-latest' - with: - name: arm5 - path: ./build/bin/geth-linux-arm-5 - - - name: Upload ARM-6 Build - uses: actions/upload-artifact@v3 - if: matrix.os == 'ubuntu-latest' - with: - name: arm6 - path: ./build/bin/geth-linux-arm-6 - - - name: Upload ARM-7 Build - uses: actions/upload-artifact@v3 - if: matrix.os == 'ubuntu-latest' - with: - name: arm7 - path: ./build/bin/geth-linux-arm-7 - - name: Upload ARM-64 Build uses: actions/upload-artifact@v3 if: matrix.os == 'ubuntu-latest' @@ -145,24 +138,6 @@ jobs: name: windows path: ./windows - - name: Download Artifacts - uses: actions/download-artifact@v3 - with: - name: arm5 - path: ./arm5 - - - name: Download Artifacts - uses: actions/download-artifact@v3 - with: - name: arm6 - path: ./arm6 - - - name: Download Artifacts - uses: actions/download-artifact@v3 - with: - name: arm7 - path: ./arm7 - - name: Download Artifacts uses: actions/download-artifact@v3 with: @@ -211,7 +186,4 @@ jobs: ./linux/geth_linux ./macos/geth_macos ./windows/geth_windows.exe - ./arm5/geth-linux-arm-5 - ./arm6/geth-linux-arm-6 - ./arm7/geth-linux-arm-7 ./arm64/geth-linux-arm64 diff --git a/Dockerfile b/Dockerfile index ecbc855cd..12815f435 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,8 +13,6 @@ COPY go.sum /go-ethereum/ RUN cd /go-ethereum && go mod download ADD . /go-ethereum -ENV CGO_CFLAGS="-O -D__BLST_PORTABLE__" -ENV CGO_CFLAGS_ALLOW="-O -D__BLST_PORTABLE__" RUN cd /go-ethereum && go run build/ci.go install ./cmd/geth # Pull Geth into a second stage deploy alpine container @@ -28,10 +26,9 @@ ENV BSC_HOME=/bsc ENV HOME=${BSC_HOME} ENV DATA_DIR=/data -ARG VERSION_GCC=11.2.1_git20220219-r2 ENV PACKAGES ca-certificates jq \ bash bind-tools tini \ - grep curl sed gcc==${VERSION_GCC} + grep curl sed gcc RUN apk add --no-cache $PACKAGES \ && rm -rf /var/cache/apk/* \ @@ -59,4 +56,7 @@ USER ${BSC_USER_UID}:${BSC_USER_GID} # rpc ws graphql EXPOSE 8545 8546 8547 30303 30303/udp +# For blst runtime env +ENV CGO_CFLAGS="-O -D__BLST_PORTABLE__" +ENV CGO_CFLAGS_ALLOW="-O -D__BLST_PORTABLE__" ENTRYPOINT ["/sbin/tini", "--", "./docker-entrypoint.sh"] \ No newline at end of file diff --git a/Dockerfile.alltools b/Dockerfile.alltools index 3205b412e..c968551d1 100644 --- a/Dockerfile.alltools +++ b/Dockerfile.alltools @@ -29,3 +29,7 @@ ARG VERSION="" ARG BUILDNUM="" LABEL commit="$COMMIT" version="$VERSION" buildnum="$BUILDNUM" + +# For blst runtime env +ENV CGO_CFLAGS="-O -D__BLST_PORTABLE__" +ENV CGO_CFLAGS_ALLOW="-O -D__BLST_PORTABLE__" diff --git a/Makefile b/Makefile index c18cdddea..adda257e7 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,6 @@ .PHONY: geth android ios evm all test truffle-test clean .PHONY: docker -.PHONY: geth-linux-arm geth-linux-arm64 geth-linux-arm5 geth-linux-arm6 geth-linux-arm7 GOBIN = ./build/bin GO ?= latest @@ -17,23 +16,6 @@ geth: @echo "Done building." @echo "Run \"$(GOBIN)/geth\" to launch geth." -ldflags = -X main.gitCommit=$(GIT_COMMIT) \ - -X main.gitDate=$(GIT_COMMIT_DATE) - -geth-linux-arm: geth-linux-arm5 geth-linux-arm6 geth-linux-arm7 geth-linux-arm64 - -geth-linux-arm5: - env GO111MODULE=on GOARCH=arm GOARM=5 GOOS=linux go build -ldflags="$(ldflags)" -o build/bin/geth-linux-arm-5 ./cmd/geth - -geth-linux-arm6: - env GO111MODULE=on GOARCH=arm GOARM=6 GOOS=linux go build -ldflags="$(ldflags)" -o build/bin/geth-linux-arm-6 ./cmd/geth - -geth-linux-arm7: - env GO111MODULE=on GOARCH=arm GOARM=7 GOOS=linux go build -ldflags="$(ldflags)" -o build/bin/geth-linux-arm-7 ./cmd/geth - -geth-linux-arm64: - env GO111MODULE=on GOARCH=arm64 GOOS=linux go build -ldflags="$(ldflags)" -o build/bin/geth-linux-arm64 ./cmd/geth - all: $(GORUN) build/ci.go install diff --git a/README.md b/README.md index 9b6c28f24..20d8ecbaf 100644 --- a/README.md +++ b/README.md @@ -142,6 +142,16 @@ Download latest chaindata snapshot from [here](https://github.com/bnb-chain/bsc- ./geth --config ./config.toml --datadir ./node --cache 8000 --rpc.allow-unprotected-txs --txlookuplimit 0 --tries-verify-mode none ``` +if you get such error: +```shell +Caught SIGILL in blst_cgo_init, consult /bindinds/go/README.md. +``` +please try to add the following environment variables: +```shell +export CGO_CFLAGS="-O -D__BLST_PORTABLE__" +export CGO_CFLAGS_ALLOW="-O -D__BLST_PORTABLE__" +``` + #### 5. Monitor node status Monitor the log from **./node/bsc.log** by default. When the node has started syncing, should be able to see the following output: diff --git a/build/ci.go b/build/ci.go index d036b7d6e..80599916c 100644 --- a/build/ci.go +++ b/build/ci.go @@ -24,19 +24,18 @@ Usage: go run build/ci.go Available commands are: - install [ -arch architecture ] [ -cc compiler ] [ packages... ] -- builds packages and executables - test [ -coverage ] [ packages... ] -- runs the tests - lint -- runs certain pre-selected linters - archive [ -arch architecture ] [ -type zip|tar ] [ -signer key-envvar ] [ -signify key-envvar ] [ -upload dest ] -- archives build artifacts - importkeys -- imports signing keys from env - debsrc [ -signer key-id ] [ -upload dest ] -- creates a debian source package - nsis -- creates a Windows NSIS installer - aar [ -local ] [ -sign key-id ] [-deploy repo] [ -upload dest ] -- creates an Android archive - xcode [ -local ] [ -sign key-id ] [-deploy repo] [ -upload dest ] -- creates an iOS XCode framework - purge [ -store blobstore ] [ -days threshold ] -- purges old archives from the blobstore + install [ -arch architecture ] [ -cc compiler ] [ packages... ] -- builds packages and executables + test [ -coverage ] [ packages... ] -- runs the tests + lint -- runs certain pre-selected linters + archive [ -arch architecture ] [ -type zip|tar ] [ -signer key-envvar ] [ -signify key-envvar ] [ -upload dest ] -- archives build artifacts + importkeys -- imports signing keys from env + debsrc [ -signer key-id ] [ -upload dest ] -- creates a debian source package + nsis -- creates a Windows NSIS installer + aar [ -local ] [ -sign key-id ] [-deploy repo] [ -upload dest ] -- creates an Android archive + xcode [ -local ] [ -sign key-id ] [-deploy repo] [ -upload dest ] -- creates an iOS XCode framework + purge [ -store blobstore ] [ -days threshold ] -- purges old archives from the blobstore For all commands, -n prevents execution of external programs (dry run mode). - */ package main @@ -198,9 +197,10 @@ func main() { func doInstall(cmdline []string) { var ( - dlgo = flag.Bool("dlgo", false, "Download Go and build with it") - arch = flag.String("arch", "", "Architecture to cross build for") - cc = flag.String("cc", "", "C compiler to cross build with") + dlgo = flag.Bool("dlgo", false, "Download Go and build with it") + arch = flag.String("arch", "", "Architecture to cross build for") + cc = flag.String("cc", "", "C compiler to cross build with") + output = flag.String("o", "", "Output directory for build artifacts") ) flag.CommandLine.Parse(cmdline) @@ -213,7 +213,8 @@ func doInstall(cmdline []string) { // Configure the build. env := build.Env() - gobuild := tc.Go("build", buildFlags(env)...) + buildArgs := buildFlags(env) + gobuild := tc.Go("build", buildArgs...) // arm64 CI builders are memory-constrained and can't handle concurrent builds, // better disable it. This check isn't the best, it should probably @@ -239,7 +240,11 @@ func doInstall(cmdline []string) { for _, pkg := range packages { args := make([]string, len(gobuild.Args)) copy(args, gobuild.Args) - args = append(args, "-o", executablePath(path.Base(pkg))) + outputPath := executablePath(path.Base(pkg)) + if output != nil && *output != "" { + outputPath = *output + } + args = append(args, "-o", outputPath) args = append(args, pkg) build.MustRun(&exec.Cmd{Path: gobuild.Path, Args: args, Env: gobuild.Env}) } From 779f4a80eef3072cccb00d49edaaf8188118e68a Mon Sep 17 00:00:00 2001 From: dylanhuang Date: Tue, 25 Apr 2023 09:11:29 +0800 Subject: [PATCH 6/6] fix: lint error and docs (#1520) * ci: upgrade golangci-lint * build: move blst env to build stage * chore: fix lint error * docs: update readme --- .github/workflows/lint.yml | 2 +- Dockerfile | 7 +-- Dockerfile.alltools | 7 ++- README.md | 22 ++++----- build/checksums.txt | 90 ++++++++++++++++++++---------------- build/ci.go | 2 +- consensus/parlia/snapshot.go | 4 +- 7 files changed, 71 insertions(+), 63 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ebe646dfe..87bfb710d 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -50,7 +50,7 @@ jobs: uses: golangci/golangci-lint-action@v3 with: # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version - version: v1.50 + version: v1.52.2 working-directory: ./ skip-pkg-cache: true skip-cache: true diff --git a/Dockerfile b/Dockerfile index 12815f435..316cc2896 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,6 +13,10 @@ COPY go.sum /go-ethereum/ RUN cd /go-ethereum && go mod download ADD . /go-ethereum + +# For blst +ENV CGO_CFLAGS="-O -D__BLST_PORTABLE__" +ENV CGO_CFLAGS_ALLOW="-O -D__BLST_PORTABLE__" RUN cd /go-ethereum && go run build/ci.go install ./cmd/geth # Pull Geth into a second stage deploy alpine container @@ -56,7 +60,4 @@ USER ${BSC_USER_UID}:${BSC_USER_GID} # rpc ws graphql EXPOSE 8545 8546 8547 30303 30303/udp -# For blst runtime env -ENV CGO_CFLAGS="-O -D__BLST_PORTABLE__" -ENV CGO_CFLAGS_ALLOW="-O -D__BLST_PORTABLE__" ENTRYPOINT ["/sbin/tini", "--", "./docker-entrypoint.sh"] \ No newline at end of file diff --git a/Dockerfile.alltools b/Dockerfile.alltools index c968551d1..c3cfed913 100644 --- a/Dockerfile.alltools +++ b/Dockerfile.alltools @@ -13,6 +13,9 @@ COPY go.sum /go-ethereum/ RUN cd /go-ethereum && go mod download ADD . /go-ethereum +# For blst +ENV CGO_CFLAGS="-O -D__BLST_PORTABLE__" +ENV CGO_CFLAGS_ALLOW="-O -D__BLST_PORTABLE__" RUN cd /go-ethereum && go run build/ci.go install # Pull all binaries into a second stage deploy alpine container @@ -29,7 +32,3 @@ ARG VERSION="" ARG BUILDNUM="" LABEL commit="$COMMIT" version="$VERSION" buildnum="$BUILDNUM" - -# For blst runtime env -ENV CGO_CFLAGS="-O -D__BLST_PORTABLE__" -ENV CGO_CFLAGS_ALLOW="-O -D__BLST_PORTABLE__" diff --git a/README.md b/README.md index 20d8ecbaf..0b62ea7af 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ Many of the below are the same as or similar to go-ethereum. For prerequisites and detailed build instructions please read the [Installation Instructions](https://geth.ethereum.org/docs/getting-started/installing-geth). -Building `geth` requires both a Go (version 1.18 or later) and a C compiler. You can install +Building `geth` requires both a Go (version 1.19 or later) and a C compiler. You can install them using your favourite package manager. Once the dependencies are installed, run ```shell @@ -74,6 +74,16 @@ or, to build the full suite of utilities: make all ``` +If you get such error when running the node with self built binary: +```shell +Caught SIGILL in blst_cgo_init, consult /bindinds/go/README.md. +``` +please try to add the following environment variables and build again: +```shell +export CGO_CFLAGS="-O -D__BLST_PORTABLE__" +export CGO_CFLAGS_ALLOW="-O -D__BLST_PORTABLE__" +``` + ## Executables The bsc project comes with several wrappers/executables found in the `cmd` @@ -142,16 +152,6 @@ Download latest chaindata snapshot from [here](https://github.com/bnb-chain/bsc- ./geth --config ./config.toml --datadir ./node --cache 8000 --rpc.allow-unprotected-txs --txlookuplimit 0 --tries-verify-mode none ``` -if you get such error: -```shell -Caught SIGILL in blst_cgo_init, consult /bindinds/go/README.md. -``` -please try to add the following environment variables: -```shell -export CGO_CFLAGS="-O -D__BLST_PORTABLE__" -export CGO_CFLAGS_ALLOW="-O -D__BLST_PORTABLE__" -``` - #### 5. Monitor node status Monitor the log from **./node/bsc.log** by default. When the node has started syncing, should be able to see the following output: diff --git a/build/checksums.txt b/build/checksums.txt index 1d2f1cba1..f781ba6b7 100644 --- a/build/checksums.txt +++ b/build/checksums.txt @@ -14,44 +14,52 @@ e4032e7c52ebc48bad5c58ba8de0759b6091d9b1e59581a8a521c8c9d88dbe93 go1.19.5.linux- 764871cbca841a99a24e239b63c68a4aaff4104658e3165e9ca450cac1fcbea3 go1.19.5.linux-s390x.tar.gz 85a75555e82d8aa6f486d8d29491c593389682acce9f0c270090d5938eee30ef go1.19.5.windows-arm64.zip -06456f980c7dfddfa6a30bf37a839843ee6564a2f9c4c9a8c1319dcdfeae0748 golangci-lint-1.50.1-linux-mips64le.tar.gz -0f615fb8c364f6e4a213f2ed2ff7aa1fc2b208addf29511e89c03534067bbf57 golangci-lint-1.50.1-darwin-amd64.tar.gz -10200bdf2a22d63a3b7f51d3b28e8b919b638b449b6d7867b26af008e33190b6 golangci-lint-1.50.1-linux-ppc64le.deb -131a339395aedd1e32672d9b6243abfeef91adff493bd4fb8d3edcd38e7d7498 golangci-lint-1.50.1-linux-arm64.rpm -162667015519495c2ae35955ff7804d2170ee94a24497cbe0ddf163d5ce10dd4 golangci-lint-1.50.1-linux-ppc64le.tar.gz -193fcf9b72345a8a0d27c330d8433eb6c9bce249bb2e1edea7143d4dbc1acaf4 golangci-lint-1.50.1-linux-mips64le.rpm -1dfeff81f222ec776bee2b8ddf36d727b0300b71e672e80096b2897be296f825 golangci-lint-1.50.1-windows-armv6.zip -26daf55ff7ab4d858058d666ed08ba7c1757d3eb47b24c071955d2bd30fc368a golangci-lint-1.50.1-linux-mips64.deb -3c6ff7318c574cf6096014fd527b36430721cc7a484819a7569478e20a478e1c golangci-lint-1.50.1-freebsd-amd64.tar.gz -3ca9753d7804b34f9165427fbe339dbea69bd80be8a10e3f02c6037393b2e1c4 golangci-lint-1.50.1-darwin-arm64.tar.gz -3ea0a6d5946340f6831646e2c67a317dd9b35bdc4e09b2df953a86f09ba05d74 golangci-lint-1.50.1-linux-arm64.tar.gz -4ba1dc9dbdf05b7bdc6f0e04bdfe6f63aa70576f51817be1b2540bbce017b69a golangci-lint-1.50.1-linux-amd64.tar.gz -4ed8e23077e2466350a100b988cde79750d9ef03498aa4f05d72dbd2e4b28233 golangci-lint-1.50.1-linux-s390x.rpm -50d05c2932a8ea567882fe0586f6b5c1bbfb2a2e944dafaa8f649606ad92105f golangci-lint-1.50.1-linux-ppc64le.rpm -5af2ab7c6d389dde240f7f0d661742cfce615b4b8f8f879c7c36b398f7000db1 golangci-lint-1.50.1-linux-s390x.deb -656ea0215985dfd02ed14018cee868f518d34e2274b14ec675b01aea0d305e28 golangci-lint-1.50.1-freebsd-386.tar.gz -6c371d9a37cad2d3719c45d113a07c9619e52406ca2381d247c217a41c6f5d57 golangci-lint-1.50.1-linux-armv7.deb -6d11fb6ed91ba3aecbf2ea8e1a95dce16cf0449d54aa77c607ac4e75cc43213a golangci-lint-1.50.1-windows-386.zip -73ad2af342e00e59f0a5fbd71cfb17c5dc0f765d2cf4391d5a69c79a7a8b24af golangci-lint-1.50.1-linux-mips64.rpm -757d4f17177c6eff01974e2c8e3122b85d542d1a375c416d2a870ef785ad188b golangci-lint-1.50.1-linux-arm64.deb -7fd52d1da270fa8448c975d2500b6ef2d19db143b6cfc205de16612d6f4effa9 golangci-lint-1.50.1-windows-arm64.zip -81f3136bc111bfe51da293fafcee7642dbf998e2d25bf83d24a2ff18f8d1fc14 golangci-lint-1.50.1-linux-armv7.tar.gz -8965c4327e742444bd4359bd952d42ebc645eba929d3826dd12adb8a14cc6248 golangci-lint-1.50.1-linux-386.tar.gz -8c2da214884db02fb7f3d929672c515ae3b9d10defad4dd661c4ab365a316d68 golangci-lint-1.50.1-windows-amd64.zip -96ae5ef97fec1487bcfd298e9341855ed6bf2f7d6a0bd9dfa758d2c1e4da96ec golangci-lint-1.50.1-linux-mips64.tar.gz -96ce5d9e7ae8134342e8c671ca357d92096b76673b61caf5524bfd6d772ee714 golangci-lint-1.50.1-linux-riscv64.deb -980832f12fbdd0a8e636666839b168c2bbf0ca573ff50b042d3977f65c4987d7 golangci-lint-1.50.1-linux-armv6.tar.gz -999126cbd30f08b41b9eb3cef0bb72686eace82d9cb388e8e24a910ff7a8be51 golangci-lint-1.50.1-linux-386.rpm -a2f2da85622630ff2d0aecac1acc1b3b62c4853594e49fc5a266d6ddbe1a692e golangci-lint-1.50.1-freebsd-armv7.tar.gz -a8af864c92743243ae986f20afdcc58b2cb15b0063e2821c519dcc3c8efc669d golangci-lint-1.50.1-linux-386.deb -aaa3e42de0a57c7c1f64991e3c6d0f9a97aa06455a1cde5a55c59a7fa76e2045 golangci-lint-1.50.1-linux-riscv64.tar.gz -bcdcd7a8068aa91bba432a20909babc911269504325aeff15171f29ecc72b9f0 golangci-lint-1.50.1-linux-mips64le.deb -c1d3abf0d873c7e1f123bf468f940b152526aa5af72aa5f1f5acc1733012293c golangci-lint-1.50.1-linux-armv7.rpm -c2955d6b10ce005ee20b4ad03e5cd805076971a5335a215a757d1ab72db499f9 golangci-lint-1.50.1-linux-amd64.deb -c79ec2884ff743dd965bace09f4f22d5412ccfc3fbd4aec719c8edc48fb455a0 golangci-lint-1.50.1-linux-s390x.tar.gz -c946f6ecb87ddc4f32a98baad0aa9b59f3066b04b2dc822d085c184f85764c7b golangci-lint-1.50.1-windows-armv7.zip -c9c4856e01166e835888c82af02c3952a3b55b75d5c02b674501c03f5ea1e107 golangci-lint-1.50.1-linux-amd64.rpm -dfe91654cbc5c12245c608b0fad44772ce90938c483ff945a0059442f5f3722f golangci-lint-1.50.1-freebsd-armv6.tar.gz -e140169da4ec3d1132277f2109d7202638a6032326bdeada547ffcd9d8cbedbc golangci-lint-1.50.1-linux-armv6.rpm -ecbbc8c35787aea093ef5c639972612a2300bbdc75b21466f4674f8c0d2e38ed golangci-lint-1.50.1-linux-armv6.deb -f42db20276811d7e6002d237985e658a0d1bca36586642bc071e9df9454fb4fc golangci-lint-1.50.1-linux-riscv64.rpm +000d4d58f1e25323aaf0da20b337d059d401c8c1fb31cef92ce50ef35c05e877 golangci-lint-1.52.2-linux-ppc64le.deb +0970b2e3ecc20003a0fc78b078623ab27c61f0f809a44288e2cc438bfbbf5616 golangci-lint-1.52.2-linux-s390x.deb +0bfe9b51f68a33cc4e43139151d8032b57b15e61a19f5a7554b687a3fa166ab8 golangci-lint-1.52.2-netbsd-armv7.tar.gz +0e4e24085d364f4e03752c060d5f37b5ead52acd62f07392f4c9022515e0ecd8 golangci-lint-1.52.2-linux-armv7.rpm +0f19ad6c037d45867f4978287a7a6d78bc761daf8e6cb3a5e6af86d5714b0258 golangci-lint-1.52.2-linux-armv6.tar.gz +1506b19f3f0410f6d85d1e339a47fcc84646d552516c0f429dc8cd7f34b4069a golangci-lint-1.52.2-windows-armv6.zip +1cc68baa226e186c15c5514a6e93b1cc8d47ff06aaf1a395b8266434cb01df29 golangci-lint-1.52.2-linux-386.rpm +1d23661087ae686563e40d3b1e33f309dd3b4ba7d1c7e571ca7723f77a52a9e4 golangci-lint-1.52.2-linux-s390x.rpm +227673a18d21b428f1768bb8ee46e38c36a0f002960bc6211ef6137b85d03f52 golangci-lint-1.52.2-freebsd-armv7.tar.gz +24f0272e5741c05c59e7162b7ff0258cfa6beb0d9265bd87c386fe80ac25135d golangci-lint-1.52.2-linux-mips64.deb +3abc8ad30b336ccbe3c5e3c65fa146f5b12d8e81e644345fa8d51cdbaa8cb570 golangci-lint-1.52.2-netbsd-amd64.tar.gz +40a2645b4c7bd94c16618eb0f12b32cd54c17e5620f761cf477b256d3622f299 golangci-lint-1.52.2-windows-386.zip +40b40002e07db81628d94108265525052c58fc9ce358bef26a36d27f0aea3d87 golangci-lint-1.52.2-windows-amd64.zip +41e936b62ba4fc66c02daf6fa9cf74213bc2220745c7a796acbe197c05ed26bb golangci-lint-1.52.2-netbsd-armv6.tar.gz +4bcbb4cf34bf3c8ae1ca880d12516a999499189326621599f8362ededd6e4229 golangci-lint-1.52.2-linux-riscv64.tar.gz +4edb83f1433f7c57f06f79a7fc30bf3f920c1f86c334e481661ac6627d80293f golangci-lint-1.52.2-linux-arm64.deb +50d662e86d094dbad6634d086eca4f670ffa8ea7142508d8da357a2d750ac21a golangci-lint-1.52.2-linux-armv7.tar.gz +6891597bedbcd7e530d08ed198bab7eeb9b23f3f8161dc6e87505b783cb11593 golangci-lint-1.52.2-windows-arm64.zip +6d79f4f3448b70e83952e746fcb9e251c6ba94ec2790a912806cc1704ade4d64 golangci-lint-1.52.2-linux-mips64.rpm +6de51ae05d39002421caf6049e0dd0014a2f10961471c5547c905d33d8e6adf1 golangci-lint-1.52.2-linux-armv6.deb +715dc0f0cf3538c3b2c75f084dde8dcdc3485b3494f42a6d0d9c0dc61e62b5a8 golangci-lint-1.52.2-linux-s390x.tar.gz +7c559332a97ee49b80427aba5a7122e17cac18c57e700f48e6db5ffcbbb61b2b golangci-lint-1.52.2-linux-arm64.rpm +81201bb5f19897fefb4380af2e187a0133dc5efda22254698c063cc36a601f43 golangci-lint-1.52.2-linux-386.deb +89e523d45883903cfc472ab65621073f850abd4ffbb7720bbdd7ba66ee490bc8 golangci-lint-1.52.2-darwin-arm64.tar.gz +8d60d63eee38f8de679e57b1a781de32987152f004f852f20cd47baa4c582209 golangci-lint-1.52.2-linux-mips64le.rpm +9e22df0516cbd847910f353d92245e58eab2b6edacc669646bfa06eb032a65a3 golangci-lint-1.52.2-linux-riscv64.deb +a1a74747a196d4ccd2394ea8a461508eb2edf1eb5a88010611debf572991961d golangci-lint-1.52.2-linux-loong64.tar.gz +a7f076d0fb50e0f5bc24d0f3b2567f2cfe864441e6ad20323189b7fde7cc065d golangci-lint-1.52.2-freebsd-386.tar.gz +abc100851a59cbcea2a7e9ff5ad2974a43270135520aeac9a302ca6c712a41e1 golangci-lint-1.52.2-linux-loong64.rpm +adf11a1f7f43b5a431c19cccea260e6205e2e2b42a2d2d450e31c287fec199f2 golangci-lint-1.52.2-linux-amd64.rpm +b2249e43e1624486398f41700dbe4094a4222bf50b2b1b3a740323adb9a1b66f golangci-lint-1.52.2-linux-386.tar.gz +b8e81bf979dc8bf226cb592eb78c1792f1018c3dea1bbeb11517efc4cc3301bb golangci-lint-1.52.2-windows-armv7.zip +bb9a6a0aabe39fb3d581cc200c639ce6598821a53b4d16ec59366c65f4cc2960 golangci-lint-1.52.2-source.tar.gz +c152280b2e61c202614c1c476cf4458922cda0d2781e4492be2c22d45655cae0 golangci-lint-1.52.2-freebsd-armv6.tar.gz +c8bf25c0bca142638ce4bfc921bf23d23038818d57658d69aa4a9947d514d48f golangci-lint-1.52.2-linux-ppc64le.rpm +c9cf72d12058a131746edd409ed94ccd578fbd178899d1ed41ceae3ce5f54501 golangci-lint-1.52.2-linux-amd64.tar.gz +d03f2b331b5139eddea5db2b49066d10a90094747b08d72d7b2d61cf91c79a27 golangci-lint-1.52.2-linux-mips64le.tar.gz +d609c1d49591d714148e1f8c8b5ae9f9565c601aeabc44a5a53ba44b0eb99f36 golangci-lint-1.52.2-linux-riscv64.rpm +d679adad29603ed7549372b64077cccad784e404deffe5c1e9495a06659cff33 golangci-lint-1.52.2-linux-mips64.tar.gz +d91e8cb60920cf0e46958ed917fcdd059738c00d162189c2e878424ffc8ada75 golangci-lint-1.52.2-linux-ppc64le.tar.gz +d9b5820b491e317fb1360775441d68bd3dc2f303439da5b6d536df23977e28c9 golangci-lint-1.52.2-freebsd-amd64.tar.gz +ddeae781cf07c016898efd80eaed6853a91bfaf1f22c08fbbf5cf08a573b98c4 golangci-lint-1.52.2-linux-loong64.deb +dfc5e755cfa95381f61f736780ff736a5b6c9cbccc88140348986c166d484f85 golangci-lint-1.52.2-linux-amd64.deb +e57f2599de73c4da1d36d5255b9baec63f448b3d7fb726ebd3cd64dabbd3ee4a golangci-lint-1.52.2-darwin-amd64.tar.gz +ebfb5b643ba73ef6007236b90f863ae49fc34fd366682c971b7d1308ab28f642 golangci-lint-1.52.2-netbsd-386.tar.gz +f46b60a90fab5916a7de899ad9a3a4b3d77278c2e1737d070719d3ea27919557 golangci-lint-1.52.2-linux-armv7.deb +f6e39d0ac4691c2b9f49d6d5819594f48bb03e18692fd6d100e7114077f710e6 golangci-lint-1.52.2-linux-armv6.rpm +fa5da589075143628a49a0c123ccd76a8717bb6308fb3bdb6bf1df59435d921b golangci-lint-1.52.2-linux-mips64le.deb +fc09a97f8888809fab83a316f7da70c8ed74d4863b7eed7d872cec41911a55e8 golangci-lint-1.52.2-linux-arm64.tar.gz diff --git a/build/ci.go b/build/ci.go index 80599916c..8ab3c0b96 100644 --- a/build/ci.go +++ b/build/ci.go @@ -343,7 +343,7 @@ func doLint(cmdline []string) { // downloadLinter downloads and unpacks golangci-lint. func downloadLinter(cachedir string) string { - const version = "1.50.1" + const version = "1.52.2" csdb := build.MustLoadChecksums("build/checksums.txt") arch := runtime.GOARCH diff --git a/consensus/parlia/snapshot.go b/consensus/parlia/snapshot.go index c110e5534..e7a9dea46 100644 --- a/consensus/parlia/snapshot.go +++ b/consensus/parlia/snapshot.go @@ -24,6 +24,8 @@ import ( "fmt" "sort" + lru "github.com/hashicorp/golang-lru" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/consensus" "github.com/ethereum/go-ethereum/core/types" @@ -31,7 +33,6 @@ import ( "github.com/ethereum/go-ethereum/internal/ethapi" "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/params" - lru "github.com/hashicorp/golang-lru" ) // Snapshot is the state of the validatorSet at a given point. @@ -297,7 +298,6 @@ func (s *Snapshot) apply(headers []*types.Header, chain consensus.ChainHeaderRea } } - snap.updateAttestation(header, chainConfig, s.config) snap.RecentForkHashes[number] = hex.EncodeToString(header.Extra[extraVanity-nextForkHashSize : extraVanity])