Commit 40e7fc7b authored by Adrian Sutton's avatar Adrian Sutton Committed by GitHub

op-program: Remove caching for transition states. (#13714)

parent ca1f7773
......@@ -20,7 +20,6 @@ type CachingOracle struct {
nodes *simplelru.LRU[common.Hash, []byte]
codes *simplelru.LRU[common.Hash, []byte]
outputs *simplelru.LRU[common.Hash, eth.Output]
transitionStates *simplelru.LRU[common.Hash, *interopTypes.TransitionState]
}
func NewCachingOracle(oracle Oracle) *CachingOracle {
......@@ -28,14 +27,12 @@ func NewCachingOracle(oracle Oracle) *CachingOracle {
nodeLRU, _ := simplelru.NewLRU[common.Hash, []byte](nodeCacheSize, nil)
codeLRU, _ := simplelru.NewLRU[common.Hash, []byte](codeCacheSize, nil)
outputLRU, _ := simplelru.NewLRU[common.Hash, eth.Output](codeCacheSize, nil)
transitionStates, _ := simplelru.NewLRU[common.Hash, *interopTypes.TransitionState](codeCacheSize, nil)
return &CachingOracle{
oracle: oracle,
blocks: blockLRU,
nodes: nodeLRU,
codes: codeLRU,
outputs: outputLRU,
transitionStates: transitionStates,
}
}
......@@ -87,11 +84,6 @@ func (o *CachingOracle) BlockDataByHash(agreedBlockHash, blockHash common.Hash,
}
func (o *CachingOracle) TransitionStateByRoot(root common.Hash) *interopTypes.TransitionState {
state, ok := o.transitionStates.Get(root)
if ok {
return state
}
state = o.oracle.TransitionStateByRoot(root)
o.transitionStates.Add(root, state)
return state
// Don't bother caching as this is only requested once as part of the bootstrap process
return o.oracle.TransitionStateByRoot(root)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment