Skip to content

Commit 27ec449

Browse files
committed
fix(core): change allowed_random_relayers to opt-in model
1 parent 5597054 commit 27ec449

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

crates/core/src/app_state.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ impl RelayersAllowedForRandom {
4949
// If the list is empty, it means all relayers are allowed (equivalent to "*")
5050
allowed_relayers.is_empty() || allowed_relayers.contains(relayer)
5151
} else {
52-
// If no configuration exists for this chain, all relayers are allowed by default
53-
true
52+
// If no configuration exists for this chain, the feature is disabled
53+
false
5454
}
5555
}
5656
}

crates/core/src/transaction/api/send_random_transaction.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ pub async fn send_transaction_random(
3131

3232
/// Selects a random available relayer for the specified chain.
3333
///
34-
/// Filters out paused and internal-only relayers before making the selection.
34+
/// Filters out paused, internal-only, and relayers only allowed for random selection.
35+
/// Note: The random relayer feature must be explicitly enabled via `allowed_random_relayers`
36+
/// config for the network, otherwise all relayers will be filtered out.
3537
async fn select_random_relayer(
3638
state: &Arc<AppState>,
3739
chain_id: &ChainId,

documentation/rrelayer/docs/pages/config/networks/config.mdx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,13 @@ the documentation in the signer provider pages:
182182
### allowed_random_relayers - optional
183183
184184
Controls which relayers are eligible for selection when using the random relayer endpoint.
185-
If not specified, all available relayers can be selected (equivalent to `"*"`).
185+
**If not specified, the random relayer feature is disabled for this network.**
186186
187187
**Options:**
188-
- `"*"` - Allow all relayers (default behavior)
188+
- `"*"` - Allow all relayers for random selection
189189
- Single address - Only allow one specific relayer for random selection
190190
- Array of addresses - Allow only the specified relayers for random selection
191+
- Not specified - Random relayer feature disabled
191192
192193
```yaml [rrelayer.yaml]
193194
name: first-rrelayer
@@ -210,14 +211,14 @@ networks: // [!code focus]
210211
211212
**Examples:**
212213
213-
Allow all relayers (default):
214+
Enable for all relayers:
214215
```yaml
215216
allowed_random_relayers: "*"
216217
```
217218
218219
Allow only specific relayers:
219220
```yaml
220-
allowed_random_relayers:
221+
allowed_random_relayers:
221222
- "0x742f0677b50b0F1C2151865Dcb98BF32FeaF65c9"
222223
- "0x8ba1f109551bD432803012645Hac136c6d3A60E7"
223224
```

documentation/rrelayer/docs/pages/integration/sdk/transactions/node.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ const txRequest: TransactionToSend = {
256256
};
257257

258258
// Send to a random relayer on the specified chain
259-
let response = await client.network.sendTransactionRandom(chainId, txRequest);
259+
let response = await client.network.sendRandom(chainId, txRequest);
260260

261261
// returns a TransactionReceipt - import { TransactionReceipt } from 'rrelayer';
262262
let relayTransactionResult = await client.transaction.waitForTransactionReceiptById(

0 commit comments

Comments
 (0)