-
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
Add functions for multithreaded validation to the Rust side. #541
Open
matt-o-how
wants to merge
122
commits into
main
Choose a base branch
from
multithread_validation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
122 commits
Select commit
Hold shift + click to select a range
9628d74
port errors and npc_result to rust
matt-o-how b1d414e
add function bones for filling in
matt-o-how 8ec9f22
add BlockGenerator and simple_solution_generator
matt-o-how cbcd4e2
get_flags_for_height_and_constants
matt-o-how 3c8fa30
add get_name_puzzle_conditions
matt-o-how 3a7d6d5
type fixes
matt-o-how e02aa6c
more type fixes
matt-o-how f6896c9
pkm_pairs
matt-o-how 2ce2d7b
type fixes
matt-o-how 3da2738
use blscache
matt-o-how 844751d
remove references to npcresult
matt-o-how 8f8eace
minor fixes and improvements
matt-o-how 68ec039
add syncing toggle
matt-o-how 424d6e4
makes errs pub
matt-o-how 07cf8b4
commit before rebase
matt-o-how 4f6afb8
move to use ConsensusConstants and cargo fixes
matt-o-how f3be475
more cargo fixes
matt-o-how e24026c
even more cargo fixes
matt-o-how e4d518e
continued cargo work
matt-o-how 46ee479
more compilation error fixes
matt-o-how 1fe83b9
fix make_aggsig_final_message
matt-o-how cecee94
remove unnecessary clones
matt-o-how 2c12d92
yet more cargo fixes
matt-o-how 7a9f8ea
handle other opcode cases
matt-o-how d18120c
fix simple_solution_generator
matt-o-how 4949012
fmt
matt-o-how 088e834
test runs!
matt-o-how b91f098
pass test
matt-o-how dcbf2e3
fmt
matt-o-how 6467689
clippy fixes
matt-o-how c754324
pass constants as reference
matt-o-how 0fb2322
remove unnecessary clones
matt-o-how a16b487
use ? instead of match
matt-o-how 6d2a79d
another fmt
matt-o-how 4a783f0
small arvid suggestions
matt-o-how 311c860
remove BlockGenerator from get_name_puzzle_conditions
matt-o-how d023c2a
reduce clones in loop
matt-o-how 948ea39
save an allocation
matt-o-how 8ff50f0
unused import
matt-o-how 9c80a65
remove block validation function stubs
matt-o-how c5053fc
remove calls to run_block_generator in get_npc
matt-o-how c3b5d92
no longer create a generator program
matt-o-how 30003a7
clippy fixes
matt-o-how 42e4b09
use consenusconstants for additional_data instead of hashmap
matt-o-how 4399e8a
switch pkm_pairs to return an iter
matt-o-how c01bcbe
optimise via inlining pkm_pairs
matt-o-how 24ca094
fmt + clippy
matt-o-how 42b29b0
add unsafes to pkm_iter and add test for it
matt-o-how fd4a8d8
remove further clones inside iter
matt-o-how 2607c70
add aggsig_me test
matt-o-how 20cb94d
Update crates/chia-consensus/src/multiprocess_validation.rs
matt-o-how 6a54ea0
update get_flags and fix npcresult unwrap
matt-o-how 2a2f354
Use only one aggregate_verify with a (pk, msg) iter
matt-o-how a0e35df
fmt
matt-o-how 2b90681
remove useless vec cast
matt-o-how 0b5064f
remove syncing, return additions
matt-o-how d96dab2
fix cache benchmark
matt-o-how 3775939
add aggsig parent puzzle test and remove syncing and fix cache benchmark
matt-o-how a4ae257
test_validate_aggsig_parent_amount
matt-o-how d7a2d8d
add test_validate_aggsig_puzzle_amount
matt-o-how 3845a2c
add pyfunction for validate_clvm_and_signature
matt-o-how af104f6
OwnedSpendBundleConditions never fails now
matt-o-how b5cf9c2
remove NO_RELATIVE_CONDITIONS_ON_EPHEMERAL flag as it is now uncondit…
matt-o-how dc53e40
cargo and fmt fixes
matt-o-how 9f69b59
reduce allocations in make_aggsig_final_message
matt-o-how c0886f7
use hex!
matt-o-how d453405
add cache.update() and return additions as vec
matt-o-how e11152b
clippy and fmt
matt-o-how bea5393
Update crates/chia-consensus/src/multiprocess_validation.rs
matt-o-how 62d1e89
delete BlockGenerator struct
matt-o-how c6a022d
apply some of arvid's suggestions
matt-o-how fc1d307
add test to u64_to_bytes
matt-o-how 20c2775
implement more of arvid's comments
matt-o-how 38a08ff
unused import
matt-o-how 33cbfbc
remove unused pyo3 import
matt-o-how 7e84370
add pytest and type stubs
matt-o-how 1654ebf
if no cache passed in, then create one
matt-o-how d4d0c23
explicitly call conversion
matt-o-how bfc24ab
cargo fmt
matt-o-how e7297da
add costing test
matt-o-how 6ed3814
fix DedupFlags not setting properly
matt-o-how ff30619
return cache additions as bytes
matt-o-how 61697a2
return badaggsig instead of generic badspendbundle
matt-o-how 3280753
create pybinding for get_name_puzzle_conditions
matt-o-how 6230278
clippy
matt-o-how b90a72c
add type stubs for get_name_puzzle_conditions
matt-o-how 4fb81b5
pass whole GTElement and update with iter
matt-o-how 83d7c5a
Merge branch 'multithread_validation' of https://github.com/Chia-Netw…
matt-o-how e636637
python items() returns GTElement
matt-o-how dc46758
use chia_rs values
matt-o-how e625725
use ARC pointer and don't clone test list
matt-o-how 3359fa9
return python object for GTElement instead of bytes when calling BLSC…
matt-o-how 3861339
black test_blscache.py
matt-o-how 211b63a
stubs fix
matt-o-how 574521b
optimise tests
matt-o-how 451302e
Merge branch 'main' into multithread_validation
matt-o-how 029b120
fix removal of softfork flag
matt-o-how 8768baf
add Additions and ValidationResult types for Clippy's sake
matt-o-how 54318db
Add interior mutability to BLSCache
Rigidity facd7b5
fix final pytest
matt-o-how a91aa35
black tests
matt-o-how 3438e6e
Merge pull request #623 from Chia-Network/cache-interior-mutability
matt-o-how 3825fc3
remove commented out code
matt-o-how abc0366
fmt
matt-o-how d8192cc
remove .collect() call from validate_clvm_and_signature
matt-o-how cd48403
remove pre-validate spendbundle
matt-o-how 3b14011
move Arc import to tests mod
matt-o-how 7565924
rename get_name_puzzle_conditions to get_conditions_from_spendbundle
matt-o-how 20f95ce
rename multithread_validation to spend_bundle_validation
matt-o-how d4fb13f
remove mempool mode bool
matt-o-how 44b5dfc
expose get_flags_for_height_and_constants
matt-o-how bd307b6
move large spendbundle test to a clsp.hex file
matt-o-how 09e4a8a
add regression test to make_aggsig_final_message
matt-o-how ec77718
clippy fixes
matt-o-how fced1e3
rename npc_result to spendbundle_conditions
matt-o-how 47c23d7
remove need for mut in flags
matt-o-how 019b2f1
Revert "rename get_name_puzzle_conditions to get_conditions_from_spen…
matt-o-how 48c706a
re-rename npc and type a Vec
matt-o-how 2c8a045
Revert "rename multithread_validation to spend_bundle_validation"
matt-o-how 5ff17d2
remove added file
matt-o-how 6ed8437
rename multithread validation
matt-o-how 4b212fd
re-apply updates to spendbundle_validation
matt-o-how File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ use chia_consensus::merkle_set::compute_merkle_set_root as compute_merkle_root_i | |
use chia_consensus::merkle_tree::{validate_merkle_proof, MerkleSet}; | ||
use chia_consensus::multiprocess_validation::validate_clvm_and_signature; | ||
|
||
use chia_consensus::npc_result::get_name_puzzle_conditions; | ||
use chia_consensus::npc_result::get_conditions_from_spendbundle; | ||
use chia_protocol::{ | ||
BlockRecord, Bytes32, ChallengeBlockInfo, ChallengeChainSubSlot, ClassgroupElement, Coin, | ||
CoinSpend, CoinState, CoinStateFilters, CoinStateUpdate, EndOfSubSlotBundle, Foliage, | ||
|
@@ -398,19 +398,20 @@ pub fn py_validate_clvm_and_signature( | |
} | ||
|
||
#[pyfunction] | ||
#[pyo3(name = "get_name_puzzle_conditions")] | ||
pub fn py_get_name_puzzle_conditions( | ||
#[pyo3(name = "get_conditions_from_spendbundle")] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we need to call this from python? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. It is required to fix a bug with the fast-forwarding code |
||
pub fn py_get_conditions_from_spendbundle( | ||
spend_bundle: &SpendBundle, | ||
max_cost: u64, | ||
constants: &ConsensusConstants, | ||
mempool_mode: bool, | ||
height: u32, | ||
) -> PyResult<OwnedSpendBundleConditions> { | ||
let osbc = get_name_puzzle_conditions(spend_bundle, max_cost, mempool_mode, height, constants) | ||
.map_err(|e| { | ||
let error_code: u32 = e.1.into(); | ||
PyErr::new::<PyTypeError, _>(error_code) | ||
})?; | ||
let osbc = | ||
get_conditions_from_spendbundle(spend_bundle, max_cost, mempool_mode, height, constants) | ||
.map_err(|e| { | ||
let error_code: u32 = e.1.into(); | ||
PyErr::new::<PyTypeError, _>(error_code) | ||
})?; | ||
Ok(osbc) | ||
} | ||
|
||
|
@@ -445,7 +446,7 @@ pub fn chia_rs(_py: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> { | |
|
||
// multithread validattion | ||
m.add_function(wrap_pyfunction!(py_validate_clvm_and_signature, m)?)?; | ||
m.add_function(wrap_pyfunction!(py_get_name_puzzle_conditions, m)?)?; | ||
m.add_function(wrap_pyfunction!(py_get_conditions_from_spendbundle, m)?)?; | ||
|
||
// clvm functions | ||
m.add("NO_UNKNOWN_CONDS", NO_UNKNOWN_CONDS)?; | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
this parameter should be removed. You're only dealing with transactions, i.e. mempool mode
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.
Done