-
Notifications
You must be signed in to change notification settings - Fork 355
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
fix address range functions #316
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. tests for extra coverage would be great if you will like coding more.
Let's wait for core maintainers approval for merging.
Do not merge please. I will add some tests |
Tests added. (hope you are OK with that fact that I add |
|
Likely, some version / rules updates. |
@maurolacy there is no way to log in in circle without providing
Still no changes from |
Don't worry, we'll fix it later. |
You can always try and reproduce the CI setup / tests locally. Take a look a the cicleci config file for reference. |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some code style remarks. Mauro and Ethan know the logic better than I do.
packages/cw0/Cargo.toml
Outdated
@@ -16,3 +16,6 @@ cosmwasm-std = { version = "0.14.0" } | |||
schemars = "0.8.1" | |||
serde = { version = "1.0.103", default-features = false, features = ["derive"] } | |||
thiserror = { version = "1.0.21" } | |||
|
|||
[dev-dependencies] | |||
cw-storage-plus = { version = "0.6.1", features = ["iterator"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use a local dependency, e.g.
cw-storage-plus = { version = "0.6.1", features = ["iterator"] } | |
cw-storage-plus = { path = "../../packages/storage-plus", version = "0.6.2", features = ["iterator"] } |
packages/cw0/src/pagination.rs
Outdated
} | ||
pub fn calc_range_start(start_after: Option<Addr>) -> Option<Vec<u8>> { | ||
start_after.map(|addr| { | ||
let mut v: Vec<u8> = addr.as_ref().into(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is now .as_bytes()
which is a bit more explicit and does the same
let mut v: Vec<u8> = addr.as_ref().into(); | |
let mut v: Vec<u8> = addr.as_bytes().into(); |
packages/cw0/src/pagination.rs
Outdated
None => Ok(None), | ||
} | ||
pub fn calc_range_end(end_before: Option<Addr>) -> Option<Vec<u8>> { | ||
end_before.map(|addr| addr.as_ref().into()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
end_before.map(|addr| addr.as_ref().into()) | |
end_before.map(|addr| addr.as_bytes().into()) |
} | ||
None => Ok(None), | ||
} | ||
pub fn calc_range_start(start_after: Option<Addr>) -> Option<Vec<u8>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can only do proper / full reviews beginning next week.
Perhaps the original functions must be kept, as they can be useful for old-style ranges / storage. These new ones can also be suffixed by _addr
for clarity, but given that this is the new standard, I don't think that's really necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see now that the original argument is Addr
already so, it's OK to remove / rename these functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm.
Fix dependency section. |
The version of cosmwasm-std is not up to date anymore. Your branch has 0.14. Could you update this PR to the latest main state? |
Signed-off-by: Stanislav Pirx <stanislav.pirx@gmail.com>
Signed-off-by: Stanislav Pirx <stanislav.pirx@gmail.com>
Signed-off-by: Stanislav Pirx <stanislav.pirx@gmail.com>
Signed-off-by: Stanislav Pirx <stanislav.pirx@gmail.com>
Signed-off-by: Stanislav Pirx <stanislav.pirx@gmail.com>
b833b61
to
0509cc7
Compare
Done, rebase it to |
Merging |
No description provided.