-
Notifications
You must be signed in to change notification settings - Fork 631
[CO-410] Implement NetworkMagic
logic
#3775
Conversation
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.
Only looked at final commit (1204e85) as per @intricate's instruction. One minor comment.
tools/src/Pos/Tools/Dbgen/Lib.hs
Outdated
@@ -248,16 +249,16 @@ generateWalletDB CLI{..} spec@GenSpec{..} = do | |||
|
|||
case addTo of | |||
Just accId -> | |||
if checkIfAddTo fakeUtxoSpec fakeTxs then | |||
addAddressesTo spec accId | |||
if (checkIfAddTo fakeUtxoSpec fakeTxs) then |
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.
Redundant brackets here.
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.
Thanks!
1204e85
to
39dfb58
Compare
NetworkMagic
logicNetworkMagic
logic
038f8d5
to
fdf3427
Compare
NetworkMagic
logicNetworkMagic
logic
fdf3427
to
24aec7f
Compare
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, but we should probably get one more set of eyes on this.
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
nm <- asks (makeNetworkMagic . ccMagic . tcCardano) | ||
let newRootId = HD.eskToHdRootId nm esk | ||
-- TODO @intricate: Get from TransCtxt or PassiveWallet? | ||
-- nm <- asks (makeNetworkMagic . ccMagic . tcCardano) |
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.
Stale comment?
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.
Oops. Thanks.
0e90771
to
7a38603
Compare
db/src/Pos/DB/Block/Slog/Logic.hs
Outdated
@@ -238,7 +240,8 @@ slogApplyBlocks k (ShouldCallBListener callBListener) blunds = do | |||
-- If the program is interrupted at this point (after putting blunds | |||
-- in BlockDB), we will have garbage blunds in BlockDB, but it's not a | |||
-- problem. | |||
bListenerBatch <- if callBListener then onApplyBlocks fixedNM blunds | |||
let nm = makeNetworkMagic pm |
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.
If the only thing we do with the protocolMagic
value is create a networkMagic
from it, why not accept it directly?
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.
My mistake.
lib/src/Pos/Util/UserSecret.hs
Outdated
instance Buildable WalletUserSecret where | ||
build WalletUserSecret{..} = | ||
bprint ("{ root = "%addressF%", set name = "%build% | ||
", wallets = "%pairsF%", accounts = "%pairsF%" }") | ||
(makeRootPubKeyAddress fixedNM $ encToPublic _wusRootKey) | ||
(makeRootPubKeyAddress NetworkMainOrStage $ encToPublic _wusRootKey) |
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.
Correct me if I am wrong: won't this return a wrong address result for testing networks?
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, you're correct. This slipped my mind as I was supposed to come back and address this. I may need to add a NetworkMagic
field to WalletUserSecret
. However, I wonder if that's a good idea given that this NetworkMagic
field within WalletUserSecret
will never be used in any place other than its Buildable
instance. Will look into either changing the output from build
or adding this field.
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.
Decided to change the Buildable
instance such that the public key is printed instead of the address.
9bacd05
to
e5722ad
Compare
Co-authored-by: Michael Hueschen <[email protected]> Co-authored-by: Jordan Millar <[email protected]>
e5722ad
to
80e3d99
Compare
…ement-networkmagic [CO-410] Implement `NetworkMagic` logic
…hk/i+j/develop/CO-410/implement-networkmagic [CO-410] Implement `NetworkMagic` logic
Description
We pipe the full NetworkMagic to the "frontier" outlined above. This means bridging the gap from where we have ProtocolMagic to where we need NetworkMagic (and had
RequiresNoMagic
hardcoded).Since PR #3756 splits the test-suites, we see most of the changes in this PR are to source-code files.
Linked issue
https://iohk.myjetbrains.com/youtrack/issue/CO-410
Type of change
^ this PR adds the capability for differently formatted
Address
es, which include aNetworkMagic
value. Thus it is a breaking change for testnets (NetworkTestnet
), but backwards compatible for mainnet/staging (NetworkMainOrStage
).Developer checklist
^ there is no 1.3.1 section in the CHANGELOG, and this is dev work on a release branch, so I'm skipping this.
Testing checklist
^ tests we added/modified in [CO-410] Split test-suites for NetworkMainOrStage/NetworkTestnet #3756 - we are relying on those.