github.com/ethereum/go-ethereum@v1.16.1/beacon/params/params.go (about)

     1  // Copyright 2022 The go-ethereum Authors
     2  // This file is part of the go-ethereum library.
     3  //
     4  // The go-ethereum library is free software: you can redistribute it and/or modify
     5  // it under the terms of the GNU Lesser General Public License as published by
     6  // the Free Software Foundation, either version 3 of the License, or
     7  // (at your option) any later version.
     8  //
     9  // The go-ethereum library is distributed in the hope that it will be useful,
    10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    12  // GNU Lesser General Public License for more details.
    13  //
    14  // You should have received a copy of the GNU Lesser General Public License
    15  // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
    16  
    17  package params
    18  
    19  const (
    20  	EpochLength      = 32
    21  	SyncPeriodLength = 8192
    22  
    23  	BLSSignatureSize = 96
    24  	BLSPubkeySize    = 48
    25  
    26  	SyncCommitteeSize          = 512
    27  	SyncCommitteeBitmaskSize   = SyncCommitteeSize / 8
    28  	SyncCommitteeSupermajority = (SyncCommitteeSize*2 + 2) / 3
    29  )
    30  
    31  const (
    32  	StateIndexGenesisTime              = 32
    33  	StateIndexGenesisValidators        = 33
    34  	StateIndexForkVersion              = 141
    35  	StateIndexLatestHeader             = 36
    36  	StateIndexBlockRoots               = 37
    37  	StateIndexStateRoots               = 38
    38  	StateIndexHistoricRoots            = 39
    39  	StateIndexFinalBlockOld            = 105
    40  	StateIndexFinalBlockElectra        = 169
    41  	StateIndexSyncCommitteeOld         = 54
    42  	StateIndexSyncCommitteeElectra     = 86
    43  	StateIndexNextSyncCommitteeOld     = 55
    44  	StateIndexNextSyncCommitteeElectra = 87
    45  	StateIndexExecPayload              = 56
    46  	StateIndexExecHead                 = 908
    47  
    48  	BodyIndexExecPayload = 25
    49  )
    50  
    51  func StateIndexFinalBlock(forkName string) uint64 {
    52  	switch forkName {
    53  	case "bellatrix", "capella", "deneb":
    54  		return StateIndexFinalBlockOld
    55  	default:
    56  		return StateIndexFinalBlockElectra
    57  	}
    58  }
    59  func StateIndexSyncCommittee(forkName string) uint64 {
    60  	switch forkName {
    61  	case "bellatrix", "capella", "deneb":
    62  		return StateIndexSyncCommitteeOld
    63  	default:
    64  		return StateIndexSyncCommitteeElectra
    65  	}
    66  }
    67  func StateIndexNextSyncCommittee(forkName string) uint64 {
    68  	switch forkName {
    69  	case "bellatrix", "capella", "deneb":
    70  		return StateIndexNextSyncCommitteeOld
    71  	default:
    72  		return StateIndexNextSyncCommitteeElectra
    73  	}
    74  }