before_code
stringlengths
30
149k
reviewer_comment
stringlengths
16
20.6k
after_code
stringlengths
30
163k
diff_context
stringlengths
0
22.4k
file_path
stringlengths
6
155
comment_line
int64
0
26
language
stringclasses
19 values
quality_score
float64
0.07
1
comment_type
stringclasses
9 values
comment_length
int64
16
20.6k
before_lines
int64
2
4.61k
after_lines
int64
2
4.4k
is_negative
bool
2 classes
pr_title
stringlengths
7
140
pr_number
int64
18
61.2k
repo_name
stringclasses
29 values
repo_stars
int64
321
56k
repo_language
stringclasses
14 values
reviewer_username
stringclasses
378 values
author_username
stringclasses
739 values
user
stringlengths
361
200k
assistant
stringlengths
16
20.6k
system
stringclasses
1 value
ProtocolMessageTypes.request_block_header: {NodeType.WALLET, NodeType.FULL_NODE}, ProtocolMessageTypes.respond_block_header: {NodeType.WALLET, NodeType.FULL_NODE}, ProtocolMessageTypes.reject_header_request: {NodeType.WALLET, NodeType.FULL_NODE}, ProtocolMessageTypes.request_removals: {NodeType.WALLET, ...
```suggestion ProtocolMessageTypes.request_fee_estimates: {NodeType.WALLET}, ProtocolMessageTypes.respond_fee_estimates: {NodeType.FULL_NODE}, ``` I would expect something like this
ProtocolMessageTypes.request_puzzle_solution: {NodeType.WALLET}, ProtocolMessageTypes.respond_puzzle_solution: {NodeType.FULL_NODE}, ProtocolMessageTypes.reject_puzzle_solution: {NodeType.FULL_NODE}, ProtocolMessageTypes.send_transaction: {NodeType.WALLET}, ProtocolMessageTypes.transaction_ack: {Nod...
@@ -0,0 +1,126 @@ +from __future__ import annotations + +from chia.protocols.outbound_message import NodeType +from chia.protocols.protocol_message_types import ProtocolMessageTypes + +ProtocolMessageTypeToNodeType: dict[ProtocolMessageTypes, set[NodeType]] = { + # Shared protocol (all services) + ProtocolMessage...
chia/protocols/protocol_message_type_to_node_type.py
26
Python
0.857
suggestion
190
51
51
false
CHIA-3905 Improve nodes message typechecking
20,556
Chia-Network/chia-blockchain
10,822
Python
arvidn
AmineKhaldi
Review this pull request change. Language: Python File: chia/protocols/protocol_message_type_to_node_type.py PR Title: CHIA-3905 Improve nodes message typechecking BEFORE CODE: ProtocolMessageTypes.request_block_header: {NodeType.WALLET, NodeType.FULL_NODE}, ProtocolMessageTypes.respond_block_header: {NodeT...
```suggestion ProtocolMessageTypes.request_fee_estimates: {NodeType.WALLET}, ProtocolMessageTypes.respond_fee_estimates: {NodeType.FULL_NODE}, ``` I would expect something like this
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
ProtocolMessageTypes.respond_transaction: {NodeType.FULL_NODE}, ProtocolMessageTypes.request_proof_of_weight: {NodeType.WALLET, NodeType.FULL_NODE}, ProtocolMessageTypes.respond_proof_of_weight: {NodeType.FULL_NODE}, ProtocolMessageTypes.request_block: {NodeType.FULL_NODE}, ProtocolMessageTypes.resp...
a none response means the request failed in some way. I think every node type is allowed to send this
ProtocolMessageTypes.respond_transaction: {NodeType.FULL_NODE}, ProtocolMessageTypes.request_proof_of_weight: {NodeType.WALLET, NodeType.FULL_NODE}, ProtocolMessageTypes.respond_proof_of_weight: {NodeType.FULL_NODE}, ProtocolMessageTypes.request_block: {NodeType.FULL_NODE}, ProtocolMessageTypes.resp...
@@ -0,0 +1,130 @@ +from __future__ import annotations + +from chia.protocols.outbound_message import NodeType +from chia.protocols.protocol_message_types import ProtocolMessageTypes + +# Map of protocol message type to the node types that send it. We use this to +# validate which nodes are allowed to send which message...
chia/protocols/protocol_message_type_to_node_type.py
26
Python
0.5
bug
101
51
51
false
CHIA-3905 Improve nodes message typechecking
20,556
Chia-Network/chia-blockchain
10,822
Python
arvidn
AmineKhaldi
Review this pull request change. Language: Python File: chia/protocols/protocol_message_type_to_node_type.py PR Title: CHIA-3905 Improve nodes message typechecking BEFORE CODE: ProtocolMessageTypes.respond_transaction: {NodeType.FULL_NODE}, ProtocolMessageTypes.request_proof_of_weight: {NodeType.WALLET, Nod...
a none response means the request failed in some way. I think every node type is allowed to send this
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
ProtocolMessageTypes.respond_to_coin_updates: {NodeType.FULL_NODE}, ProtocolMessageTypes.request_children: {NodeType.WALLET}, ProtocolMessageTypes.respond_children: {NodeType.FULL_NODE}, ProtocolMessageTypes.request_ses_hashes: {NodeType.WALLET}, ProtocolMessageTypes.respond_ses_hashes: {NodeType.FU...
I would think farmers would also be allowed to request peers from the introducer
ProtocolMessageTypes.respond_to_ph_updates: {NodeType.FULL_NODE}, ProtocolMessageTypes.register_for_coin_updates: {NodeType.WALLET}, ProtocolMessageTypes.respond_to_coin_updates: {NodeType.FULL_NODE}, ProtocolMessageTypes.request_children: {NodeType.WALLET}, ProtocolMessageTypes.respond_children: {N...
@@ -0,0 +1,130 @@ +from __future__ import annotations + +from chia.protocols.outbound_message import NodeType +from chia.protocols.protocol_message_types import ProtocolMessageTypes + +# Map of protocol message type to the node types that send it. We use this to +# validate which nodes are allowed to send which message...
chia/protocols/protocol_message_type_to_node_type.py
26
Python
0.214
suggestion
80
35
39
false
CHIA-3905 Improve nodes message typechecking
20,556
Chia-Network/chia-blockchain
10,822
Python
arvidn
AmineKhaldi
Review this pull request change. Language: Python File: chia/protocols/protocol_message_type_to_node_type.py PR Title: CHIA-3905 Improve nodes message typechecking BEFORE CODE: ProtocolMessageTypes.respond_to_coin_updates: {NodeType.FULL_NODE}, ProtocolMessageTypes.request_children: {NodeType.WALLET}, P...
I would think farmers would also be allowed to request peers from the introducer
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
return None try: return PeerInfo(ip, uint16(port)) except ValueError: return None def get_port(self) -> uint16: if self._port is None: raise ValueError("Port not set") return uint16(self._port) def accept_inbound_connections(self,...
```suggestion key_and_limit = self.inbound_connections_info[node_type] config_key, default_limit = key_and_limit limit: int = self.config.get(config_key, default_limit) return inbound_count < limit ```
if node_type == NodeType.WALLET: return inbound_count < cast(int, self.config.get("max_inbound_wallet", 20)) if node_type == NodeType.FARMER: return inbound_count < cast(int, self.config.get("max_inbound_farmer", 10)) if node_type == NodeType.TIMELORD: return ...
@@ -719,13 +739,14 @@ def accept_inbound_connections(self, node_type: NodeType) -> bool: return inbound_count < cast(int, self.config.get("target_peer_count", 40)) - cast( int, self.config.get("target_outbound_peer_count", 8) ) - if node_type == NodeType.WALLET: - ...
chia/server/server.py
26
Python
0.929
suggestion
233
48
28
false
CHIA-3906 Improve accept_inbound_connections
20,557
Chia-Network/chia-blockchain
10,822
Python
arvidn
AmineKhaldi
Review this pull request change. Language: Python File: chia/server/server.py PR Title: CHIA-3906 Improve accept_inbound_connections BEFORE CODE: return None try: return PeerInfo(ip, uint16(port)) except ValueError: return None def get_port(self) -> uint16: ...
```suggestion key_and_limit = self.inbound_connections_info[node_type] config_key, default_limit = key_and_limit limit: int = self.config.get(config_key, default_limit) return inbound_count < limit ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
ca_cert: Path, ca_key: Path, cert_path: Path, key_path: Path, *, check_permissions: bool = True, log: logging.Logger | None = None, ) -> ssl.SSLContext: if check_permissions: verify_ssl_certs_and_keys([ca_cert, cert_path], [ca_key, key_path], log) ssl_context = ssl._create_u...
This is a special case of creating new user config parameters and setting default values to use default parameters for ones are missing from a legacy config file. Is there a way to do this in a more "config"-based file? Is seems a bit specific to have this config-override stuff at this level.
ca_cert: Path, ca_key: Path, cert_path: Path, key_path: Path, *, check_permissions: bool = True, log: logging.Logger | None = None, ) -> ssl.SSLContext: if check_permissions: verify_ssl_certs_and_keys([ca_cert, cert_path], [ca_key, key_path], log) ssl_context = ssl._create_u...
@@ -101,6 +101,24 @@ def calculate_node_id(cert_path: Path) -> bytes32: return bytes32(der_cert.fingerprint(hashes.SHA256())) +def get_inbound_limit_defaults() -> dict[NodeType, tuple[str, int]]:
chia/server/server.py
26
Python
0.5
suggestion
293
51
51
false
CHIA-3906 Improve accept_inbound_connections
20,557
Chia-Network/chia-blockchain
10,822
Python
richardkiss
AmineKhaldi
Review this pull request change. Language: Python File: chia/server/server.py PR Title: CHIA-3906 Improve accept_inbound_connections BEFORE CODE: ca_cert: Path, ca_key: Path, cert_path: Path, key_path: Path, *, check_permissions: bool = True, log: logging.Logger | None = None, ) -> ssl.S...
This is a special case of creating new user config parameters and setting default values to use default parameters for ones are missing from a legacy config file. Is there a way to do this in a more "config"-based file? Is seems a bit specific to have this config-override stuff at this level.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
# Missing `enable_private_networks` config entry in introducer_peer should default to False for back compat discovery0 = FullNodeDiscovery( server=chia_server, target_outbound_count=0, peers_file_path=SIMULATOR_ROOT_PATH / Path(chia_server.config["peers_file_path"]), introducer_...
No issues found.
# Missing `enable_private_networks` config entry in introducer_peer should default to False for back compat discovery0 = FullNodeDiscovery( server=chia_server, target_outbound_count=0, peers_file_path=SIMULATOR_ROOT_PATH / Path(chia_server.config["peers_file_path"]), introducer_...
@@ -20,33 +20,47 @@ async def test_enable_private_networks( # Missing `enable_private_networks` config entry in introducer_peer should default to False for back compat discovery0 = FullNodeDiscovery( - chia_server, - 0, - SIMULATOR_ROOT_PATH / Path(chia_server.config["peers_file_path"])...
chia/_tests/core/server/test_node_discovery.py
0
Python
1
none
16
51
51
true
[CHIA-2615] Add ContextManager to FullNodePeers
19,427
Chia-Network/chia-blockchain
10,822
Python
matt-o-how
Review this pull request change. Language: Python File: chia/_tests/core/server/test_node_discovery.py PR Title: [CHIA-2615] Add ContextManager to FullNodePeers BEFORE CODE: # Missing `enable_private_networks` config entry in introducer_peer should default to False for back compat discovery0 = FullNodeDisc...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
cc_sub_slot = ChallengeChainSubSlot( cc_vdf, icc_sub_slot_hash, ses_hash, new_sub_slot_iters, new_difficulty, ) else: # No icc icc_sub_slot = No...
No issues found.
cc_sub_slot = ChallengeChainSubSlot( cc_vdf, icc_sub_slot_hash, ses_hash, new_sub_slot_iters, new_difficulty, ) else: # No icc icc_sub_slot = No...
@@ -19,7 +19,6 @@ import anyio from chia_puzzles_py.programs import CHIALISP_DESERIALISATION, ROM_BOOTSTRAP_GENERATOR from chia_rs import ( - MEMPOOL_MODE, AugSchemeMPL, ConsensusConstants, G1Element, @@ -75,7 +74,7 @@ from chia.ssl.create_ssl import create_all_ssl from chia.types.blockchain_form...
chia/simulator/block_tools.py
0
Python
1
none
16
51
51
true
Enable Keccak for 2.5.4
19,563
Chia-Network/chia-blockchain
10,822
Python
emlowe
Review this pull request change. Language: Python File: chia/simulator/block_tools.py PR Title: Enable Keccak for 2.5.4 BEFORE CODE: cc_sub_slot = ChallengeChainSubSlot( cc_vdf, icc_sub_slot_hash, ses_hash, new_sub_slot_...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
sk = AugSchemeMPL.key_gen(b"2" * 32) g1 = sk.get_g1() sig = AugSchemeMPL.sign(sk, b"foobar", g1) conditions.append([ConditionOpcode.AGG_SIG_UNSAFE, g1, b"foobar"]) return spend_bundle_from_conditions(conditions, coin, sig) async def send_spendbundle( mempool_manager: MempoolMan...
No issues found.
sk = AugSchemeMPL.key_gen(b"2" * 32) g1 = sk.get_g1() sig = AugSchemeMPL.sign(sk, b"foobar", g1) conditions.append([ConditionOpcode.AGG_SIG_UNSAFE, g1, b"foobar"]) return spend_bundle_from_conditions(conditions, coin, sig) async def send_spendbundle( mempool_manager: MempoolMan...
@@ -34,6 +34,8 @@ can_replace, check_removals, compute_assert_height, + is_atom_canonical, + is_clvm_canonical, optional_max, optional_min, ) @@ -88,6 +90,74 @@ TEST_HEIGHT = uint32(5) +@pytest.mark.parametrize("clvm_hex", ["80", "ff8080", "ff7f03", "ffff8080ff8080"]) +def test_clvm...
chia/_tests/core/mempool/test_mempool_manager.py
0
Python
1
none
16
51
51
true
Improve dedup
19,565
Chia-Network/chia-blockchain
10,822
Python
arvidn
Review this pull request change. Language: Python File: chia/_tests/core/mempool/test_mempool_manager.py PR Title: Improve dedup BEFORE CODE: sk = AugSchemeMPL.key_gen(b"2" * 32) g1 = sk.get_g1() sig = AugSchemeMPL.sign(sk, b"foobar", g1) conditions.append([ConditionOpcode.AGG_SIG_UN...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
) if err is None: # No error, immediately add to mempool, after removing conflicting TXs. assert item is not None conflict = self.mempool.remove_from_pool(remove_items, MempoolRemoveReason.CONFLICT) info = self.mempool.add_to_pool(item) if info...
No issues found.
) if err is None: # No error, immediately add to mempool, after removing conflicting TXs. assert item is not None conflict = self.mempool.remove_from_pool(remove_items, MempoolRemoveReason.CONFLICT) info = self.mempool.add_to_pool(item) if info...
@@ -625,7 +625,10 @@ async def validate_spend_bundle( EligibilityAndAdditions(is_eligible_for_dedup=False, spend_additions=[], ff_puzzle_hash=None), ) - supports_dedup = eligibility_info.is_eligible_for_dedup and is_clvm_canonical(bytes(coin_spend.solution)) + suppo...
chia/full_node/mempool_manager.py
0
Python
1
none
16
51
51
true
amendment to Dedup patch #19565
19,569
Chia-Network/chia-blockchain
10,822
Python
arvidn
Review this pull request change. Language: Python File: chia/full_node/mempool_manager.py PR Title: amendment to Dedup patch #19565 BEFORE CODE: ) if err is None: # No error, immediately add to mempool, after removing conflicting TXs. assert item is not None confl...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
from chia.consensus.condition_costs import ConditionCost from chia.consensus.default_constants import DEFAULT_CONSTANTS from chia.types.blockchain_format.coin import Coin from chia.types.blockchain_format.program import Program from chia.types.condition_opcodes import ConditionOpcode from chia.util.errors import Err, ...
No issues found.
from chia.consensus.condition_costs import ConditionCost from chia.consensus.default_constants import DEFAULT_CONSTANTS from chia.types.blockchain_format.coin import Coin from chia.types.blockchain_format.program import Program from chia.types.condition_opcodes import ConditionOpcode from chia.util.errors import Err, ...
@@ -0,0 +1,58 @@ +from __future__ import annotations + +from chia_rs import CoinSpend +from chia_rs.sized_ints import uint64 + +from chia.consensus.condition_costs import ConditionCost +from chia.consensus.default_constants import DEFAULT_CONSTANTS +from chia.types.blockchain_format.coin import Coin +from chia.types.bl...
chia/wallet/util/compute_additions.py
0
Python
1
none
16
51
51
true
Remove the dependency of `chia.consensus` on the module `chia.types`
19,590
Chia-Network/chia-blockchain
10,822
Python
richardkiss
Review this pull request change. Language: Python File: chia/wallet/util/compute_additions.py PR Title: Remove the dependency of `chia.consensus` on the module `chia.types` BEFORE CODE: from chia.consensus.condition_costs import ConditionCost from chia.consensus.default_constants import DEFAULT_CONSTANTS from chia...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
assert royalty_percentage_raw is not None # clvm encodes large ints as bytes if isinstance(royalty_percentage_raw, bytes): royalty_percentage = int_from_bytes(royalty_percentage_raw) else: royalty_percentage = int(royalty_percentage_raw) ...
No issues found.
assert royalty_percentage_raw is not None # clvm encodes large ints as bytes if isinstance(royalty_percentage_raw, bytes): royalty_percentage = int_from_bytes(royalty_percentage_raw) else: royalty_percentage = int(royalty_percentage_raw) ...
@@ -1161,10 +1161,10 @@ async def mint_from_did( - The launcher coins are then spent along with the created eve spend and an xch spend that funds the transactions and pays fees. - There is also an option to pass in a list of target puzzlehashes. If - provided this method will creat...
chia/wallet/nft_wallet/nft_wallet.py
0
Python
1
none
16
51
51
true
chore: fix some typos in comment
19,594
Chia-Network/chia-blockchain
10,822
Python
yetyear
Review this pull request change. Language: Python File: chia/wallet/nft_wallet/nft_wallet.py PR Title: chore: fix some typos in comment BEFORE CODE: assert royalty_percentage_raw is not None # clvm encodes large ints as bytes if isinstance(royalty_percentage_raw, bytes): ...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
cancel_request = { "trade_id": maker_response["offer"]["trade_id"], "secure": secure, "fee": None, } await offer_setup.maker.api.cancel_offer(request=cancel_request) if secure: offer_to_cancel = TradingOffer.from_bytes(hexstr_to_bytes(maker_response["offer"]["offer"])) ...
No issues found.
cancel_request = { "trade_id": maker_response["offer"]["trade_id"], "secure": secure, "fee": None, } await offer_setup.maker.api.cancel_offer(request=cancel_request) if secure: offer_to_cancel = TradingOffer.from_bytes(hexstr_to_bytes(maker_response["offer"]["offer"])) ...
@@ -3003,18 +3003,18 @@ async def test_pagination_rpcs( "total_pages": 1, "total_bytes": 8, "diff": [ - {"type": "DELETE", "key": key6.hex(), "value": value6.hex()}, {"type": "INSERT", "key": key6.hex(), "value": new_value.hex()}, + {...
chia/_tests/core/data_layer/test_data_rpc.py
0
Python
1
none
16
51
51
true
Optimize DL functions for get keys/values.
19,609
Chia-Network/chia-blockchain
10,822
Python
fchirica
Review this pull request change. Language: Python File: chia/_tests/core/data_layer/test_data_rpc.py PR Title: Optimize DL functions for get keys/values. BEFORE CODE: cancel_request = { "trade_id": maker_response["offer"]["trade_id"], "secure": secure, "fee": None, } await offer...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
seed=b"data", time_per_block=50, skip_slots=1, min_signage_point=block_1.reward_chain_block.signage_point_index, )[-1] # make sure block_2 has higher iterations assert block_2.total_iters >= b...
No issues found.
seed=b"data", time_per_block=50, skip_slots=1, min_signage_point=block_1.reward_chain_block.signage_point_index, )[-1] # make sure block_2 has higher iterations assert block_2.total_iters >= b...
@@ -279,7 +279,12 @@ async def test_timelord_new_peak_unfinished_orphaned_overflow( # make two new blocks on tip block_1 = bt.get_consecutive_blocks(1, default_1000_blocks, time_per_block=9, force_overflow=True)[-1] block_2 = bt.get_consecutive_blocks( - ...
chia/_tests/timelord/test_new_peak.py
0
Python
1
none
16
51
51
true
dont skip same peak if in unfinished cache
19,626
Chia-Network/chia-blockchain
10,822
Python
almogdepaz
Review this pull request change. Language: Python File: chia/_tests/timelord/test_new_peak.py PR Title: dont skip same peak if in unfinished cache BEFORE CODE: seed=b"data", time_per_block=50, skip_slots=1, min_signage_point=block_1.rew...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
continue if fill_missing_services: r.update(load_defaults_for_missing_services(config=r, config_name=path.name)) if sub_config is not None: r = cast(dict[str, Any], r.get(sub_config)) return r except Exception as e: ...
No issues found.
continue if fill_missing_services: r.update(load_defaults_for_missing_services(config=r, config_name=path.name)) if sub_config is not None: r = cast(dict[str, Any], r.get(sub_config)) return r except Exception as e: ...
@@ -18,8 +18,6 @@ import yaml from typing_extensions import Literal -from chia.server.outbound_message import NodeType -from chia.types.peer_info import UnresolvedPeerInfo from chia.util.lock import Lockfile log = logging.getLogger(__name__) @@ -330,38 +328,3 @@ def load_defaults_for_missing_services(config: di...
chia/util/config.py
0
Python
1
none
16
51
51
true
Fix `chia.util` <= `chia.server` dependency
19,629
Chia-Network/chia-blockchain
10,822
Python
richardkiss
Review this pull request change. Language: Python File: chia/util/config.py PR Title: Fix `chia.util` <= `chia.server` dependency BEFORE CODE: continue if fill_missing_services: r.update(load_defaults_for_missing_services(config=r, config_name=path.name)) if s...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
request.proof_of_space.size, difficulty, request.challenge_chain_sp, ) sp_iters: uint64 = calculate_sp_iters(self.full_node.constants, sub_slot_iters, request.signage_point_index) ip_iters: uint64 = calculate_ip_iters( s...
No issues found.
request.proof_of_space.size, difficulty, request.challenge_chain_sp, ) sp_iters: uint64 = calculate_sp_iters(self.full_node.constants, sub_slot_iters, request.signage_point_index) ip_iters: uint64 = calculate_ip_iters( s...
@@ -726,7 +726,9 @@ async def respond_signage_point( return None peak = self.full_node.blockchain.get_peak() if peak is not None and peak.height > self.full_node.constants.MAX_SUB_SLOT_BLOCKS: - next_sub_slot_iters = self.full_node.blockchain.get_next_slot_iters...
chia/full_node/full_node_api.py
0
Python
1
none
16
51
51
true
CHIA-2823 move sp broadcast
19,654
Chia-Network/chia-blockchain
10,822
Python
almogdepaz
Review this pull request change. Language: Python File: chia/full_node/full_node_api.py PR Title: CHIA-2823 move sp broadcast BEFORE CODE: request.proof_of_space.size, difficulty, request.challenge_chain_sp, ) sp_iters: uint64 = calculate_sp_it...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
CoinRecord( Coin(std_hash(b"X" + i.to_bytes(4, byteorder="big")), std_hash(b"3"), uint64(100)), uint32(i), uint32(2 * i), False, uint64(12321312), ) for i in range(1, 301) ] coin_store = a...
No issues found.
CoinRecord( Coin(std_hash(b"X" + i.to_bytes(4, byteorder="big")), std_hash(b"3"), uint64(100)), uint32(i), uint32(2 * i), False, uint64(12321312), ) for i in range(1, 301) ] coin_store = a...
@@ -12,6 +12,7 @@ from clvm.casts import int_to_bytes from chia._tests.blockchain.blockchain_test_utils import _validate_and_add_block +from chia._tests.util.coin_store import add_coin_records_to_db from chia._tests.util.db_connection import DBConnection from chia._tests.util.get_name_puzzle_conditions import get...
chia/_tests/core/full_node/stores/test_coin_store.py
0
Python
1
none
16
51
51
true
CHIA-3050 Extract _add_coin_records out of CoinStore and simplify it
19,686
Chia-Network/chia-blockchain
10,822
Python
AmineKhaldi
Review this pull request change. Language: Python File: chia/_tests/core/full_node/stores/test_coin_store.py PR Title: CHIA-3050 Extract _add_coin_records out of CoinStore and simplify it BEFORE CODE: CoinRecord( Coin(std_hash(b"X" + i.to_bytes(4, byteorder="big")), std_hash(b"3"), uint6...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
from chia_rs import ( SpendBundleConditions, ) from chia_rs.sized_bytes import bytes32 from chia_rs.sized_ints import uint32, uint64 from chia.types.coin_record import CoinRecord from chia.util.errors import Err def check_time_locks( removal_coin_records: dict[bytes32, CoinRecord], bundle_conds: SpendBun...
No issues found.
from chia_rs import ( SpendBundleConditions, ) from chia_rs.sized_bytes import bytes32 from chia_rs.sized_ints import uint32, uint64 from chia.types.coin_record import CoinRecord from chia.util.errors import Err def check_time_locks( removal_coin_records: dict[bytes32, CoinRecord], bundle_conds: SpendBun...
@@ -0,0 +1,57 @@ +from __future__ import annotations + +from typing import Optional + +from chia_rs import ( + SpendBundleConditions, +) +from chia_rs.sized_bytes import bytes32 +from chia_rs.sized_ints import uint32, uint64 + +from chia.types.coin_record import CoinRecord +from chia.util.errors import Err + + +def ...
chia/consensus/check_time_locks.py
0
Python
1
none
16
51
51
true
Extract time lock validation and move to `chia.consensus`.
19,707
Chia-Network/chia-blockchain
10,822
Python
richardkiss
Review this pull request change. Language: Python File: chia/consensus/check_time_locks.py PR Title: Extract time lock validation and move to `chia.consensus`. BEFORE CODE: from chia_rs import ( SpendBundleConditions, ) from chia_rs.sized_bytes import bytes32 from chia_rs.sized_ints import uint32, uint64 from ...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
if verbose: print("") print(f"{total_time:0.4f}s, MOSTLY ADDITIONS additions: {total_add} removals: {total_remove}") all_test_time += total_time if verbose: print("Profiling mostly removals ", end="") total_add = 0 total_remove = 0 total_...
No issues found.
if verbose: print("") print(f"{total_time:0.4f}s, MOSTLY ADDITIONS additions: {total_add} removals: {total_remove}") all_test_time += total_time if verbose: print("Profiling mostly removals ", end="") total_add = 0 total_remove = 0 total_...
@@ -28,13 +28,13 @@ def make_coin() -> Coin: return Coin(rand_hash(), rand_hash(), uint64(1)) -def make_coins(num: int) -> tuple[list[tuple[bytes32, Coin]], list[bytes32]]: - additions: list[tuple[bytes32, Coin]] = [] +def make_coins(num: int) -> tuple[list[tuple[bytes32, Coin, bool]], list[bytes32]]: + ...
benchmarks/coin_store.py
0
Python
1
none
16
51
51
true
CHIA-2900 Fast forward mempool optimization
19,713
Chia-Network/chia-blockchain
10,822
Python
AmineKhaldi
Review this pull request change. Language: Python File: benchmarks/coin_store.py PR Title: CHIA-2900 Fast forward mempool optimization BEFORE CODE: if verbose: print("") print(f"{total_time:0.4f}s, MOSTLY ADDITIONS additions: {total_add} removals: {total_remove}") all_test_time ...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
blockchain_constants: ConsensusConstants, ) -> AsyncIterator[tuple[list[FullNodeSimulator], list[tuple[WalletNode, ChiaServer]], BlockTools]]: async with setup_simulators_and_wallets(1, 1, blockchain_constants) as new: yield make_old_setup_simulators_and_wallets(new=new) @pytest.fixture(scope="functio...
No issues found.
blockchain_constants: ConsensusConstants, ) -> AsyncIterator[tuple[list[FullNodeSimulator], list[tuple[WalletNode, ChiaServer]], BlockTools]]: async with setup_simulators_and_wallets(1, 1, blockchain_constants) as new: yield make_old_setup_simulators_and_wallets(new=new) @pytest.fixture(scope="functio...
@@ -196,11 +196,12 @@ def get_keychain(): class ConsensusMode(ComparableEnum): PLAIN = 0 HARD_FORK_2_0 = 1 + HARD_FORK_3_0 = 2 @pytest.fixture( scope="session", - params=[ConsensusMode.PLAIN, ConsensusMode.HARD_FORK_2_0], + params=[ConsensusMode.PLAIN, ConsensusMode.HARD_FORK_2_0, Consensu...
chia/_tests/conftest.py
0
Python
1
none
16
51
51
true
[CHIA-2859] add ConsensusMode in tests to cover the new hard fork
19,716
Chia-Network/chia-blockchain
10,822
Python
arvidn
Review this pull request change. Language: Python File: chia/_tests/conftest.py PR Title: [CHIA-2859] add ConsensusMode in tests to cover the new hard fork BEFORE CODE: blockchain_constants: ConsensusConstants, ) -> AsyncIterator[tuple[list[FullNodeSimulator], list[tuple[WalletNode, ChiaServer]], BlockTools]]: ...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
# This file converts between chialisp bytes and Python integer from __future__ import annotations def int_from_bytes(blob: bytes) -> int: size = len(blob) if size == 0: return 0 return int.from_bytes(blob, "big", signed=True) def int_to_bytes(v: int) -> bytes: byte_count = (v.bit_length() + ...
No issues found.
# This file converts between chialisp bytes and Python integer from __future__ import annotations def int_from_bytes(blob: bytes) -> int: size = len(blob) if size == 0: return 0 return int.from_bytes(blob, "big", signed=True) def int_to_bytes(v: int) -> bytes: byte_count = (v.bit_length() + ...
@@ -0,0 +1,21 @@ +# This file converts between chialisp bytes and Python integer +from __future__ import annotations + + +def int_from_bytes(blob: bytes) -> int: + size = len(blob) + if size == 0: + return 0 + return int.from_bytes(blob, "big", signed=True) + + +def int_to_bytes(v: int) -> bytes: + b...
chia/util/casts.py
0
Python
1
none
16
22
22
true
Migrate away from `clvm` imports
19,730
Chia-Network/chia-blockchain
10,822
Python
matt-o-how
Review this pull request change. Language: Python File: chia/util/casts.py PR Title: Migrate away from `clvm` imports BEFORE CODE: # This file converts between chialisp bytes and Python integer from __future__ import annotations def int_from_bytes(blob: bytes) -> int: size = len(blob) if size == 0: ...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
async with conn.execute( f"SELECT confirmed_index, spent_index, coinbase, puzzle_hash, " f"coin_parent, amount, timestamp FROM coin_record INDEXED BY sqlite_autoindex_coin_record_1 " f"WHERE coin_name in ({'?,' * (len(names) - 1)}?) " f"AND con...
No issues found.
async with conn.execute( f"SELECT confirmed_index, spent_index, coinbase, puzzle_hash, " f"coin_parent, amount, timestamp FROM coin_record INDEXED BY sqlite_autoindex_coin_record_1 " f"WHERE coin_name in ({'?,' * (len(names) - 1)}?) " f"AND con...
@@ -217,23 +217,6 @@ async def get_coins_removed_at_height(self, height: uint32) -> list[CoinRecord]: coins.append(coin_record) return coins - async def get_all_coins(self, include_spent_coins: bool) -> list[CoinRecord]: - # WARNING: this should only be used for tes...
chia/full_node/coin_store.py
0
Python
1
none
16
51
51
true
Create `CoinStoreProtocol` to remove a dependencies on `chia.full_node` from `chia.consensus`
19,741
Chia-Network/chia-blockchain
10,822
Python
richardkiss
Review this pull request change. Language: Python File: chia/full_node/coin_store.py PR Title: Create `CoinStoreProtocol` to remove a dependencies on `chia.full_node` from `chia.consensus` BEFORE CODE: async with conn.execute( f"SELECT confirmed_index, spent_index, coinbase, puzzle_hash,...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
if size < constants.MIN_PLOT_SIZE_V1: log.error("Plot size is lower than the minimum") return None if size > constants.MAX_PLOT_SIZE_V1: log.error("Plot size is higher than the maximum") return None plot_id: bytes32 = get_plot_id(pos) new_challenge: bytes32 = calculate_p...
No issues found.
if size < constants.MIN_PLOT_SIZE_V1: log.error("Plot size is lower than the minimum") return None if size > constants.MAX_PLOT_SIZE_V1: log.error("Plot size is higher than the maximum") return None plot_id: bytes32 = get_plot_id(pos) new_challenge: bytes32 = calculate_p...
@@ -61,10 +61,10 @@ def verify_and_get_quality_string_v1( return None size = pos.size().size_v1 assert size is not None - if size < constants.MIN_PLOT_SIZE: + if size < constants.MIN_PLOT_SIZE_V1: log.error("Plot size is lower than the minimum") return None - if size > cons...
chia/types/blockchain_format/proof_of_space.py
0
Python
1
none
16
51
51
true
bump chia_rs to 0.26.0
19,746
Chia-Network/chia-blockchain
10,822
Python
arvidn
Review this pull request change. Language: Python File: chia/types/blockchain_format/proof_of_space.py PR Title: bump chia_rs to 0.26.0 BEFORE CODE: if size < constants.MIN_PLOT_SIZE_V1: log.error("Plot size is lower than the minimum") return None if size > constants.MAX_PLOT_SIZE_V1: ...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
if verbose: print("") print(f"{total_time:0.4f}s, MOSTLY ADDITIONS additions: {total_add} removals: {total_remove}") all_test_time += total_time if verbose: print("Profiling mostly removals ", end="") total_add = 0 total_remove = 0 total_...
No issues found.
if verbose: print("") print(f"{total_time:0.4f}s, MOSTLY ADDITIONS additions: {total_add} removals: {total_remove}") all_test_time += total_time if verbose: print("Profiling mostly removals ", end="") total_add = 0 total_remove = 0 total_...
@@ -28,13 +28,14 @@ def make_coin() -> Coin: return Coin(rand_hash(), rand_hash(), uint64(1)) -def make_coins(num: int) -> tuple[list[Coin], list[bytes32]]: - additions: list[Coin] = [] +def make_coins(num: int) -> tuple[list[tuple[bytes32, Coin]], list[bytes32]]: + additions: list[tuple[bytes32, Coin]] ...
benchmarks/coin_store.py
0
Python
1
none
16
51
51
true
CHIA-3207 Pass coin IDs from Blockchain's _reconsider_peak to CoinStore's new_block to avoid recomputing them
19,749
Chia-Network/chia-blockchain
10,822
Python
AmineKhaldi
Review this pull request change. Language: Python File: benchmarks/coin_store.py PR Title: CHIA-3207 Pass coin IDs from Blockchain's _reconsider_peak to CoinStore's new_block to avoid recomputing them BEFORE CODE: if verbose: print("") print(f"{total_time:0.4f}s, MOSTLY ADDITIONS additi...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
if "error_code" in pool_response: self.farmer.log.error( f"Error in pooling: {pool_response['error_code'], pool_response['error_message']}" ) increment_pool_st...
No issues found.
if "error_code" in pool_response: self.farmer.log.error( f"Error in pooling: {pool_response['error_code'], pool_response['error_message']}" ) increment_pool_st...
@@ -38,7 +38,6 @@ from chia.server.ws_connection import WSChiaConnection from chia.ssl.create_ssl import get_mozilla_ca_crt from chia.types.blockchain_format.proof_of_space import ( - calculate_prefix_bits, generate_plot_public_key, generate_taproot_sk, get_plot_id, @@ -536,7 +535,7 @@ async def ne...
chia/farmer/farmer_api.py
0
Python
1
none
16
51
51
true
compute plot filter on the harvester
19,765
Chia-Network/chia-blockchain
10,822
Python
arvidn
Review this pull request change. Language: Python File: chia/farmer/farmer_api.py PR Title: compute plot filter on the harvester BEFORE CODE: if "error_code" in pool_response: self.farmer.log.error( f"Error in pooling: {...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
pos_challenge=bytes32(b"1" * 32), plot_size=uint8(0x80), plot_public_key=G1Element(), pool_public_key=G1Element(), expected_error="Plot size is lower than the minimum", ), ProofOfSpaceCase( id="v2 plot size 34", pos_challenge=bytes32(b"1" * 32), pl...
No issues found.
pos_challenge=bytes32(b"1" * 32), plot_size=uint8(0x80), plot_public_key=G1Element(), pool_public_key=G1Element(), expected_error="Plot size is lower than the minimum", ), ProofOfSpaceCase( id="v2 plot size 34", pos_challenge=bytes32(b"1" * 32), pl...
@@ -5,13 +5,18 @@ from typing import Optional import pytest -from chia_rs import G1Element, ProofOfSpace +from chia_rs import G1Element, PlotSize, ProofOfSpace from chia_rs.sized_bytes import bytes32, bytes48 from chia_rs.sized_ints import uint8, uint32 from chia._tests.util.misc import Marks, datacases from ...
chia/_tests/core/custom_types/test_proof_of_space.py
0
Python
1
none
16
51
51
true
Plot v2 quality string
19,769
Chia-Network/chia-blockchain
10,822
Python
arvidn
Review this pull request change. Language: Python File: chia/_tests/core/custom_types/test_proof_of_space.py PR Title: Plot v2 quality string BEFORE CODE: pos_challenge=bytes32(b"1" * 32), plot_size=uint8(0x80), plot_public_key=G1Element(), pool_public_key=G1Element(), expect...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
def get_puzzle_and_solution_for_coin( generator: BlockGenerator, coin: Coin, height: int, constants: ConsensusConstants ) -> SpendInfo: try: puzzle, solution = get_puzzle_and_solution_for_coin_rust( generator.program, generator.generator_refs, constants.MAX_BLOCK_COST...
No issues found.
def get_puzzle_and_solution_for_coin( generator: BlockGenerator, coin: Coin, height: int, constants: ConsensusConstants ) -> SpendInfo: try: puzzle, solution = get_puzzle_and_solution_for_coin_rust( generator.program, generator.generator_refs, constants.MAX_BLOCK_COST...
@@ -57,10 +57,13 @@ def get_spends_for_block(generator: BlockGenerator, height: int, constants: Cons spends: list[CoinSpend] = [] for spend in Program.to(ret).first().as_iter(): - parent, puzzle, amount, solution = spend.as_iter() - puzzle_hash = puzzle.get_tree_hash() - coin = Coin(par...
chia/full_node/mempool_check_conditions.py
0
Python
1
none
16
51
51
true
[CHIA-2639] drop spends we can't serialize rather than the whole request
19,773
Chia-Network/chia-blockchain
10,822
Python
arvidn
Review this pull request change. Language: Python File: chia/full_node/mempool_check_conditions.py PR Title: [CHIA-2639] drop spends we can't serialize rather than the whole request BEFORE CODE: def get_puzzle_and_solution_for_coin( generator: BlockGenerator, coin: Coin, height: int, constants: ConsensusConstan...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
self, one_wallet_node_and_rpc: OneWalletNodeAndRpc, fee: uint64, self_hostname: str ) -> None: client, wallet_node, full_node_api, total_block_rewards, _ = one_wallet_node_and_rpc bt = full_node_api.bt wallet = wallet_node.wallet_state_manager.main_wallet async with wallet....
No issues found.
self, one_wallet_node_and_rpc: OneWalletNodeAndRpc, fee: uint64, self_hostname: str ) -> None: client, wallet_node, full_node_api, total_block_rewards, _ = one_wallet_node_and_rpc bt = full_node_api.bt wallet = wallet_node.wallet_state_manager.main_wallet async with wallet....
@@ -41,7 +41,14 @@ from chia.wallet.util.tx_config import DEFAULT_TX_CONFIG from chia.wallet.util.wallet_types import WalletType from chia.wallet.wallet_node import WalletNode -from chia.wallet.wallet_request_types import GetWallets, PWAbsorbRewards, PWJoinPool, PWSelfPool, PWStatus +from chia.wallet.wallet_request_...
chia/_tests/pools/test_pool_rpc.py
0
Python
1
none
16
51
51
true
[CHIA-3294] Port `get_wallet_balance(s)` to `@marshal`
19,774
Chia-Network/chia-blockchain
10,822
Python
Quexington
Review this pull request change. Language: Python File: chia/_tests/pools/test_pool_rpc.py PR Title: [CHIA-3294] Port `get_wallet_balance(s)` to `@marshal` BEFORE CODE: self, one_wallet_node_and_rpc: OneWalletNodeAndRpc, fee: uint64, self_hostname: str ) -> None: client, wallet_node, full_node_a...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
nft_coin_id: str wallet_id: uint32 @streamable @dataclass(frozen=True) class PWStatus(Streamable): wallet_id: uint32 @streamable @dataclass(frozen=True) class PWStatusResponse(Streamable): state: PoolWalletInfo unconfirmed_transactions: list[TransactionRecord] @streamable @dataclass(frozen=Tru...
No issues found.
nft_coin_id: str wallet_id: uint32 @streamable @dataclass(frozen=True) class PWStatus(Streamable): wallet_id: uint32 @streamable @dataclass(frozen=True) class PWStatusResponse(Streamable): state: PoolWalletInfo unconfirmed_transactions: list[TransactionRecord] @streamable @dataclass(frozen=Tru...
@@ -2,7 +2,7 @@ import sys from dataclasses import dataclass, field -from typing import Any, Optional, final +from typing import Any, BinaryIO, Optional, final from chia_rs import Coin, G1Element, G2Element, PrivateKey from chia_rs.sized_bytes import bytes32 @@ -28,7 +28,9 @@ from chia.wallet.trade_record impo...
chia/wallet/wallet_request_types.py
0
Python
1
none
16
51
51
true
[CHIA-3297] Port `get_transaction(s)` to `@marshal`
19,775
Chia-Network/chia-blockchain
10,822
Python
Quexington
Review this pull request change. Language: Python File: chia/wallet/wallet_request_types.py PR Title: [CHIA-3297] Port `get_transaction(s)` to `@marshal` BEFORE CODE: nft_coin_id: str wallet_id: uint32 @streamable @dataclass(frozen=True) class PWStatus(Streamable): wallet_id: uint32 @streamable @dat...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
@pytest.mark.parametrize( "host_port", [ "127.0.0.1", "::1", "example.com", "localhost", "127.0.0.1:", ":8080", ], ) def test_parse_host_port_invalid(host_port: str) -> None: with pytest.raises(ValueError): parse_host_port(host_port) @pytest.mark...
No issues found.
@pytest.mark.parametrize( "host_port", [ "127.0.0.1", "::1", "example.com", "localhost", "127.0.0.1:", ":8080", ], ) def test_parse_host_port_invalid(host_port: str) -> None: with pytest.raises(ValueError): parse_host_port(host_port) @pytest.mark...
@@ -8,7 +8,38 @@ import pytest from chia.util.ip_address import IPAddress -from chia.util.network import resolve +from chia.util.network import parse_host_port, resolve + + +@pytest.mark.parametrize( + "host_port, expected_host, expected_port", + [ + ("127.0.0.1:8080", "127.0.0.1", 8080), + ("[:...
chia/_tests/util/test_network.py
0
Python
1
none
16
51
51
true
ruff issues
19,787
Chia-Network/chia-blockchain
10,822
Python
richardkiss
Review this pull request change. Language: Python File: chia/_tests/util/test_network.py PR Title: ruff issues BEFORE CODE: @pytest.mark.parametrize( "host_port", [ "127.0.0.1", "::1", "example.com", "localhost", "127.0.0.1:", ":8080", ], ) def test_parse_...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
Returns: list[CoinSpend]: list of unique coin spends in this mempool item uint64: the cost we're saving by deduplicating eligible coins list[Coin]: list of unique additions in this mempool item Raises: ValueError to skip the mempool item we're currently i...
No issues found.
Returns: list[CoinSpend]: list of unique coin spends in this mempool item uint64: the cost we're saving by deduplicating eligible coins list[Coin]: list of unique additions in this mempool item Raises: ValueError to skip the mempool item we're currently i...
@@ -16,16 +16,6 @@ from chia.util.errors import Err -@dataclasses.dataclass(frozen=True) -class EligibilityAndAdditions: - is_eligible_for_dedup: bool - spend_additions: list[Coin] - # This is the spend puzzle hash. It's set to `None` if the spend is not - # eligible for fast forward. When the spend is...
chia/full_node/eligible_coin_spends.py
0
Python
1
none
16
51
51
true
[CHIA-2827] simplify MempoolManager by removing EligibilityAndAdditions
19,801
Chia-Network/chia-blockchain
10,822
Python
arvidn
Review this pull request change. Language: Python File: chia/full_node/eligible_coin_spends.py PR Title: [CHIA-2827] simplify MempoolManager by removing EligibilityAndAdditions BEFORE CODE: Returns: list[CoinSpend]: list of unique coin spends in this mempool item uint64: the cost we'...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
pk = bytes.fromhex( "88bc9360319e7c54ab42e19e974288a2d7a817976f7633f4b43f36ce72074e59c4ab8ddac362202f3e366f0aebbb6280" ) puzzle = p2_delegated_puzzle_or_hidden_puzzle.puzzle_for_pk(G1Element.from_bytes(pk)) disassembly = binutils.disassemble(puzzle) unknown_opcode = "15" program = Seria...
No issues found.
pk = bytes.fromhex( "88bc9360319e7c54ab42e19e974288a2d7a817976f7633f4b43f36ce72074e59c4ab8ddac362202f3e366f0aebbb6280" ) puzzle = p2_delegated_puzzle_or_hidden_puzzle.puzzle_for_pk(G1Element.from_bytes(pk)) disassembly = binutils.disassemble(puzzle) unknown_opcode = "15" program = Seria...
@@ -4,7 +4,8 @@ import pathlib import pytest -from chia_rs import G1Element +from chia_rs import G1Element, get_flags_for_height_and_constants +from chia_rs import get_puzzle_and_solution_for_coin2 as get_puzzle_and_solution_for_coin from chia_rs.sized_bytes import bytes32 from chia_rs.sized_ints import uint32, u...
chia/_tests/core/test_cost_calculation.py
0
Python
1
none
16
51
51
true
Use chia_rs in API instead of clvm
19,803
Chia-Network/chia-blockchain
10,822
Python
matt-o-how
Review this pull request change. Language: Python File: chia/_tests/core/test_cost_calculation.py PR Title: Use chia_rs in API instead of clvm BEFORE CODE: pk = bytes.fromhex( "88bc9360319e7c54ab42e19e974288a2d7a817976f7633f4b43f36ce72074e59c4ab8ddac362202f3e366f0aebbb6280" ) puzzle = p2_delega...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
eligible_for_fast_forward: bool additions: list[Coin] # cost on the specific solution in this item. The cost includes execution # cost and conditions cost, not byte-cost. cost: uint64 # if this spend is eligible for fast forward, this may be set to the # current unspent lineage belonging to...
No issues found.
eligible_for_fast_forward: bool additions: list[Coin] # cost on the specific solution in this item. The cost includes execution # cost and conditions cost, not byte-cost. cost: uint64 # if this spend is eligible for fast forward, this may be set to the # current unspent lineage belonging to...
@@ -24,8 +24,9 @@ class BundleCoinSpend: eligible_for_dedup: bool eligible_for_fast_forward: bool additions: list[Coin] - # cost on the specific solution in this item - cost: Optional[uint64] = None + # cost on the specific solution in this item. The cost includes execution + # cost and condi...
chia/types/mempool_item.py
0
Python
1
none
16
51
51
true
use per-puzzle cost to estimate DEDUP savings
19,811
Chia-Network/chia-blockchain
10,822
Python
arvidn
Review this pull request change. Language: Python File: chia/types/mempool_item.py PR Title: use per-puzzle cost to estimate DEDUP savings BEFORE CODE: eligible_for_fast_forward: bool additions: list[Coin] # cost on the specific solution in this item. The cost includes execution # cost and condition...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
async def get_signage_point(self, sp_hash: bytes32) -> Optional[dict[str, Any]]: try: return await self.fetch("get_signage_point", {"sp_hash": sp_hash.hex()}) except ValueError: # not synced return None async def get_signage_points(self) -> list[dict[str, Any]]: ...
No issues found.
async def get_signage_point(self, sp_hash: bytes32) -> Optional[dict[str, Any]]: try: return await self.fetch("get_signage_point", {"sp_hash": sp_hash.hex()}) except ValueError: # not synced return None async def get_signage_points(self) -> list[dict[str, Any]]: ...
@@ -21,7 +21,7 @@ class FarmerRpcClient(RpcClient): async def get_signage_point(self, sp_hash: bytes32) -> Optional[dict[str, Any]]: try: return await self.fetch("get_signage_point", {"sp_hash": sp_hash.hex()}) - except ValueError: + except ValueError: # not synced ...
chia/farmer/farmer_rpc_client.py
0
Python
1
none
16
51
51
true
CHIA-3396 Remove Exception Catching from node RPC
19,825
Chia-Network/chia-blockchain
10,822
Python
jack60612
Review this pull request change. Language: Python File: chia/farmer/farmer_rpc_client.py PR Title: CHIA-3396 Remove Exception Catching from node RPC BEFORE CODE: async def get_signage_point(self, sp_hash: bytes32) -> Optional[dict[str, Any]]: try: return await self.fetch("get_signage_point"...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
def test_v2_prover_get_compression_level_raises_error(self) -> None: prover = V2Prover("/nonexistent/path/test.plot2") with pytest.raises(NotImplementedError, match="V2 plot format is not yet implemented"): prover.get_compression_level() def test_v2_prover_get_id_raises_error(self) ...
No issues found.
def test_v2_prover_get_compression_level_raises_error(self) -> None: prover = V2Prover("/nonexistent/path/test.plot2") with pytest.raises(NotImplementedError, match="V2 plot format is not yet implemented"): prover.get_compression_level() def test_v2_prover_get_id_raises_error(self) ...
@@ -0,0 +1,103 @@ +from __future__ import annotations + +import tempfile +from pathlib import Path +from unittest.mock import MagicMock, patch + +import pytest + +from chia.plotting.prover import PlotVersion, V1Prover, V2Prover, get_prover_from_bytes, get_prover_from_file + + +class TestProver: + def test_v2_prover_...
chia/_tests/plotting/test_prover.py
0
Python
1
none
16
51
51
true
Plotmanager v2
19,832
Chia-Network/chia-blockchain
10,822
Python
almogdepaz
Review this pull request change. Language: Python File: chia/_tests/plotting/test_prover.py PR Title: Plotmanager v2 BEFORE CODE: def test_v2_prover_get_compression_level_raises_error(self) -> None: prover = V2Prover("/nonexistent/path/test.plot2") with pytest.raises(NotImplementedError, match="...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
export NODE_OPTIONS="--max-old-space-size=3000" SCRIPT_DIR=$( cd -- "$(dirname -- "$0")" pwd ) echo "### Checking GUI dependencies" if [ -d "${SCRIPT_DIR}/.n" ]; then export N_PREFIX="${SCRIPT_DIR}/.n" export PATH="${N_PREFIX}/bin:${PATH}" echo "Loading nodejs/npm from" echo " ${N_PREFIX}" fi if [ -z "...
No issues found.
export NODE_OPTIONS="--max-old-space-size=3000" SCRIPT_DIR=$( cd -- "$(dirname -- "$0")" pwd ) echo "### Checking GUI dependencies" if [ -d "${SCRIPT_DIR}/.n" ]; then export N_PREFIX="${SCRIPT_DIR}/.n" export PATH="${N_PREFIX}/bin:${PATH}" echo "Loading nodejs/npm from" echo " ${N_PREFIX}" fi if [ -z "...
@@ -32,8 +32,8 @@ if ! npm version >/dev/null 2>&1; then fi NPM_VERSION="$(npm -v | cut -d'.' -f 1)" -if [ "$NPM_VERSION" -lt "9" ]; then - echo "Current npm version($(npm -v)) is less than 9. GUI app requires npm>=9." +if [ "$NPM_VERSION" -lt "10" ]; then + echo "Current npm version($(npm -v)) is less than 10. G...
start-gui.sh
0
Shell
1
none
16
51
51
true
Change minimium node version to 20 and npm version to 10
19,845
Chia-Network/chia-blockchain
10,822
Python
emlowe
Review this pull request change. Language: Shell File: start-gui.sh PR Title: Change minimium node version to 20 and npm version to 10 BEFORE CODE: export NODE_OPTIONS="--max-old-space-size=3000" SCRIPT_DIR=$( cd -- "$(dirname -- "$0")" pwd ) echo "### Checking GUI dependencies" if [ -d "${SCRIPT_DIR}/.n" ];...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
spend_bundle: Optional[WalletSpendBundle] additions: list[Coin] removals: list[Coin] wallet_id: uint32 # Represents the list of peers that we sent the transaction to, whether each one # included it in the mempool, and what the error message (if any) was sent_to: list[tuple[str, uint8, Optio...
No issues found.
spend_bundle: Optional[WalletSpendBundle] additions: list[Coin] removals: list[Coin] wallet_id: uint32 # Represents the list of peers that we sent the transaction to, whether each one # included it in the mempool, and what the error message (if any) was sent_to: list[tuple[str, uint8, Optio...
@@ -57,7 +57,7 @@ class TransactionRecordOld(Streamable): # name is also called bundle_id and tx_id name: bytes32 - memos: list[tuple[bytes32, list[bytes]]] + memos: dict[bytes32, list[bytes]] def is_in_mempool(self) -> bool: # If one of the nodes we sent it to responded with success o...
chia/wallet/transaction_record.py
0
Python
1
none
16
51
51
true
[CHIA-3418] Change `TransactionRecord` to use dict instead of list of tuples for memos
19,846
Chia-Network/chia-blockchain
10,822
Python
Quexington
Review this pull request change. Language: Python File: chia/wallet/transaction_record.py PR Title: [CHIA-3418] Change `TransactionRecord` to use dict instead of list of tuples for memos BEFORE CODE: spend_bundle: Optional[WalletSpendBundle] additions: list[Coin] removals: list[Coin] wallet_id: uint...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
first_added_height, get_coin_records, get_unspent_lineage_info_for_puzzle_hash, ) if err is None: # No error, immediately add to mempool, after removing conflicting TXs. assert item is not None conflict = self.mempool.remove_from_po...
No issues found.
first_added_height, get_coin_records, get_unspent_lineage_info_for_puzzle_hash, ) if err is None: # No error, immediately add to mempool, after removing conflicting TXs. assert item is not None conflict = self.mempool.remove_from_po...
@@ -13,9 +13,11 @@ ELIGIBLE_FOR_FF, MEMPOOL_MODE, BLSCache, + CoinRecord, ConsensusConstants, SpendBundle, SpendBundleConditions, + check_time_locks, get_flags_for_height_and_constants, supports_fast_forward, validate_clvm_and_signature, @@ -25,15 +27,13 @@ from chiab...
chia/full_node/mempool_manager.py
0
Python
1
none
16
51
51
true
Import check_time_locks() and CoinRecord
19,848
Chia-Network/chia-blockchain
10,822
Python
matt-o-how
Review this pull request change. Language: Python File: chia/full_node/mempool_manager.py PR Title: Import check_time_locks() and CoinRecord BEFORE CODE: first_added_height, get_coin_records, get_unspent_lineage_info_for_puzzle_hash, ) if err is None: ...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
sb = spend_bundle_from_conditions(conditions, TEST_COIN, sig) mempool_item = mempool_item_from_spendbundle(sb) dedup_coin_spends = IdenticalSpendDedup() unique_coin_spends, cost_saving, unique_additions = dedup_coin_spends.get_deduplication_info( bundle_coin_spends=mempool_item.bundle_coin_spend...
No issues found.
sb = spend_bundle_from_conditions(conditions, TEST_COIN, sig) mempool_item = mempool_item_from_spendbundle(sb) dedup_coin_spends = IdenticalSpendDedup() unique_coin_spends, cost_saving, unique_additions = dedup_coin_spends.get_deduplication_info( bundle_coin_spends=mempool_item.bundle_coin_spend...
@@ -3211,3 +3211,61 @@ async def test_new_peak_deferred_ff_items() -> None: latest_singleton_lineage2 = mi2.bundle_coin_spends[singleton2_id].latest_singleton_lineage assert latest_singleton_lineage2 is not None assert latest_singleton_lineage2.coin_id == singleton2_new_latest.name() + + +@pytest.mark.an...
chia/_tests/core/mempool/test_mempool_manager.py
0
Python
1
none
16
51
51
true
CHIA-3484 Handle items that spend an older ff version when newer lineage exists
19,865
Chia-Network/chia-blockchain
10,822
Python
AmineKhaldi
Review this pull request change. Language: Python File: chia/_tests/core/mempool/test_mempool_manager.py PR Title: CHIA-3484 Handle items that spend an older ff version when newer lineage exists BEFORE CODE: sb = spend_bundle_from_conditions(conditions, TEST_COIN, sig) mempool_item = mempool_item_from_spend...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
if sub_slot.challenge_chain.new_sub_slot_iters is not None: sub_slot_iters = sub_slot.challenge_chain.new_sub_slot_iters tx_peak = self.full_node.blockchain.get_tx_peak() required_iters: uint64 = calculate_iterations_quality( self.full...
No issues found.
if sub_slot.challenge_chain.new_sub_slot_iters is not None: sub_slot_iters = sub_slot.challenge_chain.new_sub_slot_iters tx_peak = self.full_node.blockchain.get_tx_peak() required_iters: uint64 = calculate_iterations_quality( self.full...
@@ -1453,24 +1453,13 @@ async def request_block_headers(self, request: wallet_protocol.RequestBlockHeade if request.end_height < request.start_height or request.end_height - request.start_height > 128: return make_msg(ProtocolMessageTypes.reject_block_headers, reject) - if self.full_node....
chia/full_node/full_node_api.py
0
Python
1
none
16
51
51
true
Simplify `BlockStore`
19,880
Chia-Network/chia-blockchain
10,822
Python
richardkiss
Review this pull request change. Language: Python File: chia/full_node/full_node_api.py PR Title: Simplify `BlockStore` BEFORE CODE: if sub_slot.challenge_chain.new_sub_slot_iters is not None: sub_slot_iters = sub_slot.challenge_chain.new_sub_slot_iters tx_pe...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
if height > 0: # Add reward claims for all blocks from the prev prev block, until the prev block (including the latter) prev_transaction_block = records.block_record(block.foliage_transaction_block.prev_transaction_block_hash) assert prev_transaction_block is not None prev_transactio...
No issues found.
if height > 0: # Add reward claims for all blocks from the prev prev block, until the prev block (including the latter) prev_transaction_block = records.block_record(block.foliage_transaction_block.prev_transaction_block_hash) assert prev_transaction_block is not None prev_transactio...
@@ -116,9 +116,9 @@ def include_spends(self, conds: Optional[SpendBundleConditions], block: FullBloc timestamp = block.foliage_transaction_block.timestamp for spend in conds.spends: spend_coin_id = bytes32(spend.coin_id) - self.removals_since_fork[spend_coin_id]...
chia/consensus/block_body_validation.py
0
Python
1
none
16
51
51
true
Bump chia rs 0.28
19,891
Chia-Network/chia-blockchain
10,822
Python
arvidn
Review this pull request change. Language: Python File: chia/consensus/block_body_validation.py PR Title: Bump chia rs 0.28 BEFORE CODE: if height > 0: # Add reward claims for all blocks from the prev prev block, until the prev block (including the latter) prev_transaction_block = records.block_...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
async def setup_wallet_node( self_hostname: str, consensus_constants: ConsensusConstants, local_bt: BlockTools, spam_filter_after_n_txs: Optional[int] = 200, xch_spam_amount: int = 1000000, full_node_port: Optional[uint16] = None, introducer_port: Optional[uint16] = None, key_seed: Optio...
No issues found.
async def setup_wallet_node( self_hostname: str, consensus_constants: ConsensusConstants, local_bt: BlockTools, spam_filter_after_n_txs: Optional[int] = 200, xch_spam_amount: int = 1000000, full_node_port: Optional[uint16] = None, introducer_port: Optional[uint16] = None, key_seed: Optio...
@@ -18,40 +18,38 @@ from chia.cmds.init_funcs import init from chia.consensus.constants import replace_str_to_bytes from chia.daemon.server import WebSocketServer, daemon_launch_lock_path +from chia.farmer.farmer_service import FarmerService +from chia.farmer.start_farmer import create_farmer_service +from chia.full...
chia/simulator/setup_services.py
0
Python
1
none
16
51
51
true
Simplify dependencies wrt `chia.server`
19,895
Chia-Network/chia-blockchain
10,822
Python
richardkiss
Review this pull request change. Language: Python File: chia/simulator/setup_services.py PR Title: Simplify dependencies wrt `chia.server` BEFORE CODE: async def setup_wallet_node( self_hostname: str, consensus_constants: ConsensusConstants, local_bt: BlockTools, spam_filter_after_n_txs: Optional[in...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
@dataclass class Cache: _path: Path _changed: bool = False _data: dict[Path, CacheEntry] = field(default_factory=dict) expiry_seconds: int = 7 * 24 * 60 * 60 # Keep the cache entries alive for 7 days after its last access def __post_init__(self) -> None: self._path.parent.mkdir(parents=Tru...
No issues found.
@dataclass class Cache: _path: Path _changed: bool = False _data: dict[Path, CacheEntry] = field(default_factory=dict) expiry_seconds: int = 7 * 24 * 60 * 60 # Keep the cache entries alive for 7 days after its last access def __post_init__(self) -> None: self._path.parent.mkdir(parents=Tru...
@@ -165,28 +165,33 @@ def load(self) -> None: # it's here to filter invalid cache entries coming from bladebit RAM plotting. # Related: - https://github.com/Chia-Network/chia-blockchain/issues/13084 # - https://github.com/Chia-Net...
chia/plotting/cache.py
0
Python
1
none
16
51
51
true
pass along plot format version from `ProverProtocol` into `ProofOfSpace`
19,930
Chia-Network/chia-blockchain
10,822
Python
arvidn
Review this pull request change. Language: Python File: chia/plotting/cache.py PR Title: pass along plot format version from `ProverProtocol` into `ProofOfSpace` BEFORE CODE: @dataclass class Cache: _path: Path _changed: bool = False _data: dict[Path, CacheEntry] = field(default_factory=dict) expiry...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
_, cc_proof = get_vdf_info_and_proof( constants, ClassgroupElement.get_default_element(), cc_vdf.challenge, sub_slot_iters, True, ) # generate sub_epoch_summary, and if the las...
No issues found.
_, cc_proof = get_vdf_info_and_proof( constants, ClassgroupElement.get_default_element(), cc_vdf.challenge, sub_slot_iters, True, ) # generate sub_epoch_summary, and if the las...
@@ -14,7 +14,7 @@ from dataclasses import dataclass, replace from pathlib import Path from random import Random -from typing import Any, Callable, Optional +from typing import Any, Callable, Optional, Union import anyio from chia_puzzles_py.programs import CHIALISP_DESERIALISATION, ROM_BOOTSTRAP_GENERATOR @@ -64...
chia/simulator/block_tools.py
0
Python
1
none
16
51
51
true
[CHIA-3654] [CHIA-3537] [CHIA-3673] stub chiapos2 API
19,969
Chia-Network/chia-blockchain
10,822
Python
arvidn
Review this pull request change. Language: Python File: chia/simulator/block_tools.py PR Title: [CHIA-3654] [CHIA-3537] [CHIA-3673] stub chiapos2 API BEFORE CODE: _, cc_proof = get_vdf_info_and_proof( constants, ClassgroupElement.get_default_element(), ...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
} expected_cost = mempool_item.bundle_coin_spends[TEST_COIN_ID].cost assert dedup_coin_spends == IdenticalSpendDedup( {TEST_COIN_ID: DedupCoinSpend(solution=solution, cost=expected_cost)} ) def test_dedup_info_eligible_but_different_solution() -> None: # Eligible coin but different solutio...
No issues found.
} expected_cost = mempool_item.bundle_coin_spends[TEST_COIN_ID].cost assert dedup_coin_spends == IdenticalSpendDedup( {TEST_COIN_ID: DedupCoinSpend(solution=solution, cost=expected_cost)} ) def test_dedup_info_eligible_but_different_solution() -> None: # Eligible coin but different solutio...
@@ -41,7 +41,6 @@ QUOTE_BYTES, QUOTE_EXECUTION_COST, MempoolManager, - NewPeakItem, TimelockConditions, can_replace, check_removals, @@ -3288,7 +3287,7 @@ async def test_new_peak_txs_added(condition_and_error: tuple[ConditionOpcode, Er assert mempool_manager.peak is not None c...
chia/_tests/core/mempool/test_mempool_manager.py
0
Python
1
none
16
51
51
true
CHIA-3704 Optimize peak post processing by using transaction IDs instead of NewPeakItem elements
19,985
Chia-Network/chia-blockchain
10,822
Python
AmineKhaldi
Review this pull request change. Language: Python File: chia/_tests/core/mempool/test_mempool_manager.py PR Title: CHIA-3704 Optimize peak post processing by using transaction IDs instead of NewPeakItem elements BEFORE CODE: } expected_cost = mempool_item.bundle_coin_spends[TEST_COIN_ID].cost assert ded...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
"RespondCostInfo", "RespondFeeEstimates", "RespondHeaderBlocks", "RespondPuzzleSolution", "RespondPuzzleState", "RespondRemovals", "RespondRemoveCoinSubscriptions", "RespondRemovePuzzleSubscriptions", "RespondSESInfo", "RespondToCoinUpdates...
No issues found.
"RespondCostInfo", "RespondFeeEstimates", "RespondHeaderBlocks", "RespondPuzzleSolution", "RespondPuzzleState", "RespondRemovals", "RespondRemoveCoinSubscriptions", "RespondRemovePuzzleSubscriptions", "RespondSESInfo", "RespondToCoinUpdates...
@@ -4,6 +4,8 @@ import inspect from typing import Any, cast +import pytest + from chia.protocols import ( farmer_protocol, full_node_protocol, @@ -264,3 +266,19 @@ def test_missing_messages() -> None: assert types_in_module(shared_protocol) == shared_msgs, ( f"message types were added or re...
chia/_tests/util/test_network_protocol_test.py
0
Python
1
none
16
51
51
true
Simplify rate limit numbers
19,991
Chia-Network/chia-blockchain
10,822
Python
arvidn
Review this pull request change. Language: Python File: chia/_tests/util/test_network_protocol_test.py PR Title: Simplify rate limit numbers BEFORE CODE: "RespondCostInfo", "RespondFeeEstimates", "RespondHeaderBlocks", "RespondPuzzleSolution", "RespondPuzzleState", "R...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
message_bytes, input_bytes = parse_blob(input_bytes) message_48 = type(respond_additions).from_bytes(message_bytes) assert message_48 == respond_additions assert bytes(message_48) == bytes(respond_additions) message_bytes, input_bytes = parse_blob(input_bytes) message_49 = type(reject_additions...
No issues found.
message_bytes, input_bytes = parse_blob(input_bytes) message_48 = type(respond_additions).from_bytes(message_bytes) assert message_48 == respond_additions assert bytes(message_48) == bytes(respond_additions) message_bytes, input_bytes = parse_blob(input_bytes) message_49 = type(reject_additions...
@@ -426,153 +426,158 @@ def test_protocol_bytes() -> None: assert bytes(message_79) == bytes(new_signage_point_harvester) message_bytes, input_bytes = parse_blob(input_bytes) - message_80 = type(new_proof_of_space).from_bytes(message_bytes) - assert message_80 == new_proof_of_space - assert bytes(m...
chia/_tests/util/test_network_protocol_files.py
0
Python
1
none
16
51
51
true
support previous harvester protocol
19,994
Chia-Network/chia-blockchain
10,822
Python
arvidn
Review this pull request change. Language: Python File: chia/_tests/util/test_network_protocol_files.py PR Title: support previous harvester protocol BEFORE CODE: message_bytes, input_bytes = parse_blob(input_bytes) message_48 = type(respond_additions).from_bytes(message_bytes) assert message_48 == resp...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
WalletStateTransition( pre_block_balance_updates={ "xch": { "<=#spendable_balance": -5, "<=#max_send_amount": -5, ">=#pending_change": 1, # any amount increase "pending_coin_r...
No issues found.
WalletStateTransition( pre_block_balance_updates={ "xch": { "<=#spendable_balance": -5, "<=#max_send_amount": -5, ">=#pending_change": 1, # any amount increase "pending_coin_r...
@@ -6,6 +6,7 @@ import json import logging import random +import re from collections.abc import AsyncIterator from operator import attrgetter from typing import Any, Optional @@ -108,6 +109,7 @@ CATGetAssetID, CATGetName, CATSetName, + CATSpend, CheckDeleteKey, CheckOfferValidity, ...
chia/_tests/wallet/rpc/test_wallet_rpc.py
0
Python
1
none
16
51
51
true
[CHIA-3605] Port `cat_spend` to `@marshal`
20,007
Chia-Network/chia-blockchain
10,822
Python
Quexington
Review this pull request change. Language: Python File: chia/_tests/wallet/rpc/test_wallet_rpc.py PR Title: [CHIA-3605] Port `cat_spend` to `@marshal` BEFORE CODE: WalletStateTransition( pre_block_balance_updates={ "xch": { "<=#spendable_balanc...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
@pytest.fixture(scope="function") async def two_wallet_nodes_services( blockchain_constants: ConsensusConstants, ) -> AsyncIterator[tuple[list[SimulatorFullNodeService], list[WalletService], BlockTools]]: async with setup_simulators_and_wallets_service(1, 2, blockchain_constants) as _: yield _ @pyte...
No issues found.
@pytest.fixture(scope="function") async def two_wallet_nodes_services( blockchain_constants: ConsensusConstants, ) -> AsyncIterator[tuple[list[SimulatorFullNodeService], list[WalletService], BlockTools]]: async with setup_simulators_and_wallets_service(1, 2, blockchain_constants) as _: yield _ @pyte...
@@ -92,7 +92,7 @@ from chia_rs.sized_ints import uint128 from chia._tests.environments.wallet import WalletEnvironment, WalletState, WalletTestFramework -from chia._tests.util.setup_nodes import setup_farmer_multi_harvester +from chia._tests.util.setup_nodes import setup_farmer_solver_multi_harvester from chia.ful...
chia/_tests/conftest.py
0
Python
1
none
16
51
51
true
Farmer solver networking
20,019
Chia-Network/chia-blockchain
10,822
Python
almogdepaz
Review this pull request change. Language: Python File: chia/_tests/conftest.py PR Title: Farmer solver networking BEFORE CODE: @pytest.fixture(scope="function") async def two_wallet_nodes_services( blockchain_constants: ConsensusConstants, ) -> AsyncIterator[tuple[list[SimulatorFullNodeService], list[WalletS...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
from __future__ import annotations from dataclasses import dataclass from chia_rs import SpendBundle, SpendBundleConditions from chia_rs.sized_bytes import bytes32 from chia_rs.sized_ints import uint32 from chia.types.mempool_item import BundleCoinSpend @dataclass(frozen=True) class InternalMempoolItem: spend_...
No issues found.
from __future__ import annotations from dataclasses import dataclass from chia_rs import SpendBundle, SpendBundleConditions from chia_rs.sized_bytes import bytes32 from chia_rs.sized_ints import uint32 from chia.types.mempool_item import BundleCoinSpend @dataclass(frozen=True) class InternalMempoolItem: spend_...
@@ -14,5 +14,5 @@ class InternalMempoolItem: spend_bundle: SpendBundle conds: SpendBundleConditions height_added_to_mempool: uint32 - # Map of coin ID to coin spend data between the bundle and its NPCResult + # Map of coin ID to coin spend data between the bundle and its SpendBundleConditions ...
chia/types/internal_mempool_item.py
0
Python
1
none
16
19
19
true
remove unnecessary NPCResult in mempool_manager
20,022
Chia-Network/chia-blockchain
10,822
Python
arvidn
Review this pull request change. Language: Python File: chia/types/internal_mempool_item.py PR Title: remove unnecessary NPCResult in mempool_manager BEFORE CODE: from __future__ import annotations from dataclasses import dataclass from chia_rs import SpendBundle, SpendBundleConditions from chia_rs.sized_bytes im...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
), ProofOfSpaceCase( id="Not passing the plot filter v2", pos_challenge=b32("3d29ea79d19b3f7e99ebf764ae53697cbe143603909873946af6ab1ece606861"), plot_size=PlotSize.make_v2(32), pool_public_key=g1( "b6449c2c68df97c19e884427e42ee7350982d4020571ead08732615ff39bd216bfd630...
No issues found.
), ProofOfSpaceCase( id="Not passing the plot filter v2", pos_challenge=b32("3d29ea79d19b3f7e99ebf764ae53697cbe143603909873946af6ab1ece606861"), plot_size=PlotSize.make_v2(32), pool_public_key=g1( "b6449c2c68df97c19e884427e42ee7350982d4020571ead08732615ff39bd216bfd630...
@@ -206,17 +206,17 @@ def test_verify_and_get_quality_string_v2(caplog: pytest.LogCaptureFixture, case (0, 2), (DEFAULT_CONSTANTS.HARD_FORK_HEIGHT, 2), (DEFAULT_CONSTANTS.HARD_FORK2_HEIGHT, 2), - (DEFAULT_CONSTANTS.PLOT_DIFFICULTY_4_HEIGHT - 1, 2), - (DEFAULT_CONSTANTS.PLOT_DIFF...
chia/_tests/core/custom_types/test_proof_of_space.py
0
Python
1
none
16
51
51
true
bump chia_rs dependency
20,023
Chia-Network/chia-blockchain
10,822
Python
arvidn
Review this pull request change. Language: Python File: chia/_tests/core/custom_types/test_proof_of_space.py PR Title: bump chia_rs dependency BEFORE CODE: ), ProofOfSpaceCase( id="Not passing the plot filter v2", pos_challenge=b32("3d29ea79d19b3f7e99ebf764ae53697cbe143603909873946af6ab1ece6...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
proof_of_space = ProofOfSpace( challenge, pos.pool_public_key, pos.pool_contract_puzzle_hash, public_key, pos.version_and_size, pos.proof, ) rcb = block.reward_chain_block.get_unfinished...
No issues found.
proof_of_space = ProofOfSpace( challenge, pos.pool_public_key, pos.pool_contract_puzzle_hash, public_key, pos.version_and_size, pos.proof, ) rcb = block.reward_chain_block.get_unfinished...
@@ -1882,7 +1882,9 @@ async def test_new_signage_point_caching( ) -> None: full_node_1, _full_node_2, server_1, server_2, _wallet_a, _wallet_receiver, bt = wallet_nodes blocks = await full_node_1.get_all_full_blocks() - + assert full_node_1.full_node.full_node_store.get_signage_point_by_index_and_cc_outpu...
chia/_tests/core/full_node/test_full_node.py
0
Python
1
none
16
51
51
true
fix sp lookup at genesis
20,057
Chia-Network/chia-blockchain
10,822
Python
almogdepaz
Review this pull request change. Language: Python File: chia/_tests/core/full_node/test_full_node.py PR Title: fix sp lookup at genesis BEFORE CODE: proof_of_space = ProofOfSpace( challenge, pos.pool_public_key, pos.pool_contract_puzzle_hash, ...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
if committment > 6: generator_refs = [uint32(n) for n in range(600)] unf = UnfinishedBlock( block.finished_sub_slots[:] if not overflow else block.finished_sub_slots[:-1], reward_chain_block, block.challenge_chain_sp_proof, block.reward_chain_sp_proof, foliage, ...
No issues found.
if committment > 6: generator_refs = [uint32(n) for n in range(600)] unf = UnfinishedBlock( block.finished_sub_slots[:] if not overflow else block.finished_sub_slots[:-1], reward_chain_block, block.challenge_chain_sp_proof, block.reward_chain_sp_proof, foliage, ...
@@ -919,6 +919,10 @@ async def suppress_value_error(coro: Coroutine[Any, Any, None]) -> None: @pytest.mark.anyio +@pytest.mark.limit_consensus_modes( + allowed=[ConsensusMode.HARD_FORK_2_0, ConsensusMode.HARD_FORK_3_0], + reason="We can no longer (reliably) farm blocks from before the hard fork", +) async d...
chia/_tests/core/full_node/test_full_node.py
0
Python
1
none
16
51
51
true
[CHIA-3712] simplify add_transaction()
20,063
Chia-Network/chia-blockchain
10,822
Python
arvidn
Review this pull request change. Language: Python File: chia/_tests/core/full_node/test_full_node.py PR Title: [CHIA-3712] simplify add_transaction() BEFORE CODE: if committment > 6: generator_refs = [uint32(n) for n in range(600)] unf = UnfinishedBlock( block.finished_sub_slots[:] if not o...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
Coin(TEST_COIN_ID, IDENTITY_PUZZLE_HASH, uint64(TEST_COIN_AMOUNT - 1)), } expected_cost = mempool_item.bundle_coin_spends[TEST_COIN_ID].cost assert dedup_coin_spends == IdenticalSpendDedup( {TEST_COIN_ID: DedupCoinSpend(solution=solution, cost=expected_cost)} ) def test_dedup_info_elig...
No issues found.
Coin(TEST_COIN_ID, IDENTITY_PUZZLE_HASH, uint64(TEST_COIN_AMOUNT - 1)), } expected_cost = mempool_item.bundle_coin_spends[TEST_COIN_ID].cost assert dedup_coin_spends == IdenticalSpendDedup( {TEST_COIN_ID: DedupCoinSpend(solution=solution, cost=expected_cost)} ) def test_dedup_info_elig...
@@ -579,7 +579,6 @@ def make_bundle_spends_map_and_fee( bundle_coin_spends[coin_id] = BundleCoinSpend( coin_spend=coin_spend, eligible_for_dedup=bool(spend_conds.flags & ELIGIBLE_FOR_DEDUP), - eligible_for_fast_forward=bool(spend_conds.flags & ELIGIBLE_FOR_FF), ...
chia/_tests/core/mempool/test_mempool_manager.py
0
Python
1
none
16
51
51
true
CHIA-3737 Simplify BundleCoinSpend's tracking of fast forward spends
20,069
Chia-Network/chia-blockchain
10,822
Python
AmineKhaldi
Review this pull request change. Language: Python File: chia/_tests/core/mempool/test_mempool_manager.py PR Title: CHIA-3737 Simplify BundleCoinSpend's tracking of fast forward spends BEFORE CODE: Coin(TEST_COIN_ID, IDENTITY_PUZZLE_HASH, uint64(TEST_COIN_AMOUNT - 1)), } expected_cost = mempool_item....
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
if decimal_only: # dont use scientific notation. final_amount = f"{amount / scale:.12f}" else: final_amount = f"{amount / scale}" ret = f"{final_amount} {address_prefix} " if scale > 1: ret += f"({amount} mojo)" return ret async def print_balances( root_path: pathlib.P...
No issues found.
if decimal_only: # dont use scientific notation. final_amount = f"{amount / scale:.12f}" else: final_amount = f"{amount / scale}" ret = f"{final_amount} {address_prefix} " if scale > 1: ret += f"({amount} mojo)" return ret async def print_balances( root_path: pathlib.P...
@@ -53,6 +53,7 @@ CATSpend, CATSpendResponse, ClawbackPuzzleDecoratorOverride, + CRCATApprovePending, CreateNewWallet, CreateNewWalletType, CreateOfferForIDs, @@ -1937,18 +1938,22 @@ async def approve_r_cats( async with get_wallet_client(root_path, wallet_rpc_port, fingerprint) as ...
chia/cmds/wallet_funcs.py
0
Python
1
none
16
51
51
true
[LABS-249] Port `crcat_approve_pending` to `@marshal`
20,116
Chia-Network/chia-blockchain
10,822
Python
Quexington
Review this pull request change. Language: Python File: chia/cmds/wallet_funcs.py PR Title: [LABS-249] Port `crcat_approve_pending` to `@marshal` BEFORE CODE: if decimal_only: # dont use scientific notation. final_amount = f"{amount / scale:.12f}" else: final_amount = f"{amount / scale}" ...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
# Eligible coin but different solution from the one we encountered initial_conditions = [ [ConditionOpcode.CREATE_COIN, IDENTITY_PUZZLE_HASH, 1], [ConditionOpcode.CREATE_COIN, IDENTITY_PUZZLE_HASH, TEST_COIN_AMOUNT], ] initial_solution = SerializedProgram.to(initial_conditions) dedup...
No issues found.
# Eligible coin but different solution from the one we encountered initial_conditions = [ [ConditionOpcode.CREATE_COIN, IDENTITY_PUZZLE_HASH, 1], [ConditionOpcode.CREATE_COIN, IDENTITY_PUZZLE_HASH, TEST_COIN_AMOUNT], ] initial_solution = SerializedProgram.to(initial_conditions) dedup...
@@ -597,7 +597,7 @@ def mempool_item_from_spendbundle(spend_bundle: SpendBundle) -> MempoolItem: ) bundle_coin_spends, fee = make_bundle_spends_map_and_fee(spend_bundle, conds) return MempoolItem( - spend_bundle=spend_bundle, + aggregated_signature=spend_bundle.aggregated_signature, ...
chia/_tests/core/mempool/test_mempool_manager.py
0
Python
1
none
16
51
51
true
CHIA-2515 Simplify MempoolItem by constructing SpendBundle on demand from its components
20,123
Chia-Network/chia-blockchain
10,822
Python
AmineKhaldi
Review this pull request change. Language: Python File: chia/_tests/core/mempool/test_mempool_manager.py PR Title: CHIA-2515 Simplify MempoolItem by constructing SpendBundle on demand from its components BEFORE CODE: # Eligible coin but different solution from the one we encountered initial_conditions = [ ...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
block: FullBlock = blocks[-1] unf = make_unfinished_block(block, bt.constants) await full_node_1.full_node.add_unfinished_block(unf, dummy_peer) assert full_node_1.full_node.full_node_store.get_unfinished_block(unf.partial_hash) assert unf.foliage_transaction_block is not None block_2 = recurs...
No issues found.
block: FullBlock = blocks[-1] unf = make_unfinished_block(block, bt.constants) await full_node_1.full_node.add_unfinished_block(unf, dummy_peer) assert full_node_1.full_node.full_node_store.get_unfinished_block(unf.partial_hash) assert unf.foliage_transaction_block is not None block_2 = recurs...
@@ -3362,39 +3362,58 @@ async def test_pending_tx_cache_retry_on_new_peak( @pytest.mark.anyio @pytest.mark.parametrize("mismatch_cost", [True, False]) @pytest.mark.parametrize("mismatch_fee", [True, False]) +@pytest.mark.parametrize("tx_already_seen", [True, False]) +@pytest.mark.parametrize("mismatch_on_reannounce"...
chia/_tests/core/full_node/test_full_node.py
0
Python
1
none
16
51
51
true
CHIA-3787 Make sure the fee and cost specified in a NewTransaction match the ones from validating its spend bundle
20,166
Chia-Network/chia-blockchain
10,822
Python
AmineKhaldi
Review this pull request change. Language: Python File: chia/_tests/core/full_node/test_full_node.py PR Title: CHIA-3787 Make sure the fee and cost specified in a NewTransaction match the ones from validating its spend bundle BEFORE CODE: block: FullBlock = blocks[-1] unf = make_unfinished_block(block, bt....
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
async def cat_get_name(self, request: CATGetName) -> CATGetNameResponse: wallet = self.service.wallet_state_manager.get_wallet(id=request.wallet_id, required_type=CATWallet) name: str = wallet.get_name() return CATGetNameResponse(wallet_id=request.wallet_id, name=name) @marshal asyn...
No issues found.
async def cat_get_name(self, request: CATGetName) -> CATGetNameResponse: wallet = self.service.wallet_state_manager.get_wallet(id=request.wallet_id, required_type=CATWallet) name: str = wallet.get_name() return CATGetNameResponse(wallet_id=request.wallet_id, name=name) @marshal asyn...
@@ -197,6 +197,8 @@ GetCoinRecordsByNames, GetCoinRecordsByNamesResponse, GetCurrentDerivationIndexResponse, + GetFarmedAmount, + GetFarmedAmountResponse, GetHeightInfoResponse, GetLoggedInFingerprintResponse, GetNextAddress, @@ -3200,7 +3202,8 @@ async def get_coin_records(self, req...
chia/wallet/wallet_rpc_api.py
0
Python
1
none
16
51
51
true
[LABS-291] Port `get_farmed_amount` to `@marshal`
20,187
Chia-Network/chia-blockchain
10,822
Python
Quexington
Review this pull request change. Language: Python File: chia/wallet/wallet_rpc_api.py PR Title: [LABS-291] Port `get_farmed_amount` to `@marshal` BEFORE CODE: async def cat_get_name(self, request: CATGetName) -> CATGetNameResponse: wallet = self.service.wallet_state_manager.get_wallet(id=request.wallet_...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
# print(f"\nmaybe_reference_offer = {maker_response['offer']}") # only check for success # due to differences in chain progression, the exact offer and trade id may differ from the reference # assert maker_response == {"success": True, "offer": reference.make_offer_response} assert maker_response["...
No issues found.
# print(f"\nmaybe_reference_offer = {maker_response['offer']}") # only check for success # due to differences in chain progression, the exact offer and trade id may differ from the reference # assert maker_response == {"success": True, "offer": reference.make_offer_response} assert maker_response["...
@@ -73,7 +73,6 @@ from chia.wallet.trading.offer import Offer as TradingOffer from chia.wallet.transaction_record import TransactionRecord from chia.wallet.util.tx_config import DEFAULT_TX_CONFIG -from chia.wallet.wallet import Wallet from chia.wallet.wallet_node import WalletNode from chia.wallet.wallet_request_t...
chia/_tests/core/data_layer/test_data_rpc.py
0
Python
1
none
16
51
51
true
[LABS-293] Ensure wallet is synced for RPC TX endpoints
20,190
Chia-Network/chia-blockchain
10,822
Python
Quexington
Review this pull request change. Language: Python File: chia/_tests/core/data_layer/test_data_rpc.py PR Title: [LABS-293] Ensure wallet is synced for RPC TX endpoints BEFORE CODE: # print(f"\nmaybe_reference_offer = {maker_response['offer']}") # only check for success # due to differences in chain prog...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
) icc_eos_vdf, icc_ip_proof = get_icc( constants, uint128(sub_slot_start_total_iters + sub_slot_iters), finished_sub_slots_at_ip, latest_block, blocks, sub_slot_start_total_iters, eos_...
No issues found.
) icc_eos_vdf, icc_ip_proof = get_icc( constants, uint128(sub_slot_start_total_iters + sub_slot_iters), finished_sub_slots_at_ip, latest_block, blocks, sub_slot_start_total_iters, eos_...
@@ -41,6 +41,7 @@ ) from chia_rs.sized_bytes import bytes32 from chia_rs.sized_ints import uint8, uint16, uint32, uint64, uint128 +from filelock import FileLock from chia.consensus.block_creation import create_unfinished_block, unfinished_block_to_full_block from chia.consensus.block_record import BlockRecordPro...
chia/simulator/block_tools.py
0
Python
1
none
16
51
51
true
filelock for test- plots and blocks
20,193
Chia-Network/chia-blockchain
10,822
Python
arvidn
Review this pull request change. Language: Python File: chia/simulator/block_tools.py PR Title: filelock for test- plots and blocks BEFORE CODE: ) icc_eos_vdf, icc_ip_proof = get_icc( constants, uint128(sub_slot_start_total_iters + sub_slot_iters), ...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
pos: ProofOfSpace, constants: ConsensusConstants, original_challenge_hash: bytes32, signage_point: bytes32, *, height: uint32, ) -> Optional[bytes32]: # Exactly one of (pool_public_key, pool_contract_puzzle_hash) must not be None if (pos.pool_public_key is None) and (pos.pool_contract_pu...
No issues found.
pos: ProofOfSpace, constants: ConsensusConstants, original_challenge_hash: bytes32, signage_point: bytes32, *, height: uint32, ) -> Optional[bytes32]: # Exactly one of (pool_public_key, pool_contract_puzzle_hash) must not be None if (pos.pool_public_key is None) and (pos.pool_contract_pu...
@@ -4,7 +4,7 @@ from typing import Optional, cast from bitstring import BitArray -from chia_rs import AugSchemeMPL, ConsensusConstants, G1Element, PlotSize, PrivateKey, ProofOfSpace +from chia_rs import AugSchemeMPL, ConsensusConstants, G1Element, PlotSize, PrivateKey, ProofOfSpace, validate_proof_v2 from chia_rs....
chia/types/blockchain_format/proof_of_space.py
0
Python
1
none
16
51
51
true
Minor pos2 updates
20,200
Chia-Network/chia-blockchain
10,822
Python
arvidn
Review this pull request change. Language: Python File: chia/types/blockchain_format/proof_of_space.py PR Title: Minor pos2 updates BEFORE CODE: pos: ProofOfSpace, constants: ConsensusConstants, original_challenge_hash: bytes32, signage_point: bytes32, *, height: uint32, ) -> Optional[bytes3...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
@classmethod def from_program(cls, program: Program) -> AssertMyAmount: return cls( uint64(program.at("rf").as_int()), ) @final @streamable @dataclass(frozen=True) class AssertMyBirthSeconds(Condition): seconds: uint64 def to_program(self) -> Program: condition: Pr...
No issues found.
@classmethod def from_program(cls, program: Program) -> AssertMyAmount: return cls( uint64(program.at("rf").as_int()), ) @final @streamable @dataclass(frozen=True) class AssertMyBirthSeconds(Condition): seconds: uint64 def to_program(self) -> Program: condition: Pr...
@@ -1096,16 +1096,16 @@ def from_program(cls, program: Program, **kwargs: Optional[bytes32]) -> AssertAn ) -TIMELOCK_TYPES = Union[ - AssertSecondsRelative, - AssertHeightRelative, - AssertSecondsAbsolute, - AssertHeightAbsolute, - AssertBeforeSecondsRelative, - AssertBeforeHeightRelative...
chia/wallet/conditions.py
0
Python
1
none
16
51
51
true
Manual fixes for upcoming Ruff pyupgrade push
20,213
Chia-Network/chia-blockchain
10,822
Python
Quexington
Review this pull request change. Language: Python File: chia/wallet/conditions.py PR Title: Manual fixes for upcoming Ruff pyupgrade push BEFORE CODE: @classmethod def from_program(cls, program: Program) -> AssertMyAmount: return cls( uint64(program.at("rf").as_int()), ) @final...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
# required_iters too high calculate_ip_iters(test_constants, ssi, sp_interval_iters, sp_interval_iters) with raises(ValueError): # required_iters too high calculate_ip_iters(test_constants, ssi, sp_interval_iters, sp_interval_iters * 12) with raises(Valu...
No issues found.
# required_iters too high calculate_ip_iters(test_constants, ssi, sp_interval_iters, sp_interval_iters) with raises(ValueError): # required_iters too high calculate_ip_iters(test_constants, ssi, sp_interval_iters, sp_interval_iters * 12) with raises(Valu...
@@ -1,6 +1,5 @@ from __future__ import annotations -import pytest from chia_rs import PlotSize from chia_rs.sized_ints import uint8, uint16, uint32, uint64, uint128 from pytest import raises @@ -10,7 +9,6 @@ from chia.consensus.pot_iterations import ( calculate_ip_iters, calculate_iterations_quality, -...
chia/_tests/core/consensus/test_pot_iterations.py
0
Python
1
none
16
51
51
true
[CHIA-3795] change v1 plot phase-out
20,216
Chia-Network/chia-blockchain
10,822
Python
arvidn
Review this pull request change. Language: Python File: chia/_tests/core/consensus/test_pot_iterations.py PR Title: [CHIA-3795] change v1 plot phase-out BEFORE CODE: # required_iters too high calculate_ip_iters(test_constants, ssi, sp_interval_iters, sp_interval_iters) with raises(V...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
@pytest.mark.anyio async def test_percentage_limits() -> None: r = RateLimiter(True, 60, 40, get_time=lambda: 0) new_peak_message = make_msg(ProtocolMessageTypes.new_peak, bytes([1] * 40)) for i in range(50): assert r.process_msg_and_check(new_peak_message, rl_v2, rl_v2) is None saw_disconnect...
No issues found.
@pytest.mark.anyio async def test_percentage_limits() -> None: r = RateLimiter(True, 60, 40, get_time=lambda: 0) new_peak_message = make_msg(ProtocolMessageTypes.new_peak, bytes([1] * 40)) for i in range(50): assert r.process_msg_and_check(new_peak_message, rl_v2, rl_v2) is None saw_disconnect...
@@ -24,7 +24,6 @@ rl_v2 = [Capability.BASE, Capability.BLOCK_HEADERS, Capability.RATE_LIMITS_V2] rl_v1 = [Capability.BASE] node_with_params_b = node_with_params -test_different_versions_results: list[int] = [] @dataclass @@ -418,11 +417,14 @@ async def test_different_versions( # The following code checks w...
chia/_tests/core/server/test_rate_limits.py
0
Python
1
none
16
51
51
true
[CHIA-3793] after the hard fork, disallow block references
20,218
Chia-Network/chia-blockchain
10,822
Python
arvidn
Review this pull request change. Language: Python File: chia/_tests/core/server/test_rate_limits.py PR Title: [CHIA-3793] after the hard fork, disallow block references BEFORE CODE: @pytest.mark.anyio async def test_percentage_limits() -> None: r = RateLimiter(True, 60, 40, get_time=lambda: 0) new_peak_mes...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
raise ValueError( "A `preferred_change_puzzle_hash` was specified that would make a duplicate output" ) # We cannot create two coins has same id, create a new puzhash for the change: ...
No issues found.
raise ValueError( "A `preferred_change_puzzle_hash` was specified that would make a duplicate output" ) # We cannot create two coins has same id, create a new puzhash for the change: ...
@@ -96,15 +96,15 @@ def max_send_quantity(self) -> int: # avoid full block TXs return int(self.wallet_state_manager.constants.MAX_BLOCK_COST_CLVM / 5 / self.cost_of_single_tx) - async def get_max_spendable_coins(self, records: Optional[set[WalletCoinRecord]] = None) -> set[WalletCoinRecord]: - ...
chia/wallet/wallet.py
0
Python
1
none
16
51
51
true
[LABS-296] Merge `get_cat_spendable_coins` into `get_spendable_coins_for_wallet`
20,230
Chia-Network/chia-blockchain
10,822
Python
Quexington
Review this pull request change. Language: Python File: chia/wallet/wallet.py PR Title: [LABS-296] Merge `get_cat_spendable_coins` into `get_spendable_coins_for_wallet` BEFORE CODE: raise ValueError( "A `preferred_change_puzzle_hash` was specified ...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
) _, _, blocks = load_block_list(block_list, bt.constants) block = block_list[-1] latest_tx_before_sp = find_tx_before_sp(block_list) assert latest_tx_before_sp is not None assert ( prev_tx_block( constants=test_constants, blocks=BlockCache(blocks), pr...
No issues found.
) _, _, blocks = load_block_list(block_list, bt.constants) block = block_list[-1] latest_tx_before_sp = find_tx_before_sp(block_list) assert latest_tx_before_sp is not None assert ( prev_tx_block( constants=test_constants, blocks=BlockCache(blocks), pr...
@@ -1,16 +1,31 @@ from __future__ import annotations -from chia_rs.sized_ints import uint32 +from typing import Optional + +from chia_rs import FullBlock +from chia_rs.sized_ints import uint8, uint32 -from chia.consensus.generator_tools import get_block_header from chia.consensus.get_block_challenge import prev_t...
chia/_tests/core/full_node/test_prev_tx_block.py
0
Python
1
none
16
51
51
true
prev_tx_before_sp
20,235
Chia-Network/chia-blockchain
10,822
Python
almogdepaz
Review this pull request change. Language: Python File: chia/_tests/core/full_node/test_prev_tx_block.py PR Title: prev_tx_before_sp BEFORE CODE: ) _, _, blocks = load_block_list(block_list, bt.constants) block = block_list[-1] latest_tx_before_sp = find_tx_before_sp(block_list) assert latest_tx...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
async def get_block_spends_with_conditions(self, request: dict[str, Any]) -> EndpointResult: if "header_hash" not in request: raise ValueError("No header_hash in request") header_hash = bytes32.from_hexstr(request["header_hash"]) full_block: Optional[FullBlock] = await self.servi...
No issues found.
async def get_block_spends_with_conditions(self, request: dict[str, Any]) -> EndpointResult: if "header_hash" not in request: raise ValueError("No header_hash in request") header_hash = bytes32.from_hexstr(request["header_hash"]) full_block: Optional[FullBlock] = await self.servi...
@@ -24,6 +24,7 @@ from chia_rs.sized_ints import uint32, uint64, uint128 from chia.consensus.blockchain import Blockchain, BlockchainMutexPriority +from chia.consensus.get_block_challenge import pre_sp_tx_block_height from chia.consensus.get_block_generator import get_block_generator from chia.consensus.pos_quali...
chia/full_node/full_node_rpc_api.py
0
Python
1
none
16
51
51
true
make sure to pass in the correct previous transaction block height
20,237
Chia-Network/chia-blockchain
10,822
Python
arvidn
Review this pull request change. Language: Python File: chia/full_node/full_node_rpc_api.py PR Title: make sure to pass in the correct previous transaction block height BEFORE CODE: async def get_block_spends_with_conditions(self, request: dict[str, Any]) -> EndpointResult: if "header_hash" not in reque...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
if connection.connection_type != NodeType.FARMER: raise InvalidConnectionTypeError(connection.connection_type, NodeType.HARVESTER) self._connection = connection def bump_next_message_id(self) -> None: self._next_message_id = uint64(self._next_message_id + 1) def _reset(self...
No issues found.
if connection.connection_type != NodeType.FARMER: raise InvalidConnectionTypeError(connection.connection_type, NodeType.HARVESTER) self._connection = connection def bump_next_message_id(self) -> None: self._next_message_id = uint64(self._next_message_id + 1) def _reset(self...
@@ -9,7 +9,7 @@ from pathlib import Path from typing import Any, Generic, Optional, TypeVar -from chia_rs.sized_ints import int16, uint32, uint64 +from chia_rs.sized_ints import int16, uint8, uint32, uint64 from typing_extensions import Protocol from chia.plot_sync.exceptions import AlreadyStartedError, Invalid...
chia/plot_sync/sender.py
0
Python
1
none
16
51
51
true
[CHIA-3566] improve v2-plot support in plot-sync
20,238
Chia-Network/chia-blockchain
10,822
Python
arvidn
Review this pull request change. Language: Python File: chia/plot_sync/sender.py PR Title: [CHIA-3566] improve v2-plot support in plot-sync BEFORE CODE: if connection.connection_type != NodeType.FARMER: raise InvalidConnectionTypeError(connection.connection_type, NodeType.HARVESTER) self...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
) _, _, blocks = load_block_list(block_list, bt.constants) block = block_list[-1] latest_tx_before_sp = find_tx_before_sp(block_list) assert latest_tx_before_sp is not None assert ( pre_sp_tx_block_height( constants=test_constants, blocks=BlockCache(blocks), ...
No issues found.
) _, _, blocks = load_block_list(block_list, bt.constants) block = block_list[-1] latest_tx_before_sp = find_tx_before_sp(block_list) assert latest_tx_before_sp is not None assert ( pre_sp_tx_block_height( constants=test_constants, blocks=BlockCache(blocks), ...
@@ -5,21 +5,21 @@ from chia_rs import FullBlock from chia_rs.sized_ints import uint8, uint32 -from chia.consensus.get_block_challenge import prev_tx_block +from chia.consensus.get_block_challenge import pre_sp_tx_block_height from chia.simulator.block_tools import BlockTools, load_block_list, test_constants from ...
chia/_tests/core/full_node/test_prev_tx_block.py
0
Python
1
none
16
51
51
true
fix tx block refrences in blocktools
20,239
Chia-Network/chia-blockchain
10,822
Python
almogdepaz
Review this pull request change. Language: Python File: chia/_tests/core/full_node/test_prev_tx_block.py PR Title: fix tx block refrences in blocktools BEFORE CODE: ) _, _, blocks = load_block_list(block_list, bt.constants) block = block_list[-1] latest_tx_before_sp = find_tx_before_sp(block_list) ...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
latest_block.deficit if latest_block.deficit > 0 else constants.MIN_BLOCKS_PER_CHALLENGE_BLOCK ) icc_eos_vdf, icc_ip_proof = get_icc( constants, uint128(sub_slot_start_total_iters + sub_slot_iters), finished_sub_slots_at_ip, ...
No issues found.
latest_block.deficit if latest_block.deficit > 0 else constants.MIN_BLOCKS_PER_CHALLENGE_BLOCK ) icc_eos_vdf, icc_ip_proof = get_icc( constants, uint128(sub_slot_start_total_iters + sub_slot_iters), finished_sub_slots_at_ip, ...
@@ -99,6 +99,7 @@ generate_taproot_sk, is_v1_phased_out, make_pos, + num_phase_out_epochs, passes_plot_filter, ) from chia.types.blockchain_format.serialized_program import SerializedProgram @@ -1559,6 +1560,9 @@ def get_pospaces_for_challenge( rng = random.Random() rng.seed(s...
chia/simulator/block_tools.py
0
Python
1
none
16
51
51
true
Tweak phase out
20,258
Chia-Network/chia-blockchain
10,822
Python
arvidn
Review this pull request change. Language: Python File: chia/simulator/block_tools.py PR Title: Tweak phase out BEFORE CODE: latest_block.deficit if latest_block.deficit > 0 else constants.MIN_BLOCKS_PER_CHALLENGE_BLOCK ) icc_eos_vdf, icc_ip_proof = get_icc( c...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
epoch_counter = (v1_cut_off_height(constants) - prev_transaction_block_height) // constants.EPOCH_BLOCKS # if we're past the phase-out, v1 plots are unconditionally invalid if epoch_counter < 0: return True proof_value = std_hash(proof + b"chia proof-of-space v1 phase-out")[0] & phase_out_epoc...
No issues found.
epoch_counter = (v1_cut_off_height(constants) - prev_transaction_block_height) // constants.EPOCH_BLOCKS # if we're past the phase-out, v1 plots are unconditionally invalid if epoch_counter < 0: return True proof_value = std_hash(proof + b"chia proof-of-space v1 phase-out")[0] & phase_out_epoc...
@@ -131,16 +131,18 @@ def verify_and_get_quality_string( *, height: uint32, prev_transaction_block_height: uint32, # this is the height of the last tx block before the current block SP + height_agnostic: bool = False, ) -> bytes32 | None: plot_param = pos.param() - if plot_param.size_v1 is...
chia/types/blockchain_format/proof_of_space.py
0
Python
1
none
16
51
51
true
relax PoS validation in weight proofs
20,298
Chia-Network/chia-blockchain
10,822
Python
arvidn
Review this pull request change. Language: Python File: chia/types/blockchain_format/proof_of_space.py PR Title: relax PoS validation in weight proofs BEFORE CODE: epoch_counter = (v1_cut_off_height(constants) - prev_transaction_block_height) // constants.EPOCH_BLOCKS # if we're past the phase-out, v1 plot...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
assert block.reward_chain_block.signage_point_index == 0 signage_point = original_challenge_hash else: signage_point = block.reward_chain_block.challenge_chain_sp_vdf.output.get_hash() if passes_plot_filter(filter_prefix_bits, plot_id, original_challenge_hash, signage...
No issues found.
assert block.reward_chain_block.signage_point_index == 0 signage_point = original_challenge_hash else: signage_point = block.reward_chain_block.challenge_chain_sp_vdf.output.get_hash() if passes_plot_filter(filter_prefix_bits, plot_id, original_challenge_hash, signage...
@@ -55,33 +55,33 @@ async def farmer_harvester_with_filter_size_9( async def have_connections() -> bool: return len(await farmer_rpc_cl.get_connections()) > 0 - local_b_tools = await create_block_tools_async( + async with create_block_tools_async( constants=test_constants.replace(NUMBER_Z...
chia/_tests/farmer_harvester/test_filter_prefix_bits.py
0
Python
1
none
16
51
51
true
context manager for BlockTools
20,326
Chia-Network/chia-blockchain
10,822
Python
emlowe
Review this pull request change. Language: Python File: chia/_tests/farmer_harvester/test_filter_prefix_bits.py PR Title: context manager for BlockTools BEFORE CODE: assert block.reward_chain_block.signage_point_index == 0 signage_point = original_challenge_hash else: sig...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
resulting_txs = [] for _ in range(total_txs): resulting_txs.append(await transaction_queue.pop()) @pytest.mark.anyio async def test_queue_cleanup_and_fairness(seeded_random: random.Random) -> None: transaction_queue = TransactionQueue(1000, log, max_tx_clvm_cost=TEST_MAX_TX_CLVM_COST) peer_a =...
No issues found.
resulting_txs = [] for _ in range(total_txs): resulting_txs.append(await transaction_queue.pop()) @pytest.mark.anyio async def test_queue_cleanup_and_fairness(seeded_random: random.Random) -> None: transaction_queue = TransactionQueue(1000, log, max_tx_clvm_cost=TEST_MAX_TX_CLVM_COST) peer_a =...
@@ -13,10 +13,13 @@ from chia_rs.sized_ints import uint64 from chia.full_node.tx_processing_queue import PeerWithTx, TransactionQueue, TransactionQueueEntry, TransactionQueueFull +from chia.simulator.block_tools import test_constants from chia.util.task_referencer import create_referenced_task log = logging.get...
chia/_tests/core/full_node/test_tx_processing_queue.py
0
Python
1
none
16
51
51
true
CHIA-3856 Use an adapted version of deficit round robin algorithm in TransactionQueue's pop
20,351
Chia-Network/chia-blockchain
10,822
Python
AmineKhaldi
Review this pull request change. Language: Python File: chia/_tests/core/full_node/test_tx_processing_queue.py PR Title: CHIA-3856 Use an adapted version of deficit round robin algorithm in TransactionQueue's pop BEFORE CODE: resulting_txs = [] for _ in range(total_txs): resulting_txs.append(await t...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
with pytest.raises(ValueError, match=re.escape(Err.GENERATOR_REF_HAS_NO_GENERATOR.name)): await abc.lookup_block_generators(blocks[10].header_hash, {uint32(3), uint32(10)}) # block 1 exists in the chain, but it doesn't have a generator with pytest.raises(ValueError, match=re.escape(Err.GENERATOR_R...
No issues found.
with pytest.raises(ValueError, match=re.escape(Err.GENERATOR_REF_HAS_NO_GENERATOR.name)): await abc.lookup_block_generators(blocks[10].header_hash, {uint32(3), uint32(10)}) # block 1 exists in the chain, but it doesn't have a generator with pytest.raises(ValueError, match=re.escape(Err.GENERATOR_R...
@@ -11,7 +11,7 @@ from chia._tests.blockchain.blockchain_test_utils import _validate_and_add_block from chia._tests.util.blockchain import create_blockchain -from chia.consensus.augmented_chain import AugmentedBlockchain +from chia.consensus.augmented_chain import AugmentedBlockchain, AugmentedBlockchainValidationE...
chia/_tests/blockchain/test_augmented_chain.py
0
Python
1
none
16
51
51
true
Augmented usage fix
20,361
Chia-Network/chia-blockchain
10,822
Python
almogdepaz
Review this pull request change. Language: Python File: chia/_tests/blockchain/test_augmented_chain.py PR Title: Augmented usage fix BEFORE CODE: with pytest.raises(ValueError, match=re.escape(Err.GENERATOR_REF_HAS_NO_GENERATOR.name)): await abc.lookup_block_generators(blocks[10].header_hash, {uint32(3...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
The total number of reward mojos farmed to the requested address. """ if isinstance(timeout, _Default): timeout = (count + 1) * timeout_per_block timeout += 15 with anyio.fail_after(delay=adjusted_timeout(timeout)): if count == 0: ...
No issues found.
The total number of reward mojos farmed to the requested address. """ if isinstance(timeout, _Default): timeout = (count + 1) * timeout_per_block timeout += 15 with anyio.fail_after(delay=adjusted_timeout(timeout)): if count == 0: ...
@@ -236,17 +236,12 @@ async def farm_new_transaction_block( current_blocks = await self.get_all_full_blocks() target = request.puzzle_hash - pool_target: bytes32 | None = target - if current_blocks[-1].height >= self.full_node.constants.HARD_FORK2_HEIGHT - 1: - ...
chia/simulator/full_node_simulator.py
0
Python
1
none
16
51
51
true
Explore bringing back v2 plot pool keys support
20,388
Chia-Network/chia-blockchain
10,822
Python
AmineKhaldi
Review this pull request change. Language: Python File: chia/simulator/full_node_simulator.py PR Title: Explore bringing back v2 plot pool keys support BEFORE CODE: The total number of reward mojos farmed to the requested address. """ if isinstance(timeout, _Default): timeout...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
def add_block_record(self, block_record: BlockRecord) -> None: self.add_block(block_record) @pytest.mark.anyio async def test_get_flags_outside_transition_period(bt: BlockTools) -> None: """Test get_flags when block is outside the transition period.""" block_list = bt.get_consecutive_blocks( ...
No issues found.
def add_block_record(self, block_record: BlockRecord) -> None: self.add_block(block_record) @pytest.mark.anyio async def test_get_flags_outside_transition_period(bt: BlockTools) -> None: """Test get_flags when block is outside the transition period.""" block_list = bt.get_consecutive_blocks( ...
@@ -0,0 +1,92 @@ +from __future__ import annotations + +import pytest +from chia_rs import BlockRecord, get_flags_for_height_and_constants +from chia_rs.sized_bytes import bytes32 +from chia_rs.sized_ints import uint32 + +from chia.consensus.get_block_challenge import pre_sp_tx_block_height +from chia.full_node.hard_fo...
chia/_tests/core/full_node/test_hard_fork_utils.py
0
Python
1
none
16
51
51
true
get_flags, fix pre_sp_tx_block, test CHIA-3861
20,400
Chia-Network/chia-blockchain
10,822
Python
almogdepaz
Review this pull request change. Language: Python File: chia/_tests/core/full_node/test_hard_fork_utils.py PR Title: get_flags, fix pre_sp_tx_block, test CHIA-3861 BEFORE CODE: def add_block_record(self, block_record: BlockRecord) -> None: self.add_block(block_record) @pytest.mark.anyio async def te...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
blocks = bt.get_consecutive_blocks(3, guarantee_transaction_block=True) for block in blocks: await full_node_1.full_node.add_block(block) coin = blocks[-1].get_included_reward_coins()[0] puzzle_hash = wallet_receiver.get_new_puzzlehash() peer = await connect_and_get_peer(server_1, server_2,...
No issues found.
blocks = bt.get_consecutive_blocks(3, guarantee_transaction_block=True) for block in blocks: await full_node_1.full_node.add_block(block) coin = blocks[-1].get_included_reward_coins()[0] puzzle_hash = wallet_receiver.get_new_puzzlehash() peer = await connect_and_get_peer(server_1, server_2,...
@@ -2120,25 +2120,6 @@ async def test_compact_protocol( @pytest.mark.anyio -# TODO: todo_v2_plots this test is failing for HARD_FORK_3_0 for some reason. -# Investigate, fix and remove this limit_consensus_modes() -# this is the failure: -# chia/_tests/core/full_node/test_full_node.py:2184: in test_compact_protoco...
chia/_tests/core/full_node/test_full_node.py
0
Python
1
none
16
51
51
true
fix tests
20,457
Chia-Network/chia-blockchain
10,822
Python
almogdepaz
Review this pull request change. Language: Python File: chia/_tests/core/full_node/test_full_node.py PR Title: fix tests BEFORE CODE: blocks = bt.get_consecutive_blocks(3, guarantee_transaction_block=True) for block in blocks: await full_node_1.full_node.add_block(block) coin = blocks[-1].get_in...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
from __future__ import annotations import random from time import perf_counter from chia._tests.util.test_full_block_utils import get_full_blocks random.seed(123456789) def main() -> None: total_time = 0.0 counter = 0 for shard in [0, 1, 2, 3]: for block in get_full_blocks(shard): s...
No issues found.
from __future__ import annotations import random from time import perf_counter from chia._tests.util.test_full_block_utils import get_full_blocks random.seed(123456789) def main() -> None: total_time = 0.0 counter = 0 for shard in [0, 1, 2, 3]: for block in get_full_blocks(shard): s...
@@ -11,12 +11,13 @@ def main() -> None: total_time = 0.0 counter = 0 - for block in get_full_blocks(): - start = perf_counter() - block.to_json_dict() - end = perf_counter() - total_time += end - start - counter += 1 + for shard in [0, 1, 2, 3]: + for block in ...
benchmarks/jsonify.py
0
Python
1
none
16
27
27
true
update the fast FullBlock parser
20,458
Chia-Network/chia-blockchain
10,822
Python
arvidn
Review this pull request change. Language: Python File: benchmarks/jsonify.py PR Title: update the fast FullBlock parser BEFORE CODE: from __future__ import annotations import random from time import perf_counter from chia._tests.util.test_full_block_utils import get_full_blocks random.seed(123456789) def main...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
) -> None: full_node_1, _full_node_2, server_1, server_2, wallet_a, wallet_receiver, bt = wallet_nodes blocks = await full_node_1.get_all_full_blocks() blocks = bt.get_consecutive_blocks(3, guarantee_transaction_block=True) for block in blocks: await full_node_1.full_node.add_block(block) co...
No issues found.
) -> None: full_node_1, _full_node_2, server_1, server_2, wallet_a, wallet_receiver, bt = wallet_nodes blocks = await full_node_1.get_all_full_blocks() blocks = bt.get_consecutive_blocks(3, guarantee_transaction_block=True) for block in blocks: await full_node_1.full_node.add_block(block) co...
@@ -95,6 +95,7 @@ ) from chia.types.blockchain_format.serialized_program import SerializedProgram from chia.types.blockchain_format.vdf import CompressibleVDFField, VDFProof +from chia.types.clvm_cost import QUOTE_BYTES, QUOTE_EXECUTION_COST from chia.types.coin_spend import make_spend from chia.types.condition_op...
chia/_tests/core/full_node/test_full_node.py
0
Python
1
none
16
51
51
true
CHIA-3883 Tolerate quote related cost mismatch for older nodes
20,460
Chia-Network/chia-blockchain
10,822
Python
AmineKhaldi
Review this pull request change. Language: Python File: chia/_tests/core/full_node/test_full_node.py PR Title: CHIA-3883 Tolerate quote related cost mismatch for older nodes BEFORE CODE: ) -> None: full_node_1, _full_node_2, server_1, server_2, wallet_a, wallet_receiver, bt = wallet_nodes blocks = await ful...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
# the "best" unfinished block according to the metric we use to pick one # deterministically best_unf: UnfinishedBlock | None = None for idx in range(6): # we include a different transaction in each block. This makes the # foliage different in each of them, but the reward block (plot) ...
No issues found.
# the "best" unfinished block according to the metric we use to pick one # deterministically best_unf: UnfinishedBlock | None = None for idx in range(6): # we include a different transaction in each block. This makes the # foliage different in each of them, but the reward block (plot) ...
@@ -67,7 +67,7 @@ from chia.protocols.outbound_message import Message, NodeType, make_msg from chia.protocols.protocol_message_types import ProtocolMessageTypes from chia.protocols.shared_protocol import Capability, default_capabilities -from chia.protocols.wallet_protocol import SendTransaction, TransactionAck +fro...
chia/_tests/core/full_node/test_full_node.py
0
Python
1
none
16
51
51
true
CHIA-3887 Skip fetching additions and removals for non transaction blocks in FullNodeAPI's request_header_blocks
20,470
Chia-Network/chia-blockchain
10,822
Python
AmineKhaldi
Review this pull request change. Language: Python File: chia/_tests/core/full_node/test_full_node.py PR Title: CHIA-3887 Skip fetching additions and removals for non transaction blocks in FullNodeAPI's request_header_blocks BEFORE CODE: # the "best" unfinished block according to the metric we use to pick one ...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
@pytest.mark.parametrize(argnames="capacity", argvalues=[-10, -1, 0, 1, 5, 10]) def test_get_capacity(capacity: int) -> None: cache: LRUCache[object, object] = LRUCache(capacity=capacity) assert cache.get_capacity() == capacity class TestLRUSet: def test_put_and_contains(self) -> None: s: LRUSet[...
No issues found.
@pytest.mark.parametrize(argnames="capacity", argvalues=[-10, -1, 0, 1, 5, 10]) def test_get_capacity(capacity: int) -> None: cache: LRUCache[object, object] = LRUCache(capacity=capacity) assert cache.get_capacity() == capacity class TestLRUSet: def test_put_and_contains(self) -> None: s: LRUSet[...
@@ -4,7 +4,7 @@ import pytest -from chia.util.lru_cache import LRUCache +from chia.util.lru_cache import LRUCache, LRUSet class TestLRUCache(unittest.TestCase): @@ -70,3 +70,114 @@ def test_with_zero_capacity(capacity: int) -> None: def test_get_capacity(capacity: int) -> None: cache: LRUCache[object, o...
chia/_tests/core/util/test_lru_cache.py
0
Python
1
none
16
51
51
true
reject unsolicited RespondCompactVDF messages
20,531
Chia-Network/chia-blockchain
10,822
Python
arvidn
Review this pull request change. Language: Python File: chia/_tests/core/util/test_lru_cache.py PR Title: reject unsolicited RespondCompactVDF messages BEFORE CODE: @pytest.mark.parametrize(argnames="capacity", argvalues=[-10, -1, 0, 1, 5, 10]) def test_get_capacity(capacity: int) -> None: cache: LRUCache[obje...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
difficulty = uint64(peak.weight - self.full_node.blockchain.block_record(peak.prev_hash).weight) sub_slot_iters = peak.sub_slot_iters for sub_slot in finished_sub_slots: if sub_slot.challenge_chain.new_difficulty is not None: di...
No issues found.
difficulty = uint64(peak.weight - self.full_node.blockchain.block_record(peak.prev_hash).weight) sub_slot_iters = peak.sub_slot_iters for sub_slot in finished_sub_slots: if sub_slot.challenge_chain.new_difficulty is not None: di...
@@ -83,6 +83,9 @@ else: FullNode = object +MAX_COIN_HASHES_PER_REQUEST = 50 +MAX_COINS_MAP_SIZE = 100 + async def tx_request_and_timeout(full_node: FullNode, transaction_id: bytes32, task_id: bytes32) -> None: """ @@ -1303,18 +1306,31 @@ async def request_block_header(self, request: wallet_protocol.Requ...
chia/full_node/full_node_api.py
0
Python
1
none
16
51
51
true
[CHIA-3935] return RejectAdditionsRequest to wallets instead of raising an exception
20,555
Chia-Network/chia-blockchain
10,822
Python
arvidn
Review this pull request change. Language: Python File: chia/full_node/full_node_api.py PR Title: [CHIA-3935] return RejectAdditionsRequest to wallets instead of raising an exception BEFORE CODE: difficulty = uint64(peak.weight - self.full_node.blockchain.block_record(peak.prev_hash).weight) ...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
fnp.RequestUnfinishedBlock2(unf.partial_hash, unf.foliage.foliage_transaction_block_hash) ) assert res is not None assert res.data == bytes(fnp.RespondUnfinishedBlock(unf)) res = await full_node_1.request_unfinished_block(fnp.RequestUnfinishedBlock(unf.partial_hash)) ...
No issues found.
fnp.RequestUnfinishedBlock2(unf.partial_hash, unf.foliage.foliage_transaction_block_hash) ) assert res is not None assert res.data == bytes(fnp.RespondUnfinishedBlock(unf)) res = await full_node_1.request_unfinished_block(fnp.RequestUnfinishedBlock(unf.partial_hash)) ...
@@ -3655,3 +3655,18 @@ async def test_request_header_blocks_non_tx_block( assert msg is not None response = RespondHeaderBlocks.from_bytes(msg.data) assert len(response.header_blocks) == 2 + + +@pytest.mark.anyio +@pytest.mark.limit_consensus_modes(allowed=[ConsensusMode.HARD_FORK_2_0], reason="irrelevan...
chia/_tests/core/full_node/test_full_node.py
0
Python
1
none
16
51
51
true
CHIA-3905 Improve nodes message typechecking
20,556
Chia-Network/chia-blockchain
10,822
Python
AmineKhaldi
Review this pull request change. Language: Python File: chia/_tests/core/full_node/test_full_node.py PR Title: CHIA-3905 Improve nodes message typechecking BEFORE CODE: fnp.RequestUnfinishedBlock2(unf.partial_hash, unf.foliage.foliage_transaction_block_hash) ) assert res is not None ...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
self_hostname: str, ) -> None: full_node_1, full_node_2, server_1, server_2, _wallet_a, _wallet_receiver, bt = wallet_nodes blocks = await full_node_1.get_all_full_blocks() blocks = bt.get_consecutive_blocks(3, block_list_input=blocks, skip_slots=2) await full_node_1.full_node.add_block(blocks[-3])...
No issues found.
self_hostname: str, ) -> None: full_node_1, full_node_2, server_1, server_2, _wallet_a, _wallet_receiver, bt = wallet_nodes blocks = await full_node_1.get_all_full_blocks() blocks = bt.get_consecutive_blocks(3, block_list_input=blocks, skip_slots=2) await full_node_1.full_node.add_block(blocks[-3])...
@@ -3659,14 +3659,51 @@ async def test_request_header_blocks_non_tx_block( @pytest.mark.anyio @pytest.mark.limit_consensus_modes(allowed=[ConsensusMode.HARD_FORK_2_0], reason="irrelevant") -@pytest.mark.parametrize("node_type", NodeType) +@pytest.mark.parametrize( + "node_type", + [NodeType.FULL_NODE, NodeTyp...
chia/_tests/core/full_node/test_full_node.py
0
Python
1
none
16
51
51
true
CHIA-3906 Improve accept_inbound_connections
20,557
Chia-Network/chia-blockchain
10,822
Python
AmineKhaldi
Review this pull request change. Language: Python File: chia/_tests/core/full_node/test_full_node.py PR Title: CHIA-3906 Improve accept_inbound_connections BEFORE CODE: self_hostname: str, ) -> None: full_node_1, full_node_2, server_1, server_2, _wallet_a, _wallet_receiver, bt = wallet_nodes blocks = aw...
No issues found.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
self.windowController = windowController self.workspace = workspace } var windowController: NSWindowController var tabBarHeight = 28.0 private var path: String = "" @ObservedObject var workspace: WorkspaceDocument @State private var showingAlert = false @State private var ...
using fixed values worries me a little bit... maybe 250 it's low and not that much but we should definitely put this value inside a constant that maybe is injected upon initalization?
self.windowController = windowController self.workspace = workspace } var windowController: NSWindowController var tabBarHeight = 28.0 private var path: String = "" @ObservedObject var workspace: WorkspaceDocument @State private var showingAlert = false @State private var ...
@@ -23,15 +23,20 @@ struct WorkspaceView: View { @State private var showingAlert = false @State private var alertTitle = "" @State private var alertMsg = "" + @State var showInspector = true var body: some View { NavigationView { if workspace.workspaceClient != nil { - ...
CodeEdit/WorkspaceView.swift
26
Swift
0.571
question
184
47
51
false
Placeholder Inspector Sidebar
141
CodeEditApp/CodeEdit
18,361
Swift
MarcoCarnevali
austincondiff
Review this pull request change. Language: Swift File: CodeEdit/WorkspaceView.swift PR Title: Placeholder Inspector Sidebar BEFORE CODE: self.windowController = windowController self.workspace = workspace } var windowController: NSWindowController var tabBarHeight = 28.0 private var...
using fixed values worries me a little bit... maybe 250 it's low and not that much but we should definitely put this value inside a constant that maybe is injected upon initalization?
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
], path: "Modules/StatusBar/src" ), .target( name: "Overlays", path: "Modules/Overlays/src" ), .target( name: "GitClient", path: "Modules/GitClient/src" ), .target( name: "TerminalEmulator", depe...
You probably need to uncomment this so tests pass. ![Screen Shot 2022-03-25 at 03 21 38](https://user-images.githubusercontent.com/9460130/160041937-210e940e-5ce0-4bdb-9f73-19477dc751c6.png)
name: "CodeEditKit", url: "https://github.com/CodeEditApp/CodeEditKit", branch: "main" ), .package( name: "Light-Swift-Untar", url: "https://github.com/Light-Untar/Light-Swift-Untar", from: "1.0.4" ), .package( ...
@@ -127,6 +131,11 @@ let package = Package( "WorkspaceClient" ], path: "Modules/Search/src" + ), + .target( + name: "GitClone", +// dependencies: ["GitClient"],
CodeEditModules/Package.swift
26
Swift
0.429
suggestion
195
31
51
false
Add functionality for cloning from git in welcome view
232
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
Pythonen
Review this pull request change. Language: Swift File: CodeEditModules/Package.swift PR Title: Add functionality for cloning from git in welcome view BEFORE CODE: ], path: "Modules/StatusBar/src" ), .target( name: "Overlays", path: "Modules/Overlays/src" ), ...
You probably need to uncomment this so tests pass. ![Screen Shot 2022-03-25 at 03 21 38](https://user-images.githubusercontent.com/9460130/160041937-210e940e-5ce0-4bdb-9f73-19477dc751c6.png)
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
// // GitCloneView.swift // CodeEdit // // Created by Aleksi Puttonen on 23.3.2022. // import SwiftUI import GitClient import Foundation import ShellClient public struct GitCloneView: View { var shellClient: ShellClient @Binding var isPresented: Bool @State private var repoUrlStr = "" @State privat...
nit: this can be a private _let_
// // GitCloneView.swift // CodeEdit // // Created by Aleksi Puttonen on 23.3.2022. // import SwiftUI import GitClient import Foundation import ShellClient public struct GitCloneView: View { private let shellClient: ShellClient @Binding private var isPresented: Bool @State private var repoUrlStr = "" ...
@@ -0,0 +1,164 @@ +// +// GitCloneView.swift +// CodeEdit +// +// Created by Aleksi Puttonen on 23.3.2022. +// + +import SwiftUI +import GitClient +import Foundation +import ShellClient + +public struct GitCloneView: View { + var shellClient: ShellClient
CodeEditModules/Modules/GitClone/src/GitCloneView.swift
14
Swift
0.071
nitpick
32
39
39
false
Add functionality for cloning from git in welcome view
232
CodeEditApp/CodeEdit
18,361
Swift
MarcoCarnevali
Pythonen
Review this pull request change. Language: Swift File: CodeEditModules/Modules/GitClone/src/GitCloneView.swift PR Title: Add functionality for cloning from git in welcome view BEFORE CODE: // // GitCloneView.swift // CodeEdit // // Created by Aleksi Puttonen on 23.3.2022. // import SwiftUI import GitClient impo...
nit: this can be a private _let_
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
.bold() .padding(.bottom, 2) Text("Enter a git repository URL:") .font(.system(size: 11)) .foregroundColor(.secondary) .alignmentGuide(.trailing) { context in ...
let's try to avoid force unwrapping, an _if let_ should work good here
.bold() .padding(.bottom, 2) Text("Enter a git repository URL:") .font(.system(size: 11)) .foregroundColor(.secondary) .alignmentGuide(.trailing) { context in ...
@@ -0,0 +1,164 @@ +// +// GitCloneView.swift +// CodeEdit +// +// Created by Aleksi Puttonen on 23.3.2022. +// + +import SwiftUI +import GitClient +import Foundation +import ShellClient + +public struct GitCloneView: View { + var shellClient: ShellClient + @Binding var isPresented: Bool + @State private var...
CodeEditModules/Modules/GitClone/src/GitCloneView.swift
26
Swift
0.286
suggestion
70
51
51
false
Add functionality for cloning from git in welcome view
232
CodeEditApp/CodeEdit
18,361
Swift
MarcoCarnevali
Pythonen
Review this pull request change. Language: Swift File: CodeEditModules/Modules/GitClone/src/GitCloneView.swift PR Title: Add functionality for cloning from git in welcome view BEFORE CODE: .bold() .padding(.bottom, 2) Text("Enter a git repository U...
let's try to avoid force unwrapping, an _if let_ should work good here
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
} TextField("Git Repository URL", text: $repoUrlStr) .lineLimit(1) .padding(.bottom, 15) .frame(width: 300) HStack { Button("Cancel") { ...
nit: better to use guards in this case
} TextField("Git Repository URL", text: $repoUrlStr) .lineLimit(1) .padding(.bottom, 15) .frame(width: 300) HStack { Button("Cancel") { ...
@@ -0,0 +1,164 @@ +// +// GitCloneView.swift +// CodeEdit +// +// Created by Aleksi Puttonen on 23.3.2022. +// + +import SwiftUI +import GitClient +import Foundation +import ShellClient + +public struct GitCloneView: View { + var shellClient: ShellClient + @Binding var isPresented: Bool + @State private var...
CodeEditModules/Modules/GitClone/src/GitCloneView.swift
26
Swift
0.143
suggestion
38
51
51
false
Add functionality for cloning from git in welcome view
232
CodeEditApp/CodeEdit
18,361
Swift
MarcoCarnevali
Pythonen
Review this pull request change. Language: Swift File: CodeEditModules/Modules/GitClone/src/GitCloneView.swift PR Title: Add functionality for cloning from git in welcome view BEFORE CODE: } TextField("Git Repository URL", text: $repoUrlStr) .lineLimit...
nit: better to use guards in this case
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
showAlert(alertMsg: "Url cannot be empty", infoText: "You must specify a repository to clone") return } // Parsing repo name ...
let's try to avoid force unwrapping
.keyboardShortcut(.defaultAction) .disabled(!isValid(url: repoUrlStr)) } .offset(x: 185) .alignmentGuide(.leading) { context in context[.leading] } } ...
@@ -0,0 +1,164 @@ +// +// GitCloneView.swift +// CodeEdit +// +// Created by Aleksi Puttonen on 23.3.2022. +// + +import SwiftUI +import GitClient +import Foundation +import ShellClient + +public struct GitCloneView: View { + var shellClient: ShellClient + @Binding var isPresented: Bool + @State private var...
CodeEditModules/Modules/GitClone/src/GitCloneView.swift
26
Swift
0.143
suggestion
35
51
51
false
Add functionality for cloning from git in welcome view
232
CodeEditApp/CodeEdit
18,361
Swift
MarcoCarnevali
Pythonen
Review this pull request change. Language: Swift File: CodeEditModules/Modules/GitClone/src/GitCloneView.swift PR Title: Add functionality for cloning from git in welcome view BEFORE CODE: showAlert(alertMsg: "Url cannot be empty", in...
let's try to avoid force unwrapping
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
VStack(spacing: 8) { HStack { Image(nsImage: NSApp.applicationIconImage) .resizable() .frame(width: 64, height: 64) .padding(.bottom, 50) VStack(alignment: .leading) { Text("Clone an exist...
move the logic to a `private func`
VStack(spacing: 8) { HStack { Image(nsImage: NSApp.applicationIconImage) .resizable() .frame(width: 64, height: 64) .padding(.bottom, 50) VStack(alignment: .leading) { Text("Clone an exist...
@@ -0,0 +1,168 @@ +// +// GitCloneView.swift +// CodeEdit +// +// Created by Aleksi Puttonen on 23.3.2022. +// + +import SwiftUI +import GitClient +import Foundation +import ShellClient + +public struct GitCloneView: View { + private let shellClient: ShellClient + @Binding private var isPresented: Bool + @S...
CodeEditModules/Modules/GitClone/src/GitCloneView.swift
26
Swift
0.286
suggestion
35
51
51
false
Add functionality for cloning from git in welcome view
232
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
Pythonen
Review this pull request change. Language: Swift File: CodeEditModules/Modules/GitClone/src/GitCloneView.swift PR Title: Add functionality for cloning from git in welcome view BEFORE CODE: VStack(spacing: 8) { HStack { Image(nsImage: NSApp.applicationIconImage) ...
move the logic to a `private func`
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
} private var appVersion: String { return Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "" } private var appBuild: String { return Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") as? String ?? "" } private var macOsVersion...
Please no exit, it there is no version number display nothing.
} private var appVersion: String { return Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "" } private var appBuild: String { return Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") as? String ?? "" } private var macOsVersion: St...
@@ -42,6 +42,27 @@ struct WelcomeView: View { private var appBuild: String { return Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") as? String ?? "" } + + private var macOsVersion: String { + let osVersion = ProcessInfo.processInfo.operatingSystemVersion + return "\(o...
CodeEdit/Welcome/WelcomeView.swift
26
Swift
0.214
suggestion
62
51
51
false
Add copy info
275
CodeEditApp/CodeEdit
18,361
Swift
0xWDG
Angelk90
Review this pull request change. Language: Swift File: CodeEdit/Welcome/WelcomeView.swift PR Title: Add copy info BEFORE CODE: } private var appVersion: String { return Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "" } private var appBuild: String { ...
Please no exit, it there is no version number display nothing.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
}) .buttonStyle(PlainButtonStyle()) .accessibilityLabel(Text("Close")) .onHover { hover in isHoveringClose = hover } } private var appVersion: String { return Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "" ...
If Xcode is not installed, that’s no reason for a exit/crash
}) .buttonStyle(PlainButtonStyle()) .accessibilityLabel(Text("Close")) .onHover { hover in isHoveringClose = hover } } private var appVersion: String { return Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "" ...
@@ -42,6 +42,27 @@ struct WelcomeView: View { private var appBuild: String { return Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") as? String ?? "" } + + private var macOsVersion: String { + let osVersion = ProcessInfo.processInfo.operatingSystemVersion + return "\(o...
CodeEdit/Welcome/WelcomeView.swift
26
Swift
0.214
bug
60
51
51
false
Add copy info
275
CodeEditApp/CodeEdit
18,361
Swift
0xWDG
Angelk90
Review this pull request change. Language: Swift File: CodeEdit/Welcome/WelcomeView.swift PR Title: Add copy info BEFORE CODE: }) .buttonStyle(PlainButtonStyle()) .accessibilityLabel(Text("Close")) .onHover { hover in isHoveringClose = hover } } private v...
If Xcode is not installed, that’s no reason for a exit/crash
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
) }, message: { Text(alertMsg) }) .onChange(of: workspace.selectionState.selectedId) { newValue in if newValue == nil { windowController.window?.subtitle = "" } } } @ViewBuilder private var content: some View { LeadingSidebar(workspace...
`minWidth` should be larger. (see Xcode)
) }, message: { Text(alertMsg) }) .onChange(of: workspace.selectionState.selectedId) { newValue in if newValue == nil { windowController.window?.subtitle = "" } } } @ViewBuilder private var content: some View { LeadingSidebar(workspace...
@@ -53,18 +53,19 @@ struct WorkspaceView: View { LeadingSidebar(workspace: workspace, windowController: windowController) .frame(minWidth: 250) HSplitView { - ZStack { - WorkspaceCodeFileView(windowController: windowController, - workspace: workspace) - } - .safeAreaInset(edge: .bottom) { -...
CodeEdit/WorkspaceView.swift
26
Swift
0.286
suggestion
40
36
36
false
Improve sizing behaviour code file view and inspector sidebar splitiview
287
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
StefKors
Review this pull request change. Language: Swift File: CodeEdit/WorkspaceView.swift PR Title: Improve sizing behaviour code file view and inspector sidebar splitiview BEFORE CODE: ) }, message: { Text(alertMsg) }) .onChange(of: workspace.selectionState.selectedId) { newValue in ...
`minWidth` should be larger. (see Xcode)
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
} else { EmptyView() } } .frame(minWidth: 1000, minHeight: 600) .alert(alertTitle, isPresented: $showingAlert, actions: { Button( action: { showingAlert = false }, label: { Text("OK") } ) }, m...
change `minWidth` to 500 so the status bar will not clip
} else { EmptyView() } } .frame(minWidth: 1000, minHeight: 600) .alert(alertTitle, isPresented: $showingAlert, actions: { Button( action: { showingAlert = false }, label: { Text("OK") } ) }, m...
@@ -53,18 +53,19 @@ struct WorkspaceView: View { LeadingSidebar(workspace: workspace, windowController: windowController) .frame(minWidth: 250) HSplitView { - ZStack { - WorkspaceCodeFileView(windowController: windowController, - workspace: workspace) - } - .safeAreaInset(edge: .bottom) { -...
CodeEdit/WorkspaceView.swift
26
Swift
0.429
suggestion
56
45
45
false
Improve sizing behaviour code file view and inspector sidebar splitiview
287
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
StefKors
Review this pull request change. Language: Swift File: CodeEdit/WorkspaceView.swift PR Title: Improve sizing behaviour code file view and inspector sidebar splitiview BEFORE CODE: } else { EmptyView() } } .frame(minWidth: 1000, minHeight: 600) .alert(a...
change `minWidth` to 500 so the status bar will not clip
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
case "LICENSE": return "key.fill" case "java": return "cup.and.saucer" case "h": return "h.square" case "m": return "m.square" case "vue": return "v.square" default: ...
use `Color(red: 0.255, green: 0.722, blue: 0.514, opacity: 1.000)` for `vue`
case "LICENSE": return "key.fill" case "java": return "cup.and.saucer" case "h": return "h.square" case "m": return "m.square" case "vue": return "v.square" default: ...
@@ -71,10 +77,12 @@ public extension WorkspaceClient { return .red case "js", "entitlements", "json", "LICENSE": return Color("SidebarYellow") - case "css", "ts", "jsx", "md", "py": + case "css", "ts", "jsx", "md", "py", "h": return ....
CodeEditModules/Modules/WorkspaceClient/src/Model/FileItem.swift
26
Swift
0.429
suggestion
76
51
51
false
Add file icon for .h .m and .vue
295
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
akring
Review this pull request change. Language: Swift File: CodeEditModules/Modules/WorkspaceClient/src/Model/FileItem.swift PR Title: Add file icon for .h .m and .vue BEFORE CODE: case "LICENSE": return "key.fill" case "java": return "cup.and.saucer" c...
use `Color(red: 0.255, green: 0.722, blue: 0.514, opacity: 1.000)` for `vue`
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
return "cup.and.saucer" case "h": return "h.square" case "m": return "m.square" case "vue": return "v.square" default: return "doc" } } public var iconColor: Color...
Use `Color(red: 0.271, green: 0.106, blue: 0.525, opacity: 1.000)` for `m`
return "cup.and.saucer" case "h": return "h.square" case "m": return "m.square" case "vue": return "v.square" default: return "doc" } } public var iconColor: Color...
@@ -71,10 +77,12 @@ public extension WorkspaceClient { return .red case "js", "entitlements", "json", "LICENSE": return Color("SidebarYellow") - case "css", "ts", "jsx", "md", "py": + case "css", "ts", "jsx", "md", "py", "h": return ....
CodeEditModules/Modules/WorkspaceClient/src/Model/FileItem.swift
26
Swift
0.429
suggestion
74
51
51
false
Add file icon for .h .m and .vue
295
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
akring
Review this pull request change. Language: Swift File: CodeEditModules/Modules/WorkspaceClient/src/Model/FileItem.swift PR Title: Add file icon for .h .m and .vue BEFORE CODE: return "cup.and.saucer" case "h": return "h.square" case "m": return...
Use `Color(red: 0.271, green: 0.106, blue: 0.525, opacity: 1.000)` for `m`
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
case "html", "py", "sh": return "chevron.left.forwardslash.chevron.right" case "LICENSE": return "key.fill" case "java": return "cup.and.saucer" case "h": return "h.square" case "m": ...
Use `Color(red: 0.667, green: 0.031, blue: 0.133, opacity: 1.000)` for `h`
case "html", "py", "sh": return "chevron.left.forwardslash.chevron.right" case "LICENSE": return "key.fill" case "java": return "cup.and.saucer" case "h": return "h.square" case "m": ...
@@ -71,10 +77,12 @@ public extension WorkspaceClient { return .red case "js", "entitlements", "json", "LICENSE": return Color("SidebarYellow") - case "css", "ts", "jsx", "md", "py": + case "css", "ts", "jsx", "md", "py", "h":
CodeEditModules/Modules/WorkspaceClient/src/Model/FileItem.swift
26
Swift
0.429
suggestion
74
51
51
false
Add file icon for .h .m and .vue
295
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
akring
Review this pull request change. Language: Swift File: CodeEditModules/Modules/WorkspaceClient/src/Model/FileItem.swift PR Title: Add file icon for .h .m and .vue BEFORE CODE: case "html", "py", "sh": return "chevron.left.forwardslash.chevron.right" case "LICENSE": ...
Use `Color(red: 0.667, green: 0.031, blue: 0.133, opacity: 1.000)` for `h`
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
/// input a backslash (\\) @IBAction func inputBackSlash(_ sender: Any?) { super.insertText( "\\", replacementRange: selectedRange() ) } /// Override of the default context menu in the editor... /// /// This is a basic view without any functionality, onc...
Please make it localized. add `.localized()` and add it to `Localizable.strings`
/// input a backslash (\\) @IBAction func inputBackSlash(_ sender: Any?) { super.insertText( "\\", replacementRange: selectedRange() ) } /// Override of the default context menu in the editor... /// /// This is a basic view without any functionality, onc...
@@ -89,4 +89,156 @@ public class CodeEditorTextView: NSTextView { replacementRange: selectedRange() ) } + + /// input a backslash (\\) + @IBAction func inputBackSlash(_ sender: Any?) { + super.insertText( + "\\", + replacementRange: selectedRange() + ...
CodeEditModules/Modules/CodeFile/src/TextView/CodeEditorTextView.swift
26
Swift
0.357
suggestion
81
51
51
false
Custom Context Menu for Code Editor
334
CodeEditApp/CodeEdit
18,361
Swift
0xWDG
nanashili
Review this pull request change. Language: Swift File: CodeEditModules/Modules/CodeFile/src/TextView/CodeEditorTextView.swift PR Title: Custom Context Menu for Code Editor BEFORE CODE: /// input a backslash (\\) @IBAction func inputBackSlash(_ sender: Any?) { super.insertText( "\\", ...
Please make it localized. add `.localized()` and add it to `Localizable.strings`
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
replacementRange: selectedRange() ) } /// Override of the default context menu in the editor... /// /// This is a basic view without any functionality, once we have most the items built /// we will start connecting the menu items to their respective actions. public override ...
Please make it localized. add `.localized()` and add it to `Localizable.strings`
replacementRange: selectedRange() ) } /// Override of the default context menu in the editor... /// /// This is a basic view without any functionality, once we have most the items built /// we will start connecting the menu items to their respective actions. public override ...
@@ -89,4 +89,156 @@ public class CodeEditorTextView: NSTextView { replacementRange: selectedRange() ) } + + /// input a backslash (\\) + @IBAction func inputBackSlash(_ sender: Any?) { + super.insertText( + "\\", + replacementRange: selectedRange() + ...
CodeEditModules/Modules/CodeFile/src/TextView/CodeEditorTextView.swift
26
Swift
0.357
suggestion
81
51
51
false
Custom Context Menu for Code Editor
334
CodeEditApp/CodeEdit
18,361
Swift
0xWDG
nanashili
Review this pull request change. Language: Swift File: CodeEditModules/Modules/CodeFile/src/TextView/CodeEditorTextView.swift PR Title: Custom Context Menu for Code Editor BEFORE CODE: replacementRange: selectedRange() ) } /// Override of the default context menu in the editor... //...
Please make it localized. add `.localized()` and add it to `Localizable.strings`
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
/// /// This is a basic view without any functionality, once we have most the items built /// we will start connecting the menu items to their respective actions. public override func menu(for event: NSEvent) -> NSMenu? { guard var menu = super.menu(for: event) else { return nil } menu ...
Please make it localized. add `.localized()` and add it to `Localizable.strings`
/// /// This is a basic view without any functionality, once we have most the items built /// we will start connecting the menu items to their respective actions. public override func menu(for event: NSEvent) -> NSMenu? { guard var menu = super.menu(for: event) else { return nil } menu ...
@@ -89,4 +89,156 @@ public class CodeEditorTextView: NSTextView { replacementRange: selectedRange() ) } + + /// input a backslash (\\) + @IBAction func inputBackSlash(_ sender: Any?) { + super.insertText( + "\\", + replacementRange: selectedRange() + ...
CodeEditModules/Modules/CodeFile/src/TextView/CodeEditorTextView.swift
26
Swift
0.357
suggestion
81
51
51
false
Custom Context Menu for Code Editor
334
CodeEditApp/CodeEdit
18,361
Swift
0xWDG
nanashili
Review this pull request change. Language: Swift File: CodeEditModules/Modules/CodeFile/src/TextView/CodeEditorTextView.swift PR Title: Custom Context Menu for Code Editor BEFORE CODE: /// /// This is a basic view without any functionality, once we have most the items built /// we will start connecting ...
Please make it localized. add `.localized()` and add it to `Localizable.strings`
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.