From f94b67fe3856350d275ee267df74321d237fe651 Mon Sep 17 00:00:00 2001 From: Thomas E Lackey Date: Fri, 3 Feb 2023 23:56:01 -0600 Subject: [PATCH 1/4] More logging for statediffs. --- statediff/builder.go | 64 ++++++++++++++++--------- statediff/service.go | 4 +- statediff/test_helpers/mocks/builder.go | 4 +- 3 files changed, 47 insertions(+), 25 deletions(-) diff --git a/statediff/builder.go b/statediff/builder.go index 58cba37f4..ebde39d99 100644 --- a/statediff/builder.go +++ b/statediff/builder.go @@ -22,6 +22,7 @@ package statediff import ( "bytes" "fmt" + "time" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/state" @@ -45,7 +46,7 @@ var ( type Builder interface { BuildStateDiffObject(args Args, params Params) (types2.StateObject, error) BuildStateTrieObject(current *types.Block) (types2.StateObject, error) - WriteStateDiffObject(args types2.StateRoots, params Params, output types2.StateNodeSink, codeOutput types2.CodeSink) error + WriteStateDiffObject(args Args, params Params, output types2.StateNodeSink, codeOutput types2.CodeSink) error } type StateDiffBuilder struct { @@ -157,9 +158,7 @@ func (sdb *StateDiffBuilder) buildStateTrie(it trie.NodeIterator) ([]types2.Stat func (sdb *StateDiffBuilder) BuildStateDiffObject(args Args, params Params) (types2.StateObject, error) { var stateNodes []types2.StateNode var codeAndCodeHashes []types2.CodeAndCodeHash - err := sdb.WriteStateDiffObject( - types2.StateRoots{OldStateRoot: args.OldStateRoot, NewStateRoot: args.NewStateRoot}, - params, StateNodeAppender(&stateNodes), CodeMappingAppender(&codeAndCodeHashes)) + err := sdb.WriteStateDiffObject(args, params, StateNodeAppender(&stateNodes), CodeMappingAppender(&codeAndCodeHashes)) if err != nil { return types2.StateObject{}, err } @@ -172,7 +171,7 @@ func (sdb *StateDiffBuilder) BuildStateDiffObject(args Args, params Params) (typ } // WriteStateDiffObject writes a statediff object to output callback -func (sdb *StateDiffBuilder) WriteStateDiffObject(args types2.StateRoots, params Params, output types2.StateNodeSink, codeOutput types2.CodeSink) error { +func (sdb *StateDiffBuilder) WriteStateDiffObject(args Args, params Params, output types2.StateNodeSink, codeOutput types2.CodeSink) error { // Load tries for old and new states oldTrie, err := sdb.StateCache.OpenTrie(args.OldStateRoot) if err != nil { @@ -198,19 +197,22 @@ func (sdb *StateDiffBuilder) WriteStateDiffObject(args types2.StateRoots, params }, } + logger := log.New("hash", args.BlockHash.Hex(), "number", args.BlockNumber) if !params.IntermediateStateNodes { - return sdb.BuildStateDiffWithoutIntermediateStateNodes(iterPairs, params, output, codeOutput) + return sdb.BuildStateDiffWithoutIntermediateStateNodes(iterPairs, params, output, codeOutput, logger) } else { - return sdb.BuildStateDiffWithIntermediateStateNodes(iterPairs, params, output, codeOutput) + return sdb.BuildStateDiffWithIntermediateStateNodes(iterPairs, params, output, codeOutput, logger) } } -func (sdb *StateDiffBuilder) BuildStateDiffWithIntermediateStateNodes(iterPairs []IterPair, params Params, output types2.StateNodeSink, codeOutput types2.CodeSink) error { +func (sdb *StateDiffBuilder) BuildStateDiffWithIntermediateStateNodes(iterPairs []IterPair, params Params, output types2.StateNodeSink, codeOutput types2.CodeSink, logger log.Logger) error { + start, t := time.Now(), time.Now() + defer logger.Debug(fmt.Sprintf("statediff BuildStateDiffWithIntermediateStateNodes duration=%dms", time.Since(start).Milliseconds())) // collect a slice of all the nodes that were touched and exist at B (B-A) // a map of their leafkey to all the accounts that were touched and exist at B // and a slice of all the paths for the nodes in both of the above sets diffAccountsAtB, diffPathsAtB, err := sdb.createdAndUpdatedStateWithIntermediateNodes( - iterPairs[0].Older, iterPairs[0].Newer, params.watchedAddressesLeafPaths, output) + iterPairs[0].Older, iterPairs[0].Newer, params.watchedAddressesLeafPaths, output, logger) if err != nil { return fmt.Errorf("error collecting createdAndUpdatedNodes: %v", err) } @@ -220,42 +222,48 @@ func (sdb *StateDiffBuilder) BuildStateDiffWithIntermediateStateNodes(iterPairs diffAccountsAtA, err := sdb.deletedOrUpdatedState( iterPairs[1].Older, iterPairs[1].Newer, diffAccountsAtB, diffPathsAtB, params.watchedAddressesLeafPaths, - params.IntermediateStateNodes, params.IntermediateStorageNodes, output) + params.IntermediateStateNodes, params.IntermediateStorageNodes, output, logger) if err != nil { return fmt.Errorf("error collecting deletedOrUpdatedNodes: %v", err) } // collect and sort the leafkey keys for both account mappings into a slice + t = time.Now() createKeys := trie_helpers.SortKeys(diffAccountsAtB) deleteKeys := trie_helpers.SortKeys(diffAccountsAtA) + logger.Debug(fmt.Sprintf("statediff BuildStateDiffWithIntermediateStateNodes - sorting keys duration=%dms", time.Since(t).Milliseconds())) // and then find the intersection of these keys // these are the leafkeys for the accounts which exist at both A and B but are different // this also mutates the passed in createKeys and deleteKeys, removing the intersection keys // and leaving the truly created or deleted keys in place + t = time.Now() updatedKeys := trie_helpers.FindIntersection(createKeys, deleteKeys) + logger.Debug(fmt.Sprintf("statediff BuildStateDiffWithIntermediateStateNodes - finding intersection duration=%dms", time.Since(t).Milliseconds())) // build the diff nodes for the updated accounts using the mappings at both A and B as directed by the keys found as the intersection of the two err = sdb.buildAccountUpdates( diffAccountsAtB, diffAccountsAtA, updatedKeys, - params.IntermediateStorageNodes, output) + params.IntermediateStorageNodes, output, logger) if err != nil { return fmt.Errorf("error building diff for updated accounts: %v", err) } // build the diff nodes for created accounts - err = sdb.buildAccountCreations(diffAccountsAtB, params.IntermediateStorageNodes, output, codeOutput) + err = sdb.buildAccountCreations(diffAccountsAtB, params.IntermediateStorageNodes, output, codeOutput, logger) if err != nil { return fmt.Errorf("error building diff for created accounts: %v", err) } return nil } -func (sdb *StateDiffBuilder) BuildStateDiffWithoutIntermediateStateNodes(iterPairs []IterPair, params Params, output types2.StateNodeSink, codeOutput types2.CodeSink) error { +func (sdb *StateDiffBuilder) BuildStateDiffWithoutIntermediateStateNodes(iterPairs []IterPair, params Params, output types2.StateNodeSink, codeOutput types2.CodeSink, logger log.Logger) error { + start, t := time.Now(), time.Now() + defer logger.Debug(fmt.Sprintf("statediff BuildStateDiffWithoutIntermediateStateNodes duration=%dms", time.Since(start).Milliseconds())) // collect a map of their leafkey to all the accounts that were touched and exist at B // and a slice of all the paths for the nodes in both of the above sets diffAccountsAtB, diffPathsAtB, err := sdb.createdAndUpdatedState( iterPairs[0].Older, iterPairs[0].Newer, - params.watchedAddressesLeafPaths) + params.watchedAddressesLeafPaths, logger) if err != nil { return fmt.Errorf("error collecting createdAndUpdatedNodes: %v", err) } @@ -265,30 +273,34 @@ func (sdb *StateDiffBuilder) BuildStateDiffWithoutIntermediateStateNodes(iterPai diffAccountsAtA, err := sdb.deletedOrUpdatedState( iterPairs[1].Older, iterPairs[1].Newer, diffAccountsAtB, diffPathsAtB, params.watchedAddressesLeafPaths, - params.IntermediateStateNodes, params.IntermediateStorageNodes, output) + params.IntermediateStateNodes, params.IntermediateStorageNodes, output, logger) if err != nil { return fmt.Errorf("error collecting deletedOrUpdatedNodes: %v", err) } // collect and sort the leafkeys for both account mappings into a slice + t = time.Now() createKeys := trie_helpers.SortKeys(diffAccountsAtB) deleteKeys := trie_helpers.SortKeys(diffAccountsAtA) + logger.Debug(fmt.Sprintf("statediff BuildStateDiffWithoutIntermediateStateNodes - sorting keys duration=%dms", time.Since(t).Milliseconds())) // and then find the intersection of these keys // these are the leafkeys for the accounts which exist at both A and B but are different // this also mutates the passed in createKeys and deleteKeys, removing in intersection keys // and leaving the truly created or deleted keys in place + t = time.Now() updatedKeys := trie_helpers.FindIntersection(createKeys, deleteKeys) + logger.Debug(fmt.Sprintf("statediff BuildStateDiffWithoutIntermediateStateNodes - finding intersection duration=%dms", time.Since(t).Milliseconds())) // build the diff nodes for the updated accounts using the mappings at both A and B as directed by the keys found as the intersection of the two err = sdb.buildAccountUpdates( diffAccountsAtB, diffAccountsAtA, updatedKeys, - params.IntermediateStorageNodes, output) + params.IntermediateStorageNodes, output, logger) if err != nil { return fmt.Errorf("error building diff for updated accounts: %v", err) } // build the diff nodes for created accounts - err = sdb.buildAccountCreations(diffAccountsAtB, params.IntermediateStorageNodes, output, codeOutput) + err = sdb.buildAccountCreations(diffAccountsAtB, params.IntermediateStorageNodes, output, codeOutput, logger) if err != nil { return fmt.Errorf("error building diff for created accounts: %v", err) } @@ -298,7 +310,7 @@ func (sdb *StateDiffBuilder) BuildStateDiffWithoutIntermediateStateNodes(iterPai // createdAndUpdatedState returns // a mapping of their leafkeys to all the accounts that exist in a different state at B than A // and a slice of the paths for all of the nodes included in both -func (sdb *StateDiffBuilder) createdAndUpdatedState(a, b trie.NodeIterator, watchedAddressesLeafPaths [][]byte) (types2.AccountMap, map[string]bool, error) { +func (sdb *StateDiffBuilder) createdAndUpdatedState(a, b trie.NodeIterator, watchedAddressesLeafPaths [][]byte, logger log.Logger) (types2.AccountMap, map[string]bool, error) { diffPathsAtB := make(map[string]bool) diffAccountsAtB := make(types2.AccountMap) watchingAddresses := len(watchedAddressesLeafPaths) > 0 @@ -354,7 +366,9 @@ func (sdb *StateDiffBuilder) createdAndUpdatedState(a, b trie.NodeIterator, watc // a slice of all the intermediate nodes that exist in a different state at B than A // a mapping of their leafkeys to all the accounts that exist in a different state at B than A // and a slice of the paths for all of the nodes included in both -func (sdb *StateDiffBuilder) createdAndUpdatedStateWithIntermediateNodes(a, b trie.NodeIterator, watchedAddressesLeafPaths [][]byte, output types2.StateNodeSink) (types2.AccountMap, map[string]bool, error) { +func (sdb *StateDiffBuilder) createdAndUpdatedStateWithIntermediateNodes(a, b trie.NodeIterator, watchedAddressesLeafPaths [][]byte, output types2.StateNodeSink, logger log.Logger) (types2.AccountMap, map[string]bool, error) { + start := time.Now() + defer logger.Debug(fmt.Sprintf("statediff createdAndUpdatedStateWithIntermediateNodes duration=%dms", time.Since(start).Milliseconds())) diffPathsAtB := make(map[string]bool) diffAccountsAtB := make(types2.AccountMap) watchingAddresses := len(watchedAddressesLeafPaths) > 0 @@ -420,7 +434,9 @@ func (sdb *StateDiffBuilder) createdAndUpdatedStateWithIntermediateNodes(a, b tr // deletedOrUpdatedState returns a slice of all the pathes that are emptied at B // and a mapping of their leafkeys to all the accounts that exist in a different state at A than B -func (sdb *StateDiffBuilder) deletedOrUpdatedState(a, b trie.NodeIterator, diffAccountsAtB types2.AccountMap, diffPathsAtB map[string]bool, watchedAddressesLeafPaths [][]byte, intermediateStateNodes, intermediateStorageNodes bool, output types2.StateNodeSink) (types2.AccountMap, error) { +func (sdb *StateDiffBuilder) deletedOrUpdatedState(a, b trie.NodeIterator, diffAccountsAtB types2.AccountMap, diffPathsAtB map[string]bool, watchedAddressesLeafPaths [][]byte, intermediateStateNodes, intermediateStorageNodes bool, output types2.StateNodeSink, logger log.Logger) (types2.AccountMap, error) { + start := time.Now() + defer logger.Debug(fmt.Sprintf("statediff deletedOrUpdatedState duration=%dms", time.Since(start).Milliseconds())) diffAccountAtA := make(types2.AccountMap) watchingAddresses := len(watchedAddressesLeafPaths) > 0 @@ -526,7 +542,9 @@ func (sdb *StateDiffBuilder) deletedOrUpdatedState(a, b trie.NodeIterator, diffA // to generate the statediff node objects for all of the accounts that existed at both A and B but in different states // needs to be called before building account creations and deletions as this mutates // those account maps to remove the accounts which were updated -func (sdb *StateDiffBuilder) buildAccountUpdates(creations, deletions types2.AccountMap, updatedKeys []string, intermediateStorageNodes bool, output types2.StateNodeSink) error { +func (sdb *StateDiffBuilder) buildAccountUpdates(creations, deletions types2.AccountMap, updatedKeys []string, intermediateStorageNodes bool, output types2.StateNodeSink, logger log.Logger) error { + start := time.Now() + defer logger.Debug(fmt.Sprintf("statediff buildAccountUpdates duration=%dms", time.Since(start).Milliseconds())) var err error for _, key := range updatedKeys { createdAcc := creations[key] @@ -560,7 +578,9 @@ func (sdb *StateDiffBuilder) buildAccountUpdates(creations, deletions types2.Acc // buildAccountCreations returns the statediff node objects for all the accounts that exist at B but not at A // it also returns the code and codehash for created contract accounts -func (sdb *StateDiffBuilder) buildAccountCreations(accounts types2.AccountMap, intermediateStorageNodes bool, output types2.StateNodeSink, codeOutput types2.CodeSink) error { +func (sdb *StateDiffBuilder) buildAccountCreations(accounts types2.AccountMap, intermediateStorageNodes bool, output types2.StateNodeSink, codeOutput types2.CodeSink, logger log.Logger) error { + start := time.Now() + defer logger.Debug(fmt.Sprintf("statediff buildAccountCreations duration=%dms", time.Since(start).Milliseconds())) for _, val := range accounts { diff := types2.StateNode{ NodeType: val.NodeType, diff --git a/statediff/service.go b/statediff/service.go index b5edd19fe..2847850bf 100644 --- a/statediff/service.go +++ b/statediff/service.go @@ -867,9 +867,11 @@ func (sds *Service) writeStateDiff(block *types.Block, parentRoot common.Hash, p return sds.indexer.PushCodeAndCodeHash(tx, c) } - err = sds.Builder.WriteStateDiffObject(types2.StateRoots{ + err = sds.Builder.WriteStateDiffObject(Args{ NewStateRoot: block.Root(), OldStateRoot: parentRoot, + BlockHash: block.Hash(), + BlockNumber: block.Number(), }, params, output, codeOutput) // TODO this anti-pattern needs to be sorted out eventually if err := tx.Submit(err); err != nil { diff --git a/statediff/test_helpers/mocks/builder.go b/statediff/test_helpers/mocks/builder.go index e2452301a..ba0b154cf 100644 --- a/statediff/test_helpers/mocks/builder.go +++ b/statediff/test_helpers/mocks/builder.go @@ -42,8 +42,8 @@ func (builder *Builder) BuildStateDiffObject(args statediff.Args, params statedi } // BuildStateDiffObject mock method -func (builder *Builder) WriteStateDiffObject(args sdtypes.StateRoots, params statediff.Params, output sdtypes.StateNodeSink, codeOutput sdtypes.CodeSink) error { - builder.StateRoots = args +func (builder *Builder) WriteStateDiffObject(args statediff.Args, params statediff.Params, output sdtypes.StateNodeSink, codeOutput sdtypes.CodeSink) error { + builder.StateRoots = sdtypes.StateRoots{OldStateRoot: args.OldStateRoot, NewStateRoot: args.NewStateRoot} builder.Params = params return builder.builderError -- 2.45.2 From d30183e4eddcd7478931e69d4398cde1cf3c6229 Mon Sep 17 00:00:00 2001 From: Thomas E Lackey Date: Fri, 3 Feb 2023 23:59:38 -0600 Subject: [PATCH 2/4] Add count --- statediff/builder.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/statediff/builder.go b/statediff/builder.go index ebde39d99..9df87742a 100644 --- a/statediff/builder.go +++ b/statediff/builder.go @@ -239,7 +239,9 @@ func (sdb *StateDiffBuilder) BuildStateDiffWithIntermediateStateNodes(iterPairs // and leaving the truly created or deleted keys in place t = time.Now() updatedKeys := trie_helpers.FindIntersection(createKeys, deleteKeys) - logger.Debug(fmt.Sprintf("statediff BuildStateDiffWithIntermediateStateNodes - finding intersection duration=%dms", time.Since(t).Milliseconds())) + logger.Debug(fmt.Sprintf("statediff BuildStateDiffWithIntermediateStateNodes - finding intersection count=%d duration=%dms", + len(updatedKeys), + time.Since(t).Milliseconds())) // build the diff nodes for the updated accounts using the mappings at both A and B as directed by the keys found as the intersection of the two err = sdb.buildAccountUpdates( @@ -290,7 +292,9 @@ func (sdb *StateDiffBuilder) BuildStateDiffWithoutIntermediateStateNodes(iterPai // and leaving the truly created or deleted keys in place t = time.Now() updatedKeys := trie_helpers.FindIntersection(createKeys, deleteKeys) - logger.Debug(fmt.Sprintf("statediff BuildStateDiffWithoutIntermediateStateNodes - finding intersection duration=%dms", time.Since(t).Milliseconds())) + logger.Debug(fmt.Sprintf("statediff BuildStateDiffWithoutIntermediateStateNodes - finding intersection count=%d duration=%dms", + len(updatedKeys), + time.Since(t).Milliseconds())) // build the diff nodes for the updated accounts using the mappings at both A and B as directed by the keys found as the intersection of the two err = sdb.buildAccountUpdates( -- 2.45.2 From e4f7b11ede248f41defbce61799e725117a13c8d Mon Sep 17 00:00:00 2001 From: Thomas E Lackey Date: Sat, 4 Feb 2023 00:13:19 -0600 Subject: [PATCH 3/4] Tweak logging --- statediff/builder.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/statediff/builder.go b/statediff/builder.go index 9df87742a..df3b1b8e8 100644 --- a/statediff/builder.go +++ b/statediff/builder.go @@ -207,7 +207,7 @@ func (sdb *StateDiffBuilder) WriteStateDiffObject(args Args, params Params, outp func (sdb *StateDiffBuilder) BuildStateDiffWithIntermediateStateNodes(iterPairs []IterPair, params Params, output types2.StateNodeSink, codeOutput types2.CodeSink, logger log.Logger) error { start, t := time.Now(), time.Now() - defer logger.Debug(fmt.Sprintf("statediff BuildStateDiffWithIntermediateStateNodes duration=%dms", time.Since(start).Milliseconds())) + defer logger.Debug(fmt.Sprintf("statediff BuildStateDiffWithIntermediateStateNodes total duration=%dms", time.Since(start).Milliseconds())) // collect a slice of all the nodes that were touched and exist at B (B-A) // a map of their leafkey to all the accounts that were touched and exist at B // and a slice of all the paths for the nodes in both of the above sets @@ -231,7 +231,7 @@ func (sdb *StateDiffBuilder) BuildStateDiffWithIntermediateStateNodes(iterPairs t = time.Now() createKeys := trie_helpers.SortKeys(diffAccountsAtB) deleteKeys := trie_helpers.SortKeys(diffAccountsAtA) - logger.Debug(fmt.Sprintf("statediff BuildStateDiffWithIntermediateStateNodes - sorting keys duration=%dms", time.Since(t).Milliseconds())) + logger.Debug(fmt.Sprintf("statediff BuildStateDiffWithIntermediateStateNodes sort duration=%dms", time.Since(t).Milliseconds())) // and then find the intersection of these keys // these are the leafkeys for the accounts which exist at both A and B but are different @@ -239,7 +239,7 @@ func (sdb *StateDiffBuilder) BuildStateDiffWithIntermediateStateNodes(iterPairs // and leaving the truly created or deleted keys in place t = time.Now() updatedKeys := trie_helpers.FindIntersection(createKeys, deleteKeys) - logger.Debug(fmt.Sprintf("statediff BuildStateDiffWithIntermediateStateNodes - finding intersection count=%d duration=%dms", + logger.Debug(fmt.Sprintf("statediff BuildStateDiffWithIntermediateStateNodes intersection count=%d duration=%dms", len(updatedKeys), time.Since(t).Milliseconds())) @@ -260,7 +260,7 @@ func (sdb *StateDiffBuilder) BuildStateDiffWithIntermediateStateNodes(iterPairs func (sdb *StateDiffBuilder) BuildStateDiffWithoutIntermediateStateNodes(iterPairs []IterPair, params Params, output types2.StateNodeSink, codeOutput types2.CodeSink, logger log.Logger) error { start, t := time.Now(), time.Now() - defer logger.Debug(fmt.Sprintf("statediff BuildStateDiffWithoutIntermediateStateNodes duration=%dms", time.Since(start).Milliseconds())) + defer logger.Debug(fmt.Sprintf("statediff BuildStateDiffWithoutIntermediateStateNodes total duration=%dms", time.Since(start).Milliseconds())) // collect a map of their leafkey to all the accounts that were touched and exist at B // and a slice of all the paths for the nodes in both of the above sets diffAccountsAtB, diffPathsAtB, err := sdb.createdAndUpdatedState( @@ -284,7 +284,7 @@ func (sdb *StateDiffBuilder) BuildStateDiffWithoutIntermediateStateNodes(iterPai t = time.Now() createKeys := trie_helpers.SortKeys(diffAccountsAtB) deleteKeys := trie_helpers.SortKeys(diffAccountsAtA) - logger.Debug(fmt.Sprintf("statediff BuildStateDiffWithoutIntermediateStateNodes - sorting keys duration=%dms", time.Since(t).Milliseconds())) + logger.Debug(fmt.Sprintf("statediff BuildStateDiffWithoutIntermediateStateNodessort sort duration=%dms", time.Since(t).Milliseconds())) // and then find the intersection of these keys // these are the leafkeys for the accounts which exist at both A and B but are different @@ -292,7 +292,7 @@ func (sdb *StateDiffBuilder) BuildStateDiffWithoutIntermediateStateNodes(iterPai // and leaving the truly created or deleted keys in place t = time.Now() updatedKeys := trie_helpers.FindIntersection(createKeys, deleteKeys) - logger.Debug(fmt.Sprintf("statediff BuildStateDiffWithoutIntermediateStateNodes - finding intersection count=%d duration=%dms", + logger.Debug(fmt.Sprintf("statediff BuildStateDiffWithoutIntermediateStateNodes intersection count=%d duration=%dms", len(updatedKeys), time.Since(t).Milliseconds())) -- 2.45.2 From 7e205659cc9332d28884aab911a1ad60acfb1ce0 Mon Sep 17 00:00:00 2001 From: Thomas E Lackey Date: Sat, 4 Feb 2023 10:06:07 -0600 Subject: [PATCH 4/4] lint --- statediff/builder.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/statediff/builder.go b/statediff/builder.go index df3b1b8e8..04a7ff00e 100644 --- a/statediff/builder.go +++ b/statediff/builder.go @@ -206,7 +206,7 @@ func (sdb *StateDiffBuilder) WriteStateDiffObject(args Args, params Params, outp } func (sdb *StateDiffBuilder) BuildStateDiffWithIntermediateStateNodes(iterPairs []IterPair, params Params, output types2.StateNodeSink, codeOutput types2.CodeSink, logger log.Logger) error { - start, t := time.Now(), time.Now() + start := time.Now() defer logger.Debug(fmt.Sprintf("statediff BuildStateDiffWithIntermediateStateNodes total duration=%dms", time.Since(start).Milliseconds())) // collect a slice of all the nodes that were touched and exist at B (B-A) // a map of their leafkey to all the accounts that were touched and exist at B @@ -228,7 +228,7 @@ func (sdb *StateDiffBuilder) BuildStateDiffWithIntermediateStateNodes(iterPairs } // collect and sort the leafkey keys for both account mappings into a slice - t = time.Now() + t := time.Now() createKeys := trie_helpers.SortKeys(diffAccountsAtB) deleteKeys := trie_helpers.SortKeys(diffAccountsAtA) logger.Debug(fmt.Sprintf("statediff BuildStateDiffWithIntermediateStateNodes sort duration=%dms", time.Since(t).Milliseconds())) @@ -259,7 +259,7 @@ func (sdb *StateDiffBuilder) BuildStateDiffWithIntermediateStateNodes(iterPairs } func (sdb *StateDiffBuilder) BuildStateDiffWithoutIntermediateStateNodes(iterPairs []IterPair, params Params, output types2.StateNodeSink, codeOutput types2.CodeSink, logger log.Logger) error { - start, t := time.Now(), time.Now() + start := time.Now() defer logger.Debug(fmt.Sprintf("statediff BuildStateDiffWithoutIntermediateStateNodes total duration=%dms", time.Since(start).Milliseconds())) // collect a map of their leafkey to all the accounts that were touched and exist at B // and a slice of all the paths for the nodes in both of the above sets @@ -281,7 +281,7 @@ func (sdb *StateDiffBuilder) BuildStateDiffWithoutIntermediateStateNodes(iterPai } // collect and sort the leafkeys for both account mappings into a slice - t = time.Now() + t := time.Now() createKeys := trie_helpers.SortKeys(diffAccountsAtB) deleteKeys := trie_helpers.SortKeys(diffAccountsAtA) logger.Debug(fmt.Sprintf("statediff BuildStateDiffWithoutIntermediateStateNodessort sort duration=%dms", time.Since(t).Milliseconds())) -- 2.45.2