Status-react: Expose ethereum logs details in an extension manipulable way

Created on 12 Dec 2018  Â·  68Comments  Â·  Source: status-im/status-react

User Story

As a developer, I want to have an easy access to both data and logs property from logs events in an easy to consume way. It could be exposed in a new events property.

bounty-m extensions

All 68 comments

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


__This issue now has a funding of 120.0 DAI (120.0 USD @ $1.0/DAI) attached to it.__

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


__Work has been started__.

These users each claimed they can complete the work by 2 months, 3 weeks from now.
Please review their action plans below:

1) speedyfixer has been approved to start work.

  • Read status-react repo
  • Identify logs events
  • Identify events
  • Add new property
  • Tests
  • Make the PR

Initial questions:

Could you provide some example of "easy to consume way"?

Learn more on the Gitcoin Issue Details page.

@speedyfixer you've been approved, @jeluard may be able to help with your initial question.

Thanks @StatusSceptre , @jeluard could you help me with my initial question?

@speedyFixer This is the place that should be enhanced: https://github.com/status-im/status-react/blob/develop/src/status_im/extensions/ethereum.cljs#L242
data and topics are available as hex. They should be decoded into clojure maps (that might require user to provide some hints).

GitHub
a free (libre) open source, mobile OS for Ethereum - status-im/status-react

Thanks @jeluard , now, I'm reading status-react repo. I will keep you informed of my progress.

@speedyfixer Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • [x] reminder (3 days)
  • [ ] escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

@speedyfixer Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • [x] reminder (3 days)
  • [ ] escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

Hi, I already read the status-react repo, I will back from holidays in two days.

@speedyfixer Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • [x] reminder (3 days)
  • [ ] escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

Hello, I'm back from holidays, today, I was coding some extensions and added it in Status App also I read almost all the documentation (Learning about status.im). I'm feel more confident with my knowledge about this great project :)

Tomorrow I will try to change data and log from hex to clojure maps and I will look up a way for testing it.

Note:
Maybe I am not going to be quick because It's my first contact with this project, so if you need a quick fix please let me know to leave this issue. In the meantime I'm learning as fast as I can and I working hard to solve it quickly.

Regards

@speedyFixer Great to hear that! Please take your time!

@speedyfixer Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • [x] reminder (3 days)
  • [ ] escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

@speedyfixer Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • [x] reminder (3 days)
  • [ ] escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

Thanks @jeluard , I got stuck running status-react in my local environment (Ubuntu) but in the end I could run it. Now I can look the ethereum logs and test them. Could someone snooze the Gitcoin bot for a few days?

@speedyfixer Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • [x] reminder (3 days)
  • [ ] escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

Snoozed @speedyFixer !

Thanks @StatusSceptre , @jeluard I couldn't be able to make that re-frisk UI debugger works and seems like Figwheel hangs waiting for connects, is there any way to reach some that help me with it? Any Advice?

@speedyFixer I am not using re-frisk. You can always do plain println style debugging.

Actually for this task unit tests would probably be the simplest option.

Thanks @jeluard , I was able to run re-frisk and Figwheel, so for any beginner dev with the same problem:

I was running status-react with a Real Android device but "figwheel-urls" in env/dev/env/config.cljs is set with 10.0.2.2 (Special alias to your host loopback interface, Host machine) so the problem was that figwheel was waiting for app connections that never happened because a wrong IP. Therefore, You can use a emulator with avd (10.0.2.2) or set the correct IP of real device in "figwheel-urls".

@speedyfixer Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • [x] reminder (3 days)
  • [ ] escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

Hi, now I am playing around with ethereum/logs event in extensions, I think that I will make a WIP PR on next Thursday or sooner if possible.

@speedyfixer Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • [x] reminder (3 days)
  • [ ] escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

@speedyfixer Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • [x] reminder (3 days)
  • [ ] escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

Hi @speedyFixer, any update on progress here?

Hi @vs77bb , I will soon submit a PR, sorry for the delay, I had some problems with my computer.

@speedyfixer Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • [x] reminder (3 days)
  • [ ] escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

Hi, I think that ethereum/logs isn't working, I get 0 values with call it in custom extension, so I'm going to check this in order to solve this issue.

@speedyfixer Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • [x] reminder (3 days)
  • [ ] escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

@speedyfixer Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • [x] reminder (3 days)
  • [ ] escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

@speedyfixer Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • [x] reminder (3 days)
  • [ ] escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

Thanks for the update @speedyFixer Snoozed the bot from pinging you for 5 days; let us know if we can help!

Thank you so much @StatusSceptre !

@speedyfixer Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • [x] reminder (3 days)
  • [ ] escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

@speedyFixer Did you make progress on that one? i would be interested in using it :)

Sorry @jeluard I'm stuck, I haven't achieved to find why the parse-log isn't getting called when I use ethereum/logs in a custom extension. I have made a lot of prints and also checking re-frisk UI and always I get 0 values, I have changed Network, contract and etc, but with no luck. Now I'm thinking how debug in advanced way with Cursive.

@speedyfixer Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • [x] reminder (3 days)
  • [ ] escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

@speedyfixer Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • [x] reminder (3 days)
  • [ ] escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

Hello @jeluard and @StatusSceptre I found the bug with ethereum/logs, I going to raise a issue with the info and the possible fix.

FYI #7344

Thanks @speedyFixer will make sure someone checks this out next week!

@speedyFixer Sorry for those issues! Could you look at the logs parsing?
Ultimately I think it would be easier to just rely on unit tests for this one. You don't really need to test it with a real extension.

@speedyfixer Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • [x] reminder (3 days)
  • [ ] escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

@speedyfixer Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • [x] reminder (3 days)
  • [ ] escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

@jeluard Yes, I'm going to test it with unit tests.

Hi @jeluard when you say: "that might require user to provide some hints" , do you refer to ABI contract interface? right? I will use "web3.eth.abi.decodeLog" for decode it and convert it to a Clojure map.

Actually we have our own facility to decode ABI style hints (see the ns abi-spec).
You can find some example of what I was thinking here e.g. :params ["address" "address" "uint256"]
If you can, do not rely on anything provided by web3.

@speedyfixer Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • [x] reminder (3 days)
  • [ ] escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

I got it @jeluard thanks, I have some questions about hints providing by users, We can use params for decode data from logs, but We need "indexed" keyword for decode topics[n] where 0 < n < 4.

Reading the code I understood that if :type is provided by user then It's a indexed topic for encode purposes. https://github.com/status-im/status-react/blob/7985ee838ef2ae88d9c908f834c13d63bef7f546/src/status_im/extensions/ethereum.cljs#L304

For decode purposes, could I read hints about indexed arguments from user input?

e.g. In the next example the user doesn't provide :type and the LogBet has a indexed argument "player" of type address. Check Ropsten - Contract Events.

[ethereum/logs {:fromBlock "4479309"
                  :toBlock "4488087"
                  :address ["0x869CD9C7D178254cD6ACF448737D7Eed2CA7E839"]
                  :topics [[{:event "LogBet" :params ["address" "uint8" "int8" "uint256" "uint256" "bool"]}
                            {:event "drawBet" :params ["uint256" "uint8" "int8" "address" "uint256"]}]]
                  :on-success [store-result]}]

So, result has a Log that shows topic1: "0x000000000000000000000000cb0fa7f4600f5fa709353e741ebd3d37b8a9798a":

{:address 0x869cd9c7d178254cd6acf448737d7eed2ca7e839, :transactionHash 0xb5e09579c299066041e77bb9f56ea34952d5aab558a2727a34d0bf8d9707661e, :blockHash 0xe17dfafc8eddc898636a487a10a60ef257e434f88f58fdef947f3839d9e92e87, :transactionIndex 0x13, :topics [0x0a15cc8b657a0a07f2fdd9692b3c23013dd99170f303edd690ec8f67dfdb0a9b 0x000000000000000000000000cb0fa7f4600f5fa709353e741ebd3d37b8a9798a], :blockNumber 0x447b96, :logIndex 0x11, :removed false, :data 0x00000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000017000000000000000000000000000000000000000000000000000000000000008400000000000000000000000000000000000000000000000000470de4df8200000000000000000000000000000000000000000000000000000000000000000000}

But I don't have the hint about type for topic1, so I couldn't decode it.

Could We change the user input for something like: (:indexed key added and It is optional):

[ethereum/logs {:fromBlock "4479309"
                  :toBlock "4488087"
                  :address ["0x869CD9C7D178254cD6ACF448737D7Eed2CA7E839"]
                  :topics [[{:event "LogBet" :params ["address" "uint8" "int8" "uint256" "uint256" "bool"] :indexed ["address"]}
                            {:event "drawBet" :params ["uint256" "uint8" "int8" "address" "uint256"]}]]
                  :on-success [store-result]}]

I have also been thinking about the key names in the Clojure map, key names could be:

  1. The same name in the contract (this must be provided by user in his input)
  2. arg1, arg2 and son on

What do you think about that options? Do you have any recommendation?
If you prefer 1, could you give me an example of an user input?

Thanks in advance :+1: .

Hey @speedyFixer ! Nice to see some great progress!

Re. adding indexed yes please definitely!
Re. key names: same as in contract would probably be the most convenient

@speedyfixer Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • [x] reminder (3 days)
  • [ ] escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

@speedyfixer Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • [x] reminder (3 days)
  • [ ] escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

@speedyfixer Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • [x] reminder (3 days)
  • [ ] escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

@speedyFixer Great job so far, have snoozed the gitcoin bot warnings while you're working on this.

@StatusSceptre @jeluard thanks!

@speedyfixer Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • [x] reminder (3 days)
  • [ ] escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

@speedyfixer Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • [x] reminder (3 days)
  • [ ] escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

Hi, just an update about the work:

Decoded DATA is almost done, after that, I will do the topics decode, I will do some code cleaning and finally I will do the PR.

decoded

ropsten_decode

Thanks for your patience :+1:

@speedyFixer Thanks for the update!

@speedyfixer Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • [x] reminder (3 days)
  • [ ] escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

Hello @jeluard , could you help me with any clue about how could I run tests on my local environment? I was try clj -R:test build.clj test without luck because java.lang.NullPointerException is showed while it compiles build.clj

This issue is almost done, I'm testing it.

@speedyFixer You can run tests with lein test-cljs

Thanks @jeluard I was able to run tests with clj -R:test build.clj test test, I just tested lein test-cljs but doesn't work:

Updating hook: pre-commit
Retrieving lein-doo/lein-doo/0.1.9/lein-doo-0.1.9.pom from clojars
Retrieving org/clojure/clojurescript/1.9.229/clojurescript-1.9.229.pom from central
Retrieving lein-doo/lein-doo/0.1.9/lein-doo-0.1.9.jar from clojars
Retrieving org/clojure/clojurescript/1.9.89/clojurescript-1.9.89.pom from central
Retrieving re-frame/re-frame/0.9.3/re-frame-0.9.3.pom from clojars
WARNING: Use of undeclared Var status-im.utils.config/pairing-enabled? at line 76 test/cljs/status_im/test/pairing/core.cljs
WARNING: Use of undeclared Var status-im.utils.config/pairing-enabled? at line 76 test/cljs/status_im/test/pairing/core.cljs
WARNING: Use of undeclared Var status-im.utils.config/pairing-enabled? at line 76 test/cljs/status_im/test/pairing/core.cljs
WARNING: Use of undeclared Var status-im.utils.config/pairing-enabled? at line 167 test/cljs/status_im/test/pairing/core.cljs
WARNING: Use of undeclared Var status-im.utils.config/pairing-enabled? at line 167 test/cljs/status_im/test/pairing/core.cljs
WARNING: Use of undeclared Var status-im.utils.config/pairing-enabled? at line 167 test/cljs/status_im/test/pairing/core.cljs
WARNING: Use of undeclared Var status-im.utils.config/pairing-enabled? at line 228 test/cljs/status_im/test/pairing/core.cljs
WARNING: Use of undeclared Var status-im.utils.config/pairing-enabled? at line 228 test/cljs/status_im/test/pairing/core.cljs
WARNING: Use of undeclared Var status-im.utils.config/pairing-enabled? at line 228 test/cljs/status_im/test/pairing/core.cljs

;; ======================================================================
;; Testing with Node:

Error: Cannot find module 'hi-base32'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
at Module._load (internal/modules/cjs/loader.js:506:25)
at Function.hookedLoader [as _load] (/Developments/status-react/target/test/test.js:14:10)
at Module.require (internal/modules/cjs/loader.js:636:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object. (/Developments/status-react/target/test/status_im/js_dependencies.cljs:12:26)
at Module._compile (internal/modules/cjs/loader.js:688:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
Error encountered performing task 'doo' with profile(s): 'test'
Subprocess failed

Seems like that hi-base32 is missing in the dev dependencies?

@speedyFixer Looks like we will have to fox that!
If you can run your test anyway, LGTM

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


__Work for 120.0 DAI (120.0 USD @ $1.0/DAI) has been submitted by__:

  1. @speedyfixer

@StatusSceptre please take a look at the submitted work:

  • PR by @speedyFixer

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


__The funding of 120.0 DAI (120.0 USD @ $1.0/DAI) attached to this issue has been approved & issued to @speedyFixer.__

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


__The funding of 120.0 DAI (120.0 USD @ $1.0/DAI) attached to this issue has been approved & issued to @speedyFixer.__

Was this page helpful?
0 / 5 - 0 ratings

Related issues

churik picture churik  Â·  52Comments

jakubgs picture jakubgs  Â·  54Comments

jakubgs picture jakubgs  Â·  174Comments

yenda picture yenda  Â·  52Comments

chadyj picture chadyj  Â·  53Comments