-
Notifications
You must be signed in to change notification settings - Fork 179
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
Update bootstrapping to include nft and metadata views #4536
Conversation
@ramtinms @janezpodhostnik Would one of you be able to get on a quick call with me so I can explain these changes to you? I'm getting a bunch of errors when running the tests and I'm not sure what is going wrong, so I could use some guidance about how everything fits together. |
fvm/bootstrap.go
Outdated
@@ -411,14 +413,55 @@ func (b *bootstrapExecutor) deployFungibleToken() flow.Address { | |||
return fungibleToken | |||
} | |||
|
|||
func (b *bootstrapExecutor) deployFlowToken(service, fungibleToken flow.Address) flow.Address { | |||
func (b *bootstrapExecutor) deployNonFungibleToken() flow.Address { | |||
nonFungibleToken := b.createAccount(b.accountKeys.FungibleTokenAccountPublicKeys) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can break stuff with on emulator, changes flowtoken address.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does it break it because the addresses are assigned in order? Is there any way around this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we could create the FlowToken account first, then deploy the other contracts to other accounts, then deploy FlowToken
after that to the first account created
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
creating accounts in advance should make it backwards compatible I guess.
Lines 318 to 326 in 7dda552
service := b.createServiceAccount() | |
fungibleToken := b.deployFungibleToken() | |
nonFungibleToken := b.deployNonFungibleToken() | |
b.deployMetadataViews(fungibleToken, nonFungibleToken) | |
flowToken := b.deployFlowToken(service, fungibleToken, nonFungibleToken) | |
storageFees := b.deployStorageFees(service, fungibleToken, flowToken) | |
feeContract := b.deployFlowFees(service, fungibleToken, flowToken, storageFees) | |
Core contracts have fixed indexes https://github.com/onflow/flow-go/blob/91da6d0b24d1d5a5e156c3616f1179b4951d19a6/fvm/environment/account_creator.go#L15C1-L20C1
better not to disturb them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can create all accounts (like serviceAccount ), then reference them in the functions. (by passing as parameter )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
something like this:
service := b.createServiceAccount()
fungibleToken := b.deployFungibleToken()
//create those to not change index
flowTokenAccount := b.createAccount(....)
flowFeesAccount := b.createAccount(....)
nonFungibleToken := b.deployNonFungibleToken()
b.deployMetadataViews(fungibleToken, nonFungibleToken)
flowToken := b.deployFlowToken(service, flowTokenAccount, fungibleToken, nonFungibleToken)
storageFees := b.deployStorageFees(service, fungibleToken, flowToken)
feeContract := b.deployFlowFees(service, flowFeesAccount, fungibleToken, flowToken, storageFees)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can also deploy metadata views and non fungible tokens on the first/service account
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@janezpodhostnik actually this is much better, then we would be totally compatible with emulator.
Codecov Report
@@ Coverage Diff @@
## master #4536 +/- ##
==========================================
- Coverage 56.25% 54.47% -1.79%
==========================================
Files 653 914 +261
Lines 64699 85238 +20539
==========================================
+ Hits 36396 46430 +10034
- Misses 25362 35218 +9856
- Partials 2941 3590 +649
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Looks like the emulator needs to be upgraded with this version of flow-go then the integration tests need to be updated with that emulator version. |
aab111f
to
e5669ef
Compare
I merged the PR in the core contracts repo. What do we need to do to get this PR merged? |
We need another review. |
bors merge |
4536: Update bootstrapping to include nft and metadata views r=janezpodhostnik a=joshuahannan In onflow/flow-core-contracts#370, we're adding metadata views to the `FlowToken` smart contract. For this, the contract needs to implement all the metadata views contracts. This PR updates the bootstrapping logic to deploy `NonFungibleToken`, `MetadataViews`, `ViewResolver`, and `FungibleTokenMetadataViews` and provide those import addresses to the `FlowToken` smart contract deployment. Co-authored-by: Josh Hannan <hannanjoshua19@gmail.com> Co-authored-by: Janez Podhostnik <janez.podhostnik@gmail.com> Co-authored-by: Janez Podhostnik <67895329+janezpodhostnik@users.noreply.github.com>
Build failed: |
bors merge |
4536: Update bootstrapping to include nft and metadata views r=janezpodhostnik a=joshuahannan In onflow/flow-core-contracts#370, we're adding metadata views to the `FlowToken` smart contract. For this, the contract needs to implement all the metadata views contracts. This PR updates the bootstrapping logic to deploy `NonFungibleToken`, `MetadataViews`, `ViewResolver`, and `FungibleTokenMetadataViews` and provide those import addresses to the `FlowToken` smart contract deployment. Co-authored-by: Josh Hannan <hannanjoshua19@gmail.com> Co-authored-by: Janez Podhostnik <janez.podhostnik@gmail.com> Co-authored-by: Janez Podhostnik <67895329+janezpodhostnik@users.noreply.github.com>
Build failed: |
bors merge |
4536: Update bootstrapping to include nft and metadata views r=janezpodhostnik a=joshuahannan In onflow/flow-core-contracts#370, we're adding metadata views to the `FlowToken` smart contract. For this, the contract needs to implement all the metadata views contracts. This PR updates the bootstrapping logic to deploy `NonFungibleToken`, `MetadataViews`, `ViewResolver`, and `FungibleTokenMetadataViews` and provide those import addresses to the `FlowToken` smart contract deployment. Co-authored-by: Josh Hannan <hannanjoshua19@gmail.com> Co-authored-by: Janez Podhostnik <janez.podhostnik@gmail.com> Co-authored-by: Janez Podhostnik <67895329+janezpodhostnik@users.noreply.github.com>
Build failed: |
bors merge |
4536: Update bootstrapping to include nft and metadata views r=janezpodhostnik a=joshuahannan In onflow/flow-core-contracts#370, we're adding metadata views to the `FlowToken` smart contract. For this, the contract needs to implement all the metadata views contracts. This PR updates the bootstrapping logic to deploy `NonFungibleToken`, `MetadataViews`, `ViewResolver`, and `FungibleTokenMetadataViews` and provide those import addresses to the `FlowToken` smart contract deployment. Co-authored-by: Josh Hannan <hannanjoshua19@gmail.com> Co-authored-by: Janez Podhostnik <janez.podhostnik@gmail.com> Co-authored-by: Janez Podhostnik <67895329+janezpodhostnik@users.noreply.github.com>
Timed out. |
bors merge |
4536: Update bootstrapping to include nft and metadata views r=janezpodhostnik a=joshuahannan In onflow/flow-core-contracts#370, we're adding metadata views to the `FlowToken` smart contract. For this, the contract needs to implement all the metadata views contracts. This PR updates the bootstrapping logic to deploy `NonFungibleToken`, `MetadataViews`, `ViewResolver`, and `FungibleTokenMetadataViews` and provide those import addresses to the `FlowToken` smart contract deployment. Co-authored-by: Josh Hannan <hannanjoshua19@gmail.com> Co-authored-by: Janez Podhostnik <janez.podhostnik@gmail.com> Co-authored-by: Janez Podhostnik <67895329+janezpodhostnik@users.noreply.github.com>
Build failed: |
bors merge |
4536: Update bootstrapping to include nft and metadata views r=janezpodhostnik a=joshuahannan In onflow/flow-core-contracts#370, we're adding metadata views to the `FlowToken` smart contract. For this, the contract needs to implement all the metadata views contracts. This PR updates the bootstrapping logic to deploy `NonFungibleToken`, `MetadataViews`, `ViewResolver`, and `FungibleTokenMetadataViews` and provide those import addresses to the `FlowToken` smart contract deployment. Co-authored-by: Josh Hannan <hannanjoshua19@gmail.com> Co-authored-by: Janez Podhostnik <janez.podhostnik@gmail.com> Co-authored-by: Janez Podhostnik <67895329+janezpodhostnik@users.noreply.github.com>
Build failed: |
d99178a
to
aa528ad
Compare
In onflow/flow-core-contracts#370, we're adding metadata views to the
FlowToken
smart contract. For this, the contract needs to implement all the metadata views contracts. This PR updates the bootstrapping logic to deployNonFungibleToken
,MetadataViews
,ViewResolver
, andFungibleTokenMetadataViews
and provide those import addresses to theFlowToken
smart contract deployment.