Add full diff objects to output (#4)
All checks were successful
Test / Run unit tests (push) Successful in 12m36s
All checks were successful
Test / Run unit tests (push) Successful in 12m36s
Reviewed-on: #4
This commit is contained in:
parent
353b68c395
commit
fbcb133735
@ -10,6 +10,6 @@ Use `scripts/compare-diffs.sh` to compare outputs of `go-ethereum/statediff` and
|
|||||||
./scripts/compare-diffs.sh -d _var/ geth plugeth
|
./scripts/compare-diffs.sh -d _var/ geth plugeth
|
||||||
|
|
||||||
# Compare geth-statediff and the plugin using parallel iterators:
|
# Compare geth-statediff and the plugin using parallel iterators:
|
||||||
./scripts/compare-diffs.sh -d _var/ geth plugeth
|
./scripts/compare-diffs.sh -d _var/ geth plugeth-parallel
|
||||||
|
|
||||||
A zero exit code indicates identical outputs, modulo possible duplicate nodes.
|
A zero exit code indicates identical outputs, modulo possible duplicate nodes.
|
||||||
|
@ -70,16 +70,35 @@ func writeDiff(outputDir string, number int, diff *statediff.StateObject) {
|
|||||||
}
|
}
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
for _, item := range diff.IPLDs {
|
for _, item := range diff.IPLDs {
|
||||||
if _, err = f.WriteString("ipld," + item.CID + "\n"); err != nil {
|
s := fmt.Sprintf("ipld,%s,%x\n",
|
||||||
|
item.CID,
|
||||||
|
item.Content,
|
||||||
|
)
|
||||||
|
if _, err = f.WriteString(s); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for _, item := range diff.Nodes {
|
for _, item := range diff.Nodes {
|
||||||
if _, err = f.WriteString("state," + item.AccountWrapper.CID + "\n"); err != nil {
|
s := fmt.Sprintf("state,%s,%x,%t,%v,%v,%s,%x\n",
|
||||||
|
item.AccountWrapper.CID,
|
||||||
|
item.AccountWrapper.LeafKey,
|
||||||
|
item.Removed,
|
||||||
|
item.AccountWrapper.Account.Nonce,
|
||||||
|
item.AccountWrapper.Account.Balance,
|
||||||
|
item.AccountWrapper.Account.Root,
|
||||||
|
item.AccountWrapper.Account.CodeHash,
|
||||||
|
)
|
||||||
|
if _, err = f.WriteString(s); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
for _, storage := range item.StorageDiff {
|
for _, storage := range item.StorageDiff {
|
||||||
if _, err = f.WriteString("storage," + storage.CID + "\n"); err != nil {
|
s := fmt.Sprintf("storage,%s,%x,%t,%x\n",
|
||||||
|
storage.CID,
|
||||||
|
storage.LeafKey,
|
||||||
|
storage.Removed,
|
||||||
|
storage.Value,
|
||||||
|
)
|
||||||
|
if _, err = f.WriteString(s); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,15 +14,13 @@ shift $((OPTIND - 1))
|
|||||||
A=${1:-geth}
|
A=${1:-geth}
|
||||||
B=${2:-plugeth}
|
B=${2:-plugeth}
|
||||||
|
|
||||||
if [[ -n "$output_dir" ]]; then
|
if [[ -z "$output_dir" ]]; then
|
||||||
mkdir -p $output_dir
|
output_dir=$(mktemp -d)
|
||||||
A_OUTPUT="$output_dir/A"
|
|
||||||
B_OUTPUT="$output_dir/B"
|
|
||||||
else
|
|
||||||
A_OUTPUT=$(mktemp -d -t A_XXXX)
|
|
||||||
B_OUTPUT=$(mktemp -d -t B_XXXX)
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
A_OUTPUT="$output_dir/A"
|
||||||
|
B_OUTPUT="$output_dir/B"
|
||||||
|
|
||||||
./dumpdiff.$A $A_OUTPUT
|
./dumpdiff.$A $A_OUTPUT
|
||||||
./dumpdiff.$B $B_OUTPUT
|
./dumpdiff.$B $B_OUTPUT
|
||||||
|
|
||||||
@ -34,5 +32,4 @@ for file in $(ls $A_OUTPUT); do
|
|||||||
mv $tmpfile "$dir/$file"
|
mv $tmpfile "$dir/$file"
|
||||||
done
|
done
|
||||||
(set -x; diff "${A_OUTPUT}/$file" "${B_OUTPUT}/$file")
|
(set -x; diff "${A_OUTPUT}/$file" "${B_OUTPUT}/$file")
|
||||||
echo Files match: "$PLUGIN_OUTPUT/$file" "$GETH_OUTPUT/$file"
|
|
||||||
done
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user