Skip to content

Conversation

@sanket1729
Copy link
Member

Based on #48 and #49

This module is assuming bitcoin jets that are not
implemented/unspecified. Comment this out, this will be renabled later
in a separate PR after we have all the jets
Add a new function to_type that outputs Type
These are no longer used in C and probably incorrect.
We should remove this code entirely after we use FFI jets.

This just removes unneeded fields in the ElementsEnv struct in the next
commit
This commit also does a couple other things.
1) Makes modification to bitmachine that allows to skip assertions in
test cfg. Useful for creating states of bitmachine wihtout creating a
program.
2) Removes all existing jets that were implemented in rust. This is
   really not a good idea because the definitions of certain jets are
hard to emulate and have special corner/wierd cases. We are best to
directly use the FFI bindings.
3) Adds test for checking FFI with/without env
Also add clippy.toml to preserve MSRV warnings
@sanket1729
Copy link
Member Author

Rebased after #49

@apoelstra
Copy link
Collaborator

We never actually re-enable the policy module -- is that intentional?

@apoelstra
Copy link
Collaborator

Ah, yes, I see, there's a TODO for doing Bitcoin jets that still needs to be addressed before we can re-enable the module.

@apoelstra
Copy link
Collaborator

Overall this looks great. There are a bunch of unimplemented!s and FIXMEs and TODOs left which we will need to address in the new year. I'm not sure what the best strategy for testing this all is -- because we call into C code we can't use Miri. I suppose fuzzing+valgrind may be our best bet.

At some point we can use mutagen to assess our test coverage.

Copy link
Collaborator

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ACK bbbb7ca

@apoelstra apoelstra merged commit 8262925 into BlockstreamResearch:master Jan 1, 2023
@sanket1729
Copy link
Member Author

@apoelstra, yep. The policy compiler code is really old and based on bitcoin jets that I assumed would be created in 2020. Time to revisit this in 2023.

Similar to how we exported the jets, we should also export the test cases from schnorr6, schnorr0, hashblock, sighashall, and others to make sure that the programs are also executed correctly by rust-simplicity.

apoelstra added a commit to apoelstra/rust-simplicity that referenced this pull request Sep 5, 2025
I can't find any citation that this is safe to do. We don't actually use
this structure in our Rust code; we populate it by calling a c_set function
which is defined on the C side, and then pass it to C functions. So no code
needs to be changed.

However, I want to remove the c_set_* functions because they hide life
information (and in fact, are unsound, as we currently use them) and serve
to obfuscate code. They seem to have come from BlockstreamResearch#48 BlockstreamResearch#49 BlockstreamResearch#50 BlockstreamResearch#51 in which
Sanket seems to have copied the corresponding Haskell code into Rust, where
it is unnecessary and dangerous.
apoelstra added a commit to apoelstra/rust-simplicity that referenced this pull request Sep 12, 2025
I can't find any citation that this is safe to do. We don't actually use
this structure in our Rust code; we populate it by calling a c_set function
which is defined on the C side, and then pass it to C functions. So no code
needs to be changed.

However, I want to remove the c_set_* functions because they hide life
information (and in fact, are unsound, as we currently use them) and serve
to obfuscate code. They seem to have come from BlockstreamResearch#48 BlockstreamResearch#49 BlockstreamResearch#50 BlockstreamResearch#51 in which
Sanket seems to have copied the corresponding Haskell code into Rust, where
it is unnecessary and dangerous.
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.

2 participants