-
Notifications
You must be signed in to change notification settings - Fork 217
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
Get epoch and slot lengths from HFC History Interpreter #2246
Conversation
👌 seems like a good idea |
f16a092
to
e5e9be9
Compare
47b00bc
to
286c403
Compare
, checkpointEpochStability = coerce (gp ^. #getEpochStability) | ||
, checkpointActiveSlotCoeff = | ||
W.unActiveSlotCoefficient (gp ^. #getActiveSlotCoefficient) | ||
, checkpointActiveSlotCoeff = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about renaming the fields with a Unused
suffix so it is a bit more transparent / consistent with other unused fields? It's a bit sad that we can't drop columns in SQLite tables :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK done.
|
||
-- TODO: Query activeSlotCoeff. Where to get it from though? Need to be able | ||
-- to query Globals from ledger. | ||
let getActiveSlotCoeff = pure (ActiveSlotCoefficient 1.0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't really hard-code this value because we use a different value for testing than what's use on the mainnet and testnet networks :/
I'd suggest to keep the active slot coefficient untouched and keep retrieving it from the Shelley genesis. The value for Byron is always known and equal to 1.0
so we could have this function return 1.0
or the shelley value depending on the era we're in?
In the meantime, let's ask if the Globals
can be made available through the LSQ protocol.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the meantime, let's ask if the Globals can be made available through the LSQ protocol.
Think Rodney already asked -> https://input-output-rnd.slack.com/archives/CFKLUH4R0/p1603176743124800, and it looked like they were going to add it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I could add an era switch for hardcoding the mainnet activeSlotCoeff value, or we could wait for it to be implemented in shelley-ledger and cardano-node.
286c403
to
c4b172e
Compare
bors try |
c4b172e
to
cce88a5
Compare
tryBuild failed: Is this a new one?
|
@rvl , no, seen in the past. This property is sometimes failing on rare cases but we haven't investigated the reason yet. The result looks okay everytime, but maybe a |
cce88a5
to
ee24c89
Compare
bors r+ |
👎 Rejected by too few approved reviews |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm! Maybe a comment could be nice about #2246 (comment) if you agree.
Tried locally, on master:
$ cardano-wallet network parameters | jq .
Ok.
{
"slot_length": {
"quantity": 20,
"unit": "second"
},
"decentralization_level": {
"quantity": 48,
"unit": "percent"
},
"epoch_stability": {
"quantity": 2160,
"unit": "block"
},
"genesis_block_hash": "5f20df933584822601f9e3f8c024eb5eb252fe8cefb24d1317dc3d432e940ebb",
"blockchain_start_time": "2017-09-23T21:44:51Z",
"desired_pool_number": 150,
"epoch_length": {
"quantity": 21600,
"unit": "slot"
},
"active_slot_coefficient": {
"quantity": 100,
"unit": "percent"
},
"hardfork_at": {
"epoch_start_time": "2020-07-29T21:44:51Z",
"epoch_number": 208
},
"minimum_utxo_value": {
"quantity": 1000000,
"unit": "lovelace"
}
}
and with this pr:
$ cardano-wallet network parameters | jq .
Ok.
{
"slot_length": {
"quantity": 1,
"unit": "second"
},
"decentralization_level": {
"quantity": 48,
"unit": "percent"
},
"epoch_stability": {
"quantity": 2160,
"unit": "block"
},
"genesis_block_hash": "5f20df933584822601f9e3f8c024eb5eb252fe8cefb24d1317dc3d432e940ebb",
"blockchain_start_time": "2017-09-23T21:44:51Z",
"desired_pool_number": 150,
"epoch_length": {
"quantity": 432000,
"unit": "slot"
},
"active_slot_coefficient": {
"quantity": 100,
"unit": "percent"
},
"hardfork_at": {
"epoch_start_time": "2020-07-29T21:44:51Z",
"epoch_number": 208
},
"minimum_utxo_value": {
"quantity": 1000000,
"unit": "lovelace"
}
}
let (apiNetworkParams, epochNoM) = | ||
toApiNetworkParameters np { protocolParameters = pp } | ||
let pastHorizon :: PastHorizonException -> IO W.SlottingParameters | ||
pastHorizon _ = pure (slottingParameters np) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the unlikely event this happens, I think we should rather do something else than using the genesis slotting parameters. Say the tip is in Shelley of the Byron;Shelley;Allegra
mode, then the genesis slotting params would be misleading, no?
Seems unlikely, and maybe not the most important, but maybe add a comment about it at least?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a comment. It should never happen because we ask the node for slotting parameters of its current tip. That should always be within the horizon. The only time I have seen the PastHorizonException is when the node tip was at genesis.
@@ -1799,8 +1799,11 @@ getNetworkParameters | |||
-> Handler ApiNetworkParameters | |||
getNetworkParameters (_block0, np, _st) nl = do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a thought: Maybe we should call this genesisNp
or something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, good thought.
{ getEpochLength = EpochLength 21600 | ||
, getSlotLength = SlotLength 10 | ||
, getGenesisBlockDate = StartTime (read "2019-11-09 16:43:02 UTC") | ||
, getGenesisBlockHash = Hash "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Divide up network parameters further. Remove slot length and epoch length from genesis parameters, because we will be getting them with HFC queries. Update all slotting parameter usages
ee24c89
to
4a231af
Compare
bors r+ |
Build succeeded: |
Issue Number
#2226
Overview