Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
weiihann committed Dec 18, 2024
1 parent 41fc99c commit d591ebb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 3 additions & 1 deletion core/trie/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,9 @@ func (n *Node) Update(other *Node) error {
return fmt.Errorf("conflicting Left keys: %v != %v", n.Left, other.Left)
}

if n.Right != nil && other.Right != nil && !n.Right.Equal(emptyBitArray) && !other.Right.Equal(emptyBitArray) && !n.Right.Equal(other.Right) {
if n.Right != nil && other.Right != nil &&
!n.Right.Equal(emptyBitArray) && !other.Right.Equal(emptyBitArray) &&
!n.Right.Equal(other.Right) {
return fmt.Errorf("conflicting Right keys: %v != %v", n.Right, other.Right)
}

Expand Down
8 changes: 7 additions & 1 deletion core/trie/trie.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,13 @@ func (t *Trie) replaceLinkWithNewParent(key *BitArray, commonKey BitArray, sibli
}

// TODO(weiihann): not a good idea to couple proof verification logic with trie logic
func (t *Trie) insertOrUpdateValue(nodeKey *BitArray, node *Node, nodes []StorageNode, sibling StorageNode, siblingIsParentProof bool) error {
func (t *Trie) insertOrUpdateValue(
nodeKey *BitArray,
node *Node,
nodes []StorageNode,
sibling StorageNode,
siblingIsParentProof bool,
) error {
var commonKey BitArray
commonKey.CommonMSBs(nodeKey, sibling.key)

Expand Down
2 changes: 0 additions & 2 deletions core/trie/trie_pkg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ func TestTrieKeys(t *testing.T) {
require.NoError(t, err)

newVal := new(felt.Felt).SetUint64(12)
//nolint: dupl
t.Run("Add to left branch", func(t *testing.T) {
newKey := new(felt.Felt).SetUint64(0b101)
_, err = tempTrie.Put(newKey, newVal)
Expand All @@ -146,7 +145,6 @@ func TestTrieKeys(t *testing.T) {
assert.Equal(t, tempTrie.FeltToKey(leftKey), *parentNode.Left)
assert.Equal(t, tempTrie.FeltToKey(newKey), *parentNode.Right)
})
//nolint: dupl
t.Run("Add to right branch", func(t *testing.T) {
newKey := new(felt.Felt).SetUint64(0b110)
_, err = tempTrie.Put(newKey, newVal)
Expand Down

0 comments on commit d591ebb

Please sign in to comment.