Add full diff objects to output #4
@ -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
|
||||
|
||||
# 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.
|
||||
|
@ -70,16 +70,35 @@ func writeDiff(outputDir string, number int, diff *statediff.StateObject) {
|
||||
}
|
||||
defer f.Close()
|
||||
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)
|
||||
}
|
||||
}
|
||||
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)
|
||||
}
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
@ -14,14 +14,12 @@ shift $((OPTIND - 1))
|
||||
A=${1:-geth}
|
||||
B=${2:-plugeth}
|
||||
|
||||
if [[ -n "$output_dir" ]]; then
|
||||
mkdir -p $output_dir
|
||||
if [[ -z "$output_dir" ]]; then
|
||||
output_dir=$(mktemp -d)
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
./dumpdiff.$A $A_OUTPUT
|
||||
./dumpdiff.$B $B_OUTPUT
|
||||
@ -34,5 +32,4 @@ for file in $(ls $A_OUTPUT); do
|
||||
mv $tmpfile "$dir/$file"
|
||||
done
|
||||
(set -x; diff "${A_OUTPUT}/$file" "${B_OUTPUT}/$file")
|
||||
echo Files match: "$PLUGIN_OUTPUT/$file" "$GETH_OUTPUT/$file"
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user