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

Introduce k parameter #1827

Merged
merged 9 commits into from
Jul 2, 2020
Merged

Conversation

paweljakubas
Copy link
Contributor

@paweljakubas paweljakubas commented Jun 29, 2020

Issue Number

#1822

Overview

  • I have extended ApiNetworkParameters for desired number of pools. This is optional as it does not make sense for byron, it is unknown in jormungandr
  • I have made the changes in swagger
  • I have updated unit tests in core, especially made a change to Arbitrary for ApiNetworkParameters to allow Word16.
  • I have added 0 to byron and used max value of participation capping in jormungandr
  • I have added impl in shelley using ledger accessors
  • I have updated all other places in the code to account for this change
  • I have extended integration network test for shelley and see that desired number of pools is 3.

Comments

@paweljakubas
Copy link
Contributor Author

bors try

iohk-bors bot added a commit that referenced this pull request Jun 29, 2020
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jun 29, 2020

protocolParametersFeePolicy W.FeePolicy sql=fee_policy
protocolParametersTxMaxSize Word16 sql=tx_max_size
protocolParametersDecentralizationLevel Percentage sql=decentralization_level
protocolParametersDesiredNumberOfPools Word16 Maybe sql=desired_pool_number
Copy link
Member

Choose a reason for hiding this comment

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

Why is this a Maybe 🤔 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I looked at PParams in ledger for byron - there is no such a thing. So it does not make sense to talk about it (of course there is no staking for byron). So I thought Nothing there make sense. For jormungandr there is no such thing exposed so also set Nothing (although it is sensible as stake pools are there). For shelley we have this parameter in ledger nOpt and we can query the desired number of stake pool (which is 100 btw)

Copy link
Member

Choose a reason for hiding this comment

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

There's pool_participation_capping for Jörmungandr, which has the same meaning. For Byron, we could default to 0 here, I think it'll be less misleading than having to carry a Maybe around for Shelley :/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, will use Word16 instead of Maybe Word16 with 0 for Byron

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done in 3957dbc (also used pool participation capping max value for jormunagndr)

@paweljakubas paweljakubas force-pushed the paweljakubas/1822/introduce-k-parameter branch from d231dfb to c3d24aa Compare June 30, 2020 11:42
@paweljakubas paweljakubas requested a review from KtorZ June 30, 2020 11:44
@paweljakubas
Copy link
Contributor Author

bors try

iohk-bors bot added a commit that referenced this pull request Jun 30, 2020
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jun 30, 2020

try

Build failed

@KtorZ KtorZ added the ADDING FEATURE Mark a PR as adding a new feature, for auto-generated CHANGELOG label Jun 30, 2020
@paweljakubas
Copy link
Contributor Author

paweljakubas commented Jun 30, 2020

error not related to this PR to my best knowledge:

Left (DecodeFailure "Error in $: parsing Cardano.Wallet.Api.Types.ApiTransaction(ApiTransaction) failed, key \"id\" not found: Response {responseStatus = Status {statusCode = 404, statusMessage = \"Not Found\"}, responseVersion = HTTP/1.1, responseHeaders = [(\"Transfer-Encoding\",\"chunked\"),(\"Date\",\"Tue, 30 Jun 2020 12:09:51 GMT\"),(\"Server\",\"Warp/3.3.5\")], responseBody = \"{\\\"code\\\":\\\"no_such_pool\\\",\\\"message\\\":\\\"I couldn't find any stake pool with the given id: 1b3dc19c6ab89eaffc8501f375bb03c11bf8ed5d183736b1d80413d6\\\"}\", responseCookieJar = CJ {expose = []}, responseClose' = ResponseClose}")
--

@rvl
Copy link
Contributor

rvl commented Jul 1, 2020

@paweljakubas yes - that test failure is due to #1831.

@paweljakubas paweljakubas force-pushed the paweljakubas/1822/introduce-k-parameter branch from c3d24aa to af7fc9c Compare July 1, 2020 12:13
@@ -1409,6 +1413,7 @@ instance Buildable ProtocolParameters where
build pp = blockListF' "" id
[ "Decentralization level: " <> build (pp ^. #decentralizationLevel)
, "Transaction parameters: " <> build (pp ^. #txParameters)
, "K parameter: " <> build (pp ^. #desiredNumberOfStakePools)
Copy link
Member

Choose a reason for hiding this comment

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

I'd actually go for "desired number of pools" here too. A bit clearer since there are at least 3 things called k in the shelley specs ^^"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done in 499d4eb

@paweljakubas
Copy link
Contributor Author

bors r+

iohk-bors bot added a commit that referenced this pull request Jul 2, 2020
1827: Introduce k parameter r=paweljakubas a=paweljakubas

# Issue Number

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

# Overview

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

- [x] I have extended ApiNetworkParameters for desired number of pools. This is optional as it does not make sense for byron, it is unknown in jormungandr 
- [x] I have made the changes in swagger
- [x] I have updated unit tests in core, especially made a change to Arbitrary for ApiNetworkParameters to allow Word16. 
- [x] I have added 0 to byron and used max value of participation capping in jormungandr
- [x] I have added impl in shelley using ledger accessors
- [x] I have updated all other places in the code to account for this change 
- [x] I have extended integration network test for shelley and see that desired number of pools is 3.


# 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: Pawel Jakubas <[email protected]>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jul 2, 2020

Build failed

@paweljakubas
Copy link
Contributor Author

bors retry

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jul 2, 2020

@iohk-bors iohk-bors bot merged commit 6918c67 into master Jul 2, 2020
@iohk-bors iohk-bors bot deleted the paweljakubas/1822/introduce-k-parameter branch July 2, 2020 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ADDING FEATURE Mark a PR as adding a new feature, for auto-generated CHANGELOG
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants