Skip to content

Commit 695c144

Browse files
authored
core/rawdb: correct misleading comments for state history accessors (#32783)
1 parent e42af53 commit 695c144

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

core/rawdb/accessors_state.go

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,11 @@ func ReadStateHistoryMetaList(db ethdb.AncientReaderOp, start uint64, count uint
170170
return db.AncientRange(stateHistoryMeta, start-1, count, 0)
171171
}
172172

173-
// ReadStateAccountIndex retrieves the state root corresponding to the specified
174-
// state history. Compute the position of state history in freezer by minus one
175-
// since the id of first state history starts from one(zero for initial state).
173+
// ReadStateAccountIndex retrieves the account index blob for the specified
174+
// state history. The index contains fixed-size entries with offsets and lengths
175+
// into the concatenated account data table. Compute the position of state
176+
// history in freezer by minus one since the id of first state history starts
177+
// from one (zero for initial state).
176178
func ReadStateAccountIndex(db ethdb.AncientReaderOp, id uint64) []byte {
177179
blob, err := db.Ancient(stateHistoryAccountIndex, id-1)
178180
if err != nil {
@@ -181,9 +183,11 @@ func ReadStateAccountIndex(db ethdb.AncientReaderOp, id uint64) []byte {
181183
return blob
182184
}
183185

184-
// ReadStateStorageIndex retrieves the state root corresponding to the specified
185-
// state history. Compute the position of state history in freezer by minus one
186-
// since the id of first state history starts from one(zero for initial state).
186+
// ReadStateStorageIndex retrieves the storage index blob for the specified
187+
// state history. The index contains fixed-size entries that locate storage slot
188+
// data in the concatenated storage data table. Compute the position of state
189+
// history in freezer by minus one since the id of first state history starts
190+
// from one (zero for initial state).
187191
func ReadStateStorageIndex(db ethdb.AncientReaderOp, id uint64) []byte {
188192
blob, err := db.Ancient(stateHistoryStorageIndex, id-1)
189193
if err != nil {
@@ -192,9 +196,10 @@ func ReadStateStorageIndex(db ethdb.AncientReaderOp, id uint64) []byte {
192196
return blob
193197
}
194198

195-
// ReadStateAccountHistory retrieves the state root corresponding to the specified
196-
// state history. Compute the position of state history in freezer by minus one
197-
// since the id of first state history starts from one(zero for initial state).
199+
// ReadStateAccountHistory retrieves the concatenated account data blob for the
200+
// specified state history. Offsets and lengths are resolved via the account
201+
// index. Compute the position of state history in freezer by minus one since
202+
// the id of first state history starts from one (zero for initial state).
198203
func ReadStateAccountHistory(db ethdb.AncientReaderOp, id uint64) []byte {
199204
blob, err := db.Ancient(stateHistoryAccountData, id-1)
200205
if err != nil {
@@ -203,9 +208,11 @@ func ReadStateAccountHistory(db ethdb.AncientReaderOp, id uint64) []byte {
203208
return blob
204209
}
205210

206-
// ReadStateStorageHistory retrieves the state root corresponding to the specified
207-
// state history. Compute the position of state history in freezer by minus one
208-
// since the id of first state history starts from one(zero for initial state).
211+
// ReadStateStorageHistory retrieves the concatenated storage slot data blob for
212+
// the specified state history. Locations are resolved via the account and
213+
// storage indexes. Compute the position of state history in freezer by minus
214+
// one since the id of first state history starts from one (zero for initial
215+
// state).
209216
func ReadStateStorageHistory(db ethdb.AncientReaderOp, id uint64) []byte {
210217
blob, err := db.Ancient(stateHistoryStorageData, id-1)
211218
if err != nil {

0 commit comments

Comments
 (0)