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:
Victor Farazdagi
2021-02-01 07:14:36 -08:00
committed by GitHub
parent 372dc47b64
commit d53fdcf781
6 changed files with 7 additions and 7 deletions

View File

@@ -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)

View File

@@ -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

View File

@@ -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
}

View File

@@ -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()

View File

@@ -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

View File

@@ -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