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
Extend address type (#67)
  • Loading branch information
cabrador authored Apr 11, 2024
commit bc2f8f8a54d79ccea1916fa1895c71498deb235d
52 changes: 50 additions & 2 deletions types/address.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,57 @@ import (
"encoding/hex"
)

const AddressLength = 20

// Address represents the 20 byte address of an Ethereum account.
type Address [20]byte
type Address [AddressLength]byte

func (a Address) String() string {
return "0x" + hex.EncodeToString(a[:])
return "0x" + hex.EncodeToString(a.Bytes())
}

func (a Address) Bytes() []byte { return a[:] }

// HexToAddress returns Address with byte values of s.
// If s is larger than len(h), s will be cropped from the left.
func HexToAddress(s string) Address { return BytesToAddress(FromHex(s)) }

// BytesToAddress returns Address with value b.
// If b is larger than len(h), b will be cropped from the left.
func BytesToAddress(b []byte) Address {
var a Address
a.SetBytes(b)
return a
}

// SetBytes sets the address to the value of b.
// If b is larger than len(a), b will be cropped from the left.
func (a *Address) SetBytes(b []byte) {
if len(b) > len(a) {
b = b[len(b)-AddressLength:]
}
copy(a[AddressLength-len(b):], b)
}

// FromHex returns the bytes represented by the hexadecimal string s.
// s may be prefixed with "0x".
func FromHex(s string) []byte {
if has0xPrefix(s) {
s = s[2:]
}
if len(s)%2 == 1 {
s = "0" + s
}
return Hex2Bytes(s)
}

// has0xPrefix validates str begins with '0x' or '0X'.
func has0xPrefix(str string) bool {
return len(str) >= 2 && str[0] == '0' && (str[1] == 'x' || str[1] == 'X')
}

// Hex2Bytes returns the bytes represented by the hexadecimal string str.
func Hex2Bytes(str string) []byte {
h, _ := hex.DecodeString(str)
return h
}
31 changes: 31 additions & 0 deletions types/types_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package types

import (
"math/big"
"testing"
)

func TestAddress_Convertation(t *testing.T) {
addrStr := "0x9c1a711a5e31a9461f6d1f662068e0a2f9edf552"
addr := HexToAddress(addrStr)

if addr.String() != addrStr {
t.Fatal("incorrect address conversion")
}
}

func TestHash_Compare(t *testing.T) {
a := big.NewInt(1)
b := big.NewInt(2)

h1 := BigToHash(a)
h2 := BigToHash(b)

if h1.Compare(h2) != -1 {
t.Fatal("incorrect comparing")
}

if h1.Uint64() != uint64(1) {
t.Fatal("incorrect uint64 conversion")
}
}