Coder Social home page Coder Social logo

Comments (13)

chasefleming avatar chasefleming commented on September 6, 2024 1

init doesn't actually deploy any contracts. It uses Dependency Manager to add them to flow.json for easy setup. That also looks for any dependencies the contract you're installing has and sets those up for you as well to make your life easier. But I think I realized what the issue is! By default when init uses Dependency Manager under the hood it's set to look at mainnet, but now we have different networks with different language versions. I think if we change the default network to be checking contracts and their dependencies to be previewnet it might solve it.

from flow-cli.

chasefleming avatar chasefleming commented on September 6, 2024 1

Yep, I changed that and it appears to get around the issue, but a new issue comes up where it repeatedly asks about the Burner dependency that is a dependency of one of its imports.

I started a draft PR with the network change, but we probably shouldn't merge until we figure out the Burner issue.

And yeah it parses the programs to get the imports of a contract so you don't have to manually copy/paste every contract and its dependencies and then add to your flow.json. Big time saver. More about it on the docs here: https://developers.flow.com/tools/flow-cli/dependency-manager

from flow-cli.

turbolent avatar turbolent commented on September 6, 2024 1

Nice! For the Burner contract, we probably can just add it to the SystemContracts in flow-go?

from flow-cli.

jribbink avatar jribbink commented on September 6, 2024 1

Nice! For the Burner contract, we probably can just add it to the SystemContracts in flow-go?

I've made a PR 👍 onflow/flow-go#6211

from flow-cli.

illia-malachyn avatar illia-malachyn commented on September 6, 2024

I assume the local net is not the cause as it fails during initialization. So, you can skip some steps mentioned above

from flow-cli.

chasefleming avatar chasefleming commented on September 6, 2024

@turbolent do you have any insight into this? It's definitely failing because that contract is not upgraded to C1. It's pulled from the system contracts library.

from flow-cli.

turbolent avatar turbolent commented on September 6, 2024

Looking into, can reproduce the problem with master of flow-go and flow-cli:

$ go run ./cmd/flow init
# github.com/karalabe/usb
In file included from ../../../go/pkg/mod/github.com/karalabe/[email protected]/libs.go:50:
../../../go/pkg/mod/github.com/karalabe/[email protected]/libusb/libusb/os/darwin_usb.c:53:29: warning: macro 'ATOMIC_VAR_INIT' has been marked as deprecated [-Wdeprecated-pragma]
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/15.0.0/include/stdatomic.h:54:41: note: macro marked 'deprecated' here
Enter the name of your project

> Test

account:
directoryWithBasePath:  /var/folders/n6/04ql0mr94nq5qj61wz_lcsx40000gn/T/flow-cli-92178280/cadence/contracts
filenameWithBasePath:  /var/folders/n6/04ql0mr94nq5qj61wz_lcsx40000gn/T/flow-cli-92178280/cadence/contracts/Counter.cdc
relativeFilenameWithBasePath:  cadence/contracts/Counter.cdc
account:
account:
✔ Yes
Select any core contracts you would like to install or skip to continue.
Use arrow keys to navigate, space to select, enter to confirm or skip, q to quit:

  [ ] FlowEpoch
  [ ] FlowIDTableStaking
  [ ] FlowClusterQC
  [ ] FlowDKG
> [x] FlowServiceAccount
  [ ] NodeVersionBeacon
  [ ] RandomBeaconHistory
  [ ] FlowStorageFees
  [ ] FlowFees
  [ ] FlowToken
  [ ] FungibleToken
  [ ] NonFungibleToken
  [ ] MetadataViews
  [ ] ViewResolver
  [ ] EVM

🔄 Installing selected core contracts and dependencies...
❌ Command Error: error processing dependency: failed to parse program: Parsing failed:
error: `pub` is no longer a valid access keyword
 --> :7:0
  |
7 | pub contract FlowServiceAccount {
  | ^^^

error: `pub` is no longer a valid access keyword
 --> :9:4
  |
9 |     pub event TransactionFeeUpdated(newFee: UFix64)
  |     ^^^

error: `pub` is no longer a valid access keyword
  --> :11:4
   |
11 |     pub event AccountCreationFeeUpdated(newFee: UFix64)
   |     ^^^

error: `pub` is no longer a valid access keyword
  --> :13:4
   |
13 |     pub event AccountCreatorAdded(accountCreator: Address)
   |     ^^^

error: `pub` is no longer a valid access keyword
  --> :15:4
   |
15 |     pub event AccountCreatorRemoved(accountCreator: Address)
   |     ^^^

error: `pub` is no longer a valid access keyword
  --> :17:4
   |
17 |     pub event IsAccountCreationRestrictedUpdated(isRestricted: Bool)
   |     ^^^

error: `pub` is no longer a valid access keyword
  --> :20:4
   |
20 |     pub var transactionFee: UFix64
   |     ^^^

error: `pub` is no longer a valid access keyword
  --> :23:4
   |
23 |     pub var accountCreationFee: UFix64
   |     ^^^

error: `pub` is no longer a valid access keyword
  --> :29:4
   |
29 |     pub fun initDefaultToken(_ acct: AuthAccount) {
   |     ^^^

error: restricted types have been removed; replace with the concrete type or an equivalent intersection type
  --> :35:35
   |
35 |         acct.link<&FlowToken.Vault{FungibleToken.Receiver}>(
   |                                    ^^^^^^^^^^^^^

from flow-cli.

turbolent avatar turbolent commented on September 6, 2024

I'm new to the flow init feature and the deployment of core contracts.

Why is it prompting the user to deploy any of these contracts? These core contracts are all part of the bootstrapping process, i.e. deployed when the network starts, as the protocol needs them to function.

Also, why are the contracts hard-coded to the Mainnet variants? It looks like that causes the contracts to be pulled from Mainnet – and those contracts are not updated to Cadence 1.0 yet.

It looks like this was added in PR #1517, and the issue for it, #1482, doesn't mention the reason why this should be done.

I'd say the fix is to remove the core contract deployment – unless I'm missing something, it is not only not needed, but won't work.

cc @onflow/flow-cadence-execution

from flow-cli.

turbolent avatar turbolent commented on September 6, 2024

I see! Thanks for the explanation 👍

I think if we change the default network to be checking contracts and their dependencies to be previewnet it might solve it.

Yeah, that's what I was wondering about above:

Also, why are the contracts hard-coded to the Mainnet variants? It looks like that causes the contracts to be pulled from Mainnet – and those contracts are not updated to Cadence 1.0 yet.

Maybe we need to change

sc := systemcontracts.SystemContractsForChain(flowGo.Mainnet)

especially for Cadence 1.0, until it's deployed on TN and MN?

from flow-cli.

turbolent avatar turbolent commented on September 6, 2024

init doesn't actually deploy any contracts. It uses Dependency Manager to add them to flow.json for easy setup.

error processing dependency: failed to parse program

Why does it parse the programs? To get all the imports?

from flow-cli.

chasefleming avatar chasefleming commented on September 6, 2024

I think I might have fixed all the additional issues related to the addition of the previewnet network on this feature. One of the main ones being it now needed to know which aliases needed to be asked for depending on what network is was pulling from. Give this branch a try if you can. The second issue being it kept asking for Burner over and over.

@gregsantos @jribbink do you mind reviewing/testing this as well since you are familiar with its behavior? Thanks.

from flow-cli.

chasefleming avatar chasefleming commented on September 6, 2024

Thanks for adding that @jribbink !

from flow-cli.

chasefleming avatar chasefleming commented on September 6, 2024

Going to merge #1671 , but heads up there will still be some minor non-ideal issues until we have a flow go update with the new system contracts update.

from flow-cli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.