-
Notifications
You must be signed in to change notification settings - Fork 35
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 'origin/main' into acc-sig-checksd
- Loading branch information
Showing
47 changed files
with
995 additions
and
101 deletions.
There are no files selected for viewing
Submodule concordium-contracts-common
updated
7 files
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
29 changes: 29 additions & 0 deletions
29
concordium-std/tests/derive-deserial-with-state/fail-colliding-forward.rs
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,29 @@ | ||
//! Ensure `derive(DeserialWithState)` fails when 'forward' attributes are | ||
//! colliding. | ||
use concordium_std::*; | ||
|
||
#[derive(DeserialWithState)] | ||
#[concordium(state_parameter = "S", repr(u8))] | ||
enum Count<S> { | ||
One { | ||
field: StateSet<u32, S>, | ||
}, | ||
#[concordium(forward = [5, 6])] | ||
Two(Inner), | ||
|
||
#[concordium(forward = 5)] | ||
Three(Inner), | ||
} | ||
|
||
#[derive(Deserial)] | ||
#[concordium(repr(u8))] | ||
enum Inner { | ||
#[concordium(tag = 5)] | ||
Alpha { | ||
balance: u32, | ||
}, | ||
#[concordium(tag = 6)] | ||
Beta(u16), | ||
} | ||
|
||
fn main() {} |
11 changes: 11 additions & 0 deletions
11
concordium-std/tests/derive-deserial-with-state/fail-colliding-forward.stderr
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,11 @@ | ||
error: The tag of 'Three' collides with the tag of 'Two'. | ||
--> tests/derive-deserial-with-state/fail-colliding-forward.rs:14:28 | ||
| | ||
14 | #[concordium(forward = 5)] | ||
| ^ | ||
|
||
error: The tag of 'Two' collides with the tag of 'Three'. | ||
--> tests/derive-deserial-with-state/fail-colliding-forward.rs:11:29 | ||
| | ||
11 | #[concordium(forward = [5, 6])] | ||
| ^ |
29 changes: 29 additions & 0 deletions
29
concordium-std/tests/derive-deserial-with-state/fail-colliding-tag-forward.rs
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,29 @@ | ||
//! Ensure `derive(DeserialWithState)` fails when 'forward' and 'tag' attributes | ||
//! are colliding. | ||
use concordium_std::*; | ||
|
||
#[derive(DeserialWithState)] | ||
#[concordium(state_parameter = "S", repr(u8))] | ||
enum Count<S> { | ||
One { | ||
field: StateSet<u32, S>, | ||
}, | ||
#[concordium(forward = [5, 6])] | ||
Two(Inner), | ||
|
||
#[concordium(tag = 5)] | ||
Three(Inner), | ||
} | ||
|
||
#[derive(Deserial)] | ||
#[concordium(repr(u8))] | ||
enum Inner { | ||
#[concordium(tag = 5)] | ||
Alpha { | ||
balance: u32, | ||
}, | ||
#[concordium(tag = 6)] | ||
Beta(u16), | ||
} | ||
|
||
fn main() {} |
11 changes: 11 additions & 0 deletions
11
concordium-std/tests/derive-deserial-with-state/fail-colliding-tag-forward.stderr
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,11 @@ | ||
error: The tag of 'Three' collides with the tag of 'Two'. | ||
--> tests/derive-deserial-with-state/fail-colliding-tag-forward.rs:14:18 | ||
| | ||
14 | #[concordium(tag = 5)] | ||
| ^^^ | ||
|
||
error: The tag of 'Two' collides with the tag of 'Three'. | ||
--> tests/derive-deserial-with-state/fail-colliding-tag-forward.rs:11:29 | ||
| | ||
11 | #[concordium(forward = [5, 6])] | ||
| ^ |
25 changes: 25 additions & 0 deletions
25
concordium-std/tests/derive-deserial-with-state/fail-forward-collide-with-inferred.rs
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,25 @@ | ||
//! Ensure `derive(DeserialWithState)` fails when a 'forward' attribute collides | ||
//! with the default tag for another variant. | ||
use concordium_std::*; | ||
|
||
#[derive(DeserialWithState)] | ||
#[concordium(state_parameter = "S", repr(u8))] | ||
enum Count<S> { | ||
One { | ||
field: StateSet<u32, S>, | ||
}, | ||
#[concordium(forward = [0, 6])] | ||
Two(Inner), | ||
} | ||
|
||
#[derive(Deserial)] | ||
#[concordium(repr(u8))] | ||
enum Inner { | ||
Alpha { | ||
balance: u32, | ||
}, | ||
#[concordium(tag = 6)] | ||
Beta(u16), | ||
} | ||
|
||
fn main() {} |
11 changes: 11 additions & 0 deletions
11
concordium-std/tests/derive-deserial-with-state/fail-forward-collide-with-inferred.stderr
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,11 @@ | ||
error: The tag of 'Two' collides with the tag of 'One'. | ||
--> tests/derive-deserial-with-state/fail-forward-collide-with-inferred.rs:11:29 | ||
| | ||
11 | #[concordium(forward = [0, 6])] | ||
| ^ | ||
|
||
error: The tag of 'One' collides with the tag of 'Two'. | ||
--> tests/derive-deserial-with-state/fail-forward-collide-with-inferred.rs:8:5 | ||
| | ||
8 | One { | ||
| ^^^ |
26 changes: 26 additions & 0 deletions
26
concordium-std/tests/derive-deserial-with-state/fail-forward-gt-repr.rs
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,26 @@ | ||
//! Ensure `derive(DeserialWithState)` fails when a 'forward' attribute is | ||
//! greater than what 'repr(u8)' can represent. | ||
use concordium_std::*; | ||
|
||
#[derive(DeserialWithState)] | ||
#[concordium(state_parameter = "S", repr(u8))] | ||
enum Count<S> { | ||
One { | ||
field: StateSet<u32, S>, | ||
}, | ||
#[concordium(forward = [500, 6])] | ||
Two(Inner), | ||
} | ||
|
||
#[derive(Deserial)] | ||
#[concordium(repr(u16))] | ||
enum Inner { | ||
#[concordium(tag = 500)] | ||
Alpha { | ||
balance: u32, | ||
}, | ||
#[concordium(tag = 6)] | ||
Beta(u16), | ||
} | ||
|
||
fn main() {} |
5 changes: 5 additions & 0 deletions
5
concordium-std/tests/derive-deserial-with-state/fail-forward-gt-repr.stderr
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,5 @@ | ||
error: 'forward' attribute tag value of 500 cannot be represented by the type u8 set in 'repr(u8)' | ||
--> tests/derive-deserial-with-state/fail-forward-gt-repr.rs:11:29 | ||
| | ||
11 | #[concordium(forward = [500, 6])] | ||
| ^^^ |
26 changes: 26 additions & 0 deletions
26
concordium-std/tests/derive-deserial-with-state/fail-forward-without-repr.rs
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,26 @@ | ||
//! Ensure `derive(DeserialWithState)` fails when using 'forward' attribute | ||
//! without a 'repr' attribute. | ||
use concordium_std::*; | ||
|
||
#[derive(DeserialWithState)] | ||
#[concordium(state_parameter = "S")] | ||
enum Count<S> { | ||
One { | ||
field: StateSet<u32, S>, | ||
}, | ||
#[concordium(forward = [5, 6])] | ||
Two(Inner), | ||
} | ||
|
||
#[derive(Deserial)] | ||
#[concordium(repr(u8))] | ||
enum Inner { | ||
#[concordium(tag = 5)] | ||
Alpha { | ||
balance: u32, | ||
}, | ||
#[concordium(tag = 6)] | ||
Beta(u16), | ||
} | ||
|
||
fn main() {} |
7 changes: 7 additions & 0 deletions
7
concordium-std/tests/derive-deserial-with-state/fail-forward-without-repr.stderr
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,7 @@ | ||
error: 'repr(..)' attribute must be set on the type when using 'forward' attribute | ||
--> tests/derive-deserial-with-state/fail-forward-without-repr.rs:5:10 | ||
| | ||
5 | #[derive(DeserialWithState)] | ||
| ^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: this error originates in the derive macro `DeserialWithState` (in Nightly builds, run with -Z macro-backtrace for more info) |
28 changes: 28 additions & 0 deletions
28
concordium-std/tests/derive-deserial/fail-colliding-forward.rs
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,28 @@ | ||
//! Ensure `derive(Deserial)` fails when 'forward' attributes are colliding. | ||
use concordium_std::*; | ||
|
||
#[derive(Deserial)] | ||
#[concordium(repr(u8))] | ||
enum Count { | ||
One { | ||
field: u32, | ||
}, | ||
#[concordium(forward = [5, 6])] | ||
Two(Inner), | ||
|
||
#[concordium(forward = 5)] | ||
Three(Inner), | ||
} | ||
|
||
#[derive(Deserial)] | ||
#[concordium(repr(u8))] | ||
enum Inner { | ||
#[concordium(tag = 5)] | ||
Alpha { | ||
balance: u32, | ||
}, | ||
#[concordium(tag = 6)] | ||
Beta(u16), | ||
} | ||
|
||
fn main() {} |
11 changes: 11 additions & 0 deletions
11
concordium-std/tests/derive-deserial/fail-colliding-forward.stderr
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,11 @@ | ||
error: The tag of 'Three' collides with the tag of 'Two'. | ||
--> tests/derive-deserial/fail-colliding-forward.rs:13:28 | ||
| | ||
13 | #[concordium(forward = 5)] | ||
| ^ | ||
|
||
error: The tag of 'Two' collides with the tag of 'Three'. | ||
--> tests/derive-deserial/fail-colliding-forward.rs:10:29 | ||
| | ||
10 | #[concordium(forward = [5, 6])] | ||
| ^ |
29 changes: 29 additions & 0 deletions
29
concordium-std/tests/derive-deserial/fail-colliding-tag-forward.rs
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,29 @@ | ||
//! Ensure `derive(Deserial)` fails when 'forward' and 'tag' attributes are | ||
//! colliding. | ||
use concordium_std::*; | ||
|
||
#[derive(Deserial)] | ||
#[concordium(repr(u8))] | ||
enum Count { | ||
One { | ||
field: u32, | ||
}, | ||
#[concordium(forward = [5, 6])] | ||
Two(Inner), | ||
|
||
#[concordium(tag = 5)] | ||
Three(Inner), | ||
} | ||
|
||
#[derive(Deserial)] | ||
#[concordium(repr(u8))] | ||
enum Inner { | ||
#[concordium(tag = 5)] | ||
Alpha { | ||
balance: u32, | ||
}, | ||
#[concordium(tag = 6)] | ||
Beta(u16), | ||
} | ||
|
||
fn main() {} |
11 changes: 11 additions & 0 deletions
11
concordium-std/tests/derive-deserial/fail-colliding-tag-forward.stderr
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,11 @@ | ||
error: The tag of 'Three' collides with the tag of 'Two'. | ||
--> tests/derive-deserial/fail-colliding-tag-forward.rs:14:18 | ||
| | ||
14 | #[concordium(tag = 5)] | ||
| ^^^ | ||
|
||
error: The tag of 'Two' collides with the tag of 'Three'. | ||
--> tests/derive-deserial/fail-colliding-tag-forward.rs:11:29 | ||
| | ||
11 | #[concordium(forward = [5, 6])] | ||
| ^ |
25 changes: 25 additions & 0 deletions
25
concordium-std/tests/derive-deserial/fail-forward-collide-with-inferred.rs
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,25 @@ | ||
//! Ensure `derive(Deserial)` fails when a 'forward' attribute collides with the | ||
//! default tag for another variant. | ||
use concordium_std::*; | ||
|
||
#[derive(Deserial)] | ||
#[concordium(repr(u8))] | ||
enum Count { | ||
One { | ||
field: u32, | ||
}, | ||
#[concordium(forward = [0, 6])] | ||
Two(Inner), | ||
} | ||
|
||
#[derive(Deserial)] | ||
#[concordium(repr(u8))] | ||
enum Inner { | ||
Alpha { | ||
balance: u32, | ||
}, | ||
#[concordium(tag = 6)] | ||
Beta(u16), | ||
} | ||
|
||
fn main() {} |
11 changes: 11 additions & 0 deletions
11
concordium-std/tests/derive-deserial/fail-forward-collide-with-inferred.stderr
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,11 @@ | ||
error: The tag of 'Two' collides with the tag of 'One'. | ||
--> tests/derive-deserial/fail-forward-collide-with-inferred.rs:11:29 | ||
| | ||
11 | #[concordium(forward = [0, 6])] | ||
| ^ | ||
|
||
error: The tag of 'One' collides with the tag of 'Two'. | ||
--> tests/derive-deserial/fail-forward-collide-with-inferred.rs:8:5 | ||
| | ||
8 | One { | ||
| ^^^ |
26 changes: 26 additions & 0 deletions
26
concordium-std/tests/derive-deserial/fail-forward-gt-repr.rs
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,26 @@ | ||
//! Ensure `derive(Deserial)` fails when a 'forward' attribute is greater than | ||
//! what 'repr(u8)' can represent. | ||
use concordium_std::*; | ||
|
||
#[derive(Deserial)] | ||
#[concordium(repr(u8))] | ||
enum Count { | ||
One { | ||
field: u32, | ||
}, | ||
#[concordium(forward = [500, 6])] | ||
Two(Inner), | ||
} | ||
|
||
#[derive(Deserial)] | ||
#[concordium(repr(u16))] | ||
enum Inner { | ||
#[concordium(tag = 500)] | ||
Alpha { | ||
balance: u32, | ||
}, | ||
#[concordium(tag = 6)] | ||
Beta(u16), | ||
} | ||
|
||
fn main() {} |
5 changes: 5 additions & 0 deletions
5
concordium-std/tests/derive-deserial/fail-forward-gt-repr.stderr
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,5 @@ | ||
error: 'forward' attribute tag value of 500 cannot be represented by the type u8 set in 'repr(u8)' | ||
--> tests/derive-deserial/fail-forward-gt-repr.rs:11:29 | ||
| | ||
11 | #[concordium(forward = [500, 6])] | ||
| ^^^ |
25 changes: 25 additions & 0 deletions
25
concordium-std/tests/derive-deserial/fail-forward-without-repr.rs
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,25 @@ | ||
//! Ensure `derive(Deserial)` fails when using 'forward' attribute without a | ||
//! 'repr' attribute. | ||
use concordium_std::*; | ||
|
||
#[derive(Deserial)] | ||
enum Count { | ||
One { | ||
field: u32, | ||
}, | ||
#[concordium(forward = [5, 6])] | ||
Two(Inner), | ||
} | ||
|
||
#[derive(Deserial)] | ||
#[concordium(repr(u8))] | ||
enum Inner { | ||
#[concordium(tag = 5)] | ||
Alpha { | ||
balance: u32, | ||
}, | ||
#[concordium(tag = 6)] | ||
Beta(u16), | ||
} | ||
|
||
fn main() {} |
7 changes: 7 additions & 0 deletions
7
concordium-std/tests/derive-deserial/fail-forward-without-repr.stderr
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,7 @@ | ||
error: 'repr(..)' attribute must be set on the type when using 'forward' attribute | ||
--> tests/derive-deserial/fail-forward-without-repr.rs:5:10 | ||
| | ||
5 | #[derive(Deserial)] | ||
| ^^^^^^^^ | ||
| | ||
= note: this error originates in the derive macro `Deserial` (in Nightly builds, run with -Z macro-backtrace for more info) |
Oops, something went wrong.