-
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
6044 wallet voting #6077
6044 wallet voting #6077
Changes from 3 commits
67125c1
2ee574e
78e98de
f99ae74
cfc2341
f28f464
2b97dd7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -116,6 +116,11 @@ const initSlotVal = (table, slot, val) => { | |
*/ | ||
export const makeExportContext = () => { | ||
const walletObjects = { | ||
/** @type {IdTable<number, unknown>} */ | ||
offerResult: { | ||
bySlot: makeScalarMap(), | ||
byVal: makeScalarMap(), | ||
}, | ||
/** @type {IdTable<number, Purse>} */ | ||
purse: { | ||
bySlot: makeScalarMap(), | ||
|
@@ -187,6 +192,8 @@ export const makeExportContext = () => { | |
* @param {IdTable<number, V>} table | ||
*/ | ||
const makeSaver = (kind, table) => { | ||
// XXX table passed in to simplify type inference | ||
assert.equal(table, walletObjects[kind]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good idea. |
||
let nonce = 0; | ||
/** @param {V} val */ | ||
const saver = val => { | ||
|
@@ -197,6 +204,7 @@ export const makeExportContext = () => { | |
}; | ||
|
||
return harden({ | ||
saveOfferResultActions: makeSaver('offerResult', walletObjects.offerResult), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah. I opted for consistency with the others, but I don't understand why "Actions" is part of any of them. Cool to remove from all? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think so. @michaelfig ? are the other 2 used? @samsiegart ? |
||
savePurseActions: makeSaver('purse', walletObjects.purse), | ||
savePaymentActions: makeSaver('payment', walletObjects.payment), | ||
/** | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,7 +50,7 @@ const makeOnChainWallet = board => { | |
}); | ||
}; | ||
|
||
test('makeImportContext preserves identity across AMM and wallet', t => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we still want a test that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Happy to revert. I thought I was executing your suggestion in #5883 (comment) Or are you suggesting to keep this change and add something like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oops... that "better phrasing" suggestion wasn't all that clear; it was about the |
||
test('contract cannot forge references to purses', t => { | ||
const context = makeImportContext(); | ||
|
||
const board = makeBoard(0, { prefix: 'board' }); | ||
|
@@ -118,7 +118,7 @@ test('ensureBoardId allows re-registration; initBoardId does not', t => { | |
t.throws(() => context.initBoardId('board12', brandM)); | ||
}); | ||
|
||
test('makeExportContext.serialize handles unregistered identites', t => { | ||
test('makeExportContext.serialize handles unregistered identities', t => { | ||
const brand = Far('Zoe invitation brand', {}); | ||
const instance = Far('amm instance', {}); | ||
const invitationAmount = harden({ brand, value: [{ instance }] }); | ||
|
@@ -163,4 +163,19 @@ test('makeExportContext.serialize handles unregistered identites', t => { | |
slots: ['payment:1'], | ||
}); | ||
t.deepEqual(context.unserialize(cap2), myPayment); | ||
|
||
{ | ||
const val = Far('someOfferResult', {}); | ||
context.saveOfferResultActions(val); | ||
const cap = context.serialize(val); | ||
t.deepEqual(cap, { | ||
body: JSON.stringify({ | ||
'@qclass': 'slot', | ||
iface: 'Alleged: someOfferResult', | ||
index: 0, | ||
}), | ||
slots: ['offerResult:1'], | ||
}); | ||
t.deepEqual(context.unserialize(cap), val); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's important that |
||
} | ||
}); |
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.
@Chris-Hibbert I just realized that in order for committee members to be able to put questions as well, the "charter" contract should be a different shape:
Our design for raising debt limits involved using a method on a public facet, which assumed users had access to
zoe
andE(zoe).getPublicFacet()
.https://github.com/Agoric/inter-protocol-bootstrap/blob/56de1ed1821e19828a6f74ff10b7fce27b3f2cb7/vote-raise-debt-limit.js#L177
I think life will be simpler if the new charter contract you're building uses methods on an offer result instead of methods on a public facet.
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.
There isn't a task corresponding to that description on my radar. Can we make an issue?
I presume we want a variant of econCommitteeCharter that serves PSM only. If the capability to invoke votes is carried by an offer result, should the various committee members each invoke a separate invitation, or is an invitation exercised once in bootstrap, and the offer result handed out from there?
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, we can; I more or less expected that was part of "Do The Right Thing" that you said what you had what you need for. The capability to vote is taken care of by the committee contract. My concern here is for posing questions. You're right that this raises a question of how the invitations get to the committee members. I suppose we can use the same mechanism as we did for the voting invitations, but it's worth some thought / discussion.