Solving the Jane Street Reverse Engineering Challenge

(jestoph.com)

136 points | by anitil 2 hours ago

18 comments

  • ctippett 10 minutes ago
    > I ended up using a tool called ‘z3’. It’s kind of magical? Every time it finds a solution I get a surge of joy.

    This resonates so much. I had a similar feeling after going to my very first operations research lecture. Solving seemingly incomprehensibly complex problems by framing them as a bunch of simple constraints and getting a solution seemed like such magic.

  • xvilka 1 hour ago
    To help with such tasks for real chips (given the good quality images) there is Degate[1][2] open source software.

    [1] https://www.degate.org/

    [2] https://github.com/DegateCommunity/Degate

    • flaghacker 1 hour ago
      Degate is even a bit overkill, it is meant for when you only have images of the physical chip. This challenge has the full GDS files, which are the files that are sent to the fab for manufacturing. They still contain information about all of the separate layers. In this case they even contained the stdcell names, making even full transistor and logic function extraction unnecessary.
  • AlDante2 53 minutes ago
    Hi Chris,

    just for info: https://en.wikipedia.org/wiki/GDSII will tell you about the GDS format. It apparently stands for Graphic Data System II (originally developed by Calma in the late 1970s).

    • anitil 29 minutes ago
      No spoilers! But thanks I did find out after I published, I just thought it was funnier not to know while I was working on it
  • swiftcoder 1 hour ago
    I'm not sure I've ever seen such a vicious case of NIH-syndrome. Regardless, congrats on the solve!
    • bluGill 55 minutes ago
      Since this was for fun, and the goal was learning at least as much as solving the problem that is just fine. More people should get NIH for those purposes.

      Now if he is presenting his tools as a good way to solve this problem, something you should use, or any such - that would be a bad thing. Good tools for this are complex and need to be done as part of a large team. If good tools that others should use is the goal then he should join some other group making those tools. I'm sure there is an existing open source project (maybe KiCAD - I'm not in this space so that is the only name I can come up with but maybe their goals are different?) that does this and would welcome more help.

    • _false 1 hour ago
      I first thought you were teasing Jane Street instead of OP. Maybe shows that OP is a good culture fit for Jane Street :)
  • BalistaCRATZ 1 hour ago
    Nice! I ended up using the KLayout Python API to parse the GDS and extract the netlist, which was actually quite nice to use.

    Also, yosys has support for doing “assertion checking”, which I used in my solution: https://sunaabh.com/systems/2026/08/18/jspuzzle.html

  • piker 2 hours ago
    > Well I don’t really know what to work on next

    Let me help you: work on figuring out how to spend the millions of dollars every year Jane Street will pay you to clock in. I've heard private aviation is expensive, for example. :)

    • bko 2 hours ago
      A lot of places claim they want to hire extremely smart autists, and some do. But these types of employees are incredibly hard to manage. Imagine herding cats. So if you don't invest a lot of effort in building an environment to let this person cook, go down the right rabbit holes and not rub others the wrong way, a person like this is a huge liability to the org.
      • vovavili 1 hour ago
        A lot of companies who claim to want highly intelligent and autonomous engineers by revealed preference actually want glorified slightly above average ticket pushers.

        At least by the looks of it, Jane Street appears to be an odd one to genuinely value competence.

        • bluGill 51 minutes ago
          There are a lot of incredibly smart non-autists. Or maybe slightly autistic, but enough awareness of the real world that they can be managed.
          • Emma_Goldman 40 minutes ago
            The strong affinity between autism and intelligence seems strongest in technical fields, and engineering and computer science in particular. Autism does not seem to be over-represented to anywhere near the same degree in many other domains that are full of intelligent people.
      • folkrav 43 minutes ago
        Please, explain how you determined this person was an "extremely smart autist".
        • anitil 24 minutes ago
          I took it as a compliment!
    • walrus01 2 hours ago
      Google says "Jane Street has global office locations in New York, London, Hong Kong, Singapore, Amsterdam, and Chicago" so if you're really at a loss where to spend your money, I would recommend searching for yacht dealerships in those cities. I'm sure it won't be a problem anymore.
  • flaghacker 2 hours ago
    Congrats on solving the challenge!

    I also briefly wrote about my approach here, with less pictures but going into slightly more detail about how to convert circuits to z3 equations: https://gist.github.com/KarelPeeters/dba417c2690cf0505ac9079...

    • anitil 1 hour ago
      That's really interesting that you actually used z3 to extract the output from the circuit! It hadn't occurred to me that it would be possible to do that. I suppose I got a little fixated on my approach of running a verilog simulation, and I only used z3 to solve one part (though the hardest part I think). How did you get a $DAYJOB involving formal verification?
      • flaghacker 1 hour ago
        Yeah I briefly considered switching to a simulator to get the final output, but then luckily realized the Z3 setup I had was already acting as a super-powered simulator anyway!

        I'm not actually using formal verification at $DAYJOB, there we're using MILP solvers (which are closely related to SAT solvers) as part of the compilation flow when scheduling operations onto hardware accelerators.

        I have been interested in formal verification for hardware for a while, but so far haven't found an opportunity to apply it. There are some great resources online though: the ZipCpu blog at https://zipcpu.com/formal/formal.html and SymbiYosys website at https://symbiyosys.readthedocs.io/en/latest/. I hindsight I could probably have used SymbiYosys instead of Z3, it would have saved me from having to walk the graph and map the gates to equations myself.

  • anitil 2 hours ago
    Hi HN, I recently solved the Jane Street reverse engineering challenge [0], and I wrote a blog post on how I reached the answer.

    It's a moderately technical and (hopefully) entertaining run through of the process. I hope you enjoy reading it as much as I enjoyed doing the challenge (though, as you'll read, it was also quite a frustrating process). My github is on the post if you were interested in seeing a bit more in detail what my solution looked like, though I intend to write some follow up posts that are a bit more in the weeds of the solution. And frankly, the code I used is pretty ugly but it got the job done.

    This is my first blog post, so if you have any feedback please let me know. All the writing, all the code was done by me, by hand, in vim.

    [0] https://blog.janestreet.com/can-you-reverse-engineer-an-asic...

    • __atx__ 1 hour ago
      > It turns out that this ‘sky130’ thing is like a … standard? Or something for making chips.

      Very cool seeing someone completely naive going into this :)

      If you want to read more about a bit more... cheaty way to do this, I have written about using formal verification machinery to straight up force the solution out of the netlist here: https://atx.name/electronics/asic-re/ . Could be a bit of an infohazard, but I think journey is the goal and yours was certainly more educational :)

      • anitil 1 hour ago
        I'll definitely be reading this thankyou! I think this would have been a much better way to approach it, it's a bit of a joke in the piece that I always do things the hard way, but it's a genuine mystery to me why I operate this way.

        I should add I have an EE degree (but have never worked as an EE), so even though I don't know industry standards like this sky130 thing, it's not completely foreign to me.

      • vzcx 1 hour ago
        Nice solution and good easter egg find!
    • NamTaf 1 hour ago
      I really enjoyed the writing, cheers. And yes, you may have done it the hard way, but you probably learnt 10x more by doing that.

      As for what to do next, I used to spend way too much of my late-2000s time on puzzle hunts (particularly the Melbourne Uni one [1]) and this tickled the same part of my brain. Unfortunately they're no longer a thing, but it definitely sounds like you'd enjoy something similar.

      [1]: https://www.puzzles.wiki/wiki/MUMS_Puzzle_Hunt

    • vzcx 2 hours ago
      Incredible amount of determination, but you really did make it hard for yourself!

      You can install librelane to get the whole open silicon tool suite and the sky130 PDK. Circuit extraction can be done with magic. Going from a spice netlist to verilog netlist is pretty mechanical and not a hard transform to write. You almost immediately have something that can be simulated and a good baseline for further reversing.

      • __atx__ 1 hour ago
        > Circuit extraction can be done with magic.

        So that was the missing part for me! I did it from scratch (with custom Python script with gdstk and shapely) (the GDS file does have the cells annotated, so not a big problem but still). I was thinking about scripting the "trace net" tool in klayout but decided that's going to probably bring its own can of worms...

        • vzcx 1 hour ago
          You can give the cell instances a stable name by setting GDS property 98, which I learned about from my reconnaissance of the puzzle author's github and sky130 visualization tool. This way I was able to spot check a pass over the netlist that broke up the regions into a hierarchical design.

          I'd like to do a full writeup but haven't had the time.

      • anitil 1 hour ago
        > Incredible amount of determination

        That's very kind of you. At some point I had put so much of myself in to it that I was in too deep and the only was out was to keep digging.

        I'll take a look at librelane thanks!

  • anon-3988 1 hour ago
    I have used Codex (Sol 5.6 or whatever) to solve this problem. It turns the problem into Z3, then iteratively work through the problems until it figured out the solution.

    Personally, I did not learn that much from that experience. So I am glad that there's other people working on it as well. I am mostly interested in the techniques used to solve this.

    • gnyman 1 hour ago
      The fact that agents can solve these is telling and the Infosec Capture The Flag community is trying to figure out how to approach.

      I recently solved a (in)famously hard challenge (disobey conference hacker ticket) more or less by accident. I say by accident because I have always ignored this challenges as they generally require a lot of patience and motivation to solve. Some years they haven't been solved at all. This year I had a GPT sub with some unused quota so I thought let's see how far it gets.

      And it crunched through the whole thing in an evening and morning (occasional poking from me to keep going and steer it right).

      Like anon, I learned nothing except that the agents have become really good at solving puzzles. Last time I had thrown a puzzle on them was Advent of code, with GPT3 I think and it struggled so much I gave up my experiment on day 7 or something.

    • seritools 1 hour ago
      > Personally, I did not learn that much from that experience.

      What did you expect?

  • motoxpro 53 minutes ago
    So cool to see someone who loves challenges. Congrats!
  • amelius 1 hour ago
    If there's a "two stars" solution, then maybe there is also a "three stars" solution?
  • mring33621 1 hour ago
    I love this person!
  • fabflying 1 hour ago
    So good
  • charcircuit 2 hours ago
    I wonder how far a LLM could get with this. It will be cool when we get to the point where you can decap a chip, take a picture, and then an LLM can create an emulator for that chip.
    • anitil 1 hour ago
      I'd say they could solve it much faster than I could. Some of the other commenters are mentioning tools that would have made this so much easier, and I'd assume an LLM would know to use them
    • vzcx 2 hours ago
      This would need good image recognition, but maybe not so far out of the realm of possibility.

      These GDS design files have a lot more structure to them.

  • dahshanlabs 1 hour ago
    nice one
  • gyanchawdhary 2 hours ago
    curious what the actual use case for a challenge like this is from Jane Streets side .. guess the obvious one is trading even closer to the wire .. being able to reverse engineer .. inspect circuits to uncover flaws or optimisations that shave latency or improve determinism in the trading stack .. but I wonder if there are other less obvious applications ..
    • bux93 1 hour ago
      Probably this is just an unfamiliar domain for most non-hardware folks, so it's a nice challenge that might introduce Jane Street to some people they might want to interview for non-hardware roles.

      But, they do have a hardware division, and Jane Street has a podcast that talks about some of the things they do https://signalsandthreads.com/?tag=hardware

      • gyanchawdhary 1 hour ago
        wow thanks for sharing, will check it out
  • dhzzwgzua 1 hour ago
    [dead]
  • zeninkhan 2 hours ago
    [dead]