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

Corrupted ErgoTree in node scan #1781

Open
SethDusek opened this issue Jul 27, 2022 · 2 comments
Open

Corrupted ErgoTree in node scan #1781

SethDusek opened this issue Jul 27, 2022 · 2 comments

Comments

@SethDusek
Copy link
Contributor

SethDusek commented Jul 27, 2022

Hi, I am running into the following issue. I am trying to register a scan:

  "scanName": "Pool Box Scan",
  "trackingRule": {
    "args": [
      {
        "assetId": "f0aa270b0830411b94f41bc16c3ed89e345bc67e9d3328659881b9df237d390b",
        "predicate": "containsAsset"
      },
      {
        "predicate": "equals",
        "value": "1004040204000e20c97883afac2a5d97fa8ff3f08c069b351962217337c2ec00b80f7ba1094ee8f10e205868cee35f3f5dd0982abce2ba0796f385d4d7cd1c4862a1caa145fda3d09eafd801d6018cb2db6308b2a473000073010001d1ec93720173029372017303"
      }
    ],
    "predicate": "and"
  }
}

The value bytes are an ErgoTree eip-23 pool box contract. Unfortunately, this is not picking up boxes, and after inspecting the /scan/listAll output, it seems the ergotree has been corrupted somehow. Here's the output:

[
  {
    "scanId": 11,
    "scanName": "Pool Box Scan",
    "trackingRule": {
      "predicate": "and",
      "args": [
        {
          "predicate": "containsAsset",
          "assetId": "f0aa270b0830411b94f41bc16c3ed89e345bc67e9d3328659881b9df237d390b"
        },
        {
          "predicate": "equals",
          "register": "R1",
          "value": "100404020400"
        }
      ]
    },
    "walletInteraction": "shared",
    "removeOffchain": true
  }
]

It is checking for only a few bytes in R1 register, instead of the original script. I've tried registering this scan on both testnet 5.0-RC1 and ergo-4.0.35 (mainnet)

@kushti
Copy link
Member

kushti commented Jul 27, 2022

@SethDusek please provide value as byte array wrapping the tree, so for a p2pk address that would be 0e2308cd025d3ce5d0e988e4023794551680a82dafdf4010150b1c5b811f60ff541cbf8753 (p2pk script here is 08cd025d3ce5d0e988e4023794551680a82dafdf4010150b1c5b811f60ff541cbf8753)

@SethDusek
Copy link
Contributor Author

SethDusek commented Jul 27, 2022

Thanks, that seems to be working, however it might be worthwhile for node to throw an error if the value that the node parses is not equivalent to the one the user passed by doing a roundtrip deserialization/serialization

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

No branches or pull requests

2 participants