Skip to content

Commit 0a6d1ae

Browse files
authored
Merge pull request #229 from filecoin-project/feature/snapshot
fix: snapshot synchronization issues
2 parents e4d9fa7 + 894af5e commit 0a6d1ae

26 files changed

+860
-618
lines changed

snapshot/Dockerfile.test

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,8 @@ COPY --from=snapshot-builder /build/app .
2626
COPY --from=snapshot-builder /build/configuration.yaml .
2727
COPY --from=snapshot-builder /build/proof.ucan ./
2828

29+
ENV TZ=Asia/Shanghai
30+
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
31+
2932
# run
3033
CMD ["/dist/app"]

snapshot/api/proto/backend.pb.go

Lines changed: 16 additions & 16 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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ message GetAllVoterAddressResponse {
2424
}
2525

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

snapshot/build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
set -e
33

4-
IMAGE_NAME="pv-snapshot"
4+
IMAGE_NAME="pv-snapshot-mainnet"
55

66
if [ ! -f "configuration.yaml" ]; then
77
echo "Error: configuration.yaml does not exist."
@@ -37,4 +37,4 @@ else
3737
echo "Container $IMAGE_NAME does not exist or is already stopped."
3838
fi
3939

40-
docker run --name $IMAGE_NAME -v ./configuration.yaml:/dist/configuration.yaml -p $PORT:$PORT -d $IMAGE_NAME
40+
docker run --name $IMAGE_NAME -p $PORT:$PORT -v /mnt/fil/mainnet/snapshot/weights:/dist/data/weights -d $IMAGE_NAME

snapshot/configuration.yaml.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,4 @@ w3client:
3333

3434
rate:
3535
githubRequestLimit: 50 # Request interval time, unit in microseconds
36+
syncStartDate: 20250401

snapshot/constant/constant.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const (
3030
TaskActionActor = "actor"
3131
TaskActionMiner = "miner"
3232
DeveloperWeightsFilePrefix = "developer_weights_"
33+
SavedHeightDuration = -DataExpiredDuration * 2880
3334
)
3435

3536
var TimeoutSecond = 15 * time.Second

snapshot/constant/errors.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package constant
2+
3+
4+
var ActorNotFound = "actor not found"

snapshot/constant/key.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ const (
1919
RedisAddrSyncedDate = "%d_SYNCED_DATE"
2020
RedisAddrPower = "%d_POWER_%s"
2121
RedisDeveloperPower = "DEV_POWER"
22-
RedisTipset = "TIPSET_%d"
22+
RedisTipset = "%d_TIPSET"
2323
)

snapshot/go.mod

Lines changed: 48 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
module power-snapshot
22

3-
go 1.22.0
3+
go 1.23.7
44

5-
toolchain go1.22.1
5+
toolchain go1.23.8
66

77
require (
88
github.com/ethereum/go-ethereum v1.14.3
9-
github.com/filecoin-project/go-address v1.1.0
9+
github.com/filecoin-project/go-address v1.2.0
1010
github.com/golang-module/carbon v1.7.3
1111
github.com/golang/mock v1.6.0
1212
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.1.0
13+
github.com/ipld/go-ipld-prime v0.21.0
1314
github.com/multiformats/go-multibase v0.2.0
1415
github.com/multiformats/go-multihash v0.2.3
1516
github.com/multiformats/go-varint v0.0.7
@@ -19,96 +20,94 @@ require (
1920
github.com/samber/lo v1.39.0
2021
github.com/spf13/viper v1.18.2
2122
github.com/stretchr/testify v1.10.0
22-
github.com/whyrusleeping/cbor-gen v0.1.1
23+
github.com/web3-storage/go-ucanto v0.1.0
24+
github.com/whyrusleeping/cbor-gen v0.3.1
2325
github.com/ybbus/jsonrpc/v3 v3.1.5
2426
go.uber.org/zap v1.27.0
25-
golang.org/x/sync v0.11.0
27+
golang.org/x/sync v0.12.0
2628
google.golang.org/grpc v1.71.0
2729
google.golang.org/protobuf v1.36.5
2830
)
2931

3032
require (
31-
github.com/benbjohnson/clock v1.3.0 // indirect
32-
github.com/blang/semver/v4 v4.0.0 // indirect
33-
github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3 // indirect
33+
github.com/cpuguy83/go-md2man/v2 v2.0.6 // indirect
3434
github.com/go-logr/logr v1.4.2 // indirect
3535
github.com/go-logr/stdr v1.2.2 // indirect
3636
github.com/go-sql-driver/mysql v1.7.0 // indirect
3737
github.com/gogo/protobuf v1.3.2 // indirect
38-
github.com/google/go-cmp v0.7.0 // indirect
38+
github.com/google/pprof v0.0.0-20250208200701-d0013a598941 // indirect
3939
github.com/google/uuid v1.6.0 // indirect
40-
github.com/hashicorp/golang-lru v0.5.4 // indirect
40+
github.com/gopherjs/gopherjs v1.17.2 // indirect
41+
github.com/hashicorp/golang-lru v1.0.2 // indirect
4142
github.com/ipfs/bbloom v0.0.4 // indirect
42-
github.com/ipfs/boxo v0.12.0 // indirect
43-
github.com/ipfs/go-blockservice v0.5.0 // indirect
43+
github.com/ipfs/go-blockservice v0.5.2 // indirect
4444
github.com/ipfs/go-datastore v0.6.0 // indirect
45-
github.com/ipfs/go-ipfs-blockstore v1.2.0 // indirect
46-
github.com/ipfs/go-ipfs-ds-help v1.1.0 // indirect
47-
github.com/ipfs/go-ipfs-exchange-interface v0.2.0 // indirect
45+
github.com/ipfs/go-ipfs-blockstore v1.3.1 // indirect
46+
github.com/ipfs/go-ipfs-ds-help v1.1.1 // indirect
47+
github.com/ipfs/go-ipfs-exchange-interface v0.2.1 // indirect
4848
github.com/ipfs/go-ipld-legacy v0.2.1 // indirect
4949
github.com/ipfs/go-log v1.0.5 // indirect
5050
github.com/ipfs/go-log/v2 v2.5.1 // indirect
5151
github.com/ipfs/go-merkledag v0.11.0 // indirect
5252
github.com/ipfs/go-metrics-interface v0.0.1 // indirect
53-
github.com/ipfs/go-verifcid v0.0.2 // indirect
53+
github.com/ipfs/go-peertaskqueue v0.8.1 // indirect
54+
github.com/ipfs/go-verifcid v0.0.3 // indirect
5455
github.com/ipld/go-car v0.6.2 // indirect
5556
github.com/ipld/go-codec-dagpb v1.6.0 // indirect
56-
github.com/ipld/go-ipld-prime v0.21.0 // indirect
5757
github.com/jbenet/goprocess v0.1.4 // indirect
5858
github.com/jinzhu/inflection v1.0.0 // indirect
5959
github.com/jinzhu/now v1.1.5 // indirect
60-
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
61-
github.com/libp2p/go-flow-metrics v0.1.0 // indirect
62-
github.com/libp2p/go-libp2p v0.26.3 // indirect
63-
github.com/mitchellh/go-homedir v1.1.0 // indirect
64-
github.com/multiformats/go-multiaddr v0.8.0 // indirect
65-
github.com/multiformats/go-multicodec v0.9.0 // indirect
66-
github.com/multiformats/go-multistream v0.4.1 // indirect
60+
github.com/libp2p/go-libp2p v0.39.1 // indirect
61+
github.com/mattn/go-colorable v0.1.14 // indirect
62+
github.com/mattn/go-runewidth v0.0.16 // indirect
63+
github.com/multiformats/go-multiaddr v0.14.0 // indirect
6764
github.com/opentracing/opentracing-go v1.2.0 // indirect
68-
github.com/web3-storage/go-ucanto v0.1.0 // indirect
65+
github.com/pion/webrtc/v4 v4.0.9 // indirect
66+
github.com/rivo/uniseg v0.4.7 // indirect
67+
github.com/smartystreets/assertions v1.13.0 // indirect
68+
github.com/urfave/cli/v2 v2.27.5 // indirect
6969
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
7070
go.opentelemetry.io/otel v1.35.0 // indirect
7171
go.opentelemetry.io/otel/metric v1.35.0 // indirect
7272
go.opentelemetry.io/otel/trace v1.35.0 // indirect
73-
go.uber.org/atomic v1.10.0 // indirect
73+
go.uber.org/atomic v1.11.0 // indirect
74+
golang.org/x/time v0.11.0 // indirect
7475
)
7576

7677
require (
7778
github.com/Microsoft/go-winio v0.6.1 // indirect
7879
github.com/StackExchange/wmi v1.2.1 // indirect
79-
github.com/avast/retry-go v3.0.0+incompatible
80-
github.com/bits-and-blooms/bitset v1.10.0 // indirect
80+
github.com/bits-and-blooms/bitset v1.13.0 // indirect
8181
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect
8282
github.com/cespare/xxhash/v2 v2.3.0 // indirect
8383
github.com/consensys/bavard v0.1.13 // indirect
8484
github.com/consensys/gnark-crypto v0.12.1 // indirect
8585
github.com/crate-crypto/go-kzg-4844 v1.0.0 // indirect
8686
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
8787
github.com/deckarep/golang-set/v2 v2.1.0 // indirect
88-
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
88+
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
8989
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
9090
github.com/ethereum/c-kzg-4844 v1.0.0 // indirect
91+
github.com/filecoin-project/go-state-types v0.16.0
9192
github.com/fsnotify/fsnotify v1.7.0 // indirect
9293
github.com/go-ole/go-ole v1.3.0 // indirect
9394
github.com/go-resty/resty/v2 v2.16.5
9495
github.com/gobuffalo/envy v1.10.2 // indirect
9596
github.com/gobuffalo/packd v1.0.2 // indirect
9697
github.com/gobuffalo/packr v1.30.1 // indirect
97-
github.com/gorilla/websocket v1.4.2 // indirect
98+
github.com/gorilla/websocket v1.5.3 // indirect
9899
github.com/hashicorp/hcl v1.0.0 // indirect
99100
github.com/holiman/uint256 v1.2.4 // indirect
100101
github.com/ipfs/go-block-format v0.2.0 // indirect
101-
github.com/ipfs/go-cid v0.4.1
102-
github.com/ipfs/go-ipfs-api v0.7.0
103-
github.com/ipfs/go-ipfs-util v0.0.2 // indirect
104-
github.com/ipfs/go-ipld-cbor v0.1.0 // indirect
105-
github.com/ipfs/go-ipld-format v0.5.0 // indirect
102+
github.com/ipfs/go-cid v0.5.0
103+
github.com/ipfs/go-ipfs-util v0.0.3 // indirect
104+
github.com/ipfs/go-ipld-cbor v0.2.0 // indirect
105+
github.com/ipfs/go-ipld-format v0.6.0 // indirect
106106
github.com/joho/godotenv v1.5.1 // indirect
107-
github.com/klauspost/compress v1.17.2 // indirect
108-
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
107+
github.com/klauspost/compress v1.17.11 // indirect
108+
github.com/klauspost/cpuid/v2 v2.2.9 // indirect
109109
github.com/magiconair/properties v1.8.7 // indirect
110110
github.com/mattn/go-isatty v0.0.20 // indirect
111-
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 // indirect
112111
github.com/minio/sha256-simd v1.0.1 // indirect
113112
github.com/mitchellh/mapstructure v1.5.0 // indirect
114113
github.com/mmcloughlin/addchain v0.4.0 // indirect
@@ -127,27 +126,27 @@ require (
127126
github.com/sourcegraph/conc v0.3.0 // indirect
128127
github.com/spaolacci/murmur3 v1.1.0 // indirect
129128
github.com/spf13/afero v1.11.0 // indirect
130-
github.com/spf13/cast v1.6.0 // indirect
129+
github.com/spf13/cast v1.7.0 // indirect
131130
github.com/spf13/pflag v1.0.5 // indirect
132131
github.com/subosito/gotenv v1.6.0 // indirect
133132
github.com/supranational/blst v0.3.11 // indirect
134133
github.com/tklauser/go-sysconf v0.3.12 // indirect
135134
github.com/tklauser/numcpus v0.6.1 // indirect
136135
github.com/web3-storage/go-w3up v0.0.3
137-
go.uber.org/multierr v1.10.0 // indirect
138-
golang.org/x/crypto v0.33.0 // indirect
139-
golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f // indirect
140-
golang.org/x/mod v0.18.0 // indirect
141-
golang.org/x/net v0.35.0 // indirect
142-
golang.org/x/sys v0.30.0 // indirect
143-
golang.org/x/text v0.22.0 // indirect
144-
golang.org/x/tools v0.22.0 // indirect
145-
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
136+
go.uber.org/multierr v1.11.0 // indirect
137+
golang.org/x/crypto v0.36.0 // indirect
138+
golang.org/x/exp v0.0.0-20250210185358-939b2ce775ac // indirect
139+
golang.org/x/mod v0.24.0 // indirect
140+
golang.org/x/net v0.37.0 // indirect
141+
golang.org/x/sys v0.31.0 // indirect
142+
golang.org/x/text v0.23.0 // indirect
143+
golang.org/x/tools v0.31.0 // indirect
144+
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect
146145
google.golang.org/genproto/googleapis/rpc v0.0.0-20250218202821-56aae31c358a // indirect
147146
gopkg.in/ini.v1 v1.67.0 // indirect
148147
gopkg.in/yaml.v3 v3.0.1 // indirect
149148
gorm.io/driver/mysql v1.5.7
150149
gorm.io/gorm v1.25.12
151-
lukechampine.com/blake3 v1.1.7 // indirect
150+
lukechampine.com/blake3 v1.3.0 // indirect
152151
rsc.io/tmplfunc v0.0.3 // indirect
153152
)

0 commit comments

Comments
 (0)