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
4da9923c
Commit
4da9923c
authored
Sep 23, 2021
by
George Hotz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oracle cache
parent
8c5d5b43
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
proved.go
minigeth/oracle/proved.go
+9
-1
No files found.
minigeth/oracle/proved.go
View file @
4da9923c
...
@@ -91,6 +91,7 @@ func unhash(addrHash common.Hash) common.Address {
...
@@ -91,6 +91,7 @@ func unhash(addrHash common.Hash) common.Address {
return
unhashMap
[
addrHash
]
return
unhashMap
[
addrHash
]
}
}
var
cached
=
make
(
map
[
string
]
bool
)
var
preimages
=
make
(
map
[
common
.
Hash
][]
byte
)
var
preimages
=
make
(
map
[
common
.
Hash
][]
byte
)
func
Preimage
(
hash
common
.
Hash
)
[]
byte
{
func
Preimage
(
hash
common
.
Hash
)
[]
byte
{
...
@@ -102,6 +103,13 @@ func Preimage(hash common.Hash) []byte {
...
@@ -102,6 +103,13 @@ func Preimage(hash common.Hash) []byte {
}
}
func
PrefetchAddress
(
blockNumber
*
big
.
Int
,
addr
common
.
Address
,
skey
common
.
Hash
)
{
func
PrefetchAddress
(
blockNumber
*
big
.
Int
,
addr
common
.
Address
,
skey
common
.
Hash
)
{
key
:=
fmt
.
Sprintf
(
"proof_%d_%s_%s"
,
blockNumber
,
addr
,
skey
)
if
cached
[
key
]
{
//fmt.Println("hit", key)
return
}
cached
[
key
]
=
true
ap
:=
GetProofAccount
(
blockNumber
,
addr
,
skey
)
ap
:=
GetProofAccount
(
blockNumber
,
addr
,
skey
)
for
_
,
s
:=
range
ap
{
for
_
,
s
:=
range
ap
{
ret
,
_
:=
hex
.
DecodeString
(
s
[
2
:
])
ret
,
_
:=
hex
.
DecodeString
(
s
[
2
:
])
...
@@ -138,7 +146,7 @@ func GetProofAccount(blockNumber *big.Int, addr common.Address, skey common.Hash
...
@@ -138,7 +146,7 @@ func GetProofAccount(blockNumber *big.Int, addr common.Address, skey common.Hash
func
GetProvedCodeBytes
(
blockNumber
*
big
.
Int
,
addrHash
common
.
Hash
,
codehash
common
.
Hash
)
[]
byte
{
func
GetProvedCodeBytes
(
blockNumber
*
big
.
Int
,
addrHash
common
.
Hash
,
codehash
common
.
Hash
)
[]
byte
{
addr
:=
unhash
(
addrHash
)
addr
:=
unhash
(
addrHash
)
fmt
.
Println
(
"ORACLE GetProvedCodeBytes:"
,
blockNumber
,
addr
,
codehash
)
//
fmt.Println("ORACLE GetProvedCodeBytes:", blockNumber, addr, codehash)
key
:=
fmt
.
Sprintf
(
"code_%s"
,
codehash
)
key
:=
fmt
.
Sprintf
(
"code_%s"
,
codehash
)
if
!
cacheExists
(
key
)
{
if
!
cacheExists
(
key
)
{
r
:=
jsonreq
{
Jsonrpc
:
"2.0"
,
Method
:
"eth_getCode"
,
Id
:
1
}
r
:=
jsonreq
{
Jsonrpc
:
"2.0"
,
Method
:
"eth_getCode"
,
Id
:
1
}
...
...
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