Skip to content

Commit 884302f

Browse files
authored
Merge pull request #220 from filecoin-project/dev
Refactor snapshot codes
2 parents eb6c100 + 0788347 commit 884302f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1726
-1383
lines changed

snapshot/Dockerfile.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ ENV GO111MODULE=on \
1111
WORKDIR /build
1212

1313

14-
COPY power-snapshot/go.mod power-snapshot/go.sum ./
14+
COPY snapshot/go.mod snapshot/go.sum ./
1515
RUN go mod tidy
1616

17-
COPY power-snapshot/. .
17+
COPY snapshot/. .
1818

1919
RUN go build -o app .
2020

snapshot/api/backend.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func GetAllVoterAddresss(chainId int64) ([]string, error) {
6464
return nil, err
6565
}
6666

67-
return grpcResp.Address, nil
67+
return grpcResp.GetAddresses(), nil
6868
}
6969

7070
func GetVoterInfo(address string) (models.VoterInfo, error) {
@@ -80,9 +80,13 @@ func GetVoterInfo(address string) (models.VoterInfo, error) {
8080
return models.VoterInfo{}, err
8181
}
8282

83+
var actorIds []string
84+
if len(grpcResp.ActorId) > 1 {
85+
actorIds = []string{grpcResp.ActorId}
86+
}
8387
return models.VoterInfo{
8488
EthAddress: common.HexToAddress(address),
85-
ActorIds: []uint64{grpcResp.ActorId},
89+
ActorIds: actorIds,
8690
MinerIds: grpcResp.MinerIds,
8791
GithubAccount: grpcResp.GithubAccount,
8892
}, nil

snapshot/api/proto/backend.pb.go

Lines changed: 38 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

snapshot/api/proto/backend.proto

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,25 @@ option go_package = "./proto;rpc";
66

77

88
service Backend {
9-
rpc GetAllVoterAddresss(GetAllVoterAddressRequest) returns (GetAllVoterAddressResponse);
10-
rpc GetVoterInfo(GetVoterInfoRequest) returns (GetVoterInfoResponse);
9+
rpc GetAllVoterAddresss(GetAllVoterAddressRequest)
10+
returns (GetAllVoterAddressResponse);
11+
rpc GetVoterInfo(GetVoterInfoRequest) returns (GetVoterInfoResponse);
1112
}
1213

1314
message GetAllVoterAddressRequest {
14-
int64 chainId = 1;
15+
int64 chain_id=1;
1516
}
1617

1718
message GetVoterInfoRequest {
18-
string address = 1;
19+
string address = 1;
1920
}
2021

2122
message GetAllVoterAddressResponse {
22-
repeated string address = 1;
23-
int64 endHeight = 2;
23+
repeated string addresses = 1;
2424
}
2525

2626
message GetVoterInfoResponse {
27-
repeated uint64 minerIds = 1;
28-
uint64 actorId =2;
29-
string githubAccount = 3;
27+
repeated string miner_ids = 1;
28+
string actor_id =2;
29+
string github_account = 3;
3030
}

0 commit comments

Comments
 (0)