File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
crates/evm/traces/src/identifier Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,19 @@ impl SignaturesCache {
108108 }
109109 }
110110
111+ /// Saves the cache to a file and returns an error if it fails.
112+ #[ instrument( target = "evm::traces" , name = "SignaturesCache::save_result" , skip( self ) ) ]
113+ pub fn save_result ( & self , path : & Path ) -> Result < ( ) > {
114+ if let Some ( parent) = path. parent ( ) {
115+ std:: fs:: create_dir_all ( parent)
116+ . map_err ( |err| eyre:: eyre!( "failed to create cache directory: {err}" ) ) ?;
117+ }
118+ fs:: write_json_file ( path, self )
119+ . map_err ( |err| eyre:: eyre!( "failed to flush signature cache: {err}" ) ) ?;
120+ trace ! ( target: "evm::traces" , "flushed signature cache" ) ;
121+ Ok ( ( ) )
122+ }
123+
111124 /// Updates the cache from an ABI.
112125 pub fn extend_from_abi ( & mut self , abi : & JsonAbi ) {
113126 self . extend ( abi. items ( ) . filter_map ( |item| match item {
You can’t perform that action at this time.
0 commit comments