File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed
crates/core/src/wasm_runtime Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -138,6 +138,11 @@ impl ContractStore {
138138 let data = code. data ( ) . to_vec ( ) ;
139139 self . contract_cache
140140 . insert ( * code_hash, Arc :: new ( ContractCode :: from ( data) ) , size) ;
141+ // Wait for the cache insert to be visible. Stretto uses background threads
142+ // for inserts, and without wait() the value may not be immediately visible
143+ // to subsequent get() calls (eventual consistency). This is critical because
144+ // validate_state() needs to fetch the contract immediately after storing.
145+ let _ = self . contract_cache . wait ( ) ;
141146
142147 // save on disc
143148 let version = APIVersion :: from ( contract) ;
Original file line number Diff line number Diff line change @@ -117,6 +117,10 @@ impl DelegateStore {
117117 let code_size = data. len ( ) as i64 ;
118118 self . delegate_cache
119119 . insert ( * code_hash, delegate. code ( ) . clone ( ) . into_owned ( ) , code_size) ;
120+ // Wait for the cache insert to be visible. Stretto uses background threads
121+ // for inserts, and without wait() the value may not be immediately visible
122+ // to subsequent get() calls (eventual consistency).
123+ let _ = self . delegate_cache . wait ( ) ;
120124
121125 // save on disc
122126 let version = APIVersion :: from ( delegate. clone ( ) ) ;
You can’t perform that action at this time.
0 commit comments