Skip to content

Conversation

@technicallyty
Copy link
Contributor

Description

Closes: #25573

Implements membership and non-membership proofs on IAVLX tree

@github-actions
Copy link
Contributor

@technicallyty your pull request is missing a changelog!

return nil, err
}
if rightNode != nil {
rightKey, err := rightNode.Key()

Check warning

Code scanning / CodeQL

Useless assignment to local variable Warning

This definition of err is never used.

Copilot Autofix

AI 4 days ago

The best way to fix this problem is to handle the potential error from rightNode.Key() similarly to how it is handled for leftNode.Key(). That is, after calling rightKey, err := rightNode.Key(), check if err != nil and return early if it's not nil. This ensures that any unexpected error is handled gracefully and won't be missed.
Specifically, update the code at line 137 by assigning both rightKey and err, then immediately test err before progressing. You do not need to change any function signatures or imports. Only this code block inside GetNonMembershipProof is changed.


Suggested changeset 1
iavlx/immutable_tree.go

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/iavlx/immutable_tree.go b/iavlx/immutable_tree.go
--- a/iavlx/immutable_tree.go
+++ b/iavlx/immutable_tree.go
@@ -135,7 +135,9 @@
 	}
 	if rightNode != nil {
 		rightKey, err := rightNode.Key()
-
+		if err != nil {
+			return nil, err
+		}
 		if rightKey != nil {
 			nonexist.Right, err = createExistenceProof(root, rightKey)
 			if err != nil {
EOF
@@ -135,7 +135,9 @@
}
if rightNode != nil {
rightKey, err := rightNode.Key()

if err != nil {
return nil, err
}
if rightKey != nil {
nonexist.Right, err = createExistenceProof(root, rightKey)
if err != nil {
Copilot is powered by AI and may make mistakes. Always verify output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

iavlx: implement ICS23 proofs

2 participants