fix: fund wallet before peer connect#71
fix: fund wallet before peer connect#71arunabha003 wants to merge 1 commit intoStabilityNexus:mainfrom
Conversation
WalkthroughThe code reorders a wallet funding block in Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@main.py`:
- Around line 331-336: The run_node function references an undefined variable
host when calling network.start(port=port, host=host); update run_node to accept
a host parameter (e.g., def run_node(..., host):) and propagate the parsed
--host value from main() into the call to run_node so network.start receives the
CLI host; ensure the run_node signature and all callers (main) are updated to
pass host and that network.start uses that host parameter.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
| await network.start(port=port, host=host) | ||
|
|
||
| # Fund this node's wallet so it can transact in the demo | ||
| if fund > 0: | ||
| chain.state.credit_mining_reward(pk, reward=fund) | ||
| logger.info("💰 Funded %s... with %d coins", pk[:12], fund) |
There was a problem hiding this comment.
Undefined variable host will cause a NameError.
Line 331 references host, but this variable is not defined in the run_node function scope. The --host argument is parsed in main() (line 362) but never passed to run_node().
🐛 Proposed fix: Add host parameter to run_node
Update the function signature:
-async def run_node(port: int, connect_to: str | None, fund: int, datadir: str | None):
+async def run_node(port: int, connect_to: str | None, fund: int, datadir: str | None, host: str = "127.0.0.1"):And update the call in main():
- asyncio.run(run_node(args.port, args.connect, args.fund, args.datadir))
+ asyncio.run(run_node(args.port, args.connect, args.fund, args.datadir, args.host))🧰 Tools
🪛 Ruff (0.15.6)
[error] 331-331: Undefined name host
(F821)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@main.py` around lines 331 - 336, The run_node function references an
undefined variable host when calling network.start(port=port, host=host); update
run_node to accept a host parameter (e.g., def run_node(..., host):) and
propagate the parsed --host value from main() into the call to run_node so
network.start receives the CLI host; ensure the run_node signature and all
callers (main) are updated to pass host and that network.start uses that host
parameter.
Addressed Issues:
Summary
--fundcredit ahead of peer connection during node startupAdditional Notes:
AI Usage Disclosure:
We encourage contributors to use AI tools responsibly when creating Pull Requests. While AI can be a valuable aid, it is essential to ensure that your contributions meet the task requirements, build successfully, include relevant tests, and pass all linters. Submissions that do not meet these standards may be closed without warning to maintain the quality and integrity of the project. Please take the time to understand the changes you are proposing and their impact. AI slop is strongly discouraged and may lead to banning and blocking. Do not spam our repos with AI slop.
Check one of the checkboxes below:
I have used the following AI models and tools: TODO
Checklist
Summary by CodeRabbit