Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge develop to main #78

Merged
merged 69 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
5dfc689
DB package (#30)
cabrador Dec 22, 2023
da15acd
New alloc (#31)
cabrador Dec 25, 2023
b7957b3
Add env with tests. (#33)
cabrador Dec 25, 2023
98902eb
Add message with tests. (#34)
cabrador Dec 25, 2023
d936eb9
Add result with tests. (#35)
cabrador Dec 25, 2023
0496d12
New rlp (#37)
cabrador Dec 25, 2023
53e6233
Add string functions to new_substate (#38)
cabrador Dec 27, 2023
266b518
Create substate_db tests (#39)
cabrador Dec 27, 2023
fa7d010
Create substate Iterator divided from classic low level iterator (#40)
cabrador Dec 29, 2023
56e5d97
Update db (#41)
cabrador Jan 2, 2024
1cb3ca0
Add generic iterator (#42)
cabrador Jan 2, 2024
2f2a7c7
Add updateset iterator. (#43)
cabrador Jan 2, 2024
a8e0430
Remove Transaction type. Add block and tx number to substate type. (#44)
cabrador Jan 2, 2024
eb5c2ac
New_substate -> substate (#45)
cabrador Jan 12, 2024
7d2b77a
Change name of const (#46)
cabrador Jan 17, 2024
3ffd9c3
First wait to close all threads. Then release low level iterator. (#47)
cabrador Jan 17, 2024
ad594f6
Naming refactor
evgensheff Mar 18, 2024
b45a026
Naming refactor
evgensheff Mar 18, 2024
d35375d
unused code cleaned
evgensheff Mar 18, 2024
db9c2bc
Update README.md
evgensheff Mar 19, 2024
53d5733
Merge remote-tracking branch 'personal/refactor' into refactor
evgensheff Mar 19, 2024
279bb4e
Merge pull request #48 from evgensheff/refactor
evgensheff Mar 19, 2024
fa20756
common hash and address refactor
evgensheff Mar 20, 2024
8fc6d91
further optimizing of internal types
evgensheff Mar 20, 2024
36ae557
changed common to simple types
evgensheff Mar 20, 2024
9d33692
naming
evgensheff Mar 20, 2024
5c241c9
Update db/code_db.go
evgensheff Mar 21, 2024
dfad463
Merge pull request #50 from Fantom-foundation/refactor
evgensheff Mar 21, 2024
ee4de13
added unit tests for rlp decoding
evgensheff Mar 22, 2024
b30ec91
Rename variables back to what it was.
cabrador Mar 22, 2024
fa2cc90
Add tests for each cross encoding/decoding.
cabrador Mar 25, 2024
42e7948
Remove incorrect comment. Add data to test log.
cabrador Mar 25, 2024
a38458b
Fix Iterator (#51)
cabrador Mar 26, 2024
af84ebb
Merge branch 'develop' into eugene/decode
cabrador Mar 26, 2024
4829f5e
added rlp methods for types.Log
evgensheff Mar 26, 2024
2162a4f
refactor and debug of Decoding
evgensheff Mar 27, 2024
64afe2b
unit test fix
evgensheff Mar 27, 2024
067f5ff
Merge pull request #53 from Fantom-foundation/eugene/decode
evgensheff Mar 27, 2024
e02ea3b
Uncomment incorrectly merged code. (#54)
cabrador Mar 27, 2024
cb22995
removed go-ethereum from dependencies
evgensheff Mar 28, 2024
7f8dedd
Merge branch 'develop' into eugene/geth
evgensheff Mar 28, 2024
0f97566
removed panics and comment added
evgensheff Mar 28, 2024
4abefca
Merge pull request #55 from Fantom-foundation/eugene/geth
evgensheff Mar 28, 2024
2e4e807
Account.Code bug found and fixed. Tests are updated
evgensheff Apr 2, 2024
4dea10a
test added
evgensheff Apr 2, 2024
a7d9327
fix
evgensheff Apr 2, 2024
3327231
fix of lost data
evgensheff Apr 3, 2024
4871ed8
Add test after bug-fix
cabrador Apr 3, 2024
c30f242
Merge pull request #57 from Fantom-foundation/eugene/fix-test
evgensheff Apr 3, 2024
fd8604a
returns back RecordReplay
evgensheff Apr 4, 2024
2cd3752
Merge pull request #59 from Fantom-foundation/eugene/rr
evgensheff Apr 4, 2024
4161d4d
Fixed iterator issue and added some unit tests
evgensheff Apr 5, 2024
ab1848b
Merge pull request #61 from Fantom-foundation/eugene/fix-issue-60
evgensheff Apr 5, 2024
4a891d5
fix formatting
wsodsong Apr 9, 2024
b11389b
Merge pull request #62 from Fantom-foundation/wasuwee/fix-format
wsodsong Apr 9, 2024
da3f446
Use go 1.21 (#65)
wsodsong Apr 9, 2024
6d51459
Github actions (#36)
cabrador Apr 9, 2024
bc2f8f8
Extend address type (#67)
cabrador Apr 11, 2024
8e88c18
Add missing functions from db package. (#63)
cabrador Apr 12, 2024
255eab4
Fix baseFee nilptr dereference. (#64)
cabrador Apr 12, 2024
de1e380
Fix incorrect slice assignment (#68)
cabrador Apr 12, 2024
f5a1d46
Add missing hash functionality. (#69)
cabrador Apr 19, 2024
d646d5f
Create bloom type (#66)
cabrador Apr 19, 2024
301648e
added hash and address MarshallText() (#72)
evgensheff Apr 22, 2024
2772ef3
Sort errors (#73)
cabrador Apr 22, 2024
570203f
Allow stopping even if workers result channel is full. (#74)
cabrador Apr 22, 2024
60d9336
Create read-only factory functions for databases. (#75)
cabrador Apr 22, 2024
cc6c29f
Correctly return error. (#77)
cabrador May 20, 2024
0d28864
Open existing db (#76)
cabrador Jun 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
First wait to close all threads. Then release low level iterator. (#47)
  • Loading branch information
cabrador authored Jan 17, 2024
commit 3ffd9c34480966b6303748737eda47c98f490b70
2 changes: 1 addition & 1 deletion db/iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ func (i *iterator[T]) Value() T {

// Release the iterator and wait until all threads are closed gracefully.
func (i *iterator[T]) Release() {
i.iter.Release()
i.wg.Wait()
i.iter.Release()
}

func isNil[T comparable](arg T) bool {
Expand Down
9 changes: 9 additions & 0 deletions db/substate_db.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
gethrlp "github.com/Fantom-foundation/Substate/geth/rlp"
"github.com/Fantom-foundation/Substate/rlp"
"github.com/Fantom-foundation/Substate/substate"
"github.com/syndtr/goleveldb/leveldb"
"github.com/syndtr/goleveldb/leveldb/opt"
)

Expand Down Expand Up @@ -42,6 +43,14 @@ func NewSubstateDB(path string, o *opt.Options, wo *opt.WriteOptions, ro *opt.Re
return newSubstateDB(path, o, wo, ro)
}

func MakeDefaultSubstateDb(db *leveldb.DB) SubstateDB {
return &substateDB{&codeDB{&baseDB{backend: db}}}
}

func MakeSubstateDb(db *leveldb.DB, wo *opt.WriteOptions, ro *opt.ReadOptions) SubstateDB {
return &substateDB{&codeDB{&baseDB{backend: db, wo: wo, ro: ro}}}
}

func newSubstateDB(path string, o *opt.Options, wo *opt.WriteOptions, ro *opt.ReadOptions) (*substateDB, error) {
base, err := newCodeDB(path, o, wo, ro)
if err != nil {
Expand Down
8 changes: 2 additions & 6 deletions db/substate_iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (i *substateIterator) decode(data rawEntry) (*substate.Substate, error) {

func (i *substateIterator) start(numWorkers int) {
// Create channels
errCh := make(chan error)
errCh := make(chan error, numWorkers)
rawDataChs := make([]chan rawEntry, numWorkers)
resultChs := make([]chan *substate.Substate, numWorkers)

Expand All @@ -61,11 +61,7 @@ func (i *substateIterator) start(numWorkers int) {
i.wg.Done()
}()
step := 0
for {
if !i.iter.Next() {
return
}

for i.iter.Next() {
key := make([]byte, len(i.iter.Key()))
copy(key, i.iter.Key())
value := make([]byte, len(i.iter.Value()))
Expand Down
38 changes: 12 additions & 26 deletions rlp/rlp.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,41 +28,27 @@ type RLP struct {
func Decode(val []byte, block uint64) (*RLP, error) {
var (
substateRLP RLP
done bool
err error
)

if IsLondonFork(block) {
err = rlp.DecodeBytes(val, &substateRLP)
if err != nil {
return nil, err
} else {
return &substateRLP, nil
}
err = rlp.DecodeBytes(val, &substateRLP)
if err == nil {
return &substateRLP, nil
}

if IsBerlinFork(block) && !done {
var berlin berlinRLP
err = rlp.DecodeBytes(val, &berlin)
if err != nil {
return nil, err
} else {
return berlin.toLondon(), nil
}
var berlin berlinRLP
err = rlp.DecodeBytes(val, &berlin)
if err == nil {
return berlin.toLondon(), nil
}

if !done {
var legacy legacyRLP
err = rlp.DecodeBytes(val, &legacy)
if err != nil {
return nil, err
} else {
return legacy.toLondon(), nil
}

var legacy legacyRLP
err = rlp.DecodeBytes(val, &legacy)
if err == nil {
return nil, err
}

return nil, err
return legacy.toLondon(), nil
}

// ToSubstate transforms every attribute of r from RLP to substate.Substate.
Expand Down
2 changes: 1 addition & 1 deletion rlp/rlp_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ type Message struct {
func (m Message) ToSubstate(getHashFunc func(codeHash common.Hash) ([]byte, error)) (*substate.Message, error) {
sm := &substate.Message{
Nonce: m.Nonce,
CheckNonce: m.CheckNonce,
CheckNonce: !m.CheckNonce, // todo find out if this is correct
GasPrice: m.GasPrice,
Gas: m.Gas,
From: m.From,
Expand Down