-
Notifications
You must be signed in to change notification settings - Fork 47
Subnet management script and node init config fixes #1464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
phutchins
wants to merge
27
commits into
main
Choose a base branch
from
subnet-management-script
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
c88b37e
Initial commit of subnet deployment management script
phutchins 0122f9d
Adding info command
phutchins 6162aab
fix: resolve libp2p binding issue on cloud VMs
phutchins 8d83981
feat: add configurable `listen-ip` option to P2P configuration
phutchins 0d61d66
fix: update subnet configuration and add documentation for parent fin…
phutchins f2ede72
feat: add watch-finality command for real-time monitoring of parent f…
phutchins e23e442
feat: introduce watch-blocks command for real-time block production m…
phutchins 6665dd8
feat: add advanced performance tuning guide and apply tuning script
phutchins 2be6670
feat: implement fix for bottom-up checkpoint broadcasting error
phutchins 3919bee
feat: introduce live monitoring dashboard for IPC subnets
phutchins dfbdc46
feat: add bottom-up checkpointing settings and functionality
phutchins d0f8db8
feat: add consensus recovery guide and diagnostic tools for IPC subne…
phutchins 8e1d815
feat: add scripts for SSH tunnel management and Anvil connectivity te…
phutchins ae7cc74
feat: add debug script and documentation for relayer error diagnosis
phutchins dda41cc
feat: add systemd installation fix documentation and script improvements
phutchins 1f6cedb
feat: update subnet configuration and enhance debugging capabilities
phutchins 2c876e6
feat: enhance IPC subnet manager with binary update functionality and…
phutchins 21f4947
feat: enhance subnet health reporting with Ethereum address conversion
phutchins ae3825f
feat: add gas estimation script for IPC subnet management
phutchins 875321e
fix: add newline at the end of estimate-gas.sh for consistency
phutchins c5c44d4
feat: add ELK stack for IPC validator log aggregation
phutchins afb706d
feat: implement local deployment mode for IPC subnet manager
phutchins d25c6fb
feat: implement automatic subnet deployment in IPC subnet manager
phutchins e08fe61
fix: update subnet configuration and improve genesis creation process
phutchins f064635
refactor: streamline metrics fetching in dashboard script
phutchins cf59481
refactor: simplify chain ID retrieval in health.sh
phutchins 760cb2b
Updates for local
phutchins File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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.
Empty file.
This file contains hidden or 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 hidden or 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,42 @@ | ||
| # Dependencies | ||
| node_modules/ | ||
| frontend/node_modules/ | ||
| backend/node_modules/ | ||
|
|
||
| # Build output (frontend will be built in Docker) | ||
| frontend/dist/ | ||
|
|
||
| # Development files | ||
| .env | ||
| .env.local | ||
| .env.*.local | ||
|
|
||
| # Git | ||
| .git/ | ||
| .gitignore | ||
|
|
||
| # IDE | ||
| .vscode/ | ||
| .idea/ | ||
| *.swp | ||
| *.swo | ||
|
|
||
| # OS | ||
| .DS_Store | ||
| Thumbs.db | ||
|
|
||
| # Logs | ||
| logs/ | ||
| *.log | ||
| npm-debug.log* | ||
|
|
||
| # Documentation | ||
| README.md | ||
| docs/ | ||
|
|
||
| # Testing | ||
| *.test.js | ||
| *.spec.js | ||
| test/ | ||
| coverage/ | ||
|
|
This file contains hidden or 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,8 @@ | ||
| PRIVATE_KEY=0x5eda872ee2da7bc9d7e0af4507f7d5060aed54d43fd1a72e1283622400c7cb85 | ||
| # private key for generated address 0x3c34b12c13988FFf7288e0366F108821ebE162Fd | ||
| #PRIVATE_KEY=0x564e8313a1e480509ee863d2a4cae3fad93bdf9847aaeffd661e711a25fa7fed | ||
| # for address ending in fba | ||
| RPC_URL=http://node-1.test.ipc.space:8545 | ||
| FAUCET_AMOUNT=10 | ||
| RATE_LIMIT_WINDOW=86400000 | ||
| RATE_LIMIT_MAX=3 | ||
This file contains hidden or 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,174 @@ | ||
| #!/usr/bin/env node | ||
|
|
||
| /** | ||
| * Check Pending Transactions for IPC Faucet | ||
| * | ||
| * Helps diagnose stuck transactions | ||
| */ | ||
|
|
||
| import { ethers } from 'ethers' | ||
| import dotenv from 'dotenv' | ||
| import { fileURLToPath } from 'url' | ||
| import { dirname, join } from 'path' | ||
|
|
||
| const __filename = fileURLToPath(import.meta.url) | ||
| const __dirname = dirname(__filename) | ||
|
|
||
| // Load environment variables from parent directory | ||
| dotenv.config({ path: join(__dirname, '..', '.env') }) | ||
|
|
||
| const RPC_URL = process.env.RPC_URL || 'http://node-1.test.ipc.space:8545' | ||
| const PRIVATE_KEY = process.env.PRIVATE_KEY | ||
|
|
||
| async function checkPendingTransactions() { | ||
| try { | ||
| if (!PRIVATE_KEY) { | ||
| console.error('❌ Error: PRIVATE_KEY not found in .env file') | ||
| process.exit(1) | ||
| } | ||
|
|
||
| console.log('\n🔍 Checking for pending transactions...\n') | ||
| console.log(`RPC: ${RPC_URL}\n`) | ||
|
|
||
| const provider = new ethers.JsonRpcProvider(RPC_URL) | ||
| const wallet = new ethers.Wallet(PRIVATE_KEY, provider) | ||
|
|
||
| console.log(`Wallet Address: ${wallet.address}\n`) | ||
|
|
||
| // Get current nonce from network (includes pending) | ||
| const pendingNonce = await provider.getTransactionCount(wallet.address, 'pending') | ||
|
|
||
| // Get confirmed nonce | ||
| const confirmedNonce = await provider.getTransactionCount(wallet.address, 'latest') | ||
|
|
||
| // Get balance | ||
| const balance = await provider.getBalance(wallet.address) | ||
| const balanceFIL = ethers.formatEther(balance) | ||
|
|
||
| console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━') | ||
| console.log('📊 Wallet Status') | ||
| console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━') | ||
| console.log(`Balance: ${balanceFIL} tFIL`) | ||
| console.log(`Confirmed Nonce: ${confirmedNonce}`) | ||
| console.log(`Pending Nonce: ${pendingNonce}`) | ||
| console.log(`Stuck Transactions: ${pendingNonce - confirmedNonce}`) | ||
| console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n') | ||
|
|
||
| if (pendingNonce === confirmedNonce) { | ||
| console.log('✅ No pending transactions!\n') | ||
| return | ||
| } | ||
|
|
||
| console.log('⚠️ Pending transactions detected!\n') | ||
| console.log('Checking transaction details...\n') | ||
|
|
||
| // Try to get pending transactions | ||
| try { | ||
| // Note: Not all RPC endpoints support this method | ||
| const pendingBlock = await provider.send('eth_getBlockByNumber', ['pending', true]) | ||
|
|
||
| if (pendingBlock && pendingBlock.transactions) { | ||
| const myPendingTxs = pendingBlock.transactions.filter( | ||
| tx => tx.from && tx.from.toLowerCase() === wallet.address.toLowerCase() | ||
| ) | ||
|
|
||
| if (myPendingTxs.length > 0) { | ||
| console.log(`Found ${myPendingTxs.length} pending transaction(s):\n`) | ||
|
|
||
| myPendingTxs.forEach((tx, index) => { | ||
| console.log(`Transaction ${index + 1}:`) | ||
| console.log(` Hash: ${tx.hash}`) | ||
| console.log(` To: ${tx.to}`) | ||
| console.log(` Value: ${ethers.formatEther(tx.value)} tFIL`) | ||
| console.log(` Nonce: ${parseInt(tx.nonce)}`) | ||
| console.log(` Gas Price: ${tx.gasPrice ? ethers.formatUnits(tx.gasPrice, 'gwei') : 'N/A'} Gwei`) | ||
| console.log('') | ||
| }) | ||
| } | ||
| } | ||
| } catch (error) { | ||
| console.log('ℹ️ Could not fetch pending transaction details (RPC may not support this)\n') | ||
| } | ||
|
|
||
| // Check recent confirmed transactions | ||
| console.log('📜 Recent confirmed transactions:\n') | ||
|
|
||
| try { | ||
| const latestBlock = await provider.getBlockNumber() | ||
| const fromBlock = Math.max(0, latestBlock - 20) // Check last 20 blocks | ||
|
|
||
| let foundTxs = 0 | ||
| for (let i = latestBlock; i >= fromBlock && foundTxs < 5; i--) { | ||
| const block = await provider.getBlock(i, true) | ||
| if (block && block.transactions) { | ||
| for (const tx of block.transactions) { | ||
| if (tx.from && tx.from.toLowerCase() === wallet.address.toLowerCase()) { | ||
| const receipt = await provider.getTransactionReceipt(tx.hash) | ||
| console.log(`Block ${i}:`) | ||
| console.log(` Hash: ${tx.hash}`) | ||
| console.log(` To: ${tx.to}`) | ||
| console.log(` Value: ${ethers.formatEther(tx.value || 0)} tFIL`) | ||
| console.log(` Nonce: ${parseInt(tx.nonce)}`) | ||
| console.log(` Status: ${receipt.status === 1 ? '✅ Success' : '❌ Failed'}`) | ||
| console.log('') | ||
| foundTxs++ | ||
| if (foundTxs >= 5) break | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| if (foundTxs === 0) { | ||
| console.log(' No recent transactions found\n') | ||
| } | ||
| } catch (error) { | ||
| console.log(' Could not fetch recent transactions\n') | ||
| } | ||
|
|
||
| // Provide solutions | ||
| console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━') | ||
| console.log('💡 Solutions to Clear Stuck Transactions') | ||
| console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n') | ||
|
|
||
| console.log('Option 1: Wait for transactions to be mined') | ||
| console.log(' - Transactions may just need more time\n') | ||
|
|
||
| console.log('Option 2: Speed up with higher gas (if RPC supports)') | ||
| console.log(' - Use node scripts/speed-up-tx.js\n') | ||
|
|
||
| console.log('Option 3: Cancel stuck transactions') | ||
| console.log(' - Send 0 value tx to yourself with same nonce') | ||
| console.log(' - Use node scripts/cancel-tx.js <nonce>\n') | ||
|
|
||
| console.log('Option 4: Check gas price settings') | ||
| console.log(' - Ensure faucet is using adequate gas price') | ||
| console.log(' - Check network congestion\n') | ||
|
|
||
| // Get network gas info | ||
| try { | ||
| const feeData = await provider.getFeeData() | ||
| console.log('Current Network Gas Prices:') | ||
| if (feeData.gasPrice) { | ||
| console.log(` Gas Price: ${ethers.formatUnits(feeData.gasPrice, 'gwei')} Gwei`) | ||
| } | ||
| if (feeData.maxFeePerGas) { | ||
| console.log(` Max Fee: ${ethers.formatUnits(feeData.maxFeePerGas, 'gwei')} Gwei`) | ||
| } | ||
| if (feeData.maxPriorityFeePerGas) { | ||
| console.log(` Max Priority Fee: ${ethers.formatUnits(feeData.maxPriorityFeePerGas, 'gwei')} Gwei`) | ||
| } | ||
| console.log('') | ||
| } catch (error) { | ||
| console.log(' Could not fetch gas prices\n') | ||
| } | ||
|
|
||
| } catch (error) { | ||
| console.error('❌ Error:', error.message) | ||
| process.exit(1) | ||
| } | ||
| } | ||
|
|
||
| checkPendingTransactions() | ||
|
|
||
|
|
||
|
|
This file contains hidden or 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,13 @@ | ||
| { | ||
| "name": "ipc-faucet-scripts", | ||
| "version": "1.0.0", | ||
| "type": "module", | ||
| "private": true, | ||
| "dependencies": { | ||
| "ethers": "^6.11.1", | ||
| "dotenv": "^16.4.5" | ||
| } | ||
| } | ||
|
|
||
|
|
||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Sensitive Credentials Exposed in Repository
A
.envfile containing actual private keys has been committed to the repository. The file includesPRIVATE_KEY=0x5eda872ee2da7bc9d7e0af4507f7d5060aed54d43fd1a72e1283622400c7cb85and a commented alternative key. Environment files with credentials should never be committed to version control - they should be in.gitignoreand users should create them from a template (like.env.example). This exposes private keys that could control real accounts with funds.