Skip to content

Commit 29b380a

Browse files
frristiand
authored andcommitted
deps: import HAMT parallel diffing
1 parent 8170e7e commit 29b380a

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

chain/actors/adt/diff/map.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ import (
44
"context"
55

66
"github.com/filecoin-project/go-hamt-ipld/v3"
7-
adt2 "github.com/filecoin-project/lily/chain/actors/adt"
87
"github.com/filecoin-project/lotus/chain/actors/adt"
8+
9+
adt2 "github.com/filecoin-project/lily/chain/actors/adt"
910
)
1011

1112
// Hamt returns a set of changes that transform `preMap` into `curMap`. opts are applied to both `preMap` and `curMap`.
@@ -20,5 +21,5 @@ func Hamt(ctx context.Context, preMap, curMap adt2.Map, preStore, curStore adt.S
2021
return nil, err
2122
}
2223

23-
return hamt.Diff(ctx, preStore, curStore, preRoot, curRoot, hamtOpts...)
24+
return hamt.ParallelDiff(ctx, preStore, curStore, preRoot, curRoot, hamtOpts...)
2425
}

chain/indexer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ func (t *TipSetIndexer) stateChangedActors(ctx context.Context, old, new cid.Cid
603603
if newVersion == oldVersion && (newVersion != types.StateTreeVersion0 && newVersion != types.StateTreeVersion1) {
604604
span.SetAttributes(attribute.String("diff", "fast"))
605605
// TODO: replace hamt.UseTreeBitWidth and hamt.UseHashFunction with values based on network version
606-
changes, err := hamt.Diff(ctx, t.node.Store(), t.node.Store(), oldRoot, newRoot, hamt.UseTreeBitWidth(5), hamt.UseHashFunction(func(input []byte) []byte {
606+
changes, err := hamt.ParallelDiff(ctx, t.node.Store(), t.node.Store(), oldRoot, newRoot, hamt.UseTreeBitWidth(5), hamt.UseHashFunction(func(input []byte) []byte {
607607
res := sha256.Sum256(input)
608608
return res[:]
609609
}))

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ require (
1111
github.com/filecoin-project/go-amt-ipld/v2 v2.1.1-0.20201006184820-924ee87a1349 // indirect
1212
github.com/filecoin-project/go-amt-ipld/v3 v3.1.1
1313
github.com/filecoin-project/go-bitfield v0.2.4
14-
github.com/filecoin-project/go-hamt-ipld/v3 v3.1.0
14+
github.com/filecoin-project/go-hamt-ipld/v3 v3.1.1-0.20220218192134-ff52c0c24b11
1515
github.com/filecoin-project/go-jsonrpc v0.1.5
1616
github.com/filecoin-project/go-paramfetch v0.0.4
1717
github.com/filecoin-project/go-state-types v0.1.3

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,8 @@ github.com/filecoin-project/go-hamt-ipld/v2 v2.0.0/go.mod h1:7aWZdaQ1b16BVoQUYR+
347347
github.com/filecoin-project/go-hamt-ipld/v3 v3.0.1/go.mod h1:gXpNmr3oQx8l3o7qkGyDjJjYSRX7hp/FGOStdqrWyDI=
348348
github.com/filecoin-project/go-hamt-ipld/v3 v3.1.0 h1:rVVNq0x6RGQIzCo1iiJlGFm9AGIZzeifggxtKMU7zmI=
349349
github.com/filecoin-project/go-hamt-ipld/v3 v3.1.0/go.mod h1:bxmzgT8tmeVQA1/gvBwFmYdT8SOFUwB3ovSUfG1Ux0g=
350+
github.com/filecoin-project/go-hamt-ipld/v3 v3.1.1-0.20220218192134-ff52c0c24b11 h1:HfkHHvWSaFGxtfILZWIcoIIEY426NBTVPMB9N7tc/jc=
351+
github.com/filecoin-project/go-hamt-ipld/v3 v3.1.1-0.20220218192134-ff52c0c24b11/go.mod h1:7OHE1C+OZo+GlOMHKNGIU6IAOxXTx6xqDbXvhVdQ0hY=
350352
github.com/filecoin-project/go-jsonrpc v0.1.5 h1:ckxqZ09ivBAVf5CSmxxrqqNHC7PJm3GYGtYKiNQ+vGk=
351353
github.com/filecoin-project/go-jsonrpc v0.1.5/go.mod h1:XBBpuKIMaXIIzeqzO1iucq4GvbF8CxmXRFoezRh+Cx4=
352354
github.com/filecoin-project/go-multistore v0.0.3/go.mod h1:kaNqCC4IhU4B1uyr7YWFHd23TL4KM32aChS0jNkyUvQ=

0 commit comments

Comments
 (0)