Skip to content

Commit d53fdcf

Browse files
Simplify expressions (#8370)
* Simplify expressions * avoid escaping Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
1 parent 372dc47 commit d53fdcf

File tree

6 files changed

+7
-7
lines changed

6 files changed

+7
-7
lines changed

beacon-chain/core/epoch/precompute/reward_penalty_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func TestAttestationDeltaPrecompute(t *testing.T) {
9191

9292
// Add some variances to target and head balances.
9393
// See: https://github.com/prysmaticlabs/prysm/issues/5593
94-
bp.PrevEpochTargetAttested = bp.PrevEpochTargetAttested / 2
94+
bp.PrevEpochTargetAttested /= 2
9595
bp.PrevEpochHeadAttested = bp.PrevEpochHeadAttested * 2 / 3
9696
rewards, penalties, err := AttestationsDelta(beaconState, bp, vp)
9797
require.NoError(t, err)

beacon-chain/core/helpers/slot_epoch.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ func WeakSubjectivityCheckptEpoch(valCount uint64) (uint64, error) {
213213
if err != nil {
214214
return 0, err
215215
}
216-
v = v / (2 * 100 * m)
216+
v /= 2 * 100 * m
217217
wsp += v
218218
}
219219
return wsp, nil

beacon-chain/powchain/log_processing.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ func (s *Service) processPastLogs(ctx context.Context) error {
318318
}
319319

320320
// multiplicative decrease
321-
batchSize = batchSize / multiplicativeDecreaseDivisor
321+
batchSize /= multiplicativeDecreaseDivisor
322322
continue
323323
}
324324
return err
@@ -351,7 +351,7 @@ func (s *Service) processPastLogs(ctx context.Context) error {
351351

352352
if batchSize < s.eth1HeaderReqLimit {
353353
// update the batchSize with additive increase
354-
batchSize = batchSize + additiveFactor
354+
batchSize += additiveFactor
355355
if batchSize > s.eth1HeaderReqLimit {
356356
batchSize = s.eth1HeaderReqLimit
357357
}

beacon-chain/rpc/validator/attester_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ func TestAttestationDataAtSlot_HandlesFarAwayJustifiedEpoch(t *testing.T) {
208208
justifiedBlock := testutil.NewBeaconBlock()
209209
justifiedBlock.Block.Slot, err = helpers.StartSlot(helpers.SlotToEpoch(1500))
210210
require.NoError(t, err)
211-
justifiedBlock.Block.Slot = justifiedBlock.Block.Slot - 2 // Imagine two skip block
211+
justifiedBlock.Block.Slot -= 2 // Imagine two skip block
212212
blockRoot, err := block.Block.HashTreeRoot()
213213
require.NoError(t, err, "Could not hash beacon block")
214214
justifiedBlockRoot, err := justifiedBlock.Block.HashTreeRoot()

shared/params/loader.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func replaceHexStringWithYAMLFormat(line string) []string {
5151
if err != nil {
5252
log.WithError(err).Error("Failed to marshal config file.")
5353
}
54-
parts[0] = parts[0] + string(fixedByte)
54+
parts[0] += string(fixedByte)
5555
parts = parts[:1]
5656
case l > 1 && l <= 4:
5757
var arr [4]byte

validator/accounts/accounts_import.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727
keystorev4 "github.com/wealdtech/go-eth2-wallet-encryptor-keystorev4"
2828
)
2929

30-
var derivationPathRegex = regexp.MustCompile("m_12381_3600_([0-9]+)_([0-9]+)_([0-9]+)")
30+
var derivationPathRegex = regexp.MustCompile(`m_12381_3600_(\d+)_(\d+)_(\d+)`)
3131

3232
// byDerivationPath implements sort.Interface based on a
3333
// derivation path present in a keystore filename, if any. This

0 commit comments

Comments
 (0)