flow-emulator icon indicating copy to clipboard operation
flow-emulator copied to clipboard

Borrowing Capability from non existent address crashes emulator

Open devbugging opened this issue 3 years ago • 0 comments

@justjoolz commented on Fri Apr 08 2022

🐞 Bug Report

If you send a transaction that tries to borrow a capability from an account that doesn't exist, the cli and emulator hang Waiting for transaction to be sealed...⠸

ERRO[0007] Failed to commit block error="[Failure Code: 2000] unknown failure: transaction invocation failed when executing transaction: fatal error: storage error: storage address allocation failed: failed to store the key storage index: failed to update storage used by key #73746f726167655f696e646578 on account 0000000000000001: account 0000000000000001 storage used is not initialized or not initialized correctly"

Reproduction steps

Steps to reproduce the behaviour:

  1. Run transaction that: let nonExistingAddr = Address(0x01) let ref = getAccount(nonExistingAddr).getCapability(ExampleNFT.CollectionPublicPath).borrow<&{NonFungibleToken.CollectionPublic}>()!
  2. See error

Expected behaviour

Transaction should execute with an error and block should still seal

Specifications

  • System: macOS 12.0.1
  • Flow CLI: v0.33.0


@sideninja commented on Fri Apr 08 2022

Thank you for this report. This looks like a bug to me and I will further investigate and provide a fix with the next release.


@janezpodhostnik commented on Fri Apr 08 2022

Thank you for the report.

This is something that was also discovered on testnet and addressed in https://github.com/onflow/flow-go/pull/2253. And included in the emulator in https://github.com/onflow/flow-emulator/pull/143.

Just needs merging and releasing.

devbugging avatar May 11 '22 18:05 devbugging