From f30168fa5285f4f389d4d25de3f041567126034d Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Wed, 27 Sep 2023 16:32:44 +0800 Subject: [PATCH] add full diff objects to output --- pkg/diff_dump.go | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/pkg/diff_dump.go b/pkg/diff_dump.go index 3b7bcc2..c02693f 100644 --- a/pkg/diff_dump.go +++ b/pkg/diff_dump.go @@ -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) } }