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

get rid of <[Object: null prototype] {}> console noise #2324

Closed
erights opened this issue Feb 3, 2021 · 7 comments · Fixed by #2549, endojs/endo#587 or #2552
Closed

get rid of <[Object: null prototype] {}> console noise #2324

erights opened this issue Feb 3, 2021 · 7 comments · Fixed by #2549, endojs/endo#587 or #2552
Assignees
Labels
bug Something isn't working

Comments

@erights
Copy link
Member

erights commented Feb 3, 2021

After applying both #2303 and endojs/endo#569 , a yarn test fails in something having to do with xsnap, complaining about an assignment to a constructor property failing.

Low priority because endojs/endo#569 is low priority. But fixing this would cause the Node console to stop adding junk like the following to its display of objects.

[Function (anonymous)] Function <Function <[Object: null prototype] {}>>
@erights erights added the bug Something isn't working label Feb 3, 2021
@erights
Copy link
Member Author

erights commented Feb 10, 2021

When linking master of agoric-sdk with https://github.com/Agoric/SES-shim/pull/569` i.e., https://github.com/Agoric/SES-shim/tree/markm-stop-enabling-O-p-constructor and then doing a yarn test I get lots of error output in which this seems to be the key diagnostic:

    message: 'Cannot assign to read only property \'constructor\' of object \'[object Object]\' in /Users/markmiller/src/ongithub/agoric/agoric-sdk/node_modules/ses/src/whitelist.js',

However, this is unlikely to be a problem in the source code of whitelist.js since it doesn't have this problem otherwise. But perhaps?

This diagnostic appears within the following longer sample

Replaying SwingSet transcripts
Replaying SwingSet transcripts
  devices › before hook

  Rejected promise returned by test. Reason:

  TypeError {
    code: 'PLUGIN_ERROR',
    hook: 'transform',
    id: '/Users/markmiller/src/ongithub/agoric/agoric-sdk/node_modules/ses/src/whitelist.js',
    plugin: 'commonjs',
    watchFiles: [
      '/Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/SwingSet/src/kernel/vatManager/lockdown-subprocess-xsnap.js',
      '/Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/xsnap/lib/bootstrap.js',
      '/Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/xsnap/lib/console-shim.js',
      '/Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/xsnap/lib/text-shim.js',
      '/Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/xsnap/lib/lockdown-shim.js',
      '/Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/eventual-send/shim.js',
      '/Users/markmiller/src/ongithub/agoric/agoric-sdk/node_modules/ses/lockdown.js',
      '/Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/eventual-send/src/index.js',
      '/Users/markmiller/src/ongithub/agoric/agoric-sdk/node_modules/ses/src/commons.js',
      '/Users/markmiller/src/ongithub/agoric/agoric-sdk/node_modules/ses/src/tame-function-tostring.js',
      '/Users/markmiller/src/ongithub/agoric/agoric-sdk/node_modules/ses/src/intrinsics.js',
      '/Users/markmiller/src/ongithub/agoric/agoric-sdk/node_modules/ses/src/get-anonymous-intrinsics.js',
      '/Users/markmiller/src/ongithub/agoric/agoric-sdk/node_modules/ses/src/lockdown-shim.js',
      '/Users/markmiller/src/ongithub/agoric/agoric-sdk/node_modules/ses/src/compartment-shim.js',
      '/Users/markmiller/src/ongithub/agoric/agoric-sdk/node_modules/ses/src/error/assert.js',
      '/Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/eventual-send/src/track-turns.js',
      '/Users/markmiller/src/ongithub/agoric/agoric-sdk/node_modules/ses/src/whitelist.js',
      '/Users/markmiller/src/ongithub/agoric/agoric-sdk/node_modules/ses/src/inert.js',
      '/Users/markmiller/src/ongithub/agoric/agoric-sdk/node_modules/ses/src/whitelist-intrinsics.js',
      '/Users/markmiller/src/ongithub/agoric/agoric-sdk/node_modules/ses/src/repair-legacy-accessors.js',
      '/Users/markmiller/src/ongithub/agoric/agoric-sdk/node_modules/ses/src/tame-function-constructors.js',
      '/Users/markmiller/src/ongithub/agoric/agoric-sdk/node_modules/ses/src/tame-date-constructor.js',
      '/Users/markmiller/src/ongithub/agoric/agoric-sdk/node_modules/ses/src/tame-math-object.js',
      '/Users/markmiller/src/ongithub/agoric/agoric-sdk/node_modules/ses/src/tame-regexp-constructor.js',
      '/Users/markmiller/src/ongithub/agoric/agoric-sdk/node_modules/ses/src/enable-property-overrides.js',
      '/Users/markmiller/src/ongithub/agoric/agoric-sdk/node_modules/ses/src/tame-locale-methods.js',
      '/Users/markmiller/src/ongithub/agoric/agoric-sdk/node_modules/ses/src/global-object.js',
      '/Users/markmiller/src/ongithub/agoric/agoric-sdk/node_modules/ses/src/evaluate.js',
      '/Users/markmiller/src/ongithub/agoric/agoric-sdk/node_modules/ses/src/scope-constants.js',
      '/Users/markmiller/src/ongithub/agoric/agoric-sdk/node_modules/ses/src/transforms.js',
      '/Users/markmiller/src/ongithub/agoric/agoric-sdk/node_modules/ses/src/error/tame-console.js',
      '/Users/markmiller/src/ongithub/agoric/agoric-sdk/node_modules/ses/src/error/tame-error-constructor.js',
      '/Users/markmiller/src/ongithub/agoric/agoric-sdk/node_modules/ses/src/error/stringify-utils.js',
      '/Users/markmiller/src/ongithub/agoric/agoric-sdk/node_modules/ses/src/error/types.js',
      '/Users/markmiller/src/ongithub/agoric/agoric-sdk/node_modules/ses/src/error/internal-types.js',
    ],
    message: 'Cannot assign to read only property \'constructor\' of object \'[object Object]\' in /Users/markmiller/src/ongithub/agoric/agoric-sdk/node_modules/ses/src/whitelist.js',
  }



  demos › run encouragementBot Demo

  Rejected promise returned by test. Reason:

  TypeError {
    code: 'PLUGIN_ERROR',
    hook: 'transform',
    id: '/Users/markmiller/src/ongithub/agoric/agoric-sdk/node_modules/ses/src/whitelist.js',
    plugin: 'commonjs',
    watchFiles: [
      '/Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/SwingSet/src/kernel/vatManager/lockdown-subprocess-xsnap.js',
      '/Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/xsnap/lib/bootstrap.js',
      '/Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/xsnap/lib/console-shim.js',

@erights erights closed this as completed Feb 10, 2021
@erights
Copy link
Member Author

erights commented Feb 10, 2021

Fixing Object.prototype.constructor would also remove two of the eight junk lines in the VSCode debugger's object inspector of all objects. This is a significant noise reduction of the debugging experience.

@erights erights reopened this Feb 10, 2021
@erights
Copy link
Member Author

erights commented Feb 10, 2021

Sorry closed by mistake

@dckc dckc changed the title Something in the xsnap integration seems to override O.p.constructor by assignment can't get rid of <[Object: null prototype] {}> console noise due to something in the xsnap / override O.p.constructor Feb 19, 2021
@dckc
Copy link
Member

dckc commented Feb 27, 2021

with stackFiltering set to verbose in install-ses I get more detail:


@@@@@@2 [TypeError: Cannot assign to read only property 'constructor' of object '[object Object]' in /home/connolly/projects/agoric/SES-shim/packages/ses/src/whitelist.js
  at Object.pp$2.checkLVal (/home/connolly/projects/agoric/agoric-sdk/node_modules/acorn/dist/acorn.js:1814:33)
  at Object.pp$3.checkParams (/home/connolly/projects/agoric/agoric-sdk/node_modules/acorn/dist/acorn.js:2717:12)
  at Object.pp$3.parseFunctionBody (/home/connolly/projects/agoric/agoric-sdk/node_modules/acorn/dist/acorn.js:2685:12)
  at Object.pp$1.parseFunction (/home/connolly/projects/agoric/agoric-sdk/node_modules/acorn/dist/acorn.js:1283:10)
  at Object.pp$1.parseFunctionStatement (/home/connolly/projects/agoric/agoric-sdk/node_modules/acorn/dist/acorn.js:983:17)
  at Object.pp$1.parseStatement (/home/connolly/projects/agoric/agoric-sdk/node_modules/acorn/dist/acorn.js:830:19)
  at Object.parseStatement (/home/connolly/projects/agoric/agoric-sdk/packages/bundle-source/node_modules/rollup/dist/shared/node-entry.js:11825:30)
  at Object.pp$1.parseTopLevel (/home/connolly/projects/agoric/agoric-sdk/node_modules/acorn/dist/acorn.js:746:23)
  at Object.parse (/home/connolly/projects/agoric/agoric-sdk/node_modules/acorn/dist/acorn.js:553:17)
  at InertConstructor.parse (/home/connolly/projects/agoric/agoric-sdk/node_modules/acorn/dist/acorn.js:576:37)
  at Graph.contextParse (/home/connolly/projects/agoric/agoric-sdk/packages/bundle-source/node_modules/rollup/dist/shared/node-entry.js:13216:70)
  at tryParse (/home/connolly/projects/agoric/agoric-sdk/packages/bundle-source/node_modules/@rollup/plugin-commonjs/dist/index.js:282:12)
  at checkEsModule (/home/connolly/projects/agoric/agoric-sdk/packages/bundle-source/node_modules/@rollup/plugin-commonjs/dist/index.js:296:15)
  at Object.transformAndCheckExports (/home/connolly/projects/agoric/agoric-sdk/packages/bundle-source/node_modules/@rollup/plugin-commonjs/dist/index.js:801:28)
  at Object.transform (/home/connolly/projects/agoric/agoric-sdk/packages/bundle-source/node_modules/@rollup/plugin-commonjs/dist/index.js:884:48)
  at /home/connolly/projects/agoric/agoric-sdk/packages/bundle-source/node_modules/rollup/dist/shared/node-entry.js:13113:25] {
  id: '/home/connolly/projects/agoric/SES-shim/packages/ses/src/whitelist.js',
  hook: 'transform',
  code: 'PLUGIN_ERROR',
  plugin: 'commonjs'
}

@dckc
Copy link
Member

dckc commented Mar 1, 2021

I'm expanding the scope of this to actually getting rid of the console noise; i.e. doing the SES-shim release @erights asked for and upgrading agoric-sdk to use it.

@dckc dckc reopened this Mar 1, 2021
@dckc dckc changed the title can't get rid of <[Object: null prototype] {}> console noise due to something in the xsnap / override O.p.constructor get rid of <[Object: null prototype] {}> console noise Mar 1, 2021
@erights
Copy link
Member Author

erights commented Mar 1, 2021

I'm expanding the scope of this to actually getting rid of the console noise; i.e. doing the SES-shim release @erights asked for and upgrading agoric-sdk to use it.

Excellent, thanks!

If we can get endojs/endo#590 and endojs/endo#591 in quickly enough to make this release, that would be nice. Otherwise they can wait until the next release.

@dckc
Copy link
Member

dckc commented Mar 2, 2021

#2552 failed lint:types due to outdated @agoric/make-hardener types. I tried to make a release with the types fixed (9b16d93fe94b9) but I don't have write access to https://www.npmjs.com/package/@agoric/make-hardener .

I wouldn't mind keeping it that way :)

@warner perhaps you're willing to move the ball ahead the next few yards? If not, nominate somebody? (if it's me, grant me npm write access)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment