Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/llm.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ List admin params → agcli admin list --output json
| `--network NET` | `AGCLI_NETWORK` | finney\|test\|local\|archive |
| `--endpoint URL` | `AGCLI_ENDPOINT` | Custom WS endpoint |
| `-w NAME` | `AGCLI_WALLET` | Wallet name |
| `--hotkey NAME` | `AGCLI_HOTKEY` | Hotkey name |
| `--hotkey-name NAME` | `AGCLI_HOTKEY` | Hotkey name |
| `--wallet-dir DIR` | `AGCLI_WALLET_DIR` | Wallet dir |
| `--proxy SS58` | `AGCLI_PROXY` | Proxy account |
| `--live [SECS]` | — | Live polling (default 12s) |
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/validator-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Validators evaluate miners by setting weights, which determines emission distrib
agcli wallet create --name validator

# Create a hotkey (operational key — used for on-chain validator operations)
agcli wallet create-hotkey --name validator --hotkey default
agcli wallet create-hotkey --name validator --hotkey-name default
```

### 2. Fund Your Coldkey
Expand Down
35 changes: 35 additions & 0 deletions reg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash
set -euo pipefail

WALLET="${1:-}"
HOTKEY="${2:-}"
NETUID="${3:-}"
PASSWORD="${4:-}"
WALLET_DIR="${AGCLI_WALLET_DIR:-/root/.bittensor/wallets}"

if [[ -z "$WALLET" ]]; then
read -r -p "Wallet name: " WALLET
fi

if [[ -z "$HOTKEY" ]]; then
read -r -p "Hotkey name: " HOTKEY
fi

if [[ -z "$NETUID" ]]; then
read -r -p "Netuid: " NETUID
fi

if [[ -z "$PASSWORD" ]]; then
read -r -s -p "Password: " PASSWORD
echo
fi

export AGCLI_PASSWORD="$PASSWORD"

while true; do
agcli --wallet-dir "$WALLET_DIR" \
--wallet "$WALLET" \
--hotkey-name "$HOTKEY" \
subnet register-neuron --netuid "$NETUID" --yes && break
sleep 1
done
45 changes: 35 additions & 10 deletions src/chain/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use anyhow::{Context, Result};
use sp_core::sr25519;
use subxt::backend::legacy::rpc_methods::LegacyRpcMethods;
use subxt::backend::rpc::RpcClient;
use subxt::tx::PairSigner;
use subxt::tx::{PairSigner, TxStatus};
use subxt::OnlineClient;

use crate::queries::query_cache::QueryCache;
Expand Down Expand Up @@ -346,7 +346,7 @@ impl Client {
// Retry submission on transient errors (connection drop before tx reaches node).
// Once submitted, we do NOT retry — the finalization wait is non-idempotent.
let inner = &self.inner;
let progress = retry_on_transient("sign_submit", RPC_RETRIES, || async {
let mut progress = retry_on_transient("sign_submit", RPC_RETRIES, || async {
match inner
.tx()
.sign_and_submit_then_watch_default(tx, &signer)
Expand All @@ -365,28 +365,53 @@ impl Client {
}
})
.await?;
spinner.set_message("Waiting for finalization...");
tracing::debug!("Extrinsic submitted, waiting for finalization");
let result = tokio::time::timeout(
std::time::Duration::from_secs(30),
progress.wait_for_finalized_success(),
)
spinner.set_message("Waiting for inclusion...");
tracing::debug!("Extrinsic submitted, waiting for in-block inclusion");
let in_block = tokio::time::timeout(std::time::Duration::from_secs(30), async {
loop {
match progress.next().await {
Some(Ok(TxStatus::InBestBlock(b) | TxStatus::InFinalizedBlock(b))) => {
return Ok(b);
}
Some(Ok(TxStatus::Error { message })) => {
return Err(subxt::Error::Other(message));
}
Some(Ok(TxStatus::Invalid { message })) => {
return Err(subxt::Error::Other(message));
}
Some(Ok(TxStatus::Dropped { message })) => {
return Err(subxt::Error::Other(message));
}
Some(Ok(_)) => continue,
Some(Err(e)) => return Err(e),
None => {
return Err(subxt::Error::Other(
"Transaction stream ended before inclusion".to_string(),
))
}
}
}
})
.await
.map_err(|_| {
spinner.finish_and_clear();
anyhow::anyhow!(
"Transaction timed out after 30s waiting for finalization. \
"Transaction timed out after 30s waiting for block inclusion. \
The extrinsic may have been dropped from the pool \
(insufficient balance, invalid state, or node not producing blocks)."
)
})?
.map_err(|e| {
spinner.finish_and_clear();
anyhow::anyhow!("{}", e)
})?;
let result = in_block.wait_for_success().await.map_err(|e| {
spinner.finish_and_clear();
format_dispatch_error(e)
})?;
let hash = format!("{:?}", result.extrinsic_hash());
spinner.finish_and_clear();
tracing::info!(tx_hash = %hash, elapsed_ms = start.elapsed().as_millis() as u64, "Extrinsic finalized");
tracing::info!(tx_hash = %hash, elapsed_ms = start.elapsed().as_millis() as u64, "Extrinsic included in block");
Ok(hash)
}

Expand Down
Loading
Loading