chia-blockchain 2.6.0rc3__py3-none-any.whl → 2.6.0rc4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- chia/_tests/core/full_node/test_full_node.py +8 -1
- chia/_tests/core/mempool/test_mempool_manager.py +1 -3
- chia/full_node/full_node.py +9 -1
- chia/full_node/full_node_api.py +23 -8
- chia/full_node/mempool_manager.py +1 -6
- chia/types/clvm_cost.py +4 -0
- {chia_blockchain-2.6.0rc3.dist-info → chia_blockchain-2.6.0rc4.dist-info}/METADATA +1 -1
- {chia_blockchain-2.6.0rc3.dist-info → chia_blockchain-2.6.0rc4.dist-info}/RECORD +11 -11
- {chia_blockchain-2.6.0rc3.dist-info → chia_blockchain-2.6.0rc4.dist-info}/WHEEL +1 -1
- {chia_blockchain-2.6.0rc3.dist-info → chia_blockchain-2.6.0rc4.dist-info}/entry_points.txt +0 -0
- {chia_blockchain-2.6.0rc3.dist-info → chia_blockchain-2.6.0rc4.dist-info}/licenses/LICENSE +0 -0
|
@@ -95,6 +95,7 @@ from chia.types.blockchain_format.proof_of_space import (
|
|
|
95
95
|
)
|
|
96
96
|
from chia.types.blockchain_format.serialized_program import SerializedProgram
|
|
97
97
|
from chia.types.blockchain_format.vdf import CompressibleVDFField, VDFProof
|
|
98
|
+
from chia.types.clvm_cost import QUOTE_BYTES, QUOTE_EXECUTION_COST
|
|
98
99
|
from chia.types.coin_spend import make_spend
|
|
99
100
|
from chia.types.condition_opcodes import ConditionOpcode
|
|
100
101
|
from chia.types.condition_with_args import ConditionWithArgs
|
|
@@ -3388,6 +3389,7 @@ async def test_pending_tx_cache_retry_on_new_peak(
|
|
|
3388
3389
|
@pytest.mark.parametrize("mismatch_fee", [True, False])
|
|
3389
3390
|
@pytest.mark.parametrize("tx_already_seen", [True, False])
|
|
3390
3391
|
@pytest.mark.parametrize("mismatch_on_reannounce", [True, False])
|
|
3392
|
+
@pytest.mark.parametrize("tolerated_quote_cost_diff", [True, False])
|
|
3391
3393
|
async def test_ban_for_mismatched_tx_cost_fee(
|
|
3392
3394
|
three_nodes: list[FullNodeAPI],
|
|
3393
3395
|
bt: BlockTools,
|
|
@@ -3396,6 +3398,7 @@ async def test_ban_for_mismatched_tx_cost_fee(
|
|
|
3396
3398
|
mismatch_fee: bool,
|
|
3397
3399
|
tx_already_seen: bool,
|
|
3398
3400
|
mismatch_on_reannounce: bool,
|
|
3401
|
+
tolerated_quote_cost_diff: bool,
|
|
3399
3402
|
) -> None:
|
|
3400
3403
|
"""
|
|
3401
3404
|
Tests that a peer gets banned if it sends a `NewTransaction` message with a
|
|
@@ -3406,6 +3409,8 @@ async def test_ban_for_mismatched_tx_cost_fee(
|
|
|
3406
3409
|
the ones specified in the `NewTransaction` message.
|
|
3407
3410
|
With `mismatch_on_reannounce` we control whether the peer sent us the same
|
|
3408
3411
|
transaction twice with different cost and fee.
|
|
3412
|
+
With `tolerated_quote_cost_diff` we cover older nodes with a specific cost
|
|
3413
|
+
mismatch due to the byte size cost and execution cost of the wrapper quote.
|
|
3409
3414
|
"""
|
|
3410
3415
|
full_node_1, full_node_2, full_node_3 = three_nodes
|
|
3411
3416
|
server_1 = full_node_1.full_node.server
|
|
@@ -3439,7 +3444,9 @@ async def test_ban_for_mismatched_tx_cost_fee(
|
|
|
3439
3444
|
assert mempool_item is not None
|
|
3440
3445
|
# Now send a NewTransaction with a cost and/or fee mismatch from the second
|
|
3441
3446
|
# full node.
|
|
3442
|
-
|
|
3447
|
+
quote_cost = QUOTE_BYTES * node.constants.COST_PER_BYTE + QUOTE_EXECUTION_COST
|
|
3448
|
+
cost_diff = quote_cost if tolerated_quote_cost_diff else 0
|
|
3449
|
+
cost = uint64(mempool_item.cost + 1) if mismatch_cost else uint64(mempool_item.cost + cost_diff)
|
|
3443
3450
|
fee = uint64(mempool_item.fee + 1) if mismatch_fee else mempool_item.fee
|
|
3444
3451
|
msg = make_msg(ProtocolMessageTypes.new_transaction, NewTransaction(mempool_item.name, cost, fee))
|
|
3445
3452
|
# We won't ban localhost, so let's set a different ip address for the
|
|
@@ -41,8 +41,6 @@ from chia.full_node.eligible_coin_spends import (
|
|
|
41
41
|
from chia.full_node.mempool import MAX_SKIPPED_ITEMS, PRIORITY_TX_THRESHOLD
|
|
42
42
|
from chia.full_node.mempool_manager import (
|
|
43
43
|
MEMPOOL_MIN_FEE_INCREASE,
|
|
44
|
-
QUOTE_BYTES,
|
|
45
|
-
QUOTE_EXECUTION_COST,
|
|
46
44
|
MempoolManager,
|
|
47
45
|
TimelockConditions,
|
|
48
46
|
can_replace,
|
|
@@ -63,7 +61,7 @@ from chia.simulator.wallet_tools import WalletTool
|
|
|
63
61
|
from chia.types.blockchain_format.coin import Coin
|
|
64
62
|
from chia.types.blockchain_format.program import DEFAULT_FLAGS, INFINITE_COST, Program
|
|
65
63
|
from chia.types.blockchain_format.serialized_program import SerializedProgram
|
|
66
|
-
from chia.types.clvm_cost import CLVMCost
|
|
64
|
+
from chia.types.clvm_cost import QUOTE_BYTES, QUOTE_EXECUTION_COST, CLVMCost
|
|
67
65
|
from chia.types.coin_spend import make_spend
|
|
68
66
|
from chia.types.condition_opcodes import ConditionOpcode
|
|
69
67
|
from chia.types.condition_with_args import ConditionWithArgs
|
chia/full_node/full_node.py
CHANGED
|
@@ -78,6 +78,7 @@ from chia.server.server import ChiaServer
|
|
|
78
78
|
from chia.server.ws_connection import WSChiaConnection
|
|
79
79
|
from chia.types.blockchain_format.classgroup import ClassgroupElement
|
|
80
80
|
from chia.types.blockchain_format.vdf import CompressibleVDFField, VDFInfo, VDFProof, validate_vdf
|
|
81
|
+
from chia.types.clvm_cost import QUOTE_BYTES, QUOTE_EXECUTION_COST
|
|
81
82
|
from chia.types.mempool_inclusion_status import MempoolInclusionStatus
|
|
82
83
|
from chia.types.mempool_item import MempoolItem
|
|
83
84
|
from chia.types.peer_info import PeerInfo
|
|
@@ -2818,7 +2819,14 @@ class FullNode:
|
|
|
2818
2819
|
# Now that we validated this transaction, check what fees and
|
|
2819
2820
|
# costs the peers have advertised for it.
|
|
2820
2821
|
for peer_id, entry in peers_with_tx.items():
|
|
2821
|
-
|
|
2822
|
+
# Older nodes (2.4.3 and earlier) compute the cost slightly
|
|
2823
|
+
# differently. They include the byte cost and execution cost of
|
|
2824
|
+
# the quote for the puzzle.
|
|
2825
|
+
tolerated_diff = QUOTE_BYTES * self.constants.COST_PER_BYTE + QUOTE_EXECUTION_COST
|
|
2826
|
+
if entry.advertised_fee == mempool_item.fee and (
|
|
2827
|
+
entry.advertised_cost == mempool_item.cost
|
|
2828
|
+
or entry.advertised_cost == mempool_item.cost + tolerated_diff
|
|
2829
|
+
):
|
|
2822
2830
|
continue
|
|
2823
2831
|
self.log.warning(
|
|
2824
2832
|
f"Banning peer {peer_id}. Sent us a new tx {spend_name} with mismatch "
|
chia/full_node/full_node_api.py
CHANGED
|
@@ -67,6 +67,7 @@ from chia.server.ws_connection import WSChiaConnection
|
|
|
67
67
|
from chia.types.block_protocol import BlockInfo
|
|
68
68
|
from chia.types.blockchain_format.coin import Coin, hash_coin_ids
|
|
69
69
|
from chia.types.blockchain_format.proof_of_space import verify_and_get_quality_string
|
|
70
|
+
from chia.types.clvm_cost import QUOTE_BYTES, QUOTE_EXECUTION_COST
|
|
70
71
|
from chia.types.generator_types import BlockGenerator, NewBlockGenerator
|
|
71
72
|
from chia.types.mempool_inclusion_status import MempoolInclusionStatus
|
|
72
73
|
from chia.types.peer_info import PeerInfo
|
|
@@ -220,11 +221,17 @@ class FullNodeAPI:
|
|
|
220
221
|
# If already seen, the cost and fee must match, otherwise ban the peer
|
|
221
222
|
mempool_item = self.full_node.mempool_manager.get_mempool_item(transaction.transaction_id, include_pending=True)
|
|
222
223
|
if mempool_item is not None:
|
|
223
|
-
|
|
224
|
+
# Older nodes (2.4.3 and earlier) compute the cost slightly
|
|
225
|
+
# differently. They include the byte cost and execution cost of
|
|
226
|
+
# the quote for the puzzle.
|
|
227
|
+
tolerated_diff = QUOTE_BYTES * self.full_node.constants.COST_PER_BYTE + QUOTE_EXECUTION_COST
|
|
228
|
+
if (transaction.cost != mempool_item.cost and transaction.cost != mempool_item.cost + tolerated_diff) or (
|
|
229
|
+
transaction.fees != mempool_item.fee
|
|
230
|
+
):
|
|
224
231
|
self.log.warning(
|
|
225
|
-
f"Banning peer {peer.peer_node_id}. Sent us an already seen tx
|
|
226
|
-
f"with mismatch on cost {transaction.cost} vs validation
|
|
227
|
-
f"fee {transaction.fees} vs {mempool_item.fee}."
|
|
232
|
+
f"Banning peer {peer.peer_node_id} version {peer.version}. Sent us an already seen tx "
|
|
233
|
+
f"{transaction.transaction_id} with mismatch on cost {transaction.cost} vs validation "
|
|
234
|
+
f"cost {mempool_item.cost} and/or fee {transaction.fees} vs {mempool_item.fee}."
|
|
228
235
|
)
|
|
229
236
|
await peer.close(CONSENSUS_ERROR_BAN_SECONDS)
|
|
230
237
|
return None
|
|
@@ -244,11 +251,19 @@ class FullNodeAPI:
|
|
|
244
251
|
return None
|
|
245
252
|
prev = current_map.get(peer.peer_node_id)
|
|
246
253
|
if prev is not None:
|
|
247
|
-
|
|
254
|
+
# Older nodes (2.4.3 and earlier) compute the cost slightly
|
|
255
|
+
# differently. They include the byte cost and execution cost of
|
|
256
|
+
# the quote for the puzzle.
|
|
257
|
+
tolerated_diff = QUOTE_BYTES * self.full_node.constants.COST_PER_BYTE + QUOTE_EXECUTION_COST
|
|
258
|
+
if prev.advertised_fee != transaction.fees or (
|
|
259
|
+
prev.advertised_cost != transaction.cost
|
|
260
|
+
and abs(prev.advertised_cost - transaction.cost) != tolerated_diff
|
|
261
|
+
):
|
|
248
262
|
self.log.warning(
|
|
249
|
-
f"Banning peer {peer.peer_node_id}. Sent us a new tx
|
|
250
|
-
f"mismatch on cost {transaction.cost} vs
|
|
251
|
-
f"and/or fee {transaction.fees}
|
|
263
|
+
f"Banning peer {peer.peer_node_id} version {peer.version}. Sent us a new tx "
|
|
264
|
+
f"{transaction.transaction_id} with mismatch on cost {transaction.cost} vs "
|
|
265
|
+
f"previous advertised cost {prev.advertised_cost} and/or fee {transaction.fees} "
|
|
266
|
+
f"vs previous advertised fee {prev.advertised_fee}."
|
|
252
267
|
)
|
|
253
268
|
await peer.close(CONSENSUS_ERROR_BAN_SECONDS)
|
|
254
269
|
return None
|
|
@@ -36,7 +36,7 @@ from chia.full_node.fee_estimator_interface import FeeEstimatorInterface
|
|
|
36
36
|
from chia.full_node.mempool import MEMPOOL_ITEM_FEE_LIMIT, Mempool, MempoolRemoveInfo, MempoolRemoveReason
|
|
37
37
|
from chia.full_node.pending_tx_cache import ConflictTxCache, PendingTxCache
|
|
38
38
|
from chia.types.blockchain_format.coin import Coin
|
|
39
|
-
from chia.types.clvm_cost import CLVMCost
|
|
39
|
+
from chia.types.clvm_cost import QUOTE_BYTES, QUOTE_EXECUTION_COST, CLVMCost
|
|
40
40
|
from chia.types.fee_rate import FeeRate
|
|
41
41
|
from chia.types.generator_types import NewBlockGenerator
|
|
42
42
|
from chia.types.mempool_inclusion_status import MempoolInclusionStatus
|
|
@@ -140,11 +140,6 @@ class NewPeakInfo:
|
|
|
140
140
|
removals: list[MempoolRemoveInfo]
|
|
141
141
|
|
|
142
142
|
|
|
143
|
-
# For block overhead cost calculation
|
|
144
|
-
QUOTE_BYTES = 2
|
|
145
|
-
QUOTE_EXECUTION_COST = 20
|
|
146
|
-
|
|
147
|
-
|
|
148
143
|
def is_atom_canonical(clvm_buffer: bytes, offset: int) -> tuple[int, bool]:
|
|
149
144
|
b = clvm_buffer[offset]
|
|
150
145
|
if (b & 0b11000000) == 0b10000000:
|
chia/types/clvm_cost.py
CHANGED
|
@@ -211,7 +211,7 @@ chia/_tests/core/full_node/stores/test_sync_store.py,sha256=3UAWBrU4STQdSyILsWNY
|
|
|
211
211
|
chia/_tests/core/full_node/test_address_manager.py,sha256=te51gguX_AgSO-PGYMoZSVDYokprX3_Oc3KkXzmoWgs,31806
|
|
212
212
|
chia/_tests/core/full_node/test_block_height_map.py,sha256=5LKwLo76KuoUivIHHA7JoHG201BFoAcgC5xEA0t2UJc,24733
|
|
213
213
|
chia/_tests/core/full_node/test_conditions.py,sha256=7lLBXz3PZI6kuB1i35fQm2EEJADeUNmT_QNX8fpwFOE,25818
|
|
214
|
-
chia/_tests/core/full_node/test_full_node.py,sha256=
|
|
214
|
+
chia/_tests/core/full_node/test_full_node.py,sha256=5ViRbmYcCmKgSQJjW4cnFi-abociEp-f6U1cfQz-Z6U,152029
|
|
215
215
|
chia/_tests/core/full_node/test_generator_tools.py,sha256=Ft38N9nioI-6P9ZXUzhle5tJViek1a8dwMHRM3gSq5Q,3771
|
|
216
216
|
chia/_tests/core/full_node/test_hard_fork_utils.py,sha256=XNIi66_1Lew_OqL5bp9sMeszjL9dJWdSjjBr_IofJts,3815
|
|
217
217
|
chia/_tests/core/full_node/test_hint_management.py,sha256=QqbvtiztYHSTZBBqdSAo4kv9ROLi70LnDbg_lw_I3fA,4499
|
|
@@ -229,7 +229,7 @@ chia/_tests/core/mempool/test_mempool.py,sha256=g4vZRUnplL9KFWaCflqgm_xC2yCQoth3
|
|
|
229
229
|
chia/_tests/core/mempool/test_mempool_fee_estimator.py,sha256=QcCpuCwbYYAlQ3toVHQfTP1MffPBWDnWV2XCAOycmvU,3824
|
|
230
230
|
chia/_tests/core/mempool/test_mempool_fee_protocol.py,sha256=0_lj2VlUIsEXOLKDG6zF8suyUPSL7GlakFmDdWHUkYg,2071
|
|
231
231
|
chia/_tests/core/mempool/test_mempool_item_queries.py,sha256=9PgMxWV05pInH8aXD88BsLQ3tPiEMcOFcwAHktAvNVo,6988
|
|
232
|
-
chia/_tests/core/mempool/test_mempool_manager.py,sha256=
|
|
232
|
+
chia/_tests/core/mempool/test_mempool_manager.py,sha256=L3CcQssR8F7dgMwS5bLjGSY6dptuOvi3_syoLAG40Rw,157783
|
|
233
233
|
chia/_tests/core/mempool/test_mempool_performance.py,sha256=a5bLSJ_Q_EVYnUHn96I5RC7VZl7niizBK47yVnzvWn4,2935
|
|
234
234
|
chia/_tests/core/mempool/test_singleton_fast_forward.py,sha256=_oq3QWvKRm4E0Qoo_DnY_LB2aWzIhnUDWK9H-NgxFLM,33890
|
|
235
235
|
chia/_tests/core/node_height.py,sha256=yfkEmmYCsAb3cIe1ZhtE9J2SFB9lG_49SgjxsITdrZk,917
|
|
@@ -657,8 +657,8 @@ chia/full_node/fee_estimator_interface.py,sha256=3yE7-IfFhP1HnReSIOnULUReXXgxIGL
|
|
|
657
657
|
chia/full_node/fee_history.py,sha256=hcLmy3HLuuATidOQ94wD7MAtzZU9PadKaKt8q3m8fVI,591
|
|
658
658
|
chia/full_node/fee_tracker.py,sha256=WYeWUTQSVhrHS12rDl5ITpg8Ppd0Jb3g9VXw70GP2eI,22520
|
|
659
659
|
chia/full_node/full_block_utils.py,sha256=rss2zZooEYCrflffOzqBmYhaFSiVut9JRDOkt1VJKBo,13231
|
|
660
|
-
chia/full_node/full_node.py,sha256=
|
|
661
|
-
chia/full_node/full_node_api.py,sha256=
|
|
660
|
+
chia/full_node/full_node.py,sha256=vgrjxNTn388T4hdo79UonNjg_eBpvdBRFHK9W-Ugjso,169395
|
|
661
|
+
chia/full_node/full_node_api.py,sha256=4gwfboLaBdwQcoia3Eh8mtycCEUK2vcrW34TNwqvtHg,100772
|
|
662
662
|
chia/full_node/full_node_rpc_api.py,sha256=fWYwh7VbYMoUVtjcAjBdHSIEhiba-MzoEm8dwsC8ifk,48566
|
|
663
663
|
chia/full_node/full_node_rpc_client.py,sha256=6alfL1AFn8tkvjA6CB4ekGSSZqoRF1GkQz2cEuSnSwQ,13384
|
|
664
664
|
chia/full_node/full_node_service.py,sha256=fD3mAV3Ud74MNl4g9xCnkhw_QIb4MwOGkoQKngVMiWA,307
|
|
@@ -667,7 +667,7 @@ chia/full_node/hard_fork_utils.py,sha256=RgiXIfBg1fVQBjaCUa2cYwVrJwzgad4RVhX8vx9
|
|
|
667
667
|
chia/full_node/hint_management.py,sha256=UJPTSIWnCXG7hO3QfuLMV1WAaBuHUdC1gok7zdz-9BA,2281
|
|
668
668
|
chia/full_node/hint_store.py,sha256=0m6y0_f0rhGIKqfAmhFSGEeyM3LCN-dv-bR1OfIr4Uo,3666
|
|
669
669
|
chia/full_node/mempool.py,sha256=oQk9aZyYC-qUESRUsHD4647JnyZnRHa6e5plE20DCgM,33917
|
|
670
|
-
chia/full_node/mempool_manager.py,sha256=
|
|
670
|
+
chia/full_node/mempool_manager.py,sha256=VGTMxtlhpRk7W1A2TWDMLMZyu2y44TBAxzt33fwVJP0,51323
|
|
671
671
|
chia/full_node/pending_tx_cache.py,sha256=3iIsoKBGtqi2N58ndu3WmGbb9HCW72fhaN3bm56o5VA,3623
|
|
672
672
|
chia/full_node/start_full_node.py,sha256=8jBRHlxy86gUQb-9UzTlZlRLSVDBaOtOEVVeg-vhlEI,4263
|
|
673
673
|
chia/full_node/subscriptions.py,sha256=TvV_dgUOF-6CjILFZ86rCxUzkdgFUlQZcwjUcZLXB2U,8641
|
|
@@ -820,7 +820,7 @@ chia/types/blockchain_format/proof_of_space.py,sha256=MP9LY9hRcrQqpoIS9_hC1dP8mg
|
|
|
820
820
|
chia/types/blockchain_format/serialized_program.py,sha256=4pN6DiiLOx3CfXILguFbJCtDOkIKcRrTA8GWfuUU0pY,88
|
|
821
821
|
chia/types/blockchain_format/tree_hash.py,sha256=dBpipLhIAAH8YYxPxzx8LinBi_3S342z5YBJYb-GCYs,2572
|
|
822
822
|
chia/types/blockchain_format/vdf.py,sha256=AQ7zojUUOSt8pdNm1k1hn_xnQV2WTp5JhSugR6negGw,2290
|
|
823
|
-
chia/types/clvm_cost.py,sha256=
|
|
823
|
+
chia/types/clvm_cost.py,sha256=nP_N6RyA_HvKtKih4QjTJb2EFWzDityYKaxSEMpu27o,417
|
|
824
824
|
chia/types/coin_spend.py,sha256=_zY55TNWVQVgHkkNN832fV1H8-41vV0CLvoCSzmLCl0,1778
|
|
825
825
|
chia/types/condition_opcodes.py,sha256=nFibKuhiR0FwXUB0hqDQbv0Ngfb-BezNKTfDzoa3vII,2213
|
|
826
826
|
chia/types/condition_with_args.py,sha256=N5f6V0ok1cLSTG-4YqAGOISYyhixC8745LGYqvu0Y58,389
|
|
@@ -1012,8 +1012,8 @@ chia/wallet/wallet_transaction_store.py,sha256=e0RtKV29mfaXsQZg4M3bjUxfPFy_3BAqE
|
|
|
1012
1012
|
chia/wallet/wallet_user_store.py,sha256=TFtNVU5E334fK1MCTOAG2SXIia8wBfeVSamDWvjqzAY,4048
|
|
1013
1013
|
chia/wallet/wallet_weight_proof_handler.py,sha256=Ni42zOX_wkLTcDnicqWJiE9pZJ5gcGyWqMfLiwgEXtM,4856
|
|
1014
1014
|
chia/wallet/wsm_apis.py,sha256=6LmxbHXC-tqNbRyoiGgz-f19PF1nEfMbfm3BTnsNQ6s,3914
|
|
1015
|
-
chia_blockchain-2.6.
|
|
1016
|
-
chia_blockchain-2.6.
|
|
1017
|
-
chia_blockchain-2.6.
|
|
1018
|
-
chia_blockchain-2.6.
|
|
1019
|
-
chia_blockchain-2.6.
|
|
1015
|
+
chia_blockchain-2.6.0rc4.dist-info/METADATA,sha256=SwgFBm3NnmEBD6VdWk734RQgfwzr4_MA1jBfuo5KEH8,10368
|
|
1016
|
+
chia_blockchain-2.6.0rc4.dist-info/WHEEL,sha256=kJCRJT_g0adfAJzTx2GUMmS80rTJIVHRCfG0DQgLq3o,88
|
|
1017
|
+
chia_blockchain-2.6.0rc4.dist-info/entry_points.txt,sha256=ehxlhrA6j4WmQ3W1pZ4GZEX9KCyrmuTsk9c_BNF9NUM,800
|
|
1018
|
+
chia_blockchain-2.6.0rc4.dist-info/licenses/LICENSE,sha256=0tuU-jTzeRDJJaxF2YCEpBwbywgpbrVSXq1i6fJq63U,11347
|
|
1019
|
+
chia_blockchain-2.6.0rc4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|