Skip to content

Commit

Permalink
alter Trie interface to use caching for slots (ethereum#181)
Browse files Browse the repository at this point in the history
* alter Trie interface to use caching for slots

* fix: use a lock to protect the point cache (ethereum#185)

* use fastest non-master go-verkle version & pull trie/Verkle.go changes to use new api (ethereum#184)

* mod: update to fastest go-verkle version today

Signed-off-by: Ignacio Hagopian <[email protected]>

* trie/verkle: use new batch serialization api

Signed-off-by: Ignacio Hagopian <[email protected]>

---------

Signed-off-by: Ignacio Hagopian <[email protected]>

---------

Signed-off-by: Ignacio Hagopian <[email protected]>
Co-authored-by: Ignacio Hagopian <[email protected]>
  • Loading branch information
gballet and jsign authored Mar 19, 2023
1 parent 65b1c84 commit df102d5
Show file tree
Hide file tree
Showing 11 changed files with 116 additions and 142 deletions.
2 changes: 1 addition & 1 deletion core/chain_makers.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ func GenerateVerkleChain(config *params.ChainConfig, parent *types.Block, engine
kvs := make(map[string][]byte)
keys := statedb.Witness().Keys()
for _, key := range keys {
v, err := vtr.TryGet(key)
v, err := vtr.GetWithHashedKey(key)
if err != nil {
panic(err)
}
Expand Down
14 changes: 7 additions & 7 deletions core/state/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ type Trie interface {
// TryGet returns the value for key stored in the trie. The value bytes must
// not be modified by the caller. If a node was not found in the database, a
// trie.MissingNodeError is returned.
TryGet(key []byte) ([]byte, error)
TryGet(address, key []byte) ([]byte, error)

// TryGetAccount abstract an account read from the trie.
TryGetAccount(key []byte) (*types.StateAccount, error)
Expand All @@ -83,14 +83,14 @@ type Trie interface {
// existing value is deleted from the trie. The value bytes must not be modified
// by the caller while they are stored in the trie. If a node was not found in the
// database, a trie.MissingNodeError is returned.
TryUpdate(key, value []byte) error
TryUpdate(address, key, value []byte) error

// TryUpdateAccount abstract an account write to the trie.
TryUpdateAccount(key []byte, account *types.StateAccount) error

// TryDelete removes any existing value for key from the trie. If a node was not
// found in the database, a trie.MissingNodeError is returned.
TryDelete(key []byte) error
TryDelete(address, key []byte) error

// TryDeleteAccount abstracts an account deletion from the trie.
TryDeleteAccount(key []byte) error
Expand Down Expand Up @@ -142,7 +142,7 @@ func NewDatabaseWithConfig(db ethdb.Database, config *trie.Config) Database {
diskdb: db,
codeSizeCache: csc,
codeCache: fastcache.New(codeCacheSize),
addrToPoint: make(utils.PointCache),
addrToPoint: utils.NewPointCache(),
}
}
return &cachingDB{
Expand Down Expand Up @@ -246,7 +246,7 @@ type VerkleDB struct {

// Caches all the points that correspond to an address,
// so they are not recalculated.
addrToPoint utils.PointCache
addrToPoint *utils.PointCache
}

func (db *VerkleDB) GetTreeKeyHeader(addr []byte) *verkle.Point {
Expand All @@ -256,7 +256,7 @@ func (db *VerkleDB) GetTreeKeyHeader(addr []byte) *verkle.Point {
// OpenTrie opens the main account trie.
func (db *VerkleDB) OpenTrie(root common.Hash) (Trie, error) {
if root == (common.Hash{}) || root == emptyRoot {
return trie.NewVerkleTrie(verkle.New(), db.db, &db.addrToPoint), nil
return trie.NewVerkleTrie(verkle.New(), db.db, db.addrToPoint), nil
}
payload, err := db.DiskDB().Get(root[:])
if err != nil {
Expand All @@ -267,7 +267,7 @@ func (db *VerkleDB) OpenTrie(root common.Hash) (Trie, error) {
if err != nil {
panic(err)
}
return trie.NewVerkleTrie(r, db.db, &db.addrToPoint), err
return trie.NewVerkleTrie(r, db.db, db.addrToPoint), err
}

// OpenStorageTrie opens the storage trie of an account.
Expand Down
16 changes: 4 additions & 12 deletions core/state/state_object.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ import (
"github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/trie"
trieUtils "github.com/ethereum/go-ethereum/trie/utils"
"github.com/holiman/uint256"
)

var emptyCodeHash = crypto.Keccak256(nil)
Expand Down Expand Up @@ -227,7 +225,7 @@ func (s *stateObject) GetCommittedState(db Database, key common.Hash) common.Has
panic("verkle trees use the snapshot")
}
start := time.Now()
enc, err = s.getTrie(db).TryGet(key.Bytes())
enc, err = s.getTrie(db).TryGet(s.address[:], key.Bytes())
if metrics.EnabledExpensive {
s.db.StorageReads += time.Since(start)
}
Expand Down Expand Up @@ -343,22 +341,16 @@ func (s *stateObject) updateTrie(db Database) Trie {

var v []byte
if (value == common.Hash{}) {
if tr.IsVerkle() {
k := trieUtils.GetTreeKeyStorageSlotWithEvaluatedAddress(s.db.db.(*VerkleDB).GetTreeKeyHeader(s.address[:]), new(uint256.Int).SetBytes(key[:]))
s.setError(tr.TryDelete(k))
//s.db.db.TrieDB().DiskDB().Delete(append(s.address[:], key[:]...))
} else {
s.setError(tr.TryDelete(key[:]))
}
s.setError(tr.TryDelete(s.address[:], key[:]))
s.db.StorageDeleted += 1
} else {
// Encoding []byte cannot fail, ok to ignore the error.
v, _ = rlp.EncodeToBytes(common.TrimLeftZeroes(value[:]))
if !tr.IsVerkle() {
s.setError(tr.TryUpdate(key[:], v))
s.setError(tr.TryUpdate(s.address[:], key[:], v))
} else {
// Update the trie, with v as a value
s.setError(tr.TryUpdate(key[:], value[:]))
s.setError(tr.TryUpdate(s.address[:], key[:], value[:]))
}
s.db.StorageUpdated += 1
}
Expand Down
2 changes: 1 addition & 1 deletion core/state/trie_prefetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ func (sf *subfetcher) loop() {
if len(task) == len(common.Address{}) {
sf.trie.TryGetAccount(task)
} else {
sf.trie.TryGet(task)
sf.trie.TryGet(nil, task)
}
sf.seen[string(task)] = struct{}{}
}
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/cespare/cp v0.1.0
github.com/cloudflare/cloudflare-go v0.14.0
github.com/consensys/gnark-crypto v0.4.1-0.20210426202927-39ac3d4b3f1f
github.com/crate-crypto/go-ipa v0.0.0-20230202201618-2e6f5bfc5401
github.com/crate-crypto/go-ipa v0.0.0-20230315201338-1643fdc2ead8
github.com/davecgh/go-spew v1.1.1
github.com/deckarep/golang-set v1.8.0
github.com/docker/docker v1.6.2
Expand All @@ -23,7 +23,7 @@ require (
github.com/fjl/gencodec v0.0.0-20220412091415-8bb9e558978c
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff
github.com/gballet/go-verkle v0.0.0-20230303104313-a4243d1136b3
github.com/gballet/go-verkle v0.0.0-20230317174103-141354da6b11
github.com/go-stack/stack v1.8.0
github.com/golang-jwt/jwt/v4 v4.3.0
github.com/golang/protobuf v1.5.2
Expand Down Expand Up @@ -60,7 +60,7 @@ require (
github.com/urfave/cli/v2 v2.10.2
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/sync v0.1.0
golang.org/x/sys v0.6.0
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211
golang.org/x/text v0.3.7
Expand Down
20 changes: 6 additions & 14 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,8 @@ github.com/consensys/gnark-crypto v0.4.1-0.20210426202927-39ac3d4b3f1f/go.mod h1
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/crate-crypto/go-ipa v0.0.0-20221111143132-9aa5d42120bc h1:mtR7MuscVeP/s0/ERWA2uSr5QOrRYy1pdvZqG1USfXI=
github.com/crate-crypto/go-ipa v0.0.0-20221111143132-9aa5d42120bc/go.mod h1:gFnFS95y8HstDP6P9pPwzrxOOC5TRDkwbM+ao15ChAI=
github.com/crate-crypto/go-ipa v0.0.0-20230202201618-2e6f5bfc5401 h1:TSXRL74LZ7R2xWOI1M0mz9E56PiPKGlSw0drgR8g7CE=
github.com/crate-crypto/go-ipa v0.0.0-20230202201618-2e6f5bfc5401/go.mod h1:gFnFS95y8HstDP6P9pPwzrxOOC5TRDkwbM+ao15ChAI=
github.com/crate-crypto/go-ipa v0.0.0-20230315201338-1643fdc2ead8 h1:2EBbIwPDRqlCD2K34Eojyy0x9d3RhOuHAZfbQm508X8=
github.com/crate-crypto/go-ipa v0.0.0-20230315201338-1643fdc2ead8/go.mod h1:gzbVz57IDJgQ9rLQwfSk696JGWof8ftznEL9GoAv3NI=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4=
github.com/dave/jennifer v1.2.0/go.mod h1:fIb+770HOpJ2fmN9EPPKOqm1vMGhB+TwXKMZhrIygKg=
Expand Down Expand Up @@ -137,12 +135,8 @@ github.com/garslo/gogen v0.0.0-20170306192744-1d203ffc1f61 h1:IZqZOB2fydHte3kUgx
github.com/garslo/gogen v0.0.0-20170306192744-1d203ffc1f61/go.mod h1:Q0X6pkwTILDlzrGEckF6HKjXe48EgsY/l7K7vhY4MW8=
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI=
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww=
github.com/gballet/go-verkle v0.0.0-20221122140954-75ceda26b7db h1:YvtZfE11QEYWPjsQCyZLoZCGMsxJs9mTEbhF3MnM32Q=
github.com/gballet/go-verkle v0.0.0-20221122140954-75ceda26b7db/go.mod h1:DMDd04jjQgdynaAwbEgiRERIGpC8fDjx0+y06an7Psg=
github.com/gballet/go-verkle v0.0.0-20221129125207-513116151b28 h1:UbB7D2R1OQCkNFX+LYoo2pHZ0u5LhwR9ldUsY4ZbZqI=
github.com/gballet/go-verkle v0.0.0-20221129125207-513116151b28/go.mod h1:DMDd04jjQgdynaAwbEgiRERIGpC8fDjx0+y06an7Psg=
github.com/gballet/go-verkle v0.0.0-20230303104313-a4243d1136b3 h1:UfRrJQF6ohVQGdi3MTU/8dPnayaIR2RuulZ55gUYXIE=
github.com/gballet/go-verkle v0.0.0-20230303104313-a4243d1136b3/go.mod h1:NR+n/LUx+m5SyVTRObiuNdJ50q309MGPD0VrIMDZJuc=
github.com/gballet/go-verkle v0.0.0-20230317174103-141354da6b11 h1:x4hiQFgr1SlqR4IoAZiXLFZK4L7KbibqkORqa1fwKp8=
github.com/gballet/go-verkle v0.0.0-20230317174103-141354da6b11/go.mod h1:IyOnn1kujMWaT+wet/6Ix1BtvYwateOBy9puuWH/8sw=
github.com/getkin/kin-openapi v0.53.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4=
github.com/getkin/kin-openapi v0.61.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
Expand Down Expand Up @@ -516,8 +510,9 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand Down Expand Up @@ -558,10 +553,7 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211020174200-9d6173849985/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc=
golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.2.0 h1:ljd4t30dBnAvMZaQCevtY0xLLD0A+bRZXbgLMLU1F/A=
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
Expand Down
10 changes: 5 additions & 5 deletions light/trie.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ type odrTrie struct {
trie *trie.Trie
}

func (t *odrTrie) TryGet(key []byte) ([]byte, error) {
func (t *odrTrie) TryGet(_, key []byte) ([]byte, error) {
key = crypto.Keccak256(key)
var res []byte
err := t.do(key, func() (err error) {
Expand Down Expand Up @@ -142,25 +142,25 @@ func (t *odrTrie) TryUpdateAccount(key []byte, acc *types.StateAccount) error {
})
}

func (t *odrTrie) TryUpdate(key, value []byte) error {
func (t *odrTrie) TryUpdate(_, key, value []byte) error {
key = crypto.Keccak256(key)
return t.do(key, func() error {
return t.trie.TryUpdate(key, value)
})
}

func (t *odrTrie) TryDelete(key []byte) error {
func (t *odrTrie) TryDelete(_, key []byte) error {
key = crypto.Keccak256(key)
return t.do(key, func() error {
return t.trie.TryDelete(key)
return t.trie.TryDelete(nil, key)
})
}

// TryDeleteAccount abstracts an account deletion from the trie.
func (t *odrTrie) TryDeleteAccount(key []byte) error {
key = crypto.Keccak256(key)
return t.do(key, func() error {
return t.trie.TryDelete(key)
return t.trie.TryDelete(nil, key)
})
}

Expand Down
16 changes: 8 additions & 8 deletions trie/secure_trie.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func NewStateTrie(id *ID, db *Database) (*StateTrie, error) {
// Get returns the value for key stored in the trie.
// The value bytes must not be modified by the caller.
func (t *StateTrie) Get(key []byte) []byte {
res, err := t.TryGet(key)
res, err := t.TryGet(nil, key)
if err != nil {
log.Error("Unhandled trie error in StateTrie.Get", "err", err)
}
Expand All @@ -86,7 +86,7 @@ func (t *StateTrie) Get(key []byte) []byte {
// The value bytes must not be modified by the caller.
// If the specified node is not in the trie, nil will be returned.
// If a trie node is not found in the database, a MissingNodeError is returned.
func (t *StateTrie) TryGet(key []byte) ([]byte, error) {
func (t *StateTrie) TryGet(_, key []byte) ([]byte, error) {
return t.trie.TryGet(t.hashKey(key))
}

Expand Down Expand Up @@ -131,7 +131,7 @@ func (t *StateTrie) TryGetNode(path []byte) ([]byte, int, error) {
// The value bytes must not be modified by the caller while they are
// stored in the trie.
func (t *StateTrie) Update(key, value []byte) {
if err := t.TryUpdate(key, value); err != nil {
if err := t.TryUpdate(nil, key, value); err != nil {
log.Error("Unhandled trie error in StateTrie.Update", "err", err)
}
}
Expand All @@ -144,7 +144,7 @@ func (t *StateTrie) Update(key, value []byte) {
// stored in the trie.
//
// If a node is not found in the database, a MissingNodeError is returned.
func (t *StateTrie) TryUpdate(key, value []byte) error {
func (t *StateTrie) TryUpdate(_, key, value []byte) error {
hk := t.hashKey(key)
err := t.trie.TryUpdate(hk, value)
if err != nil {
Expand All @@ -171,25 +171,25 @@ func (t *StateTrie) TryUpdateAccount(key []byte, acc *types.StateAccount) error

// Delete removes any existing value for key from the trie.
func (t *StateTrie) Delete(key []byte) {
if err := t.TryDelete(key); err != nil {
if err := t.TryDelete(nil, key); err != nil {
log.Error("Unhandled trie error in StateTrie.Delete", "err", err)
}
}

// TryDelete removes any existing value for key from the trie.
// If the specified trie node is not in the trie, nothing will be changed.
// If a node is not found in the database, a MissingNodeError is returned.
func (t *StateTrie) TryDelete(key []byte) error {
func (t *StateTrie) TryDelete(_, key []byte) error {
hk := t.hashKey(key)
delete(t.getSecKeyCache(), string(hk))
return t.trie.TryDelete(hk)
return t.trie.TryDelete(nil, hk)
}

// TryDeleteAccount abstracts an account deletion from the trie.
func (t *StateTrie) TryDeleteAccount(key []byte) error {
hk := t.hashKey(key)
delete(t.getSecKeyCache(), string(hk))
return t.trie.TryDelete(hk)
return t.trie.TryDelete(nil, hk)
}

// GetKey returns the sha3 preimage of a hashed key that was
Expand Down
4 changes: 2 additions & 2 deletions trie/trie.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,14 +389,14 @@ func (t *Trie) insert(n node, prefix, key []byte, value node) (bool, node, error

// Delete removes any existing value for key from the trie.
func (t *Trie) Delete(key []byte) {
if err := t.TryDelete(key); err != nil {
if err := t.TryDelete(nil, key); err != nil {
log.Error("Unhandled trie error in Trie.Delete", "err", err)
}
}

// TryDelete removes any existing value for key from the trie.
// If a node was not found in the database, a MissingNodeError is returned.
func (t *Trie) TryDelete(key []byte) error {
func (t *Trie) TryDelete(_, key []byte) error {
t.unhashed++
k := keybytesToHex(key)
_, n, err := t.delete(t.root, nil, k)
Expand Down
28 changes: 22 additions & 6 deletions trie/utils/verkle.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
package utils

import (
"sync"

"github.com/crate-crypto/go-ipa/bandersnatch/fr"
"github.com/gballet/go-verkle"
"github.com/holiman/uint256"
Expand All @@ -41,19 +43,33 @@ var (
getTreePolyIndex0Point *verkle.Point
)

type PointCache map[string]*verkle.Point
type PointCache struct {
cache map[string]*verkle.Point
lock sync.RWMutex
}

func NewPointCache() *PointCache {
return &PointCache{
cache: make(map[string]*verkle.Point),
}
}

func (pc PointCache) GetTreeKeyHeader(addr []byte) *verkle.Point {
if point, ok := pc[string(addr)]; ok {
func (pc *PointCache) GetTreeKeyHeader(addr []byte) *verkle.Point {
pc.lock.RLock()
point, ok := pc.cache[string(addr)]
pc.lock.RUnlock()
if ok {
return point
}

point := EvaluateAddressPoint(addr)
pc[string(addr)] = point
point = EvaluateAddressPoint(addr)
pc.lock.Lock()
pc.cache[string(addr)] = point
pc.lock.Unlock()
return point
}

func (pc PointCache) GetTreeKeyVersionCached(addr []byte) []byte {
func (pc *PointCache) GetTreeKeyVersionCached(addr []byte) []byte {
p := pc.GetTreeKeyHeader(addr)
v := PointToHash(p, VersionLeafKey)
return v[:]
Expand Down
Loading

0 comments on commit df102d5

Please sign in to comment.