Agoric / agoric-sdk

monorepo for the Agoric Javascript smart contract platform
Apache License 2.0
326 stars 206 forks source link

can't build bundles compatible with mainnet due to endo patterns breaking change #8826

Closed dckc closed 8 months ago

dckc commented 8 months ago

Describe the bug

I ran into SwingSet: xsnap: v11: RangeError#1: Expected undefined is same as Interface, asked for help, and learned in discussion with @Chris-Hibbert, @kriskowal , @mhofman that it's due to a breaking change in @endo/patterns, and that as a result, I wouldn't be able to test the upgrade fix for #8311 on master; I'd have to do development in the release branch, which (presumably) doesn't include the breaking change to patterns.

1.0.0 (2023-12-12) ⚠ BREAKING CHANGES patterns: tag and retype guards -- patterns/CHANGELOG

To Reproduce

  1. check out 8826-wip-repro (683733d as of this writing)
  2. cd agoric-sdk; yarn
  3. cd a3p-integration; corepack enable; yarn
  4. yarn test
  5. lots of stuff happens that's cached, up thru => CACHED [test-names-by-addr test-names-by-addr 4/4]
  6. Running test image for proposal upgrade-14 runs ok
  7. Running test image for proposal names-by-addr starts; goes ok thru v1: upgradeProvisioningVat..., but then
  8. fail with v1: Error: vat-upgrade failure
stack for v1: Error: vat-upgrade failure ``` 2024-01-26T22:32:05.111Z SwingSet: vat: v1: evaluateBundleCap { manifestBundleRef: { bundleID: 'b1-ae1949442574923fc03f229d529644ded41a2dbdc6336f6bf1496fdd7f557b1fcad2d1bfa59a2f0a2241f66a8f864dcbbeddd3abf0afcf0ac7879d26d0821994' }, manifestGetterName: 'getManifestForProvisioning', vatAdminSvc: Promise [Promise] {} } 2024-01-26T22:32:05.171Z SwingSet: vat: v1: execute { manifestGetterName: 'getManifestForProvisioning', bundleExports: [ 'getManifestForProvisioning', 'upgradeProvisioningVat' ] } 2024-01-26T22:32:05.171Z SwingSet: vat: v1: coreProposal: upgradeProvisioningVat 2024-01-26T22:32:05.171Z SwingSet: vat: v1: upgradeProvisioningVat... 2024-01-26T22:32:05.172Z SwingSet: vat: v1: provisioning { adminNode: Object [Alleged: adminNode] {}, root: Object [Alleged: undefined] {} } b1-10d640ccc3f09d37719d87bf33b4cf2cf950da2a5daf7b2c927e5b4569e65e03950fa36be3591e33250906a98e6c39f79fd4cfb5fe1b38f5aff8a115ccfe3846 2024-01-26T22:32:05.174Z SwingSet: vat: v1: CORE_EVAL failed: (RemoteError(error:liveSlots:v2#70001)#3) 2024-01-26T22:32:05.174Z SwingSet: vat: v1: RemoteError(error:liveSlots:v2#70001)#3: vat-upgrade failure 2024-01-26T22:32:05.174Z SwingSet: vat: v1: Error: vat-upgrade failure at construct () at Error (/bundled-source/.../node_modules/ses/src/error/tame-error-constructor.js:56) at makeError (/bundled-source/.../node_modules/ses/src/error/assert.js:243) at decodeErrorCommon (/bundled-source/.../node_modules/@endo/marshal/src/marshal.js:281) at decodeFromSmallcaps (/bundled-source/.../node_modules/@endo/marshal/src/encodeToSmallcaps.js:434) at fromCapData (/bundled-source/.../node_modules/@endo/marshal/src/marshal.js:356) at notifyOnePromise (/bundled-source/.../packages/swingset-liveslots/src/liveslots.js:1225) at notify (/bundled-source/.../packages/swingset-liveslots/src/liveslots.js:1249) at dispatchToUserspace (/bundled-source/.../packages/swingset-liveslots/src/liveslots.js:1514) at runWithoutMetering (/bundled-source/.../packages/swingset-xsnap-supervisor/lib/supervisor-subprocess-xsnap.js:60) at () ```

Expected behavior

The upgrade should work just as well as on the release branch (#8786).

Platform Environment

IOU

Additional context

was working on #8311

Screenshots / Stack trace

earlier stack from 2024-01-22 ``` ag-power-tools-agd-1 | 2024-01-22T17:19:40.483Z SwingSet: vat: v1: provisioning { adminNode: Object [Alleged: adminNode] {}, root: Object [Alleged: undefined] {} } b1-10d640ccc3f09d37719d87bf33b4cf2cf950da2a5daf7b2c927e5b4569e65e03950fa36be3591e33250906a98e6c39f79fd4cfb5fe1b38f5aff8a115ccfe3846 ag-power-tools-agd-1 | 2024-01-22T17:19:41.117Z SwingSet: xsnap: v11: error during vat dispatch() of startVat,[object Object] (RangeError#1) ag-power-tools-agd-1 | 2024-01-22T17:19:41.117Z SwingSet: xsnap: v11: RangeError#1: Expected undefined is same as Interface ag-power-tools-agd-1 | 2024-01-22T17:19:41.118Z SwingSet: xsnap: v11: RangeError: Expected (an undefined) is same as (a string) ag-power-tools-agd-1 | at makeError (/bundled-source/.../node_modules/ses/src/error/assert.js:243) ag-power-tools-agd-1 | at fail (/bundled-source/.../node_modules/ses/src/error/assert.js:357) ag-power-tools-agd-1 | at equal (/bundled-source/.../node_modules/ses/src/error/assert.js:390) ag-power-tools-agd-1 | at defendPrototype (/bundled-source/.../node_modules/@endo/exo/src/exo-tools.js:238) ag-power-tools-agd-1 | at defineKindInternal (/bundled-source/.../packages/swingset-liveslots/src/virtualObjectManager.js:957) ag-power-tools-agd-1 | at defineDurableKind (/bundled-source/.../packages/swingset-liveslots/src/virtualObjectManager.js:1155) ag-power-tools-agd-1 | at prepareAttenuator (.../internal/src/callback.js:300) ag-power-tools-agd-1 | at prepareGuardedAttenuator (.../internal/src/callback.js:319) ag-power-tools-agd-1 | at prepareMixinMyAddress (.../vats/src/nameHub.js:58) ag-power-tools-agd-1 | at prepareSpecializedNameAdmin (.../vats/src/vat-provisioning.js:20) ag-power-tools-agd-1 | at buildRootObject (.../vats/src/vat-provisioning.js:91) ```
mhofman commented 8 months ago

@erights might have some insights

dckc commented 8 months ago

I wonder if I'm jumping to conclusions about patterns... the stack trace doesn't show any patterns code. It shows defendPrototype in @endo/exo as where an assert fails.

dckc commented 8 months ago

@erights I think the steps to reproduce above are complete now. Please try it and let me know.

erights commented 8 months ago

Hi @gibson042 , I co-assigned this to myself. Before starting on a fix for this, we should talk.

mhofman commented 8 months ago

This is part of the larger effort to handle versioning, and should be included in that effort's design, where we should decide what the fix looks like.

dckc commented 8 months ago

This is part of the larger effort to handle versioning, and should be included in that effort's design

Got a pointer to 1 or 2 of the relevant issues? Maybe worth a label?

mhofman commented 8 months ago

I think @warner is drafting notes from out meeting last week. Part of the effort to have a plan upgrading endo, XS, liveslots, etc.

dckc commented 8 months ago
$ docker images|grep unreleased
ghcr.io/agoric/agoric-sdk           unreleased              1503a39cee8e   12 days ago    2.22GB

and

$ docker run -ti --rm --entrypoint /bin/bash ghcr.io/agoric/agoric-sdk:unreleased
root@bbb113d72760:~# ls -l /usr/local/bin/agd
lrwxrwxrwx 1 root root 27 Jan 25 19:56 /usr/local/bin/agd -> /usr/src/agoric-sdk/bin/agd

and

$ docker run -ti --rm --entrypoint /usr/local/bin/agd ghcr.io/agoric/agoric-sdk:unreleased version --long
name: agoriccosmos
server_name: agd
version: 0.35.0-u13.0
commit: ""
build_tags: ledger
go: go version go1.20.13 linux/amd64
build_deps:
- cosmossdk.io/api@v0.2.6
- cosmossdk.io/core@v0.5.1
- cosmossdk.io/depinject@v1.0.0-alpha.3
- filippo.io/edwards25519@v1.0.0-rc.1
- github.com/99designs/keyring@v1.2.1 => github.com/cosmos/keyring@v1.2.0
- github.com/ChainSafe/go-schnorrkel@v0.0.0-20200405005733-88cbf1b4c40d
- github.com/Workiva/go-datastructures@v1.0.53
- github.com/armon/go-metrics@v0.4.1
- github.com/beorn7/perks@v1.0.1
- github.com/bgentry/speakeasy@v0.1.1-0.20220910012023-760eaf8b6816
- github.com/btcsuite/btcd/btcec/v2@v2.3.2
- github.com/cespare/xxhash/v2@v2.1.2
- github.com/coinbase/rosetta-sdk-go@v0.7.9
- github.com/cometbft/cometbft-db@v0.7.0
- github.com/confio/ics23/go@v0.9.1 => github.com/agoric-labs/cosmos-sdk/ics23/go@v0.8.0-alpha.agoric.1
- github.com/cosmos/btcutil@v1.0.4
- github.com/cosmos/cosmos-db@v0.0.0-20221226095112-f3c38ecb5e32
- github.com/cosmos/cosmos-proto@v1.0.0-beta.1
- github.com/cosmos/cosmos-sdk@v0.45.16 => github.com/agoric-labs/cosmos-sdk@v0.45.16-alpha.agoric.3
- github.com/cosmos/go-bip39@v1.0.0
- github.com/cosmos/iavl@v0.19.5
- github.com/cosmos/ibc-go/v4@v4.5.1
- github.com/cosmos/ledger-cosmos-go@v0.12.2
- github.com/creachadair/taskgroup@v0.3.2
- github.com/davecgh/go-spew@v1.1.1
- github.com/decred/dcrd/dcrec/secp256k1/v4@v4.0.1
- github.com/desertbit/timer@v0.0.0-20180107155436-c41aec40b27f
- github.com/dvsekhvalnov/jose2go@v1.5.0
- github.com/felixge/httpsnoop@v1.0.2
- github.com/fsnotify/fsnotify@v1.6.0
- github.com/go-kit/kit@v0.12.0
- github.com/go-kit/log@v0.2.1
- github.com/go-logfmt/logfmt@v0.5.1
- github.com/godbus/dbus@v0.0.0-20190726142602-4481cbc300e2
- github.com/gogo/gateway@v1.1.0
- github.com/gogo/protobuf@v1.3.3 => github.com/regen-network/protobuf@v1.3.3-alpha.regen.1
- github.com/golang/protobuf@v1.5.2
- github.com/golang/snappy@v0.0.4
- github.com/google/btree@v1.1.2
- github.com/google/orderedcode@v0.0.1
- github.com/gorilla/handlers@v1.5.1
- github.com/gorilla/mux@v1.8.0
- github.com/gorilla/websocket@v1.5.0
- github.com/grpc-ecosystem/go-grpc-middleware@v1.3.0
- github.com/grpc-ecosystem/grpc-gateway@v1.16.0
- github.com/gsterjov/go-libsecret@v0.0.0-20161001094733-a6f4afe4910c
- github.com/gtank/merlin@v0.1.1
- github.com/gtank/ristretto255@v0.1.2
- github.com/hashicorp/go-immutable-radix@v1.3.1
- github.com/hashicorp/golang-lru@v0.5.5-0.20210104140557-80c98217689d
- github.com/hashicorp/hcl@v1.0.0
- github.com/hdevalence/ed25519consensus@v0.0.0-20220222234857-c00d1f31bab3
- github.com/improbable-eng/grpc-web@v0.14.1
- github.com/klauspost/compress@v1.15.11
- github.com/lib/pq@v1.10.6
- github.com/libp2p/go-buffer-pool@v0.1.0
- github.com/magiconair/properties@v1.8.6
- github.com/mattn/go-colorable@v0.1.13
- github.com/mattn/go-isatty@v0.0.16
- github.com/matttproud/golang_protobuf_extensions@v1.0.2-0.20181231171920-c182affec369
- github.com/mimoo/StrobeGo@v0.0.0-20210601165009-122bf33a46e0
- github.com/minio/highwayhash@v1.0.2
- github.com/mitchellh/mapstructure@v1.5.0
- github.com/mtibben/percent@v0.2.1
- github.com/pelletier/go-toml/v2@v2.0.5
- github.com/pkg/errors@v0.9.1
- github.com/pmezard/go-difflib@v1.0.0
- github.com/prometheus/client_golang@v1.14.0
- github.com/prometheus/client_model@v0.3.0
- github.com/prometheus/common@v0.37.0
- github.com/prometheus/procfs@v0.8.0
- github.com/rakyll/statik@v0.1.7
- github.com/rcrowley/go-metrics@v0.0.0-20201227073835-cf1acfcdf475
- github.com/regen-network/cosmos-proto@v0.3.1
- github.com/rs/cors@v1.8.2
- github.com/rs/zerolog@v1.27.0
- github.com/spf13/afero@v1.9.2
- github.com/spf13/cast@v1.5.0
- github.com/spf13/cobra@v1.6.1
- github.com/spf13/jwalterweatherman@v1.1.0
- github.com/spf13/pflag@v1.0.5
- github.com/spf13/viper@v1.14.0
- github.com/stretchr/testify@v1.8.1
- github.com/subosito/gotenv@v1.4.1
- github.com/syndtr/goleveldb@v1.0.1-0.20210819022825-2ae1ddf74ef7
- github.com/tendermint/go-amino@v0.16.0
- github.com/tendermint/tendermint@v0.34.27 => github.com/agoric-labs/cometbft@v0.34.27-alpha.agoric.3
- github.com/tendermint/tm-db@v0.6.7
- github.com/tidwall/btree@v1.5.0
- github.com/zondax/hid@v0.9.1 => github.com/zondax/hid@v0.9.1-0.20220302062450-5552068d2266
- github.com/zondax/ledger-go@v0.14.1
- golang.org/x/crypto@v0.5.0
- golang.org/x/exp@v0.0.0-20221019170559-20944726eadf
- golang.org/x/net@v0.7.0
- golang.org/x/sys@v0.5.0
- golang.org/x/term@v0.5.0
- golang.org/x/text@v0.7.0
- google.golang.org/genproto@v0.0.0-20230125152338-dcaf20b6aeaa
- google.golang.org/grpc@v1.52.3 => google.golang.org/grpc@v1.33.2
- google.golang.org/protobuf@v1.28.2-0.20220831092852-f930b1dc76e8
- gopkg.in/ini.v1@v1.67.0
- gopkg.in/yaml.v2@v2.4.0
- gopkg.in/yaml.v3@v3.0.1
- nhooyr.io/websocket@v1.8.6
cosmos_sdk_version: v0.45.16
dckc commented 8 months ago

my version of ghcr.io/agoric/agoric-sdk:unreleased was evidently not the one that was supposed to be used.

@mhofman plans to try to reproduce a couple things, though the timing might be complicated by upgrade-14

erights commented 8 months ago

Some progress at https://github.com/endojs/endo/pull/2038

mhofman commented 8 months ago

Reopening to track integration in agoric-sdk