Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NTRN-383 revision number and height in query #165

Merged
merged 15 commits into from
Mar 22, 2023

Conversation

quasisamurai
Copy link
Contributor

@quasisamurai quasisamurai commented Mar 15, 2023

@quasisamurai quasisamurai changed the base branch from main to neutron_audit_informal_17_01_2023 March 15, 2023 10:20
@quasisamurai quasisamurai marked this pull request as ready for review March 17, 2023 10:34
// to avoid nil in neutron, null in json and rust marshalling errors, here we initialize it with "default" values
// which is not equal 0 because github.com/cosmos/cosmos-sdk/codec/types skips true default values
emptyHeight := ibcclienttypes.NewHeight(1, 1)
if query.LastSubmittedResultRemoteHeight == nil {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just to use Option<u64> on sc level?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you meant Option<Height>, I believe couple of simple lines in neutron node is a bit preferable than unnecessary complications in our smart contracts, also we should init this struct anyway (in other place), even w Option

Comment on lines 258 to 261
if query.LastSubmittedResultRemoteHeight.RevisionNumber < height.GetRevisionNumber() {
return nil
} else if query.LastSubmittedResultRemoteHeight.RevisionHeight >= height.GetRevisionHeight() &&
query.LastSubmittedResultRemoteHeight.RevisionNumber == height.GetRevisionNumber() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ibcclienttypes.Height has all the necessary methods to compare two structs (LTE, GTE, etc).

@quasisamurai quasisamurai force-pushed the fix/revision-number-and-height branch from 3858936 to e01e41d Compare March 20, 2023 14:13
@quasisamurai
Copy link
Contributor Author

Talked to @swelf19, going too try smth to make it look a bit better

@quasisamurai quasisamurai force-pushed the fix/revision-number-and-height branch from 5c82cbe to 999d7d8 Compare March 21, 2023 14:54
@quasisamurai
Copy link
Contributor Author

FRESH TEST RUN

swelf19
swelf19 previously approved these changes Mar 21, 2023
pr0n00gler
pr0n00gler previously approved these changes Mar 21, 2023
@quasisamurai quasisamurai changed the base branch from neutron_audit_informal_17_01_2023 to main March 21, 2023 15:43
@quasisamurai quasisamurai dismissed stale reviews from pr0n00gler and swelf19 March 21, 2023 15:43

The base branch was changed.

@zavgorodnii zavgorodnii merged commit 3d5500d into main Mar 22, 2023
@pr0n00gler pr0n00gler deleted the fix/revision-number-and-height branch September 18, 2023 13:21
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.

4 participants