Skip to content

Commit

Permalink
update go.mod to point to erigon-lib fork for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
pratikspatil024 committed Sep 23, 2023
1 parent bd1086e commit c690cb2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
4 changes: 2 additions & 2 deletions consensus/bor/bor.go
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ func (c *Bor) Prepare(chain consensus.ChainHeaderReader, header *types.Header, s
// sort validator by address
sort.Sort(valset.ValidatorsByAddress(newValidators))

if c.config.IsParallelUniverse(header.Number) {
if c.config.IsParallelUniverse(header.Number.Uint64()) {
var tempValidatorBytes []byte

for _, validator := range newValidators {
Expand All @@ -910,7 +910,7 @@ func (c *Bor) Prepare(chain consensus.ChainHeaderReader, header *types.Header, s
header.Extra = append(header.Extra, validator.HeaderBytes()...)
}
}
} else if c.config.IsParallelUniverse(header.Number) {
} else if c.config.IsParallelUniverse(header.Number.Uint64()) {
blockExtraData := &types.BlockExtraData{
ValidatorBytes: nil,
TxDependency: nil,
Expand Down
2 changes: 1 addition & 1 deletion core/types/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -1525,7 +1525,7 @@ func (b *Block) GetTxDependency() [][]uint64 {
}

func (h *Header) GetValidatorBytes(config *chain.BorConfig) []byte {
if !config.IsParallelUniverse(h.Number) {
if !config.IsParallelUniverse(h.Number.Uint64()) {
return h.Extra[ExtraVanityLength : len(h.Extra)-ExtraSealLength]
}

Expand Down
13 changes: 13 additions & 0 deletions erigon-lib/chain/chain_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,8 @@ type BorConfig struct {
IndoreBlock *big.Int `json:"indoreBlock"` // Indore switch block (nil = no fork, 0 = already on indore)
StateSyncConfirmationDelay map[string]uint64 `json:"stateSyncConfirmationDelay"` // StateSync Confirmation Delay, in seconds, to calculate `to`

ParallelUniverseBlock *big.Int `json:"parallelUniverseBlock"` // TODO: update all occurrence, change name and finalize number (hardfork for block-stm related changes)

sprints sprints
}

Expand Down Expand Up @@ -520,6 +522,17 @@ func (c *BorConfig) CalculateStateSyncDelay(number uint64) uint64 {
return borKeyValueConfigHelper(c.StateSyncConfirmationDelay, number)
}

// TODO: modify this function once the block number is finalized
func (c *BorConfig) IsParallelUniverse(number uint64) bool {
if c.ParallelUniverseBlock != nil {
if c.ParallelUniverseBlock.Cmp(big.NewInt(0)) == 0 {
return false
}
}

return isForked(c.ParallelUniverseBlock, number)
}

func (c *BorConfig) calcConfig(field map[string]uint64, number uint64) uint64 {
keys := sortMapKeys(field)
for i := 0; i < len(keys)-1; i++ {
Expand Down

0 comments on commit c690cb2

Please sign in to comment.