-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge commit '474d0646f9d8744138d38ce6b3b12277c71799df' into catchup/…
…long_lived_vault_from_main_474d0646f9d8744138d38ce6b3b12277c71799df
- Loading branch information
Showing
128 changed files
with
2,076 additions
and
1,874 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
from __future__ import annotations | ||
|
||
import asyncio | ||
import cProfile | ||
import time | ||
from contextlib import contextmanager | ||
from subprocess import check_call | ||
from typing import Iterator | ||
|
||
from chia.simulator.block_tools import create_block_tools_async, test_constants | ||
from chia.simulator.keyring import TempKeyring | ||
from chia.util.keyring_wrapper import KeyringWrapper | ||
from tests.util.blockchain import persistent_blocks | ||
|
||
|
||
@contextmanager | ||
def enable_profiler(profile: bool, name: str) -> Iterator[None]: | ||
if not profile: | ||
yield | ||
return | ||
|
||
with cProfile.Profile() as pr: | ||
yield | ||
|
||
pr.create_stats() | ||
output_file = f"{name}" | ||
pr.dump_stats(output_file + ".profile") | ||
check_call(["gprof2dot", "-f", "pstats", "-o", output_file + ".dot", output_file + ".profile"]) | ||
with open(output_file + ".png", "w+") as f: | ||
check_call(["dot", "-T", "png", output_file + ".dot"], stdout=f) | ||
print(" output written to: %s.png" % output_file) | ||
|
||
|
||
async def run_test_chain_benchmark() -> None: | ||
with TempKeyring() as keychain: | ||
bt = await create_block_tools_async(constants=test_constants, keychain=keychain) | ||
with enable_profiler(True, "load-test-chain"): | ||
start = time.monotonic() | ||
for version in ["", "_hardfork"]: | ||
for count, name in [ | ||
(400, "test_blocks_400_rc5"), | ||
(1000, "test_blocks_1000_rc5"), | ||
(1000, "pre_genesis_empty_slots_1000_blocksrc5"), | ||
(1500, "test_blocks_1500_rc5"), | ||
(10000, "test_blocks_10000_rc5"), | ||
(758 + 320, "test_blocks_long_reorg_rc5"), | ||
(2000, "test_blocks_2000_compact_rc5"), | ||
(10000, "test_blocks_10000_compact_rc5"), | ||
]: | ||
persistent_blocks(count, f"{name}{version}.db", bt, seed=b"100") | ||
end = time.monotonic() | ||
KeyringWrapper.cleanup_shared_instance() | ||
|
||
print(f"time to load test chains: {end - start:.2f}s") | ||
|
||
|
||
if __name__ == "__main__": | ||
import logging | ||
|
||
logger = logging.getLogger() | ||
logger.addHandler(logging.StreamHandler()) | ||
logger.setLevel(logging.WARNING) | ||
|
||
asyncio.run(run_test_chain_benchmark()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[Unit] | ||
Description=Chia Crawler Service for %i | ||
Requires=chia-daemon@%i.service | ||
After=chia-daemon@%i.service | ||
|
||
[Service] | ||
Type=simple | ||
Environment=CHIA_ROOT=/home/%i/.chia/mainnet | ||
ExecStart=/opt/chia/start_crawler | ||
User=%i | ||
Group=%i | ||
LimitNOFILE=1048576 | ||
LimitNPROC=1048576 | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[Unit] | ||
Description=Chia Daemon Service for %i | ||
StopWhenUnneeded=true | ||
|
||
[Service] | ||
Type=simple | ||
Environment=CHIA_ROOT=/home/%i/.chia/mainnet | ||
ExecStart=/opt/chia/daemon | ||
ExecStartPost=/bin/bash -c '(while ! nc -z -v -w1 localhost 55400 2>/dev/null; do echo "Waiting for the daemon to listen on port 55400..."; sleep 1; done); sleep 1' | ||
User=%i | ||
Group=%i | ||
LimitNOFILE=1048576 | ||
LimitNPROC=1048576 | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
17 changes: 17 additions & 0 deletions
17
build_scripts/assets/systemd/chia-data-layer-http@.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[Unit] | ||
Description=Chia Data Layer HTTP Service for %i | ||
Requires=chia-daemon@%i.service | ||
After=chia-daemon@%i.service | ||
|
||
[Service] | ||
Type=simple | ||
Environment=CHIA_ROOT=/home/%i/.chia/mainnet | ||
ExecStart=/opt/chia/start_data_layer_http | ||
User=%i | ||
Group=%i | ||
LimitNOFILE=1048576 | ||
LimitNPROC=1048576 | ||
TimeoutStopSec=15 | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[Unit] | ||
Description=Chia Data Layer Service for %i | ||
Requires=chia-daemon@%i.service | ||
After=chia-daemon@%i.service | ||
|
||
[Service] | ||
Type=simple | ||
Environment=CHIA_ROOT=/home/%i/.chia/mainnet | ||
ExecStart=/opt/chia/start_data_layer | ||
User=%i | ||
Group=%i | ||
LimitNOFILE=1048576 | ||
LimitNPROC=1048576 | ||
TimeoutStopSec=15 | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
Oops, something went wrong.