@Andre-Popovitch should I try something else?
I was investigating the issue you reported but wasnât able to reproduce it. Itâs strange that the second transfer failed but not the first. Iâll try some more tomorrow and let you know. Sorry youâre running into trouble! It might be useful if you could tell me the exact commands you ran chronologically so I can make sure Iâm exercising the same part of sns-testing as you
I follow the sns-testing repo steps to here:
But as macbook pro I canât use docker.
Then I follow my prior steps, which is just a case of going to my local OpenFPL repo and deploying with
dfx deploy --network=local
Then I go back into the sns-testing repo to run:
NUM_PARTICIPANTS=10
ICP_PER_PARTICIPANT=100000
./let_nns_control_dapp.sh
./propose_sns.sh
./participate_sns_swap.sh $NUM_PARTICIPANTS $ICP_PER_PARTICIPANT
As you can see from the logs it fails in participate_sns_swap.sh:
File with that log:
#!/usr/bin/env bash
set -euo pipefail
cd -- "$(dirname -- "${BASH_SOURCE[0]}")"
export NUM_PARTICIPANTS="${1:-100}"
export ICP_PER_PARTICIPANT="${2:-10000}"
ICP_PER_PARTICIPANT_E8S=$(echo "100000000 * $ICP_PER_PARTICIPANT" | bc)
. ./constants.sh normal
# Reset to the constant's $DX_IDENT before starting the swap
dfx identity use "$DX_IDENT"
export CURRENT_DX_IDENT=$(dfx identity whoami)
for (( c=0; c<${NUM_PARTICIPANTS}; c++ ))
do
export ID="$(printf "%03d" ${c})"
export NEW_DX_IDENT="participant-${ID}"
dfx identity new --storage-mode=plaintext "${NEW_DX_IDENT}" 2>/dev/null || true
dfx identity use "${NEW_DX_IDENT}"
export ACCOUNT_ID="$(dfx ledger --network ${NETWORK} account-id)"
dfx identity import --force --storage-mode=plaintext icp-ident-RqOPnjj5ERjAEnwlvfKw "$REPO_ROOT/test-identities/icp-ident.pem" 2> /dev/null
echo "--- a -----"
dfx identity use icp-ident-RqOPnjj5ERjAEnwlvfKw
echo "--- b -----"
dfx ledger transfer --network "${NETWORK}" --memo 0 --icp "$((2 * ${ICP_PER_PARTICIPANT}))" "${ACCOUNT_ID}" || exit 1;
echo "--- c -----"
dfx identity use "${NEW_DX_IDENT}"
echo "--- d -----"
while [ "$(dfx ledger --network "${NETWORK}" balance)" == "0.00000000 ICP" ]
do
sleep 1
done
export PEM_FILE="$(readlink -f ~/.config/dfx/identity/${NEW_DX_IDENT}/identity.pem)"
echo "--- e -----"
# Get the ticket
quill sns new-sale-ticket --amount-icp-e8s "${ICP_PER_PARTICIPANT_E8S}" --canister-ids-file ./sns_canister_ids.json --pem-file "${PEM_FILE}" > msg.json
RESPONSE="$(quill --insecure-local-dev-mode send --yes msg.json)"
if [[ "${RESPONSE}" == *"invalid_user_amount"* ]]
then
echo "ERROR: invalid_user_amount error; see full output from quill below this line"
echo "${RESPONSE}"
exit 1
fi
TICKET_CREATION_TIME="$(echo "${RESPONSE}" | grep "creation_time" | sed "s/.*creation_time = \([0-9_]*\) : nat64;/\1/" | sed "s/_//g")"
TICKET_ID="$(echo "${RESPONSE}" | grep "ticket_id" | sed "s/.*ticket_id = \([0-9_]*\) : nat64;/\1/" | sed "s/_//g")"
if [ -z "${TICKET_CREATION_TIME}" ]
then
echo "ERROR: ticket could not be created: see full output from quill below this line"
echo "${RESPONSE}"
exit 1
else
echo "Ticket (${TICKET_ID}) created with creation time ${TICKET_CREATION_TIME}"
fi
# Use the ticket
quill sns pay --amount-icp-e8s "${ICP_PER_PARTICIPANT_E8S}" --ticket-creation-time "${TICKET_CREATION_TIME}" --ticket-id "${TICKET_ID}" --canister-ids-file ./sns_canister_ids.json --pem-file "${PEM_FILE}" > msg.json
quill --insecure-local-dev-mode send --yes msg.json
done
dfx identity use "${DX_IDENT}"
Here is the response variable echo
RESPONSE="$(quill --insecure-local-dev-mode send --yes msg.json)"
echo $RESPONSE
Sending message with Call type: update Sender: 2rlus-kgjom-kxvbu-6qrj4-u4eki-ecaqt-dv6jd-4co4g-ekltn-6sjp7-jqe Canister id: b77ix-eeaaa-aaaaa-qaada-cai Method name: new_sale_ticket Arguments: (record { subaccount = null; amount_icp_e8s = 10_000_000_000_000 : nat64 }) Request ID: 0xb48baf13137b012ac0439d2c4753ec0612a8ac78492726305ed913cf77258326 The request is being processed⌠The request is being processed⌠The request is being processed⌠( record { result = opt variant { Err = record { invalid_user_amount = null; existing_ticket = null; error_type = 2 : int32; } }; }, )
You could always clone the FPL repo and try to do an SNS, maybe this would get the same error?
I wonder if itâs possible that youâre not running this from a sufficiently clean state or something. The error youâre seeing is telling you that the swap is closed. (which means the swap is probably finalizing). In any case, can you carry on with the rest of your test after seeing that error? Once you get that error_type = 2
response from ./participate_sns_swap.sh
, you shouldnât have to participate in the swap anymore to continue the test
Hi @Andre-Popovitch,
That could be the case, but I was under the assumption following the sns-testing repo state would always start at a sufficiently clean state. Afterall, we never know the potential state, any future developer could have the same potentially unclean state.
I followed this procedure as I am doing it now on the last version, I didnât have to wait for a swap to close.
Here is the sns swap state:
james@Jamess-MacBook-Pro sns-testing % ./get_sns_swap_state.sh
Using identity: "default".
(
record {
swap = opt record {
auto_finalize_swap_response = opt record {
set_dapp_controllers_call_result = null;
create_sns_neuron_recipes_result = opt record {
failure = 0 : nat32;
skipped = 0 : nat32;
invalid = 0 : nat32;
success = 208 : nat32;
global_failures = 0 : nat32;
};
settle_community_fund_participation_result = null;
error_message = null;
settle_neurons_fund_participation_result = opt record {
possibility = opt variant {
Ok = record {
neurons_fund_participation_icp_e8s = opt (2_709_908_117_315 : nat64);
neurons_fund_neurons_count = opt (4 : nat64);
}
};
};
set_mode_call_result = opt record {
possibility = opt variant { Ok = record {} };
};
sweep_icp_result = opt record {
failure = 0 : nat32;
skipped = 0 : nat32;
invalid = 0 : nat32;
success = 100 : nat32;
global_failures = 0 : nat32;
};
claim_neuron_result = opt record {
failure = 0 : nat32;
skipped = 0 : nat32;
invalid = 0 : nat32;
success = 208 : nat32;
global_failures = 0 : nat32;
};
sweep_sns_result = opt record {
failure = 0 : nat32;
skipped = 0 : nat32;
invalid = 0 : nat32;
success = 208 : nat32;
global_failures = 0 : nat32;
};
};
neuron_recipes = vec {};
next_ticket_id = opt (100 : nat64);
decentralization_sale_open_timestamp_seconds = opt (
1_726_695_428 : nat64
);
finalize_swap_in_progress = opt false;
cf_participants = vec {};
init = opt record {
nns_proposal_id = opt (10 : nat64);
sns_root_canister_id = "be2us-64aaa-aaaaa-qaabq-cai";
neurons_fund_participation = opt true;
min_participant_icp_e8s = opt (10_000_000_000 : nat64);
neuron_basket_construction_parameters = opt record {
dissolve_delay_interval_seconds = 2_630_016 : nat64;
count = 2 : nat64;
};
fallback_controller_principal_ids = vec {
"d7egg-wf5tk-olxbg-izlyy-bphvp-2nfuf-5yltc-kzmvt-dk5lo-qtv7e-vae";
};
max_icp_e8s = null;
neuron_minimum_stake_e8s = opt (100_000_000 : nat64);
confirmation_text = null;
swap_start_timestamp_seconds = opt (1_726_695_428 : nat64);
swap_due_timestamp_seconds = opt (1_727_460_900 : nat64);
min_participants = opt (57 : nat32);
sns_token_e8s = opt (50_000_000_000_000 : nat64);
nns_governance_canister_id = "rrkah-fqaaa-aaaaa-aaaaq-cai";
transaction_fee_e8s = opt (10_000 : nat64);
icp_ledger_canister_id = "ryjl3-tyaaa-aaaaa-aaaba-cai";
sns_ledger_canister_id = "bw4dl-smaaa-aaaaa-qaacq-cai";
neurons_fund_participation_constraints = opt record {
coefficient_intervals = vec {
record {
slope_numerator = opt (0 : nat64);
intercept_icp_e8s = opt (0 : nat64);
from_direct_participation_icp_e8s = opt (0 : nat64);
slope_denominator = opt (999_999_000_000_000 : nat64);
to_direct_participation_icp_e8s = opt (8_277_217_552_429 : nat64);
};
record {
slope_numerator = opt (900_000_000_000_000 : nat64);
intercept_icp_e8s = opt (0 : nat64);
from_direct_participation_icp_e8s = opt (
8_277_217_552_429 : nat64
);
slope_denominator = opt (999_999_000_000_000 : nat64);
to_direct_participation_icp_e8s = opt (9_763_040_095_110 : nat64);
};
record {
slope_numerator = opt (990_000_000_000_000 : nat64);
intercept_icp_e8s = opt (0 : nat64);
from_direct_participation_icp_e8s = opt (
9_763_040_095_110 : nat64
);
slope_denominator = opt (999_999_000_000_000 : nat64);
to_direct_participation_icp_e8s = opt (
13_570_070_475_945 : nat64
);
};
record {
slope_numerator = opt (99_000_000_000_000 : nat64);
intercept_icp_e8s = opt (1_000_000_000_000 : nat64);
from_direct_participation_icp_e8s = opt (
13_570_070_475_945 : nat64
);
slope_denominator = opt (999_999_000_000_000 : nat64);
to_direct_participation_icp_e8s = opt (
22_430_266_717_481 : nat64
);
};
record {
slope_numerator = opt (9_900_000_000_000 : nat64);
intercept_icp_e8s = opt (2_000_000_000_000 : nat64);
from_direct_participation_icp_e8s = opt (
22_430_266_717_481 : nat64
);
slope_denominator = opt (999_999_000_000_000 : nat64);
to_direct_participation_icp_e8s = opt (
18_446_744_073_709_551_615 : nat64
);
};
};
max_neurons_fund_participation_icp_e8s = opt (
2_709_908_117_316 : nat64
);
min_direct_participation_threshold_icp_e8s = opt (
10_000_000_000_000 : nat64
);
ideal_matched_participation_function = opt record {
serialized_representation = opt "{\"t_1\":\"75000.0\",\"t_2\":\"225000.0\",\"t_3\":\"375000.0\",\"t_4\":\"1500000.00\",\"cap\":\"750000.0\"}";
};
};
neurons_fund_participants = null;
should_auto_finalize = opt true;
max_participant_icp_e8s = opt (1_000_000_000_000 : nat64);
sns_governance_canister_id = "br5f7-7uaaa-aaaaa-qaaca-cai";
min_direct_participation_icp_e8s = opt (10_000_000_000_000 : nat64);
restricted_countries = opt record { iso_codes = vec { "AQ" } };
min_icp_e8s = null;
max_direct_participation_icp_e8s = opt (100_000_000_000_000 : nat64);
};
already_tried_to_auto_finalize = opt true;
neurons_fund_participation_icp_e8s = opt (2_709_908_117_315 : nat64);
purge_old_tickets_last_completion_timestamp_nanoseconds = opt (0 : nat64);
direct_participation_icp_e8s = opt (100_000_000_000_000 : nat64);
lifecycle = 3 : int32;
purge_old_tickets_next_principal = opt blob "\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00";
decentralization_swap_termination_timestamp_seconds = opt (
1_726_696_197 : nat64
);
buyers = vec {};
params = opt record {
min_participant_icp_e8s = 10_000_000_000 : nat64;
neuron_basket_construction_parameters = opt record {
dissolve_delay_interval_seconds = 2_630_016 : nat64;
count = 2 : nat64;
};
max_icp_e8s = 102_709_908_117_316 : nat64;
swap_due_timestamp_seconds = 1_727_460_900 : nat64;
min_participants = 57 : nat32;
sns_token_e8s = 50_000_000_000_000 : nat64;
sale_delay_seconds = null;
max_participant_icp_e8s = 1_000_000_000_000 : nat64;
min_direct_participation_icp_e8s = opt (10_000_000_000_000 : nat64);
min_icp_e8s = 10_000_000_000_000 : nat64;
max_direct_participation_icp_e8s = opt (100_000_000_000_000 : nat64);
};
open_sns_token_swap_proposal_id = opt (10 : nat64);
};
derived = opt record {
sns_tokens_per_icp = 0.48680794 : float32;
buyer_total_icp_e8s = 102_709_908_117_315 : nat64;
cf_participant_count = opt (4 : nat64);
neurons_fund_participation_icp_e8s = opt (2_709_908_117_315 : nat64);
direct_participation_icp_e8s = opt (100_000_000_000_000 : nat64);
direct_participant_count = opt (100 : nat64);
cf_neuron_count = opt (4 : nat64);
};
},
)
Every time I try to participate in the swap, values in here do not change, for example buyer_total_icp_e8s doesnât increase, making me think when I run
./participate_sns_swap.sh $NUM_PARTICIPANTS $ICP_PER_PARTICIPANT
is actually not workingâŚ
When you say the error is telling me the swap is closed, how do you see that? I thought it was telling me this:
Something to do with the amountâŚ
Any help appreciated,
Kind regards,
James
Given that swap state, you will not be able to participate, as the swap has closed and finalized. (When you see auto_finalize_swap_response
set to something, thatâs what that means). The swap appears to be closing earlier than you expect it to, but is that a problem for your testing?
Well the token doesnât appear in the local sns, which is a problem. I need it setup as it is on live to raise proposals.
Iâm going to try again from scratch but not so the rock out one, that token sits in the local sns. See if FPL then appears.
@Andre-Popovitch I am just going to announce that it is not possible to test the SNS on twitter. I get constant abuse from people with OpenFPL not being live, I will have to remove the canisters I need outside of the sns and continue fantasy football this way.
Not sure if this helps, but I use Colima on my mac (pro, M3) and so far works pretty well (no problem observed with general building or running Docker containers), might be worth a shot
Sure maybe, but in my experience I need dfinity to be sure it is the way to go. I know we can run docker on mac but I have spent many months just working with this repo and right now adding another step without them saying this is the way to do it, potentially costs me more and more time.
The whole process is just too long and complex, download this tool, add this file, open this window then another then another, run scripts.
Itâs insane.
The OpenFPL repo is public, anyone SHOULD be able to get a local version of the SNS setup, ideally in simple steps. Currently the steps are huge, but testing an app on say AWS or Azure is one click.
It will probably not sooth your frustration, but the latest pic and dfx release notes show significant progress on being able to save pocket IC states, which means youâll be able to store the start state and run tests from there. I think you could theoretically do this at the moment with the latest pocket IC if you transpose the NNS setup files over to a pocket IC framework. I think weâve been in this dfx replica to pocket ic transition for a few months now which feels like a stall but will make things much better once it is done.
I too spent a couple days trying to get a good SNS state I could import to pic.js and finally just wrote my tests in dfx in a way that had to be executed manually.
Yeah Iâm live again.
Iâve given up with it and Iâm doing exactly that. Building unit tests that just prove each logics medium as required.
FYI using the latest version of sns-testing we were able to get things setup:
The OpenFPL readme has been updated to reflect this:
Nice! Was this through DFX or through Pocket IC?
All through DFX, we havenât got to pocketIC, yet.