From 426958f66301a9394719547770af2ff037c26bea Mon Sep 17 00:00:00 2001 From: Vladimir Lebedev Date: Tue, 11 Jun 2024 17:50:47 +0700 Subject: [PATCH] Remove development things, imporve usability, improve README, add CI --- .github/workflows/docker.yml | 87 ++++++ Cargo.lock | 111 +++++++ Cargo.toml | 4 +- Dockerfile | 14 +- README.md | 132 ++++++++- block-metrics/Dockerfile | 3 - block-metrics/global.config.json | 14 - config/config.example.yml | 91 ------ config/global.config.json | 461 ------------------------------ config/testnet-global.config.json | 326 --------------------- docker-compose.yml | 35 --- explorer/Dockerfile | 5 - src/main.rs | 81 +++++- 13 files changed, 411 insertions(+), 953 deletions(-) create mode 100644 .github/workflows/docker.yml delete mode 100644 block-metrics/Dockerfile delete mode 100644 block-metrics/global.config.json delete mode 100644 config/config.example.yml delete mode 100644 config/global.config.json delete mode 100644 config/testnet-global.config.json delete mode 100644 docker-compose.yml delete mode 100644 explorer/Dockerfile diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..199a0a9 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,87 @@ +name: Docker Image Publish + +on: + push: + branches: [ "master" ] + # Publish semver tags as releases. + tags: [ 'v*.*.*' ] + pull_request: + branches: [ "master" ] + +env: + # Use docker.io for Docker Hub if empty + REGISTRY: ghcr.io + # github.repository as / + IMAGE_NAME: ${{ github.repository }} + + +jobs: + build: + + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + # This is used to complete the identity challenge + # with sigstore/fulcio when running outside of PRs. + id-token: write + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Workaround: https://github.com/docker/build-push-action/issues/461 + - name: Setup Docker buildx + uses: docker/setup-buildx-action@v2 + + # Login against a Docker registry except on PR + # https://github.com/docker/login-action + - name: Log into registry ${{ env.REGISTRY }} + if: github.event_name != 'pull_request' + uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Extract metadata (tags, labels) for Docker + # https://github.com/docker/metadata-action + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + flavor: | + latest=${{ github.ref == 'refs/heads/master' }} + + # Buildkit cache + # https://github.com/reproducible-containers/buildkit-cache-dance + - name: Cache + uses: actions/cache@v3 + id: cache + with: + path: | + var-cache-buildkit + key: cache-${{ hashFiles('Dockerfile') }} + + - name: Inject cache into docker + uses: reproducible-containers/buildkit-cache-dance@v3.1.0 + with: + cache-map: | + { + "var-cache-buildkit": "/var/cache/buildkit" + } + skip-extraction: ${{ steps.cache.outputs.cache-hit }} + + # Build and push Docker image with Buildx (don't push on PR) + # https://github.com/docker/build-push-action + - name: Build and push Docker image + id: build-and-push + uses: docker/build-push-action@v4 + with: + context: "{{defaultContext}}" + push: ${{ github.event_name != 'pull_request' }} # Don't push on PR + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 4d68aa6..75c0a0e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -452,6 +452,15 @@ version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if", +] + [[package]] name = "crossbeam" version = "0.8.4" @@ -829,6 +838,16 @@ version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" +[[package]] +name = "flate2" +version = "1.0.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + [[package]] name = "fnv" version = "1.0.7" @@ -850,6 +869,12 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af2469fab0bd07e64ccf0ad57a1438f63160c69b2e57f04a439653d68eb558d6" +[[package]] +name = "fs_extra" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" + [[package]] name = "futures" version = "0.3.30" @@ -2032,6 +2057,21 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" +[[package]] +name = "ring" +version = "0.17.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" +dependencies = [ + "cc", + "cfg-if", + "getrandom", + "libc", + "spin", + "untrusted", + "windows-sys 0.52.0", +] + [[package]] name = "rlimit" version = "0.9.1" @@ -2085,6 +2125,37 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "rustls" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" +dependencies = [ + "log", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" + +[[package]] +name = "rustls-webpki" +version = "0.102.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff448f7e92e913c4b7d4c6d8e4540a1724b319b4152b8aef6d4cf8339712b33e" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + [[package]] name = "rustversion" version = "1.0.17" @@ -2283,6 +2354,12 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + [[package]] name = "strsim" version = "0.9.3" @@ -2634,6 +2711,7 @@ dependencies = [ "async-trait", "axum", "broxus-util", + "fs_extra", "futures-util", "hex", "metrics", @@ -2650,6 +2728,7 @@ dependencies = [ "tower", "tracing", "tracing-subscriber", + "ureq", "x25519-dalek", ] @@ -2928,6 +3007,29 @@ version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "ureq" +version = "2.9.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d11a831e3c0b56e438a28308e7c810799e3c118417f342d30ecec080105395cd" +dependencies = [ + "base64 0.22.1", + "flate2", + "log", + "once_cell", + "rustls", + "rustls-pki-types", + "rustls-webpki", + "url", + "webpki-roots", +] + [[package]] name = "url" version = "2.5.0" @@ -3037,6 +3139,15 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "webpki-roots" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c452ad30530b54a4d8e71952716a212b08efd0f3562baa66c29a618b07da7c3" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "weedb" version = "0.1.1" diff --git a/Cargo.toml b/Cargo.toml index 4b7259b..7851a71 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,4 +25,6 @@ hex = "0.4" x25519-dalek = { version = "2.0.1", features = ["static_secrets"] } metrics = "0.22.3" metrics-exporter-prometheus = { version = "0.14.0", default-features = false } -tokio-metrics-collector = { version = "0.2.1", features = ["rt"] } \ No newline at end of file +tokio-metrics-collector = { version = "0.2.1", features = ["rt"] } +ureq = "2.9.7" +fs_extra = "1.3.0" \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 0c7f2c9..9a85f5b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,6 +11,14 @@ RUN --mount=type=cache,target=/var/cache/buildkit \ FROM debian:bookworm-slim AS runtime WORKDIR /app COPY --from=builder /ton-node /usr/local/bin -COPY config /config -EXPOSE 3000 -ENTRYPOINT ["/usr/local/bin/ton-node"] \ No newline at end of file +VOLUME /data +ENTRYPOINT ["/usr/local/bin/ton-node"] + +# http +EXPOSE 3000/tcp + +# liteapi +EXPOSE 3333/tcp + +# nodes p2p +EXPOSE 30303/udp diff --git a/README.md b/README.md index 34c7b7a..d80d716 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,40 @@ # TON Liteserver in Rust +> :warning: **WARNING:** experimental software, not yet ready for production use + +## Usage + +### Docker CLI +```bash +# use mainnet config +docker run -d -it -P ghcr.io/hacker-volodya/liteserver + +# use testnet config +docker run -d -it -P ghcr.io/hacker-volodya/liteserver --testnet + +# use custom config from url +docker run -d -it -P ghcr.io/hacker-volodya/liteserver --global-config-url https://example.com/global.config.json + +# use local config +docker run -d -it -P -v $PWD/global.config.json:/global.config.json ghcr.io/hacker-volodya/liteserver --global-config-path /global.config.json + +# specify custom node config (examples below) +docker run -d -it -P -v $PWD/config.yml:/config.yml ghcr.io/hacker-volodya/liteserver --config /config.yml +``` + +### Docker Compose +```yaml +version: '2' +services: + liteserver: + image: ghcr.io/hacker-volodya/liteserver + ports: + - 30303:30303/udp # nodes p2p (host port and container port must be equal, container port is specified in config.yml) + - 3000:3000/tcp # web interface + - 3333:3333/tcp # liteapi + restart: always +``` + ## Method support | Status | Method | Description | |--------|--------|-------------| @@ -36,4 +71,99 @@ | 🔜 | GetState | 🔜 | GetOutMsgQueueSizes | 🔜 | GetValidatorGroups -| 🔜 | GetCandidate \ No newline at end of file +| 🔜 | GetCandidate + +## Node config example +```yaml +indexer: + ip_address: 0.0.0.0:30303 + rocks_db_path: /data/rocksdb + file_db_path: /data/file + state_gc_options: null + blocks_gc_options: + # - `before_previous_key_block` - on each new key block delete all blocks before the previous one + # - `before_previous_persistent_state` - on each new key block delete all blocks before the previous key block with persistent state + kind: before_previous_key_block + enable_for_sync: true # Whether to enable blocks GC during sync. + max_blocks_per_batch: 100000 # Max `WriteBatch` entries before apply + shard_state_cache_options: + ttl_sec: 120 # LRU cache item duration. + db_options: + rocksdb_lru_capacity: 1 GB + cells_cache_size: 2 GB + low_thread_pool_size: 8 + high_thread_pool_size: 8 + max_subcompactions: 8 + archive_options: + gc_interval: + # - `manual` - Do not perform archives GC + # - `persistent_states` - Archives GC triggers on each persistent state + type: persistent_states + offset_sec: 300 # Remove archives after this interval after the new persistent state + sync_options: + old_blocks_policy: # Whether to sync very old blocks + type: ignore + # type: sync + # from_seqno: 100 + parallel_archive_downloads: 16 + save_to_disk_threshold: 1073741824 + max_block_applier_depth: 32 + force_use_get_next_block: false # Ignore archives + persistent_state_options: + prepare_persistent_states: false + persistent_state_parallelism: 1 + remove_old_states: true + adnl_options: + query_min_timeout_ms: 500 # Minimal ADNL query timeout. Will override the used timeout if it is less. + query_default_timeout_ms: 5000 # Default ADNL query timeout. Will be used if no timeout is specified. + transfer_timeout_sec: 3 # ADNL multipart transfer timeout. It will drop the transfer if it is not completed within this timeout. + clock_tolerance_sec: 60 # Permissible time difference between remote and local clocks. + channel_reset_timeout_sec: 30 # Drop channels which had no response for this amount of time. + address_list_timeout_sec: 1000 # How much time address lists from packets should be valid. + packet_history_enabled: false # Whether to add additional duplicated packets check. + packet_signature_required: true # Whether handshake packets signature is mandatory. + force_use_priority_channels: false # Whether to use priority channels for queries. + use_loopback_for_neighbours: false # Whether to use loopback ip to communicate with nodes on the same ip + version: null # ADNL protocol version + rldp_options: + max_answer_size: 10485760 # Max allowed RLDP answer size in bytes. Query will be rejected if answer is bigger. + max_peer_queries: 16 # Max parallel RLDP queries per peer. + query_min_timeout_ms: 500 # Min RLDP query timeout. + query_max_timeout_ms: 10000 # Max RLDP query timeout + query_wave_len: 10 # Number of FEC messages to send in group. There will be a short delay between them. + query_wave_interval_ms: 10 # Interval between FEC broadcast waves. + force_compression: false # Whether requests will be compressed. + dht_options: + value_ttl_sec: 3600 # Default stored value timeout used for [`Node::store_overlay_node`] and [`Node::store_address`] + query_timeout_ms: 1000 # ADNL query timeout + default_value_batch_len: 5 # Amount of DHT peers, used for values search + bad_peer_threshold: 5 # Max peer penalty points. On each unsuccessful query every peer gains 2 points, and then they are reduced by one on each good action. + max_allowed_k: 20 # Max allowed `k` value for DHT `FindValue` query. + max_key_name_len: 127 # Max allowed key name length (in bytes). See [`everscale_network::proto::dht::Key`] + max_key_index: 15 # Max allowed key index + storage_gc_interval_ms: 10000 # Storage GC interval. Will remove all outdated entries + overlay_shard_options: + max_neighbours: 200 # More persistent list of peers. Used to distribute broadcasts. + max_broadcast_log: 1000 # Max simultaneous broadcasts. + broadcast_gc_interval_ms: 1000 # Broadcasts GC interval. Will leave at most `max_broadcast_log` each iteration. + overlay_peers_timeout_ms: 60000 # Neighbours or random peers update interval. + max_ordinary_broadcast_len: 768 # Packets with length bigger than this will be sent using FEC broadcast. + broadcast_target_count: 5 # Max number of peers to distribute broadcast to. + secondary_broadcast_target_count: 3 # Max number of peers to redistribute ordinary broadcast to. + secondary_fec_broadcast_target_count: 3 # Max number of peers to redistribute FEC broadcast to. + fec_broadcast_wave_len: 20 # Number of FEC messages to send in group. There will be a short delay between them. + fec_broadcast_wave_interval_ms: 10 # Interval between FEC broadcast waves. + broadcast_timeout_sec: 60 # Overlay broadcast timeout. It will be forcefully dropped if not received in this time. + force_compression: false # Whether requests will be compressed. + neighbours_options: + max_neighbours: 16 + reloading_min_interval_sec: 10 + reloading_max_interval_sec: 30 + ping_interval_ms: 500 + search_interval_ms: 1000 + ping_min_timeout_ms: 10 + ping_max_timeout_ms: 1000 + default_rldp_roundtrip_ms: 2000 + max_ping_tasks: 6 + max_exchange_tasks: 6 +``` diff --git a/block-metrics/Dockerfile b/block-metrics/Dockerfile deleted file mode 100644 index f07924a..0000000 --- a/block-metrics/Dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -FROM ghcr.io/hacker-volodya/block-metrics -COPY global.config.json / -CMD ["--config", "/global.config.json"] \ No newline at end of file diff --git a/block-metrics/global.config.json b/block-metrics/global.config.json deleted file mode 100644 index 360e09e..0000000 --- a/block-metrics/global.config.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "@type": "config.global", - "liteservers": [ - { - "ip": -1408172031, - "port": 3333, - "id": { - "@type": "pub.ed25519", - "key": "aRoUUo+ykRg5ZJxInLTL7B9KoSbCRMDqKsKU61aKcDc=" - } - } - ] - } - \ No newline at end of file diff --git a/config/config.example.yml b/config/config.example.yml deleted file mode 100644 index 0fed590..0000000 --- a/config/config.example.yml +++ /dev/null @@ -1,91 +0,0 @@ -indexer: - ip_address: 0.0.0.0:30303 - rocks_db_path: /data/rocksdb - file_db_path: /data/file - state_gc_options: null - blocks_gc_options: - # - `before_previous_key_block` - on each new key block delete all blocks before the previous one - # - `before_previous_persistent_state` - on each new key block delete all blocks before the previous key block with persistent state - kind: before_previous_key_block - enable_for_sync: true # Whether to enable blocks GC during sync. - max_blocks_per_batch: 100000 # Max `WriteBatch` entries before apply - shard_state_cache_options: - ttl_sec: 120 # LRU cache item duration. - db_options: - rocksdb_lru_capacity: 1 GB - cells_cache_size: 2 GB - low_thread_pool_size: 8 - high_thread_pool_size: 8 - max_subcompactions: 8 - archive_options: - gc_interval: - # - `manual` - Do not perform archives GC - # - `persistent_states` - Archives GC triggers on each persistent state - type: persistent_states - offset_sec: 300 # Remove archives after this interval after the new persistent state - sync_options: - old_blocks_policy: # Whether to sync very old blocks - type: ignore - # type: sync - # from_seqno: 100 - parallel_archive_downloads: 16 - save_to_disk_threshold: 1073741824 - max_block_applier_depth: 32 - force_use_get_next_block: false # Ignore archives - persistent_state_options: - prepare_persistent_states: false - persistent_state_parallelism: 1 - remove_old_states: true - adnl_options: - query_min_timeout_ms: 500 # Minimal ADNL query timeout. Will override the used timeout if it is less. - query_default_timeout_ms: 5000 # Default ADNL query timeout. Will be used if no timeout is specified. - transfer_timeout_sec: 3 # ADNL multipart transfer timeout. It will drop the transfer if it is not completed within this timeout. - clock_tolerance_sec: 60 # Permissible time difference between remote and local clocks. - channel_reset_timeout_sec: 30 # Drop channels which had no response for this amount of time. - address_list_timeout_sec: 1000 # How much time address lists from packets should be valid. - packet_history_enabled: false # Whether to add additional duplicated packets check. - packet_signature_required: true # Whether handshake packets signature is mandatory. - force_use_priority_channels: false # Whether to use priority channels for queries. - use_loopback_for_neighbours: false # Whether to use loopback ip to communicate with nodes on the same ip - version: null # ADNL protocol version - rldp_options: - max_answer_size: 10485760 # Max allowed RLDP answer size in bytes. Query will be rejected if answer is bigger. - max_peer_queries: 16 # Max parallel RLDP queries per peer. - query_min_timeout_ms: 500 # Min RLDP query timeout. - query_max_timeout_ms: 10000 # Max RLDP query timeout - query_wave_len: 10 # Number of FEC messages to send in group. There will be a short delay between them. - query_wave_interval_ms: 10 # Interval between FEC broadcast waves. - force_compression: false # Whether requests will be compressed. - dht_options: - value_ttl_sec: 3600 # Default stored value timeout used for [`Node::store_overlay_node`] and [`Node::store_address`] - query_timeout_ms: 1000 # ADNL query timeout - default_value_batch_len: 5 # Amount of DHT peers, used for values search - bad_peer_threshold: 5 # Max peer penalty points. On each unsuccessful query every peer gains 2 points, and then they are reduced by one on each good action. - max_allowed_k: 20 # Max allowed `k` value for DHT `FindValue` query. - max_key_name_len: 127 # Max allowed key name length (in bytes). See [`everscale_network::proto::dht::Key`] - max_key_index: 15 # Max allowed key index - storage_gc_interval_ms: 10000 # Storage GC interval. Will remove all outdated entries - overlay_shard_options: - max_neighbours: 200 # More persistent list of peers. Used to distribute broadcasts. - max_broadcast_log: 1000 # Max simultaneous broadcasts. - broadcast_gc_interval_ms: 1000 # Broadcasts GC interval. Will leave at most `max_broadcast_log` each iteration. - overlay_peers_timeout_ms: 60000 # Neighbours or random peers update interval. - max_ordinary_broadcast_len: 768 # Packets with length bigger than this will be sent using FEC broadcast. - broadcast_target_count: 5 # Max number of peers to distribute broadcast to. - secondary_broadcast_target_count: 3 # Max number of peers to redistribute ordinary broadcast to. - secondary_fec_broadcast_target_count: 3 # Max number of peers to redistribute FEC broadcast to. - fec_broadcast_wave_len: 20 # Number of FEC messages to send in group. There will be a short delay between them. - fec_broadcast_wave_interval_ms: 10 # Interval between FEC broadcast waves. - broadcast_timeout_sec: 60 # Overlay broadcast timeout. It will be forcefully dropped if not received in this time. - force_compression: false # Whether requests will be compressed. - neighbours_options: - max_neighbours: 16 - reloading_min_interval_sec: 10 - reloading_max_interval_sec: 30 - ping_interval_ms: 500 - search_interval_ms: 1000 - ping_min_timeout_ms: 10 - ping_max_timeout_ms: 1000 - default_rldp_roundtrip_ms: 2000 - max_ping_tasks: 6 - max_exchange_tasks: 6 diff --git a/config/global.config.json b/config/global.config.json deleted file mode 100644 index fe3c7ee..0000000 --- a/config/global.config.json +++ /dev/null @@ -1,461 +0,0 @@ -{ - "@type": "config.global", - "dht": { - "@type": "dht.config.global", - "k": 6, - "a": 3, - "static_nodes": { - "@type": "dht.nodes", - "nodes": [ - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "6PGkPQSbyFp12esf1NqmDOaLoFA8i9+Mp5+cAx5wtTU=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": -1185526007, - "port": 22096 - } - ], - "version": 0, - "reinit_date": 0, - "priority": 0, - "expire_at": 0 - }, - "version": -1, - "signature": "L4N1+dzXLlkmT5iPnvsmsixzXU0L6kPKApqMdcrGP5d9ssMhn69SzHFK+yIzvG6zQ9oRb4TnqPBaKShjjj2OBg==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "4R0C/zU56k+x2HGMsLWjX2rP/SpoTPIHSSAmidGlsb8=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": -1952265919, - "port": 14395 - } - ], - "version": 0, - "reinit_date": 0, - "priority": 0, - "expire_at": 0 - }, - "version": -1, - "signature": "0uwWyCFn2KjPnnlbSFYXLZdwIakaSgI9WyRo87J3iCGwb5TvJSztgA224A9kNAXeutOrXMIPYv1b8Zt8ImsrCg==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "/YDNd+IwRUgL0mq21oC0L3RxrS8gTu0nciSPUrhqR78=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": -1402455171, - "port": 14432 - } - ], - "version": 0, - "reinit_date": 0, - "priority": 0, - "expire_at": 0 - }, - "version": -1, - "signature": "6+oVk6HDtIFbwYi9khCc8B+fTFceBUo1PWZDVTkb4l84tscvr5QpzAkdK7sS5xGzxM7V7YYQ6gUQPrsP9xcLAw==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "DA0H568bb+LoO2LGY80PgPee59jTPCqqSJJzt1SH+KE=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": -1402397332, - "port": 14583 - } - ], - "version": 0, - "reinit_date": 0, - "priority": 0, - "expire_at": 0 - }, - "version": -1, - "signature": "cL79gDTrixhaM9AlkCdZWccCts7ieQYQBmPxb/R7d7zHw3bEHL8Le96CFJoB1KHu8C85iDpFK8qlrGl1Yt/ZDg==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "MJr8xja0xpu9DoisFXBrkNHNx1XozR7HHw9fJdSyEdo=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": -2018147130, - "port": 6302 - } - ], - "version": 0, - "reinit_date": 0, - "priority": 0, - "expire_at": 0 - }, - "version": -1, - "signature": "XcR5JaWcf4QMdI8urLSc1zwv5+9nCuItSE1EDa0dSwYF15R/BtJoKU5YHA4/T8SiO18aVPQk2SL1pbhevuMrAQ==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "Fhldu4zlnb20/TUj9TXElZkiEmbndIiE/DXrbGKu+0c=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": -2018147075, - "port": 6302 - } - ], - "version": 0, - "reinit_date": 0, - "priority": 0, - "expire_at": 0 - }, - "version": -1, - "signature": "nUGB77UAkd2+ZAL5PgInb3TvtuLLXJEJ2icjAUKLv4qIGB3c/O9k/v0NKwSzhsMP0ljeTGbcIoMDw24qf3goCg==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "gzUNJnBJhdpooYCE8juKZo2y4tYDIQfoCvFm0yBr7y0=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": 89013260, - "port": 54390 - } - ], - "version": 0, - "reinit_date": 0, - "priority": 0, - "expire_at": 0 - }, - "version": -1, - "signature": "LCrCkjmkMn6AZHW2I+oRm1gHK7CyBPfcb6LwsltskCPpNECyBl1GxZTX45n0xZtLgyBd/bOqMPBfawpQwWt1BA==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "jXiLaOQz1HPayilWgBWhV9xJhUIqfU95t+KFKQPIpXg=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": 94452896, - "port": 12485 - } - ], - "version": 0, - "reinit_date": 0, - "priority": 0, - "expire_at": 0 - }, - "version": -1, - "signature": "fKSZh9nXMx+YblkQXn3I/bndTD0JZ1yAtK/tXPIGruNglpe9sWMXR+8fy3YogPhLJMdjNiMom1ya+tWG7qvBAQ==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "vhFPq+tgjJi+4ZbEOHBo4qjpqhBdSCzNZBdgXyj3NK8=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": 85383775, - "port": 36752 - } - ], - "version": 0, - "reinit_date": 0, - "priority": 0, - "expire_at": 0 - }, - "version": -1, - "signature": "kBwAIgJVkz8AIOGoZcZcXWgNmWq8MSBWB2VhS8Pd+f9LLPIeeFxlDTtwAe8Kj7NkHDSDC+bPXLGQZvPv0+wHCg==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "sbsuMcdyYFSRQ0sG86/n+ZQ5FX3zOWm1aCVuHwXdgs0=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": 759132846, - "port": 50187 - } - ], - "version": 0, - "reinit_date": 0, - "priority": 0, - "expire_at": 0 - }, - "version": -1, - "signature": "9FJwbFw3IECRFkb9bA54YaexjDmlNBArimWkh+BvW88mjm3K2i5V2uaBPS3GubvXWOwdHLE2lzQBobgZRGMyCg==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "aeMgdMdkkbkfAS4+n4BEGgtqhkf2/zXrVWWECOJ/h3A=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": -1481887565, - "port": 25975 - } - ], - "version": 0, - "reinit_date": 0, - "priority": 0, - "expire_at": 0 - }, - "version": -1, - "signature": "z5ogivZWpQchkS4UR4wB7i2pfOpMwX9Nd/USxinL9LvJPa+/Aw3F1AytR9FX0BqDftxIYvblBYAB5JyAmlj+AA==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "rNzhnAlmtRn9rTzW6o2568S6bbOXly7ddO1olDws5wM=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": -2134428422, - "port": 45943 - } - ], - "version": 0, - "reinit_date": 0, - "priority": 0, - "expire_at": 0 - }, - "version": -1, - "signature": "sn/+ZfkfCSw2bHnEnv04AXX/Goyw7+StHBPQOdPr+wvdbaJ761D7hyiMNdQGbuZv2Ep2cXJpiwylnZItrwdUDg==" - } - ] - } - }, - "liteservers": [ - { - "ip": 84478511, - "port": 19949, - "id": { - "@type": "pub.ed25519", - "key": "n4VDnSCUuSpjnCyUk9e3QOOd6o0ItSWYbTnW3Wnn8wk=" - } - }, - { - "ip": 84478479, - "port": 48014, - "id": { - "@type": "pub.ed25519", - "key": "3XO67K/qi+gu3T9v8G2hx1yNmWZhccL3O7SoosFo8G0=" - } - }, - { - "ip": -2018135749, - "port": 53312, - "id": { - "@type": "pub.ed25519", - "key": "aF91CuUHuuOv9rm2W5+O/4h38M3sRm40DtSdRxQhmtQ=" - } - }, - { - "ip": -2018145068, - "port": 13206, - "id": { - "@type": "pub.ed25519", - "key": "K0t3+IWLOXHYMvMcrGZDPs+pn58a17LFbnXoQkKc2xw=" - } - }, - { - "ip": -2018145059, - "port": 46995, - "id": { - "@type": "pub.ed25519", - "key": "wQE0MVhXNWUXpWiW5Bk8cAirIh5NNG3cZM1/fSVKIts=" - } - }, - { - "ip": 1091931625, - "port": 30131, - "id": { - "@type": "pub.ed25519", - "key": "wrQaeIFispPfHndEBc0s0fx7GSp8UFFvebnytQQfc6A=" - } - }, - { - "ip": 1091931590, - "port": 47160, - "id": { - "@type": "pub.ed25519", - "key": "vOe1Xqt/1AQ2Z56Pr+1Rnw+f0NmAA7rNCZFIHeChB7o=" - } - }, - { - "ip": 1091931623, - "port": 17728, - "id": { - "@type": "pub.ed25519", - "key": "BYSVpL7aPk0kU5CtlsIae/8mf2B/NrBi7DKmepcjX6Q=" - } - }, - { - "ip": 1091931589, - "port": 13570, - "id": { - "@type": "pub.ed25519", - "key": "iVQH71cymoNgnrhOT35tl/Y7k86X5iVuu5Vf68KmifQ=" - } - }, - { - "ip": -1539021362, - "port": 52995, - "id": { - "@type": "pub.ed25519", - "key": "QnGFe9kihW+TKacEvvxFWqVXeRxCB6ChjjhNTrL7+/k=" - } - }, - { - "ip": -1539021936, - "port": 20334, - "id": { - "@type": "pub.ed25519", - "key": "gyLh12v4hBRtyBygvvbbO2HqEtgl+ojpeRJKt4gkMq0=" - } - }, - { - "ip": -1136338705, - "port": 19925, - "id": { - "@type": "pub.ed25519", - "key": "ucho5bEkufbKN1JR1BGHpkObq602whJn3Q3UwhtgSo4=" - } - }, - { - "ip": 868465979, - "port": 19434, - "id": { - "@type": "pub.ed25519", - "key": "J5CwYXuCZWVPgiFPW+NY2roBwDWpRRtANHSTYTRSVtI=" - } - }, - { - "ip": 868466060, - "port": 23067, - "id": { - "@type": "pub.ed25519", - "key": "vX8d0i31zB0prVuZK8fBkt37WnEpuEHrb7PElk4FJ1o=" - } - }, - { - "ip": -2018147130, - "port": 53560, - "id": { - "@type": "pub.ed25519", - "key": "NlYhh/xf4uQpE+7EzgorPHqIaqildznrpajJTRRH2HU=" - } - }, - { - "ip": -2018147075, - "port": 46529, - "id": { - "@type": "pub.ed25519", - "key": "jLO6yoooqUQqg4/1QXflpv2qGCoXmzZCR+bOsYJ2hxw=" - } - }, - { - "ip": 908566172, - "port": 51565, - "id": { - "@type": "pub.ed25519", - "key": "TDg+ILLlRugRB4Kpg3wXjPcoc+d+Eeb7kuVe16CS9z8=" - } - }, - { - "ip": -1185526007, - "port": 4701, - "id": { - "@type": "pub.ed25519", - "key": "G6cNAr6wXBBByWDzddEWP5xMFsAcp6y13fXA8Q7EJlM=" - } - } - ], - "validator": { - "@type": "validator.config.global", - "zero_state": { - "workchain": -1, - "shard": -9223372036854775808, - "seqno": 0, - "root_hash": "F6OpKZKqvqeFp6CQmFomXNMfMj2EnaUSOXN+Mh+wVWk=", - "file_hash": "XplPz01CXAps5qeSWUtxcyBfdAo5zVb1N979KLSKD24=" - }, - "init_block": { - "root_hash": "VpWyfNOLm8Rqt6CZZ9dZGqJRO3NyrlHHYN1k1oLbJ6g=", - "seqno": 34835953, - "file_hash": "8o12KX54BtJM8RERD1J97Qe1ZWk61LIIyXydlBnixK8=", - "workchain": -1, - "shard": -9223372036854775808 - }, - "hardforks": [ - { - "file_hash": "t/9VBPODF7Zdh4nsnA49dprO69nQNMqYL+zk5bCjV/8=", - "seqno": 8536841, - "root_hash": "08Kpc9XxrMKC6BF/FeNHPS3MEL1/Vi/fQU/C9ELUrkc=", - "workchain": -1, - "shard": -9223372036854775808 - } - ] - } -} diff --git a/config/testnet-global.config.json b/config/testnet-global.config.json deleted file mode 100644 index 8af8277..0000000 --- a/config/testnet-global.config.json +++ /dev/null @@ -1,326 +0,0 @@ -{ - "liteservers": [ - { - "ip": 822907680, - "port": 27842, - "provided":"Beavis", - "id": { - "@type": "pub.ed25519", - "key": "sU7QavX2F964iI9oToP9gffQpCQIoOLppeqL/pdPvpM=" - } - }, - { - "ip": -1468571697, - "port": 27787, - "provided":"Beavis", - "id": { - "@type": "pub.ed25519", - "key": "Y/QVf6G5VDiKTZOKitbFVm067WsuocTN8Vg036A4zGk=" - } - }, - { - "ip": -1468575011, - "port": 51088, - "provided":"Beavis", - "id": { - "@type": "pub.ed25519", - "key": "Sy5ghr3EahQd/1rDayzZXt5+inlfF+7kLfkZDJcU/ek=" - } - }, - { - "ip": 1844203537, - "port": 37537, - "provided":"Neo", - "id": { - "@type": "pub.ed25519", - "key": "K1F7zEe0ETf+SwkefLS56hJE8x42sjCVsBJJuaY7nEA=" - } - }, - { - "ip": 1844203589, - "port": 34411, - "provided":"Neo", - "id": { - "@type": "pub.ed25519", - "key": "pOpRRpIxDuMRm1qFUPpvVjD62vo8azkO0npw4FPcW/I=" - } - }, - { - "ip": 1047529523, - "port": 37649, - "provided":"Neo", - "id": { - "@type": "pub.ed25519", - "key": "pRf2sAa7d+Chl8gDclWOMtthtxjKnLYeAIzk869mMvA=" - } - }, - { - "ip": 1592601963, - "port": 13833, - "id": { - "@type": "pub.ed25519", - "key": "QpVqQiv1u3nCHuBR3cg3fT6NqaFLlnLGbEgtBRukDpU=" - } - }, - { - "ip": 1162057690, - "port": 35939, - "id": { - "@type": "pub.ed25519", - "key": "97y55AkdzXWyyVuOAn+WX6p66XTNs2hEGG0jFUOkCIo=" - } - }, - { - "ip": -1304477830, - "port": 20700, - "id": { - "@type": "pub.ed25519", - "key": "dGLlRRai3K9FGkI0dhABmFHMv+92QEVrvmTrFf5fbqA=" - } - }, - { - "ip": 1959453117, - "port": 20700, - "id": { - "@type": "pub.ed25519", - "key": "24RL7iVI20qcG+j//URfd/XFeEG9qtezW2wqaYQgVKw=" - } - }, - { - "ip": -809760973, - "port": 20700, - "id": { - "@type": "pub.ed25519", - "key": "vunMV7K35yPlTQPx/Fqk6s+4/h5lpcbP+ao0Cy3M2hw=" - } - }, - { - "ip": 1097633201, - "port": 17439, - "id": { - "@type": "pub.ed25519", - "key": "0MIADpLH4VQn+INHfm0FxGiuZZAA8JfTujRqQugkkA8=" - } - }, - { - "ip": 1091956407, - "port": 16351, - "id": { - "@type": "pub.ed25519", - "key": "Mf/JGvcWAvcrN3oheze8RF/ps6p7oL6ifrIzFmGQFQ8=" - } - } - ], - "dht": { - "a": 3, - "k": 3, - "static_nodes": { - "nodes": [ - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "K2AWu8leN2RjYmhMpYAaGX/F6nGVk9oZw9c09RX3yyc=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": 1592601963, - "port": 38723 - } - ], - "version": 0, - "reinit_date": 0, - "priority": 0, - "expire_at": 0 - }, - "version": -1, - "signature": "21g16jxnqbb2ENAijrZFccHqLQcmmpkAI1HA46DaPvnVYvMkATFNEyHTy2R1T1jgU5M7CCLGJN+MxhwZfl/ZDA==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "fVIJzD9ATMilaPd847eFs6PtGSB67C+D9b4R+nf1+/s=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": 1097649206, - "port": 29081 - } - ], - "version": 0, - "reinit_date": 0, - "priority": 0, - "expire_at": 0 - }, - "version": -1, - "signature": "wH0HEVT6yAfZZAoD5bF6J3EZWdSFwBGl1ZpOfhxZ0Bp2u52tv8OzjeH8tlZ+geMLTG50Csn5nxSKP1tswTWwBg==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "gu+woR+x7PoRmaMqAP7oeOjK2V4U0NU8ofdacWZ34aY=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": 1162057690, - "port": 41578 - } - ], - "version": 0, - "reinit_date": 0, - "priority": 0, - "expire_at": 0 - }, - "version": -1, - "signature": "0PwDLXpN3IbRQuOTLkZBjkbT6+IkeUcvlhWrUY9us3IfSehmCfQjScR9mkVYsQ6cQHF+JeaFmqzV4GAiUcgjAg==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "WC4BO1eZ916FnLBSKmt07Pn5NP4D3/1wary1VjaCLaY=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": -1304477830, - "port": 9670 - } - ], - "version": 0, - "reinit_date": 0, - "priority": 0, - "expire_at": 0 - }, - "version": -1, - "signature": "cvpzkGeuEuKV+d92qIVkln9ngm8qeDnmYtK5rq8uSet0392hAZcIv2IniDzTw0rN42NaOHL9A4KEelwKu1N2Ag==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "nC8dcxV+EV2i0ARvub94IFJKKZUYACfY4xFj1NaG7Pw=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": 1959453117, - "port": 63625 - } - ], - "version": 0, - "reinit_date": 0, - "priority": 0, - "expire_at": 0 - }, - "version": -1, - "signature": "AHF6joNvQhyFFE0itV4OMA9n3Q8CEHVKapCLqazP7QJ4arsn4pdVkRYiGFEyQkngx+cm8izU4gB0JIaxF6PiBg==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "dqsRZLzTg/P7uxUlQpgl4VyTBNYBRMc4js3mnRiolBk=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": -809760973, - "port": 40398 - } - ], - "version": 0, - "reinit_date": 0, - "priority": 0, - "expire_at": 0 - }, - "version": -1, - "signature": "mJxLrAv5RamN5B9mDz6MhQwFjF92D3drJ5efOSZryDaazil0AR4bRHh4vxzZlYiPhi/X/NyG6WwNvKBz+1ntBw==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "fO6cFYRCRrD+yQzOJdHcNWpRFwu+qLhQnddLq0gGbTs=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": 1097633201, - "port": 7201 - } - ], - "version": 0, - "reinit_date": 0, - "priority": 0, - "expire_at": 0 - }, - "version": -1, - "signature": "o/rhtiUL3rvA08TKBcCn0DCiSjsNQdAv41aw7VVUig7ubaqJzYMv1cW3qMjxvsXn1BOugIheJm7voA1/brbtCg==" - } - ], - "@type": "dht.nodes" - }, - "@type": "dht.config.global" - }, - "@type": "config.global", - "validator": { - "zero_state": { - "file_hash": "Z+IKwYS54DmmJmesw/nAD5DzWadnOCMzee+kdgSYDOg=", - "seqno": 0, - "root_hash": "gj+B8wb/AmlPk1z1AhVI484rhrUpgSr2oSFIh56VoSg=", - "workchain": -1, - "shard": -9223372036854775808 - }, - "@type": "validator.config.global", - "init_block": { - "workchain": -1, - "shard": -9223372036854775808, - "seqno": 17908219, - "root_hash": "y6qWqhCnLgzWHjUFmXysaiOljuK5xVoCRMLzUwGInVM=", - "file_hash": "Y/GziXxwuYte0AM4WT7tTWsCx+6rcfLpGmRaEQwhUKI=" - }, - "hardforks": [ - { - "file_hash": "jF3RTD+OyOoP+OI9oIjdV6M8EaOh9E+8+c3m5JkPYdg=", - "seqno": 5141579, - "root_hash": "6JSqIYIkW7y8IorxfbQBoXiuY3kXjcoYgQOxTJpjXXA=", - "workchain": -1, - "shard": -9223372036854775808 - }, - { - "file_hash": "WrNoMrn5UIVPDV/ug/VPjYatvde8TPvz5v1VYHCLPh8=", - "seqno": 5172980, - "root_hash": "054VCNNtUEwYGoRe1zjH+9b1q21/MeM+3fOo76Vcjes=", - "workchain": -1, - "shard": -9223372036854775808 - }, - { - "file_hash": "xRaxgUwgTXYFb16YnR+Q+VVsczLl6jmYwvzhQ/ncrh4=", - "seqno": 5176527, - "root_hash": "SoPLqMe9Dz26YJPOGDOHApTSe5i0kXFtRmRh/zPMGuI=", - "workchain": -1, - "shard": -9223372036854775808 - } - ] - } -} diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 5befd90..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,35 +0,0 @@ -version: '2' -services: - app: - build: . - command: ["-c", "/config/config.yml", "--global-config", "/config/global.config.json"] - ports: - - 30303:30303/udp - - 3000:3000/tcp - - 172.17.0.1:3333:3333/tcp - volumes: - - data:/data - restart: always - explorer: - build: explorer - restart: always - ports: - - 80:8080 - block-metrics: - build: block-metrics - restart: always - ports: - - 3001:3000 - logs: - image: amir20/dozzle:v5.8.1 - restart: unless-stopped - environment: - - DOZZLE_BASE=/logs - - DOZZLE_PASSWORD=root - - DOZZLE_USERNAME=root - volumes: - - /var/run/docker.sock:/var/run/docker.sock:ro - ports: - - 3002:8080 -volumes: - data: \ No newline at end of file diff --git a/explorer/Dockerfile b/explorer/Dockerfile deleted file mode 100644 index ff3844a..0000000 --- a/explorer/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM ubuntu:22.04 -RUN apt update -y && apt install -y gnupg2 software-properties-common && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F6A649124520E5F3 && add-apt-repository ppa:ton-foundation/ppa && apt install ton -RUN echo xrQTSGkaFFKPspEYOWScSJy0y+wfSqEmwkTA6irClOtWinA3 | base64 -d > key.pub -CMD blockchain-explorer -a app:3333 -p key.pub -H 8080 -v9 -EXPOSE 8080 \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index a8a29a6..b6e9036 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,7 +9,6 @@ use std::sync::Arc; use anyhow::Result; use argh::FromArgs; -use metrics::set_global_recorder; use metrics_exporter_prometheus::PrometheusBuilder; use serde::{Deserialize, Serialize}; use tracing_subscriber::{fmt::format::FmtSpan, EnvFilter}; @@ -22,13 +21,21 @@ static GLOBAL: ton_indexer::alloc::Allocator = ton_indexer::alloc::allocator(); #[derive(Debug, FromArgs)] #[argh(description = "")] pub struct App { - /// path to config - #[argh(option, short = 'c', default = "String::from(\"config.yaml\")")] - pub config: String, + /// path to node config + #[argh(option, short = 'c')] + pub config: Option, /// path to the global config with zerostate and static dht nodes - #[argh(option, default = "String::from(\"ton-global.config.json\")")] - pub global_config: String, + #[argh(option)] + pub global_config_path: Option, + + /// url to the global config with zerostate and static dht nodes + #[argh(option)] + pub global_config_url: Option, + + /// if path or url are not specified, download global config from https://ton.org/global.config.json (default) or https://ton.org/testnet-global.config.json (--testnet flag) + #[argh(switch)] + pub testnet: bool, } #[tokio::main] @@ -38,7 +45,6 @@ async fn main() -> Result<()> { .with_default_directive(tracing::Level::INFO.into()) .from_env_lossy(), ); - logger.init(); let any_signal = broxus_util::any_signal(broxus_util::TERMINATION_SIGNALS); @@ -63,48 +69,97 @@ struct BlockSubscriber; impl Subscriber for BlockSubscriber {} async fn run(app: App) -> Result<()> { + if app.global_config_path.is_some() && app.global_config_url.is_some() { + anyhow::bail!("only one of --global-config-path and --global-config-url can be specified"); + } else if app.testnet && (app.global_config_path.is_some() || app.global_config_url.is_some()) { + anyhow::bail!("--testnet flag cannot be used with --global-config-path or --global-config-url"); + } + // SAFETY: global allocator is set to jemalloc + tracing::info!("Applying allocator config..."); unsafe { ton_indexer::alloc::apply_config() }; // TODO: option to configure using environment variables, auto-generate and store private keys - let mut config: Config = broxus_util::read_config(app.config)?; + let mut config = if let Some(config) = app.config { + broxus_util::read_config(config)? + } else { + tracing::info!("-c option is not set, using default node configuration"); + Config::default() + }; + tracing::info!(?config, "Node configuration is done"); + + tracing::info!("RocksDB size is {} GB", fs_extra::dir::get_size(&config.indexer.rocks_db_path).unwrap_or(0) >> 30); + tracing::info!("File DB size is {} GB", fs_extra::dir::get_size(&config.indexer.file_db_path).unwrap_or(0) >> 30); + + tracing::info!("Resolving public IPv4 for node ADNL->IP DHT entry..."); config .indexer .ip_address .set_ip(broxus_util::resolve_public_ip(None).await?); + tracing::info!(?config.indexer.ip_address, "IP is resolved"); + // prometheus metrics let builder = PrometheusBuilder::new(); let recorder = builder.install_recorder()?; - prometheus::default_registry() .register(Box::new( tokio_metrics_collector::default_runtime_collector(), ))?; - let global_config = read_global_config(app.global_config)?; + let global_config = if let Some(path) = app.global_config_path { + read_global_config_from_path(path)? + } else if let Some(url) = app.global_config_url { + read_global_config_from_url(&url)? + } else if app.testnet { + read_global_config_from_url("https://ton.org/testnet-global.config.json")? + } else { + read_global_config_from_url("https://ton.org/global.config.json")? + }; + + tracing::info!("Initializing engine..."); let engine = Engine::new( config.indexer, global_config.clone(), Arc::new(BlockSubscriber), ) .await?; + + tracing::info!("Initializing web server..."); web::run(engine.clone(), recorder).await?; + + tracing::info!("Initializing liteserver..."); liteserver::run(engine.clone(), global_config); + + tracing::info!("Starting engine..."); engine.start().await?; + + tracing::info!("Engine is running"); futures_util::future::pending().await } -#[derive(Serialize, Deserialize)] +#[derive(Serialize, Deserialize, Default, Debug)] struct Config { indexer: NodeConfig, } -fn read_global_config(path: T) -> Result +fn read_global_config_from_path(path: T) -> Result where - T: AsRef, + T: AsRef + std::fmt::Display, { + tracing::info!("Loading global config from path {path}"); let file = std::fs::File::open(path)?; let reader = std::io::BufReader::new(file); let config = serde_json::from_reader(reader)?; Ok(config) } + +fn read_global_config_from_url(url: &str) -> Result { + tracing::info!("Loading global config from url {url}"); + let response = ureq::get(url).call() + .map_err(|e| anyhow::anyhow!("Error occurred while fetching config from {}: {:?}. Use --global-config-path if you have local config.", url, e))?; + if response.status() != 200 { + anyhow::bail!("Error occurred while fetching config from {}: {}", url, response.status()); + } + let config = serde_json::from_reader(response.into_reader())?; + Ok(config) +} \ No newline at end of file