Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
Formatting go files.
Browse files Browse the repository at this point in the history
  • Loading branch information
miha-stopar committed Oct 10, 2023
1 parent 750b00d commit b3e1f3f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
16 changes: 8 additions & 8 deletions mpt-witness-generator/state/statedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -457,26 +457,26 @@ func (s *StateDB) SetStateObjectIfExists(addr common.Address) {
}

/*
When an account that does not exist is tried to be fetched by PrefetchAccount and when the some other account
exist at the overlapping address (the beginning of it), this (wrong) account is obtained by PrefetchAccount
and needs to be ignored.
When an account that does not exist is tried to be fetched by PrefetchAccount and when the some other account
exist at the overlapping address (the beginning of it), this (wrong) account is obtained by PrefetchAccount
and needs to be ignored.
*/
isExpectedAddress := func() bool {
address_hash := crypto.Keccak256Hash(addr.Bytes())
len_address_remaining := ret[2] - 128
if ret[3] != 32 {
nibble := address_hash[32 - len_address_remaining] % 16
if ret[3] - 48 != nibble {
nibble := address_hash[32-len_address_remaining] % 16
if ret[3]-48 != nibble {
return false
}
}
for i := 0; i < int(len_address_remaining - 1); i++ {
if address_hash[32 - int(len_address_remaining) + 1 + i] != ret[4 + i] {
for i := 0; i < int(len_address_remaining-1); i++ {
if address_hash[32-int(len_address_remaining)+1+i] != ret[4+i] {
return false
}
}
return true
}
}
if isExpectedAddress() {
s.SetStateObjectFromEncoding(addr, ret)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2290,7 +2290,7 @@ func TestTrieDoesNotExistShortVal(t *testing.T) {
Value: val1,
Address: addr,
}

trieModifications := []TrieModification{trieMod1}

prepareWitness("TrieDoesNotExistShortVal", trieModifications, statedb)
Expand Down Expand Up @@ -2318,7 +2318,7 @@ func TestTrieDoesNotExistLongVal(t *testing.T) {
Value: val1,
Address: addr,
}

trieModifications := []TrieModification{trieMod1}

prepareWitness("TrieDoesNotExistLongVal", trieModifications, statedb)
Expand Down Expand Up @@ -2355,8 +2355,8 @@ func TestWrongAccount(t *testing.T) {
Value: val1,
Address: addr,
}

trieModifications := []TrieModification{trieMod1, trieMod2, trieMod3}

prepareWitness("WrongAccount", trieModifications, statedb)
}
}

0 comments on commit b3e1f3f

Please sign in to comment.