-
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
Add 'Initial' message-decoder with config parameters #266
The head ref may contain hidden characters: "anviking/218/j\u00F6rmungandr-config"
Conversation
\5e05f5f8e53b87e7ea452f000000000000000e" | ||
genesisHeader | ||
|
||
it "should decode a genesis block" $ 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.
should decode a genesis block header
is now redundant, but I didn't mind the duplication since we would get more information from the test output without looking at the details. Happy to change though.
-- Seconds elapsed since 1-Jan-1970 (unix time) | ||
= Block0Date Word64 | ||
| ConfigDiscrimination Discrimination | ||
| ConsensusVersion Word16 -- ? |
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.
Types here are obviously not that polished
-- 12 most-significant bits: tag | ||
taglen <- getWord16be | ||
let tag = taglen `shift` (-6) | ||
let len = fromIntegral $ taglen .&. (63) -- 0b111111 |
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.
Had this bit-wise logic separate at first, but
TagLen
would be completely uninteresting to the rest of the code- Testing it indirectly through
getConfigParam . putConfigParam
roundtrip should be fine…? 🤔 or we will miss potential edge-cases?
a -> fail $ "Invalid config param with tag " ++ show a | ||
|
||
data Discrimination = Production | Test | ||
deriving (Eq, Show) |
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.
That should basically match the Cardano.Wallet.Environment.Jormungandr
. There's no more protocol magic with Jormungandr but instead, only two levels of discrimination.
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
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
Issue Number
#218
Overview
Initial
message,ConfigParam
and some child typesComments