Use math.MaxUint64 (#9857)

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
terence tsao 2021-11-04 11:48:09 -07:00 committed by GitHub
parent 7974fe01cd
commit 341a2f1ea3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 7 deletions

View File

@ -3,6 +3,7 @@ package debug
import (
"context"
"fmt"
"math"
types "github.com/prysmaticlabs/eth2-types"
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
@ -61,7 +62,7 @@ func (ds *Server) GetInclusionSlot(ctx context.Context, req *pbrpc.InclusionSlot
return nil, status.Errorf(codes.Internal, "Could not retrieve blocks: %v", err)
}
inclusionSlot := types.Slot(1<<64 - 1)
inclusionSlot := types.Slot(math.MaxUint64)
targetStates := make(map[[32]byte]state.ReadOnlyBeaconState)
for _, blk := range blks {
for _, a := range blk.Block().Body().Attestations() {

View File

@ -65,8 +65,8 @@ var mainnetNetworkConfig = &NetworkConfig{
var mainnetBeaconConfig = &BeaconChainConfig{
// Constants (Non-configurable)
FarFutureEpoch: 1<<64 - 1,
FarFutureSlot: 1<<64 - 1,
FarFutureEpoch: math.MaxUint64,
FarFutureSlot: math.MaxUint64,
BaseRewardsPerEpoch: 4,
DepositContractTreeDepth: 32,
GenesisDelay: 604800, // 1 week.

View File

@ -82,8 +82,8 @@ func MinimalSpecConfig() *BeaconChainConfig {
minimalConfig.GenesisForkVersion = []byte{0, 0, 0, 1}
minimalConfig.DepositContractTreeDepth = 32
minimalConfig.FarFutureEpoch = 1<<64 - 1
minimalConfig.FarFutureSlot = 1<<64 - 1
minimalConfig.FarFutureEpoch = math.MaxUint64
minimalConfig.FarFutureSlot = math.MaxUint64
// New Altair params
minimalConfig.AltairForkVersion = []byte{1, 0, 0, 1} // Highest byte set to 0x01 to avoid collisions with mainnet versioning

View File

@ -416,8 +416,8 @@ func TestPrevSlot(t *testing.T) {
},
{
name: "max",
slot: 1<<64 - 1,
want: 1<<64 - 1 - 1,
slot: math.MaxUint64,
want: math.MaxUint64 - 1,
},
}
for _, tt := range tests {