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

Change how we fund accounts from genesis accounts and wallets #274

Open
algochoi opened this issue Apr 7, 2023 · 0 comments
Open

Change how we fund accounts from genesis accounts and wallets #274

algochoi opened this issue Apr 7, 2023 · 0 comments

Comments

@algochoi
Copy link
Contributor

algochoi commented Apr 7, 2023

Problem

Currently, we fund accounts by:

  1. Getting wallet information in a step and populating an accounts array, which is shared between every step.
  2. We assume that the genesis account with many Algos exist in the first index of the accounts array. So we transfer some algos from accounts[0] to the account we want to fund.

But when we rekey accounts, the accounts in the wallet might be switched around (non-deterministically?). So when we get the wallet information again, accounts[0] might not be the genesis account and may have been replaced by an underfunded account.

This can cause flaky tests and cause overspending errors if the wrong account is selected and seems to affect all 4 SDKs.

Solution

Our current solution is to fund the rekeyed account with a semi-large amount of Algos so that every account we pull from has (hopefully) enough Algos to fund other accounts. We currently do this in the Python and JS SDK. Example in Python SDK. This might not be enough to protect future tests/steps that require more accounts with more Algos.

A better long term solution is not to depend on accounts[0] holding the genesis account with lots of Algos. We can create a separate genesis_account global/context object that holds the pk-sk pair, and fund accounts using that. Then, we can replace every instance of accounts[0] with the genesis_account instead.

Urgency

There is a temporary solution to this, but may cause flaky tests in the future if we add more tests/steps involving account funding.

@algochoi algochoi added the new-feature-request Feature request that needs triage label Apr 7, 2023
@algoanne algoanne added tech debt Team Lamprey and removed new-feature-request Feature request that needs triage labels Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants