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

expose integers as our fixed-width integer types from chia-blockchain #379

Merged
merged 1 commit into from
Jan 31, 2024

Conversation

arvidn
Copy link
Contributor

@arvidn arvidn commented Jan 30, 2024

This is an alternative approach to #378
It uses a trait to recursively convert the rust types into python, which is better in my mind.

It's a lot simpler and robust to use a trait for this. The downside is that rust doesn't support trait specializations or negative trait bounds, so it's not possible to defer all non-covered types to a default implementation.

There does not seem to be a slow-down.

main

232.64s call     tests/test_block_record_fidelity.py::test_block_record
8.56s call     tests/test_program_fidelity.py::test_uncurry
7.17s call     tests/test_blspy_fidelity.py::test_bls
1.16s call     tests/test_program_fidelity.py::test_round_trip
0.91s call     tests/test_program_fidelity.py::test_run_program
0.42s call     tests/test_program_fidelity.py::test_tree_hash
0.20s call     tests/test_blspy_fidelity.py::test_invalid_points
0.08s call     tests/test_run_block_generator.py::test_run_block_generator_cost
0.02s call     tests/test_run_puzzle.py::test_block_834752[generator-tests/block-834752.txt-0]
0.02s call     tests/test_run_puzzle.py::test_block_834752[generator-tests/block-834752.txt-33554432]

this PR

211.67s call     tests/test_block_record_fidelity.py::test_block_record
8.60s call     tests/test_program_fidelity.py::test_uncurry
7.20s call     tests/test_blspy_fidelity.py::test_bls
1.19s call     tests/test_program_fidelity.py::test_round_trip
0.94s call     tests/test_program_fidelity.py::test_run_program
0.47s call     tests/test_program_fidelity.py::test_tree_hash
0.20s call     tests/test_blspy_fidelity.py::test_invalid_points
0.08s call     tests/test_run_block_generator.py::test_run_block_generator_cost
0.02s call     tests/test_run_puzzle.py::test_block_834752[generator-tests/block-834752-compressed.txt-33554432]
0.02s call     tests/test_run_puzzle.py::test_block_834752[generator-tests/block-834752.txt-33554432]

@arvidn arvidn requested a review from Rigidity January 30, 2024 14:20
@arvidn arvidn force-pushed the python-bindings-int-2 branch 2 times, most recently from a679508 to ea3c453 Compare January 30, 2024 14:28
Copy link

coveralls-official bot commented Jan 30, 2024

Pull Request Test Coverage Report for Build 7726793994

  • -57 of 147 (61.22%) changed or added relevant lines in 9 files are covered.
  • 8 unchanged lines in 4 files lost coverage.
  • Overall coverage decreased (-0.2%) to 84.508%

Changes Missing Coverage Covered Lines Changed/Added Lines %
chia-protocol/src/block_record.rs 31 32 96.88%
chia-protocol/src/unfinished_block.rs 0 2 0.0%
chia-protocol/src/bytes.rs 3 6 50.0%
chia_py_streamable_macro/src/lib.rs 34 37 91.89%
chia-protocol/src/chia_protocol.rs 0 6 0.0%
chia-protocol/src/fullblock.rs 0 6 0.0%
chia-protocol/src/header_block.rs 0 6 0.0%
chia-traits/src/int.rs 21 51 41.18%
Files with Coverage Reduction New Missed Lines %
chia-protocol/src/block_record.rs 1 77.37%
chia-protocol/src/unfinished_block.rs 1 32.43%
chia-protocol/src/fullblock.rs 3 16.67%
chia-protocol/src/header_block.rs 3 27.16%
Totals Coverage Status
Change from base Build 7655434740: -0.2%
Covered Lines: 11172
Relevant Lines: 13220

💛 - Coveralls

@arvidn arvidn marked this pull request as ready for review January 30, 2024 15:25
Rigidity
Rigidity previously approved these changes Jan 31, 2024
Copy link
Contributor

@Rigidity Rigidity left a comment

Choose a reason for hiding this comment

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

looks good

@arvidn arvidn merged commit 0b15101 into main Jan 31, 2024
59 checks passed
@arvidn arvidn deleted the python-bindings-int-2 branch January 31, 2024 15:00
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.

2 participants