-
Notifications
You must be signed in to change notification settings - Fork 2k
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
use rust version of SpendBundle #17430
Conversation
0a3b7ff
to
b77bbf2
Compare
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
b77bbf2
to
1fd1508
Compare
Conflicts have been resolved. A maintainer will review the pull request shortly. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
1fd1508
to
6ec00c4
Compare
Conflicts have been resolved. A maintainer will review the pull request shortly. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Conflicts have been resolved. A maintainer will review the pull request shortly. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
1 similar comment
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Conflicts have been resolved. A maintainer will review the pull request shortly. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
1 similar comment
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
71cd28e
to
a3a28c7
Compare
Conflicts have been resolved. A maintainer will review the pull request shortly. |
I'm going to take a look at wallet performance with this PR, given the recent weight proof debacle. Otherwise, looks good to me. |
Pull Request Test Coverage Report for Build 9485741536Warning: 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 |
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.
aok
Waiting on |
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.
With Rust spend bundle:
Total time: 3.2067s
Total amount: 6194000
Total coin spends: 12400000
With Python spend bundle:
Total time: 3.2434s
Total amount: 6194000
Total coin spends: 12400000
from time import monotonic
from typing import List
from chia_rs import Coin, CoinSpend, G2Element, Program, SpendBundle
from chia_rs.sized_ints import uint64
from chia_rs.sized_bytes import bytes32
from chia.util.hash import std_hash
from chia.wallet.nft_wallet.nft_puzzles import STANDARD_PUZZLE_MOD
FAKE_PUZZLE = Program.from_program(STANDARD_PUZZLE_MOD)
FAKE_PUZZLE_HASH = bytes32(b"0" * 32)
def make_spend_bundle(spend_count: int) -> SpendBundle:
coin_spends: List[CoinSpend] = []
for i in range(spend_count):
coin = Coin(std_hash(i.to_bytes(4, "big")), FAKE_PUZZLE_HASH, uint64(i))
puzzle_reveal = FAKE_PUZZLE
solution = Program.to([[51, FAKE_PUZZLE_HASH, i]])
coin_spends.append(CoinSpend(coin, puzzle_reveal, solution))
return SpendBundle(coin_spends, G2Element.generator())
def bench_spend_bundles():
initial = monotonic()
total_amount = 0
spend_count = 0
for i in range(1, 16):
start = monotonic()
spend_bundle = make_spend_bundle(i * 100)
for cs in spend_bundle.coin_spends:
spend_count += len(spend_bundle.coin_spends)
_ = spend_bundle.coin_spends
total_amount += cs.coin.amount
end = monotonic()
print(f"{i * 100} coin spends with O(n^2) loop took {end - start:.4f}s")
final = monotonic()
print(f"Total time: {final - initial:.4f}s")
print(f"Total amount: {total_amount}")
print(f"Total coin spends: {spend_count}")
if __name__ == "__main__":
bench_spend_bundles()
I don't think we need to worry about |
the streamable format of |
|
Re-removing coverage diff since Arvid overrid it earlier and a new CI run added it back. |
Purpose:
This is a step towards validating transactions in threads. The python <-> rust boundary will need to move to make the
SpendBundle
live on the rust side, to allow moving it to the worker thread and back.Current Behavior:
SpendBundle
is a python type.New Behavior:
SpendBundle
is a rust type.