Skip to content
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

Wallet UI working with new Smart Wallet contract #6134

Merged
merged 17 commits into from
Sep 15, 2022
Merged

Conversation

turadg
Copy link
Member

@turadg turadg commented Sep 4, 2022

closes (almost): #6127 (leave open until Product verifies)

Stacked on,

Description

Wallet UI has a WalletBackendAdapter for how the UI queries RPC nodes for data. That messaging system has changed with the new smart wallet and at least the adapter needs to be revised to match it.

Further changes may be warranted or necessary.

Security Considerations

Documentation Considerations

Testing Considerations

@turadg turadg force-pushed the ta/split-smartwallet branch 6 times, most recently from 9b85ce3 to 708972f Compare September 7, 2022 20:00
@turadg turadg force-pushed the 6127-psm-new-wallet branch from ab040e8 to 494c540 Compare September 7, 2022 20:05
Base automatically changed from ta/split-smartwallet to master September 7, 2022 21:12
@michaelfig michaelfig force-pushed the 6127-psm-new-wallet branch 2 times, most recently from 70ab19a to 6d73875 Compare September 12, 2022 23:17
@michaelfig michaelfig self-assigned this Sep 12, 2022
packages/wallet/api/src/marshal-contexts.js Show resolved Hide resolved
packages/wallet/ui/src/components/Proposal.jsx Outdated Show resolved Hide resolved
packages/wallet/ui/src/util/WalletBackendAdapter.js Outdated Show resolved Hide resolved
packages/wallet/ui/src/util/WalletBackendAdapter.js Outdated Show resolved Hide resolved
/** @type {number} */
let firstHeight;
for await (const { blockHeight } of iterateReverse(follower)) {
// TODO: Only set firstHeight and break if the value contains all our state.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do we tell when we get to a snapshot block?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They don't exist yet, which is why we only have this comment to describe what the code should eventually do.

@michaelfig michaelfig marked this pull request as ready for review September 14, 2022 02:04
@michaelfig michaelfig added the automerge:no-update (expert!) Automatically merge without updates label Sep 14, 2022
Copy link
Member

@dckc dckc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked at it by commit; the code looks fine, but I haven't tested that it works.

@samsiegart samsiegart self-requested a review September 14, 2022 03:16
Copy link
Contributor

@samsiegart samsiegart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@@ -122,6 +122,7 @@ scenario2-setup-nobuild:
$(AGCH) --home=t1/bootstrap keys add bootstrap --keyring-backend=test
$(AGCH) --home=t1/bootstrap keys show -a bootstrap --keyring-backend=test > t1/bootstrap-address
$(AGCH) --home=t1/n0 add-genesis-account `cat t1/bootstrap-address` $(BOOT_COINS)
# Create
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

???



# Send some USDC to the vbank/provision module account where it can be traded for IST.
fund-provision-pool: wait-for-cosmos
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 ty

idea: make fund-acct depend on this having run. E.g. make this have a side-effect of noting its completion and have fund-acct depend on that, so that it runs if necesssary..

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copied to 8fa8326

@@ -9,7 +9,7 @@ import { observeIteration, subscribeEach } from '@agoric/notifier';
* If this proves to be a problem we can add an option to this or a related
* utility to reset state from RPC.
*
* @param {ERef<StoredSubscriber<import('./smartWallet').UpdateRecord>>} updates
* @param {ERef<Subscriber<import('./smartWallet').UpdateRecord>>} updates
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 this doesn't care about storage

@@ -1,6 +1,6 @@
import bundleCentralSupply from '@agoric/vats/bundles/bundle-centralSupply.js';
import bundleMintHolder from '@agoric/vats/bundles/bundle-mintHolder.js';
import bundleWalletFactory from '@agoric/vats/bundles/bundle-legacy-walletFactory.js';
import bundleWalletFactory from '@agoric/vats/bundles/bundle-walletFactory.js';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a yarn build for this package now that builds ../bundles/bundle-walletFactory.js.

Consider using that instead, so while making changes to this package you don't have to build all vats.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I lean toward: you can assume yarn build is up-to-date for other packages, but changes within a package should get bundled at test-time within a package. So this one is a little awkward: it depends on yarn build in vats whenever a change to the walletFactory contract in this package is changed.

hm. not sure I have a concrete suggestion.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by that principle shouldn't this be as suggested?

Suggested change
import bundleWalletFactory from '@agoric/vats/bundles/bundle-walletFactory.js';
import bundleWalletFactory from '../bundles/bundle-walletFactory.js';

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, that's good, provided the test.before() auto-updates that bundle.

packages/wallet/api/src/marshal-contexts.js Show resolved Hide resolved
@@ -62,7 +62,7 @@ const ConnectionSettingsDialog = ({
const classes = useStyles();
const smartConnectionHrefs = allConnectionConfigs.map(({ href }) => href);

const [config, setConfig] = useState(connectionConfig);
const [config, setConfig] = useState(connectionConfig || {});
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to express defaults in the params

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The connectionConfig may be falsy but not undefined (such as when it's null). I found it was necessary to handle all falsy values.

@@ -130,15 +130,80 @@ export const makeWalletBridgeFromFollower = (
]),
);

// We assume just one cosmos purse per brand.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could ref #6126 (though I now see it is below)

Comment on lines +173 to +176
brand: descriptor.brand,
brandPetname: descriptor.petname,
pursePetname: descriptor.petname,
displayInfo: descriptor.displayInfo,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the intent might be more clear with destructring,

Suggested change
brand: descriptor.brand,
brandPetname: descriptor.petname,
pursePetname: descriptor.petname,
displayInfo: descriptor.displayInfo,
...descriptor

Copy link
Member

@michaelfig michaelfig Sep 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a remapping of properties, so I found following the current style was clearest for me.

Comment on lines +188 to +189
currentAmount,
value: currentAmount.value,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

odd to have value right next to an amount that has the same value. please remove the redundant one.

Copy link
Member

@dckc dckc Sep 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect it's an external design constraint; that is: removing the redundant one would involve something like upgrading all the dapps (or: the half of the dapps that use the one or the other).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found both were necessary.

@mergify mergify bot merged commit a390655 into master Sep 15, 2022
@mergify mergify bot deleted the 6127-psm-new-wallet branch September 15, 2022 05:41
@turadg turadg mentioned this pull request Sep 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge:no-update (expert!) Automatically merge without updates wallet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants