Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
40e7fc7b
Unverified
Commit
40e7fc7b
authored
Jan 14, 2025
by
Adrian Sutton
Committed by
GitHub
Jan 14, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-program: Remove caching for transition states. (#13714)
parent
ca1f7773
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
20 deletions
+12
-20
cache.go
op-program/client/l2/cache.go
+12
-20
No files found.
op-program/client/l2/cache.go
View file @
40e7fc7b
...
@@ -15,12 +15,11 @@ const nodeCacheSize = 100_000
...
@@ -15,12 +15,11 @@ const nodeCacheSize = 100_000
const
codeCacheSize
=
10
_000
const
codeCacheSize
=
10
_000
type
CachingOracle
struct
{
type
CachingOracle
struct
{
oracle
Oracle
oracle
Oracle
blocks
*
simplelru
.
LRU
[
common
.
Hash
,
*
types
.
Block
]
blocks
*
simplelru
.
LRU
[
common
.
Hash
,
*
types
.
Block
]
nodes
*
simplelru
.
LRU
[
common
.
Hash
,
[]
byte
]
nodes
*
simplelru
.
LRU
[
common
.
Hash
,
[]
byte
]
codes
*
simplelru
.
LRU
[
common
.
Hash
,
[]
byte
]
codes
*
simplelru
.
LRU
[
common
.
Hash
,
[]
byte
]
outputs
*
simplelru
.
LRU
[
common
.
Hash
,
eth
.
Output
]
outputs
*
simplelru
.
LRU
[
common
.
Hash
,
eth
.
Output
]
transitionStates
*
simplelru
.
LRU
[
common
.
Hash
,
*
interopTypes
.
TransitionState
]
}
}
func
NewCachingOracle
(
oracle
Oracle
)
*
CachingOracle
{
func
NewCachingOracle
(
oracle
Oracle
)
*
CachingOracle
{
...
@@ -28,14 +27,12 @@ func NewCachingOracle(oracle Oracle) *CachingOracle {
...
@@ -28,14 +27,12 @@ func NewCachingOracle(oracle Oracle) *CachingOracle {
nodeLRU
,
_
:=
simplelru
.
NewLRU
[
common
.
Hash
,
[]
byte
](
nodeCacheSize
,
nil
)
nodeLRU
,
_
:=
simplelru
.
NewLRU
[
common
.
Hash
,
[]
byte
](
nodeCacheSize
,
nil
)
codeLRU
,
_
:=
simplelru
.
NewLRU
[
common
.
Hash
,
[]
byte
](
codeCacheSize
,
nil
)
codeLRU
,
_
:=
simplelru
.
NewLRU
[
common
.
Hash
,
[]
byte
](
codeCacheSize
,
nil
)
outputLRU
,
_
:=
simplelru
.
NewLRU
[
common
.
Hash
,
eth
.
Output
](
codeCacheSize
,
nil
)
outputLRU
,
_
:=
simplelru
.
NewLRU
[
common
.
Hash
,
eth
.
Output
](
codeCacheSize
,
nil
)
transitionStates
,
_
:=
simplelru
.
NewLRU
[
common
.
Hash
,
*
interopTypes
.
TransitionState
](
codeCacheSize
,
nil
)
return
&
CachingOracle
{
return
&
CachingOracle
{
oracle
:
oracle
,
oracle
:
oracle
,
blocks
:
blockLRU
,
blocks
:
blockLRU
,
nodes
:
nodeLRU
,
nodes
:
nodeLRU
,
codes
:
codeLRU
,
codes
:
codeLRU
,
outputs
:
outputLRU
,
outputs
:
outputLRU
,
transitionStates
:
transitionStates
,
}
}
}
}
...
@@ -87,11 +84,6 @@ func (o *CachingOracle) BlockDataByHash(agreedBlockHash, blockHash common.Hash,
...
@@ -87,11 +84,6 @@ func (o *CachingOracle) BlockDataByHash(agreedBlockHash, blockHash common.Hash,
}
}
func
(
o
*
CachingOracle
)
TransitionStateByRoot
(
root
common
.
Hash
)
*
interopTypes
.
TransitionState
{
func
(
o
*
CachingOracle
)
TransitionStateByRoot
(
root
common
.
Hash
)
*
interopTypes
.
TransitionState
{
state
,
ok
:=
o
.
transitionStates
.
Get
(
root
)
// Don't bother caching as this is only requested once as part of the bootstrap process
if
ok
{
return
o
.
oracle
.
TransitionStateByRoot
(
root
)
return
state
}
state
=
o
.
oracle
.
TransitionStateByRoot
(
root
)
o
.
transitionStates
.
Add
(
root
,
state
)
return
state
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment