-
Notifications
You must be signed in to change notification settings - Fork 24
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
Support for addresses with staking keys #103 [obsolete]. #134
Conversation
I haven't added any tests yet. All the tests are left unchanged, that is they are initialized with enterprise addresses (no stake). Some of them rely on running with enterprise address. |
TODO: Update changelog, but once we're settled with interface change |
data TestWallet = TestWallet | ||
{ twInitDistribiution :: [Positive] | ||
, twExpected :: Maybe (ValueOrdering, Value) | ||
, hasStakeKeys :: Bool |
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.
Maybe make separate type for key, like KeyType = Enterprise | WithStakeing
to avoid boolean boolean blindness.
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.
KeyType
probably, AddressType
will be better
[shouldFail] | ||
, -- Tests with wallet's Value assertions | ||
assertExecution | ||
"Pay from wallet to wallet" | ||
(initAda [100] <> initAndAssertAda [100, 13] 123) | ||
(withContract $ \[pkh1] -> payTo pkh1 10_000_000) | ||
(withContract . onEnterpriseWallets $ \[pkh1] -> payTo pkh1 10_000_000) |
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.
Hmm, I'm not sure if onEnterpriseWallets
needed. Maybe just give user
withContract $ \walletInfos :: [WalletInfo] -> ...
as it will be breaking API change anyway?
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.
And probably change payTo
contracts to accept address as 1st argument.
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 was thinking of it only as a helper to quickly adjust existing tests with little effort and not something that should be used in newly written tests. I would leave that in the exports, though as our tests double as examples for documentation, i see that i should actually go through them and update to use new api.
TestWallet (..), | ||
compareValuesWith, | ||
ValueOrdering (..), | ||
WalletInfo (..), |
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 should be careful with exporting constructors, I think.
I see there is smart constructor makeWalletInfo
which builds ownAddress
depending on staking keys presence or absence. If this is invariant of WalletInfo
, then exposing WalletInfo
constructor can allow creation of invalid instates.
(or maybe make ownAddress
function that computes address when it's called, not the filed of ADT)
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.
right, I would hide the constructor
Contract w s e a -> | ||
m () | ||
runContract_ e w c = void $ runContract e w c | ||
|
||
runContract :: | ||
(ToJSON w, Monoid w, MonadIO m) => | ||
ClusterEnv -> | ||
BpiWallet -> | ||
WalletInfo -> |
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.
be4f410
to
a63d2bb
Compare
I reverted this pr to the last green commit and pr'ed latest changes instead to #136. This is because my intention turned out to be impossible to implement ;/ more in that pr. We need to go with some simpler aproaches |
Subsumed by #136 |
addWallets
withStakeKeys
to add stake keys toTestWallets
pcOwnStakePubKeyHash
for BPI.WalletInfo
's to contracts instead ofPubKeyHash
's.onEnterpriseAddresses
helper.withContract
.