Skip to content

Implement /api/derive/session/progress call#35

Closed
aspekt112 wants to merge 19 commits into
SimplyStaking:masterfrom
p2p-org:master
Closed

Implement /api/derive/session/progress call#35
aspekt112 wants to merge 19 commits into
SimplyStaking:masterfrom
p2p-org:master

Conversation

@aspekt112

Copy link
Copy Markdown

This API call allow us to obtain much more info about current session and era:

/api/derive/session/progress
{"result":{"activeEra":"0x00000a29","activeEraStart":1628594874004,"currentEra":"0x00000a29","currentIndex":"0x00003a35","validatorCount":"0x00000384","eraLength":"0x00000e10","isEpoch":true,"sessionLength":"0x0000000000000258","sessionsPerEra":"0x00000006","eraProgress":"0x000007fb","sessionProgress":"0x000000f3"}}

@dillu24

dillu24 commented Aug 23, 2021

Copy link
Copy Markdown
Collaborator

Hi @aspekt112 , thanks a lot for your contribution! We will give it a look hopefully soon.

@aspekt112

Copy link
Copy Markdown
Author

@dillu24 Hello! How soon can you review these changes?

@dillu24

dillu24 commented Aug 31, 2021

Copy link
Copy Markdown
Collaborator

Later this week hopefully

@dillu24

dillu24 commented Sep 7, 2021

Copy link
Copy Markdown
Collaborator

@aspekt112 - Sorry for the delay, will start reviewing now.

@dillu24 dillu24 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Good Work! Require only few minor changes:

  1. Change the endpoint description as described in one of the threads.
  2. Add the following entry to doc/CHANGELOG.md's Unreleased Section:
  • Added session/progress. This returns information about the current session.
  1. Since you have already pulled from base's code, we will wait for PR #36 to be merged to our repo due to some requested changes. Once #36 is merged, please pull from master to have the latest code-base, and push to your branch.

Comment thread doc/DESIGN_AND_FEATURES.md Outdated
| `/api/custom/getSlashAmount` | `websocket`, `account_address` | `block_hash` | The `balance slashed` (if any) of the specified `account address` in the specified `block hash`, or in the latest block if the block hash is not specified |
| **Derive** | | | |
| `/api/derive/staking/validators` | `websocket` | None | `nextElected` - List of `validators` which will be active in the `next session` and `validators` - List of `validators` which are currently active |
| `/api/derive/session/progress` | `websocket` | None | retrieves all the `session` and `era` query and calculates specific values on it as the length of the session and eras |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Change the description to Retrieves information about the current session

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Also, same as my other comment, kindly put this above /api/derive/staking/validators

@DanielMagro97 DanielMagro97 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Just a few minor comments for rewording and reordering of functions

Comment thread demos/api_demo.py Outdated
params={'websocket': websocket})
print(r.text)

print('/api/derive/session/progress')

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Kindly move this before /api/derive/staking/validators, to keep things in alphabetical order

Comment thread doc/DESIGN_AND_FEATURES.md Outdated
| `/api/custom/getSlashAmount` | `websocket`, `account_address` | `block_hash` | The `balance slashed` (if any) of the specified `account address` in the specified `block hash`, or in the latest block if the block hash is not specified |
| **Derive** | | | |
| `/api/derive/staking/validators` | `websocket` | None | `nextElected` - List of `validators` which will be active in the `next session` and `validators` - List of `validators` which are currently active |
| `/api/derive/session/progress` | `websocket` | None | retrieves all the `session` and `era` query and calculates specific values on it as the length of the session and eras |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Also, same as my other comment, kindly put this above /api/derive/staking/validators

Comment thread doc/DESIGN_AND_FEATURES.md Outdated
| `/api/query/staking/payee` | `websocket`, `account_id` | None | Reward destination address assigned to the stash with the specified `account_id`. Returns json with different keys depending on the type of reward destination: `staked: null` - when reward destination is a stash, `controller: addr` - when reward destination is a controller, and `result: addr` when reward destination is any other address. |
| `/api/query/staking/unappliedSlashes` | `websocket` | `era_index` | List of slashed validators (unapplied) in the specified era, or the current era if an era index is not specified. |
| `/api/query/staking/validators` | `websocket`, `account_id` | Preferences of the validator whose stash is the specified `account_id` (validator commission and blocked status). |
| `/api/query/system/account` | `websocket`, `account_id` | None | The full account information for a particular account ID |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The full account information for the specified account_id

Comment thread src/interface/substrate_derive.js Outdated
);
}

// Session

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Same as before, kindly put Session before Staking

Comment thread src/interface/substrate_derive.js Outdated
} catch (e) {
return {'error': e.toString()};
}
// Session

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Same here

Comment thread src/server.js Outdated
}
});

// Session

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Again kindly put this before the Derive Staking one to preserve the alphabetical order

@aspekt112

Copy link
Copy Markdown
Author

@dillu24 @DanielMagro97 can you review fixes?

@dillu24

dillu24 commented Sep 29, 2021

Copy link
Copy Markdown
Collaborator

@aspekt112 - Sorry for the delay, we will be reviewing this week for sure.

@aspekt112

Copy link
Copy Markdown
Author

@dillu24 @DanielMagro97 Please review another commit. Last runtime upgrade made major API changes

@dillu24

dillu24 commented Oct 13, 2021

Copy link
Copy Markdown
Collaborator

@aspekt112 .. Waiting for #36 to be merged. Once it is merged please merge from master into this branch so that the latest changes are reflected.

@aspekt112 aspekt112 closed this Feb 27, 2023
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.

4 participants