Skip to content

Commit 84f9b7e

Browse files
authored
API node keep historical states of 256 blocks (#4699)
1 parent 8e678b7 commit 84f9b7e

File tree

12 files changed

+612
-29
lines changed

12 files changed

+612
-29
lines changed

Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM golang:1.23.0-alpine AS build
22

33
WORKDIR /go/apps/iotex-core
44

5-
RUN apk add --no-cache make gcc musl-dev linux-headers git ca-certificates
5+
RUN apk add --no-cache make gcc build-base musl-dev linux-headers git ca-certificates libstdc++
66

77
COPY go.mod .
88
COPY go.sum .
@@ -19,6 +19,8 @@ RUN mkdir -p $GOPATH/pkg/linux_amd64/github.com/iotexproject/ && \
1919

2020
FROM alpine
2121

22+
RUN apk add --no-cache libstdc++
23+
2224
RUN mkdir -p /etc/iotex/
2325
COPY --from=build /go/apps/iotex-core/bin/server /usr/local/bin/iotex-server
2426
COPY --from=build /go/apps/iotex-core/bin/actioninjectorv2 /usr/local/bin/iotex-actioninjectorv2

Makefile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ PackageFlags += -X '$(VersionImportPath).GoVersion=$(GO_VERSION)'
6464
PackageFlags += -X '$(VersionImportPath).BuildTime=$(BUILD_TIME)'
6565
PackageFlags += -s -w
6666

67+
BUILD_TAGS = nosilkworm
68+
6769
TEST_IGNORE= ".git,vendor"
6870
COV_OUT := profile.coverprofile
6971
COV_REPORT := overalls.coverprofile
@@ -84,30 +86,30 @@ all: clean build-all test
8486

8587
.PHONY: build
8688
build: ioctl
87-
$(GOBUILD) -ldflags "$(PackageFlags)" -o ./bin/$(BUILD_TARGET_SERVER) -v ./$(BUILD_TARGET_SERVER)
89+
$(GOBUILD) -tags $(BUILD_TAGS) -ldflags "$(PackageFlags)" -o ./bin/$(BUILD_TARGET_SERVER) -v ./$(BUILD_TARGET_SERVER)
8890

8991
.PHONY: build-all
9092
build-all: build build-actioninjector build-addrgen build-minicluster build-staterecoverer build-readtip
9193

9294
.PHONY: build-actioninjector
9395
build-actioninjector:
94-
$(GOBUILD) -o ./bin/$(BUILD_TARGET_ACTINJV2) -v ./tools/actioninjector.v2
96+
$(GOBUILD) -tags $(BUILD_TAGS) -o ./bin/$(BUILD_TARGET_ACTINJV2) -v ./tools/actioninjector.v2
9597

9698
.PHONY: build-addrgen
9799
build-addrgen:
98-
$(GOBUILD) -o ./bin/$(BUILD_TARGET_ADDRGEN) -v ./tools/addrgen
100+
$(GOBUILD) -tags $(BUILD_TAGS) -o ./bin/$(BUILD_TARGET_ADDRGEN) -v ./tools/addrgen
99101

100102
.PHONY: build-minicluster
101103
build-minicluster:
102-
$(GOBUILD) -o ./bin/$(BUILD_TARGET_MINICLUSTER) -v ./tools/minicluster
104+
$(GOBUILD) -tags $(BUILD_TAGS) -o ./bin/$(BUILD_TARGET_MINICLUSTER) -v ./tools/minicluster
103105

104106
.PHONY: build-staterecoverer
105107
build-staterecoverer:
106-
$(GOBUILD) -o ./bin/$(BUILD_TARGET_RECOVER) -v ./tools/staterecoverer
108+
$(GOBUILD) -tags $(BUILD_TAGS) -o ./bin/$(BUILD_TARGET_RECOVER) -v ./tools/staterecoverer
107109

108110
.PHONY: build-readtip
109111
build-readtip:
110-
$(GOBUILD) -o ./bin/$(BUILD_TARGET_READTIP) -v ./tools/readtip
112+
$(GOBUILD) -tags $(BUILD_TAGS) -o ./bin/$(BUILD_TARGET_READTIP) -v ./tools/readtip
111113

112114
.PHONY: fmt
113115
fmt:

blockchain/config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ type (
4040
BlobStoreDBPath string `yaml:"blobStoreDBPath"`
4141
BlobStoreRetentionDays uint32 `yaml:"blobStoreRetentionDays"`
4242
HistoryIndexPath string `yaml:"historyIndexPath"`
43+
HistoryBlockRetention uint64 `yaml:"historyBlockRetention"`
4344
ID uint32 `yaml:"id"`
4445
EVMNetworkID uint32 `yaml:"evmNetworkID"`
4546
Address string `yaml:"address"`
@@ -104,6 +105,7 @@ var (
104105
ContractStakingIndexDBPath: "/var/data/contractstaking.index.db",
105106
BlobStoreDBPath: "/var/data/blob.db",
106107
BlobStoreRetentionDays: 21,
108+
HistoryBlockRetention: 0,
107109
ID: 1,
108110
EVMNetworkID: 4689,
109111
Address: "",

go.mod

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,32 @@ require (
7777
github.com/Microsoft/go-winio v0.6.1 // indirect
7878
github.com/StackExchange/wmi v1.2.1 // indirect
7979
github.com/VictoriaMetrics/fastcache v1.12.2 // indirect
80+
github.com/ajwerner/btree v0.0.0-20211221152037-f427b3e689c0 // indirect
81+
github.com/alecthomas/atomic v0.1.0-alpha2 // indirect
82+
github.com/anacrolix/chansync v0.3.0 // indirect
83+
github.com/anacrolix/dht/v2 v2.21.1 // indirect
84+
github.com/anacrolix/envpprof v1.3.0 // indirect
85+
github.com/anacrolix/generics v0.0.0-20230816105729-c755655aee45 // indirect
86+
github.com/anacrolix/go-libutp v1.3.1 // indirect
87+
github.com/anacrolix/log v0.15.2 // indirect
88+
github.com/anacrolix/missinggo v1.3.0 // indirect
89+
github.com/anacrolix/missinggo/perf v1.0.0 // indirect
90+
github.com/anacrolix/missinggo/v2 v2.7.2-0.20230527121029-a582b4f397b9 // indirect
91+
github.com/anacrolix/mmsg v1.0.0 // indirect
92+
github.com/anacrolix/multiless v0.3.1-0.20221221005021-2d12701f83f7 // indirect
93+
github.com/anacrolix/stm v0.4.1-0.20221221005312-96d17df0e496 // indirect
94+
github.com/anacrolix/sync v0.5.1 // indirect
95+
github.com/anacrolix/torrent v1.52.6-0.20231201115409-7ea994b6bbd8 // indirect
96+
github.com/anacrolix/upnp v0.1.3-0.20220123035249-922794e51c96 // indirect
97+
github.com/anacrolix/utp v0.1.0 // indirect
98+
github.com/bahlo/generic-list-go v0.2.0 // indirect
8099
github.com/benbjohnson/clock v1.3.5 // indirect
100+
github.com/benbjohnson/immutable v0.4.1-0.20221220213129-8932b999621d // indirect
101+
github.com/benesch/cgosymbolizer v0.0.0-20190515212042-bec6fe6e597b // indirect
81102
github.com/beorn7/perks v1.0.1 // indirect
82103
github.com/bits-and-blooms/bitset v1.12.0 // indirect
83104
github.com/blang/semver/v4 v4.0.0 // indirect
105+
github.com/bradfitz/iter v0.0.0-20191230175014-e8f45d346db8 // indirect
84106
github.com/btcsuite/btcd v0.24.2 // indirect
85107
github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect
86108
github.com/btcsuite/btcd/btcutil v1.1.5 // indirect
@@ -100,34 +122,52 @@ require (
100122
github.com/crate-crypto/go-kzg-4844 v0.7.0 // indirect
101123
github.com/davecgh/go-spew v1.1.1 // indirect
102124
github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect
125+
github.com/deckarep/golang-set v1.8.0 // indirect
103126
github.com/deckarep/golang-set/v2 v2.3.1 // indirect
104127
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
105128
github.com/dlclark/regexp2 v1.7.0 // indirect
106129
github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127 // indirect
107130
github.com/dustin/go-humanize v1.0.1 // indirect
108131
github.com/edsrzf/mmap-go v1.1.0 // indirect
109132
github.com/elastic/gosigar v0.14.3 // indirect
133+
github.com/emicklei/dot v1.6.1 // indirect
134+
github.com/erigontech/erigon-snapshot v1.3.0 // indirect
110135
github.com/erigontech/mdbx-go v0.27.24 // indirect
111136
github.com/erigontech/secp256k1 v1.1.0 // indirect
137+
github.com/erigontech/silkworm-go v0.18.0 // indirect
138+
github.com/erigontech/speedtest v0.0.2 // indirect
112139
github.com/ethereum/c-kzg-4844 v0.4.0 // indirect
140+
github.com/fjl/gencodec v0.0.0-20230517082657-f9840df7b83e // indirect
141+
github.com/garslo/gogen v0.0.0-20170307003452-d6ebae628c7c // indirect
113142
github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 // indirect
143+
github.com/go-llsqlite/adapter v0.0.0-20230927005056-7f5ce7f0c916 // indirect
144+
github.com/go-llsqlite/crawshaw v0.4.0 // indirect
114145
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
115146
github.com/go-stack/stack v1.8.1 // indirect
116147
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
148+
github.com/goccy/go-json v0.10.2 // indirect
117149
github.com/godbus/dbus/v5 v5.1.0 // indirect
118150
github.com/gofrs/flock v0.8.1 // indirect
151+
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
119152
github.com/golang/mock v1.6.0 // indirect
120153
github.com/google/btree v1.1.2 // indirect
121154
github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e // indirect
155+
github.com/hashicorp/golang-lru/arc/v2 v2.0.7 // indirect
156+
github.com/huandu/xstrings v1.4.0 // indirect
157+
github.com/ianlancetaylor/cgosymbolizer v0.0.0-20220405231054-a1ae3e4bba26 // indirect
158+
github.com/json-iterator/go v1.1.12 // indirect
122159
github.com/klauspost/compress v1.17.11 // indirect
123160
github.com/kr/pretty v0.3.1 // indirect
124161
github.com/kr/text v0.2.0 // indirect
125162
github.com/mattn/go-colorable v0.1.13 // indirect
126163
github.com/mattn/go-isatty v0.0.20 // indirect
127164
github.com/mmcloughlin/addchain v0.4.0 // indirect
165+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
166+
github.com/modern-go/reflect2 v1.0.2 // indirect
128167
github.com/mschoch/smat v0.2.0 // indirect
129168
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
130169
github.com/ncruces/go-strftime v0.1.9 // indirect
170+
github.com/pelletier/go-toml/v2 v2.2.1 // indirect
131171
github.com/pion/datachannel v1.5.10 // indirect
132172
github.com/pion/dtls/v2 v2.2.12 // indirect
133173
github.com/pion/dtls/v3 v3.0.4 // indirect
@@ -142,36 +182,48 @@ require (
142182
github.com/pion/rtp v1.8.11 // indirect
143183
github.com/pion/sctp v1.8.35 // indirect
144184
github.com/pion/sdp/v3 v3.0.10 // indirect
185+
github.com/pion/srtp/v2 v2.0.20 // indirect
145186
github.com/pion/srtp/v3 v3.0.4 // indirect
146187
github.com/pion/stun v0.6.1 // indirect
147188
github.com/pion/stun/v3 v3.0.0 // indirect
148189
github.com/pion/transport/v2 v2.2.10 // indirect
149190
github.com/pion/transport/v3 v3.0.7 // indirect
150191
github.com/pion/turn/v2 v2.1.6 // indirect
151192
github.com/pion/turn/v4 v4.0.0 // indirect
193+
github.com/pion/webrtc/v3 v3.3.5 // indirect
152194
github.com/pion/webrtc/v4 v4.0.8 // indirect
153195
github.com/protolambda/ztyp v0.2.2 // indirect
196+
github.com/prysmaticlabs/gohashtree v0.0.3-alpha.0.20230502123415-aafd8b3ca202 // indirect
197+
github.com/quasilyte/go-ruleguard/dsl v0.3.22 // indirect
154198
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
155199
github.com/rivo/uniseg v0.2.0 // indirect
156200
github.com/rogpeppe/go-internal v1.13.1 // indirect
201+
github.com/rs/dnscache v0.0.0-20211102005908-e0241e321417 // indirect
202+
github.com/shirou/gopsutil/v4 v4.24.7 // indirect
157203
github.com/shoenig/go-m1cpu v0.1.6 // indirect
158204
github.com/sirupsen/logrus v1.9.3 // indirect
205+
github.com/spf13/afero v1.9.5 // indirect
159206
github.com/supranational/blst v0.3.15 // indirect
207+
github.com/thomaso-mirodin/intmath v0.0.0-20160323211736-5dc6d854e46e // indirect
160208
github.com/tidwall/btree v1.6.0 // indirect
161209
github.com/ugorji/go/codec v1.1.13 // indirect
210+
github.com/ugorji/go/codec/codecgen v1.1.13 // indirect
162211
github.com/valyala/fastjson v1.6.4 // indirect
163212
github.com/wlynxg/anet v0.0.5 // indirect
213+
github.com/xsleonard/go-merkle v1.1.0 // indirect
164214
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
165215
go.uber.org/dig v1.18.0 // indirect
166216
go.uber.org/fx v1.23.0 // indirect
167217
golang.org/x/mod v0.24.0 // indirect
168218
golang.org/x/tools v0.31.0 // indirect
169219
gonum.org/v1/gonum v0.15.1 // indirect
220+
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0 // indirect
170221
modernc.org/libc v1.62.1 // indirect
171222
modernc.org/mathutil v1.7.1 // indirect
172223
modernc.org/memory v1.9.1 // indirect
173224
modernc.org/sqlite v1.37.0 // indirect
174225
rsc.io/tmplfunc v0.0.3 // indirect
226+
zombiezen.com/go/sqlite v0.13.1 // indirect
175227
)
176228

177229
require (
@@ -301,6 +353,6 @@ replace github.com/iotexproject/go-pkgs => github.com/iotexproject/go-pkgs v0.1.
301353

302354
replace github.com/erigontech/erigon-lib => github.com/erigontech/erigon/erigon-lib v0.0.0-20250305121304-76181961ed24
303355

304-
replace github.com/gballet/go-verkle => github.com/envestcc/go-verkle v0.0.0-20250213083643-8c07c3a18b5d
356+
replace github.com/gballet/go-verkle => github.com/envestcc/go-verkle v0.0.0-20250318002112-1d982889428e
305357

306358
replace github.com/erigontech/erigon-snapshot => github.com/ledgerwatch/erigon-snapshot v1.3.1-0.20240805114253-42da880260bb

0 commit comments

Comments
 (0)