Skip to content

Commit

Permalink
Rebased the branch n updated address types n added comment
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkLord017 committed Sep 27, 2024
1 parent 2b738b1 commit 394539b
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions execution/proof.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ import (
"golang.org/x/crypto/sha3"
)

// Account struct to represent the account in the Merkle proof
type Account struct {
Nonce uint64
Balance *big.Int
StorageRoot [32]byte
CodeHash [32]byte
}

// EIP1186AccountProofResponse for account proof encoding
type EIP1186AccountProofResponse struct {
Nonce uint64
Expand Down Expand Up @@ -100,7 +92,8 @@ func pathsMatch(p1 []byte, s1 int, p2 []byte, s2 int) bool {
return true
}

func getRestPath(p []byte, s int) string {
// dead code
func GetRestPath(p []byte, s int) string {
var ret string
for i := s; i < len(p)*2; i++ {
n := getNibble(p, i)
Expand All @@ -113,7 +106,7 @@ func isEmptyValue(value []byte) bool {
emptyAccount := Account{

Check failure on line 106 in execution/proof.go

View workflow job for this annotation

GitHub Actions / test

undefined: Account

Check failure on line 106 in execution/proof.go

View workflow job for this annotation

GitHub Actions / build (1.22.3)

undefined: Account

Check failure on line 106 in execution/proof.go

View workflow job for this annotation

GitHub Actions / golangci-lint (/home/runner/work/selene/selene)

undefined: Account
Nonce: 0,
Balance: big.NewInt(0),
StorageRoot: [32]byte{0x56, 0xe8, 0x1f, 0x17, 0x1b, 0xcc, 0x55, 0xa6, 0xff, 0x83, 0x45, 0xe6, 0x92, 0xc0, 0xf8, 0x6e, 0x5b, 0x48, 0xe0, 0x1b, 0x99, 0x6c, 0xad, 0xc0, 0x01, 0x62, 0x2f, 0xb5, 0xe3, 0x63, 0xb4, 0x21},
StorageHash: [32]byte{0x56, 0xe8, 0x1f, 0x17, 0x1b, 0xcc, 0x55, 0xa6, 0xff, 0x83, 0x45, 0xe6, 0x92, 0xc0, 0xf8, 0x6e, 0x5b, 0x48, 0xe0, 0x1b, 0x99, 0x6c, 0xad, 0xc0, 0x01, 0x62, 0x2f, 0xb5, 0xe3, 0x63, 0xb4, 0x21},
CodeHash: [32]byte{0xc5, 0xd2, 0x46, 0x01, 0x86, 0xf7, 0x23, 0x3c, 0x92, 0x7e, 0x7d, 0xb2, 0xdc, 0xc7, 0x03, 0xc0, 0xe5, 0x00, 0xb6, 0x53, 0xca, 0x82, 0x27, 0x3b, 0x7b, 0xfa, 0xd8, 0x04, 0x5d, 0x85, 0xa4, 0x70},
}

Expand Down Expand Up @@ -177,13 +170,14 @@ func EncodeAccount(proof *EIP1186AccountProofResponse) ([]byte, error) {
account := Account{

Check failure on line 170 in execution/proof.go

View workflow job for this annotation

GitHub Actions / test

undefined: Account

Check failure on line 170 in execution/proof.go

View workflow job for this annotation

GitHub Actions / build (1.22.3)

undefined: Account

Check failure on line 170 in execution/proof.go

View workflow job for this annotation

GitHub Actions / golangci-lint (/home/runner/work/selene/selene)

undefined: Account (typecheck)
Nonce: proof.Nonce,
Balance: proof.Balance,
StorageRoot: proof.StorageHash,
StorageHash: proof.StorageHash,
CodeHash: proof.CodeHash,
}

return rlp.EncodeToBytes(account)
}

// Make a generic function for it
func min(a, b int) int {
if a < b {
return a
Expand Down

0 comments on commit 394539b

Please sign in to comment.