Skip to content

Commit 7a26610

Browse files
authored
less pre-inting for ints (#19853)
1 parent 55165b1 commit 7a26610

36 files changed

+83
-83
lines changed

chia/_tests/core/consensus/test_pot_iterations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def test_calculate_ip_iters(self):
6767
ip_iters = calculate_ip_iters(test_constants, ssi, uint8(13), required_iters)
6868
assert ip_iters == sp_iters + test_constants.NUM_SP_INTERVALS_EXTRA * sp_interval_iters + required_iters
6969

70-
required_iters = uint64(int(ssi * 4 / 300))
70+
required_iters = uint64(ssi * 4 / 300)
7171
ip_iters = calculate_ip_iters(test_constants, ssi, uint8(13), required_iters)
7272
assert ip_iters == sp_iters + test_constants.NUM_SP_INTERVALS_EXTRA * sp_interval_iters + required_iters
7373
assert sp_iters < ip_iters

chia/_tests/core/full_node/test_full_node.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ async def test_request_peers(
548548
async def have_msgs(full_node_peers: FullNodePeers) -> bool:
549549
assert full_node_peers.address_manager is not None
550550
await full_node_peers.address_manager.add_to_new_table(
551-
[TimestampedPeerInfo("127.0.0.1", uint16(1000), uint64(int(time.time()) - 1000))],
551+
[TimestampedPeerInfo("127.0.0.1", uint16(1000), uint64(time.time() - 1000))],
552552
None,
553553
)
554554
assert server_2._port is not None

chia/_tests/core/test_crawler.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ async def test_crawler_to_db(crawler_service_no_loop: CrawlerService, one_node:
111111
uint64(0),
112112
uint32(0),
113113
uint64(0),
114-
uint64(int(time.time())),
114+
uint64(time.time()),
115115
uint64(0),
116116
"undefined",
117117
uint64(0),
@@ -153,8 +153,8 @@ async def test_crawler_peer_cleanup(
153153
uint64(0),
154154
uint32(0),
155155
uint64(0),
156-
uint64(int(time.time())),
157-
uint64(int((datetime.now() - timedelta(days=idx * 10)).timestamp())),
156+
uint64(time.time()),
157+
uint64((datetime.now() - timedelta(days=idx * 10)).timestamp()),
158158
"undefined",
159159
uint64(0),
160160
tls_version="unknown",

chia/_tests/core/test_seeder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def database_peers() -> dict[str, PeerReliability]:
8383
uint64(0),
8484
uint32(0),
8585
uint64(0),
86-
uint64(int(time.time())),
86+
uint64(time.time()),
8787
uint64(0),
8888
"undefined",
8989
uint64(0),

chia/_tests/plot_sync/test_sender.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def new_expected_response(sync_id: int, message_id: int, message_type: ProtocolM
7575

7676
def new_response_message(sync_id: int, message_id: int, message_type: ProtocolMessageTypes) -> PlotSyncResponse:
7777
return PlotSyncResponse(
78-
plot_sync_identifier(uint64(sync_id), uint64(message_id)), int16(int(message_type.value)), None
78+
plot_sync_identifier(uint64(sync_id), uint64(message_id)), int16(message_type.value), None
7979
)
8080

8181
response_message = new_response_message(0, 1, ProtocolMessageTypes.plot_sync_start)
@@ -97,7 +97,7 @@ def new_response_message(sync_id: int, message_id: int, message_type: ProtocolMe
9797
expected_response.identifier.sync_id,
9898
expected_response.identifier.message_id,
9999
)
100-
expired_message = PlotSyncResponse(expired_identifier, int16(int(ProtocolMessageTypes.plot_sync_start.value)), None)
100+
expired_message = PlotSyncResponse(expired_identifier, int16(ProtocolMessageTypes.plot_sync_start.value), None)
101101
assert not sender.set_response(expired_message)
102102
# Test invalid sync-id
103103
sender._response = new_expected_response(2, 0, ProtocolMessageTypes.plot_sync_start)

chia/_tests/plot_sync/test_sync_simulated.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def validate_plot_sync(self) -> None:
140140
assert plot_info.pool_contract_puzzle_hash == synced_plot.pool_contract_puzzle_hash
141141
assert plot_info.plot_public_key == synced_plot.plot_public_key
142142
assert plot_info.file_size == synced_plot.file_size
143-
assert uint64(int(plot_info.time_modified)) == synced_plot.time_modified
143+
assert uint64(plot_info.time_modified) == synced_plot.time_modified
144144
for plot_info in self.invalid:
145145
assert plot_info.prover.get_filename() not in self.plot_sync_receiver.plots()
146146
assert plot_info.prover.get_filename() in self.plot_sync_receiver.invalid()

chia/_tests/plot_sync/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def get_dummy_connection(node_type: NodeType, peer_id: bytes32) -> WSChiaConnect
3838

3939

4040
def plot_sync_identifier(current_sync_id: uint64, message_id: uint64) -> PlotSyncIdentifier:
41-
return PlotSyncIdentifier(uint64(int(time.time())), current_sync_id, message_id)
41+
return PlotSyncIdentifier(uint64(time.time()), current_sync_id, message_id)
4242

4343

4444
@contextlib.asynccontextmanager

chia/cmds/wallet_funcs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ async def make_offer(
525525
assert hrp is not None
526526
unit = units[hrp]
527527
except ValueError:
528-
id = uint32(int(name))
528+
id = uint32(name)
529529
if id == 1:
530530
name = "XCH"
531531
unit = units["chia"]

chia/consensus/block_rewards.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ def calculate_pool_reward(height: uint32) -> uint64:
1717
"""
1818

1919
if height == 0:
20-
return uint64(int((7 / 8) * 21000000 * _mojo_per_chia))
20+
return uint64((7 / 8) * 21000000 * _mojo_per_chia)
2121
elif height < 3 * _blocks_per_year:
22-
return uint64(int((7 / 8) * 2 * _mojo_per_chia))
22+
return uint64((7 / 8) * 2 * _mojo_per_chia)
2323
elif height < 6 * _blocks_per_year:
24-
return uint64(int((7 / 8) * 1 * _mojo_per_chia))
24+
return uint64((7 / 8) * 1 * _mojo_per_chia)
2525
elif height < 9 * _blocks_per_year:
26-
return uint64(int((7 / 8) * 0.5 * _mojo_per_chia))
26+
return uint64((7 / 8) * 0.5 * _mojo_per_chia)
2727
elif height < 12 * _blocks_per_year:
28-
return uint64(int((7 / 8) * 0.25 * _mojo_per_chia))
28+
return uint64((7 / 8) * 0.25 * _mojo_per_chia)
2929
else:
30-
return uint64(int((7 / 8) * 0.125 * _mojo_per_chia))
30+
return uint64((7 / 8) * 0.125 * _mojo_per_chia)
3131

3232

3333
def calculate_base_farmer_reward(height: uint32) -> uint64:
@@ -40,14 +40,14 @@ def calculate_base_farmer_reward(height: uint32) -> uint64:
4040
rates increase continuously.
4141
"""
4242
if height == 0:
43-
return uint64(int((1 / 8) * 21000000 * _mojo_per_chia))
43+
return uint64((1 / 8) * 21000000 * _mojo_per_chia)
4444
elif height < 3 * _blocks_per_year:
45-
return uint64(int((1 / 8) * 2 * _mojo_per_chia))
45+
return uint64((1 / 8) * 2 * _mojo_per_chia)
4646
elif height < 6 * _blocks_per_year:
47-
return uint64(int((1 / 8) * 1 * _mojo_per_chia))
47+
return uint64((1 / 8) * 1 * _mojo_per_chia)
4848
elif height < 9 * _blocks_per_year:
49-
return uint64(int((1 / 8) * 0.5 * _mojo_per_chia))
49+
return uint64((1 / 8) * 0.5 * _mojo_per_chia)
5050
elif height < 12 * _blocks_per_year:
51-
return uint64(int((1 / 8) * 0.25 * _mojo_per_chia))
51+
return uint64((1 / 8) * 0.25 * _mojo_per_chia)
5252
else:
53-
return uint64(int((1 / 8) * 0.125 * _mojo_per_chia))
53+
return uint64((1 / 8) * 0.125 * _mojo_per_chia)

chia/data_layer/data_layer_wallet.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ async def create_update_state_spend(
536536

537537
dl_tx = TransactionRecord(
538538
confirmed_at_height=uint32(0),
539-
created_at_time=uint64(int(time.time())),
539+
created_at_time=uint64(time.time()),
540540
to_puzzle_hash=new_puz_hash,
541541
amount=uint64(singleton_record.lineage_proof.amount),
542542
fee_amount=fee,
@@ -731,7 +731,7 @@ async def delete_mirror(
731731
interface.side_effects.transactions.append(
732732
TransactionRecord(
733733
confirmed_at_height=uint32(0),
734-
created_at_time=uint64(int(time.time())),
734+
created_at_time=uint64(time.time()),
735735
to_puzzle_hash=new_puzhash,
736736
amount=uint64(mirror_coin.amount),
737737
fee_amount=fee,

0 commit comments

Comments
 (0)