@agoric/cosmic-swingset 0.41.4-dev-91f5e93.0 → 0.41.4-dev-e28392f.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/package.json +10 -10
- package/src/chain-main.js +2 -4
- package/src/launch-chain.js +60 -39
- package/src/sim-chain.js +3 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/cosmic-swingset",
|
|
3
|
-
"version": "0.41.4-dev-
|
|
3
|
+
"version": "0.41.4-dev-e28392f.0+e28392f",
|
|
4
4
|
"description": "Agoric's Cosmos blockchain integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
"author": "Agoric",
|
|
23
23
|
"license": "Apache-2.0",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@agoric/assert": "0.6.1-dev-
|
|
26
|
-
"@agoric/cosmos": "0.34.2-dev-
|
|
27
|
-
"@agoric/deploy-script-support": "0.10.4-dev-
|
|
28
|
-
"@agoric/internal": "0.3.3-dev-
|
|
29
|
-
"@agoric/store": "0.9.3-dev-
|
|
30
|
-
"@agoric/swing-store": "0.9.2-dev-
|
|
31
|
-
"@agoric/swingset-vat": "0.32.3-dev-
|
|
32
|
-
"@agoric/telemetry": "0.6.3-dev-
|
|
25
|
+
"@agoric/assert": "0.6.1-dev-e28392f.0+e28392f",
|
|
26
|
+
"@agoric/cosmos": "0.34.2-dev-e28392f.0+e28392f",
|
|
27
|
+
"@agoric/deploy-script-support": "0.10.4-dev-e28392f.0+e28392f",
|
|
28
|
+
"@agoric/internal": "0.3.3-dev-e28392f.0+e28392f",
|
|
29
|
+
"@agoric/store": "0.9.3-dev-e28392f.0+e28392f",
|
|
30
|
+
"@agoric/swing-store": "0.9.2-dev-e28392f.0+e28392f",
|
|
31
|
+
"@agoric/swingset-vat": "0.32.3-dev-e28392f.0+e28392f",
|
|
32
|
+
"@agoric/telemetry": "0.6.3-dev-e28392f.0+e28392f",
|
|
33
33
|
"@endo/far": "^0.2.19",
|
|
34
34
|
"@endo/import-bundle": "^0.3.5",
|
|
35
35
|
"@endo/init": "^0.5.57",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
],
|
|
61
61
|
"timeout": "20m"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "e28392f880293ee3398c739aeb0e6887feb897ec"
|
|
64
64
|
}
|
package/src/chain-main.js
CHANGED
|
@@ -45,8 +45,6 @@ import { performStateSyncImport } from './import-kernel-db.js';
|
|
|
45
45
|
// eslint-disable-next-line no-unused-vars
|
|
46
46
|
let whenHellFreezesOver = null;
|
|
47
47
|
|
|
48
|
-
const AG_COSMOS_INIT = 'AG_COSMOS_INIT';
|
|
49
|
-
|
|
50
48
|
const TELEMETRY_SERVICE_NAME = 'agd-cosmos';
|
|
51
49
|
|
|
52
50
|
const toNumber = specimen => {
|
|
@@ -619,7 +617,7 @@ export default async function main(progname, args, { env, homedir, agcc }) {
|
|
|
619
617
|
await null;
|
|
620
618
|
|
|
621
619
|
switch (action.type) {
|
|
622
|
-
case AG_COSMOS_INIT: {
|
|
620
|
+
case ActionType.AG_COSMOS_INIT: {
|
|
623
621
|
// console.error('got AG_COSMOS_INIT', action);
|
|
624
622
|
|
|
625
623
|
!blockingSend || Fail`Swingset already initialized`;
|
|
@@ -644,7 +642,7 @@ export default async function main(progname, args, { env, homedir, agcc }) {
|
|
|
644
642
|
// Ensure that initialization has completed.
|
|
645
643
|
blockingSend = await launchAndInitializeSwingSet(action);
|
|
646
644
|
|
|
647
|
-
return
|
|
645
|
+
return blockingSend(action);
|
|
648
646
|
}
|
|
649
647
|
|
|
650
648
|
// Snapshot actions are specific to cosmos chains and handled here
|
package/src/launch-chain.js
CHANGED
|
@@ -672,14 +672,9 @@ export async function launch({
|
|
|
672
672
|
|
|
673
673
|
// Handle block related actions
|
|
674
674
|
// Some actions that are integration specific may be handled by the caller
|
|
675
|
-
// For example COSMOS_SNAPSHOT
|
|
676
|
-
async function
|
|
677
|
-
|
|
678
|
-
throw decohered;
|
|
679
|
-
}
|
|
680
|
-
|
|
681
|
-
await afterCommitWorkDone;
|
|
682
|
-
|
|
675
|
+
// For example COSMOS_SNAPSHOT is handled in chain-main.js
|
|
676
|
+
async function doBlockingSend(action) {
|
|
677
|
+
await null;
|
|
683
678
|
// blockManagerConsole.warn(
|
|
684
679
|
// 'FIGME: blockHeight',
|
|
685
680
|
// action.blockHeight,
|
|
@@ -687,38 +682,55 @@ export async function launch({
|
|
|
687
682
|
// action.type,
|
|
688
683
|
// );
|
|
689
684
|
switch (action.type) {
|
|
690
|
-
case ActionType.
|
|
685
|
+
case ActionType.AG_COSMOS_INIT: {
|
|
686
|
+
const { isBootstrap, upgradePlan, blockTime } = action;
|
|
691
687
|
// This only runs for the very first block on the chain.
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
688
|
+
if (isBootstrap) {
|
|
689
|
+
verboseBlocks && blockManagerConsole.info('block bootstrap');
|
|
690
|
+
savedHeight === 0 ||
|
|
691
|
+
Fail`Cannot run a bootstrap block at height ${savedHeight}`;
|
|
692
|
+
const blockHeight = 0;
|
|
693
|
+
const runNum = 0;
|
|
694
|
+
controller.writeSlogObject({
|
|
695
|
+
type: 'cosmic-swingset-bootstrap-block-start',
|
|
696
|
+
blockTime,
|
|
697
|
+
});
|
|
698
|
+
controller.writeSlogObject({
|
|
699
|
+
type: 'cosmic-swingset-run-start',
|
|
700
|
+
blockHeight,
|
|
701
|
+
runNum,
|
|
702
|
+
});
|
|
703
|
+
await processAction(action.type, async () =>
|
|
704
|
+
bootstrapBlock(blockHeight, blockTime),
|
|
705
|
+
);
|
|
706
|
+
controller.writeSlogObject({
|
|
707
|
+
type: 'cosmic-swingset-run-finish',
|
|
708
|
+
blockHeight,
|
|
709
|
+
runNum,
|
|
710
|
+
});
|
|
711
|
+
controller.writeSlogObject({
|
|
712
|
+
type: 'cosmic-swingset-bootstrap-block-finish',
|
|
713
|
+
blockTime,
|
|
714
|
+
});
|
|
696
715
|
}
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
});
|
|
716
|
-
await pendingSwingStoreExport;
|
|
717
|
-
controller.writeSlogObject({
|
|
718
|
-
type: 'cosmic-swingset-bootstrap-block-finish',
|
|
719
|
-
blockTime,
|
|
720
|
-
});
|
|
721
|
-
return undefined;
|
|
716
|
+
if (upgradePlan) {
|
|
717
|
+
const blockHeight = upgradePlan.height;
|
|
718
|
+
if (blockNeedsExecution(blockHeight)) {
|
|
719
|
+
controller.writeSlogObject({
|
|
720
|
+
type: 'cosmic-swingset-upgrade-start',
|
|
721
|
+
blockHeight,
|
|
722
|
+
blockTime,
|
|
723
|
+
upgradePlan,
|
|
724
|
+
});
|
|
725
|
+
// TODO: Process upgrade plan
|
|
726
|
+
controller.writeSlogObject({
|
|
727
|
+
type: 'cosmic-swingset-upgrade-finish',
|
|
728
|
+
blockHeight,
|
|
729
|
+
blockTime,
|
|
730
|
+
});
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
return true;
|
|
722
734
|
}
|
|
723
735
|
|
|
724
736
|
case ActionType.COMMIT_BLOCK: {
|
|
@@ -825,7 +837,7 @@ export async function launch({
|
|
|
825
837
|
|
|
826
838
|
// We write out our on-chain state as a number of chainSends.
|
|
827
839
|
const start = Date.now();
|
|
828
|
-
await
|
|
840
|
+
await saveChainState();
|
|
829
841
|
chainTime = Date.now() - start;
|
|
830
842
|
|
|
831
843
|
// Advance our saved state variables.
|
|
@@ -848,6 +860,15 @@ export async function launch({
|
|
|
848
860
|
}
|
|
849
861
|
}
|
|
850
862
|
}
|
|
863
|
+
async function blockingSend(action) {
|
|
864
|
+
if (decohered) {
|
|
865
|
+
throw decohered;
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
await afterCommitWorkDone;
|
|
869
|
+
|
|
870
|
+
return doBlockingSend(action).finally(() => pendingSwingStoreExport);
|
|
871
|
+
}
|
|
851
872
|
|
|
852
873
|
async function shutdown() {
|
|
853
874
|
return controller.shutdown();
|
package/src/sim-chain.js
CHANGED
|
@@ -201,11 +201,12 @@ export async function connectToFakeChain(basedir, GCI, delay, inbound) {
|
|
|
201
201
|
return;
|
|
202
202
|
}
|
|
203
203
|
// The before-first-block is special... do it now.
|
|
204
|
-
// This emulates what x/swingset does
|
|
204
|
+
// This emulates what x/swingset does when bootstrapping
|
|
205
205
|
// before continuing with the real initialHeight.
|
|
206
206
|
await blockingSend({
|
|
207
|
-
type: '
|
|
207
|
+
type: 'AG_COSMOS_INIT',
|
|
208
208
|
blockTime: scaleBlockTime(Date.now()),
|
|
209
|
+
isBootstrap: true,
|
|
209
210
|
});
|
|
210
211
|
blockHeight = initialHeight;
|
|
211
212
|
};
|