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
c331571a
Commit
c331571a
authored
Sep 22, 2021
by
George Hotz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
state transition
parent
3ecdafb0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
9 deletions
+14
-9
database.go
minigeth/core/state/database.go
+5
-0
statedb.go
minigeth/core/state/statedb.go
+9
-9
No files found.
minigeth/core/state/database.go
View file @
c331571a
package
state
import
(
"fmt"
"math/big"
"github.com/ethereum/go-ethereum/common"
...
...
@@ -81,18 +82,22 @@ type SimpleTrie struct {
}
func
(
trie
SimpleTrie
)
Commit
(
onleaf
LeafCallback
)
(
common
.
Hash
,
error
)
{
fmt
.
Println
(
"trie.Commit"
)
return
trie
.
Root
,
nil
}
func
(
trie
SimpleTrie
)
Hash
()
common
.
Hash
{
fmt
.
Println
(
"trie.Hash"
)
return
trie
.
Root
}
func
(
trie
SimpleTrie
)
TryUpdate
(
key
,
value
[]
byte
)
error
{
fmt
.
Println
(
"trie.TryUpdate"
)
return
nil
}
func
(
trie
SimpleTrie
)
TryDelete
(
key
[]
byte
)
error
{
fmt
.
Println
(
"trie.TryDelete"
)
return
nil
}
...
...
minigeth/core/state/statedb.go
View file @
c331571a
...
...
@@ -859,14 +859,14 @@ func (s *StateDB) clearJournalAndRefund() {
// Commit writes the state to the underlying in-memory trie database.
func
(
s
*
StateDB
)
Commit
(
deleteEmptyObjects
bool
)
(
common
.
Hash
,
error
)
{
/*
if s.dbErr != nil {
if
s
.
dbErr
!=
nil
{
return
common
.
Hash
{},
fmt
.
Errorf
(
"commit aborted due to earlier error: %v"
,
s
.
dbErr
)
}
// Finalize any pending changes and merge everything into the tries
s
.
IntermediateRoot
(
deleteEmptyObjects
)
// Commit objects to the trie, measuring the elapsed time
codeWriter := s.db.TrieDB().DiskDB().NewBatch()
/*
codeWriter := s.db.TrieDB().DiskDB().NewBatch()
for addr := range s.stateObjectsDirty {
if obj := s.stateObjects[addr]; !obj.deleted {
// Write any contract code associated with the state object
...
...
@@ -887,7 +887,8 @@ func (s *StateDB) Commit(deleteEmptyObjects bool) (common.Hash, error) {
if err := codeWriter.Write(); err != nil {
log.Crit("Failed to commit dirty codes", "error", err)
}
}
}*/
// Write the account trie changes, measuing the amount of wasted time
var
start
time
.
Time
if
metrics
.
EnabledExpensive
{
...
...
@@ -900,16 +901,16 @@ func (s *StateDB) Commit(deleteEmptyObjects bool) (common.Hash, error) {
if
err
:=
rlp
.
DecodeBytes
(
leaf
,
&
account
);
err
!=
nil
{
return
nil
}
if account.Root != emptyRoot {
/*
if account.Root != emptyRoot {
s.db.TrieDB().Reference(account.Root, parent)
}
}
*/
return
nil
})
if
metrics
.
EnabledExpensive
{
s
.
AccountCommits
+=
time
.
Since
(
start
)
}
// If snapshotting is enabled, update the snapshot tree with this new version
if s.snap != nil {
/*
if s.snap != nil {
if metrics.EnabledExpensive {
defer func(start time.Time) { s.SnapshotCommits += time.Since(start) }(time.Now())
}
...
...
@@ -927,10 +928,9 @@ func (s *StateDB) Commit(deleteEmptyObjects bool) (common.Hash, error) {
}
}
s.snap, s.snapDestructs, s.snapAccounts, s.snapStorage = nil, nil, nil, nil
}
return root, err*/
}*/
fmt
.
Println
(
"Commit doesn't work!!!"
)
return
common
.
Hash
{},
nil
return
root
,
err
}
// PrepareAccessList handles the preparatory steps for executing a state transition with
...
...
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