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
9b74f963
Commit
9b74f963
authored
Sep 21, 2021
by
George Hotz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
start work on oracle
parent
bf56566b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
10 deletions
+32
-10
README
minigeth/README
+3
-3
statedb.go
minigeth/core/state/statedb.go
+10
-1
main.go
minigeth/main.go
+6
-6
oracle.go
minigeth/oracle/oracle.go
+13
-0
No files found.
minigeth/README
View file @
9b74f963
...
...
@@ -19,7 +19,7 @@ type Account struct {
}
// TODO: oracle for
//
getProvedAccountBytes(blockNumber
, addr) -> rlpAccount
//
getProvedCodeBytes(blockNumber
, addr, codehash) -> []byte
//
getProvedStorage(blockNumber
, addr, root, key) -> uint256
//
GetProvedAccountBytes(blockNumber, stateRoot
, addr) -> rlpAccount
//
GetProvedCodeBytes(blockNumber, stateRoot
, addr, codehash) -> []byte
//
GetProvedStorage(blockNumber, stateRoot
, addr, root, key) -> uint256
// These functions access the backend oracle, and will assert if the proof is bad
minigeth/core/state/statedb.go
View file @
9b74f963
...
...
@@ -7,10 +7,14 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/oracle"
"github.com/ethereum/go-ethereum/rlp"
)
type
StateDB
struct
{
blockNumber
*
big
.
Int
stateRoot
common
.
Hash
// This map holds 'live' objects, which will get modified while processing a state transition.
stateObjects
map
[
common
.
Address
]
*
stateObject
...
...
@@ -18,6 +22,10 @@ type StateDB struct {
accessList
*
accessList
}
func
NewStateDB
(
header
types
.
Header
)
*
StateDB
{
return
&
StateDB
{
blockNumber
:
header
.
Number
,
stateRoot
:
header
.
Root
}
}
// AddAddressToAccessList adds the given address to the access list
func
(
s
*
StateDB
)
AddAddressToAccessList
(
addr
common
.
Address
)
{
}
...
...
@@ -242,7 +250,8 @@ func (s *StateDB) getDeletedStateObject(addr common.Address) *stateObject {
}*/
// TODO: call eth_getProof
// In a higher level, write getProvedAccountBytes(addr)
enc
:=
[]
byte
(
"12"
)
//enc := []byte("12")
enc
:=
oracle
.
GetProvedAccountBytes
(
s
.
blockNumber
,
s
.
stateRoot
,
addr
)
if
len
(
enc
)
==
0
{
return
nil
}
...
...
minigeth/main.go
View file @
9b74f963
...
...
@@ -14,12 +14,6 @@ import (
)
func
main
()
{
bc
:=
core
.
NewBlockChain
()
statedb
:=
&
state
.
StateDB
{}
vmconfig
:=
vm
.
Config
{}
processor
:=
core
.
NewStateProcessor
(
params
.
MainnetChainConfig
,
bc
,
bc
.
Engine
())
fmt
.
Println
(
"made state processor"
)
// read header
var
header
types
.
Header
{
...
...
@@ -29,6 +23,12 @@ func main() {
rlpheader
.
Decode
(
&
header
)
}
bc
:=
core
.
NewBlockChain
()
statedb
:=
state
.
NewStateDB
(
header
)
vmconfig
:=
vm
.
Config
{}
processor
:=
core
.
NewStateProcessor
(
params
.
MainnetChainConfig
,
bc
,
bc
.
Engine
())
fmt
.
Println
(
"made state processor"
)
// read txs
var
txs
[]
*
types
.
Transaction
{
...
...
minigeth/oracle/oracle.go
0 → 100644
View file @
9b74f963
package
oracle
import
(
"fmt"
"math/big"
"github.com/ethereum/go-ethereum/common"
)
func
GetProvedAccountBytes
(
blockNumber
*
big
.
Int
,
stateRoot
common
.
Hash
,
addr
common
.
Address
)
[]
byte
{
fmt
.
Println
(
"ORACLE GetProvedAccountBytes:"
,
blockNumber
,
stateRoot
,
addr
)
return
[]
byte
(
"12"
)
}
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