Skip to content

Commit

Permalink
Fixed failed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
terencechain committed Mar 19, 2020
1 parent ec61457 commit 6f39dcc
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
3 changes: 2 additions & 1 deletion beacon-chain/core/blocks/block_operations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,8 @@ func TestProcessEth1Data_SetsCorrectly(t *testing.T) {
},
}
var err error
for i := uint64(0); i < params.BeaconConfig().SlotsPerEth1VotingPeriod; i++ {
period := params.BeaconConfig().EpochsPerEth1VotingPeriod * params.BeaconConfig().SlotsPerEpoch
for i := uint64(0); i < period; i++ {
beaconState, err = blocks.ProcessEth1DataInBlock(beaconState, block)
if err != nil {
t.Fatal(err)
Expand Down
4 changes: 2 additions & 2 deletions beacon-chain/core/blocks/eth1_data_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func TestEth1DataHasEnoughSupport(t *testing.T) {
DepositCount: 1,
DepositRoot: []byte("root"),
},
hasSupport: true,
hasSupport: false,

This comment has been minimized.

Copy link
@prestonvanloon

prestonvanloon Apr 13, 2020

Member

Why?

votingPeriodLength: 7,
}, {
stateVotes: []*ethpb.Eth1Data{
Expand Down Expand Up @@ -90,7 +90,7 @@ func TestEth1DataHasEnoughSupport(t *testing.T) {
for i, tt := range tests {
t.Run(fmt.Sprintf("%d", i), func(t *testing.T) {
c := params.BeaconConfig()
c.SlotsPerEth1VotingPeriod = tt.votingPeriodLength
c.EpochsPerEth1VotingPeriod = tt.votingPeriodLength
params.OverrideBeaconConfig(c)

s, _ := beaconstate.InitializeFromProto(&pb.BeaconState{
Expand Down
2 changes: 1 addition & 1 deletion beacon-chain/rpc/validator/proposer.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func (vs *Server) mockETH1DataVote(ctx context.Context, slot uint64) (*ethpb.Eth
// DepositCount = state.eth1_deposit_index,
// BlockHash = hash(hash(current_epoch + slot_in_voting_period)),
// )
slotInVotingPeriod := slot % params.BeaconConfig().EpochsPerEth1VotingPeriod * params.BeaconConfig().SlotsPerEpoch
slotInVotingPeriod := slot % (params.BeaconConfig().EpochsPerEth1VotingPeriod * params.BeaconConfig().SlotsPerEpoch)
headState, err := vs.HeadFetcher.HeadState(ctx)
if err != nil {
return nil, err
Expand Down
9 changes: 6 additions & 3 deletions beacon-chain/rpc/validator/proposer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,8 @@ func TestPendingDeposits_Eth1DataVoteOK(t *testing.T) {
BlockHash: blockHash,
DepositCount: 3,
}
for i := 0; i <= int(params.BeaconConfig().SlotsPerEth1VotingPeriod/2); i++ {
period := params.BeaconConfig().EpochsPerEth1VotingPeriod * params.BeaconConfig().SlotsPerEpoch
for i := 0; i <= int(period/2); i++ {
votes = append(votes, vote)
}

Expand Down Expand Up @@ -635,7 +636,8 @@ func TestPendingDeposits_FollowsCorrectEth1Block(t *testing.T) {
BlockHash: []byte("0x1"),
DepositCount: 7,
}
for i := 0; i <= int(params.BeaconConfig().SlotsPerEth1VotingPeriod/2); i++ {
period := params.BeaconConfig().EpochsPerEth1VotingPeriod * params.BeaconConfig().SlotsPerEpoch
for i := 0; i <= int(period/2); i++ {
votes = append(votes, vote)
}

Expand Down Expand Up @@ -1232,7 +1234,8 @@ func TestEth1Data_MockEnabled(t *testing.T) {
if err != nil {
t.Fatal(err)
}
wantedSlot := 100 % params.BeaconConfig().SlotsPerEth1VotingPeriod
period := params.BeaconConfig().EpochsPerEth1VotingPeriod * params.BeaconConfig().SlotsPerEpoch
wantedSlot := 100 % period
currentEpoch := helpers.SlotToEpoch(100)
enc, err := ssz.Marshal(currentEpoch + wantedSlot)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions validator/client/validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ func TestWaitMultipleActivation_LogsActivationEpochOK(t *testing.T) {
}
testutil.AssertLogsContain(t, hook, "Validator activated")
}

func TestWaitActivation_NotAllValidatorsActivatedOK(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
Expand Down

0 comments on commit 6f39dcc

Please sign in to comment.