soroban-cli icon indicating copy to clipboard operation
soroban-cli copied to clipboard

Add meta during stellar contract build

Open leighmcculloch opened this issue 5 months ago • 1 comments

What problem does your feature solve?

Build tooling, CI environments, and other things outside the code want to conveniently add meta data to the contract as part of the build process.

The main use case is to support setting meta during a verified build process that @orbitlens is building.

What would you like to see?

A new option on the stellar contract build command that includes additional metadata to be written into the contractmetav0 custom section as SCMetaEntry XDR entities.

stellar contract build --meta key1=val1 --meta key2=val2 ...

What alternatives are there?

Contract can already embed meta in themselves by making the following call in the code:

soroban_sdk::contractmeta!(key = "...", val = "...");

However, sometimes build systems would like to add meta information, such as the source code repo the build is occurring from, or the commit being built, and that information may not be accessible to the code to insert itself.

It may be possible to structure that stuff with a build.rs script, but adding the ability to pass meta at the tooling level means that contracts don't need to write any code for build tooling to augment the meta.

Thanks

This idea was shared by and requested by @orbitlens in Discord:

  • https://discord.com/channels/897514728459468821/1218934322745315389/1285154853752012852

cc @janewang

leighmcculloch avatar Sep 16 '24 13:09 leighmcculloch