# EPF5 week6 In this week, mainly focus on thinking the design of data storage of trace_filter feature, here is some thoughts. ## Write the trace results 1. register a new live tracer(eg: muxTracer) 2. initialize the new live tracer with a data dir, which uses [NewFreezer](https://github.com/ethereum/go-ethereum/blob/380688c636a654becc8f114438c2a5d93d2db032/core/rawdb/freezer.go#L84) to store the rawdata of each `block`, and the trace type as a seperated table 3. also we store a field named `latest` to store the latest traced block number 4. in the hook of `OnBlockStart`, we first check if the new `ev.Block.NumberU64()` is greater than `latest`, if `<=` then call [Freezer.TruncateHead](https://github.com/ethereum/go-ethereum/blob/380688c636a654becc8f114438c2a5d93d2db032/core/rawdb/freezer.go#L277) to rewind the head first, and then update `latest` to `ev.Block.NumberU64()`, this field should be the same as `freezer.frozen` 5. generate and store the trace results in each hooks(`OnEnter`, `OnExit`, ... `OnTxEnd`), memory based or disk based? 6. after we finish the execution of a block, in the hook of `OnBlockEnd` call `tracer.GetResult()` and then marshal and write the results to freezer. ## Query the trace results > currently only implement the block number based filting 1. based on the block number to locate the freezer segment 2. iterate in the segment to return the results, maybe in streaming mode ## Questions 1. store the block trace results in memory before write into db, OOM? 2. how to build the filter indexing(eg: from/to address, function calls)