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

Add Simple pyO3 wrapper for hyperdrive_math #553

Merged
merged 12 commits into from
Aug 12, 2023

Conversation

sentilesdal
Copy link
Contributor

A proof of concept PR to establish patterns for writing pyO3 wrappers for hyperdrive rust crates. This PR creates a wrapper for the hyperdrive_math crate, exposing the State struct and the get_spot_price method within.

@github-actions
Copy link

github-actions bot commented Aug 11, 2023

Hyperdrive Gas Benchmark

Benchmark suite Current: aa44381 Previous: 1ba3542 Deviation Status
addLiquidity: min 785 gas 785 gas 0% 🟰
addLiquidity: avg 43856 gas 43582 gas 0.6287% 🚨
addLiquidity: max 80573 gas 70544 gas 14.2167% 🚨
checkpoint: min 514 gas 514 gas 0% 🟰
checkpoint: avg 23181 gas 22776 gas 1.7782% 🚨
checkpoint: max 34040 gas 32767 gas 3.8850% 🚨
closeLong: min 852 gas 852 gas 0% 🟰
closeLong: avg 45871 gas 45659 gas 0.4643% 🚨
closeLong: max 85951 gas 85364 gas 0.6876% 🚨
closeShort: min 809 gas 809 gas 0% 🟰
closeShort: avg 42013 gas 40709 gas 3.2032% 🚨
closeShort: max 87386 gas 86896 gas 0.5639% 🚨
initialize: min 714 gas 714 gas 0% 🟰
initialize: avg 159446 gas 159390 gas 0.0351% 🚨
initialize: max 233486 gas 233486 gas 0% 🟰
openLong: min 740 gas 740 gas 0% 🟰
openLong: avg 113357 gas 112616 gas 0.6580% 🚨
openLong: max 179317 gas 179317 gas 0% 🟰
openShort: min 782 gas 782 gas 0% 🟰
openShort: avg 150915 gas 151370 gas -0.3006%
openShort: max 219062 gas 218825 gas 0.1083% 🚨
removeLiquidity: min 762 gas 762 gas 0% 🟰
removeLiquidity: avg 57374 gas 57232 gas 0.2481% 🚨
removeLiquidity: max 119610 gas 118973 gas 0.5354% 🚨

This comment was automatically generated by workflow using github-action-benchmark.

@coveralls
Copy link
Collaborator

coveralls commented Aug 11, 2023

Coverage Status

coverage: 98.278%. remained the same when pulling aa44381 on matt-hyperdrive-math-py03-wrapper into dbfaaf7 on main.

Copy link
Member

@dpaiton dpaiton left a comment

Choose a reason for hiding this comment

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

Thanks a lot for cleaning this up and adding the test!

crates/hyperdrive-math-py/src/lib.rs Show resolved Hide resolved
crates/hyperdrive-math-py/src/lib.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@jalextowle jalextowle left a comment

Choose a reason for hiding this comment

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

We need to revert a few of these changes as per my comments. Should be g2g after the next review.

@sentilesdal sentilesdal marked this pull request as ready for review August 11, 2023 20:27
Copy link
Contributor

@jalextowle jalextowle left a comment

Choose a reason for hiding this comment

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

LGTM

@sentilesdal sentilesdal enabled auto-merge (squash) August 11, 2023 23:45
@sentilesdal sentilesdal merged commit 640acc1 into main Aug 12, 2023
7 checks passed
@sentilesdal sentilesdal deleted the matt-hyperdrive-math-py03-wrapper branch August 12, 2023 00:16
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