-
Notifications
You must be signed in to change notification settings - Fork 22
Update libsimplicity to latest version; add Bitcoin transaction environment #331
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
Draft
apoelstra
wants to merge
9
commits into
BlockstreamResearch:master
Choose a base branch
from
apoelstra:2025-12/update-libsimplicity
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Update libsimplicity to latest version; add Bitcoin transaction environment #331
apoelstra
wants to merge
9
commits into
BlockstreamResearch:master
from
apoelstra:2025-12/update-libsimplicity
Conversation
This file contains hidden or 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
Don't actually build bitcoin yet; just refactor build.rs
For dumb "C polymorphism" reasons we have two structures in the C code named txEnv. We can call the corresponding Rust structures different things, but we need to access them from the C file env.c, which provides some C wrappers for FFI stuff. Since you can't have two different structs with the same name in one compilation unit, split it into two.
When we update libsimplicity we will use a new type for the Core environment rather than directly using (). Then we will need to use CoreEnv::EMPTY as the value everywhere. To minimize the later diff, do this change now, where for now we just set CoreEnv::EMPTY equal to ().
This is the more correct trait. When we update the Jet trait we will be forced to pick one, and we will pick Borrow.
Updates to BlockstreamResearch/simplicity#324 This PR does a couple things simultaneously: * Runs vendor-simplicity.sh and update-jets.sh * Updates the `Jet` trait to have associated transaction and environment types, and for the environment to be paramterized by the transaction type. * Changes the Core environment from () to CoreEnv::<Infallible> * Updates some fixed Core CMR/IHR vectors (this update to libsimplicity changes the benchmarks for the Core jets and thus changes these vectors) * Uncomments the commented-out symbols in simplicity-sys/src/c_jets/c_env/bitcoin.rs * Adds the "build bitcoin" lines to simplicity-sys/build.rs The update to the `Jet` trait is a bit noisy but ultimately mechanical: everywhere that we're generic over all J: Jet, we now also have to be generic over all T: Borrow<J::Transaction>, which leads to some extra line noise especially in unit tests where we have assert_* helper functions. The last four points are tiny diffs, thanks to the previous preparatory commits. The use of CoreEnv::<Infallible> as the core environment type is kinda fun. It means that it is impossible to execute any code which attempts to access the transaction in the environment. (No such code exists, since it would be nonsensical, but now we have some assurance that it won't exist by accident in the future.) Unfortunately this mixes mechanical and non-mechanical things in one commit. But the mechanical changes are exclusively in simplicity-sys/depend/ and src/jet/init/ and the non-mechanical changes are exclusively outside of those files, so it should be possible to review this.
Now that we've updated the Jet trait to allow the transactions in environments to be arbitrary T: Borrow<Transaction>, we don't need to use Arc everywhere. In many cases we can use normal references.
This is a Rust type which can be used, among other things, to construct the transaction environment needed by C jets. Also provides accessors for the underlying transaction and input index, both of which are used (in the Elements version of this struct) in the policy satisfier.
Collaborator
Author
|
cc @roconnor-blockstream this is a bit Rust-heavy but I think you can usefully review it. cc @canndrew This is a draft but I don't expect it to change other than maybe the commit ID of libsimplicity that I use. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Draft until BlockstreamResearch/simplicity#324 merges
This updates libsimplicity to the newest version, which has several changes:
Corebenchmarks leading to CMR/IMR changes forCoreprogramsJettrait, which need to happen simultaneously inGenRustJets(from libsimplicity) and here