Skip to content
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

OP_RETURN starting with"!a" is not found when OP_RETURN !aĆ[a+UQ{d^½2 is present #385

Closed
timstackblock opened this issue Aug 15, 2023 · 1 comment · Fixed by #416
Closed
Labels
bug Something isn't working

Comments

@timstackblock
Copy link
Contributor

timstackblock commented Aug 15, 2023

Describe the bug
There seems to be a bug when looking for an OP_RETURN starting with"!a" . Chainhook returns 0 actions triggered as the OP_RETURN starting with"!a" is not found when OP_RETURN !aĆ[a+�UQ{d^½2 is present

Transaction ID https://mempool.space/tx/6b9736710c061a3cef8c2cdcd46cee433c7df028ac1b71ab96dd388a2309816f
Block# 801219
Time stamp 2023-08-01 10:50

As you can see the blocks are scanned but it cannot find the OP_RETURN starting with "!a"

Screenshot 2023-08-15 at 9 33 43 AM

Here is the OP_RETURN screen shot below !aĆ[a+�UQ{d^½2

Screenshot 2023-08-15 at 9 28 20 AM

Here is the predicate where I am looking for OP_RETURNS that start with "!a"

{
  "uuid": "1",
  "name": "Hello Ordinals",
  "chain": "bitcoin",
  "version": 1,
  "networks": {
    "mainnet": {
      "start_block": 801220,
      "end_block": 801230,
      "if_this": {
        "scope": "outputs",
        "op_return": {
          "starts_with": "!a"
        }
        },
        "then_that": {
          "file_append": {
            "path": "automate/tests/bitcoin-predicates/OpReturn/OpReturn-file-result.json"
          }
        }
      }
    }
@github-project-automation github-project-automation bot moved this to 🆕 New in DevTools Aug 15, 2023
@timstackblock timstackblock added the bug Something isn't working label Aug 15, 2023
@smcclellan smcclellan moved this from 🆕 New to 📋 Backlog in DevTools Aug 21, 2023
@qustavo
Copy link
Contributor

qustavo commented Sep 4, 2023

As far as I can see mempool.space makes a subjective interpretation of the OP_RETURN's data section.
Compare the output you get from mempool.space with the one from blockstream.info:

mempool.space !aĆ[a+�UQ{d^½2
blockstream.info �!���a��Ć�[a+����U��Q����{�d^½��2�

I think that mempool.space is stripping any non-printable character, but I can't confirm.

That being said, the OP_RETURN matchers are not properly implemented in Chainhook's code yet. They are just matching an output script against the pattern defined by the predicate [1]. Implementation wise I think the matcher needs to:

  • Verify if the output is actually an OP_RETURN.
  • Perform the matching against the data section. This means skip OP_RETURN <PUSHED_BYTES>
  • Treat the predicate pattern as stated on the docs, this is, discriminate based on the 0x suffix (ASCII or HEX).

1:

if output.script_pubkey.starts_with(hex_bytes) {

@MicaiahReid MicaiahReid assigned qustavo and unassigned qustavo and MicaiahReid Sep 25, 2023
@MicaiahReid MicaiahReid moved this from 📋 Backlog to 🏗 In Progress in DevTools Sep 25, 2023
@github-project-automation github-project-automation bot moved this from 🏗 In Progress to ✅ Done in DevTools Oct 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants