Skip to content
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

FLIP 258: NFT Storage Requirement #258

Merged
merged 4 commits into from
Apr 17, 2024
Merged

FLIP 258: NFT Storage Requirement #258

merged 4 commits into from
Apr 17, 2024

Conversation

joshuahannan
Copy link
Member

@joshuahannan joshuahannan commented Apr 11, 2024

Adds a FLIP that proposes adding access(contract) var ownedNFTs: @{UInt64: {NonFungibleToken.NFT}} to the NFT standard Collection

PR: onflow/flow-nft#211
Discord Discussion

@joshuahannan
Copy link
Member Author

After looking at the currently staged contracts on testnet, it looks like there are a good amount that still have ownedNFTs as access(all). Not sure how much of a problem this is. We would need to tell them all to re-stage their contracts

@cody-evaluate
Copy link

cody-evaluate commented Apr 11, 2024

After looking at the currently staged contracts on testnet, it looks like there are a good amount that still have ownedNFTs as access(all). Not sure how much of a problem this is. We would need to tell them all to re-stage their contracts

fwiw, it dont think it will break anything because access(all) is a more derived/loose access level than the interface signature but Im not sure if the access(contract) on the Collection interface definition would gate access regardless of the access(all) concrete implementation or not (maybe someone could just force cast to the concrete and withdraw but im not 100% sure).

@joshuahannan
Copy link
Member Author

fwiw, it dont think it will break anything because access(all) is a more derived/loose access level than the interface signature but Im not sure if the access(contract) on the Collection interface definition would gate access regardless of the access(all) concrete implementation or not (maybe someone could just force cast to the concrete and withdraw but im not 100% sure).

Why is that true? I just changed the access modifier in ExampleNFT to access(all) but kept the one in NonFungibleToken as access(contract) and it looked like it worked. It seems like an interface specifying an access level should need to be followed and having a looser access level should not be allowed.

@cody-evaluate

@joshuahannan
Copy link
Member Author

I think you're right actually. So this won't be a breaking change. That is great news! I'll update the FLIP

@cody-evaluate
Copy link

cody-evaluate commented Apr 11, 2024

fwiw, it dont think it will break anything because access(all) is a more derived/loose access level than the interface signature but Im not sure if the access(contract) on the Collection interface definition would gate access regardless of the access(all) concrete implementation or not (maybe someone could just force cast to the concrete and withdraw but im not 100% sure).

Why is that true? I just changed the access modifier in ExampleNFT to access(all) but kept the one in NonFungibleToken as access(contract) and it looked like it worked. It seems like an interface specifying an access level should need to be followed and having a looser access level should not be allowed.

@cody-evaluate

i 100% agree, im just saying that defining ownedNFTs in the concrete implementation as access(all) despite being defined as access(contract) in the interface wont break at compile time but there just might be security issues (due to force casting)

basically just saying access modifiers are covariant.

Copy link
Contributor

@sisyphusSmiling sisyphusSmiling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work getting this out so quickly!

application/20240411-nft-storage.md Outdated Show resolved Hide resolved
application/20240411-nft-storage.md Outdated Show resolved Hide resolved
@joshuahannan joshuahannan merged commit 8394cbd into main Apr 17, 2024
@joshuahannan joshuahannan deleted the nft-iterator branch April 17, 2024 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants