Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supply delta live tracer #29347

Merged
merged 30 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
c686e30
add BalanceChangeReason String() for better logging
ziogaschr Mar 26, 2024
a4117a8
add supply delta live tracer
ziogaschr Mar 26, 2024
55a9f40
change `[]byte` to `json.RawMessage` in test
ziogaschr Mar 26, 2024
5db2083
fix temp path on Windows by converting backslashes to slashes
ziogaschr Mar 27, 2024
bc983e2
allow test to use different file for tracer output
ziogaschr Mar 27, 2024
3a6cf0a
Revert "allow test to use different file for tracer output"
s1na Mar 27, 2024
53f6152
try alternative tempdir
s1na Mar 27, 2024
9e21e2d
use stringer to generate BalanceChangeReason String method
ziogaschr Mar 28, 2024
a6cabe1
fix failing test
ziogaschr Mar 28, 2024
df69332
make supply type private
ziogaschr Mar 28, 2024
fb0160b
make SupplyInfo private
ziogaschr Mar 28, 2024
6e7f5bc
typo interalTxsHandler->internalTxsHandler
ziogaschr Mar 28, 2024
91260a7
try a fix for “TempDir RemoveAll cleanup”
ziogaschr Mar 28, 2024
4320189
try a fix for test to pass on Windows
ziogaschr Mar 29, 2024
cba97ef
try a fix for test to pass on Windows
ziogaschr Mar 29, 2024
4708a19
fix test by closing logger file
ziogaschr Mar 29, 2024
00ef42b
add OnTerminate in Hooks which triggered on blockchain Stop
ziogaschr Mar 30, 2024
de1c41d
remove comment
ziogaschr Mar 30, 2024
200f496
Update core/blockchain.go
ziogaschr Mar 31, 2024
f65a19a
log any error during log file close
ziogaschr Mar 31, 2024
e67c3bf
refactor logging
s1na Apr 1, 2024
5ba5254
rename Hook “OnTerminate” to “OnBlockchainTerminate”
ziogaschr Apr 3, 2024
a6541d2
Merge branch 'master' into supply-delta-live-tracer
ziogaschr Apr 25, 2024
a2639b2
s/OnBlockchainTerminate/OnClose
ziogaschr Apr 25, 2024
dec5d3b
supply test compares output as JSON
ziogaschr May 30, 2024
b07ef33
change output JSON schema
ziogaschr May 30, 2024
e4a2c82
output hex values instead of numbers
ziogaschr May 30, 2024
b12c669
Merge branch 'master' into supply-delta-live-tracer
ziogaschr May 30, 2024
3ed1bd8
omitempty fields from supply tracer output
ziogaschr May 31, 2024
405ceae
keep logic of removing empty fields in a single place for tech debt
ziogaschr May 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -1171,6 +1171,10 @@ func (bc *BlockChain) Stop() {
if err := bc.triedb.Close(); err != nil {
log.Error("Failed to close trie database", "err", err)
}
// Call OnTerminate hook on Tracers if it is set.
ziogaschr marked this conversation as resolved.
Show resolved Hide resolved
if bc.vmConfig.Tracer != nil && bc.vmConfig.Tracer.OnTerminate != nil {
bc.vmConfig.Tracer.OnTerminate()
}
log.Info("Blockchain stopped")
}

Expand Down
37 changes: 37 additions & 0 deletions core/tracing/gen_balance_change_reason_stringer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions core/tracing/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ type (

// LogHook is called when a log is emitted.
LogHook = func(log *types.Log)

// TerminateHook is called when the tracer is terminated.
TerminateHook = func()
)

type Hooks struct {
Expand All @@ -163,12 +166,15 @@ type Hooks struct {
OnCodeChange CodeChangeHook
OnStorageChange StorageChangeHook
OnLog LogHook
OnTerminate TerminateHook
}

// BalanceChangeReason is used to indicate the reason for a balance change, useful
// for tracing and reporting.
type BalanceChangeReason byte

//go:generate stringer -type=BalanceChangeReason -output gen_balance_change_reason_stringer.go

const (
BalanceChangeUnspecified BalanceChangeReason = 0

Expand Down
Loading
Loading