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

Fix next_key in table rows response #41

Open
poplexity opened this issue Oct 19, 2024 · 1 comment
Open

Fix next_key in table rows response #41

poplexity opened this issue Oct 19, 2024 · 1 comment

Comments

@poplexity
Copy link
Member

match params.lower_bound {
Some(TableIndexType::NAME(_)) => {
next_key = Some(TableIndexType::NAME(name!(next_key_str.as_str())));
}
Some(TableIndexType::UINT64(_)) => {
next_key = Some(TableIndexType::UINT64(next_key_str.parse().unwrap()));
}
Some(TableIndexType::UINT128(_)) => {
next_key = Some(TableIndexType::UINT128(next_key_str.parse().unwrap()));
}
Some(TableIndexType::CHECKSUM160(_)) => {
next_key = Some(TableIndexType::CHECKSUM160(
Checksum160::from_bytes(hex_to_bytes(&next_key_str).as_slice()).unwrap(),
));
}
Some(TableIndexType::CHECKSUM256(_)) => {
next_key = Some(TableIndexType::CHECKSUM256(
Checksum256::from_bytes(hex_to_bytes(&next_key_str).as_slice()).unwrap(),
));
}
Some(TableIndexType::FLOAT64(_)) => {
next_key = Some(TableIndexType::FLOAT64(next_key_str.parse().unwrap()));
}
None => {}

When the lower_bound is not specified in the request params, it's None, which means it defaults to the u64 of the primary key. So we should default to treating/parsing next_key as u64.

@poplexity
Copy link
Member Author

poplexity commented Oct 21, 2024

As a workaround, we've just set the lower_bound in the initial query params to be TableIndexType::UINT64(0) but this should be fixed properly.

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

No branches or pull requests

1 participant