Skip to content

Instantly share code, notes, and snippets.

@erights
erights / horton.js
Created May 26, 2023 05:00 — forked from tvcutsem/horton.js
Horton in JavaScript: delegation with blame attribution in an object-capability language
/*
* Horton in JavaScript: delegation with blame attribution in an object-capability language
*
* See http://erights.org/elib/capability/horton/index.html for idea and paper.
*
* Implementation based on: http://erights.org/elib/capability/horton
* (with N-ary message support, lexical nesting and rights amplification)
*
* To run:
*
@erights
erights / bundled-coveredCall-durable-v3.js
Created May 11, 2023 00:05
Another example loss of horizontal whitespace by bundling
(({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => { let M,mustMatch,prepareExoClass,prepareExo,swapExact,InvitationShape,isAfterDeadlineExitRule,OfferHandlerI;$h‍_imports([["@agoric/store", [["M", [$h‍_a => (M = $h‍_a)]],["mustMatch", [$h‍_a => (mustMatch = $h‍_a)]]]],["../../../exported.js", []],["@agoric/vat-data", [["prepareExoClass", [$h‍_a => (prepareExoClass = $h‍_a)]],["prepareExo", [$h‍_a => (prepareExo = $h‍_a)]]]],["../../../src/contractSupport/index.js", [["swapExact", [$h‍_a => (swapExact = $h‍_a)]]]],["../../../src/typeGuards.js", [["InvitationShape", [$h‍_a => (InvitationShape = $h‍_a)]],["isAfterDeadlineExitRule", [$h‍_a => (isAfterDeadlineExitRule = $h‍_a)]],["OfferHandlerI", [$h‍_a => (OfferHandlerI = $h‍_a)]]]]]);
const ModuleLanguagesSet = makeConstSet([
'cjs',
'mjs',
'json',
'pre-mjs-json',
'pre-cjs-json',
]);
// TODO M.elementOf doesn't yet exist. We should add it.
const ModuleLanguageShape = M.elementOf(ModuleLanguagesSet),
@erights
erights / harden-perf-stats-better-order.txt
Created May 15, 2021 06:43
Output of #3105 Harden perf stats better order
Output of https://github.com/Agoric/agoric-sdk/pull/3105
```
(1):xsnap(test-harden-perf)$ yarn test -sv test/test-harden-perf.js
yarn run v1.22.5
$ ava -sv test/test-harden-perf.js
time, BOTH, 10, nothing {
meterType: 'xs-meter-6',
compute: 12257,
@erights
erights / harden-perf-stats.txt
Last active May 15, 2021 06:44
Output of #3105 Harden perf stats
Output of https://github.com/Agoric/agoric-sdk/pull/3105
A better order at https://gist.github.com/erights/0686e4c7c975bd9320834290f7bd3022
```
(1):xsnap(test-harden-perf)$ yarn test -sv test/test-harden-perf.js
yarn run v1.22.5
$ ava -sv test/test-harden-perf.js
time, BOTH, 10, nothing {
meterType: 'xs-meter-6',

Keybase proof

I hereby claim:

  • I am erights on github.
  • I am erights (https://keybase.io/erights) on keybase.
  • I have a public key ASCODEpcW0xkfFhbDrzWvcFouU6icOqlfAPKb0rhgo_4lgo

To claim this, I am signing this object:

@erights
erights / microses-to-microses-for-persistence
Last active January 13, 2017 19:10
microses-to-microses-for-persistence
const makeAddr = (x => (y => x + y));
const wm = makeWeakMap();
const makeAddr = (x => {
const fn = (y => x + y);
wm.set(fn, {get x() { return x; });
return fn;
});