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

Add set_wasm_version! to create custom Wasm section #1946

Closed
wants to merge 1 commit into from
Closed

Conversation

webmaster128
Copy link
Member

Early PoC. Should not be maintained here long term.

Comment on lines +10 to +12
#[link_section = "cw5"]
#[allow(unused)]
static AS_BYTES: [u8; FULL.len()] = const_str::to_byte_array!(FULL);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As simple as that. I like it.

Copy link
Contributor

@maurolacy maurolacy Nov 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The #[used] attribute can also be useful, to prevent this from disappearing after optimisation: https://doc.rust-lang.org/beta/reference/abi.html#the-used-attribute

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not removed in the custom Wasm section in any case. I guess link_section ensures that. Other than that in the Wasm program it is not needed to have a static address. So I'm happy if it's optimized out.

@webmaster128
Copy link
Member Author

webmaster128 commented Feb 5, 2024

This should become a crate in cw-minus (soon a workspace hosting cw-utils, cw2 and other libraries for contract development)

@webmaster128
Copy link
Member Author

Done in #2124

@webmaster128 webmaster128 deleted the cw5 branch May 7, 2024 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants