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

can't send to account by address: namesByAddress is empty #8113

Closed
3 tasks done
Tracked by #5822
dckc opened this issue Jul 29, 2023 · 7 comments · Fixed by #8901
Closed
3 tasks done
Tracked by #5822

can't send to account by address: namesByAddress is empty #8113

dckc opened this issue Jul 29, 2023 · 7 comments · Fixed by #8901
Assignees
Labels
bug Something isn't working namehub-petname issuer naming, petnames, namehubs, ...

Comments

@dckc
Copy link
Member

dckc commented Jul 29, 2023

Tasks

Preview Give feedback
  1. automerge:rebase
  2. agoric-cosmos bug
  3. automerge:squash

Describe the bug

#5822 involves sending assets to accounts by address. As described in #8115, it should work something like...

const destDepositFacet = E(home.namesByAddress).lookup(addr, 'depositFacet');

but E(namesByAddress).entries() is empty: it resolves to [].

@anilhelvaci reported seeing [] in a REPL. I reproduced it in an ava test.

To Reproduce

Steps to reproduce the behavior:

  1. cd agoric-sdk/packages/vats
  2. apply diff below to the sim/demo config provides home with .myAddressNameAdmin test to show the entries
  3. yarn test test/bootstrapTests/test-demo-config.js -m '*home*'
  4. see an empty list of entries: []
diff --git a/packages/vats/test/bootstrapTests/test-demo-config.js b/packages/vats/test/bootstrapTests/test-demo-config.js
index d9a53b5fd..41743b0c5 100644
--- a/packages/vats/test/bootstrapTests/test-demo-config.js
+++ b/packages/vats/test/bootstrapTests/test-demo-config.js
@@ -64,6 +64,8 @@ test('sim/demo config provides home with .myAddressNameAdmin', async t => {
   const home = await makeHomeFor(addr, EV);
   const actual = await EV(home.myAddressNameAdmin).getMyAddress();
   t.is(actual, addr, 'my address');
+  const xxx = await EV(home.namesByAddress).entries();
+  console.log('@@@@', xxx);
   keyArrayEqual(t, keys(home).sort(), homeKeys);
 });

Expected behavior

An entry for each provisioned user.

Platform Environment

  • what OS are you using? what version of Node.js?
$ uname -a
Linux bldbox 5.15.0-76-generic #83-Ubuntu SMP Thu Jun 15 19:16:32 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
$ node --version
v18.14.0
  • is there anything special/unusual about your platform?

I was working on a branch at the time I reproduced the problem, but it also reproduces on master.

Additional context

@anilhelvaci reports that this is blocking a bounty issue that @schnetzlerjoe is working on (most likely #5822)

Screenshots

$ yarn test test/bootstrapTests/test-demo-config.js -m '*home*'
...
@@@@ []
  ✔ sim/demo config provides home with .myAddressNameAdmin (16.2s)
    ℹ bootstrap produced provisioning vat
@dckc dckc added the bug Something isn't working label Jul 29, 2023
@dckc dckc self-assigned this Jul 29, 2023
@dckc
Copy link
Member Author

dckc commented Jul 29, 2023

workaround for vat-provisioning on local chains

@schnetzlerjoe does 71a2c83 get your bounty issue work un-stuck?

For ref: I started a branch: 8113-provision-names. currently:

  • 71a2c83 fix(provisioning): don't use disconnected namesByAddress
  • 2796df2 chore(provisioning): extra NameHub tracing

cc @michaelfig @anilhelvaci

p.s. @schnetzlerjoe says:

This works like a charm!!!!!

@dckc
Copy link
Member Author

dckc commented Jul 29, 2023

TODO: find consumers of disconnected namesByAddress

Somehow this didn't impact sending invitations to EC members and oracle operators. I suppose those functions used namesByAddressAdmin.

But anything that consumed namesByAddress has got a useless unrelated NameHub.

cc @turadg

p.s. done: #8786 (comment)

@dckc
Copy link
Member Author

dckc commented Jul 29, 2023

impact: cannot send assets to account by address

I'm inclined to change the title to be more about this.

Background:

@dckc dckc changed the title home.namesByAddress is empty in REPL can't send to account by address: namesByAddress is empty Jul 31, 2023
@dckc
Copy link
Member Author

dckc commented Sep 13, 2023

work-around idea

In a core-eval proposal, rather than using { consume: { agoricNames } }, use { consume: { agoricNamesAdmin } } and then const agoricNames = E(agoricNamesAdmin).readOnly().

@dckc
Copy link
Member Author

dckc commented Sep 30, 2023

The work-around triggered another bug: #8408

There we have a more complete work-around.

@0xpatrickdev
Copy link
Member

use { consume: { agoricNamesAdmin } } and then const agoricNames = E(agoricNamesAdmin).readOnly().

Is it possible to create a power called agoricNamesAdminReadOnly, or agoricNamesReadOnly ?

Relatedly, I wonder if we can do something like this to better scope permit permissions for writing to agoricNames:

{
  "consume": {
    "chainStorage": {
      "agoricNamesAdmin": {
        "instance": {
          "MyContract": true,
          "MySecondContract": true
        }
      }
    }
  }
}

@dckc
Copy link
Member Author

dckc commented Dec 1, 2023

agoricNamesAdminReadOnly is called agoricNames.

And for installation, instance, brand, and issuer, the stuff is already shaped like this:

{
  consume: {...},
  instance: {
    produce: {
      MyContract: true,
      MySecondContract: true,
    }
  }
}

And the contents of these namehubs are automatically reflected to chainStorage.

p.s. see makeWellKnownSpaces

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working namehub-petname issuer naming, petnames, namehubs, ...
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants