@@ -15,27 +15,24 @@ const nodeCacheSize = 100_000
1515const codeCacheSize = 10_000
1616
1717type CachingOracle struct {
18- oracle Oracle
19- blocks * simplelru.LRU [common.Hash , * types.Block ]
20- nodes * simplelru.LRU [common.Hash , []byte ]
21- codes * simplelru.LRU [common.Hash , []byte ]
22- outputs * simplelru.LRU [common.Hash , eth.Output ]
23- transitionStates * simplelru.LRU [common.Hash , * interopTypes.TransitionState ]
18+ oracle Oracle
19+ blocks * simplelru.LRU [common.Hash , * types.Block ]
20+ nodes * simplelru.LRU [common.Hash , []byte ]
21+ codes * simplelru.LRU [common.Hash , []byte ]
22+ outputs * simplelru.LRU [common.Hash , eth.Output ]
2423}
2524
2625func NewCachingOracle (oracle Oracle ) * CachingOracle {
2726 blockLRU , _ := simplelru .NewLRU [common.Hash , * types.Block ](blockCacheSize , nil )
2827 nodeLRU , _ := simplelru .NewLRU [common.Hash , []byte ](nodeCacheSize , nil )
2928 codeLRU , _ := simplelru .NewLRU [common.Hash , []byte ](codeCacheSize , nil )
3029 outputLRU , _ := simplelru .NewLRU [common.Hash , eth.Output ](codeCacheSize , nil )
31- transitionStates , _ := simplelru .NewLRU [common.Hash , * interopTypes.TransitionState ](codeCacheSize , nil )
3230 return & CachingOracle {
33- oracle : oracle ,
34- blocks : blockLRU ,
35- nodes : nodeLRU ,
36- codes : codeLRU ,
37- outputs : outputLRU ,
38- transitionStates : transitionStates ,
31+ oracle : oracle ,
32+ blocks : blockLRU ,
33+ nodes : nodeLRU ,
34+ codes : codeLRU ,
35+ outputs : outputLRU ,
3936 }
4037}
4138
@@ -87,11 +84,6 @@ func (o *CachingOracle) BlockDataByHash(agreedBlockHash, blockHash common.Hash,
8784}
8885
8986func (o * CachingOracle ) TransitionStateByRoot (root common.Hash ) * interopTypes.TransitionState {
90- state , ok := o .transitionStates .Get (root )
91- if ok {
92- return state
93- }
94- state = o .oracle .TransitionStateByRoot (root )
95- o .transitionStates .Add (root , state )
96- return state
87+ // Don't bother caching as this is only requested once as part of the bootstrap process
88+ return o .oracle .TransitionStateByRoot (root )
9789}
0 commit comments