Failed to deploy contracts when using simple (monotonic) addresses
bartolomej opened this issue · 3 comments
Problem
When running flow emulator with flow emulator --contracts --simple-addresses
, common contracts deployment fails:
6:06PM ERR ❗ Failed to deploy contracts error="[Error Code: 1101] error caused by: 1 error occurred:\n\t* transaction execute failed: [Error Code: 1101] cadence runtime error: Execution failed:\nerror: cannot deploy invalid contract\n --> 6326a67f595cff5407032880465932150a3f63977b51cf5d8434ae3e462d6613:3:2\n |\n3 | \t\tsigner.contracts.add(name: name, code: code.decodeHex())\n | \t\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nerror: cannot find declaration `FungibleToken` in `ee82856bf20e2aa6.FungibleToken`\n --> 0000000000000001.FUSD:1:7\n |\n1 | import FungibleToken from 0xee82856bf20e2aa6\n | ^^^^^^^^^^^^^ available exported declarations are:\n\n\n\n"
The log is also a bit misleading because it says "Failed to deploy contracts", but then it follows up by logging all of the common contracts along with account addresses, where they should get deployed:
6:06PM ERR ❗ Failed to deploy contracts error="[Error Code: 1101] error caused by: 1 error occurred:\n\t* transaction execute failed: [Error Code: 1101] cadence runtime error: Execution failed:\nerror: cannot deploy invalid contract\n --> 6326a67f595cff5407032880465932150a3f63977b51cf5d8434ae3e462d6613:3:2\n |\n3 | \t\tsigner.contracts.add(name: name, code: code.decodeHex())\n | \t\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nerror: cannot find declaration `FungibleToken` in `ee82856bf20e2aa6.FungibleToken`\n --> 0000000000000001.FUSD:1:7\n |\n1 | import FungibleToken from 0xee82856bf20e2aa6\n | ^^^^^^^^^^^^^ available exported declarations are:\n\n\n\n"
6:06PM INF 💵 FUSD contract FUSD=0xf8d6e0586b0a20c7
6:06PM INF ✨ NFT contract NonFungibleToken=0xf8d6e0586b0a20c7
6:06PM INF ✨ Metadata views contract MetadataViews=0xf8d6e0586b0a20c7
6:06PM INF ✨ Example NFT contract ExampleNFT=0xf8d6e0586b0a20c7
6:06PM INF ✨ NFT Storefront contract v2 NFTStorefrontV2=0xf8d6e0586b0a20c7
6:06PM INF ✨ NFT Storefront contract NFTStorefront=0xf8d6e0586b0a20c7
6:06PM INF 🌱 Starting gRPC server on port 3569 port=3569
6:06PM INF 🌱 Starting REST API on port 8888 port=8888
6:06PM INF 🌱 Starting admin server on port 8080 port=8080
6:06PM INF 🌱 Starting debugger on port 2345 port=2345
6:06PM INF ✅ Started admin server on port 8080 port=8080
6:06PM INF ✅ Started REST API server on port 8888 port=8888
6:06PM INF ✅ Started gRPC server on port 3569 port=3569
Steps to Reproduce
Run command: flow emulator --contracts --simple-addresses
(using flow-cli v1.2.0).
Acceptance Criteria
When using simple addresses, common contracts deployment should succeed.
Context
I'm working on fixing the processing of monotonic accounts in Flowser in the scope of onflow/developer-grants#150. This isn't necessarily blocking me, I just noticed this issue along the way.
This is a bit tricky; --contracts
flag does not use fvm bootstrap ( as fvm bootstrap is not configurable enough yet ) I will have a look if we can find a workaround here.
@bluesign Awesome!
Related to that, I just noticed that the flow transactions send
command also doesn't seem to be working with monotonic addresses:
flow transactions send transfer_tokens.cdc 1.0 0x0000000000000004
❗ Version warning: a new version of Flow CLI is available (v1.3.0).
Read the installation guide for upgrade instructions: https://docs.onflow.org/flow-cli/install
❌ Invalid argument: address f8d6e0586b0a20c7 is invalid for chain flow-emulator-monotonic
🙏 Check you are connecting to the correct network or account address you use is correct.
(this is using just a standard transfer_tokens transaction)
@bartolomej yeah flow-cli actually does not support monotonic addresses. ( onflow/flow-cli#1060 )
I think monotonic addresses were added for playground usecase only, so tooling support is really limited.