Skip to content

Instantly share code, notes, and snippets.

View michaelfig's full-sized avatar

Michael FIG michaelfig

View GitHub Profile
@michaelfig
michaelfig / test-types.js
Created February 26, 2023 18:48
Using AVA snapshots to check command output files
// `yarn add globby` in `endo`
// Put this file in `endo/packages/captp/test/test-types.js`
//
// `cd packages/captp` and run `yarn test test/test-types.js`
// `yarn test -u test/test-types.js` to update the snapshots
//
// Snapshots are kept in test/snapshots/*
import test from 'ava';
import fs from 'node:fs';
import { spawn } from 'node:child_process';
@michaelfig
michaelfig / @protobufjs+inquire+1.1.0.patch
Last active May 10, 2022 08:01
cosmjs-types running in a SES compartment
diff --git a/node_modules/@protobufjs/inquire/index.js b/node_modules/@protobufjs/inquire/index.js
index 33778b5..a7aee2d 100644
--- a/node_modules/@protobufjs/inquire/index.js
+++ b/node_modules/@protobufjs/inquire/index.js
@@ -9,7 +9,7 @@ module.exports = inquire;
*/
function inquire(moduleName) {
try {
- var mod = eval("quire".replace(/^/,"re"))(moduleName); // eslint-disable-line no-eval
+ var mod = (eval)("quire".replace(/^/,"re"))(moduleName); // eslint-disable-line no-eval
@michaelfig
michaelfig / gist:2badd5fd418798acca2ce883a6f48a6b
Created February 12, 2022 23:48
Difference between kvstore writes of two typical ag0 blocks
3,102c3,102
< P3714446 \n\x91\x03\n\x02\x08\x0b\x12\x08agoric-3\x18\x8e\xdb\xe2\x01"\x0c\x08\xd1\x89\x9c\x90\x06\x10\xaf\x9d\xfb\xf7\x02*H\n \x92\x86\x8a\xb5\0\xd5g\x15\nR#\xf2\x91[\xcf\x97u\x94d\x1c4\xae\x0b\x0f9\xa7!(\xa6\x9e\x9d\xb8\x12$\x08\x01\x12 \x16\x1b#\xd2\xc1A\x8ej\xb7\xe3\x01\x8a*4\xabv\x01\x0cG\xc7Y>\xca\x01\x99\x92\xa9\xf4\x80\x11\xe5`2 '\xd6]e\xa8\x87\xb5\xc1\xa7\xdf{+\x9a\x8bC;\xa0q\xae(e(\n.\xfa\xf4\xe1h\xa8h\xda\xbb: \xe3\xb0\xc4B\x98\xfc\x1c\x14\x9a\xfb\xf4\xc8\x99o\xb9$'\xaeA\xe4d\x9b\x93L\xa4\x95\x99\x1bxR\xb8UB \xca9\x1a\xae'v\x16\xd3\x06\xd9<F\xb4\xb7\xf0\xbe\xd9t\x84\xf4Bh:*\xac\x1cW\xc2\xc7U\xe8\xe0J \xca9\x1a\xae'v\x16\xd3\x06\xd9<F\xb4\xb7\xf0\xbe\xd9t\x84\xf4Bh:*\xac\x1cW\xc2\xc7U\xe8\xe0R \x04\x80\x91\xbc}\xdc(?w\xbf\xbf\x91\xd7<D\xdaX\xc3\xdf\x8a\x9c\xbc\x86t\x05\xd8\xb7\xf3\xda\xad\xa2/Z \xc8\xf17\x1c\x9e;\xc9\rZ\xcf|\xfa&g\x14\xb7q|\xd4\xd6/\x15V\x9e\xd9G+\xd5cP\x15{b \xe3\xb0\xc4B\x98\xfc\x1c\x14\x9a\xfb\xf4\xc8\x99o\xb9$'\xaeA\xe4d\x9b\x93L\xa4\x95\x99\x1bxR\xb8Uj \xe3\xb0\xc
@michaelfig
michaelfig / consensus-mode.slog
Created February 9, 2022 23:47
Differences between consensus/non-consensus SwingSet modes
This file has been truncated, but you can view the full file.
{"type":"cosmic-swingset-begin-block","blockHeight":118,"blockTime":1644350883}
{"type":"cosmic-swingset-deliver-inbound","sender":"agoric1xj4jqmdqajsqh8frquqhq9j6hhaeh8kf969e9g","count":21}
{"type":"cosmic-swingset-deliver-inbound","sender":"agoric1xj4jqmdqajsqh8frquqhq9j6hhaeh8kf969e9g","count":30}
{"type":"cosmic-swingset-bridge-inbound","source":"bank"}
{"type":"cosmic-swingset-end-block-start","blockHeight":118,"blockTime":1644350883}
{"type":"crank-start","message":{"type":"bringOutYourDead","vatID":"v22"}}
{"type":"deliver","crankNum":4606,"vatID":"v22","deliveryNum":359,"replay":false,"kd":["bringOutYourDead"],"vd":["bringOutYourDead"]}
{"type":"deliver-result","crankNum":4606,"vatID":"v22","deliveryNum":359,"replay":false,"dr":["ok",null,{"meterType":"xs-meter-12","currentHeapCount":133572,"compute":5445,"allocate":46268448}]}
{"type":"crank-finish","crankNum":4606,"crankhash":"5c055d2a3f8510087a185b1f9ae035798f09d166a3be967bdb4d0979cc4ea89d","activityhash":"8abbc1495ae0946540050686f85917bd1c02efc680
@michaelfig
michaelfig / hermes-duplicate-sendpacket.log
Created February 4, 2022 19:05
Hermes duplicates `SendPacket` events emitted from `EndBlock`
Attaching to ibc-lab_hermes_1
hermes_1 | 2022-02-04T18:45:41.214414Z INFO ThreadId(01) [rest] address not configured, REST server disabled
hermes_1 | 2022-02-04T18:45:41.234431Z TRACE ThreadId(01) [agoric] spawned chain runtime
hermes_1 | 2022-02-04T18:45:41.256786Z TRACE ThreadId(04) parsed version specification for agd 0.27.2@9e3b931be -> SDK=0.44.4; Ibc-Go status=Some(Version { major: 2, minor: 0, patch: 0 })
hermes_1 | 2022-02-04T18:45:41.257057Z DEBUG ThreadId(04) running diagnostic on version info Specs { sdk_version: Version { major: 0, minor: 44, patch: 4 }, ibc_go_version: Some(Version { major: 2, minor: 0, patch: 0 }) }
hermes_1 | 2022-02-04T18:45:41.270338Z INFO ThreadId(01) [agoric] chain is healthy
hermes_1 | 2022-02-04T18:45:41.469080Z TRACE ThreadId(01) [cosmoshub-testnet] spawned chain runtime
hermes_1 | 2022-02-04T18:45:41.742618Z TRACE ThreadId(06) parsed version specification for <appd> @ -> SDK=0.42.10; Ibc-Go status=N
@michaelfig
michaelfig / exported-peer.json
Last active December 9, 2021 02:35
Exported state after peer crashed due to divergence when opening IBC channel
{
"app_hash": "",
"app_state": {
"auth": {
"accounts": [
{
"@type": "/cosmos.auth.v1beta1.BaseAccount",
"account_number": "0",
"address": "agoric1z2s34e3lk783khgy6r7yk8806e7jp4fcwltqgs",
"pub_key": {
@michaelfig
michaelfig / vest-faucet.sh
Created October 22, 2021 20:12
Create a vesting account with 50BLD in it
#! /bin/bash
ADDR=$1
ag0 tx vesting create-periodic-vesting-account \
--chain-id=agorictest-18 --node=https://testnet.rpc.agoric.net:443 \
--from=test-whale "$ADDR" --yes -b block /dev/stdin <<EOF
{
"start_time": 1667196000,
"periods": [
{
"coins": "50000000ubld",
@michaelfig
michaelfig / syntax-lintwarn1b.log
Created October 1, 2021 22:16
Errors while running `eslint-plugin-jsdoc@36.1.0` against https://github.com/Agoric/agoric-sdk
22:0 warning Syntax error in type: ((...args: any[]) => any) | undefined jsdoc/valid-types
19:0 warning Syntax error in type: asserts flag jsdoc/valid-types
77:0 warning Syntax error in type: asserts specimen is bigint jsdoc/valid-types
83:0 warning Syntax error in type: asserts specimen is boolean jsdoc/valid-types
89:0 warning Syntax error in type: asserts specimen is Function
@michaelfig
michaelfig / machine.js
Last active August 30, 2021 04:59
Generated by XState Viz: https://xstate.js.org/viz
Machine({
id: 'Agoric Wallet Iframe Connection',
initial: 'idle',
context: {
location: null,
connecting: false,
},
states: {
idle: {
on: {
@michaelfig
michaelfig / check-validator.js
Last active June 25, 2021 04:26
Verify that your Agoric node is a created validator
#! /usr/bin/env node
/* global process require Buffer */
// check-validator - Find if there is a validator that matches the current ag-chain-cosmos
// Michael FIG <mfig@agoric.com>, 2021-06-25
const oper = process.argv[2];
const { spawnSync } = require('child_process');
console.log('Fetching current validators matching', oper || 'ALL');
const ret = spawnSync('ag-cosmos-helper', [