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

Sync stable-cadence branch with master #2455

Merged
merged 201 commits into from
Apr 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
201 commits
Select commit Hold shift + click to select a range
f400c35
Bump fxamacker/cbor stream-mode branch to latest
fxamacker Feb 28, 2023
86cda98
Create metered UFix64/Fix64 from uint64/int64
fxamacker Feb 28, 2023
0b621a7
Add CCF codec implementating CCF Specs (RC1)
fxamacker Feb 28, 2023
a2c6bc0
Add CCF codec tests
fxamacker Feb 28, 2023
a3d00ba
Add CCF codec benchmarks
fxamacker Feb 28, 2023
4c4b6cb
Remove valid UTF-8 check in encodeString
fxamacker Mar 1, 2023
e0af91f
Close the cbor.StreamEncoder in ccf.Encode()
fxamacker Mar 1, 2023
d8bb861
Refactor CCF encoder error handling
fxamacker Mar 1, 2023
4b303bf
Refactor CCF decoder error handling
fxamacker Mar 1, 2023
8f5c69c
Panic if Cadence value has nil type in CCF encoder
fxamacker Mar 1, 2023
1556c4f
Fix linter errors
fxamacker Mar 1, 2023
f911063
Fix goimports linter errors
fxamacker Mar 1, 2023
82e1812
Remove copyright years since it's in NOTICE
fxamacker Mar 14, 2023
2ce376a
Replace for-loop with range-loop for readability
fxamacker Mar 14, 2023
a13c450
Merge branch 'master' into fxamacker/ccf-codec
fxamacker Mar 14, 2023
f89eb06
Update code comments to match latest CCF Specs
fxamacker Mar 14, 2023
42d8657
Update code comments to match latest CCF Specs
fxamacker Mar 14, 2023
266fb6a
Check for "zero or more" sortable items
fxamacker Mar 14, 2023
4aa5f6b
Refactor error handling and use UnexpectedError
fxamacker Mar 15, 2023
bc220dc
Improve CCF error messages
fxamacker Mar 15, 2023
cae3f98
Add comments and instructions for updating CCF tags
fxamacker Mar 15, 2023
ef5f6d9
Reuse restricted type ID during CCF decoding
fxamacker Mar 15, 2023
8791232
Cleanup some comments and code from PR review
fxamacker Mar 15, 2023
588594e
Decode CCF (U)Int128 and (U)Int256 in metered funcs
fxamacker Mar 15, 2023
2e6e4a4
Decode CCF dictionary in metered function
fxamacker Mar 15, 2023
9d172c9
Clarify comments about CCF sorting
fxamacker Mar 16, 2023
36b52d7
Add comments for encodeTypeValue and encodeFunction
fxamacker Mar 16, 2023
705fdd5
Simplify CCF encodeOptional()
fxamacker Mar 16, 2023
852c527
Revert accidental changes to .golangci.yml
fxamacker Mar 16, 2023
cd55481
Move sorted field cache from global to CCF encoder
fxamacker Mar 16, 2023
3350596
Add CCF type ID related tests
fxamacker Mar 17, 2023
b20b4b1
Abbreviate comments to use json-cdc
fxamacker Mar 17, 2023
657e4ed
Fix lint errors
fxamacker Mar 17, 2023
60d132c
Remove RawType comparison in EnumType.Equal()
fxamacker Mar 21, 2023
7624694
Add more CCF codec tests for array
fxamacker Mar 21, 2023
46925ec
Add CCF codec test for Enum
fxamacker Mar 21, 2023
c233780
Fix CCF encoding edge case for optional value
fxamacker Mar 22, 2023
1fdd954
Merge branch 'master' into fxamacker/ccf-codec
fxamacker Mar 22, 2023
24dcca6
Update CCF encoder to use DictionaryType directly
fxamacker Mar 22, 2023
49d23b1
Add comment for OptionalType{NeverType} edge case
fxamacker Mar 22, 2023
cadecce
Add more CCF tests
fxamacker Mar 23, 2023
9672fa4
Add more CCF tests
fxamacker Mar 23, 2023
f7c2d9f
Add more CCF tests
fxamacker Mar 23, 2023
91fba70
Add ccf test for value of restricted type
fxamacker Mar 23, 2023
7a1b3f5
Remove cadence-type-id from restricted-type(-value)
fxamacker Mar 24, 2023
54c6987
Remove cadence-type-id from function-value
fxamacker Mar 24, 2023
7715d56
Update CCF test
fxamacker Mar 24, 2023
efc5dc5
remove link decoding from JSON-CDC
turbolent Mar 24, 2023
587700e
add cadence.AccountLink
turbolent Mar 24, 2023
d78f2f7
Revert FunctionType & RestrictedType typeID change
fxamacker Mar 24, 2023
490bcbd
remove type ID from function type and restricted type
turbolent Mar 24, 2023
76a322d
improve reference type ID generation
turbolent Mar 24, 2023
c5c2782
refactor capability type ID formatting
turbolent Mar 24, 2023
11e8830
use faster WriteByte instead of WriteRune
turbolent Mar 24, 2023
fd46833
simplify reference type string formatting
turbolent Mar 24, 2023
1008020
refactor restricted type ID formatting
turbolent Mar 24, 2023
4a5105a
refactor function type ID formatting
turbolent Mar 24, 2023
eb11e52
Return error if decoded size isn't same as received
fxamacker Mar 24, 2023
8c43d33
include type parameter name instead of bound
turbolent Mar 24, 2023
3332390
add type parameters to cadence package
turbolent Mar 24, 2023
9a6490d
implement function type ID
turbolent Mar 24, 2023
ee36092
Add CCF support for reference type as static type
fxamacker Mar 24, 2023
0e6fb36
Add more CCF tests
fxamacker Mar 24, 2023
82cbfd3
Remove traversing cadence.Enum for composite type
fxamacker Mar 24, 2023
42a364c
Add more CCF tests
fxamacker Mar 24, 2023
241ec38
Add sanity check for retrieved sorted field from cache
fxamacker Mar 24, 2023
27d1ec6
Check unexpected nil type in CCF decoder
fxamacker Mar 28, 2023
3245e84
Add test for decoding extraneous CCF data
fxamacker Mar 28, 2023
205d09c
Fix lint error
fxamacker Mar 28, 2023
70efc68
Fix restricted types sorting in CCF
fxamacker Mar 29, 2023
6fa154e
Fix CCF encoding of value of optional reference type
fxamacker Mar 29, 2023
330b9a8
Fix CCF decoding of type value of recursive inits
fxamacker Mar 29, 2023
06a6d73
Check encoded but unreferenced type def in CCF
fxamacker Mar 29, 2023
e053a23
Update accounts.mdx
MaxStalker Mar 30, 2023
0758547
update dependencies
turbolent Mar 30, 2023
b4e1494
Check cyclic storage references during export
SupunS Mar 29, 2023
dd45746
update aurora
turbolent Mar 30, 2023
3cc78b8
update wasmtime-go and pp
turbolent Mar 30, 2023
37f2284
Fix abstract type caching during CCF type traversal
fxamacker Mar 30, 2023
1802700
remove outdated TODO
turbolent Mar 30, 2023
03e30ea
Merge pull request #2409 from onflow/supun/fix-reference-returns
SupunS Mar 30, 2023
f20f3ae
also compare type parameters
turbolent Mar 30, 2023
1d22675
pre-allocate
turbolent Mar 30, 2023
3f90c88
optimize restriction set
turbolent Mar 30, 2023
09eea5d
lint
turbolent Mar 30, 2023
bf50554
v0.38.0
SupunS Mar 30, 2023
5bfce97
Merge pull request #2401 from onflow/bastian/improve-link-export-import
turbolent Mar 30, 2023
3224e60
Merge pull request #2411 from onflow/release/v0.38.0
SupunS Mar 31, 2023
088de78
remove parameter names when argument labels are given
turbolent Mar 31, 2023
9999690
Merge branch 'master' into fxamacker/ccf-codec
fxamacker Mar 31, 2023
30ab566
Update to use latest Cadence APIs
fxamacker Mar 31, 2023
c885b1f
Remove outdated test
fxamacker Mar 31, 2023
6ddbd88
WIP: Allow equality comparisons for dictionaries
darkdrag00nv2 Apr 2, 2023
66d1c81
Add tests in interpreter_test and complete documentation
darkdrag00nv2 Apr 2, 2023
ac4ebf9
Improve test for Merge method on CoverageReport type
m-Peter Apr 3, 2023
ce732a8
Introduce a CoverageReport field on runtime.Config type
m-Peter Apr 3, 2023
cc5644b
Completely remove CoverageReportingEnabled field from runtime.Config …
m-Peter Apr 3, 2023
271ade7
add support for generating code of nested types
turbolent Apr 3, 2023
a7a49d2
do not import sema in code generator
turbolent Apr 3, 2023
1c087d0
do not produce cyclic import
turbolent Apr 3, 2023
d19ad1e
Remove sorting of composite initializer parameters
fxamacker Apr 3, 2023
4e15605
simplify simple type member resolvers, avoid allocation on access
turbolent Apr 3, 2023
a5b4e28
generated members for nested composite types
turbolent Apr 3, 2023
d546be3
lint
turbolent Apr 3, 2023
1a14892
move composite type member initialization to init function to allow f…
turbolent Apr 3, 2023
2a45bfe
handle nested identifiers
turbolent Apr 3, 2023
c77f9af
lint
turbolent Apr 3, 2023
b18e260
Allow only 0 or 1 composite type initializers in CCF
fxamacker Apr 3, 2023
e23dfc7
Remove a redundant comment in CCF test
fxamacker Apr 3, 2023
32e8af8
refactor AuthAccount and PublicAccount types, as well as their nested…
turbolent Apr 3, 2023
6fa530e
update documentation
turbolent Apr 3, 2023
41f75d7
Merge pull request #2416 from Build-Squad/runtime-config-coverage-rep…
turbolent Apr 3, 2023
9f7dfed
Support FunctionType.TypeParameters in CCF codec
fxamacker Apr 3, 2023
1522709
generate simple type members in init function to allow for cycles
turbolent Apr 3, 2023
011a1ce
refactor DeployedContract definition to Cadence
turbolent Apr 3, 2023
1546ddd
optimize String type members: avoid allocation on access
turbolent Apr 3, 2023
4aaaacd
refactor Character type to Cadence
turbolent Apr 3, 2023
0e532e4
optimize MetaType members: avoid allocation on access
turbolent Apr 3, 2023
d4af661
optimize member resolvers of some more types
turbolent Apr 3, 2023
7801f01
Resolve review comments:
darkdrag00nv2 Apr 4, 2023
2e136e6
Merge pull request #2414 from darkdrag00nv2/eq_dict_2275
turbolent Apr 4, 2023
8288421
remove old code
turbolent Apr 4, 2023
2d623c9
Support nullable types in CCF codec
fxamacker Apr 4, 2023
79bba60
Merge pull request #2407 from onflow/bastian/update-dependencies
turbolent Apr 4, 2023
ac8154e
optimize Address type member resolvers
turbolent Apr 4, 2023
63237bf
optimize restricted type member resolvers
turbolent Apr 4, 2023
f62e262
optimize Capability type member resolvers
turbolent Apr 4, 2023
ecc3efd
Update handling of atree errors
fxamacker Apr 5, 2023
c669989
improve type of cadence.Path.domain, ensure it is not unknown
turbolent Apr 5, 2023
2923c9c
return path subtype
turbolent Apr 5, 2023
5658ba1
test script with storage path parameter
turbolent Apr 5, 2023
c3507cb
test contract deployment with storage path contract initializer param…
turbolent Apr 5, 2023
574c3ca
Merge pull request #2417 from onflow/bastian/nested-type-code-generation
turbolent Apr 5, 2023
347953b
Merge pull request #2418 from onflow/bastian/refactor-account-types
turbolent Apr 6, 2023
73cb3b3
Merge branch 'master' into bastian/optimize-simple-types
turbolent Apr 6, 2023
dc93a87
regenerate files
turbolent Apr 6, 2023
2eda2b8
Merge pull request #2419 from onflow/bastian/optimize-simple-types
turbolent Apr 6, 2023
d5753f9
Bump onflow/atree to v0.6.0
fxamacker Apr 6, 2023
a027712
Merge pull request #2426 from onflow/fxamacker/update-atree-error-han…
fxamacker Apr 6, 2023
cb2a7c8
Merge branch 'master' into max/fix-arg-name
turbolent Apr 6, 2023
2bb742f
Merge pull request #2406 from MaxStalker/max/fix-arg-name
turbolent Apr 6, 2023
caacb28
Add the 'not' built-in matcher combinator
m-Peter Apr 4, 2023
9a54823
Add the 'beSucceeded' built-in matcher function
m-Peter Apr 4, 2023
d725d77
Add the 'beFailed' built-in matcher function
m-Peter Apr 4, 2023
54475e2
Add the 'beNil' built-in matcher function
m-Peter Apr 4, 2023
7f7fb44
Add the 'beEmpty' built-in matcher function
m-Peter Apr 4, 2023
1f938a7
Add the 'haveElementCount' built-in matcher function
m-Peter Apr 4, 2023
6786bb8
Add the 'contain' built-in matcher function
m-Peter Apr 4, 2023
f595f72
Add the 'beGreaterThan' built-in matcher function
m-Peter Apr 4, 2023
c67f456
Add the 'beLessThan' built-in matcher function
m-Peter Apr 4, 2023
24bb27b
Declare the 'panic' function in the TestContractChecker
m-Peter Apr 5, 2023
dc31ba3
Improve error handling and error messages for the new matchers
m-Peter Apr 5, 2023
bad630c
Add a struct interface to abstract the result of an executed operation
m-Peter Apr 7, 2023
3428082
Panic with DefaultUserError instead of UnexpectedError
m-Peter Apr 8, 2023
74dc043
Update description for contain matcher function
m-Peter Apr 10, 2023
fee6a8a
Merge pull request #2427 from onflow/bastian/improve-paths
turbolent Apr 10, 2023
2f4cb0d
add basic support for multiline input
turbolent Apr 11, 2023
1541525
Merge pull request #2420 from Build-Squad/testing-framework-add-more-…
turbolent Apr 11, 2023
19f829f
Add more comments
fxamacker Apr 11, 2023
a9f8706
Merge branch 'master' into fxamacker/ccf-codec
fxamacker Apr 11, 2023
b8faff0
Update CCF codec to use newer PathValue in PR 2427
fxamacker Apr 11, 2023
8045558
Parallelize some CCF tests
fxamacker Apr 11, 2023
dbbbbd9
Refactor and rename functions
fxamacker Apr 11, 2023
926661c
Refactor to use same variable name in type switch
fxamacker Apr 11, 2023
80c9f49
Make CCF codec panic on implementation errors
fxamacker Apr 11, 2023
f6f08ee
Replace map of raw fields with slice for CCF decoder
fxamacker Apr 12, 2023
565f84e
Reduce CCF decoder limits for array and map elems
fxamacker Apr 12, 2023
12b7116
Deny indef length CBOR data items in CCF
fxamacker Apr 12, 2023
0939559
separate breaking changes
turbolent Apr 12, 2023
fbaf53a
Merge pull request #2435 from onflow/bastian/fix-release-notes-config
turbolent Apr 12, 2023
683ac15
Merge pull request #2434 from onflow/bastian/repl-multiline
turbolent Apr 12, 2023
c49628b
check for potential resource loss in reference expression
turbolent Apr 5, 2023
cb1f02a
Merge pull request #2437 from onflow/bastian/handle-reference-resourc…
turbolent Apr 12, 2023
3a8f622
update doc with regards to identity BLS public keys
Apr 12, 2023
0d227f8
add callouts
Apr 12, 2023
4f07b2e
Merge pull request #2439 from onflow/tarak/2394-BLS-doc
turbolent Apr 13, 2023
4a6aa57
Add more comments for CCF codec
fxamacker Apr 13, 2023
51552f1
Unwrap ref type when reducing inline type for CCF
fxamacker Apr 13, 2023
b6b29f2
Fix comment in CCF test
fxamacker Apr 13, 2023
6e5cb15
Replace recursion in getTypeToEncodeAsCCFInlineType
fxamacker Apr 13, 2023
a87f363
Merge pull request #2364 from onflow/fxamacker/ccf-codec
fxamacker Apr 13, 2023
adb8d5f
Fix built-in result variable for optional-typed returns
SupunS Apr 13, 2023
65ce61c
Refactor code
SupunS Apr 14, 2023
147e51e
Merge pull request #2444 from onflow/supun/fix-result-var
SupunS Apr 14, 2023
d2262a4
Add reference tracking for the result variable
SupunS Apr 14, 2023
53dad69
Check for other places where references are created internally
SupunS Apr 14, 2023
6c22a63
ADd resource reference tracking for attachments
SupunS Apr 17, 2023
b743004
Update tests
SupunS Apr 17, 2023
bda1a19
Add validation for exporting references to destroyed resources
SupunS Apr 18, 2023
30589cb
Update attachment export test
SupunS Apr 18, 2023
e2568eb
Merge pull request #2453 from onflow/supun/fix-reference-export
SupunS Apr 19, 2023
a0e3f52
Merge pull request #2447 from onflow/supun/resource-tracking
SupunS Apr 19, 2023
5ee6a45
Merge branch 'master' into supun/sync-stable-cadence
SupunS Apr 19, 2023
a4acb79
Fix matchers
SupunS Apr 19, 2023
cdeeabd
Update json encoding
SupunS Apr 19, 2023
19019ff
Fix auth_account sema type generation
SupunS Apr 19, 2023
46b6996
Fix reference invalidation
SupunS Apr 20, 2023
a8adeac
Update publicaccount.cdc with new cadence syntax
SupunS Apr 20, 2023
55510a9
Update docs
SupunS Apr 20, 2023
3d57ec1
Remove depricated APIs
SupunS Apr 24, 2023
8919359
Bump CBOR version
SupunS Apr 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
changelog:
categories:
- title: 💥 Breaking Changes
- title: 💥 Language Breaking Changes
labels:
- Breaking Change
- Language Breaking Change
- Storage Breaking Change
- title: 💥 Go API Breaking Chance
labels:
- Go API Breaking Change
- title: ⭐ Features
labels:
- Feature
Expand Down
543 changes: 363 additions & 180 deletions docs/language/accounts.mdx

Large diffs are not rendered by default.

25 changes: 22 additions & 3 deletions docs/language/contracts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,28 @@ The deployed contracts of an account can be accessed through the `contracts` obj
Accounts store "deployed contracts", that is, the code of the contract:

```cadence
struct DeployedContract {
let name: String
let code: [UInt8]
pub struct DeployedContract {
/// The address of the account where the contract is deployed at.
pub let address: Address

/// The name of the contract.
pub let name: String

/// The code of the contract.
pub let code: [UInt8]

/// Returns an array of `Type` objects representing all the public type declarations in this contract
/// (e.g. structs, resources, enums).
///
/// For example, given a contract
/// ```
/// contract Foo {
/// pub struct Bar {...}
/// pub resource Qux {...}
/// }
/// ```
/// then `.publicTypes()` will return an array equivalent to the expression `[Type<Bar>(), Type<Qux>()]`
pub fun publicTypes(): [Type]
}
```

Expand Down
39 changes: 30 additions & 9 deletions docs/language/crypto.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ The raw key value depends on the supported signature scheme:
The raw public key is 64-bytes long.

- `BLS_BLS_12_381`:
The public key is a G_2 (curve over the prime field extension) element.
The public key is a G_2 element (on the curve over the prime field extension).
The encoding follows the compressed serialization defined in the
[IETF draft-irtf-cfrg-pairing-friendly-curves-08](https://www.ietf.org/archive/id/draft-irtf-cfrg-pairing-friendly-curves-08.html#name-point-serialization-procedu).
A public key is 96-bytes long.
Expand All @@ -173,9 +173,16 @@ The validation of the public key depends on the supported signature scheme:

- `BLS_BLS_12_381`:
The given key is correctly serialized following the compressed serialization in [IETF draft-irtf-cfrg-pairing-friendly-curves-08](https://www.ietf.org/archive/id/draft-irtf-cfrg-pairing-friendly-curves-08.html#name-point-serialization-procedu).
The coordinates represent valid prime field extension elemnents. The resulting point is on the curve, and is on the correct subgroup G_2.
The coordinates represent valid prime field extension elements. The resulting point is on the curve, and is on the correct subgroup G_2.
Note that the point at infinity is accepted and yields the identity public key. Such identity key can be useful when aggregating multiple keys.

Since the validation happen only at the time of creation, public keys are immutable.
<Callout type="info">

🚧 Status: Accepting the BLS identity key is going to be available in the upcoming release of Cadence on Mainnet.

</Callout>

Since the validation happens only at the time of creation, public keys are immutable.

```cadence
publicKey.signatureAlgorithm = SignatureAlgorithm.ECDSA_secp256k1 // Not allowed
Expand Down Expand Up @@ -225,15 +232,22 @@ ECDSA verification is implemented as defined in ANS X9.62 (also referred by [FIP
A valid signature would be generated using the expected `signedData`, `domainSeparationTag` and `hashAlgorithm` used to verify.

- BLS (`BLS_BLS_12_381`):
- `signature` expects a G_1 (subgroup of the curve over the prime field) point.
- `signature` expects a G_1 point (on the curve over the prime field).
The encoding follows the compressed serialization defined in the [IETF draft-irtf-cfrg-pairing-friendly-curves-08](https://www.ietf.org/archive/id/draft-irtf-cfrg-pairing-friendly-curves-08.html#name-point-serialization-procedu).
A signature is 48-bytes long.
- `signedData` is the arbitrary message to verify the signature against.
- `domainSeparationTag` is the expected domain tag. All tags are accepted (check [KMAC128 for BLS](#KMAC128-for-BLS)).
- `hashAlgorithm` only accepts `KMAC128_BLS_BLS12_381`. It is the algorithm used to hash the message along with the given tag (check [KMAC128 for BLS](#KMAC128-for-BLS)).

BLS verification performs the necessary membership check of the signature while the membership check of the public key is performed at the creation of the `PublicKey` object
and not repeated during the signature verification.
BLS verification performs the necessary membership check on the signature while the membership check of the public key is performed at the creation of the `PublicKey` object
and is not repeated during the signature verification. In order to prevent equivocation issues, a verification under the identity public key always returns `false`.

<Callout type="info">

🚧 Status: Returning `false` when verifying against a BLS identity key is going to be available in the upcoming release of Cadence on Mainnet.
Currently, BLS identity keys can only be constructed as an output of `aggregatePublicKeys`.

</Callout>

The verificaction uses a hash-to-curve algorithm to hash the `signedData` into a `G_1` point, following the `hash_to_curve` method described in the [draft-irtf-cfrg-hash-to-curve-14](https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-hash-to-curve-14#section-3).
While KMAC128 is used as a hash-to-field method resulting in two field elements, the mapping to curve is implemented using the [simplified SWU](https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-hash-to-curve-14#section-6.6.3).
Expand All @@ -252,7 +266,7 @@ These tools are defined in the built-in `BLS` contract, which does not need to b
### Proof of Possession (PoP)

Multi-signature verification in BLS requires a defense against rogue public-key attacks. Multiple ways are
available to protect BLS verification. The language provides the proof of possession of private key as a defense tool.
available to protect BLS verification. Cadence provides the proof of possession of private key as a defense tool.
The proof of possession of private key is a BLS signature over the public key itself.
The PoP signature follows the same requirements of a BLS signature (detailed in [Signature verification](#Signature-verification)),
except it uses a special domain separation tag. The key expected to be used in KMAC128 is the UTF-8 encoding of `"BLS_POP_BLS12381G1_XOF:KMAC128_SSWU_RO_POP_"`.
Expand All @@ -270,7 +284,7 @@ Signatures could be generated from the same or distinct messages, they
could also be the aggregation of other signatures.
The order of the signatures in the slice does not matter since the aggregation is commutative.
There is no subgroup membership check performed on the input signatures.
If the array is empty or if decoding one of the signature fails, the program aborts
If the array is empty or if decoding one of the signatures fails, the program aborts.

The output signature can be verified against an aggregated public key to authenticate multiple
signers at once. Since the `verify` method accepts a single data to verify against, it is only possible to
Expand All @@ -287,11 +301,18 @@ Aggregates multiple BLS public keys into one.
The order of the public keys in the slice does not matter since the aggregation is commutative.
The input keys are guaranteed to be in the correct subgroup since subgroup membership is checked
at the key creation time.
If the array is empty or any of the input keys is not a BLS key, the program aborts
If the array is empty or any of the input keys is not a BLS key, the program aborts.
Note that the identity public key is a valid input to this function and it represents the
identity element of aggregation.

The output public key can be used to verify aggregated signatures to authenticate multiple
signers at once. Since the `verify` method accepts a single data to verify against, it is only possible to
verfiy multiple signatures of the same message.
The identity public key is a possible output of the function, though signature verifications
against identity result in `false`.

In order to prevent rogue key attacks when verifying aggregated signatures, it is important to verfiy the
PoP of each individual key involved in the aggregation process.

## Crypto Contract

Expand Down
2 changes: 1 addition & 1 deletion docs/language/environment-information.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ To get information about a block, the functions `getCurrentBlock` and `getBlock`

-
```cadence
fun getBlock(at height: UInt64): Block?
fun getBlock(at: UInt64): Block?
```

Returns the block at the given height.
Expand Down
26 changes: 24 additions & 2 deletions docs/language/operators.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ Logical operators work with the boolean values `true` and `false`.

Comparison operators work with boolean and integer values.

- Equality: `==`, is supported for booleans, numbers, addresses, strings, characters, enums, paths, `Type` values, references, and `Void` values (`()`). Variable-sized arrays, fixed-size arrays, and optionals also support equality tests if their inner types do.
- Equality: `==`, is supported for booleans, numbers, addresses, strings, characters, enums, paths, `Type` values, references, and `Void` values (`()`). Variable-sized arrays, fixed-size arrays, dictionaries, and optionals also support equality tests if their inner types do.

Both sides of the equality operator may be optional, even of different levels,
so it is for example possible to compare a non-optional with a double-optional (`??`).
Expand Down Expand Up @@ -349,8 +349,19 @@ Comparison operators work with boolean and integer values.
xs == ys // is `true`
```

```cadence
// Equality tests of dictionaries are possible if the key and value types are equatable.
let d1 = {"abc": 1, "def": 2}
let d2 = {"abc": 1, "def": 2}
d1 == d2 // is `true`

let d3 = {"abc": {1: {"a": 1000}, 2: {"b": 2000}}, "def": {4: {"c": 1000}, 5: {"d": 2000}}}
let d4 = {"abc": {1: {"a": 1000}, 2: {"b": 2000}}, "def": {4: {"c": 1000}, 5: {"d": 2000}}}
d3 == d4 // is `true`
```

- Inequality: `!=`, is supported for booleans, numbers, addresses, strings, characters, enums, paths, `Type` values, references, and `Void` values (`()`).
Variable-sized arrays, fixed-size arrays, and optionals also support inequality tests if their inner types do.
Variable-sized arrays, fixed-size arrays, dictionaries, and optionals also support inequality tests if their inner types do.

Both sides of the inequality operator may be optional, even of different levels,
so it is for example possible to compare a non-optional with a double-optional (`??`).
Expand Down Expand Up @@ -405,6 +416,17 @@ Comparison operators work with boolean and integer values.
xs != ys // is `false`
```

```cadence
// Inequality tests of dictionaries are possible if the key and value types are equatable.
let d1 = {"abc": 1, "def": 2}
let d2 = {"abc": 1, "def": 500}
d1 != d2 // is `true`

let d3 = {"abc": {1: {"a": 1000}, 2: {"b": 2000}}, "def": {4: {"c": 1000}, 5: {"d": 2000}}}
let d4 = {"abc": {1: {"a": 1000}, 2: {"b": 2000}}, "def": {4: {"c": 1000}, 5: {"d": 2000}}}
d3 != d4 // is `false`
```

- Less than: `<`, for integers

```cadence
Expand Down
2 changes: 1 addition & 1 deletion docs/language/run-time-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Type<Int>() == Type<Int>()
Type<Int>() != Type<String>()
```

The method `fun isSubtype(of otherType: Type): Bool` can be used to compare the run-time types of values.
The method `fun isSubtype(of: Type): Bool` can be used to compare the run-time types of values.

```cadence
Type<Int>().isSubtype(of: Type<Int>()) // true
Expand Down
4 changes: 2 additions & 2 deletions docs/language/values-and-types.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1180,7 +1180,7 @@ It is invalid to use one of these functions on a fixed-sized array.

-
```cadence
fun insert(at index: Int, _ element: T): Void
fun insert(at: Int, _ element: T): Void
```

Inserts the new element `element` of type `T`
Expand Down Expand Up @@ -1211,7 +1211,7 @@ It is invalid to use one of these functions on a fixed-sized array.
```
-
```cadence
fun remove(at index: Int): T
fun remove(at: Int): T
```

Removes the element at the given `index` from the array and returns it.
Expand Down
Loading