Chia-Network / chia_rs

Rust crate & wheel with consensus code
Apache License 2.0
21 stars 26 forks source link

CHIA-1763: Make functions use bls cache immutably #793

Closed Rigidity closed 1 day ago

Rigidity commented 1 day ago

BLSCache has all its members protected by a mutex. In order to allow threads sharing the same object, it needs to be treated as immutable. This is the patter Mutex is meant to be used in.

It's believed to address the issue from pyo3:

full_node chia.full_node.full_node: ERROR    Error in _handle_one_transaction, closing: Traceback (most recent call last):
  File "/home/arvid/dev/chia-blockchain/chia/full_node/full_node.py", line 475, in _handle_one_transaction
    inc_status, err = await self.add_transaction(entry.transaction, entry.spend_name, peer, entry.test)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/arvid/dev/chia-blockchain/chia/full_node/full_node.py", line 2681, in add_transaction
    cost_result = await self.mempool_manager.pre_validate_spendbundle(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/arvid/dev/chia-blockchain/chia/full_node/mempool_manager.py", line 298, in pre_validate_spendbundle
    bls_cache.update(new_cache_entries)
RuntimeError: Already borrowed
coveralls-official[bot] commented 1 day ago

Pull Request Test Coverage Report for Build 11847643372

Warning: 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


Totals Coverage Status
Change from base Build 11841415899: 0.0%
Covered Lines: 12847
Relevant Lines: 15326

💛 - Coveralls