Skip to content

Commit c42b366

Browse files
Revert "Remove duplicates from AccHistory and StorageHistory" (#18109)
Reverts #17962 <@525860938360815626> : Mike prepared a DB with commitments enabled for historical eth_getProof() verifications. Upon executing the historical tests, we observed that the state root calculation failed for few tests with postState and so verification of receiptsRoot(the calculated receipt root doesn't match block.receiptRoot). Previously, even when running the Hive tests (with commitment enabled), the state root calculation was correct. By bisecting the commits, we identified that the failure was introduced after the merge of PR #17962. PR #18108 enables historical tests with Erigon commitments and inserts two calls to TouchKey() in DomainPut(). This addition resolves the failed state root calculation and the verification of the receipts root. Since I am not an expert in this specific code component, could you please verify if this is the correct fix?
1 parent e565e1a commit c42b366

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

db/kv/kvcache/cache_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ func TestEviction(t *testing.T) {
171171
}
172172

173173
func TestAPI(t *testing.T) {
174-
t.Skip()
175174
require := require.New(t)
176175

177176
// Create a context with timeout for the entire test

db/state/execctx/domain_shared.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ func (sd *SharedDomains) DomainPut(domain kv.Domain, roTx kv.TemporalTx, k, v []
357357
return fmt.Errorf("DomainPut: %s, trying to put nil value. not allowed", domain)
358358
}
359359
ks := string(k)
360+
sd.sdCtx.TouchKey(domain, ks, v)
360361

361362
if prevVal == nil {
362363
var err error
@@ -366,19 +367,17 @@ func (sd *SharedDomains) DomainPut(domain kv.Domain, roTx kv.TemporalTx, k, v []
366367
}
367368
}
368369
switch domain {
369-
case kv.CodeDomain, kv.AccountsDomain, kv.StorageDomain:
370+
case kv.CodeDomain:
370371
if bytes.Equal(prevVal, v) {
371372
return nil
372373
}
373-
case kv.RCacheDomain, kv.CommitmentDomain:
374+
case kv.StorageDomain, kv.AccountsDomain, kv.CommitmentDomain, kv.RCacheDomain:
374375
//noop
375376
default:
376377
if bytes.Equal(prevVal, v) {
377378
return nil
378379
}
379380
}
380-
sd.sdCtx.TouchKey(domain, ks, v)
381-
382381
return sd.mem.DomainPut(domain, ks, v, txNum, prevVal, prevStep)
383382
}
384383

rpc/jsonrpc/debug_api_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ func TestGetModifiedAccountsByNumber(t *testing.T) {
383383
n, n2 = rpc.BlockNumber(5), rpc.BlockNumber(8)
384384
result, err = api.GetModifiedAccountsByNumber(m.Ctx, n, &n2)
385385
require.NoError(t, err)
386-
require.Len(t, result, 37)
386+
require.Len(t, result, 38)
387387

388388
n, n2 = rpc.BlockNumber(0), rpc.BlockNumber(10)
389389
result, err = api.GetModifiedAccountsByNumber(m.Ctx, n, &n2)

0 commit comments

Comments
 (0)