-
Notifications
You must be signed in to change notification settings - Fork 118
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
store and allow retrieval of transaction results #129
Conversation
Hi @psq! I don't actively work on this project but I do work on other things that consume it directly (stacks-explorer), and first of all I wanted to thank you for this! I was just talking about these features and how they'd be useful to expose within the sidecar. I don't have much to add as far as the architectural aspects of this PR, but wanted to let you know that we'll be able to answer your questions soon.
I think it seems to be the case that we are moving toward returning most things with that kind of shape, eg: {
hex: ...,
repr: 'something human readable',
} I know that in the applications I work on, it's very helpful to have the sidecar handle and deserialization/conversion from clarity values. For the other stuff, I feel like @zone117x should be able to help out! |
@aulneau adding a human readable deserialized field should be fairly easy, will add this while I wait to hear back |
hmm, what happened to all the ci tests? Or was it because the last commit was trivial stuff that it didn't trigger? I was hoping to get it to rerun the tests as some are failing locally (faucet, pg) to see if it was better than last time. @aulneau I changed
instead of returning just the hex value, which should be similar to the way it is done for other CV values. |
Thanks for working on this @psq! Can you rebase your changes onto latest master? This PR should be good to go once the PR checks are passing, and a datastore unit test for the new field |
definitely. The rebase did some very strange things, so I've redone it locally but now I'm getting the same block from the mempool added twice the first time I run a transaction on the node, so will looking at this before pushing a clean set of commits. |
@zone117x I've rebuilt the PR, looks like it should have now. Not sure what you mean by Also, I have no idea why the I figured out why the node was sending the tx twice: I was specifying the observer twice, once with an environment variable, and once from the toml file. That didn't use to cause issues, but that was before the mempool txs were added. |
Not sure what's going on here either. It's working locally for me as well. Might be some kind of caching issue in the github actions, or maybe something wrong with how PRs from forks are handled. I'm going to pull this into another PR for debugging purposes |
Ahh I see the issue now. The PR just needs rebased on latest master (another PR was merged yesterday after your last rebase). Then the few test failures will show up locally and look like easy fixes |
Ah, yes, very good point, it runs the tests after merging with master, not the code in the PR branch. Fixing now.
makes sense, thank you. |
Codecov Report
@@ Coverage Diff @@
## master #129 +/- ##
==========================================
+ Coverage 56.87% 57.02% +0.15%
==========================================
Files 40 41 +1
Lines 2553 2562 +9
Branches 404 406 +2
==========================================
+ Hits 1452 1461 +9
Misses 1098 1098
Partials 3 3
Continue to review full report at Codecov.
|
@zone117x yes, that was it. tests are back to green now 😂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thank you @psq!
great, thank you for your help on this @zone117x |
This is work in progress, and by no means something to consider merging yet.
Background: as best I could tell, the way to get data about transactions without directly scanning the block database is to use Sidecar. You get a lot of information about each transaction, including all the events emitted (sweet!), but not what the transaction returned, which can be quite useful, and was lacking to implement a client for the Clarity hackaton.
Fortunately, the stacks-node server was emitting this data, so there was not much needed to be added to Sidecar. This PR includes the bare minimum I needed so far, but now I'd like to start a discussion on whether this should be something I should pursue further. See questions below.
With this PR, this lets you write client code like the one for the swapr contract where you get the
(list dx dy)
values returned by the transaction by just deserializing the content of tx_result which isClarityValue
. (calling this contract method)Questions:
hex
andrepr
version are available)?result
field that is not being used (https://github.com/psq/stacks-blockchain-sidecar/blob/feature/raw_result/src/event-stream/core-node-message.ts#L119), what's the status of this, is this something someone is actively working on?Bonus question: any doc or pointers on how to setup Postgres anywhere?