Comments (6)
@bluesign what do you think about this? I may be more worried about safeDeposit
since someone could try to screw on purpose some dapp transactions that is relying on the method to ever panic. I'm probably more ok with addNewVaultsByPath
since if we change the method to just skip instead of panic you will need to check on a script latter if all your vaults were actually added, so I like it how it is.
from flow-ft.
@bluesign what do you think about this? I may be more worried about
safeDeposit
since someone could try to screw on purpose some dapp transactions that is relying on the method to ever panic. I'm probably more ok withaddNewVaultsByPath
since if we change the method to just skip instead of panic you will need to check on a script latter if all your vaults were actually added, so I like it how it is.
I do want to understand the downside of this bug, If let's say the path is not linked anymore then what happens when you borrow the capability? It will panic? or just not borrow it and returns nil?
from flow-ft.
If the capability has been unlinked borrow will just return nil, but if instead, without unlinking, you load the resource that is stored under the storage path pointed by the capability, and then store there some other resource that do not implement the type of the capability, the borrow method will panic. This could be skipped by calling check on the capability first, but there's also ways of making check panic onflow/cadence#2264
With capability controllers, I believe the new borrow() method from the CapCon won't panic at all onflow/flow#798 (comment)
from flow-ft.
btw I think this panicking behaviour is a feature, otherwise returning nil can have 2 meanings: it is empty or different type stored.
ref: onflow/cadence#1247
from flow-ft.
Yeah I also think panic is a feature here, And let's say panic happens, then isn't it good that the transaction failed and not jeopardise funds? Maybe you want that transaction would never fail, as some attacker can abuse this feature and never let the transaction succeed.
from flow-ft.
Probably the best change here will be to clearly explain in which situations this methods could panic so developers using them are well aware of it.
A deposit method that will ever panic would be useful for paying royalties, that was my original thought about this
from flow-ft.
Related Issues (20)
- Adequate comments to docgen tool and include generated docs in repo
- Problems with Switchboard HOT 6
- feat: Allow public Switchboard to be used as FT Receiver HOT 2
- FungibleTokenSwitchboard is not interoperable with TokenForwarding HOT 3
- Check PrivateForwarder transactions and tests HOT 1
- error: cannot deploy invalid contract HOT 4
- Add Practical Token Setup and Transfer transactions that utilize switchboard HOT 3
- Make TokenForwarder and Switchboard target capabilities retrievable
- Update contract import schema HOT 1
- [DOCS] Add documentation for FungibleTokenMetadataViews HOT 2
- Flow CLI: Transaction Error [Error Code: 1101] pre-condition failed: Cannot deposit an incompatible token type HOT 2
- Build FT Metadata Views features
- Add FT Metadata Views to Example Token contract
- DOCS: Update FT documentation to include Metadata Views including examples
- Incorrect attribute when emitting `VaultCapabilityAdded` in FungibleTokenSwitchboard
- Update flow-ft contracts to comply with Stable Cadence changes
- cannot borrowViewResolver for some NFT HOT 2
- Normalize flow.json
- Refactor utilityContracts folder into utility folder
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flow-ft.