@agoric/cosmos 0.35.0-u16.1 → 0.35.0-u17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,15 +3,7 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [0.35.0-u16.1](https://github.com/Agoric/agoric-sdk/compare/@agoric/cosmos@0.35.0-u16.0...@agoric/cosmos@0.35.0-u16.1) (2024-07-10)
7
-
8
- **Note:** Version bump only for package @agoric/cosmos
9
-
10
-
11
-
12
-
13
-
14
- ## [0.35.0-u16.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/cosmos@0.34.1...@agoric/cosmos@0.35.0-u16.0) (2024-07-02)
6
+ ## [0.35.0-u17.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/cosmos@0.34.1...@agoric/cosmos@0.35.0-u17.0) (2024-09-17)
15
7
 
16
8
 
17
9
  ### ⚠ BREAKING CHANGES
@@ -25,11 +17,15 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
25
17
  ### Features
26
18
 
27
19
  * a proposal to upgrade scaledPriceAuthorities ([e5ed0ff](https://github.com/Agoric/agoric-sdk/commit/e5ed0ff6abcb83f52b32d49125e21e6e41923ed0))
20
+ * Add consensus-independent vat snapshot archiving configuration to AG_COSMOS_INIT ([ffc594f](https://github.com/Agoric/agoric-sdk/commit/ffc594f9441a9374646c43b69d289cc560962f64)), closes [#10036](https://github.com/Agoric/agoric-sdk/issues/10036)
21
+ * Add consensus-independent vat snapshot retention configuration to AG_COSMOS_INIT ([a5311b5](https://github.com/Agoric/agoric-sdk/commit/a5311b5a9eb257d4dfb4f18272608f00c1616abb)), closes [#9386](https://github.com/Agoric/agoric-sdk/issues/9386)
22
+ * Add consensus-independent vat transcript archiving configuration to AG_COSMOS_INIT ([d2d5803](https://github.com/Agoric/agoric-sdk/commit/d2d5803baab6e6379d179723244b2e92aac6319a)), closes [#10036](https://github.com/Agoric/agoric-sdk/issues/10036)
23
+ * Add consensus-independent vat transcript span retention configuration to AG_COSMOS_INIT ([3cf6b57](https://github.com/Agoric/agoric-sdk/commit/3cf6b57d9e1968c6197147419d5d177b5c42e62b)), closes [#9174](https://github.com/Agoric/agoric-sdk/issues/9174) [#9386](https://github.com/Agoric/agoric-sdk/issues/9386)
28
24
  * add priceFeed for StkAtom ([6a861df](https://github.com/Agoric/agoric-sdk/commit/6a861dfa14f42b4547a24ba31175a3b1a74c97c1))
29
25
  * agd vstorage 'path' for data or children ([2b56fc6](https://github.com/Agoric/agoric-sdk/commit/2b56fc66335c44b5d8ba06480841b14a6c4a83fb))
30
26
  * **agd:** try harder to find cosmic-swingset ([dd547f0](https://github.com/Agoric/agoric-sdk/commit/dd547f0a8057109a0bbe27a814fb3fc403ad3fd1))
31
27
  * **agvm:** use envvars to pass file descriptor numbers ([47b2e8c](https://github.com/Agoric/agoric-sdk/commit/47b2e8c5b2ef54118083baebd6f07cd654c32281))
32
- * **app:** establish mechanism for adding core proposals by `upgradePlan.name` ([ac25ee0](https://github.com/Agoric/agoric-sdk/commit/ac25ee0bedbe1bc7d4ab7edd97cab336f34bbc0f))
28
+ * **app:** establish mechanism for adding core proposals by `upgradePlan.name` ([5cc190d](https://github.com/Agoric/agoric-sdk/commit/5cc190d96c93e2d8d97454ae7df85b7ca9697003))
33
29
  * **cosmic-swingset:** add repair-metadata snapshot restore option ([4fc0113](https://github.com/Agoric/agoric-sdk/commit/4fc01134fab9402d5916f0593728acce4697da9e))
34
30
  * **cosmic-swingset:** replace import/export options ([0f01712](https://github.com/Agoric/agoric-sdk/commit/0f01712cadef12784afa547d568a6e77b9a83344))
35
31
  * **cosmic-swingset:** use x/swingset for swing-store export data ([1534add](https://github.com/Agoric/agoric-sdk/commit/1534adde558df456e3225b8384e2a7033d5a5d18))
@@ -38,45 +34,52 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
38
34
  * **cosmos:** add `vm/jsonrpcconn` ([4184fb1](https://github.com/Agoric/agoric-sdk/commit/4184fb1a12b3c83d898cb8c43464e1e48838348c))
39
35
  * **cosmos:** Add a "CapData" vstorage RPC endpoint ([8943f2f](https://github.com/Agoric/agoric-sdk/commit/8943f2f850e0cddb87a6fad0a36f01e4c350cf45)), closes [#7581](https://github.com/Agoric/agoric-sdk/issues/7581)
40
36
  * **cosmos:** Add a vstorage package for decoding CapData ([8bdd7cb](https://github.com/Agoric/agoric-sdk/commit/8bdd7cb915f8e8d4103dc4d21b212aae67644b56))
41
- * **cosmos:** add hooking kv reader ([fe21935](https://github.com/Agoric/agoric-sdk/commit/fe219356acd07721a8fc2f150095f72c10e8d9f9))
37
+ * **cosmos:** add hooking kv reader ([496a430](https://github.com/Agoric/agoric-sdk/commit/496a430c772a1f996e515ef9622e7668e00ea843))
42
38
  * **cosmos:** add required export-dir export cmd option ([3be2986](https://github.com/Agoric/agoric-sdk/commit/3be2986059c9f007d34518deef68e31956e9b45e))
43
39
  * **cosmos:** Always include alleged name and slot id in vstorage CapData remotable representations ([e2cbffa](https://github.com/Agoric/agoric-sdk/commit/e2cbffaccbd1da7f38c2358fd4d1fbbc2e1abd9c))
44
40
  * **cosmos:** clean up `OnStartHook` and `OnExitHook` signatures ([158d831](https://github.com/Agoric/agoric-sdk/commit/158d83156cf404d789882bb8bf34fe723d9704ec))
45
41
  * **cosmos:** encapsulate comms to agvm RPC ([e9a5c94](https://github.com/Agoric/agoric-sdk/commit/e9a5c943d2518c432329f9c1fe96e5a3f47608b4))
46
42
  * **cosmos:** fix and migrate swing-store ([a0389b8](https://github.com/Agoric/agoric-sdk/commit/a0389b887b1610f90dea192f2aedf722ce9c6d11))
43
+ * **cosmos:** fold in `b:enable-orchestration` ([2bfeb07](https://github.com/Agoric/agoric-sdk/commit/2bfeb075ccd4f179d461d53d850c2dbeaa6ca302))
47
44
  * **cosmos:** implement `ProtoJSONMarshal*` and use it ([41b5c5f](https://github.com/Agoric/agoric-sdk/commit/41b5c5f6542f8457248f0e655153340c395c378c))
48
45
  * **cosmos:** implement bidir JSON-RPC from `agd` to `agvm` subprocess ([37f3238](https://github.com/Agoric/agoric-sdk/commit/37f323830168c11ee1f3fe438a562eb0734ba038))
49
46
  * **cosmos:** impose defaults when sending VM actions ([a710d68](https://github.com/Agoric/agoric-sdk/commit/a710d68512cf9983bdf5230e2e99f267521c7210))
50
47
  * **cosmos:** KVEntry implements json Marshaler and Unmarshaller ([1bba859](https://github.com/Agoric/agoric-sdk/commit/1bba8592eee0e24e480c407095f0f63ccca4a242))
51
48
  * **cosmos:** make vm comms use `context.Context` ([fa1754c](https://github.com/Agoric/agoric-sdk/commit/fa1754c791ba6c848e6b94f3a75051c6b4cc69f6))
52
- * **cosmos:** Next upgrade is agoric-upgrade-16 ([#9565](https://github.com/Agoric/agoric-sdk/issues/9565)) ([d45b478](https://github.com/Agoric/agoric-sdk/commit/d45b478fe2dd21ff463660522e1998ab3e8bbe65))
49
+ * **cosmos:** Next upgrade is agoric-upgrade-17 ([ea47c4c](https://github.com/Agoric/agoric-sdk/commit/ea47c4cb05490b97533f3a3ffa1ad2081ec30223))
53
50
  * **cosmos:** prevent VM port handlers from panicking ([afd6017](https://github.com/Agoric/agoric-sdk/commit/afd60170d453865cfa871a01e8d8a74ffef9221a))
54
51
  * **cosmos:** propagate and handle shutdown message ([ac12e6d](https://github.com/Agoric/agoric-sdk/commit/ac12e6d57b3a50e079744f7a6faced7f4bebb957))
55
- * **cosmos:** separate swing-store export data from genesis file ([9a62f0b](https://github.com/Agoric/agoric-sdk/commit/9a62f0b8af0d3ab66000fbb4befbaece3a8cddb4))
52
+ * **cosmos:** separate swing-store export data from genesis file ([f476bd5](https://github.com/Agoric/agoric-sdk/commit/f476bd50fb3ca5df0c4f43b20e059e05a2659b4c))
56
53
  * **cosmos:** separate vm server ([37e3254](https://github.com/Agoric/agoric-sdk/commit/37e325433b6024198d34052f3150951c33a29f62))
57
54
  * **cosmos:** spawn JS on export command ([592948d](https://github.com/Agoric/agoric-sdk/commit/592948dc2fada0a9d1f56581ccae42040bfe4a53))
58
55
  * **cosmos:** support core proposals set by upgrade handler ([605eb4b](https://github.com/Agoric/agoric-sdk/commit/605eb4b8f33d7646c3a9084d43ecd51029e12b80))
59
- * **cosmos:** support snapshot export ([f87aaf1](https://github.com/Agoric/agoric-sdk/commit/f87aaf13678158e925394935a5c46f61820131e2))
56
+ * **cosmos:** support snapshot export ([4386f8e](https://github.com/Agoric/agoric-sdk/commit/4386f8e67136f184b94febb5d65990a26e101cf3))
60
57
  * **cosmos:** un-wire x/crisis ([#8582](https://github.com/Agoric/agoric-sdk/issues/8582)) ([7153535](https://github.com/Agoric/agoric-sdk/commit/7153535c5c10fed309dc60f12f981c81841fdb93))
61
58
  * **cosmos:** upgrade provisioning vat ([#8901](https://github.com/Agoric/agoric-sdk/issues/8901)) ([174e37d](https://github.com/Agoric/agoric-sdk/commit/174e37d7499b372c33ecaf6e05f82f43ebfff902))
62
59
  * **cosmos:** use operational artifact level for swingset state export/restore ([161ddd3](https://github.com/Agoric/agoric-sdk/commit/161ddd34ca6c16da0ad3ef716fa5da3d2ba86b68))
63
60
  * **cosmos:** wire in vlocalchain to the Cosmos app ([3ea527d](https://github.com/Agoric/agoric-sdk/commit/3ea527d9844dcf2b5f2c60d1bfb1760e064ec0f7))
64
61
  * **cosmos:** wire new swingset port handler ([ea582bf](https://github.com/Agoric/agoric-sdk/commit/ea582bf7738f82d0abe5529ee1ac9f2e117c957a))
65
62
  * expose node service to retrieve operator config ([cb12a53](https://github.com/Agoric/agoric-sdk/commit/cb12a53422014d2a0933411a7b842cc2e06031ed))
63
+ * **golang/cosmos:** Support homeDir-relative slogfile path in app.toml ([b43877c](https://github.com/Agoric/agoric-sdk/commit/b43877cf152efef60e33a42affb6b271cfd6622d))
64
+ * **golang/cosmos:** Support relative SLOGFILE while still requiring app.toml slogfile to be absolute ([a759010](https://github.com/Agoric/agoric-sdk/commit/a75901040fe2acc3470cdc6f95228958f399959e))
66
65
  * **golang:** bump PFM to v6.1.2 ([#9120](https://github.com/Agoric/agoric-sdk/issues/9120)) ([5c28f49](https://github.com/Agoric/agoric-sdk/commit/5c28f496976128e59e0e5a8f1a8c24f7b496527d))
67
66
  * **localchain:** make `localchain.query` and `queryMany` useful ([41209d5](https://github.com/Agoric/agoric-sdk/commit/41209d5b7c1de478d3f2ae709558e3e535c4ad8d))
68
67
  * new 'boot' package with bootstrap configs ([8e3173b](https://github.com/Agoric/agoric-sdk/commit/8e3173b0b86a3dc90b31164bc4272c54e46a6641))
69
68
  * pick up return-grants from latest cosmos-sdk ([a88eb8a](https://github.com/Agoric/agoric-sdk/commit/a88eb8a21fb914e49bf436eb86aa6be8b2546269))
70
- * repair KREAd contract on zoe upgrade ([14040d4](https://github.com/Agoric/agoric-sdk/commit/14040d4fb2a1fcc8687e26ed9208d9824c579876))
69
+ * remove vaults, auctions, and priceFeeds from upgrade.go ([d064567](https://github.com/Agoric/agoric-sdk/commit/d064567df87cad9c57ea6e9d918b650785d08089))
70
+ * repair KREAd contract on zoe upgrade ([84dd229](https://github.com/Agoric/agoric-sdk/commit/84dd2297eb74061b809a11bba3c2d2c5c697219f))
71
71
  * replace zoe and zcf ([3932a80](https://github.com/Agoric/agoric-sdk/commit/3932a80802b8f1839997994b95d919acaff95c06))
72
+ * Share cosmos-sdk runtime [viper] configuration with the cosmic-swingset VM ([950511e](https://github.com/Agoric/agoric-sdk/commit/950511ef1b9b7520bd3eaf8e97cbc315a945b836)), closes [#9946](https://github.com/Agoric/agoric-sdk/issues/9946)
73
+ * Share cosmos-sdk runtime [viper] configuration with the cosmic-swingset VM ([f8c6d50](https://github.com/Agoric/agoric-sdk/commit/f8c6d50e0f20a523caf0366d0ec7ac8b0a731b8e)), closes [#9946](https://github.com/Agoric/agoric-sdk/issues/9946)
72
74
  * Simple removal of lien primarilly through code search ([#8988](https://github.com/Agoric/agoric-sdk/issues/8988)) ([695c440](https://github.com/Agoric/agoric-sdk/commit/695c440c0f48a3591b15a43665682c5f1ebbad9d))
73
75
  * start a new auction in a3p-integration ([969235b](https://github.com/Agoric/agoric-sdk/commit/969235b18abbd15187e343d5f616f12177d224c4))
74
76
  * tolerate missing files in gaia 3-way diff ([2e4d8d3](https://github.com/Agoric/agoric-sdk/commit/2e4d8d33ae77cc50b99bbdfa1083316b6cfb3584))
75
77
  * update ibc-go to v4, adapt packages and API ([0ec1b79](https://github.com/Agoric/agoric-sdk/commit/0ec1b79ea0419d8576d8806c3b670e730bf09dcd))
76
78
  * upgrade ibc-go to v6.2.1 ([fa4695d](https://github.com/Agoric/agoric-sdk/commit/fa4695dce10091a6ac0f1423a361d27986b70f26))
77
79
  * upgrade wallet-factory ([e370bff](https://github.com/Agoric/agoric-sdk/commit/e370bff50e00b7e134148332d1ccb410d626db1c))
78
- * Upgrade Zoe ([37f96ee](https://github.com/Agoric/agoric-sdk/commit/37f96eeef41c5ff06efab5ae11d4ca14e5f6f295))
80
+ * Upgrade Zoe ([ef1e0a2](https://github.com/Agoric/agoric-sdk/commit/ef1e0a216c100de89b28923a7f13251ed48e8f36))
79
81
  * **vat-transfer:** first cut at working proposal ([2864bd5](https://github.com/Agoric/agoric-sdk/commit/2864bd5c12300c3595df9676bcfde894dbe59b29))
82
+ * **vats:** upgrade the orchestration core ([c2d9530](https://github.com/Agoric/agoric-sdk/commit/c2d9530e2d891bd9412969a43a9c5728cc3c2721))
80
83
  * **vibc:** add `AsyncVersions` flag anticipating `ibc-go` ([ca5933c](https://github.com/Agoric/agoric-sdk/commit/ca5933cc41075dfba30c44cb3a987d9c721cd97d))
81
84
  * **vibc:** use triggers to raise targeted events ([b89aaca](https://github.com/Agoric/agoric-sdk/commit/b89aaca2afd7d0901fc06d7a6bab27aab38d389b))
82
85
  * **vlocalchain:** bare minimum implementation ([6e35dc6](https://github.com/Agoric/agoric-sdk/commit/6e35dc642ce08a199604b7888d4fb5bbbd4c7db1))
@@ -100,26 +103,31 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
100
103
  ### Bug Fixes
101
104
 
102
105
  * avoid broken goleveldb ([a2bfb34](https://github.com/Agoric/agoric-sdk/commit/a2bfb34d14806e6492fb3293bdfa24e2199d40c2))
103
- * **builders:** use proper `oracleBrand` subkey case ([bf531c3](https://github.com/Agoric/agoric-sdk/commit/bf531c36c83958924a1792e0c263ee38f4a65a11))
106
+ * **builders:** use proper `oracleBrand` subkey case ([52f02b7](https://github.com/Agoric/agoric-sdk/commit/52f02b75b6706ee455a32ff83617dd5afb7342a7))
107
+ * **cosmic-swingset:** add missing bits for maxVatsOnline ([8c0c177](https://github.com/Agoric/agoric-sdk/commit/8c0c17752f7439db6f7aee9f88be1dedce2a1bf1))
108
+ * **cosmic-swingset:** plumbing for maxVatsOnline ([45a759a](https://github.com/Agoric/agoric-sdk/commit/45a759a71c8abc724618a12dfd8ae72552b9783e))
104
109
  * **cosmos:** add action context to core evals ([7cfae88](https://github.com/Agoric/agoric-sdk/commit/7cfae88a1d2c31d91030a8742972d9f03d331059))
105
110
  * **cosmos:** Add support for iavl options ([c6770ec](https://github.com/Agoric/agoric-sdk/commit/c6770ece8dd7f3f56c40b3cb80be245a99e01c9d))
106
111
  * **cosmos:** correctly detect presence of Agoric VM ([c7e266e](https://github.com/Agoric/agoric-sdk/commit/c7e266e035cc454bf74e88e96959f862ece146f8))
107
112
  * **cosmos:** don't init controller before upgrade ([b4260af](https://github.com/Agoric/agoric-sdk/commit/b4260afd158c9f1c6faae8ee95019e1e7c385e5f))
113
+ * **cosmos:** don't rerun store migrations on upgrade ([8738a9b](https://github.com/Agoric/agoric-sdk/commit/8738a9bee247096da1dc72e2d2ba9c338a0cb739))
108
114
  * **cosmos:** make agd upgrade work ([1aa1d26](https://github.com/Agoric/agoric-sdk/commit/1aa1d26f05875c91fd47da1ad7386d8979f94b03))
109
115
  * **cosmos:** module order independent init and bootstrap ([e7f5b65](https://github.com/Agoric/agoric-sdk/commit/e7f5b658b67a18c0a13544515f61216598326265))
110
116
  * **cosmos:** no global state in `vm` ([ab02669](https://github.com/Agoric/agoric-sdk/commit/ab0266908ec9f36587d3521287808f7a30ed9207))
111
- * **cosmos:** only allow snapshot export at latest height ([#9601](https://github.com/Agoric/agoric-sdk/issues/9601)) ([377e093](https://github.com/Agoric/agoric-sdk/commit/377e093c1b9b4aefb8a70a4e7d24dd7cfc957c68)), closes [#9600](https://github.com/Agoric/agoric-sdk/issues/9600)
117
+ * **cosmos:** only allow snapshot export at latest height ([#9601](https://github.com/Agoric/agoric-sdk/issues/9601)) ([6bc363b](https://github.com/Agoric/agoric-sdk/commit/6bc363b5624bab5fd151ec4889b5f5116f2cf53c)), closes [#9600](https://github.com/Agoric/agoric-sdk/issues/9600)
112
118
  * **cosmos:** prevent Golang error wrapping stack frame divergence ([3390d90](https://github.com/Agoric/agoric-sdk/commit/3390d902f42a96e502d459cad224d97c9971e307))
113
119
  * **cosmos:** Support building on Linux aarch64 ([ff2e5ed](https://github.com/Agoric/agoric-sdk/commit/ff2e5ed20e52e6484a6cba126b0739b0b1fc6360))
114
120
  * **cosmos:** update more `vtransfer` app.go wiring ([a171561](https://github.com/Agoric/agoric-sdk/commit/a1715615a01fce060eb990e1b2bb9a6d6a2a3566))
115
- * **cosmos:** use dedicated dedicate app creator for non start commands ([6232a22](https://github.com/Agoric/agoric-sdk/commit/6232a22e79d3b90eeab08d0587562ecae826a0f8))
121
+ * **cosmos:** use dedicated dedicate app creator for non start commands ([84208e9](https://github.com/Agoric/agoric-sdk/commit/84208e99f5a6f57988cabe4d3f3108f72c579436))
116
122
  * **cosmos:** vm.Action returns ActionHeader pointer ([c48fe18](https://github.com/Agoric/agoric-sdk/commit/c48fe184de76d0e426274dd97adf75afcf3e0b1d))
117
123
  * **cosmos:** wrap PFM with `vtransfer`, not the other way around ([7459f16](https://github.com/Agoric/agoric-sdk/commit/7459f16fc4a3fed955341ebc2e725b6ca9727712))
118
124
  * declare `vtransfer` in `storeUpgrades.Added` ([36f7c7e](https://github.com/Agoric/agoric-sdk/commit/36f7c7edd7453032f97f0ebcc03571e2e5b0f9ef))
119
125
  * eliminate fee double-charge by using configurable decorator ([1ff7ea7](https://github.com/Agoric/agoric-sdk/commit/1ff7ea7da7aafc8b199cf681c9215ca46c31b0d6))
120
126
  * exempt more 3rd-party protos from link check ([d2602b3](https://github.com/Agoric/agoric-sdk/commit/d2602b3bead66c57e07708e3e225a9b2aea0ac39))
127
+ * **golang/cosmos:** fix-up a rebase ([59fdc6f](https://github.com/Agoric/agoric-sdk/commit/59fdc6ff6fbe6f167467c15c153c71b82a54bcf4))
121
128
  * govulncheck updates ([34d5056](https://github.com/Agoric/agoric-sdk/commit/34d505671509c6883f55cca150b610a18978d1f0))
122
129
  * handle hang-on-halt behavior from agoric-labs/cosmos-sdk[#305](https://github.com/Agoric/agoric-sdk/issues/305) ([a4fd510](https://github.com/Agoric/agoric-sdk/commit/a4fd51067ff86d84c084292d1f38b2ca3de639b9))
130
+ * **network:** introduce `Finalizer` to close network ([54b9b00](https://github.com/Agoric/agoric-sdk/commit/54b9b009fff3fd3ab54f731adee97195acaa238f))
123
131
  * pick up snapshot initiation fix ([38f6c3f](https://github.com/Agoric/agoric-sdk/commit/38f6c3f8dfd4a5ee35f6e7f85bc59853cb7325d9))
124
132
  * unwrap account keeper for app module ([20a89f0](https://github.com/Agoric/agoric-sdk/commit/20a89f06061cae01166b1b2ca738815c58dc32ed))
125
133
  * update dependencies to fix tests ([75d6b1d](https://github.com/Agoric/agoric-sdk/commit/75d6b1dcc0d7286770679bd6d042b38fa76c4312))
@@ -135,7 +143,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
135
143
  * **vtransfer:** some separation of keeper duties ([96fdbdf](https://github.com/Agoric/agoric-sdk/commit/96fdbdf7f39d785956214e3a2f1ef2f15a520a19))
136
144
  * **x/swingset:** enforce snapshot restore before init ([35f03f9](https://github.com/Agoric/agoric-sdk/commit/35f03f9f2b72b47475a3ae4c5068bee60c1278da))
137
145
  * **x/swingset:** guard snapshot restore for concurrency ([554a110](https://github.com/Agoric/agoric-sdk/commit/554a1102a08f466dad5d8291044150236896ec7a))
138
- * **x/swingset:** handle defer errors on export write ([bff716b](https://github.com/Agoric/agoric-sdk/commit/bff716be8c85ac8e165d5274d972a155536d25d7))
146
+ * **x/swingset:** handle defer errors on export write ([f1eacbe](https://github.com/Agoric/agoric-sdk/commit/f1eacbec22eb52955266e401b83bc2e324b5bde5))
139
147
  * **x/swingset:** switch export/import to replay artifact level ([6ab24b2](https://github.com/Agoric/agoric-sdk/commit/6ab24b299f31affc0a638cc6352678a2c167044c))
140
148
  * **x/vstorage:** value can be empty in genesis data ([b8a817d](https://github.com/Agoric/agoric-sdk/commit/b8a817dfa70c225741a32fb73780de75c5aa9184))
141
149
 
package/Makefile CHANGED
@@ -61,10 +61,10 @@ node-compile-gyp:
61
61
  npm run build:gyp; \
62
62
  fi
63
63
 
64
- compile-agd: go-mod-cache
64
+ compile-agd: go.sum
65
65
  go build -v $(MOD_READONLY) $(BUILD_FLAGS) -buildmode=exe -o build/agd ./cmd/agd
66
66
 
67
- install-agd: go-mod-cache
67
+ install-agd: go.sum
68
68
  go install -v $(MOD_READONLY) $(BUILD_FLAGS) -buildmode=exe ./cmd/agd
69
69
 
70
70
  # Only run from the package.json build:gyp script.
@@ -73,17 +73,18 @@ compile-gyp:
73
73
  node-gyp configure build $(GYP_DEBUG) || { status=$$?; rm -f binding.gyp; exit $$status; }
74
74
  rm -f binding.gyp
75
75
 
76
- compile-libdaemon: go-mod-cache
76
+ compile-libdaemon: go.sum
77
77
  go build -v $(MOD_READONLY) $(SHARED_BUILD_FLAGS) -buildmode=c-shared \
78
78
  -o build/libagcosmosdaemon.so ./cmd/libdaemon/main.go
79
79
 
80
- go-mod-cache: go.sum
81
- @echo "--> Download go modules to local cache"
82
- @go mod download
83
-
84
80
  go.sum: go.mod
85
- @echo "--> Ensure dependencies have not been modified"
81
+ @echo "--> Ensure dependencies have not been modified unless suppressed by SKIP_MOD_VERIFY ..."
82
+ ifndef SKIP_MOD_VERIFY
86
83
  GO111MODULE=on go mod verify
84
+ endif
85
+ GO111MODULE=on go mod tidy
86
+ @echo "--> Download go modules to local cache"
87
+ go mod download
87
88
 
88
89
  ###############################################################################
89
90
  ### Protobuf ###
package/app/app.go CHANGED
@@ -214,6 +214,7 @@ var (
214
214
  // capabilities aren't needed for testing.
215
215
  type GaiaApp struct { // nolint: golint
216
216
  *baseapp.BaseApp
217
+ resolvedConfig servertypes.AppOptions
217
218
  legacyAmino *codec.LegacyAmino
218
219
  appCodec codec.Codec
219
220
  interfaceRegistry types.InterfaceRegistry
@@ -314,9 +315,18 @@ func NewGaiaApp(
314
315
  }
315
316
 
316
317
  func NewAgoricApp(
317
- sendToController vm.Sender, agdServer *vm.AgdServer,
318
- logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, skipUpgradeHeights map[int64]bool,
319
- homePath string, invCheckPeriod uint, encodingConfig gaiaappparams.EncodingConfig, appOpts servertypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp),
318
+ sendToController vm.Sender,
319
+ agdServer *vm.AgdServer,
320
+ logger log.Logger,
321
+ db dbm.DB,
322
+ traceStore io.Writer,
323
+ loadLatest bool,
324
+ skipUpgradeHeights map[int64]bool,
325
+ homePath string,
326
+ invCheckPeriod uint,
327
+ encodingConfig gaiaappparams.EncodingConfig,
328
+ appOpts servertypes.AppOptions,
329
+ baseAppOptions ...func(*baseapp.BaseApp),
320
330
  ) *GaiaApp {
321
331
  appCodec := encodingConfig.Marshaler
322
332
  legacyAmino := encodingConfig.Amino
@@ -342,6 +352,7 @@ func NewAgoricApp(
342
352
  app := &GaiaApp{
343
353
  BaseApp: bApp,
344
354
  AgdServer: agdServer,
355
+ resolvedConfig: appOpts,
345
356
  legacyAmino: legacyAmino,
346
357
  appCodec: appCodec,
347
358
  interfaceRegistry: interfaceRegistry,
@@ -862,27 +873,26 @@ func NewAgoricApp(
862
873
  app.SetBeginBlocker(app.BeginBlocker)
863
874
  app.SetEndBlocker(app.EndBlocker)
864
875
 
865
- for name := range upgradeNamesOfThisVersion {
876
+ for _, name := range upgradeNamesOfThisVersion {
866
877
  app.UpgradeKeeper.SetUpgradeHandler(
867
878
  name,
868
- upgrade16Handler(app, name),
879
+ upgrade17Handler(app, name),
869
880
  )
870
881
  }
871
882
 
883
+ // At this point we don't have a way to read from the store, so we have to
884
+ // rely on data saved by the x/upgrade module in the previous software.
872
885
  upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk()
873
886
  if err != nil {
874
887
  panic(err)
875
888
  }
876
- if upgradeNamesOfThisVersion[upgradeInfo.Name] && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
889
+ // Store migrations can only run once, so we use a notion of "primary upgrade
890
+ // name" to trigger them. Testnets may end up upgrading from one rc to
891
+ // another, which shouldn't re-run store upgrades.
892
+ if isPrimaryUpgradeName(upgradeInfo.Name) && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
877
893
  storeUpgrades := storetypes.StoreUpgrades{
878
- Added: []string{
879
- packetforwardtypes.ModuleName, // Added PFM
880
- vlocalchain.ModuleName, // Agoric added vlocalchain
881
- vtransfer.ModuleName, // Agoric added vtransfer
882
- },
883
- Deleted: []string{
884
- "lien", // Agoric removed the lien module
885
- },
894
+ Added: []string{},
895
+ Deleted: []string{},
886
896
  }
887
897
 
888
898
  // configure store loader that checks if version == upgradeHeight and applies store upgrades
@@ -933,11 +943,12 @@ type upgradeDetails struct {
933
943
 
934
944
  type cosmosInitAction struct {
935
945
  vm.ActionHeader `actionType:"AG_COSMOS_INIT"`
936
- ChainID string `json:"chainID"`
937
- IsBootstrap bool `json:"isBootstrap"`
938
- UpgradeDetails *upgradeDetails `json:"upgradeDetails,omitempty"`
939
- Params swingset.Params `json:"params"`
940
- SupplyCoins sdk.Coins `json:"supplyCoins"`
946
+ ChainID string `json:"chainID"`
947
+ IsBootstrap bool `json:"isBootstrap"`
948
+ Params swingset.Params `json:"params"`
949
+ ResolvedConfig *swingset.SwingsetConfig `json:"resolvedConfig"`
950
+ SupplyCoins sdk.Coins `json:"supplyCoins"`
951
+ UpgradeDetails *upgradeDetails `json:"upgradeDetails,omitempty"`
941
952
  // CAVEAT: Every property ending in "Port" is saved in chain-main.js/portNums
942
953
  // with a key consisting of this name with the "Port" stripped.
943
954
  StoragePort int `json:"storagePort"`
@@ -969,10 +980,15 @@ func (app *GaiaApp) initController(ctx sdk.Context, bootstrap bool) {
969
980
  app.controllerInited = true
970
981
 
971
982
  // Begin initializing the controller here.
983
+ swingsetConfig, err := swingset.SwingsetConfigFromViper(app.resolvedConfig)
984
+ if err != nil {
985
+ panic(err)
986
+ }
972
987
  action := &cosmosInitAction{
973
988
  ChainID: ctx.ChainID(),
974
989
  IsBootstrap: bootstrap,
975
990
  Params: app.SwingSetKeeper.GetParams(ctx),
991
+ ResolvedConfig: swingsetConfig,
976
992
  SupplyCoins: sdk.NewCoins(app.BankKeeper.GetSupply(ctx, "uist")),
977
993
  UpgradeDetails: app.upgradeDetails,
978
994
  // See CAVEAT in cosmosInitAction.
package/app/upgrade.go CHANGED
@@ -1,6 +1,8 @@
1
1
  package gaia
2
2
 
3
3
  import (
4
+ "fmt"
5
+
4
6
  "github.com/Agoric/agoric-sdk/golang/cosmos/vm"
5
7
  swingsetkeeper "github.com/Agoric/agoric-sdk/golang/cosmos/x/swingset/keeper"
6
8
  sdk "github.com/cosmos/cosmos-sdk/types"
@@ -8,13 +10,52 @@ import (
8
10
  upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
9
11
  )
10
12
 
11
- var upgradeNamesOfThisVersion = map[string]bool{
12
- "agoric-upgrade-16": true,
13
- "agoric-upgrade-16-2": true,
13
+ var upgradeNamesOfThisVersion = []string{
14
+ "agoric-upgrade-17",
15
+ }
16
+
17
+ // isUpgradeNameOfThisVersion returns whether the provided plan name is a
18
+ // known upgrade name of this software version
19
+ func isUpgradeNameOfThisVersion(name string) bool {
20
+ for _, upgradeName := range upgradeNamesOfThisVersion {
21
+ if upgradeName == name {
22
+ return true
23
+ }
24
+ }
25
+ return false
26
+ }
27
+
28
+ // validUpgradeName is an identity function that asserts the provided name
29
+ // is an upgrade name of this software version. It can be used as a sort of
30
+ // dynamic enum check.
31
+ func validUpgradeName(name string) string {
32
+ if !isUpgradeNameOfThisVersion(name) {
33
+ panic(fmt.Errorf("invalid upgrade name: %s", name))
34
+ }
35
+ return name
14
36
  }
15
37
 
38
+ // isPrimaryUpgradeName returns wether the provided plan name is considered a
39
+ // primary for the purpose of applying store migrations for the first upgrade
40
+ // of this version.
41
+ // It is expected that only primary plan names are used for non testing chains.
42
+ func isPrimaryUpgradeName(name string) bool {
43
+ if name == "" {
44
+ // An empty upgrade name can happen if there are no upgrade in progress
45
+ return false
46
+ }
47
+ switch name {
48
+ case validUpgradeName("agoric-upgrade-17"):
49
+ return true
50
+ default:
51
+ panic(fmt.Errorf("unexpected upgrade name %s", validUpgradeName(name)))
52
+ }
53
+ }
54
+
55
+ // isFirstTimeUpgradeOfThisVersion looks up in the upgrade store whether no
56
+ // upgrade plan name of this version have previously been applied.
16
57
  func isFirstTimeUpgradeOfThisVersion(app *GaiaApp, ctx sdk.Context) bool {
17
- for name := range upgradeNamesOfThisVersion {
58
+ for _, name := range upgradeNamesOfThisVersion {
18
59
  if app.UpgradeKeeper.GetDoneHeight(ctx, name) != 0 {
19
60
  return false
20
61
  }
@@ -22,8 +63,8 @@ func isFirstTimeUpgradeOfThisVersion(app *GaiaApp, ctx sdk.Context) bool {
22
63
  return true
23
64
  }
24
65
 
25
- // upgrade16Handler performs standard upgrade actions plus custom actions for upgrade-16.
26
- func upgrade16Handler(app *GaiaApp, targetUpgrade string) func(sdk.Context, upgradetypes.Plan, module.VersionMap) (module.VersionMap, error) {
66
+ // upgrade17Handler performs standard upgrade actions plus custom actions for upgrade-17.
67
+ func upgrade17Handler(app *GaiaApp, targetUpgrade string) func(sdk.Context, upgradetypes.Plan, module.VersionMap) (module.VersionMap, error) {
27
68
  return func(ctx sdk.Context, plan upgradetypes.Plan, fromVm module.VersionMap) (module.VersionMap, error) {
28
69
  app.CheckControllerInited(false)
29
70
 
@@ -32,21 +73,27 @@ func upgrade16Handler(app *GaiaApp, targetUpgrade string) func(sdk.Context, upgr
32
73
  // These CoreProposalSteps are not idempotent and should only be executed
33
74
  // as part of the first upgrade using this handler on any given chain.
34
75
  if isFirstTimeUpgradeOfThisVersion(app, ctx) {
76
+ // The storeUpgrades defined in app.go only execute for the primary upgrade name
77
+ // If we got here and this first upgrade of this version does not use the
78
+ // primary upgrade name, stores have not been initialized correctly.
79
+ if !isPrimaryUpgradeName(plan.Name) {
80
+ return module.VersionMap{}, fmt.Errorf("cannot run %s as first upgrade", plan.Name)
81
+ }
82
+
35
83
  // Each CoreProposalStep runs sequentially, and can be constructed from
36
84
  // one or more modules executing in parallel within the step.
37
85
  CoreProposalSteps = []vm.CoreProposalStep{
38
- // Upgrade Zoe + ZCF
39
- vm.CoreProposalStepForModules("@agoric/builders/scripts/vats/replace-zoe.js"),
40
- // Revive KREAd characters
41
- vm.CoreProposalStepForModules("@agoric/builders/scripts/vats/revive-kread.js"),
42
-
43
- // upgrade the provisioning vat
44
- vm.CoreProposalStepForModules("@agoric/builders/scripts/vats/replace-provisioning.js"),
45
- // Enable low-level Orchestration.
46
86
  vm.CoreProposalStepForModules(
47
- "@agoric/builders/scripts/vats/init-network.js",
48
- "@agoric/builders/scripts/vats/init-localchain.js",
49
- "@agoric/builders/scripts/vats/init-transfer.js",
87
+ // Upgrade to new liveslots for repaired vow usage.
88
+ "@agoric/builders/scripts/vats/upgrade-orch-core.js",
89
+ ),
90
+ vm.CoreProposalStepForModules(
91
+ // Upgrade to new liveslots and support vows.
92
+ "@agoric/builders/scripts/smart-wallet/build-wallet-factory2-upgrade.js",
93
+ ),
94
+ vm.CoreProposalStepForModules(
95
+ // Create vat-orchestration.
96
+ "@agoric/builders/scripts/vats/init-orchestration.js",
50
97
  ),
51
98
  }
52
99
  }
@@ -6,6 +6,7 @@ import (
6
6
  "io"
7
7
  "os"
8
8
  "path/filepath"
9
+ "strings"
9
10
 
10
11
  serverconfig "github.com/cosmos/cosmos-sdk/server/config"
11
12
 
@@ -36,6 +37,7 @@ import (
36
37
  gaia "github.com/Agoric/agoric-sdk/golang/cosmos/app"
37
38
  "github.com/Agoric/agoric-sdk/golang/cosmos/app/params"
38
39
  "github.com/Agoric/agoric-sdk/golang/cosmos/vm"
40
+ swingset "github.com/Agoric/agoric-sdk/golang/cosmos/x/swingset"
39
41
  swingsetkeeper "github.com/Agoric/agoric-sdk/golang/cosmos/x/swingset/keeper"
40
42
  )
41
43
 
@@ -43,6 +45,31 @@ var AppName = "agd"
43
45
  var OnStartHook func(*vm.AgdServer, log.Logger, servertypes.AppOptions) error
44
46
  var OnExportHook func(*vm.AgdServer, log.Logger, servertypes.AppOptions) error
45
47
 
48
+ // CustomAppConfig extends the base config struct.
49
+ type CustomAppConfig struct {
50
+ serverconfig.Config `mapstructure:",squash"`
51
+ // Swingset must be named as expected by swingset.DefaultConfigTemplate
52
+ // and must use a mapstructure key matching swingset.ConfigPrefix.
53
+ Swingset swingset.SwingsetConfig `mapstructure:"swingset"`
54
+ }
55
+
56
+ type cobraRunE func(cmd *cobra.Command, args []string) error
57
+
58
+ func appendToPreRunE(cmd *cobra.Command, fn cobraRunE) {
59
+ preRunE := cmd.PreRunE
60
+ if preRunE == nil {
61
+ cmd.PreRunE = fn
62
+ return
63
+ }
64
+ composite := func(cmd *cobra.Command, args []string) error {
65
+ if err := preRunE(cmd, args); err != nil {
66
+ return err
67
+ }
68
+ return fn(cmd, args)
69
+ }
70
+ cmd.PreRunE = composite
71
+ }
72
+
46
73
  // NewRootCmd creates a new root command for simd. It is called once in the
47
74
  // main function.
48
75
  func NewRootCmd(sender vm.Sender) (*cobra.Command, params.EncodingConfig) {
@@ -99,24 +126,25 @@ func initTendermintConfig() *tmcfg.Config {
99
126
  // initAppConfig helps to override default appConfig template and configs.
100
127
  // return "", nil if no custom configuration is required for the application.
101
128
  func initAppConfig() (string, interface{}) {
102
- // Allow us to overwrite the SDK's default server config.
103
129
  srvCfg := serverconfig.DefaultConfig()
104
- // The SDK's default minimum gas price is set to "" (empty value) inside
105
- // app.toml. If left empty by validators, the node will halt on startup.
106
- // However, the chain developer can set a default app.toml value for their
107
- // validators here.
108
- //
109
- // In summary:
110
- // - if you leave srvCfg.MinGasPrices = "", all validators MUST tweak their
111
- // own app.toml config,
112
- // - if you set srvCfg.MinGasPrices non-empty, validators CAN tweak their
113
- // own app.toml to override, or use this default value.
114
- //
115
- // FIXME: We may want to have Agoric set a min gas price in uist.
116
- // For now, we set it to zero so that validators don't have to worry about it.
130
+
131
+ // FIXME: We may want a non-zero min gas price.
132
+ // For now, we set it to zero to reduce friction (the default "" fails
133
+ // startup, forcing each validator to set their own value).
117
134
  srvCfg.MinGasPrices = "0uist"
118
135
 
119
- return serverconfig.DefaultConfigTemplate, *srvCfg
136
+ customAppConfig := CustomAppConfig{
137
+ Config: *srvCfg,
138
+ Swingset: swingset.DefaultSwingsetConfig,
139
+ }
140
+
141
+ // Config TOML.
142
+ customAppTemplate := strings.Join([]string{
143
+ serverconfig.DefaultConfigTemplate,
144
+ swingset.DefaultConfigTemplate,
145
+ }, "")
146
+
147
+ return customAppTemplate, customAppConfig
120
148
  }
121
149
 
122
150
  func initRootCmd(sender vm.Sender, rootCmd *cobra.Command, encodingConfig params.EncodingConfig) {
@@ -144,10 +172,27 @@ func initRootCmd(sender vm.Sender, rootCmd *cobra.Command, encodingConfig params
144
172
  snapshot.Cmd(ac.newSnapshotsApp),
145
173
  )
146
174
 
147
- server.AddCommands(rootCmd, gaia.DefaultNodeHome, ac.newApp, ac.appExport, addModuleInitFlags)
175
+ server.AddCommands(rootCmd, gaia.DefaultNodeHome, ac.newApp, ac.appExport, addStartFlags)
148
176
 
149
177
  for _, command := range rootCmd.Commands() {
150
178
  switch command.Name() {
179
+ case "start":
180
+ var preRunE cobraRunE = func(cmd *cobra.Command, _ []string) error {
181
+ // Consume and validate config.
182
+ viper := server.GetServerContextFromCmd(cmd).Viper
183
+ baseConfig, err := serverconfig.GetConfig(viper)
184
+ if err != nil {
185
+ return err
186
+ }
187
+ if err = baseConfig.ValidateBasic(); err != nil {
188
+ return err
189
+ }
190
+ if _, err = swingset.SwingsetConfigFromViper(viper); err != nil {
191
+ return err
192
+ }
193
+ return nil
194
+ }
195
+ appendToPreRunE(command, preRunE)
151
196
  case "export":
152
197
  addAgoricVMFlags(command)
153
198
  extendCosmosExportCommand(command)
@@ -197,7 +242,7 @@ func addAgoricVMFlags(cmd *cobra.Command) {
197
242
  )
198
243
  }
199
244
 
200
- func addModuleInitFlags(startCmd *cobra.Command) {
245
+ func addStartFlags(startCmd *cobra.Command) {
201
246
  addAgoricVMFlags(startCmd)
202
247
  }
203
248
 
@@ -282,11 +327,12 @@ func (ac appCreator) newApp(
282
327
 
283
328
  homePath := cast.ToString(appOpts.Get(flags.FlagHome))
284
329
 
285
- // Set a default value for FlagSwingStoreExportDir based on the homePath
330
+ // Set a default value for FlagSwingStoreExportDir based on homePath
286
331
  // in case we need to InitGenesis with swing-store data
287
332
  viper, ok := appOpts.(*viper.Viper)
288
- if ok && cast.ToString(appOpts.Get(gaia.FlagSwingStoreExportDir)) == "" {
289
- viper.Set(gaia.FlagSwingStoreExportDir, filepath.Join(homePath, "config", ExportedSwingStoreDirectoryName))
333
+ if ok && viper.GetString(gaia.FlagSwingStoreExportDir) == "" {
334
+ exportDir := filepath.Join(homePath, "config", ExportedSwingStoreDirectoryName)
335
+ viper.Set(gaia.FlagSwingStoreExportDir, exportDir)
290
336
  }
291
337
 
292
338
  return gaia.NewAgoricApp(
package/git-revision.txt CHANGED
@@ -1 +1 @@
1
- 2eaeab90b
1
+ 515c4c0ef
package/go.mod CHANGED
@@ -17,6 +17,7 @@ require (
17
17
  github.com/rakyll/statik v0.1.7
18
18
  github.com/spf13/cast v1.5.0
19
19
  github.com/spf13/cobra v1.7.0
20
+ github.com/spf13/pflag v1.0.5
20
21
  github.com/spf13/viper v1.14.0
21
22
  github.com/stretchr/testify v1.8.4
22
23
  github.com/tendermint/tendermint v0.34.29
@@ -133,7 +134,6 @@ require (
133
134
  github.com/sasha-s/go-deadlock v0.3.1 // indirect
134
135
  github.com/spf13/afero v1.9.2 // indirect
135
136
  github.com/spf13/jwalterweatherman v1.1.0 // indirect
136
- github.com/spf13/pflag v1.0.5 // indirect
137
137
  github.com/subosito/gotenv v1.4.1 // indirect
138
138
  github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
139
139
  github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/cosmos",
3
- "version": "0.35.0-u16.1",
3
+ "version": "0.35.0-u17.0",
4
4
  "description": "Connect JS to the Cosmos blockchain SDK",
5
5
  "parsers": {
6
6
  "js": "mjs"
@@ -9,7 +9,7 @@
9
9
  "engines": {
10
10
  "node": "^18.12 || ^20.9"
11
11
  },
12
- "packageManager": "yarn@1.22.19",
12
+ "packageManager": "yarn@1.22.22",
13
13
  "scripts": {
14
14
  "test": "exit 0",
15
15
  "build:all": "make",
@@ -39,5 +39,5 @@
39
39
  "typeCoverage": {
40
40
  "atLeast": 0
41
41
  },
42
- "gitHead": "2eaeab90b4015e355faea534c1c933351d25b1b9"
42
+ "gitHead": "515c4c0efccfc91b97da30037c10fc4b076851e2"
43
43
  }
package/util/util.go ADDED
@@ -0,0 +1,21 @@
1
+ package util
2
+
3
+ import (
4
+ "github.com/spf13/viper"
5
+ )
6
+
7
+ func IndexOf[T comparable](a []T, x T) int {
8
+ for i, s := range a {
9
+ if s == x {
10
+ return i
11
+ }
12
+ }
13
+ return -1
14
+ }
15
+
16
+ func NewFileOnlyViper(v1 *viper.Viper) (*viper.Viper, error) {
17
+ v2 := viper.New()
18
+ v2.SetConfigFile(v1.ConfigFileUsed())
19
+ err := v2.ReadInConfig()
20
+ return v2, err
21
+ }
@@ -0,0 +1,234 @@
1
+ package swingset
2
+
3
+ import (
4
+ "fmt"
5
+ "path/filepath"
6
+
7
+ "github.com/spf13/viper"
8
+
9
+ "github.com/cosmos/cosmos-sdk/client/flags"
10
+ pruningtypes "github.com/cosmos/cosmos-sdk/pruning/types"
11
+ serverconfig "github.com/cosmos/cosmos-sdk/server/config"
12
+ servertypes "github.com/cosmos/cosmos-sdk/server/types"
13
+
14
+ "github.com/Agoric/agoric-sdk/golang/cosmos/util"
15
+ )
16
+
17
+ const (
18
+ ConfigPrefix = "swingset"
19
+ FlagSlogfile = ConfigPrefix + ".slogfile"
20
+ FlagVatSnapshotArchiveDir = ConfigPrefix + ".vat-snapshot-archive-dir"
21
+ FlagVatTranscriptArchiveDir = ConfigPrefix + ".vat-transcript-archive-dir"
22
+
23
+ SnapshotRetentionOptionDebug = "debug"
24
+ SnapshotRetentionOptionOperational = "operational"
25
+
26
+ TranscriptRetentionOptionArchival = "archival"
27
+ TranscriptRetentionOptionOperational = "operational"
28
+ )
29
+
30
+ var snapshotRetentionValues []string = []string{
31
+ SnapshotRetentionOptionDebug,
32
+ SnapshotRetentionOptionOperational,
33
+ }
34
+
35
+ var transcriptRetentionValues []string = []string{
36
+ TranscriptRetentionOptionArchival,
37
+ TranscriptRetentionOptionOperational,
38
+ }
39
+
40
+ // DefaultConfigTemplate defines a default TOML configuration section for the SwingSet VM.
41
+ // Values are pulled from a "Swingset" property, in accord with CustomAppConfig from
42
+ // ../../daemon/cmd/root.go.
43
+ // See https://github.com/cosmos/cosmos-sdk/issues/20097 for auto-synchronization ideas.
44
+ const DefaultConfigTemplate = `
45
+ ###############################################################################
46
+ ### SwingSet Configuration ###
47
+ ###############################################################################
48
+
49
+ [swingset]
50
+ # The path at which a SwingSet log "slog" file should be written.
51
+ # If relative, it is interpreted against the application home directory
52
+ # (e.g., ~/.agoric).
53
+ # May be overridden by a SLOGFILE environment variable, which if relative is
54
+ # interpreted against the working directory.
55
+ slogfile = "{{ .Swingset.SlogFile }}"
56
+
57
+ # The maximum number of vats that the SwingSet kernel will bring online. A lower number
58
+ # requires less memory but may have a negative performance impact if vats need to
59
+ # be frequently paged out to remain under this limit.
60
+ max-vats-online = {{ .Swingset.MaxVatsOnline }}
61
+
62
+ # Retention of vat snapshots, with values analogous to those of export
63
+ # 'artifactMode' (cf.
64
+ # https://github.com/Agoric/agoric-sdk/blob/master/packages/swing-store/docs/data-export.md#optional--historical-data ).
65
+ # * "debug": keep all snapshots
66
+ # * "operational": keep only the last snapshot
67
+ vat-snapshot-retention = "{{ .Swingset.VatSnapshotRetention }}"
68
+
69
+ # Retention of vat transcript spans, with values analogous to those of export
70
+ # 'artifactMode' (cf.
71
+ # https://github.com/Agoric/agoric-sdk/blob/master/packages/swing-store/docs/data-export.md#optional--historical-data ).
72
+ # * "archival": keep all transcript spans
73
+ # * "operational": keep only necessary transcript spans (i.e., since the
74
+ # last snapshot of their vat)
75
+ # * "default": determined by 'pruning' ("archival" if 'pruning' is "nothing",
76
+ # otherwise "operational")
77
+ vat-transcript-retention = "{{ .Swingset.VatTranscriptRetention }}"
78
+
79
+ # Archival of gzipped vat snapshots.
80
+ vat-snapshot-archive-dir = "{{ .Swingset.VatSnapshotArchiveDir }}"
81
+
82
+ # Archival of historical (i.e., closed) vat transcript spans to gzipped files.
83
+ vat-transcript-archive-dir = "{{ .Swingset.VatTranscriptArchiveDir }}"
84
+ `
85
+
86
+ // SwingsetConfig defines configuration for the SwingSet VM.
87
+ // "mapstructure" tag data is used to direct reads from app.toml;
88
+ // "json" tag data is used to populate init messages for the VM.
89
+ // This should be kept in sync with SwingsetConfigShape in
90
+ // ../../../../packages/cosmic-swingset/src/chain-main.js.
91
+ // TODO: Consider extensions from docs/env.md.
92
+ type SwingsetConfig struct {
93
+ // SlogFile is the path at which a SwingSet log "slog" file should be written.
94
+ // If relative, it is interpreted against the application home directory
95
+ SlogFile string `mapstructure:"slogfile" json:"slogfile,omitempty"`
96
+
97
+ // MaxVatsOnline is the maximum number of vats that the SwingSet kernel will have online
98
+ // at any given time.
99
+ MaxVatsOnline int `mapstructure:"max-vats-online" json:"maxVatsOnline,omitempty"`
100
+
101
+ // VatSnapshotRetention controls retention of vat snapshots,
102
+ // and has values analogous to those of export `artifactMode` (cf.
103
+ // ../../../../packages/swing-store/docs/data-export.md#optional--historical-data ).
104
+ // * "debug": keep all snapshots
105
+ // * "operational": keep only the last snapshot
106
+ VatSnapshotRetention string `mapstructure:"vat-snapshot-retention" json:"vatSnapshotRetention,omitempty"`
107
+
108
+ // VatTranscriptRetention controls retention of vat transcript spans,
109
+ // and has values analogous to those of export `artifactMode` (cf.
110
+ // ../../../../packages/swing-store/docs/data-export.md#optional--historical-data ).
111
+ // * "archival": keep all transcript spans
112
+ // * "operational": keep only necessary transcript spans (i.e., since the
113
+ // last snapshot of their vat)
114
+ // * "default": determined by `pruning` ("archival" if `pruning` is
115
+ // "nothing", otherwise "operational")
116
+ VatTranscriptRetention string `mapstructure:"vat-transcript-retention" json:"vatTranscriptRetention,omitempty"`
117
+
118
+ // VatSnapshotArchiveDir controls archival of gzipped vat snapshots.
119
+ VatSnapshotArchiveDir string `mapstructure:"vat-snapshot-archive-dir" json:"vatSnapshotArchiveDir,omitempty"`
120
+
121
+ // VatTranscriptArchiveDir controls archival of historical (i.e., closed) vat
122
+ // transcript spans to gzipped files.
123
+ VatTranscriptArchiveDir string `mapstructure:"vat-transcript-archive-dir" json:"vatTranscriptArchiveDir,omitempty"`
124
+ }
125
+
126
+ var DefaultSwingsetConfig = SwingsetConfig{
127
+ SlogFile: "",
128
+ MaxVatsOnline: 50,
129
+ VatSnapshotRetention: "operational",
130
+ VatTranscriptRetention: "default",
131
+ }
132
+
133
+ func SwingsetConfigFromViper(resolvedConfig servertypes.AppOptions) (*SwingsetConfig, error) {
134
+ v, ok := resolvedConfig.(*viper.Viper)
135
+ if !ok {
136
+ // Tolerate an apparently empty configuration such as
137
+ // cosmos/cosmos-sdk/simapp EmptyAppOptions, but otherwise require viper.
138
+ if resolvedConfig.Get(flags.FlagHome) != nil {
139
+ return nil, fmt.Errorf("expected an instance of viper!")
140
+ }
141
+ }
142
+ if v == nil {
143
+ return nil, nil
144
+ }
145
+ v.MustBindEnv(FlagSlogfile, "SLOGFILE")
146
+ // See CustomAppConfig in ../../daemon/cmd/root.go.
147
+ type ExtendedConfig struct {
148
+ serverconfig.Config `mapstructure:",squash"`
149
+ Swingset SwingsetConfig `mapstructure:"swingset"`
150
+ }
151
+ extendedConfig := ExtendedConfig{}
152
+ if err := v.Unmarshal(&extendedConfig); err != nil {
153
+ return nil, err
154
+ }
155
+ ssConfig := &extendedConfig.Swingset
156
+
157
+ // Validate vat snapshot retention only if non-empty (because otherwise it
158
+ // it will be omitted, leaving the VM to apply its own defaults).
159
+ if ssConfig.VatSnapshotRetention != "" {
160
+ if util.IndexOf(snapshotRetentionValues, ssConfig.VatSnapshotRetention) == -1 {
161
+ err := fmt.Errorf(
162
+ "value for vat-snapshot-retention must be in %q",
163
+ snapshotRetentionValues,
164
+ )
165
+ return nil, err
166
+ }
167
+ }
168
+
169
+ // Default/validate vat transcript retention.
170
+ if ssConfig.VatTranscriptRetention == "" || ssConfig.VatTranscriptRetention == "default" {
171
+ if extendedConfig.Pruning == pruningtypes.PruningOptionNothing {
172
+ ssConfig.VatTranscriptRetention = TranscriptRetentionOptionArchival
173
+ } else {
174
+ ssConfig.VatTranscriptRetention = TranscriptRetentionOptionOperational
175
+ }
176
+ }
177
+ if util.IndexOf(transcriptRetentionValues, ssConfig.VatTranscriptRetention) == -1 {
178
+ valuesCopy := append([]string{}, transcriptRetentionValues...)
179
+ err := fmt.Errorf(
180
+ "value for vat-transcript-retention must be in %q",
181
+ append(valuesCopy, "default"),
182
+ )
183
+ return nil, err
184
+ }
185
+
186
+ // Interpret relative paths from config files against the application home
187
+ // directory and from other sources (e.g. env vars) against the current
188
+ // working directory.
189
+ var fileOnlyViper *viper.Viper
190
+ resolvePath := func(path, configKey string) (string, error) {
191
+ if path == "" || filepath.IsAbs(path) {
192
+ return path, nil
193
+ }
194
+ if v.InConfig(configKey) {
195
+ if fileOnlyViper == nil {
196
+ var err error
197
+ fileOnlyViper, err = util.NewFileOnlyViper(v)
198
+ if err != nil {
199
+ return "", err
200
+ }
201
+ }
202
+ pathFromFile := fileOnlyViper.GetString(configKey)
203
+ if path == pathFromFile {
204
+ homePath := viper.GetString(flags.FlagHome)
205
+ if homePath == "" {
206
+ return "", fmt.Errorf("cannot resolve path against empty application home")
207
+ }
208
+ absHomePath, err := filepath.Abs(homePath)
209
+ return filepath.Join(absHomePath, path), err
210
+ }
211
+ }
212
+ return filepath.Abs(path)
213
+ }
214
+
215
+ resolvedSlogFile, err := resolvePath(ssConfig.SlogFile, FlagSlogfile)
216
+ if err != nil {
217
+ return nil, err
218
+ }
219
+ ssConfig.SlogFile = resolvedSlogFile
220
+
221
+ resolvedSnapshotDir, err := resolvePath(ssConfig.VatSnapshotArchiveDir, FlagVatSnapshotArchiveDir)
222
+ if err != nil {
223
+ return nil, err
224
+ }
225
+ ssConfig.VatSnapshotArchiveDir = resolvedSnapshotDir
226
+
227
+ resolvedTranscriptDir, err := resolvePath(ssConfig.VatTranscriptArchiveDir, FlagVatTranscriptArchiveDir)
228
+ if err != nil {
229
+ return nil, err
230
+ }
231
+ ssConfig.VatTranscriptArchiveDir = resolvedTranscriptDir
232
+
233
+ return ssConfig, nil
234
+ }
@@ -1,6 +1,8 @@
1
1
  package types
2
2
 
3
3
  import (
4
+ fmt "fmt"
5
+
4
6
  sdkioerrors "cosmossdk.io/errors"
5
7
  "github.com/Agoric/agoric-sdk/golang/cosmos/vm"
6
8
  capability "github.com/cosmos/cosmos-sdk/x/capability/types"
@@ -221,7 +223,10 @@ func (im IBCModule) OnChanCloseInit(
221
223
  }
222
224
 
223
225
  err := im.impl.PushAction(ctx, event)
224
- return err
226
+ if err != nil {
227
+ return err
228
+ }
229
+ return fmt.Errorf("OnChanCloseInit can only be sent by the VM")
225
230
  }
226
231
 
227
232
  type ChannelCloseConfirmEvent struct {
@@ -50,7 +50,7 @@ func NewIBCMiddleware(ibcModule porttypes.IBCModule, vtransferKeeper keeper.Keep
50
50
  // wrapped IBCModule. They are not performed in the context of a packet, and so
51
51
  // do not need to be intercepted.
52
52
 
53
- // OnChanCloseInit implements the IBCModule interface.
53
+ // OnChanOpenInit implements the IBCModule interface.
54
54
  func (im IBCMiddleware) OnChanOpenInit(
55
55
  ctx sdk.Context,
56
56
  order channeltypes.Order,