all: fix some typos (#25551)

* Fix some typos

* Fix some mistakes

* Revert 4byte.json

* Fix an incorrect fix

* Change files to fails
This commit is contained in:
Justin Traglia
2022-08-19 09:00:21 +03:00
committed by GitHub
parent a1b8892384
commit 2c5648d891
94 changed files with 200 additions and 200 deletions
+1 -1
View File
@@ -191,7 +191,7 @@ func (h *hasher) hashData(data []byte) hashNode {
}
// proofHash is used to construct trie proofs, and returns the 'collapsed'
// node (for later RLP encoding) aswell as the hashed node -- unless the
// node (for later RLP encoding) as well as the hashed node -- unless the
// node is smaller than 32 bytes, in which case it will be returned as is.
// This method does not do anything on value- or hash-nodes.
func (h *hasher) proofHash(original node) (collapsed, hashed node) {
+16 -16
View File
@@ -205,7 +205,7 @@ func TestRangeProofWithNonExistentProof(t *testing.T) {
proof := memorydb.New()
// Short circuit if the decreased key is same with the previous key
first := decreseKey(common.CopyBytes(entries[start].k))
first := decreaseKey(common.CopyBytes(entries[start].k))
if start != 0 && bytes.Equal(first, entries[start-1].k) {
continue
}
@@ -214,7 +214,7 @@ func TestRangeProofWithNonExistentProof(t *testing.T) {
continue
}
// Short circuit if the increased key is same with the next key
last := increseKey(common.CopyBytes(entries[end-1].k))
last := increaseKey(common.CopyBytes(entries[end-1].k))
if end != len(entries) && bytes.Equal(last, entries[end].k) {
continue
}
@@ -274,7 +274,7 @@ func TestRangeProofWithInvalidNonExistentProof(t *testing.T) {
// Case 1
start, end := 100, 200
first := decreseKey(common.CopyBytes(entries[start].k))
first := decreaseKey(common.CopyBytes(entries[start].k))
proof := memorydb.New()
if err := trie.Prove(first, 0, proof); err != nil {
@@ -297,7 +297,7 @@ func TestRangeProofWithInvalidNonExistentProof(t *testing.T) {
// Case 2
start, end = 100, 200
last := increseKey(common.CopyBytes(entries[end-1].k))
last := increaseKey(common.CopyBytes(entries[end-1].k))
proof = memorydb.New()
if err := trie.Prove(entries[start].k, 0, proof); err != nil {
t.Fatalf("Failed to prove the first node %v", err)
@@ -343,7 +343,7 @@ func TestOneElementRangeProof(t *testing.T) {
// One element with left non-existent edge proof
start = 1000
first := decreseKey(common.CopyBytes(entries[start].k))
first := decreaseKey(common.CopyBytes(entries[start].k))
proof = memorydb.New()
if err := trie.Prove(first, 0, proof); err != nil {
t.Fatalf("Failed to prove the first node %v", err)
@@ -358,7 +358,7 @@ func TestOneElementRangeProof(t *testing.T) {
// One element with right non-existent edge proof
start = 1000
last := increseKey(common.CopyBytes(entries[start].k))
last := increaseKey(common.CopyBytes(entries[start].k))
proof = memorydb.New()
if err := trie.Prove(entries[start].k, 0, proof); err != nil {
t.Fatalf("Failed to prove the first node %v", err)
@@ -373,7 +373,7 @@ func TestOneElementRangeProof(t *testing.T) {
// One element with two non-existent edge proofs
start = 1000
first, last = decreseKey(common.CopyBytes(entries[start].k)), increseKey(common.CopyBytes(entries[start].k))
first, last = decreaseKey(common.CopyBytes(entries[start].k)), increaseKey(common.CopyBytes(entries[start].k))
proof = memorydb.New()
if err := trie.Prove(first, 0, proof); err != nil {
t.Fatalf("Failed to prove the first node %v", err)
@@ -641,9 +641,9 @@ func TestSameSideProofs(t *testing.T) {
sort.Sort(entries)
pos := 1000
first := decreseKey(common.CopyBytes(entries[pos].k))
first = decreseKey(first)
last := decreseKey(common.CopyBytes(entries[pos].k))
first := decreaseKey(common.CopyBytes(entries[pos].k))
first = decreaseKey(first)
last := decreaseKey(common.CopyBytes(entries[pos].k))
proof := memorydb.New()
if err := trie.Prove(first, 0, proof); err != nil {
@@ -657,9 +657,9 @@ func TestSameSideProofs(t *testing.T) {
t.Fatalf("Expected error, got nil")
}
first = increseKey(common.CopyBytes(entries[pos].k))
last = increseKey(common.CopyBytes(entries[pos].k))
last = increseKey(last)
first = increaseKey(common.CopyBytes(entries[pos].k))
last = increaseKey(common.CopyBytes(entries[pos].k))
last = increaseKey(last)
proof = memorydb.New()
if err := trie.Prove(first, 0, proof); err != nil {
@@ -765,7 +765,7 @@ func TestEmptyRangeProof(t *testing.T) {
}
for _, c := range cases {
proof := memorydb.New()
first := increseKey(common.CopyBytes(entries[c.pos].k))
first := increaseKey(common.CopyBytes(entries[c.pos].k))
if err := trie.Prove(first, 0, proof); err != nil {
t.Fatalf("Failed to prove the first node %v", err)
}
@@ -904,7 +904,7 @@ func mutateByte(b []byte) {
}
}
func increseKey(key []byte) []byte {
func increaseKey(key []byte) []byte {
for i := len(key) - 1; i >= 0; i-- {
key[i]++
if key[i] != 0x0 {
@@ -914,7 +914,7 @@ func increseKey(key []byte) []byte {
return key
}
func decreseKey(key []byte) []byte {
func decreaseKey(key []byte) []byte {
for i := len(key) - 1; i >= 0; i-- {
key[i]--
if key[i] != 0xff {
+1 -1
View File
@@ -121,7 +121,7 @@ func TestStateTrieConcurrency(t *testing.T) {
for i := 0; i < threads; i++ {
tries[i] = trie.Copy()
}
// Start a batch of goroutines interactng with the trie
// Start a batch of goroutines interacting with the trie
pend := new(sync.WaitGroup)
pend.Add(threads)
for i := 0; i < threads; i++ {