-
Notifications
You must be signed in to change notification settings - Fork 26
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
Remove chia-blockchain dependency for most of chia_rs #887
base: main
Are you sure you want to change the base?
Conversation
Pull Request Test Coverage Report for Build 13772159949Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
@@ -4,7 +4,9 @@ | |||
pub const UI_ACTUAL_SPACE_CONSTANT_FACTOR: f32 = 0.78; | |||
|
|||
// TODO: Update this when new plot format releases | |||
pub fn expected_plot_size(k: u32) -> u64 { | |||
#[cfg(feature = "py-bindings")] | |||
#[pyo3::pyfunction] |
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 think you have to do #[cfg_attr(feature = "py-bindings", pyo3::pyfunction)]
instead?
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.
@matt-o-how what happened with this? Did you try it and it didn't work?
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 would suggest you have tests that attempt to overflow integers, and especially look at all as
casts and see if there's a way to truncate integers, in tests
// is necessary to store the entries in the plot. | ||
// """ | ||
|
||
expected_plot_size(k).map_err(Into::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.
I thought clippy suggested Ok(call()?)
over this. I think they do the same thing, as the ?
-operator also implicitly converts the error type
we should squash this when landing it |
// / ((1_u128 << 256) * plot_size as u128); | ||
|
||
// Ok(iters.max(1) as u64) | ||
// } |
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.
what's the story with this? Is the TODO still relevant? If we don't need it, we should probably remove it
@@ -129,3 +129,28 @@ def wrap_call(expr: str, br: Any) -> str: | |||
return f"V:{ret}" | |||
except Exception as e: | |||
return f"E:{e}" | |||
|
|||
|
|||
# TODO: more thoroughly check these new functions which use self |
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 don't quite get this comment. what does self
refer to here? the BlockRecord
?
|
||
from run_gen import DEFAULT_CONSTANTS | ||
|
||
# from chia.consensus.pos_quality import _expected_plot_size |
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.
we can probably remove these commented-out import lines now
is_overflow_block, | ||
) | ||
|
||
# from chia.util.hash import std_hash |
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.
and here
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.
are these tests copied from chia-blockchain
?
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.
yes
@@ -4,7 +4,9 @@ | |||
pub const UI_ACTUAL_SPACE_CONSTANT_FACTOR: f32 = 0.78; | |||
|
|||
// TODO: Update this when new plot format releases | |||
pub fn expected_plot_size(k: u32) -> u64 { | |||
#[cfg(feature = "py-bindings")] | |||
#[pyo3::pyfunction] |
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.
@matt-o-how what happened with this? Did you try it and it didn't work?
} | ||
|
||
fn sp_total_iters<'a>( | ||
&self, | ||
py: Python<'a>, | ||
constants: &Bound<'_, PyAny>, | ||
) -> PyResult<Bound<'a, PyAny>> { | ||
ChiaToPython::to_python(&self.sp_total_iters_impl(py, constants)?, py) | ||
ChiaToPython::to_python(&self.sp_total_iters_impl(constants)?, py) |
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.
it's not clear to me why we need these extra wrapper functions. I would expect we could have pure rust member functions and (when enabled) python wrappers that call the rust functions. This appears to add 2 layers of python wrapper around the rust functions
This PR removes imports from
test_blscache.py
and deletestest_program_fidelity.py
.It also removes the python running from
block_record.rs
by implementingpot_iterations.py
inside the class, and porting the code to a new file calledpot_iterations.rs
.There is a corresponding PR to import this code from here in chia-blockchain: Chia-Network/chia-blockchain#19197