Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion chia/_tests/core/consensus/test_pot_iterations.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def test_calculate_ip_iters(self):
ip_iters = calculate_ip_iters(test_constants, ssi, uint8(13), required_iters)
assert ip_iters == sp_iters + test_constants.NUM_SP_INTERVALS_EXTRA * sp_interval_iters + required_iters

required_iters = uint64(int(ssi * 4 / 300))
required_iters = uint64(ssi * 4 / 300)
ip_iters = calculate_ip_iters(test_constants, ssi, uint8(13), required_iters)
assert ip_iters == sp_iters + test_constants.NUM_SP_INTERVALS_EXTRA * sp_interval_iters + required_iters
assert sp_iters < ip_iters
Expand Down
2 changes: 1 addition & 1 deletion chia/_tests/core/full_node/test_full_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ async def test_request_peers(
async def have_msgs(full_node_peers: FullNodePeers) -> bool:
assert full_node_peers.address_manager is not None
await full_node_peers.address_manager.add_to_new_table(
[TimestampedPeerInfo("127.0.0.1", uint16(1000), uint64(int(time.time()) - 1000))],
[TimestampedPeerInfo("127.0.0.1", uint16(1000), uint64(time.time() - 1000))],
None,
)
assert server_2._port is not None
Expand Down
6 changes: 3 additions & 3 deletions chia/_tests/core/test_crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ async def test_crawler_to_db(crawler_service_no_loop: CrawlerService, one_node:
uint64(0),
uint32(0),
uint64(0),
uint64(int(time.time())),
uint64(time.time()),
uint64(0),
"undefined",
uint64(0),
Expand Down Expand Up @@ -153,8 +153,8 @@ async def test_crawler_peer_cleanup(
uint64(0),
uint32(0),
uint64(0),
uint64(int(time.time())),
uint64(int((datetime.now() - timedelta(days=idx * 10)).timestamp())),
uint64(time.time()),
uint64((datetime.now() - timedelta(days=idx * 10)).timestamp()),
"undefined",
uint64(0),
tls_version="unknown",
Expand Down
2 changes: 1 addition & 1 deletion chia/_tests/core/test_seeder.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def database_peers() -> dict[str, PeerReliability]:
uint64(0),
uint32(0),
uint64(0),
uint64(int(time.time())),
uint64(time.time()),
uint64(0),
"undefined",
uint64(0),
Expand Down
4 changes: 2 additions & 2 deletions chia/_tests/plot_sync/test_sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def new_expected_response(sync_id: int, message_id: int, message_type: ProtocolM

def new_response_message(sync_id: int, message_id: int, message_type: ProtocolMessageTypes) -> PlotSyncResponse:
return PlotSyncResponse(
plot_sync_identifier(uint64(sync_id), uint64(message_id)), int16(int(message_type.value)), None
plot_sync_identifier(uint64(sync_id), uint64(message_id)), int16(message_type.value), None
)

response_message = new_response_message(0, 1, ProtocolMessageTypes.plot_sync_start)
Expand All @@ -97,7 +97,7 @@ def new_response_message(sync_id: int, message_id: int, message_type: ProtocolMe
expected_response.identifier.sync_id,
expected_response.identifier.message_id,
)
expired_message = PlotSyncResponse(expired_identifier, int16(int(ProtocolMessageTypes.plot_sync_start.value)), None)
expired_message = PlotSyncResponse(expired_identifier, int16(ProtocolMessageTypes.plot_sync_start.value), None)
assert not sender.set_response(expired_message)
# Test invalid sync-id
sender._response = new_expected_response(2, 0, ProtocolMessageTypes.plot_sync_start)
Expand Down
2 changes: 1 addition & 1 deletion chia/_tests/plot_sync/test_sync_simulated.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def validate_plot_sync(self) -> None:
assert plot_info.pool_contract_puzzle_hash == synced_plot.pool_contract_puzzle_hash
assert plot_info.plot_public_key == synced_plot.plot_public_key
assert plot_info.file_size == synced_plot.file_size
assert uint64(int(plot_info.time_modified)) == synced_plot.time_modified
assert uint64(plot_info.time_modified) == synced_plot.time_modified
for plot_info in self.invalid:
assert plot_info.prover.get_filename() not in self.plot_sync_receiver.plots()
assert plot_info.prover.get_filename() in self.plot_sync_receiver.invalid()
Expand Down
2 changes: 1 addition & 1 deletion chia/_tests/plot_sync/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def get_dummy_connection(node_type: NodeType, peer_id: bytes32) -> WSChiaConnect


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


@contextlib.asynccontextmanager
Expand Down
2 changes: 1 addition & 1 deletion chia/cmds/wallet_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ async def make_offer(
assert hrp is not None
unit = units[hrp]
except ValueError:
id = uint32(int(name))
id = uint32(name)
if id == 1:
name = "XCH"
unit = units["chia"]
Expand Down
24 changes: 12 additions & 12 deletions chia/consensus/block_rewards.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ def calculate_pool_reward(height: uint32) -> uint64:
"""

if height == 0:
return uint64(int((7 / 8) * 21000000 * _mojo_per_chia))
return uint64((7 / 8) * 21000000 * _mojo_per_chia)
elif height < 3 * _blocks_per_year:
return uint64(int((7 / 8) * 2 * _mojo_per_chia))
return uint64((7 / 8) * 2 * _mojo_per_chia)
elif height < 6 * _blocks_per_year:
return uint64(int((7 / 8) * 1 * _mojo_per_chia))
return uint64((7 / 8) * 1 * _mojo_per_chia)
elif height < 9 * _blocks_per_year:
return uint64(int((7 / 8) * 0.5 * _mojo_per_chia))
return uint64((7 / 8) * 0.5 * _mojo_per_chia)
elif height < 12 * _blocks_per_year:
return uint64(int((7 / 8) * 0.25 * _mojo_per_chia))
return uint64((7 / 8) * 0.25 * _mojo_per_chia)
else:
return uint64(int((7 / 8) * 0.125 * _mojo_per_chia))
return uint64((7 / 8) * 0.125 * _mojo_per_chia)


def calculate_base_farmer_reward(height: uint32) -> uint64:
Expand All @@ -40,14 +40,14 @@ def calculate_base_farmer_reward(height: uint32) -> uint64:
rates increase continuously.
"""
if height == 0:
return uint64(int((1 / 8) * 21000000 * _mojo_per_chia))
return uint64((1 / 8) * 21000000 * _mojo_per_chia)
elif height < 3 * _blocks_per_year:
return uint64(int((1 / 8) * 2 * _mojo_per_chia))
return uint64((1 / 8) * 2 * _mojo_per_chia)
elif height < 6 * _blocks_per_year:
return uint64(int((1 / 8) * 1 * _mojo_per_chia))
return uint64((1 / 8) * 1 * _mojo_per_chia)
elif height < 9 * _blocks_per_year:
return uint64(int((1 / 8) * 0.5 * _mojo_per_chia))
return uint64((1 / 8) * 0.5 * _mojo_per_chia)
elif height < 12 * _blocks_per_year:
return uint64(int((1 / 8) * 0.25 * _mojo_per_chia))
return uint64((1 / 8) * 0.25 * _mojo_per_chia)
else:
return uint64(int((1 / 8) * 0.125 * _mojo_per_chia))
return uint64((1 / 8) * 0.125 * _mojo_per_chia)
4 changes: 2 additions & 2 deletions chia/data_layer/data_layer_wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ async def create_update_state_spend(

dl_tx = TransactionRecord(
confirmed_at_height=uint32(0),
created_at_time=uint64(int(time.time())),
created_at_time=uint64(time.time()),
to_puzzle_hash=new_puz_hash,
amount=uint64(singleton_record.lineage_proof.amount),
fee_amount=fee,
Expand Down Expand Up @@ -731,7 +731,7 @@ async def delete_mirror(
interface.side_effects.transactions.append(
TransactionRecord(
confirmed_at_height=uint32(0),
created_at_time=uint64(int(time.time())),
created_at_time=uint64(time.time()),
to_puzzle_hash=new_puzhash,
amount=uint64(mirror_coin.amount),
fee_amount=fee,
Expand Down
8 changes: 4 additions & 4 deletions chia/farmer/farmer_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ async def new_proof_of_space(
"""
if new_proof_of_space.sp_hash not in self.farmer.number_of_responses:
self.farmer.number_of_responses[new_proof_of_space.sp_hash] = 0
self.farmer.cache_add_time[new_proof_of_space.sp_hash] = uint64(int(time.time()))
self.farmer.cache_add_time[new_proof_of_space.sp_hash] = uint64(time.time())

max_pos_per_sp = 5

Expand Down Expand Up @@ -170,14 +170,14 @@ async def new_proof_of_space(
new_proof_of_space.proof,
)
)
self.farmer.cache_add_time[new_proof_of_space.sp_hash] = uint64(int(time.time()))
self.farmer.cache_add_time[new_proof_of_space.sp_hash] = uint64(time.time())
self.farmer.quality_str_to_identifiers[computed_quality_string] = (
new_proof_of_space.plot_identifier,
new_proof_of_space.challenge_hash,
new_proof_of_space.sp_hash,
peer.peer_node_id,
)
self.farmer.cache_add_time[computed_quality_string] = uint64(int(time.time()))
self.farmer.cache_add_time[computed_quality_string] = uint64(time.time())

await peer.send_message(make_msg(ProtocolMessageTypes.request_signatures, request))

Expand Down Expand Up @@ -558,7 +558,7 @@ async def new_signage_point(self, new_signage_point: farmer_protocol.NewSignageP

pool_dict[key] = strip_old_entries(pairs=pool_dict[key], before=cutoff_24h)

now = uint64(int(time.time()))
now = uint64(time.time())
self.farmer.cache_add_time[new_signage_point.challenge_chain_sp] = now
missing_signage_points = self.farmer.check_missing_signage_points(now, new_signage_point)
self.farmer.state_changed(
Expand Down
2 changes: 1 addition & 1 deletion chia/full_node/full_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ async def send_peak_to_timelords(

async def synced(self, block_is_current_at: Optional[uint64] = None) -> bool:
if block_is_current_at is None:
block_is_current_at = uint64(int(time.time() - 60 * 7))
block_is_current_at = uint64(time.time() - 60 * 7)
if "simulator" in str(self.config.get("selected_network")):
return True # sim is always synced because it has no peers
curr: Optional[BlockRecord] = self.blockchain.get_peak()
Expand Down
4 changes: 2 additions & 2 deletions chia/full_node/full_node_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1001,14 +1001,14 @@ def get_pool_sig(_1: PoolTarget, _2: Optional[G1Element]) -> Optional[G2Element]
)

# The block's timestamp must be greater than the previous transaction block's timestamp
timestamp = uint64(int(time.time()))
timestamp = uint64(time.time())
curr: Optional[BlockRecord] = prev_b
while curr is not None and not curr.is_transaction_block and curr.height != 0:
curr = self.full_node.blockchain.try_block_record(curr.prev_hash)
if curr is not None:
assert curr.timestamp is not None
if timestamp <= curr.timestamp:
timestamp = uint64(int(curr.timestamp + 1))
timestamp = uint64(curr.timestamp + 1)

self.log.info("Starting to make the unfinished block")
unfinished_block: UnfinishedBlock = create_unfinished_block(
Expand Down
4 changes: 2 additions & 2 deletions chia/full_node/full_node_rpc_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ async def get_block_record_by_height(self, request: dict[str, Any]) -> EndpointR
if "height" not in request:
raise ValueError("No height in request")
height = request["height"]
header_height = uint32(int(height))
header_height = uint32(height)
peak_height = self.service.blockchain.get_peak_height()
if peak_height is None or header_height > peak_height:
raise ValueError(f"Block height {height} not found in chain")
Expand Down Expand Up @@ -610,7 +610,7 @@ async def get_network_space(self, request: dict[str, Any]) -> EndpointResult:
* additional_difficulty_constant
* eligible_plots_filter_multiplier
)
return {"space": uint128(int(network_space_bytes_estimate))}
return {"space": uint128(network_space_bytes_estimate)}

async def get_coin_records_by_puzzle_hash(self, request: dict[str, Any]) -> EndpointResult:
"""
Expand Down
2 changes: 1 addition & 1 deletion chia/full_node/weight_proof.py
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ def _get_weights_for_sampling(
q = 1 - delta**u
# todo check division and type conversions
weight = q * float(total_weight)
weight_to_check.append(uint128(int(weight)))
weight_to_check.append(uint128(weight))
weight_to_check.sort()
return weight_to_check

Expand Down
2 changes: 1 addition & 1 deletion chia/harvester/harvester_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ async def lookup_challenge(
msg = make_msg(ProtocolMessageTypes.new_proof_of_space, response)
await peer.send_message(msg)

now = uint64(int(time.time()))
now = uint64(time.time())

farming_info = FarmingInfo(
new_challenge.challenge_hash,
Expand Down
6 changes: 3 additions & 3 deletions chia/plot_sync/sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def _convert_plot_info_list(plot_infos: list[PlotInfo]) -> list[Plot]:
pool_contract_puzzle_hash=plot_info.pool_contract_puzzle_hash,
plot_public_key=plot_info.plot_public_key,
file_size=uint64(plot_info.file_size),
time_modified=uint64(int(plot_info.time_modified)),
time_modified=uint64(plot_info.time_modified),
compression_level=plot_info.prover.get_compression_level(),
)
)
Expand All @@ -72,7 +72,7 @@ class MessageGenerator(Generic[T]):
args: Iterable[object]

def generate(self) -> tuple[PlotSyncIdentifier, T]:
identifier = PlotSyncIdentifier(uint64(int(time.time())), self.sync_id, self.message_id)
identifier = PlotSyncIdentifier(uint64(time.time()), self.sync_id, self.message_id)
payload = self.payload_type(identifier, *self.args)
return identifier, payload

Expand Down Expand Up @@ -277,7 +277,7 @@ def sync_start(self, count: float, initial: bool) -> None:
PlotSyncStart,
initial,
self._last_sync_id,
uint32(int(count)),
uint32(count),
self._harvesting_mode,
)

Expand Down
2 changes: 1 addition & 1 deletion chia/plotting/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def save(self) -> None:
cache_entry.pool_public_key,
cache_entry.pool_contract_puzzle_hash,
cache_entry.plot_public_key,
uint64(int(cache_entry.last_use)),
uint64(cache_entry.last_use),
)
for path, cache_entry in self.items()
}
Expand Down
4 changes: 2 additions & 2 deletions chia/pools/pool_wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ async def generate_travel_transactions(self, fee: uint64, action_scope: WalletAc
interface.side_effects.transactions.append(
TransactionRecord(
confirmed_at_height=uint32(0),
created_at_time=uint64(int(time.time())),
created_at_time=uint64(time.time()),
to_puzzle_hash=new_full_puzzle.get_tree_hash(),
amount=uint64(1),
fee_amount=fee,
Expand Down Expand Up @@ -792,7 +792,7 @@ async def claim_pool_rewards(
),
)

current_time = uint64(int(time.time()))
current_time = uint64(time.time())
# The claim spend, minus the fee amount from the main wallet
async with action_scope.use() as interface:
interface.side_effects.transactions.append(
Expand Down
2 changes: 1 addition & 1 deletion chia/protocols/pool_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class ErrorResponse(Streamable):

# Get the current authentication token according to "Farmer authentication" in SPECIFICATION.md
def get_current_authentication_token(timeout: uint8) -> uint64:
return uint64(int(int(time.time() / 60) / timeout))
return uint64(int(time.time() / 60) / timeout)


# Validate a given authentication token against our local time
Expand Down
2 changes: 1 addition & 1 deletion chia/rpc/rpc_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ async def get_connections(self, request: dict[str, Any]) -> EndpointResult:
async def open_connection(self, request: dict[str, Any]) -> EndpointResult:
host = request["host"]
port = request["port"]
target_node: PeerInfo = PeerInfo(await resolve(host, prefer_ipv6=self.prefer_ipv6), uint16(int(port)))
target_node: PeerInfo = PeerInfo(await resolve(host, prefer_ipv6=self.prefer_ipv6), uint16(port))
on_connect = None
if hasattr(self.rpc_api.service, "on_connect"):
on_connect = self.rpc_api.service.on_connect
Expand Down
4 changes: 2 additions & 2 deletions chia/seeder/crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ async def load_bootstrap_peers(self) -> None:
uint64(0),
uint32(0),
uint64(0),
uint64(int(time.time())),
uint64(time.time()),
uint64(0),
"undefined",
uint64(0),
Expand Down Expand Up @@ -248,7 +248,7 @@ async def crawl(self) -> None:
uint64(0),
uint32(0),
uint64(0),
uint64(int(time.time())),
uint64(time.time()),
uint64(response_peer.timestamp),
"undefined",
uint64(0),
Expand Down
4 changes: 2 additions & 2 deletions chia/server/address_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ def parse(cls, data: io.BytesIO) -> ExtendedPeerInfo:
def from_string(cls, peer_str: str) -> ExtendedPeerInfo:
blobs = peer_str.split(" ")
assert len(blobs) == 5
peer_info = TimestampedPeerInfo(blobs[0], uint16(int(blobs[1])), uint64(int(blobs[2])))
src_peer = PeerInfo(blobs[3], uint16(int(blobs[4])))
peer_info = TimestampedPeerInfo(blobs[0], uint16(blobs[1]), uint64(blobs[2]))
src_peer = PeerInfo(blobs[3], uint16(blobs[4]))
return cls(peer_info, src_peer)

def get_tried_bucket(self, key: int) -> int:
Expand Down
2 changes: 1 addition & 1 deletion chia/server/introducer_peers.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def add(self, peer: Optional[PeerInfo]) -> bool:
return False

p = VettedPeer(peer.host, peer.port)
p.time_added = uint64(int(time.time()))
p.time_added = uint64(time.time())

if p in self._peers:
return True
Expand Down
Loading
Loading