@@ -72,7 +72,7 @@ use std::{
7272 io:: BufReader ,
7373 ops:: Range ,
7474 path:: PathBuf ,
75- sync:: Arc ,
75+ sync:: { Arc , OnceLock } ,
7676} ;
7777
7878mod utils;
@@ -498,7 +498,7 @@ pub struct Cheatcodes {
498498 /// Unlocked wallets used in scripts and testing of scripts.
499499 pub wallets : Option < Wallets > ,
500500 /// Signatures identifier for decoding events and functions
501- pub signatures_identifier : Option < SignaturesIdentifier > ,
501+ signatures_identifier : OnceLock < Option < SignaturesIdentifier > > ,
502502 /// Used to determine whether the broadcasted call has non-fixed gas limit.
503503 /// Holds values for (seen opcode GAS, seen opcode CALL) pair.
504504 /// If GAS opcode is followed by CALL opcode then both flags are marked true and call
@@ -558,7 +558,7 @@ impl Cheatcodes {
558558 arbitrary_storage : Default :: default ( ) ,
559559 deprecated : Default :: default ( ) ,
560560 wallets : Default :: default ( ) ,
561- signatures_identifier : SignaturesIdentifier :: new ( true ) . ok ( ) ,
561+ signatures_identifier : Default :: default ( ) ,
562562 dynamic_gas_limit_sequence : Default :: default ( ) ,
563563 }
564564 }
@@ -585,6 +585,11 @@ impl Cheatcodes {
585585 self . active_delegations . push ( authorization) ;
586586 }
587587
588+ /// Returns the signatures identifier.
589+ pub fn signatures_identifier ( & self ) -> Option < & SignaturesIdentifier > {
590+ self . signatures_identifier . get_or_init ( || SignaturesIdentifier :: new ( true ) . ok ( ) ) . as_ref ( )
591+ }
592+
588593 /// Decodes the input data and applies the cheatcode.
589594 fn apply_cheatcode (
590595 & mut self ,
0 commit comments