near / devx

This is the home of NEAR collective developer experience plans and roadmap.
11 stars 0 forks source link

Useless access key in the pool contract account #187

Closed zavodil closed 4 years ago

zavodil commented 4 years ago

Regarding https://github.com/near/initial-contracts/tree/master/staking-pool#usage we have to 1) create an account by owner near create_account my_validator --masterAccount=owner 2) deploy a staking-pool contract there.

Unfortunately after the first step we have access key here, example:

#near create_account testcontract1 --masterAccount=zavodil.betanet
Using options: {
  masterAccount: 'zavodil.betanet',
  networkId: 'betanet',
  nodeUrl: 'https://rpc.betanet.near.org',
  contractName: undefined,
  walletUrl: 'https://wallet.betanet.near.org',
  helperUrl: 'https://helper.betanet.near.org',
  useLedgerKey: "44'/397'/0'/0'/1'",
  newLedgerKey: "44'/397'/0'/0'/1'",
  initialBalance: '100000000000000000000000000',
  accountId: 'testcontract1'
}
Account testcontract1 for network "betanet" was created.

# near keys testcontract1
Using options: {
  networkId: 'betanet',
  nodeUrl: 'https://rpc.betanet.near.org',
  contractName: undefined,
  walletUrl: 'https://wallet.betanet.near.org',
  helperUrl: 'https://helper.betanet.near.org',
  useLedgerKey: "44'/397'/0'/0'/1'",
  accountId: 'testcontract1',
  initialBalance: null
}
Keys for account testcontract1
[
  {
    public_key: 'ed25519:2s6o7c9Ru5Fc4NF9CmPiwz12vZkYH5LL7YkovhVs3VmC',
    access_key: { nonce: 0, permission: 'FullAccess' }
  },
  [length]: 1
]

and it's breaking the logic when initial contract should be locked

Solution 1) Update the guide and add instruction to remove that keynear delete-key --accountId=testcontract1 "ed25119:..." 2) Add a parameter to skip adding access key near create_account testcontract1 --masterAccount=zavodil.betanet --no-access-key

evgenykuzyakov commented 4 years ago

Moved to devx. It's related to near-shell, to be able to create_account_transfer_deploy_initialize in one transaction without add access key to the given account.

behaviary commented 4 years ago

Solution: Staking pool factory and batch transactions. This is solved with Evgeny's example. More work is needed in deploying a contract without clicking.

Closed when this is resolved: https://github.com/near/near-shell/issues/260