Skip to content

Implement Core JetHinter#334

Open
ivanlele wants to merge 1 commit into
BlockstreamResearch:masterfrom
ivanlele:feature/core-jet-hinter
Open

Implement Core JetHinter#334
ivanlele wants to merge 1 commit into
BlockstreamResearch:masterfrom
ivanlele:feature/core-jet-hinter

Conversation

@ivanlele
Copy link
Copy Markdown
Contributor

This PR introduces the CoreJetHinter implementation, demonstrating the changeability of the main executable jet set.

@ivanlele ivanlele requested a review from delta1 as a code owner May 27, 2026 10:39
@ivanlele
Copy link
Copy Markdown
Contributor Author

@apoelstra After this PR, we can finally do the thing. We can load external implementations for Jet, JetHL, and JetHinter using dlopen2. I'll try to set up a minimal working example with it and a few jets.

Comment thread src/jet/core.rs
@ivanlele
Copy link
Copy Markdown
Contributor Author

ivanlele commented Jun 1, 2026

@apoelstra After this PR, we can finally do the thing. We can load external implementations for Jet, JetHL, and JetHinter using dlopen2. I'll try to set up a minimal working example with it and a few jets.

I've created a draft PR for this branch that implements this feature.

I initially wanted to use dlopen2 to support multiple platforms, but it requires a Rust version higher than our MSRV. So, I wrote a small driver to do the same myself for that too:
ivanlele#10

@ivanlele
Copy link
Copy Markdown
Contributor Author

ivanlele commented Jun 1, 2026

@apoelstra After this PR, we can finally do the thing. We can load external implementations for Jet, JetHL, and JetHinter using dlopen2. I'll try to set up a minimal working example with it and a few jets.

I've created a draft PR for this branch that implements this feature.

I initially wanted to use dlopen2 to support multiple platforms, but it requires a Rust version higher than our MSRV. So, I wrote a small driver to do the same myself for that too: ivanlele#10

If we want this before Core jets support, I can rebase my draft on top of master. But having a jet directory would help to keep the project structure cleaner, as we can keep all jets related staff there

KyrylR added a commit that referenced this pull request Jun 3, 2026
18845f8 Improve the source of types of jets (ivanlele)

Pull request description:

  This PR improves the source of truth for the underlying types consumed and produced by jets, following the suggestion in #334.

ACKs for top commit:
  apoelstra:
    ACK 18845f8; successfully ran local tests
  KyrylR:
    ACK 18845f8; successfully ran local tests

Tree-SHA512: f25da16d1e0544923ba43db7f70e50e84d0b41830081f3e1286673fa03341293433ca16c7f7cd614e91b02370a08f3c4b32af791403b3d659c7c898dffaa602a
@ivanlele ivanlele force-pushed the feature/core-jet-hinter branch from bf0a1d8 to 6fd9b88 Compare June 3, 2026 08:52
@ivanlele
Copy link
Copy Markdown
Contributor Author

ivanlele commented Jun 3, 2026

@apoelstra I rebased this one after #344 was merged.

Comment thread src/jet/core.rs
| Core::DivMod8
| Core::Divide8
| Core::Modulo8
| Core::Divides8 => SourceJetClassification::Binary,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry I didn't get to reviewing the PR where these names came in, but I find these names (SourceJetClassification::Uniary, Binary, Tertiary, Quad..) extremely vague and particularly ambiguous in the case of Binary.

I cannot really tell if this is correct or not without understanding the logic behind them.

After reading the logic I can see what it is, but I can't help but think that this is less helpful (and maybe more error prone) than specifying everything as SourceJetClassification::Custom() with the actual aliased type.

It may even be better to replace all of this with a generated file that creates the Custom classification

Copy link
Copy Markdown
Contributor Author

@ivanlele ivanlele Jun 4, 2026

Choose a reason for hiding this comment

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

Basically, we did this to keep information about inputs and outputs as close to C Simplicity as possible.

Unfortunately, we cannot auto-generate these because the resulting output would not be deterministic, as discussed in the comments here:
#334 (review)

As for the naming, I think the names serve their purpose quite well.
The words unary, binary, and ternary literally mean "consisting of "number"" respectively:
https://dictionary.cambridge.org/dictionary/english/ternary

"Consisting of three" does a good job of acting as a hint for the parser; it tells that the type consists of three elements, so the parser needs to split it into three parts.

I can only think of "number"-part" as a synonym, but it does not sound well with the Custom case.

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.

3 participants