Include removal of the `_` export from the WASM executable as part of the command to optimize contracts.
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- rust, wasm
- Domain
- build-system, cli
Research direction
Start at the soroban optimize command entry point and inspect how the WASM executable's exports and custom section are handled. Confirm which exports represent contract functions and ensure optimization removes the non-contract _ export while preserving the contract exports and required custom section.
Written by the indexing model from the issue text.
Description
What problem does your feature solve?
Originally, this issue was raised in the SDK repo https://github.com/stellar/rs-soroban-sdk/issues/843#issuecomment-1410805103.
I spend my days building a tool that interacts with the WASM binary in the browser, and if I want to display all available contract functions, I have to filter out the _ export. The reason the _ function is exported in the first place is to please the linker and keep the custom section included in the final *.wasm file. However, after the executable is compiled, that function will never be called and it shouldn't exist.
What would you like to see?
To solve this issue downstream, I wrote a simple disassembler that looks for non-contract exports and removes their definitions. I then re-assemble the executable and work with that. This satisfies my use case, however it's probably good to offer this more widely, I.e. running this command would also remove non-contract exports from the bytecode.
soroban optimize
What alternatives are there?
Not sure of the alternatives, but from what I've seen of NEAR executable that my friend showed me, they do not have non-contract function exports.
- Dominant language
- Rust
- Stars
- 123
- Forks
- 141
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 17
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from stellar/stellar-cli
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
stellar/stellar-cli#2384 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
stellar/stellar-cli#2347 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
stellar/stellar-cli#2723 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
stellar/stellar-cli#2722 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
stellar/stellar-cli#2703 ·
All issues in stellar/stellar-cli
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
kwakseongjae/auto-hwp#319 ·
-
area:cli bug filter-quality good first issue priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
bevyengine/bevy#25861 ·
-
comp-datalake
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121222 ·
-
enhancement remote
Difficulty 2/5 1-3 hours Newbie friendliness 68/100