-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master'
- Loading branch information
Showing
36 changed files
with
532 additions
and
320 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
|
||
# July 22, 2022 | ||
|
||
## External Mutability | ||
|
||
- FLIP that prevents external mutation was approved, implemented, and released in Secure Cadence: | ||
[https://github.com/onflow/flow/pull/703](https://github.com/onflow/flow/pull/703) | ||
- Open problems: | ||
- Composites were not covered by the FLIP, only arrays and dictionaries | ||
- Externally taking a reference to a field can circumvent the external mutability restriction | ||
- New FLIP: [https://github.com/onflow/flow/pull/1056](https://github.com/onflow/flow/pull/1056) | ||
- Purity/mutability modifier for functions | ||
- Automatic analysis to determine if function has side-effects | ||
|
||
### Condition can currently have side effects: | ||
- https://github.com/onflow/cadence/issues/1805 | ||
- Might be used for underhanded code: Post-condition might perform mutation. Example: FT withdrawal | ||
- Might be solved by purity FLIP | ||
- Can a pure function emit events? | ||
- Does affect on-chain state, but is not observable | ||
- Are other side-effecting functons like debugging logging allowed? | ||
- "Pure" vs "no side-effects" | ||
- "Pure" usually means no side-effects at all | ||
- Have to be pragmatic | ||
- Alternatives: | ||
- Prevent calls in general | ||
- Run-time errors if there are side-effects | ||
|
||
## Remove deprecated key API | ||
- We currently have two key management APIs: | ||
- `AuthAccount.addPublicKey`/`AuthAccount.removePublicKey`: | ||
- Low-level, accepts encoded key as byte array | ||
- Deprecated a year ago | ||
- [`AuthAccount.keys.add`](https://docs.onflow.org/cadence/language/accounts/#add-account-keys)/`AuthAccount.keys.remove` | ||
- High-level, accepts key as object (`PublicKey`) | ||
- Added a year ago | ||
- We attempted to remove the deprecated in the Secure Cadence release | ||
- Rolled back, as it will break client applications if they use SDK which uses deprecated API | ||
- Also: Events that are emitted when a key is added is inconsistent, depends on which API is used: https://github.com/onflow/cadence/issues/1796 | ||
- Do we have metrics on how many SDKs are still using the deprecated API? | ||
- Actionables: | ||
- Add deprecation annotation to developer tooling | ||
- Pragma, e.g. `#deprecated` | ||
- Comment, e.g. `@deprecated` | ||
- Add support in VS Code, render as ~~addPublicKey~~ | ||
|
||
## Interface default methods | ||
- https://github.com/onflow/cadence/pull/1076 | ||
- Proposed for NFT metadata standard | ||
- Helps with preventing breakage in ecosystem | ||
- Avoid copy/paste and boilerplate, making code reusable | ||
- Does not help with FT/NFT rewrite proposal | ||
- Useful for utility/convenience functions, reducing boilerplate | ||
- Open Questions: | ||
- Security implications? | ||
- Related: | ||
- Post-conditions with side-effects | ||
- Mutability | ||
- Restrict to pure functions? Potentially too restrictive, e.g. couldn’t provide | ||
- Maybe allow opt out of mutating functions. But could also be used to opt-out of a fix | ||
- Examples? | ||
- Trust relationship problem | ||
- Already have this problem with contract updates | ||
- Modification of default implementation | ||
- Would be useful to provide utility functions, like FT transfer | ||
- It should not be possible to perform malicious code, as the same could be done in a non-default function | ||
- Not a breaking change, could merge and ship before Stable Cadence | ||
- When there is a conflict, e.g multiple interfaces provide default implementation: | ||
- No "winner" is selected by default | ||
- Instead, the user is required to provide an implementation | ||
- Follow up feature: Interface requirements | ||
- Declaration site: `CI1: CI2` | ||
- Use-site would still have to explicitly declare conformance for all interfaces: `C: CI1, CI2` | ||
|
||
## Storage Querying/Iteration API | ||
- https://github.com/onflow/cadence/issues/208 | ||
- Finally added technical foundation a couple months ago: | ||
Account storage data is now stored in [atree](https://github.com/onflow/atree) values | ||
(atree is Cadence's storage layer) | ||
- Issue lays out proposal for adding API to iterate over account paths/values | ||
- Outstanding issues: | ||
- Accounts may store a lot of data. Pagination iteration? Iterator, cursor, enumerator | ||
- Concrete API proposal | ||
- First use-case: Developer tools like the Emulator and Playground | ||
- Need to show wallet developers how they can render information to users | ||
- Mutability not necessarily a problem: Run script against block. | ||
- Problem: data availability | ||
- Might be solved in future by "historic" data node | ||
- Storage Layer: | ||
- Iteration over dictionary changes when mutated | ||
- Keys are hashed | ||
- Start with MVP | ||
- Stages: | ||
- 1. Even useful if pagination problem is not solved yet | ||
- 2. Pagination for larger accounts | ||
- 3. Support for handling mutation | ||
- Also useful for e.g. dictionary, keys. Might be too large | ||
- Keys on demand | ||
- E.g. useful to pick a random key | ||
|
||
## Organisational | ||
|
||
- Should we move this meeting so it is not on a Friday evening for folks in Europe? | ||
- Not Friday, not Monday | ||
- Tuesday is best | ||
- Same time (8am PT) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.