Remove use of names from contracts

Remove dependency on name data that cash/obligation state objects will not have access to party details (such as name)
once privacy is correctly enforced.
This commit is contained in:
Ross Nicoll 2017-02-02 10:42:49 +00:00 committed by Chris Rankin
parent 456194ab78
commit e474c4d4ea
4 changed files with 18 additions and 18 deletions

View File

@ -190,7 +190,7 @@ class Obligation<P> : Contract {
"amount in settle command ${command.value.amount} matches settled total $totalAmountSettled" by (command.value.amount == totalAmountSettled) "amount in settle command ${command.value.amount} matches settled total $totalAmountSettled" by (command.value.amount == totalAmountSettled)
"signatures are present from all obligors" by command.signers.containsAll(requiredSigners) "signatures are present from all obligors" by command.signers.containsAll(requiredSigners)
"there are no zero sized inputs" by inputs.none { it.amount.quantity == 0L } "there are no zero sized inputs" by inputs.none { it.amount.quantity == 0L }
"at obligor ${obligor.name} the obligations after settlement balance" by "at obligor ${obligor} the obligations after settlement balance" by
(inputAmount == outputAmount + Amount(totalPenniesSettled, groupingKey)) (inputAmount == outputAmount + Amount(totalPenniesSettled, groupingKey))
} }
return setOf(command.value) return setOf(command.value)

View File

@ -99,7 +99,7 @@ abstract class AbstractConserveAmount<S : FungibleAsset<T>, C : CommandData, T :
requireThat { requireThat {
"there are no zero sized inputs" by inputs.none { it.amount.quantity == 0L } "there are no zero sized inputs" by inputs.none { it.amount.quantity == 0L }
"for reference ${deposit.reference} at issuer ${deposit.party.name} the amounts balance: ${inputAmount.quantity} - ${amountExitingLedger.quantity} != ${outputAmount.quantity}" by "for reference ${deposit.reference} at issuer ${deposit.party} the amounts balance: ${inputAmount.quantity} - ${amountExitingLedger.quantity} != ${outputAmount.quantity}" by
(inputAmount == outputAmount + amountExitingLedger) (inputAmount == outputAmount + amountExitingLedger)
} }

View File

@ -191,7 +191,7 @@ class CashTests {
// Move fails: not allowed to summon money. // Move fails: not allowed to summon money.
tweak { tweak {
command(DUMMY_PUBKEY_1) { Cash.Commands.Move() } command(DUMMY_PUBKEY_1) { Cash.Commands.Move() }
this `fails with` "at issuer MegaCorp the amounts balance" this `fails with` "the amounts balance"
} }
// Issue works. // Issue works.
@ -305,14 +305,14 @@ class CashTests {
transaction { transaction {
input { inState } input { inState }
output { outState `issued by` MINI_CORP } output { outState `issued by` MINI_CORP }
this `fails with` "at issuer MegaCorp the amounts balance" this `fails with` "the amounts balance"
} }
// Can't change deposit reference when splitting. // Can't change deposit reference when splitting.
transaction { transaction {
input { inState } input { inState }
output { outState.copy(amount = inState.amount / 2).editDepositRef(0) } output { outState.copy(amount = inState.amount / 2).editDepositRef(0) }
output { outState.copy(amount = inState.amount / 2).editDepositRef(1) } output { outState.copy(amount = inState.amount / 2).editDepositRef(1) }
this `fails with` "for reference [01] at issuer MegaCorp the amounts balance" this `fails with` "the amounts balance"
} }
// Can't mix currencies. // Can't mix currencies.
transaction { transaction {
@ -338,7 +338,7 @@ class CashTests {
input { inState `issued by` MINI_CORP } input { inState `issued by` MINI_CORP }
output { outState } output { outState }
command(DUMMY_PUBKEY_1) { Cash.Commands.Move() } command(DUMMY_PUBKEY_1) { Cash.Commands.Move() }
this `fails with` "at issuer MiniCorp the amounts balance" this `fails with` "the amounts balance"
} }
// Can't combine two different deposits at the same issuer. // Can't combine two different deposits at the same issuer.
transaction { transaction {
@ -386,10 +386,10 @@ class CashTests {
command(MEGA_CORP_PUBKEY, MINI_CORP_PUBKEY) { Cash.Commands.Move() } command(MEGA_CORP_PUBKEY, MINI_CORP_PUBKEY) { Cash.Commands.Move() }
this `fails with` "at issuer MegaCorp the amounts balance" this `fails with` "the amounts balance"
command(MEGA_CORP_PUBKEY) { Cash.Commands.Exit(200.DOLLARS `issued by` defaultIssuer) } command(MEGA_CORP_PUBKEY) { Cash.Commands.Exit(200.DOLLARS `issued by` defaultIssuer) }
this `fails with` "at issuer MiniCorp the amounts balance" this `fails with` "the amounts balance"
command(MINI_CORP_PUBKEY) { Cash.Commands.Exit(200.DOLLARS `issued by` MINI_CORP.ref(defaultRef)) } command(MINI_CORP_PUBKEY) { Cash.Commands.Exit(200.DOLLARS `issued by` MINI_CORP.ref(defaultRef)) }
this.verifies() this.verifies()
@ -404,7 +404,7 @@ class CashTests {
output { outState.copy(amount = inState.amount - (200.DOLLARS `issued by` defaultIssuer)) } output { outState.copy(amount = inState.amount - (200.DOLLARS `issued by` defaultIssuer)) }
command(MEGA_CORP_PUBKEY) { Cash.Commands.Exit(200.DOLLARS `issued by` defaultIssuer) } command(MEGA_CORP_PUBKEY) { Cash.Commands.Exit(200.DOLLARS `issued by` defaultIssuer) }
command(DUMMY_PUBKEY_1) { Cash.Commands.Move() } command(DUMMY_PUBKEY_1) { Cash.Commands.Move() }
this `fails with` "at issuer MegaCorp the amounts balance" this `fails with` "the amounts balance"
} }
} }
@ -418,13 +418,13 @@ class CashTests {
// Can't merge them together. // Can't merge them together.
tweak { tweak {
output { inState.copy(owner = DUMMY_PUBKEY_2, amount = 2000.DOLLARS `issued by` defaultIssuer) } output { inState.copy(owner = DUMMY_PUBKEY_2, amount = 2000.DOLLARS `issued by` defaultIssuer) }
this `fails with` "at issuer MegaCorp the amounts balance" this `fails with` "the amounts balance"
} }
// Missing MiniCorp deposit // Missing MiniCorp deposit
tweak { tweak {
output { inState.copy(owner = DUMMY_PUBKEY_2) } output { inState.copy(owner = DUMMY_PUBKEY_2) }
output { inState.copy(owner = DUMMY_PUBKEY_2) } output { inState.copy(owner = DUMMY_PUBKEY_2) }
this `fails with` "at issuer MegaCorp the amounts balance" this `fails with` "the amounts balance"
} }
// This works. // This works.

View File

@ -143,7 +143,7 @@ class ObligationTests {
// Move fails: not allowed to summon money. // Move fails: not allowed to summon money.
tweak { tweak {
command(DUMMY_PUBKEY_1) { Obligation.Commands.Move() } command(DUMMY_PUBKEY_1) { Obligation.Commands.Move() }
this `fails with` "for reference [00] at issuer MegaCorp the amounts balance" this `fails with` "the amounts balance"
} }
// Issue works. // Issue works.
@ -609,7 +609,7 @@ class ObligationTests {
transaction { transaction {
input { inState } input { inState }
output { outState `issued by` MINI_CORP } output { outState `issued by` MINI_CORP }
this `fails with` "for reference [00] at issuer MegaCorp the amounts balance" this `fails with` "the amounts balance"
} }
// Can't mix currencies. // Can't mix currencies.
transaction { transaction {
@ -636,7 +636,7 @@ class ObligationTests {
input { inState `issued by` MINI_CORP } input { inState `issued by` MINI_CORP }
output { outState } output { outState }
command(DUMMY_PUBKEY_1) { Obligation.Commands.Move() } command(DUMMY_PUBKEY_1) { Obligation.Commands.Move() }
this `fails with` "for reference [00] at issuer MiniCorp the amounts balance" this `fails with` "the amounts balance"
} }
} }
@ -678,10 +678,10 @@ class ObligationTests {
command(DUMMY_PUBKEY_1) { Obligation.Commands.Move() } command(DUMMY_PUBKEY_1) { Obligation.Commands.Move() }
this `fails with` "for reference [00] at issuer MegaCorp the amounts balance" this `fails with` "the amounts balance"
command(DUMMY_PUBKEY_1) { Obligation.Commands.Exit(Amount(200.DOLLARS.quantity, inState.amount.token.copy(product = megaCorpDollarSettlement))) } command(DUMMY_PUBKEY_1) { Obligation.Commands.Exit(Amount(200.DOLLARS.quantity, inState.amount.token.copy(product = megaCorpDollarSettlement))) }
this `fails with` "for reference [00] at issuer MegaCorp the amounts balance" this `fails with` "the amounts balance"
command(DUMMY_PUBKEY_1) { Obligation.Commands.Exit(Amount(200.POUNDS.quantity, inState.amount.token.copy(product = megaCorpPoundSettlement))) } command(DUMMY_PUBKEY_1) { Obligation.Commands.Exit(Amount(200.POUNDS.quantity, inState.amount.token.copy(product = megaCorpPoundSettlement))) }
this.verifies() this.verifies()
@ -698,13 +698,13 @@ class ObligationTests {
// Can't merge them together. // Can't merge them together.
tweak { tweak {
output { inState.copy(beneficiary = DUMMY_PUBKEY_2, quantity = 200000L) } output { inState.copy(beneficiary = DUMMY_PUBKEY_2, quantity = 200000L) }
this `fails with` "for reference [00] at issuer MegaCorp the amounts balance" this `fails with` "the amounts balance"
} }
// Missing MiniCorp deposit // Missing MiniCorp deposit
tweak { tweak {
output { inState.copy(beneficiary = DUMMY_PUBKEY_2) } output { inState.copy(beneficiary = DUMMY_PUBKEY_2) }
output { inState.copy(beneficiary = DUMMY_PUBKEY_2) } output { inState.copy(beneficiary = DUMMY_PUBKEY_2) }
this `fails with` "for reference [00] at issuer MegaCorp the amounts balance" this `fails with` "the amounts balance"
} }
// This works. // This works.