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

feat!: worker.dev_create_account, worker.dev_deploy create subaccounts of root account instead of tla (sandbox, testnet) #369

Merged
merged 45 commits into from
Dec 26, 2024

Conversation

AlexKushnir1
Copy link
Contributor

@AlexKushnir1 AlexKushnir1 commented Aug 8, 2024

Renamed method (create_tla) and added .testnet to the randomly generated ID sent to the helper when creating a dev account

worker.dev_create_account has now become worker.dev_create_tla, worker.dev_deploy has now become worker.dev_deploy_tla


  • main branch (base branch)

    • sandbox

      • creates top level account (worker.create_tla, worker.create_tla_and_deploy ,worker.dev_create_account, worker.dev_deploy)
      [src/main.rs:18:9] &result = Account {
          id: AccountId(
              "dev-20241224213704-37976876532241",
          ),
      }
      balance = 100.00 NEAR
    • testnet

      • ERRORs on top level account creation
      Error: Execution
      
      Caused by:
          Action #0: A top-level account ID AccountId("dev-20241224215752-62591402306687") can't be created
      by AccountId("testnet"), short top-level account IDs can only be created by AccountId("registrar")
  • remove-using-tla-on-testnet branch (head branch)

    • sandbox

      • creates top level account (worker.create_tla, worker.create_tla_and_deploy, worker.dev_create_tla, dev_deploy_tla)
      [src/main.rs:19:9] &result = Account {
          id: AccountId(
              "dev-20241224222905-84560672890155",
          ),
      }
      balance = 100.00 NEAR
      • creates root account sub-account (worker.create_root_account_subaccount, worker.create_root_account_subaccount_and_deploy, worker.dev_create_account, worker.dev_deploy)
      [src/main.rs:35:13] &root_account = Account {
          id: AccountId(
              "test.near",
          ),
      }
      balance = 1000000000.00 NEAR
      [src/main.rs:48:9] &result = Account {
          id: AccountId(
              "dev-20241225121559-79849516817890.test.near",
          ),
      }
      balance = 100.00 NEAR
    • testnet

      • FAILS to compile on top level account creation (no such method)
      • creates root account sub-account (worker.create_root_account_subaccount, worker.create_root_account_subaccount_and_deploy, worker.dev_create_account, worker.dev_deploy)
      [src/main.rs:62:13] &root_account_id = AccountId(
          "testnet",
      )
      balance = 15561968.34 NEAR
      [src/main.rs:74:9] &result = Account {
          id: AccountId(
              "dev-20241225121906-39307469198620.testnet",
          ),
      }
      balance = 10.01 NEAR

@AlexKushnir1
Copy link
Contributor Author

@race-of-sloths

@race-of-sloths
Copy link

race-of-sloths commented Aug 9, 2024

@AlexKushnir1 Thank you for your contribution! Your pull request is now a part of the Race of Sloths!

Shows profile picture for the author of the PR

Current status: stale

This pull request was removed from the race, but you can include it again with @race-of-sloths include command

What is the Race of Sloths

Race of Sloths is a friendly competition where you can participate in challenges and compete with other open-source contributors within your normal workflow

For contributors:

  • Tag @race-of-sloths inside your pull requests
  • Wait for the maintainer to review and score your pull request
  • Check out your position in the Leaderboard
  • Keep weekly and monthly streaks to reach higher positions
  • Boast your contributions with a dynamic picture of your Profile

For maintainers:

  • Score pull requests that participate in the Race of Sloths
  • Engage contributors with fair scoring and fast responses so they keep their streaks
  • Promote the Race to the point where the Race starts promoting you
  • Grow the community of your contributors

Feel free to check our website for additional details!

Bot commands
  • For contributors
    • Include a PR: @race-of-sloths include to enter the Race with your PR
  • For maintainers:
    • Invite contributor @race-of-sloths invite to invite the contributor to participate in a race or include it, if it's already a runner.
    • Assign points: @race-of-sloths score [1/2/3/5/8/13] to award points based on your assessment.
    • Reject this PR: @race-of-sloths exclude to send this PR back to the drawing board.
    • Exclude repo: @race-of-sloths pause to stop bot activity in this repo until @race-of-sloths unpause command is called

workspaces/tests/account.rs Outdated Show resolved Hide resolved
workspaces/src/network/variants.rs Outdated Show resolved Hide resolved
workspaces/src/network/testnet.rs Outdated Show resolved Hide resolved
workspaces/src/network/testnet.rs Outdated Show resolved Hide resolved
@AlexKushnir1 AlexKushnir1 requested a review from frol September 3, 2024 14:47
frol
frol previously requested changes Sep 5, 2024
Copy link
Collaborator

@frol frol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AlexKushnir1 Great job! We are getting very close to solving it once and for all!

@race-of-sloths score 13

workspaces/tests/account.rs Outdated Show resolved Hide resolved
workspaces/src/network/variants.rs Outdated Show resolved Hide resolved
workspaces/src/network/variants.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@akorchyn akorchyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, looks good to me. I would want to have a one more review here from
@dj8yfo or @PolyProgrammist

.github/workflows/test.yml Outdated Show resolved Hide resolved
workspaces/tests/account.rs Outdated Show resolved Hide resolved
workspaces/tests/account.rs Outdated Show resolved Hide resolved
workspaces/src/network/variants.rs Outdated Show resolved Hide resolved
workspaces/src/network/variants.rs Outdated Show resolved Hide resolved
workspaces/tests/account.rs Show resolved Hide resolved
@dj8yfo dj8yfo dismissed frol’s stale review December 24, 2024 11:52

Intending to review and merge

@dj8yfo dj8yfo marked this pull request as draft December 25, 2024 13:48
@dj8yfo
Copy link
Collaborator

dj8yfo commented Dec 25, 2024

will be adding some minor changes here

dj8yf0μl added 6 commits December 25, 2024 18:02
generate_tla_credentials and generate_sponsored_credentials do the same procedure.
they were merged into a single method, where method doesn"t know and isn"t
responsible for how its result will be used.
this could be made an associated method instead, but `Worker::<Sandbox>::generate_dev_account_credentials`
would be somewhat inconvenient to be called
trait was renamed SponsoredAccountCreator -> RootAccountSubaccountCreator
to follow pattern with TopLevelAccountCreator, where created accounts
are created funded too and it's kind of implied by default, that they
have some balance on themselves, otherwise they'd have been somewhat useless
as it was used as a sync method anyway; there was no benefit from defining it as async
@dj8yfo dj8yfo marked this pull request as ready for review December 26, 2024 13:26
@dj8yfo dj8yfo changed the title Moved away from tla on testnet feat!: worker.dev_create_account, worker.dev_deploy create subaccounts of root account instead of tla (sandbox, testnet) Dec 26, 2024
@dj8yfo dj8yfo marked this pull request as draft December 26, 2024 14:14
adding `test_dev_deploy_testnet` will cost somewhat around 80 Test NEAR
per week for runs in ci,
these are stats based on the number of runs in last week.
And the test needed to be added to detect when some functionality
becomes broken or if it needs some tweaks with additional delays, if
it periodically flakily fails.
@@ -105,17 +114,22 @@ impl TopLevelAccountCreator for Testnet {
})
}

async fn create_tla_and_deploy(
async fn create_root_account_subaccount_and_deploy(
Copy link
Collaborator

@dj8yfo dj8yfo Dec 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this appears to never have been run (during the lifespan of pr), as it didn't work

@dj8yfo dj8yfo marked this pull request as ready for review December 26, 2024 19:00
@dj8yfo dj8yfo merged commit 187a992 into near:main Dec 26, 2024
6 checks passed
@frol frol mentioned this pull request Dec 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Shipped 🚀
Development

Successfully merging this pull request may close these issues.

5 participants