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

Community Bounty #3 (Bot) #47

Closed
wants to merge 21 commits into from
Closed

Conversation

traumschule
Copy link
Collaborator

@traumschule traumschule commented Nov 21, 2020

#41:

  • Part I Validators/Block Production
  • Part II Announce Storage Providers
  • Part III Fix Council & Proposals

@traumschule traumschule mentioned this pull request Nov 21, 2020
@traumschule traumschule changed the title Bot: add Validators/Block summary (#41) Community Bouny #3 (Bot) Nov 24, 2020
@traumschule traumschule changed the title Community Bouny #3 (Bot) Community Bounty #3 (Bot) Nov 24, 2020
@mochet mochet requested review from blrhc and bwhm November 27, 2020 13:45
@bwhm
Copy link
Member

bwhm commented Nov 27, 2020

Thanks, @traumschule and @mochet, will review!

@bwhm
Copy link
Member

bwhm commented Nov 30, 2020

@traumschule
Started the review, but getting some build issues.

If I proceed now, I'll have to grade it a little lower than what is perhaps fair, so I prefer to give you another day to:

  • update the instructions
    • these are a mix of old and new
    • it's not clear what the last input is
  • fix the build issues
    • npm install fails
    • yarn && yarn build fails due to what I assume is minor issues)

Copy link
Member

@bwhm bwhm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it running with both yarn and npm now, so that's good 👍
First of all, I'm not sure what to do with the accountId in the config?

Part I Validators/Block Production
This may be related to the config, but I haven't seen any updates on the validators yet. Could also be that it only runs occasionally, so I'll give the 24h.

Part II Announce Storage Providers

  • I didn't see anything when I started a Storage Provider that was down. Do I need to setup some environment for this? I won't know for whether stopping reports before ~24 has passed.

  • When an SP opening was created/hired, the link and info was

    • Opening: New opening: Storage Provider 7
    • The openingId was 6, and the link was to curators - "*/#/working-groups/opportunities/curators/7"
    • Hired: member6 was choosen as Storage Provider 7
    • Again, the openingId was 6, and the link was to curators - "*/#/working-groups/opportunities/curators/7"
  • When multiple SPs were hired in the same opening, only one of them was included.

Ideally, a little more verbosity would be nice (such as "Title"), but fixing the errors is enough.

Part III Fix Council & Proposals

  • The council probably works fine, although on the chain I'm using for testing, the election round is too high (112,475). It seemed to work when I changed the endpoint to "wss://rome-rpc-endpoint.joystream.org:9944/" though...
  • For proposals, I'm only getting notifications when a proposal is created. Not for anything else...

Open `config.ts` and fill in the variables:
- `token`: To get a bot token talk to @botfather on Telegram.
- `chatid`: See below to find out the id of your group.
- `accountId`: The joystream hash to use for querying the api.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what to put in here?

Copy link
Collaborator Author

@traumschule traumschule Dec 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

accountId has to be a 48 character string or any of the accepted arguments below. It is used to query the api for the number of stakers in lib/announcements.js:226:

const stakers = await api.query.staking.erasStakers(parseInt(era), accountId);

/**
       * Exposure of validator at era.
       * 
       * This is keyed first by the era index to allow bulk deletion and then the stash account.
       * 
       * Is it removed after `HISTORY_DEPTH` eras.
       * If stakers hasn't been set or has been removed then empty exposure is returned.
       **/
      erasStakers: AugmentedQueryDoubleMap<ApiType, (key1: EraIndex | AnyNumber | Uint8Array, key2: AccountId | string | Uint8Array) => Observable<Exposure>>;

For example picking one of the validators:

  const accountId = "5EHfoRcN9tVa3PJ2XVhsFecxtCVyu7dz1pQ7YmheerPR3tBm";
  const era: any = await api.query.staking.currentEra();
  const stakers: any = await api.query.staking.erasStakers(+era, accountId);
  console.log("number of stakers:", stakers.others.length);

If there is a better way we should use that instead.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I understand it was supposed to be an accountId, but didn't understand why!
Yes, assuming you want to get the validator stats here, there is a better way.

In general, when the chain state tab in pioneer allows you to toggle on/off "include option", it means it's a double map.
See polkadot js!

@traumschule
Copy link
Collaborator Author

traumschule commented Dec 4, 2020

Part I Validators/Block Production
This may be related to the config, but I haven't seen any updates on the validators yet. Could also be that it only runs occasionally, so I'll give the 24h

If you reduce heartbeat to 60000 there will be a message every minute.

Part II Announce Storage Providers

* I didn't see anything when I started a Storage Provider that was down. Do I need to setup some environment for this? I won't know for whether stopping reports before ~24 has passed.

Yes, their domains have to be added to storageProviders.ts until we implement automatic discovery (e78fd77).

  * Again, the `openingId` was 6, and the link was to curators - "*/#/working-groups/opportunities/curators/7"

Committed ee4c5c8.

* When multiple SPs were hired in the same opening, only one of them was included.

Looking into it.

Part III Fix Council & Proposals

* The council _probably_ works fine, although on the chain I'm using for testing, the election round is too high (112,475). It seemed to work when I changed the endpoint to "wss://rome-rpc-endpoint.joystream.org:9944/" though...

* For proposals, I'm only getting notifications when a proposal is created. Not for anything else...

See below.

@traumschule
Copy link
Collaborator Author

Please retry with latest commits.

@bwhm
Copy link
Member

bwhm commented Dec 5, 2020

Part I Validators/Block Production
This may be related to the config, but I haven't seen any updates on the validators yet. Could also be that it only runs occasionally, so I'll give the 24h

If you reduce heartbeat to 60000 there will be a message every minute.

This did make it show up in the log, like so:

 Blocks produced during 0:01:06h in era 1998: 6
  Average blocktime: 11 s
  Average stake: Infinity M JOY (0 stakers)
  Average number of nominators: 3
  Average number of validators: 10

All numbers looks wrong, and no post was made to telegram...

Part II Announce Storage Providers

* I didn't see anything when I started a Storage Provider that was down. Do I need to setup some environment for this? I won't know for whether stopping reports before ~24 has passed.

Yes, their domains have to be added to storageProviders.ts until we implement automatic discovery (e78fd77).

To make this work, I think you need to have a look at how yarn run helios works.
https://github.com/Joystream/joystream/tree/master/storage-node

* When an SP opening was created/hired, the link and info was
  
  * Opening: `New opening: Storage Provider 7`
  * The `openingId` was 6, and the link was to curators - "*/#/working-groups/opportunities/curators/7"
  * Hired: `member6 was choosen as Storage Provider 7`

Where is the Hired message from?

"Hired" was just to show what the message was for.

  * Again, the `openingId` was 6, and the link was to curators - "*/#/working-groups/opportunities/curators/7"

* When multiple SPs were hired in the same opening, only one of them was included.

Committed ee4c5c8.

This didn't fix the issue.

  • openingId: 8
  • wg application ids: 13,14
  • hired as workers: 9,10
    ->
1gfdsdf was choosen as Storage Provider 11

link: */#/working-groups/opportunities/curators/11

Part III Fix Council & Proposals

* The council _probably_ works fine, although on the chain I'm using for testing, the election round is too high (112,475). It seemed to work when I changed the endpoint to "wss://rome-rpc-endpoint.joystream.org:9944/" though...

* For proposals, I'm only getting notifications when a proposal is created. Not for anything else...

See below.

The council now works until the reveal period ends, when it crashes.
Proposals also crashes.

@bwhm
Copy link
Member

bwhm commented Dec 5, 2020

We chose to give some more time here to iron out the issues, but will have to grade #41 now.

I think this needs a lot more work, and only the storage part is partially working.

Granting $25 on this, and closing the PR.
I will re-open the bounty, so I hope you give it another shot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants