opentensor / subtensor

Bittensor Blockchain Layer
The Unlicense
146 stars 150 forks source link

Localnet does not produce blocks #543

Closed soywod closed 1 month ago

soywod commented 3 months ago

Describe the bug

I try to create a subnet following this documentation: https://docs.bittensor.com/subnets/create-a-subnet.

Running ./scripts/localnet.sh works, but then shows indefinitely the same log:

$ ./scripts/localnet.sh 
*** Building substrate binary...
warning: field `backend` is never read
  --> node/src/rpc.rs:45:9
   |
35 | pub struct FullDeps<C, P, B> {
   |            -------- field in this struct
...
45 |     pub backend: Arc<B>,
   |         ^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default

warning: `node-subtensor` (bin "node-subtensor") generated 1 warning
    Finished `release` profile [optimized] target(s) in 0.69s
*** Binary compiled
*** Starting localnet nodes...
2024-06-17 14:50:04 Subtensor Node    
2024-06-17 14:50:04 ✌️  version 4.0.0-dev-ebb72e353e5    
2024-06-17 14:50:04 ❤️  by Substrate DevHub <https://github.com/substrate-developer-hub>, 2017-2024    
2024-06-17 14:50:04 📋 Chain specification: Bittensor    
2024-06-17 14:50:04 🏷  Node name: Bob    
2024-06-17 14:50:04 👤 Role: AUTHORITY    
2024-06-17 14:50:04 💾 Database: RocksDb at /tmp/bob/chains/bittensor/db/full    
2024-06-17 14:50:04 Subtensor Node    
2024-06-17 14:50:04 ✌️  version 4.0.0-dev-ebb72e353e5    
2024-06-17 14:50:04 ❤️  by Substrate DevHub <https://github.com/substrate-developer-hub>, 2017-2024    
2024-06-17 14:50:04 📋 Chain specification: Bittensor    
2024-06-17 14:50:04 🏷  Node name: Alice    
2024-06-17 14:50:04 👤 Role: AUTHORITY    
2024-06-17 14:50:04 💾 Database: RocksDb at /tmp/alice/chains/bittensor/db/full    
2024-06-17 14:50:05 Using default protocol ID "sup" because none is configured in the chain specs    
2024-06-17 14:50:05 🏷  Local node identity is: 12D3KooW9wi7xkoYqjKst12kJKWBAg3kAygpgcg5ZM1xoHEtCx4W    
2024-06-17 14:50:05 💻 Operating system: linux    
2024-06-17 14:50:05 💻 CPU architecture: x86_64    
2024-06-17 14:50:05 💻 Target environment: gnu    
2024-06-17 14:50:05 💻 CPU: 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz    
2024-06-17 14:50:05 💻 CPU cores: 4    
2024-06-17 14:50:05 💻 Memory: 31808MB    
2024-06-17 14:50:05 💻 Kernel: 6.6.28    
2024-06-17 14:50:05 💻 Linux distribution: NixOS 24.05 (Uakari)    
2024-06-17 14:50:05 💻 Virtual machine: no    
2024-06-17 14:50:05 📦 Highest known block at #0    
2024-06-17 14:50:05 Running JSON-RPC server: addr=127.0.0.1:9946, allowed origins=["*"]    
2024-06-17 14:50:05 〽️ Prometheus exporter started at 127.0.0.1:9615    
2024-06-17 14:50:05 Using default protocol ID "sup" because none is configured in the chain specs    
2024-06-17 14:50:05 🏷  Local node identity is: 12D3KooWNCYHzJMecM1NSdb9UgUjFrA7Po8AXJ6fo5dt1tpwAmer    
2024-06-17 14:50:05 💻 Operating system: linux    
2024-06-17 14:50:05 💻 CPU architecture: x86_64    
2024-06-17 14:50:05 💻 Target environment: gnu    
2024-06-17 14:50:05 💻 CPU: 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz    
2024-06-17 14:50:05 💻 CPU cores: 4    
2024-06-17 14:50:05 💻 Memory: 31808MB    
2024-06-17 14:50:05 💻 Kernel: 6.6.28    
2024-06-17 14:50:05 💻 Linux distribution: NixOS 24.05 (Uakari)    
2024-06-17 14:50:05 💻 Virtual machine: no    
2024-06-17 14:50:05 📦 Highest known block at #0    
2024-06-17 14:50:05 Running JSON-RPC server: addr=127.0.0.1:9945, allowed origins=["http://localhost:*", "http://127.0.0.1:*", "https://localhost:*", "https://127.0.0.1:*", "https://polkadot.js.org"]    
2024-06-17 14:50:10 💤 Idle (0 peers), best: #0 (0xc6f4…53e6), finalized #0 (0xc6f4…53e6), ⬇ 0 ⬆ 0    
2024-06-17 14:50:10 💤 Idle (0 peers), best: #0 (0xc6f4…53e6), finalized #0 (0xc6f4…53e6), ⬇ 0 ⬆ 0    
2024-06-17 14:50:15 💤 Idle (0 peers), best: #0 (0xc6f4…53e6), finalized #0 (0xc6f4…53e6), ⬇ 0 ⬆ 0    
2024-06-17 14:50:15 💤 Idle (0 peers), best: #0 (0xc6f4…53e6), finalized #0 (0xc6f4…53e6), ⬇ 0 ⬆ 0    
2024-06-17 14:50:20 💤 Idle (0 peers), best: #0 (0xc6f4…53e6), finalized #0 (0xc6f4…53e6), ⬇ 0 ⬆ 0    
2024-06-17 14:50:20 💤 Idle (0 peers), best: #0 (0xc6f4…53e6), finalized #0 (0xc6f4…53e6), ⬇ 0 ⬆ 0    
[…]

When I run:

$ btcli wallet faucet --wallet.name owner --subtensor.chain_endpoint ws://127.0.0.1:9946
Run Faucet ?
 coldkey:    5F93HA9yz1TnHqAnLV4BChgYY8TjSEmqq24BBQcFAYTQtMQk
 network:    local [y/n]: y

It just hangs, no logs from both sides.

To Reproduce

Just follow documentation on subnet creation: https://docs.bittensor.com/subnets/create-a-subnet

Fails on wallet faucet command due to freeze.

Expected behavior

I expect the wallet faucet command to output:

>> Balance: τ0.000000000 ➡ τ100.000000000

Screenshots

No response

Environment

NixOS 24.05, bittensor cli v7.2.0, subtensor branch development (ebb72e)

Additional context

No response

distributedstatemachine commented 3 months ago

Thanks for reaching out @soywod . What branch subtensor branch are you building off ?

soywod commented 3 months ago

I tried main, then v1.1.2, v1.1.1-pre-release and finally development.

I initiated the discussion on Discord (the forum section), I received some help. Somehow running the localnet script from a docker (debian) works, so it looks like an issue with the network (related to NixOS?). Now I have a ConnectionResetError: [Errno 104] Connection reset by peer when I attempt to wallet faucet.

soywod commented 3 months ago

I finally found the solution: mDNS was disabled on my OS and I needed to enable it for nodes to be discovered. I will propose a PR to improve the doc.

distributedstatemachine commented 3 months ago

Sounds good. can you please submit the PR and link it to this issue so we can close it.

soywod commented 3 months ago

Sounds good. can you please submit the PR and link it to this issue so we can close it.

Yes, I was planning to do so. Thank you!

distributedstatemachine commented 3 months ago

@soywod still waiting on that PR sir!

soywod commented 3 months ago

I do not forget, I am just a bit short in time these days.