Refactor to use statediff plugin #1
2
go.mod
2
go.mod
@ -127,7 +127,7 @@ require (
|
|||||||
replace (
|
replace (
|
||||||
github.com/cerc-io/eth-iterator-utils => git.vdb.to/cerc-io/eth-iterator-utils v0.1.2
|
github.com/cerc-io/eth-iterator-utils => git.vdb.to/cerc-io/eth-iterator-utils v0.1.2
|
||||||
github.com/cerc-io/eth-testing => git.vdb.to/cerc-io/eth-testing v0.3.1
|
github.com/cerc-io/eth-testing => git.vdb.to/cerc-io/eth-testing v0.3.1
|
||||||
github.com/cerc-io/plugeth-statediff => git.vdb.to/cerc-io/plugeth-statediff v0.1.3-0.20230926121233-367349b85a3c
|
github.com/cerc-io/plugeth-statediff => git.vdb.to/cerc-io/plugeth-statediff v0.1.3-0.20230927132920-c2ceca9230b2
|
||||||
github.com/ethereum/go-ethereum => git.vdb.to/cerc-io/plugeth v0.0.0-20230808125822-691dc334fab1
|
github.com/ethereum/go-ethereum => git.vdb.to/cerc-io/plugeth v0.0.0-20230808125822-691dc334fab1
|
||||||
github.com/openrelayxyz/plugeth-utils => git.vdb.to/cerc-io/plugeth-utils v0.0.0-20230706160122-cd41de354c46
|
github.com/openrelayxyz/plugeth-utils => git.vdb.to/cerc-io/plugeth-utils v0.0.0-20230706160122-cd41de354c46
|
||||||
)
|
)
|
||||||
|
4
go.sum
4
go.sum
@ -42,8 +42,8 @@ git.vdb.to/cerc-io/eth-testing v0.3.1 h1:sPnlMev6oEgTjsW7GtUkSsjKNG/+X6P9q0izSej
|
|||||||
git.vdb.to/cerc-io/eth-testing v0.3.1/go.mod h1:qdvpc/W1xvf2MKx3rMOqvFvYaYIHG77Z1g0lwsmw0Uk=
|
git.vdb.to/cerc-io/eth-testing v0.3.1/go.mod h1:qdvpc/W1xvf2MKx3rMOqvFvYaYIHG77Z1g0lwsmw0Uk=
|
||||||
git.vdb.to/cerc-io/plugeth v0.0.0-20230808125822-691dc334fab1 h1:KLjxHwp9Zp7xhECccmJS00RiL+VwTuUGLU7qeIctg8g=
|
git.vdb.to/cerc-io/plugeth v0.0.0-20230808125822-691dc334fab1 h1:KLjxHwp9Zp7xhECccmJS00RiL+VwTuUGLU7qeIctg8g=
|
||||||
git.vdb.to/cerc-io/plugeth v0.0.0-20230808125822-691dc334fab1/go.mod h1:cYXZu70+6xmDgIgrTD81GPasv16piiAFJnKyAbwVPMU=
|
git.vdb.to/cerc-io/plugeth v0.0.0-20230808125822-691dc334fab1/go.mod h1:cYXZu70+6xmDgIgrTD81GPasv16piiAFJnKyAbwVPMU=
|
||||||
git.vdb.to/cerc-io/plugeth-statediff v0.1.3-0.20230926121233-367349b85a3c h1:PxMvSAzKSYm2hWE1+JNPZjGRTNQALJi6lna1m5C1j6Y=
|
git.vdb.to/cerc-io/plugeth-statediff v0.1.3-0.20230927132920-c2ceca9230b2 h1:ZQefRCEyA1tqTbz5TU852U4SVy5Blv+7TleasJ5G/Rc=
|
||||||
git.vdb.to/cerc-io/plugeth-statediff v0.1.3-0.20230926121233-367349b85a3c/go.mod h1:PX1bwTwZKzegQu6zYdpuJf1tHNmU0suapKOUUO2xIzs=
|
git.vdb.to/cerc-io/plugeth-statediff v0.1.3-0.20230927132920-c2ceca9230b2/go.mod h1:PX1bwTwZKzegQu6zYdpuJf1tHNmU0suapKOUUO2xIzs=
|
||||||
git.vdb.to/cerc-io/plugeth-utils v0.0.0-20230706160122-cd41de354c46 h1:KYcbbne/RXd7AuxbUd/3hgk1jPN+33k2CKiNsUsMCC0=
|
git.vdb.to/cerc-io/plugeth-utils v0.0.0-20230706160122-cd41de354c46 h1:KYcbbne/RXd7AuxbUd/3hgk1jPN+33k2CKiNsUsMCC0=
|
||||||
git.vdb.to/cerc-io/plugeth-utils v0.0.0-20230706160122-cd41de354c46/go.mod h1:VpDN61dxy64zGff05F0adujR5enD/JEdXBkTQ+PaIsQ=
|
git.vdb.to/cerc-io/plugeth-utils v0.0.0-20230706160122-cd41de354c46/go.mod h1:VpDN61dxy64zGff05F0adujR5enD/JEdXBkTQ+PaIsQ=
|
||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
|
@ -132,19 +132,13 @@ func (s *Service) CreateSnapshot(params SnapshotParams) error {
|
|||||||
return s.indexer.PushIPLD(tx, c)
|
return s.indexer.PushIPLD(tx, c)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build a diff against the zero hash (empty trie) to get a full snapshot
|
|
||||||
sdargs := statediff.Args{
|
|
||||||
NewStateRoot: header.Root,
|
|
||||||
BlockHash: header.Hash(),
|
|
||||||
BlockNumber: header.Number,
|
|
||||||
}
|
|
||||||
sdparams := statediff.Params{
|
sdparams := statediff.Params{
|
||||||
WatchedAddresses: params.WatchedAddresses,
|
WatchedAddresses: params.WatchedAddresses,
|
||||||
}
|
}
|
||||||
sdparams.ComputeWatchedAddressesLeafPaths()
|
sdparams.ComputeWatchedAddressesLeafPaths()
|
||||||
builder := statediff.NewBuilder(adapt.GethStateView(s.stateDB))
|
builder := statediff.NewBuilder(adapt.GethStateView(s.stateDB))
|
||||||
builder.SetSubtrieWorkers(params.Workers)
|
builder.SetSubtrieWorkers(params.Workers)
|
||||||
if err = builder.WriteStateDiffTracked(sdargs, sdparams, nodeSink, ipldSink, tr); err != nil {
|
if err = builder.WriteStateSnapshot(header.Root, sdparams, nodeSink, ipldSink, tr); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user