-
Notifications
You must be signed in to change notification settings - Fork 47
feat: 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
45
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
45 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 943f4c6
refactor: update subnet configuration and improve health check functi…
phutchins 08837e8
refactor: enhance Logstash configuration for IPC logs
phutchins ea7629b
refactor: calculate expected peers dynamically in dashboard script
phutchins e6bb384
refactor: enhance mempool metrics fetching in dashboard script
phutchins c2f03fe
refactor: improve finality log extraction in monitor script
phutchins c6c53a5
refactor: dynamically derive transaction address in set_federated_pow…
phutchins 53ee237
refactor: update bottom-up checkpointing default behavior in IpcSettings
phutchins 405d033
chore: update environment configuration for IPC faucet
phutchins 6396550
refactor: enhance clear-mempool script with parameter support and dyn…
phutchins 7d24e91
refactor: enhance ELK manager script with new delete-old-indices command
phutchins 4b98cf4
refactor: update ELK manager script to support configurable IPC subne…
phutchins 3a9ff71
Merge branch 'main' into subnet-management-script
phutchins 5387e13
fix: align comment formatting in P2pConfig initialization
phutchins d64330c
fix: use is_none_or instead of map_or for bottomup_enabled
phutchins f7a9658
fix: resolve SSH connection issues in local mode for IPC manager
phutchins f5af77b
feat: implement comprehensive local mode fixes for IPC manager
phutchins 0274add
docs: add detailed explanations for Chain ID and Subnet ID in IPC man…
phutchins 0e6d322
feat: implement unique chain ID configuration for IPC subnets
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
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,22 @@ | ||
| # IPC Faucet Configuration | ||
| # Copy this file to .env and fill in your actual values | ||
| # NEVER commit .env to version control | ||
|
|
||
| # Private key for the faucet wallet (without 0x prefix or with it) | ||
| # This account will distribute funds to requesters | ||
| # Example: PRIVATE_KEY=0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef | ||
| PRIVATE_KEY=0xYOUR_PRIVATE_KEY_HERE | ||
|
|
||
| # RPC URL for the IPC subnet | ||
| # Example: http://localhost:8545 for local development | ||
| # Example: http://node-1.test.ipc.space:8545 for test network | ||
| RPC_URL=http://localhost:8545 | ||
|
|
||
| # Amount to send per faucet request (in native token units) | ||
| FAUCET_AMOUNT=10 | ||
|
|
||
| # Rate limiting window in milliseconds (86400000 = 24 hours) | ||
| RATE_LIMIT_WINDOW=86400000 | ||
|
|
||
| # Maximum number of requests per address within the rate limit window | ||
| 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() | ||
|
|
||
|
|
||
|
|
||
Oops, something went wrong.
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.
Potential null reference when accessing transaction receipt status
Low Severity
The
getTransactionReceiptcall can returnnullin ethers.js v6, but the code accessesreceipt.statusdirectly without a null check. If the receipt is unavailable (due to timing issues or RPC inconsistencies), this will throw aTypeError: Cannot read properties of null (reading 'status'). The error is caught by the outer try-catch, but results in a misleading "Could not fetch recent transactions" message instead of properly handling the null receipt case.