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

feat(axelar-std-derive): add contractstorage attribute macro #216

Merged
merged 33 commits into from
Jan 30, 2025
Merged
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
836c8da
feat(axelar-std-derive): add contractstorage attribute macro
nbayindirli Jan 27, 2025
c6de88f
diff lint
nbayindirli Jan 27, 2025
d19ef40
Merge branch 'main' into feature/storage-macro
nbayindirli Jan 28, 2025
03fdb1b
address comments
nbayindirli Jan 28, 2025
194d3ff
address comments
nbayindirli Jan 28, 2025
d83e509
breakup storage_attributes & add transform_variant doc
nbayindirli Jan 29, 2025
b0e388f
make value_type not optional + add fields_data helper
nbayindirli Jan 29, 2025
46bf998
Merge branch 'main' into feature/storage-macro
nbayindirli Jan 29, 2025
6fadf1e
expect lowercase
nbayindirli Jan 29, 2025
1db666a
improve encapsulation with storage_method on StorageType
nbayindirli Jan 29, 2025
0b30445
add ttl method
nbayindirli Jan 29, 2025
6f93793
account for Option<Option<...>> case on getter with ambiguous type
nbayindirli Jan 29, 2025
483e4d6
add deleter_name
nbayindirli Jan 29, 2025
e9d4500
add goldie on storage layout
nbayindirli Jan 29, 2025
4ad84c4
add testing on optional value type
nbayindirli Jan 29, 2025
2f2a4fb
support module-level public functions
nbayindirli Jan 29, 2025
9d035f3
enum private + public access fns
nbayindirli Jan 29, 2025
586ed70
remove println
nbayindirli Jan 29, 2025
0c0b710
remove semi-dupe test
nbayindirli Jan 29, 2025
2d6f63f
lint
nbayindirli Jan 29, 2025
6874515
remove test_storage_schema_stability
nbayindirli Jan 29, 2025
dbd645c
auto generate goldie test on generated code
nbayindirli Jan 29, 2025
b9f3c6a
lint
nbayindirli Jan 29, 2025
8f6416d
lint
nbayindirli Jan 29, 2025
ecfc0a3
remove dead golden file
nbayindirli Jan 29, 2025
3b26a9d
tests
nbayindirli Jan 29, 2025
875b896
tests
nbayindirli Jan 29, 2025
0162d95
tests
nbayindirli Jan 29, 2025
dfa5608
tests
nbayindirli Jan 29, 2025
1c76718
tests
nbayindirli Jan 29, 2025
5f9c95b
lint
nbayindirli Jan 29, 2025
b22d3b2
tests
nbayindirli Jan 29, 2025
c7576ac
address comments
nbayindirli Jan 30, 2025
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
Prev Previous commit
Next Next commit
tests
nbayindirli committed Jan 29, 2025
commit 3b26a9d9c3508a6b9dce9b6d534cf1f59ae104cf
14 changes: 13 additions & 1 deletion packages/stellar-axelar-std-derive/src/storage.rs
Original file line number Diff line number Diff line change
@@ -290,7 +290,7 @@ mod tests {
use super::*;

#[test]
fn test_storage_schema_generation() {
fn storage_schema_generation_succeeds() {
let input: DeriveInput = syn::parse_quote! {
enum DataKey {
#[instance]
@@ -320,4 +320,16 @@ mod tests {
let formatted = prettyplease::unparse(&file);
goldie::assert!(formatted);
}

#[test]
#[should_panic(expected = "contractstorage can only be used on enums.")]
fn non_enum_fails() {
let input: DeriveInput = syn::parse_quote! {
struct NotAnEnum {
field: u32,
}
};

contractstorage(&input);
}
}