mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 13:28:01 -05:00
Simplify expressions (#8370)
* Simplify expressions * avoid escaping Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
@@ -91,7 +91,7 @@ func TestAttestationDeltaPrecompute(t *testing.T) {
|
||||
|
||||
// Add some variances to target and head balances.
|
||||
// See: https://github.com/prysmaticlabs/prysm/issues/5593
|
||||
bp.PrevEpochTargetAttested = bp.PrevEpochTargetAttested / 2
|
||||
bp.PrevEpochTargetAttested /= 2
|
||||
bp.PrevEpochHeadAttested = bp.PrevEpochHeadAttested * 2 / 3
|
||||
rewards, penalties, err := AttestationsDelta(beaconState, bp, vp)
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -213,7 +213,7 @@ func WeakSubjectivityCheckptEpoch(valCount uint64) (uint64, error) {
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
v = v / (2 * 100 * m)
|
||||
v /= 2 * 100 * m
|
||||
wsp += v
|
||||
}
|
||||
return wsp, nil
|
||||
|
||||
@@ -318,7 +318,7 @@ func (s *Service) processPastLogs(ctx context.Context) error {
|
||||
}
|
||||
|
||||
// multiplicative decrease
|
||||
batchSize = batchSize / multiplicativeDecreaseDivisor
|
||||
batchSize /= multiplicativeDecreaseDivisor
|
||||
continue
|
||||
}
|
||||
return err
|
||||
@@ -351,7 +351,7 @@ func (s *Service) processPastLogs(ctx context.Context) error {
|
||||
|
||||
if batchSize < s.eth1HeaderReqLimit {
|
||||
// update the batchSize with additive increase
|
||||
batchSize = batchSize + additiveFactor
|
||||
batchSize += additiveFactor
|
||||
if batchSize > s.eth1HeaderReqLimit {
|
||||
batchSize = s.eth1HeaderReqLimit
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ func TestAttestationDataAtSlot_HandlesFarAwayJustifiedEpoch(t *testing.T) {
|
||||
justifiedBlock := testutil.NewBeaconBlock()
|
||||
justifiedBlock.Block.Slot, err = helpers.StartSlot(helpers.SlotToEpoch(1500))
|
||||
require.NoError(t, err)
|
||||
justifiedBlock.Block.Slot = justifiedBlock.Block.Slot - 2 // Imagine two skip block
|
||||
justifiedBlock.Block.Slot -= 2 // Imagine two skip block
|
||||
blockRoot, err := block.Block.HashTreeRoot()
|
||||
require.NoError(t, err, "Could not hash beacon block")
|
||||
justifiedBlockRoot, err := justifiedBlock.Block.HashTreeRoot()
|
||||
|
||||
@@ -51,7 +51,7 @@ func replaceHexStringWithYAMLFormat(line string) []string {
|
||||
if err != nil {
|
||||
log.WithError(err).Error("Failed to marshal config file.")
|
||||
}
|
||||
parts[0] = parts[0] + string(fixedByte)
|
||||
parts[0] += string(fixedByte)
|
||||
parts = parts[:1]
|
||||
case l > 1 && l <= 4:
|
||||
var arr [4]byte
|
||||
|
||||
@@ -27,7 +27,7 @@ import (
|
||||
keystorev4 "github.com/wealdtech/go-eth2-wallet-encryptor-keystorev4"
|
||||
)
|
||||
|
||||
var derivationPathRegex = regexp.MustCompile("m_12381_3600_([0-9]+)_([0-9]+)_([0-9]+)")
|
||||
var derivationPathRegex = regexp.MustCompile(`m_12381_3600_(\d+)_(\d+)_(\d+)`)
|
||||
|
||||
// byDerivationPath implements sort.Interface based on a
|
||||
// derivation path present in a keystore filename, if any. This
|
||||
|
||||
Reference in New Issue
Block a user