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

FT-event file append pulls back events that are not associated with the asset-identifier #358

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

Comments

@timstackblock
Copy link
Contributor

timstackblock commented Jul 28, 2023

Describe the bug
FT-event file append pulls back events that are not associated with the asset-identifier asset_identifier": "ST113MYNN52BC76GWP8P9PYFEP7XWJP6S5YFQM4ZE.shitty-coin::shitty",

I ran this predicate and only wanted to return ft-events for "ST113MYNN52BC76GWP8P9PYFEP7XWJP6S5YFQM4ZE.shitty-coin::shitty"

Here is the predicate file
Screen Shot 2023-07-28 at 1 40 15 PM

I successfully returned records for that asset identifier which is great but the file is very large and there are a lot of records for other FTs that do not match the asset identifier "ST113MYNN52BC76GWP8P9PYFEP7XWJP6S5YFQM4ZE.shitty-coin::shitty"

Here are screen shots this is the GOOD data

Screen Shot 2023-07-28 at 1 43 38 PM

Here is the bad data the which is not "ST113MYNN52BC76GWP8P9PYFEP7XWJP6S5YFQM4ZE.shitty-coin::shitty" and is outside of the scope. You will see FT data with asset identifiers for "asset_class_identifier":"ST2QYV0FDQE9FA10Q4W66P9Z03R1DDCDSKJFK095D.miamicoin-token::miamicoin" the filtering seems to be broken.

Screen Shot 2023-07-28 at 1 43 50 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 ✅ Done in DevTools Jul 31, 2023
@smcclellan smcclellan added this to the Q3-2023 milestone Jul 31, 2023
@timstackblock
Copy link
Contributor Author

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

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
MicaiahReid added a commit that referenced this issue Aug 3, 2023
### Description

Address #354 and
#358

#### Breaking change?

N/A

### Checklist

- [x] All tests pass
- [ ] Tests added in this PR (if applicable)

---------

Co-authored-by: Ludo Galabru <ludo@hiro.so>
@MicaiahReid
Copy link
Contributor

@timstackblock This issue should be fixed currently in the develop branch. Can you confirm?

@lgalabru lgalabru closed this as completed Aug 3, 2023
@lgalabru lgalabru reopened this Aug 3, 2023
@github-project-automation github-project-automation bot moved this from ✅ Done to 📋 Backlog in DevTools Aug 3, 2023
@timstackblock
Copy link
Contributor Author

sure let me take a look

@timstackblock
Copy link
Contributor Author

timstackblock commented Aug 3, 2023

I ran the predicate 2 times and I am getting a new error Aug 03 16:19:25.089 ERRO unable to parse stacks block_header EOF while parsing a string at line 1 column 3616 this FT has 2 transfers that should be pulled back from chainhooks, maybe there is something I am missing in the predicate but it looks correct to me, please let me know.

Screen Shot 2023-08-03 at 11 54 32 AM

I have pasted in the predicate so you can run it as well and see if you are getting that same error and no data back.

{
"chain": "stacks",
"uuid": "a2b55836-5fbe-441b-9de8-c24c3cda286c",
"name": "FT Event File",
"version": 1,
"networks": {
"testnet": {
"start_block": 26000,
"end_block": 26050,
"expire_after_occurrence": 1,
"if_this": {
"scope": "ft_event",
"asset_identifier": "ST113MYNN52BC76GWP8P9PYFEP7XWJP6S5YFQM4ZE.shitty-coin::shitty",
"actions": ["transfer"]
},
"then_that": {
"file_append": {
"path": "automate/tests/stacks-predicates/ft-event/ft-event-file-result.json"
}
}
}
}
}

Here is the contract in the explorer you can scroll down to the bottom to see the FT events we want to pull in with chainhooks https://explorer.hiro.so/txid/0x85309088b806ee358b4b2d0298d79c3b3aa17d0826a31622ad8d5cdd4e3e862c?chain=testnet

@timstackblock
Copy link
Contributor Author

timstackblock commented Aug 4, 2023

Here is the transaction

https://explorer.hiro.so/txid/0xb2a8445f65bf09f12f2d448ab74fa2c95dae4856ec13fe94c5f401040fed30e1?chain=testnet

Block 26043 has one of the transfer

Screen Shot 2023-08-04 at 8 52 15 AM

@MicaiahReid
Copy link
Contributor

It looks like the name of the event your filtering is off. You have the asset id ending in ::shitty when it should be ::shitty-coin. Here is a working predicate:

{
  "chain": "stacks",
  "uuid": "a2b55836-5fbe-441b-9de8-c24c3cda286c",
  "name": "FT Event File",
  "version": 1,
  "networks": {
    "testnet": {
      "start_block": 26043,
      "end_block": 26043,
      "expire_after_occurrence": 1,
      "if_this": {
        "scope": "ft_event",
        "asset_identifier": "ST113MYNN52BC76GWP8P9PYFEP7XWJP6S5YFQM4ZE.shitty-coin::shitty-coin",
        "actions": ["transfer"]
      },
      "then_that": {
        "file_append": {
          "path": "automate/tests/stacks-predicates/ft-event/ft-event-file-result.json"
        }
      }
    }
  }
}

@MicaiahReid
Copy link
Contributor

@timstackblock Let me know if you're able to confirm this and we should be able to close this issue!

@timstackblock
Copy link
Contributor Author

This works we can close this one

@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in DevTools Aug 7, 2023
vabanaerytk added a commit to vabanaerytk/chainhook that referenced this issue Aug 7, 2024
### Description

Address hirosystems/chainhook#354 and
hirosystems/chainhook#358

#### Breaking change?

N/A

### Checklist

- [x] All tests pass
- [ ] Tests added in this PR (if applicable)

---------

Co-authored-by: Ludo Galabru <ludo@hiro.so>
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