Skip to content

Commit

Permalink
Merge branch 'master' into ctl-router
Browse files Browse the repository at this point in the history
  • Loading branch information
hunshenshi authored Jul 12, 2024
2 parents d7e2179 + ab4a59f commit f72cb72
Show file tree
Hide file tree
Showing 22 changed files with 1,641 additions and 711 deletions.
4 changes: 2 additions & 2 deletions action/protocol/execution/evm/evm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,12 +259,12 @@ func TestConstantinople(t *testing.T) {
},
{
"io1pcg2ja9krrhujpazswgz77ss46xgt88afqlk6y",
39275560,
31174200,
},
// after Upernavik
{
action.EmptyAddress,
39275561,
31174201,
},
{
"io1pcg2ja9krrhujpazswgz77ss46xgt88afqlk6y",
Expand Down
1 change: 1 addition & 0 deletions action/protocol/staking/candidate.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ func (d *Candidate) toIoTeXTypes() *iotextypes.CandidateV2 {
TotalWeightedVotes: d.Votes.String(),
SelfStakeBucketIdx: d.SelfStakeBucketIdx,
SelfStakingTokens: d.SelfStake.String(),
Id: d.GetIdentifier().String(),
}
}

Expand Down
6 changes: 6 additions & 0 deletions action/protocol/staking/candidate_buckets_indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,12 @@ func (cbi *CandidatesBucketsIndexer) GetCandidates(height uint64, offset, limit
end = uint32(len(candidateList.Candidates))
}
candidateList.Candidates = candidateList.Candidates[offset:end]
// fill id if it's empty for backward compatibility
for i := range candidateList.Candidates {
if candidateList.Candidates[i].Id == "" {
candidateList.Candidates[i].Id = candidateList.Candidates[i].OwnerAddress
}
}
return candidateList, height, nil
}

Expand Down
3 changes: 3 additions & 0 deletions action/protocol/staking/candidate_buckets_indexer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func TestCandidatesBucketsIndexer_PutGetCandidates(t *testing.T) {
OwnerAddress: "owner1",
Name: "abc",
SelfStakeBucketIdx: 123,
Id: "owner1",
},
}
cand2 := &iotextypes.CandidateListV2{
Expand All @@ -53,6 +54,7 @@ func TestCandidatesBucketsIndexer_PutGetCandidates(t *testing.T) {
OwnerAddress: "owner2",
Name: "xyz",
SelfStakeBucketIdx: 456,
Id: "owner2",
}),
}

Expand Down Expand Up @@ -126,6 +128,7 @@ func TestCandidatesBucketsIndexer_PutGetCandidates(t *testing.T) {
OwnerAddress: "ownermax",
Name: "alphabeta",
SelfStakeBucketIdx: 789,
Id: "ownermax",
}),
}
require.NoError(cbi.PutCandidates(height, candMax))
Expand Down
Loading

0 comments on commit f72cb72

Please sign in to comment.