-
Notifications
You must be signed in to change notification settings - Fork 219
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
fix(cosmic-swingset): Publish installation success and failure topic #5541
Conversation
def73a3
to
713b472
Compare
We got publishing to work, huzzah. |
a3290d9
to
560af97
Compare
* @param {StorageNode} [storageNode] | ||
*/ | ||
const makeStoredPublisher = (initialValue, storageNode) => { | ||
let providedPublication; |
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.
Is there a reason not to initialize more fully up front? Setting up the dependencies should be inexpensive... is it instead a case of chainStorage writes happening too soon (and if so, is that fixed by switching to makeEmptyPublishKit()
, which has no initial value)?
let providedPublication; | |
const { publication, subscription } = makeSubscriptionKit(initialValue); | |
makeStoredSubscription(subscription, storageNode); | |
return { publish: publication.updateState }; |
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.
In #6103, I made casting more resilient to uninitialized storage, but at this height of the PR stack, the {coming: 'soon'}
value substantially greases the wheels.
560af97
to
c7f4730
Compare
908cedc
to
002b652
Compare
002b652
to
3edb6ab
Compare
a4f15ea
to
806f41c
Compare
3edb6ab
to
061f702
Compare
806f41c
to
e2ec5ff
Compare
061f702
to
9d7d352
Compare
e2ec5ff
to
b6aa71d
Compare
9d7d352
to
169ea3f
Compare
b6aa71d
to
3085c84
Compare
169ea3f
to
2db6122
Compare
3085c84
to
f925894
Compare
2db6122
to
152b695
Compare
f925894
to
260cd69
Compare
152b695
to
67e9a7d
Compare
260cd69
to
2df40ac
Compare
67e9a7d
to
9a77b11
Compare
2df40ac
to
3ea06d4
Compare
e752371
to
44049b3
Compare
2d79d2b
to
2dd252e
Compare
44049b3
to
908f723
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.
Looks good after a few tweaks; let me know if you think anything needs discussion.
packages/agoric-cli/src/publish.js
Outdated
@@ -146,27 +174,42 @@ export const makeHttpBundlePublisher = ({ jsonHttpCall, getAccessToken }) => { | |||
return publishBundleHttp; | |||
}; | |||
|
|||
/** | |||
* @param {string} address - a host or URL |
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.
* @param {string} address - a host or URL | |
* @param {string} address - a domain name, IPv4 address, or URL | |
* @returns {string} the corresponding URL, defaulting scheme to http |
Note that the current implementation will not work for IPv6 addresses because those must be wrapped in square brackets to be used as URL hosts (e.g., http://[2001:db8::1]/
rather than http://2001:db8::1/
): https://www.rfc-editor.org/rfc/rfc3986#section-3.2.2
This also seems like the kind of thing that should really be written once [per language and cross-referenced] and exposed in a library, but I don't consider that a blocking concern for this PR.
For the record, the other places I see similar code:
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.
Agreed wrt consolidating the implementations. It was not trivial to discover the prevailing idiom for this.
packages/agoric-cli/src/publish.js
Outdated
/** | ||
* @template T | ||
* @param {Array<T>} array | ||
* @param {number} randomNumber |
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.
* @param {number} randomNumber | |
* @param {number} randomNumber expected to be in [0, 1) |
const { publisher, subscriber } = makePublishKit(); | ||
makeStoredSubscriber(subscriber, installationStorageNode, marshaller); | ||
installationPublisher = publisher; | ||
publisher.publish({ coming: 'soon' }); |
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.
publisher.publish({ coming: 'soon' }); | |
// Publish an inconsequential initial value. | |
publisher.publish({ coming: 'soon' }); |
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.
This may not be necessary after #6103 and I’ll make a note.
2dd252e
to
2cc0eec
Compare
Ready for another round, pending CI. Follow-up commits not yet squashed and individually reviewable. |
9d0dd23
to
46713d2
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 after updating golang/cosmos/x/swingset/keeper/keeper.go .
@@ -9,4 +9,5 @@ export const ACTIVITYHASH = 'activityhash'; | |||
export const BEANSOWING = 'beansOwing'; | |||
export const EGRESS = 'egress'; | |||
export const MAILBOX = 'mailbox'; | |||
export const BUNDLES = 'bundles'; |
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.
Please also add an analogous constant to golang/cosmos/x/swingset/keeper/keeper.go to preserve synchronization as noted in the introductory comment.
46713d2
to
09f4c4d
Compare
fd2f783
to
29901be
Compare
29901be
to
02ac897
Compare
02ac897
to
9ce8ab3
Compare
closes: #5460
Description
Deploy scripts can now publish bundles directly to the chain. Currently, they receive no feedback as to whether the message was adopted into the chain, much less dequeued and successfully processed. This change will create an on-chain publication that the off-chain deploy script can subscribe to, to learn of the fate of their attempted installation. The deploy script machinery will then watch for success, failure, or timeout. If the installation times out, it will retry.
Security Considerations
Documentation Considerations
Testing Considerations
For manual verification, in
dapp-fungible-faucet
: