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

Chainhook predicate finds 93 occurrences of contract deploys for address but there are over 200 in explorer #357

Closed
timstackblock opened this issue Jul 28, 2023 · 4 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@timstackblock
Copy link
Contributor

timstackblock commented Jul 28, 2023

Describe the bug
When running the contract deploy predicate for address ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGMI only get 93 occurences returned but I can see there are over 200 contract deploys in explorer, filter for contract deploys in the activity list below to view the data. https://explorer.hiro.so/address/ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM?chain=testnet

Screen Shot 2023-07-28 at 12 34 16 PM

I was expecting all that data to be pulled in but chainhook scanned all 114982 blocks and only found 93 occurrences.
Screen Shot 2023-07-28 at 12 28 03 PM

There seems to be a large amount of contract deploys missing. Here is the predicate I selected the block height 110989 of the last contract deploy so all the data would be pulled in, please let me know if there is something present in the file that needs changing and if this is a valid bug.

Screen Shot 2023-07-28 at 12 35 43 PM
@github-project-automation github-project-automation bot moved this to 🆕 New in DevTools Jul 28, 2023
@timstackblock timstackblock added the bug Something isn't working label Jul 28, 2023
@lgalabru
Copy link
Contributor

Thanks for the time spent on this @timstackblock, I think it's time for us to take on #287.

@smcclellan smcclellan moved this from 🆕 New to 📋 Backlog in DevTools Jul 31, 2023
@timstackblock
Copy link
Contributor Author

Ok I have pushed up my test here #347 (comment) some are blocked by the corresponding bugs I found but I will comment on #287

@timstackblock timstackblock self-assigned this Aug 2, 2023
@smcclellan smcclellan added this to the Q3-2023 milestone Aug 2, 2023
@MicaiahReid
Copy link
Contributor

I've done some digging, and I think this actually is okay!

When a predicate is checked against a block, all transactions in the block are checked to see if their deployer is the one provided in the predicate. If any of the transactions match, we return the whole block and that is 1 occurrence. So, if a single block has multiple transaction deployments from the deployer, it will only count as one occurrence. However, if you inspect the actual block that is added to the file, it will have multiple transactions. Here is an example:

{
  "chain": "stacks",
  "uuid": "a0eb4a64-c96c-4ce7-836f-1b0e004fb53f",
  "name": "Stacks Testnet Contract Deployment",
  "version": 1,
  "networks": {
    "testnet": {
      "start_block": 78395,
      "end_block": 78395,
      "if_this": {
        "scope": "contract_deployment",
        "deployer": "ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM"
      },
      "then_that": {
        "file_append": {
          "path": "./results/stacks-testnet-contract-deployment.json"
        }
      }
    }
  }
}

This block has 8 different contract deployments from the specified deployer, but it only results in one occurrence. So, though the block explorer shows many more deployments, there probably are the same amount.

To check this programmatically, maybe your tests can read in the resultant file, iterate over all blocks, and count all transactions with metadata.kind.type == "ContractDeployment && metadata.kind.data.contract_identifier.startsWith(deployer)?


Another interesting thing I found is that in the explorer link you shared, when you filter by contract deployer, there are some deployments by a different address. I don't know why. But if you look at the By ST1PQ...PGZGM text under each deployment, you'll see that not all of them are actually from that address:
image

So I only actually counted 177 occurrences of a contract deployment that were actually from that address.

@timstackblock @lgalabru

@timstackblock
Copy link
Contributor Author

Ok thanks for looking into this I will closed the issue

@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in DevTools Aug 7, 2023
@smcclellan smcclellan closed this as not planned Won't fix, can't repro, duplicate, stale Aug 15, 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

No branches or pull requests

4 participants