Add script to count contributions between a certain block timeframe #208

Merged
bumi merged 2 commits from feature/count-contributions into master 2021-01-14 14:41:41 +00:00
bumi commented 2020-12-16 16:20:18 +00:00 (Migrated from github.com)

I think it is broken so far, but maybe a start.

I think it is broken so far, but maybe a start.
bumi commented 2020-12-22 11:29:58 +00:00 (Migrated from github.com)

Currently the numbers are not the same as on kredits-web. but I don't know why :)

Currently the numbers are not the same as on kredits-web. but I don't know why :)
raucao commented 2020-12-22 15:28:53 +00:00 (Migrated from github.com)

Currently the numbers are not the same as on kredits-web. but I don't know why :)

Which numbers exactly?

> Currently the numbers are not the same as on kredits-web. but I don't know why :) Which numbers exactly?
bumi commented 2020-12-22 16:24:17 +00:00 (Migrated from github.com)

I ran this script and it gives me:

Total confirmed Kredits: 1771000 between block 1 and 7765007
┌────┬───────────────┬─────────┐
│ ID │ Name          │ Kredits │
├────┼───────────────┼─────────┤
│ 1  │ Bumi          │ 260500  │
├────┼───────────────┼─────────┤
│ 2  │ Râu Cao       │ 421000  │
├────┼───────────────┼─────────┤
│ 3  │ Manuel        │ 204500  │
├────┼───────────────┼─────────┤
│ 4  │ galfert       │ 278500  │
├────┼───────────────┼─────────┤
│ 5  │ Greg          │ 336500  │
├────┼───────────────┼─────────┤
│ 6  │ Nick          │ 252000  │
├────┼───────────────┼─────────┤
│ 7  │ haythem96     │ 13000   │
...

which is different from what I see on kredits-web

I ran this script and it gives me: ``` Total confirmed Kredits: 1771000 between block 1 and 7765007 ┌────┬───────────────┬─────────┐ │ ID │ Name │ Kredits │ ├────┼───────────────┼─────────┤ │ 1 │ Bumi │ 260500 │ ├────┼───────────────┼─────────┤ │ 2 │ Râu Cao │ 421000 │ ├────┼───────────────┼─────────┤ │ 3 │ Manuel │ 204500 │ ├────┼───────────────┼─────────┤ │ 4 │ galfert │ 278500 │ ├────┼───────────────┼─────────┤ │ 5 │ Greg │ 336500 │ ├────┼───────────────┼─────────┤ │ 6 │ Nick │ 252000 │ ├────┼───────────────┼─────────┤ │ 7 │ haythem96 │ 13000 │ ... ``` which is different from what I see on kredits-web
raucao commented 2020-12-22 16:48:10 +00:00 (Migrated from github.com)

That's either a logical bug in the contract function for receiving overall kredits per contributor, or a bug in the script.

That's either a logical bug in the contract function for receiving overall kredits per contributor, or a bug in the script.
galfert commented 2020-12-22 20:54:47 +00:00 (Migrated from github.com)

When I use the filter in Kredits Web to search for all contributions of "haythem96", all contributions amount to 13000 Kredits. That's the same amount as @bumi got with the script. But Kredits Web shows 13500 in the toplist.

When I use the filter in Kredits Web to search for all contributions of "haythem96", all contributions amount to 13000 Kredits. That's the same amount as @bumi got with the script. But Kredits Web shows 13500 in the toplist.
raucao commented 2020-12-23 08:53:38 +00:00 (Migrated from github.com)

When I use the filter in Kredits Web to search for all contributions of "haythem96", all contributions amount to 13000 Kredits. That's the same amount as @bumi got with the script. But Kredits Web shows 13500 in the toplist.

That would point to a bug in the contract function then. The toplist is not calculated from the contributions directly, but using a contract function to receive those numbers. My hunch would be that vetoed contributions are counted (or not counted) in some place where they shouldn't be.

> When I use the filter in Kredits Web to search for all contributions of "haythem96", all contributions amount to 13000 Kredits. That's the same amount as @bumi got with the script. But Kredits Web shows 13500 in the toplist. That would point to a bug in the contract function then. The toplist is not calculated from the contributions directly, but using a contract function to receive those numbers. My hunch would be that vetoed contributions are counted (or not counted) in some place where they shouldn't be.
raucao commented 2020-12-23 15:20:23 +00:00 (Migrated from github.com)

How do I run the script against Rinkeby?

How do I run the script against Rinkeby?
bumi commented 2020-12-23 15:38:34 +00:00 (Migrated from github.com)

I run truffle exec --network=rinkeby scripts/list-contributions-per-contributor.js (with local IPFS running)

I run `truffle exec --network=rinkeby scripts/list-contributions-per-contributor.js` (with local IPFS running)
raucao commented 2020-12-23 16:32:17 +00:00 (Migrated from github.com)

That would point to a bug in the contract function then. The toplist is not calculated from the contributions directly, but using a contract function to receive those numbers. My hunch would be that vetoed contributions are counted (or not counted) in some place where they shouldn't be.

I had a quick look and the only thing I can see is that the if condition might ignore parentheses, but it looks correct to me. Maybe a bit too much for one line and such a critical piece of code, even if simple.

Logic still dictates that it's a problem with that function, if the numbers don't add up otherwise (and it is confirmed that the added-up numbers are correct).

> That would point to a bug in the contract function then. The toplist is not calculated from the contributions directly, but using a contract function to receive those numbers. My hunch would be that vetoed contributions are counted (or not counted) in some place where they shouldn't be. I had a quick look and the only thing I can see is that the `if` condition might ignore parentheses, but it looks correct to me. Maybe a bit too much for one line and such a critical piece of code, even if simple. Logic still dictates that it's a problem with that function, if the numbers don't add up otherwise (and it is confirmed that the added-up numbers are correct).
raucao (Migrated from github.com) approved these changes 2021-01-14 14:41:32 +00:00
raucao (Migrated from github.com) left a comment

We confirmed that the script itself is correct in the meantime.

We confirmed that the script itself is correct in the meantime.
Sign in to join this conversation.
No description provided.