kinode-dao / kit

Development toolkit for Kinode OS
Apache License 2.0
11 stars 2 forks source link

local fake chain nodes #140

Closed bitful-pannul closed 4 months ago

bitful-pannul commented 5 months ago

Problem

fakenode networking not using internal components or chain indexing.

Solution

boot a fakechain in kit (foundry::anvil), and have kns_indexer conditionally index on local chain 31337 instead of optimism.

Docs Update

running instructions: have updated kit and runtime PR branch kit f --runtime-path ~/yo/runtime (will boot fakechain on port 8545 if doesn't exist and register fake.dev) kit f --runtime-path ~/yo/runtime --fake-node-name second (registers second.dev)

Corresponding docs PR

Notes

simulation mode runtime flag for processes rather than during buildtime?

TODO in runtime:

nick1udwig commented 5 months ago

In future, please clean up old branches! I was trying to get bp/realfakenode to work only to realize this branch is actually bp/realfakenodes with an s.

nick1udwig commented 5 months ago
Tue 14:35 http_server: running on port 8080
fake.dev > thread 'tokio-runtime-worker' panicked at /home/nick/.cargo/registry/src/index.crates.io-6f17d22bba15001f/warp-0.3.7/src/server.rs:217:27:
                                                                                                                                                     error binding to 0.0.0.0:8080: error creating server listener: Address already in use (os error 98)
                                                                     note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

note I do not have 8080 occupied

nick1udwig commented 5 months ago

I think the problem is the ws_routing lines in this commit: https://github.com/kinode-dao/kinode/pull/318/commits/af877a03c7df8f3132b69a0d36356c8d928907f4#diff-a42b3d9fdebb1ee94e80c9b7e50185e119aeb6cd4f4a9b251649b421f1f4c151R484

nick1udwig commented 5 months ago

Changing them to None again makes it boot fine.

bitful-pannul commented 5 months ago
Tue 14:35 http_server: running on port 8080
fake.dev > thread 'tokio-runtime-worker' panicked at /home/nick/.cargo/registry/src/index.crates.io-6f17d22bba15001f/warp-0.3.7/src/server.rs:217:27:
                                                                                                                                                     error binding to 0.0.0.0:8080: error creating server listener: Address already in use (os error 98)
                                                                     note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

note I do not have 8080 occupied

fixed by: https://github.com/kinode-dao/kinode/pull/318/commits/c4227b46697b90d958907cf32b7dad18014097fc !

nick1udwig commented 4 months ago

EDIT: Ignore; I was on wrong branch again :pensive:

nick@pop-os:~/git/kit (bp/realfakenode $=)$ kit f -r ~/git/kinode -p 8081
Compiling Kinode runtime...
Done compiling Kinode runtime.
network_router: online at 9001
error: unexpected argument '--network-router-port' found

  tip: to pass '--network-router-port' as a value, use '-- --network-router-port'

Usage: kinode --port <PORT> <home>

For more information, try '--help'.
Cleaning up "/tmp/kinode-fake-node"...
Done cleaning up "/tmp/kinode-fake-node".
nick1udwig commented 4 months ago

EDIT: Ignore; I was on wrong branch again :pensive:

nick@pop-os:~/git/core-tests (bp/fakechain *$=)$ kit t
ERROR src/main.rs:788: 
   0: TOML parse error at line 6, column 1
   0:   |
   0: 6 | [[tests]]
   0:   | ^^^^^^^^^
   0: missing field `network_router`
   0: 

Location:
   /home/nick/git/kit/src/run_tests/mod.rs:421

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ SPANTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

   0: kit::run_tests::execute
      at src/run_tests/mod.rs:416
nick1udwig commented 4 months ago

EDIT: Ignore; I was on wrong branch again :pensive: Maybe a bad merge to develop?

nick1udwig commented 4 months ago

Really nice work @bitful-pannul . This is a huge step forward in functionality. More work to do to make it even coolers (e.g., making it possible/easy to send TXs, etc), but this is a big unlock