e3: index readers pool (#6954)

This commit is contained in:
Alex Sharov 2023-02-26 09:04:46 +07:00 committed by GitHub
parent b51b293f14
commit fae889f815
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 5 deletions

View File

@ -1,10 +1,10 @@
package state
import (
"encoding/binary"
"fmt"
libcommon "github.com/ledgerwatch/erigon-lib/common"
"github.com/ledgerwatch/erigon-lib/common/hexutility"
"github.com/ledgerwatch/erigon-lib/kv"
"github.com/ledgerwatch/erigon/core/state/temporal"
"github.com/ledgerwatch/erigon/core/types/accounts"
@ -50,7 +50,10 @@ func (hr *HistoryReaderV3) ReadAccountData(address libcommon.Address) (*accounts
}
func (hr *HistoryReaderV3) ReadAccountStorage(address libcommon.Address, incarnation uint64, key *libcommon.Hash) ([]byte, error) {
enc, _, err := hr.ttx.DomainGet(temporal.StorageDomain, append(address.Bytes(), hexutility.EncodeTs(incarnation)...), key.Bytes(), hr.txNum)
acc := make([]byte, 20+8)
copy(acc, address.Bytes())
binary.BigEndian.PutUint64(acc[20:], incarnation)
enc, _, err := hr.ttx.DomainGet(temporal.StorageDomain, acc, key.Bytes(), hr.txNum)
if hr.trace {
fmt.Printf("ReadAccountStorage [%x] [%x] => [%x]\n", address, *key, enc)
}

2
go.mod
View File

@ -3,7 +3,7 @@ module github.com/ledgerwatch/erigon
go 1.18
require (
github.com/ledgerwatch/erigon-lib v0.0.0-20230224131753-91fcc7da8185
github.com/ledgerwatch/erigon-lib v0.0.0-20230225062945-eaec91fff52d
github.com/ledgerwatch/erigon-snapshot v1.1.1-0.20230224032817-e29f5ad218a2
github.com/ledgerwatch/log/v3 v3.7.0
github.com/ledgerwatch/secp256k1 v1.0.0

4
go.sum
View File

@ -521,8 +521,8 @@ github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kylelemons/godebug v0.0.0-20170224010052-a616ab194758 h1:0D5M2HQSGD3PYPwICLl+/9oulQauOuETfgFvhBDffs0=
github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c=
github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8=
github.com/ledgerwatch/erigon-lib v0.0.0-20230224131753-91fcc7da8185 h1:ervycSGqlKnBv7putFyRjOmqVz6OVCwmWqB5g6JCbFc=
github.com/ledgerwatch/erigon-lib v0.0.0-20230224131753-91fcc7da8185/go.mod h1:y9a/PjMYVygqnGHD4mmaBePuI5P7kgtVnfiOuc2c1pU=
github.com/ledgerwatch/erigon-lib v0.0.0-20230225062945-eaec91fff52d h1:uyYQTzuOcZwsikyVasKBI9XLpLhPE2UmXbIpPpDW5YY=
github.com/ledgerwatch/erigon-lib v0.0.0-20230225062945-eaec91fff52d/go.mod h1:y9a/PjMYVygqnGHD4mmaBePuI5P7kgtVnfiOuc2c1pU=
github.com/ledgerwatch/erigon-snapshot v1.1.1-0.20230224032817-e29f5ad218a2 h1:Vf5oUCq9s4JSLd5/WJxq8zTuMY5Brn8So0yeJDvUauc=
github.com/ledgerwatch/erigon-snapshot v1.1.1-0.20230224032817-e29f5ad218a2/go.mod h1:3AuPxZc85jkehh/HA9h8gabv5MSi3kb/ddtzBsTVJFo=
github.com/ledgerwatch/log/v3 v3.7.0 h1:aFPEZdwZx4jzA3+/Pf8wNDN5tCI0cIolq/kfvgcM+og=