@agoric/cosmic-swingset 0.41.4-dev-a1dd248.0 → 0.41.4-dev-a9d113a.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 +12 -12
- package/src/launch-chain.js +34 -1
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-a9d113a.0+a9d113a",
|
|
4
4
|
"description": "Agoric's Cosmos blockchain integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -22,16 +22,16 @@
|
|
|
22
22
|
"author": "Agoric",
|
|
23
23
|
"license": "Apache-2.0",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@agoric/assert": "0.6.1-dev-
|
|
26
|
-
"@agoric/builders": "0.1.1-dev-
|
|
27
|
-
"@agoric/cosmos": "0.34.2-dev-
|
|
28
|
-
"@agoric/deploy-script-support": "0.10.4-dev-
|
|
29
|
-
"@agoric/internal": "0.3.3-dev-
|
|
30
|
-
"@agoric/store": "0.9.3-dev-
|
|
31
|
-
"@agoric/swing-store": "0.9.2-dev-
|
|
32
|
-
"@agoric/swingset-vat": "0.32.3-dev-
|
|
33
|
-
"@agoric/telemetry": "0.6.3-dev-
|
|
34
|
-
"@agoric/vm-config": "0.1.1-dev-
|
|
25
|
+
"@agoric/assert": "0.6.1-dev-a9d113a.0+a9d113a",
|
|
26
|
+
"@agoric/builders": "0.1.1-dev-a9d113a.0+a9d113a",
|
|
27
|
+
"@agoric/cosmos": "0.34.2-dev-a9d113a.0+a9d113a",
|
|
28
|
+
"@agoric/deploy-script-support": "0.10.4-dev-a9d113a.0+a9d113a",
|
|
29
|
+
"@agoric/internal": "0.3.3-dev-a9d113a.0+a9d113a",
|
|
30
|
+
"@agoric/store": "0.9.3-dev-a9d113a.0+a9d113a",
|
|
31
|
+
"@agoric/swing-store": "0.9.2-dev-a9d113a.0+a9d113a",
|
|
32
|
+
"@agoric/swingset-vat": "0.32.3-dev-a9d113a.0+a9d113a",
|
|
33
|
+
"@agoric/telemetry": "0.6.3-dev-a9d113a.0+a9d113a",
|
|
34
|
+
"@agoric/vm-config": "0.1.1-dev-a9d113a.0+a9d113a",
|
|
35
35
|
"@endo/bundle-source": "^2.7.0",
|
|
36
36
|
"@endo/far": "^0.2.21",
|
|
37
37
|
"@endo/import-bundle": "^0.4.1",
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"typeCoverage": {
|
|
70
70
|
"atLeast": 79.4
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "a9d113a09dfd93889ae985533535df53fdc771e7"
|
|
73
73
|
}
|
package/src/launch-chain.js
CHANGED
|
@@ -497,6 +497,9 @@ export async function launch({
|
|
|
497
497
|
}
|
|
498
498
|
|
|
499
499
|
let savedHeight = Number(kvStore.get(getHostKey('height')) || 0);
|
|
500
|
+
let savedBeginHeight = Number(
|
|
501
|
+
kvStore.get(getHostKey('beginHeight')) || savedHeight,
|
|
502
|
+
);
|
|
500
503
|
let runTime = 0;
|
|
501
504
|
let chainTime;
|
|
502
505
|
let saveTime = 0;
|
|
@@ -711,6 +714,11 @@ export async function launch({
|
|
|
711
714
|
throw decohered;
|
|
712
715
|
}
|
|
713
716
|
|
|
717
|
+
function saveBeginHeight(blockHeight) {
|
|
718
|
+
savedBeginHeight = blockHeight;
|
|
719
|
+
kvStore.set(getHostKey('beginHeight'), `${savedBeginHeight}`);
|
|
720
|
+
}
|
|
721
|
+
|
|
714
722
|
async function afterCommit(blockHeight, blockTime) {
|
|
715
723
|
await waitUntilQuiescent()
|
|
716
724
|
.then(afterCommitCallback)
|
|
@@ -741,7 +749,7 @@ export async function launch({
|
|
|
741
749
|
// This only runs for the very first block on the chain.
|
|
742
750
|
if (isBootstrap) {
|
|
743
751
|
verboseBlocks && blockManagerConsole.info('block bootstrap');
|
|
744
|
-
savedHeight === 0 ||
|
|
752
|
+
(savedHeight === 0 && savedBeginHeight === 0) ||
|
|
745
753
|
Fail`Cannot run a bootstrap block at height ${savedHeight}`;
|
|
746
754
|
const bootstrapBlockParams = parseParams(params);
|
|
747
755
|
const blockHeight = 0;
|
|
@@ -749,6 +757,9 @@ export async function launch({
|
|
|
749
757
|
type: 'cosmic-swingset-bootstrap-block-start',
|
|
750
758
|
blockTime,
|
|
751
759
|
});
|
|
760
|
+
// Start a block transaction, but without changing state
|
|
761
|
+
// for the upcoming begin block check
|
|
762
|
+
saveBeginHeight(savedBeginHeight);
|
|
752
763
|
await processAction(action.type, async () =>
|
|
753
764
|
bootstrapBlock(blockHeight, blockTime, bootstrapBlockParams),
|
|
754
765
|
);
|
|
@@ -780,6 +791,10 @@ export async function launch({
|
|
|
780
791
|
return undefined;
|
|
781
792
|
}
|
|
782
793
|
|
|
794
|
+
// Start a block transaction, but without changing state
|
|
795
|
+
// for the upcoming begin block check
|
|
796
|
+
saveBeginHeight(savedBeginHeight);
|
|
797
|
+
|
|
783
798
|
controller.writeSlogObject({
|
|
784
799
|
type: 'cosmic-swingset-upgrade-start',
|
|
785
800
|
blockHeight,
|
|
@@ -910,6 +925,17 @@ export async function launch({
|
|
|
910
925
|
blockManagerConsole.info('block', blockHeight, 'begin');
|
|
911
926
|
runTime = 0;
|
|
912
927
|
|
|
928
|
+
if (blockNeedsExecution(blockHeight)) {
|
|
929
|
+
if (savedBeginHeight === blockHeight) {
|
|
930
|
+
decohered = Error(
|
|
931
|
+
`Inconsistent committed state. Block ${blockHeight} had already began execution`,
|
|
932
|
+
);
|
|
933
|
+
throw decohered;
|
|
934
|
+
}
|
|
935
|
+
// Start a block transaction, recording which block height is executed
|
|
936
|
+
saveBeginHeight(blockHeight);
|
|
937
|
+
}
|
|
938
|
+
|
|
913
939
|
controller.writeSlogObject({
|
|
914
940
|
type: 'cosmic-swingset-begin-block',
|
|
915
941
|
blockHeight,
|
|
@@ -947,6 +973,13 @@ export async function launch({
|
|
|
947
973
|
throw e;
|
|
948
974
|
}
|
|
949
975
|
} else {
|
|
976
|
+
if (blockHeight !== savedBeginHeight) {
|
|
977
|
+
decohered = Error(
|
|
978
|
+
`Inconsistent committed state. Trying to end block ${blockHeight}, expected began block ${savedBeginHeight}`,
|
|
979
|
+
);
|
|
980
|
+
throw decohered;
|
|
981
|
+
}
|
|
982
|
+
|
|
950
983
|
// And now we actually process the queued actions down here, during
|
|
951
984
|
// END_BLOCK, but still reentrancy-protected.
|
|
952
985
|
|