Skip to content

Commit

Permalink
fix broken faucet whitelist arg
Browse files Browse the repository at this point in the history
  • Loading branch information
brenzi committed Mar 6, 2024
1 parent bbb627a commit 133c70f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
3 changes: 2 additions & 1 deletion client/bootstrap_demo_community.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def register_participants_and_perform_meetup(client, cid, accounts):

def faucet(client, cid, accounts):
# charlie has no genesis funds
print('Faucet is dripping...')
print('native (Alice)Faucet is dripping...')
client.faucet(accounts, is_faucet=True)

blocks_to_wait = 3
Expand Down Expand Up @@ -261,6 +261,7 @@ def balance(x):


def test_faucet(client, cid):
print("Testing the EncointerFaucet")
client.set_faucet_reserve_amount("//Alice", balance(3000))
client.await_block(2)
balance_bob = client.balance("//Bob")
Expand Down
9 changes: 5 additions & 4 deletions client/src/commands/encointer_faucet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,16 @@ pub fn create_faucet(_args: &str, matches: &ArgMatches<'_>) -> Result<(), clap::
let drip_amount = matches.faucet_drip_amount_arg().unwrap();

let api2 = api.clone();
let whitelist = futures::future::join_all(matches.whitelist_arg().map(|wl| async move {
let whitelist = if let Some(wl) = matches.whitelist_arg() {
let whitelist_vec: Vec<_> = futures::future::join_all(wl.into_iter().map(|c| {
let api_local = api2.clone();
async move { verify_cid(&api_local, c, None).await }
}))
.await;
WhiteListType::try_from(whitelist_vec).unwrap()
}))
.await;
Some(WhiteListType::try_from(whitelist_vec).unwrap())
} else {
None
};

let faucet_name = FaucetNameType::from_str(faucet_name_raw).unwrap();
let tx_payment_cid_arg = matches.tx_payment_cid_arg();
Expand Down
2 changes: 1 addition & 1 deletion client/src/commands/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub fn faucet(_args: &str, matches: &ArgMatches<'_>) -> Result<(), clap::Error>
);
ensure_payment(&api, &xt.encode().into(), tx_payment_cid_arg).await;
// send and watch extrinsic until ready
println!("Faucet drips {amount} to {to} (Alice's nonce={nonce})");
println!("Alice-Faucet drips {amount} to {to} (Alice's nonce={nonce})");
let _blockh = api.submit_and_watch_extrinsic_until(xt, XtStatus::Ready).await.unwrap();
nonce += 1;
}
Expand Down
2 changes: 1 addition & 1 deletion client/test-data/test-locations-mediterranean.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"meta": {
"name": "Mediterranea",
"symbol": "MTA",
"assets": "QmP2fzfikh7VqTu8pvzd2G2vAd4eK7EaazXTEgqGN6AWoD",
"assets": "QmaRYgDkmmsza2A1zyxy7H7fFE3bELPA535KvCHzEf2kee",
"announcementSigner": null,
"rules": "loCo"
},
Expand Down

0 comments on commit 133c70f

Please sign in to comment.