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

Report live value of d parameter in decentralizationLevel. #1693

Closed
14 tasks done
jonathanknowles opened this issue May 27, 2020 · 2 comments
Closed
14 tasks done

Report live value of d parameter in decentralizationLevel. #1693

jonathanknowles opened this issue May 27, 2020 · 2 comments
Assignees

Comments

@jonathanknowles
Copy link
Member

jonathanknowles commented May 27, 2020

Context

Task #1692 will have added a skeletal decentralizationLevel parameter to the ApiNetworkParameters object.

Decision

Adjust the code so that this parameter reflects the true value of the d parameter, as reported by the network.

Acceptance Criteria

  • The GetNetworkParameters API endpoint must return a decentralization level percentage that reflects the true value of the d parameter, as reported by the network.

Development

QA

@jonathanknowles jonathanknowles changed the title Report live value of k parameter in decentralizationLevel. Report live value of d parameter in decentralizationLevel. May 28, 2020
@jonathanknowles
Copy link
Member Author

@rvl wrote:

I suspect that you will hook in to the same place that TxParameters are updated (fromPParams), and possibly rename/embed TxParameters to something more general.

iohk-bors bot added a commit that referenced this issue May 28, 2020
1699: Add skeletal `decentralizationLevel` field. r=jonathanknowles a=jonathanknowles

# Issue Number

#1692 

# Overview

This PR:

- [x] Adds a skeletal `decentralizationLevel` field to `ApiNetworkParameters`.
- [x] Adds a corresponding entry in the Swagger API specification.
- [x] Arranges that the value of `decentralizationLevel` is initially hard-wired to **0%**.
- [x] Adds a simple integration test to verify that the API really does return **0%** for the value of `decentralizationLevel`.

In a future PR, we will update this code to report the live value. (See issue #1693.)

Co-authored-by: Jonathan Knowles <[email protected]>
@jonathanknowles jonathanknowles self-assigned this May 29, 2020
iohk-bors bot added a commit that referenced this issue Jun 2, 2020
1700: WIP: Introduce `ProtocolParameters` type. r=jonathanknowles a=jonathanknowles

# Related Issue

#1693 

# Overview

This PR prepares the ground for reporting the live value of the **_d_** protocol parameter.

We introduce the following type to hold **protocol parameters**:

```hs
data ProtocolParameters = ProtocolParameters  
    { decentralizationLevel
        :: Quantity "percent" Percentage      
    , txParameters
        :: TxParameters       
    }
```

Using the above type, we can rewrite the following type:

```diff
- data GenesisBlockParameters = GenesisBlockParameters
-     { staticParameters :: BlockchainParameters
-     ,     txParameters ::         TxParameters
-     }
+ data NetworkParameters = NetworkParameters
+     {  genesisParameters ::  GenesisParameters
+     , protocolParameters :: ProtocolParameters
+     }
```

Finally, we change the type of `toApiNetworkParameters` to:
```diff
- toApiNetworkParameters :: BlockchainParameters -> ApiNetworkParameters
+ toApiNetworkParameters ::    NetworkParameters -> ApiNetworkParameters
```

## Outstanding Work

- [x] Ensure that related functions and values are named consistently.


Co-authored-by: Jonathan Knowles <[email protected]>
iohk-bors bot added a commit that referenced this issue Jun 2, 2020
1700: Introduce `ProtocolParameters` type. r=jonathanknowles a=jonathanknowles

# Related Issue

#1693 

# Overview

This PR prepares the ground for reporting the live value of the **_d_** protocol parameter.

We introduce the following type to hold **protocol parameters**:

```hs
data ProtocolParameters = ProtocolParameters  
    { decentralizationLevel
        :: Quantity "percent" Percentage      
    , txParameters
        :: TxParameters       
    }
```

Using the above type, we can rewrite the following type:

```diff
- data GenesisBlockParameters = GenesisBlockParameters
-     { staticParameters :: BlockchainParameters
-     ,     txParameters ::         TxParameters
-     }
+ data NetworkParameters = NetworkParameters
+     {  genesisParameters ::  GenesisParameters
+     , protocolParameters :: ProtocolParameters
+     }
```

Finally, we change the type of `toApiNetworkParameters` to:
```diff
- toApiNetworkParameters :: BlockchainParameters -> ApiNetworkParameters
+ toApiNetworkParameters ::    NetworkParameters -> ApiNetworkParameters
```

## Outstanding Work

- [x] Ensure that related functions and values are named consistently.


Co-authored-by: Jonathan Knowles <[email protected]>
iohk-bors bot added a commit that referenced this issue Jun 3, 2020
1715: Revise documentation for `NetworkParameters` and related types. r=jonathanknowles a=jonathanknowles

# Related Issues

#1693 

# Overview

PR #1700 changed the way that network parameters are defined.

This PR revises and adds documentation for the following types:

- [x] `NetworkParameters`
- [x] `GenesisParameters`
- [x] `ProtocolParameters`
- [x] `TxParameters`

Co-authored-by: Jonathan Knowles <[email protected]>
iohk-bors bot added a commit that referenced this issue Jun 3, 2020
1715: Revise documentation for `NetworkParameters` and related types. r=jonathanknowles a=jonathanknowles

# Related Issues

#1693 

# Overview

PR #1700 changed the way that network parameters are defined.

This PR revises and adds documentation for the following types:

- [x] `NetworkParameters`
- [x] `GenesisParameters`
- [x] `ProtocolParameters`
- [x] `TxParameters`

Co-authored-by: Jonathan Knowles <[email protected]>
iohk-bors bot added a commit that referenced this issue Jun 3, 2020
1715: Revise documentation for `NetworkParameters` and related types. r=jonathanknowles a=jonathanknowles

# Related Issues

#1693 

# Overview

PR #1700 changed the way that network parameters are defined.

This PR revises and adds documentation for the following types:

- [x] `NetworkParameters`
- [x] `GenesisParameters`
- [x] `ProtocolParameters`
- [x] `TxParameters`

Co-authored-by: Jonathan Knowles <[email protected]>
iohk-bors bot added a commit that referenced this issue Jun 5, 2020
1725: Report live value of decentralization parameter d. r=jonathanknowles a=jonathanknowles

# Issue Number

#1693 

# Overview

This PR:

- [x] Introduces the `DecentralizationLevel` type.

    This type is based on the `Percentage` type.

    _Greater_ values indicate _greater_ levels of decentralization, as follows:

    | Value | Meaning |
    | --: | :-- |
    | 0% | Network is completely _federalized_ |
    | 100% | Network is completely _decentralized_ |

- [x] Adjusts the **wallet API server** to convert from `DecentralizationLevel` to `Quantity "percent" Percentage`.

- [x] Adjusts the **wallet layer** to store a value of type `ProtocolParameters` instead of `TxParameters`. (Note that `ProtocolParameters` _includes_ `TxParameters`.)

- [x] Adjusts the **network layer** to provide a `getProtocolParameters` function instead of `getTxParameters`.

- [x] Adjusts the **database layer** to use a `protocol_parameters` table instead of a `tx_parameters` table. (Note that `protocol_parameters` is a superset of `tx_parameters`.)

- [x] Adjusts the **chain-following code** to extract the live value of `d`, in the same way as we already do for transaction-related protocol parameters.

- [x] Adds a **conversion function** to convert from `d` parameter values to values of type `DecentralizationLevel`.

    This function performs the following mapping:
        {1 → 0%, 0.9 → 10%, 0.8 → 20%, ..., 0.1 → 90%, 0 → 100%}

# Future Work

In a future PR, we can add a manual migration step that removes the `tx_parameters` table.


Co-authored-by: Jonathan Knowles <[email protected]>
iohk-bors bot added a commit that referenced this issue Jun 12, 2020
1736: Add unit test to check updates of decentralizationLevel r=KtorZ a=rvl

### Issue Number

#1693 can be moved to "QA" column once this is merged.

### Overview

- Enhances the "unit test" to check that protocol parameters can be updated to include decentralization level.
- Removes "todo" comment from `NETWORK_PARAMS - Able to fetch network parameters` integration test case. The `decentralisationParam` in the shelley integration test genesis is 1.0 ⇒ 0% decentralised.


Co-authored-by: Rodney Lorrimar <[email protected]>
Co-authored-by: KtorZ <[email protected]>
iohk-bors bot added a commit that referenced this issue Jun 12, 2020
1736: Add unit test to check updates of decentralizationLevel r=rvl a=rvl

### Issue Number

#1693 can be moved to "QA" column once this is merged.

### Overview

- Enhances the "unit test" to check that protocol parameters can be updated to include decentralization level.
- Removes "todo" comment from `NETWORK_PARAMS - Able to fetch network parameters` integration test case. The `decentralisationParam` in the shelley integration test genesis is 1.0 ⇒ 0% decentralised.


1738: Parameterise `StakePools` API over apiPool type r=Anviking a=Anviking

# Issue Number

ADP-311, #1718 


# Overview

<!-- Detail in a few bullet points the work accomplished in this PR -->

- [x] I parameterised `StakePools` API over `apiPool`
- [x] I renamed `ApiStakePool` to `ApiJormungandrStakePool`, such that we can later introduce a haskell `ApiStakePool`
- [x] I made the default `Api` type use `ApiJormungandrStakePool`. We should later switch to `ApiStakePool`, and update the swagger scheme such that it targets haskell, and not jormungandr.
- [x] I moved `StakePoolLayer` to the jormungandr package.

# Comments

- I am keeping the Pool DB in core, since I think we still want it. But I have not thought about how it would work with shelley.
- changelog: this is pure refactoring, but in combination with follow-up PRs this is a new feature.

<!-- Additional comments or screenshots to attach if any -->

<!-- 
Don't forget to:

 ✓ Self-review your changes to make sure nothing unexpected slipped through
 ✓ Assign yourself to the PR
 ✓ Assign one or several reviewer(s)
 ✓ Once created, link this PR to its corresponding ticket
 ✓ Assign the PR to a corresponding milestone
 ✓ Acknowledge any changes required to the Wiki
-->


1747: Delegation fee shelley r=paweljakubas a=paweljakubas

# Issue Number

<!-- Put here a reference to the issue this PR relates to and which requirements it tackles -->
#1709 

# Overview

<!-- Detail in a few bullet points the work accomplished in this PR -->

- [x] I have enabled delegation fee in Shelley server
- [x] I have ported integration tests from jormungandr
- [x] I have adjusted feeMin

# Comments

<!-- Additional comments or screenshots to attach if any -->


<!-- 
Don't forget to:

 ✓ Self-review your changes to make sure nothing unexpected slipped through
 ✓ Assign yourself to the PR
 ✓ Assign one or several reviewer(s)
 ✓ Once created, link this PR to its corresponding ticket
 ✓ Assign the PR to a corresponding milestone
 ✓ Acknowledge any changes required to the Wiki
-->


Co-authored-by: Rodney Lorrimar <[email protected]>
Co-authored-by: KtorZ <[email protected]>
Co-authored-by: Johannes Lund <[email protected]>
Co-authored-by: Pawel Jakubas <[email protected]>
@piotr-iohk
Copy link
Contributor

lgtm.

iohk-bors bot added a commit that referenced this issue Jun 16, 2020
1760: Server: Use the network layer to get protocol parameters r=rvl a=rvl

### Issue Number

ADP-244 / #1693

### Overview

The API server was previously getting all network parameters from the genesis block. This change makes it use the network layer to get the latest protocol parameters.

### Comments

An integration test for this is going to be hairy.


Co-authored-by: Rodney Lorrimar <[email protected]>
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

No branches or pull requests

2 participants