Skip to content
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

"Create account" app exhibits incorrect behavior with "Try again" button in Firefox #259

Open
IgorShadurin opened this issue Jun 10, 2023 · 2 comments

Comments

@IgorShadurin
Copy link
Collaborator

The issue occurred under the following circumstances:

  • I attempted to register using an invite with a balance of 0.001 Sepolia ETH. I received a message stating that the balance was insufficient to register an account. However, the final transaction cost was 0.0003885385 ETH (0.00019807+0.000073236+0.0001172325), which should have been adequate. I wonder if the balance check happened too quickly after sending funds from the invite to the new wallet. Perhaps we need to delay the balance check to give the transfer more time to complete.
  • I then topped up the newly created wallet with an additional 0.001 ETH. This was enough to send all transactions, but my Bee node was disabled during registration. This led to a "Try again" button appearing, which I believe should have simply reuploaded data to the Bee node. However, when I clicked it, the registration process began anew. Since my username was already registered, this interrupted the process.

Here is the address of the generated wallet for reference: https://sepolia.etherscan.io/address/0x275fb5ddeae027a95d4db746586eaf1063fc22e3

Error after transferring funds from the invite to the new wallet.
Screenshot 2023-06-10 at 13 07 25

Trying registering again after top-up the wallet.
Screenshot 2023-06-10 at 13 10 02

Trying registering after running Bee node.
Screenshot 2023-06-10 at 13 11 08

@tomicvladan
Copy link
Collaborator

Regarding the balance check, there is additional cost for transaction that transfers funds from invite account to real account. So maybe that causes the 'insufficient funds' error. Gas price for that transaction is hard-coded to 0.0001 which is too small amount I think. But in any case, the app waits for transfer to complete before continuing with registration. Here is the relevant function:

const checkInviteAccount = async () => {
try {
setStep(Steps.Loading);
const wallet = new Wallet(inviteKey as string);
setLoadingMessage("CHECKING_BALANCE");
const balance = await getAccountBalance(wallet.address);
// TODO The value should be checked
const gasPrice = utils.parseUnits("0.0001", "ether");
if (balance.gt(BigNumber.from(gasPrice))) {
setLoadingMessage("TRANSFERRING_FROM_INVITE");
const amount = balance.gt(minBalance.mul(2))
? minBalance.mul(2)
: balance;
const tx = await sendFunds(
currentNetwork.config.rpcUrl,
inviteKey as string,
Wallet.fromMnemonic(data.mnemonic).address,
amount.sub(gasPrice)
);
await tx.wait();
}
if (balance.gte(minBalance)) {
return onPaymentConfirmed(`${utils.formatEther(balance)} ETH`);
}
setStep(Steps.WaitingPayment);
} catch (error) {
console.error(error);
setError((error as Error)?.message);
setStep(Steps.Error);
} finally {
setLoadingMessage(null);
}
};

And regarding the retry mechanism, there isn't anything that can be done in application level. Because the whole registration process is encapsulated inside the fdp-storage register method. We already discussed that fdp-storage needs to be modified to return an request object that can be used to track progress of registration and ability to retry only certain steps of registration. The fdp-contracts library already supports that:

https://github.com/fairDataSociety/fdp-contracts/blob/92add13f31b9151830b781447ab0ec849fa0f3d3/js-library/src/services/ens.ts#L120-L142

I think there was an issues for this feature in fdp-storage but I'm not sure. But anyway we can't modify app's behavior until this gets implemented in fdp-storage.

@IgorShadurin
Copy link
Collaborator Author

It looks like the problem is this fairDataSociety/fdp-contracts#21. It is not possible to create an account with a balance of less than 0.01.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants