@proto-kit/protocol 0.1.1-develop.1316 → 0.1.1-develop.1347
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/dist/hooks/AccountStateHook.d.ts +3 -3
- package/dist/hooks/AccountStateHook.d.ts.map +1 -1
- package/dist/hooks/AccountStateHook.js +6 -2
- package/dist/hooks/AccountStateHook.js.map +1 -1
- package/dist/hooks/LastStateRootBlockHook.d.ts +3 -4
- package/dist/hooks/LastStateRootBlockHook.d.ts.map +1 -1
- package/dist/hooks/LastStateRootBlockHook.js +4 -4
- package/dist/hooks/LastStateRootBlockHook.js.map +1 -1
- package/dist/hooks/NoopBlockHook.d.ts +3 -4
- package/dist/hooks/NoopBlockHook.d.ts.map +1 -1
- package/dist/hooks/NoopBlockHook.js +1 -1
- package/dist/hooks/NoopBlockHook.js.map +1 -1
- package/dist/hooks/NoopTransactionHook.d.ts +2 -2
- package/dist/hooks/NoopTransactionHook.d.ts.map +1 -1
- package/dist/hooks/NoopTransactionHook.js +4 -1
- package/dist/hooks/NoopTransactionHook.js.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/model/AppliedStateTransitionBatch.d.ts +114 -0
- package/dist/model/AppliedStateTransitionBatch.d.ts.map +1 -0
- package/dist/model/AppliedStateTransitionBatch.js +16 -0
- package/dist/model/AppliedStateTransitionBatch.js.map +1 -0
- package/dist/model/StateTransition.d.ts +1 -0
- package/dist/model/StateTransition.d.ts.map +1 -1
- package/dist/model/StateTransition.js +5 -0
- package/dist/model/StateTransition.js.map +1 -1
- package/dist/model/StateTransitionProvableBatch.d.ts +249 -97
- package/dist/model/StateTransitionProvableBatch.d.ts.map +1 -1
- package/dist/model/StateTransitionProvableBatch.js +72 -65
- package/dist/model/StateTransitionProvableBatch.js.map +1 -1
- package/dist/model/transaction/RuntimeTransaction.d.ts +1 -0
- package/dist/model/transaction/RuntimeTransaction.d.ts.map +1 -1
- package/dist/model/transaction/RuntimeTransaction.js +3 -0
- package/dist/model/transaction/RuntimeTransaction.js.map +1 -1
- package/dist/protocol/ProvableBlockHook.d.ts +13 -3
- package/dist/protocol/ProvableBlockHook.d.ts.map +1 -1
- package/dist/protocol/ProvableBlockHook.js +16 -0
- package/dist/protocol/ProvableBlockHook.js.map +1 -1
- package/dist/protocol/ProvableTransactionHook.d.ts +29 -2
- package/dist/protocol/ProvableTransactionHook.d.ts.map +1 -1
- package/dist/protocol/ProvableTransactionHook.js +9 -0
- package/dist/protocol/ProvableTransactionHook.js.map +1 -1
- package/dist/prover/accumulators/AppliedBatchHashList.d.ts +18 -0
- package/dist/prover/accumulators/AppliedBatchHashList.d.ts.map +1 -0
- package/dist/prover/accumulators/AppliedBatchHashList.js +25 -0
- package/dist/prover/accumulators/AppliedBatchHashList.js.map +1 -0
- package/dist/{utils → prover/accumulators}/StateTransitionReductionList.d.ts +3 -2
- package/dist/prover/accumulators/StateTransitionReductionList.d.ts.map +1 -0
- package/dist/{utils → prover/accumulators}/StateTransitionReductionList.js +6 -3
- package/dist/prover/accumulators/StateTransitionReductionList.js.map +1 -0
- package/dist/prover/accumulators/TransactionHashList.d.ts +6 -0
- package/dist/prover/accumulators/TransactionHashList.d.ts.map +1 -0
- package/dist/prover/accumulators/TransactionHashList.js +8 -0
- package/dist/prover/accumulators/TransactionHashList.js.map +1 -0
- package/dist/prover/accumulators/WitnessedRootHashList.d.ts +137 -0
- package/dist/prover/accumulators/WitnessedRootHashList.d.ts.map +1 -0
- package/dist/prover/accumulators/WitnessedRootHashList.js +50 -0
- package/dist/prover/accumulators/WitnessedRootHashList.js.map +1 -0
- package/dist/prover/block/BlockProvable.d.ts +579 -35
- package/dist/prover/block/BlockProvable.d.ts.map +1 -1
- package/dist/prover/block/BlockProvable.js +55 -3
- package/dist/prover/block/BlockProvable.js.map +1 -1
- package/dist/prover/block/BlockProver.d.ts +52 -50
- package/dist/prover/block/BlockProver.d.ts.map +1 -1
- package/dist/prover/block/BlockProver.js +289 -209
- package/dist/prover/block/BlockProver.js.map +1 -1
- package/dist/prover/block/accummulators/BlockHashMerkleTree.d.ts +55 -13
- package/dist/prover/block/accummulators/BlockHashMerkleTree.d.ts.map +1 -1
- package/dist/prover/block/accummulators/BlockHashMerkleTree.js +11 -3
- package/dist/prover/block/accummulators/BlockHashMerkleTree.js.map +1 -1
- package/dist/prover/statetransition/StateTransitionProvable.d.ts +107 -106
- package/dist/prover/statetransition/StateTransitionProvable.d.ts.map +1 -1
- package/dist/prover/statetransition/StateTransitionProvable.js +8 -8
- package/dist/prover/statetransition/StateTransitionProvable.js.map +1 -1
- package/dist/prover/statetransition/StateTransitionProver.d.ts +14 -11
- package/dist/prover/statetransition/StateTransitionProver.d.ts.map +1 -1
- package/dist/prover/statetransition/StateTransitionProver.js +116 -62
- package/dist/prover/statetransition/StateTransitionProver.js.map +1 -1
- package/dist/settlement/contracts/DispatchContractProtocolModule.d.ts +1 -1
- package/dist/settlement/contracts/DispatchSmartContract.d.ts +1 -1
- package/dist/settlement/contracts/SettlementSmartContract.d.ts.map +1 -1
- package/dist/settlement/contracts/SettlementSmartContract.js +1 -0
- package/dist/settlement/contracts/SettlementSmartContract.js.map +1 -1
- package/dist/state/assert/assert.d.ts.map +1 -1
- package/dist/state/assert/assert.js +5 -3
- package/dist/state/assert/assert.js.map +1 -1
- package/dist/state/context/RuntimeMethodExecutionContext.d.ts +3 -3
- package/dist/state/context/RuntimeMethodExecutionContext.d.ts.map +1 -1
- package/dist/state/context/RuntimeMethodExecutionContext.js +7 -4
- package/dist/state/context/RuntimeMethodExecutionContext.js.map +1 -1
- package/dist/utils/FieldOptions.d.ts +62 -0
- package/dist/utils/FieldOptions.d.ts.map +1 -0
- package/dist/utils/FieldOptions.js +13 -0
- package/dist/utils/FieldOptions.js.map +1 -0
- package/dist/utils/ProvableHashList.d.ts +21 -2
- package/dist/utils/ProvableHashList.d.ts.map +1 -1
- package/dist/utils/ProvableHashList.js +37 -2
- package/dist/utils/ProvableHashList.js.map +1 -1
- package/dist/utils/ProvableReductionHashList.d.ts +7 -3
- package/dist/utils/ProvableReductionHashList.d.ts.map +1 -1
- package/dist/utils/ProvableReductionHashList.js +8 -5
- package/dist/utils/ProvableReductionHashList.js.map +1 -1
- package/dist/utils/utils.d.ts +10 -1
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js +6 -0
- package/dist/utils/utils.js.map +1 -1
- package/package.json +2 -2
- package/src/hooks/AccountStateHook.ts +12 -3
- package/src/hooks/LastStateRootBlockHook.ts +7 -8
- package/src/hooks/NoopBlockHook.ts +7 -4
- package/src/hooks/NoopTransactionHook.ts +5 -2
- package/src/index.ts +6 -1
- package/src/model/AppliedStateTransitionBatch.ts +16 -0
- package/src/model/StateTransition.ts +6 -0
- package/src/model/StateTransitionProvableBatch.ts +94 -105
- package/src/model/transaction/RuntimeTransaction.ts +4 -0
- package/src/protocol/ProvableBlockHook.ts +51 -3
- package/src/protocol/ProvableTransactionHook.ts +67 -3
- package/src/prover/accumulators/AppliedBatchHashList.ts +32 -0
- package/src/{utils → prover/accumulators}/StateTransitionReductionList.ts +7 -4
- package/src/prover/accumulators/TransactionHashList.ts +9 -0
- package/src/prover/accumulators/WitnessedRootHashList.ts +61 -0
- package/src/prover/block/BlockProvable.ts +128 -9
- package/src/prover/block/BlockProver.ts +531 -383
- package/src/prover/block/accummulators/BlockHashMerkleTree.ts +11 -3
- package/src/prover/statetransition/StateTransitionProvable.ts +17 -11
- package/src/prover/statetransition/StateTransitionProver.ts +219 -144
- package/src/settlement/contracts/SettlementSmartContract.ts +4 -0
- package/src/state/assert/assert.ts +6 -3
- package/src/state/context/RuntimeMethodExecutionContext.ts +15 -7
- package/src/utils/FieldOptions.ts +13 -0
- package/src/utils/ProvableHashList.ts +77 -2
- package/src/utils/ProvableReductionHashList.ts +12 -3
- package/src/utils/utils.ts +18 -1
- package/test/BlockProver.test.ts +2 -0
- package/test/TestingProtocol.ts +5 -0
- package/test/model/StateTransitionProvableBatch.test.ts +137 -0
- package/test/prover/block/BlockProver.test.ts +18 -0
- package/test/prover/statetransition/StateTransitionProver.test.ts +240 -0
- package/test/utils/ProvableHashList.test.ts +44 -0
- package/test/utils/ProvableReductionHashList.test.ts +1 -1
- package/dist/utils/StateTransitionReductionList.d.ts.map +0 -1
- package/dist/utils/StateTransitionReductionList.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuntimeTransaction.js","sourceRoot":"","sources":["../../../src/model/transaction/RuntimeTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEvE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE9D;;;;GAIG;AACH,MAAM,OAAO,kBAAmB,SAAQ,MAAM,CAAC;IAC7C,QAAQ,EAAE,KAAK;IACf,QAAQ,EAAE,KAAK;IACf,KAAK,EAAE,YAAY;IACnB,MAAM,EAAE,eAAe;CACxB,CAAC;IACO,MAAM,CAAC,eAAe,CAAC,KAK7B;QACC,OAAO,IAAI,kBAAkB,CAAC;YAC5B,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,KAAK,EAAE,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC;YACzC,MAAM,EAAE,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC;SAC/C,CAAC,CAAC;IACL,CAAC;IAEM,MAAM,CAAC,WAAW,CAAC,EACxB,QAAQ,EACR,QAAQ,GAIT;QACC,OAAO,IAAI,kBAAkB,CAAC;YAC5B,QAAQ;YACR,QAAQ;YACR,KAAK,EA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C,CAAC,CAAC;SACpB,CAAC,CAAC;IACL,CAAC;IAEM,IAAI;QACT,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IACxC,CAAC;CACF"}
|
|
@@ -1,8 +1,18 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Field } from "o1js";
|
|
2
2
|
import { NetworkState } from "../model/network/NetworkState";
|
|
3
|
+
import { MethodPublicOutput } from "../model/MethodPublicOutput";
|
|
4
|
+
import { BlockProverTransactionArguments } from "../prover/block/BlockProvable";
|
|
3
5
|
import { TransitioningProtocolModule } from "./TransitioningProtocolModule";
|
|
6
|
+
import { AfterTransactionHookArguments, BeforeTransactionHookArguments, ProvableHookBlockState, toProvableHookBlockState } from "./ProvableTransactionHook";
|
|
7
|
+
export interface BeforeBlockHookArguments extends ProvableHookBlockState {
|
|
8
|
+
}
|
|
9
|
+
export interface AfterBlockHookArguments extends BeforeBlockHookArguments {
|
|
10
|
+
stateRoot: Field;
|
|
11
|
+
}
|
|
12
|
+
export declare function toBeforeTransactionHookArgument(executionData: Omit<BlockProverTransactionArguments, "verificationKeyAttestation">, networkState: NetworkState, state: Parameters<typeof toProvableHookBlockState>[0]): BeforeTransactionHookArguments;
|
|
13
|
+
export declare function toAfterTransactionHookArgument(executionData: Omit<BlockProverTransactionArguments, "verificationKeyAttestation">, networkState: NetworkState, state: Parameters<typeof toProvableHookBlockState>[0], runtimeResult: MethodPublicOutput): AfterTransactionHookArguments;
|
|
4
14
|
export declare abstract class ProvableBlockHook<Config> extends TransitioningProtocolModule<Config> {
|
|
5
|
-
abstract beforeBlock(networkState: NetworkState, state:
|
|
6
|
-
abstract afterBlock(networkState: NetworkState, state:
|
|
15
|
+
abstract beforeBlock(networkState: NetworkState, state: BeforeBlockHookArguments): Promise<NetworkState>;
|
|
16
|
+
abstract afterBlock(networkState: NetworkState, state: AfterBlockHookArguments): Promise<NetworkState>;
|
|
7
17
|
}
|
|
8
18
|
//# sourceMappingURL=ProvableBlockHook.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProvableBlockHook.d.ts","sourceRoot":"","sources":["../../src/protocol/ProvableBlockHook.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"ProvableBlockHook.d.ts","sourceRoot":"","sources":["../../src/protocol/ProvableBlockHook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAE7B,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,+BAA+B,EAAE,MAAM,+BAA+B,CAAC;AAEhF,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EACL,6BAA6B,EAC7B,8BAA8B,EAC9B,sBAAsB,EACtB,wBAAwB,EACzB,MAAM,2BAA2B,CAAC;AAEnC,MAAM,WAAW,wBAAyB,SAAQ,sBAAsB;CAAG;AAE3E,MAAM,WAAW,uBAAwB,SAAQ,wBAAwB;IACvE,SAAS,EAAE,KAAK,CAAC;CAClB;AAED,wBAAgB,+BAA+B,CAC7C,aAAa,EAAE,IAAI,CACjB,+BAA+B,EAC/B,4BAA4B,CAC7B,EACD,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC,CAAC,CAAC,GACpD,8BAA8B,CAShC;AAED,wBAAgB,8BAA8B,CAC5C,aAAa,EAAE,IAAI,CACjB,+BAA+B,EAC/B,4BAA4B,CAC7B,EACD,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC,CAAC,CAAC,EACrD,aAAa,EAAE,kBAAkB,GAChC,6BAA6B,CAK/B;AAGD,8BAAsB,iBAAiB,CACrC,MAAM,CACN,SAAQ,2BAA2B,CAAC,MAAM,CAAC;aAC3B,WAAW,CACzB,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,wBAAwB,GAC9B,OAAO,CAAC,YAAY,CAAC;aAER,UAAU,CACxB,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,uBAAuB,GAC7B,OAAO,CAAC,YAAY,CAAC;CACzB"}
|
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
import { TransitioningProtocolModule } from "./TransitioningProtocolModule";
|
|
2
|
+
import { toProvableHookBlockState, } from "./ProvableTransactionHook";
|
|
3
|
+
export function toBeforeTransactionHookArgument(executionData, networkState, state) {
|
|
4
|
+
const { transaction, signature } = executionData;
|
|
5
|
+
return {
|
|
6
|
+
networkState,
|
|
7
|
+
transaction,
|
|
8
|
+
signature,
|
|
9
|
+
prover: toProvableHookBlockState(state),
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export function toAfterTransactionHookArgument(executionData, networkState, state, runtimeResult) {
|
|
13
|
+
return {
|
|
14
|
+
...toBeforeTransactionHookArgument(executionData, networkState, state),
|
|
15
|
+
runtimeResult,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
2
18
|
// Purpose is to build transition from -> to network state
|
|
3
19
|
export class ProvableBlockHook extends TransitioningProtocolModule {
|
|
4
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProvableBlockHook.js","sourceRoot":"","sources":["../../src/protocol/ProvableBlockHook.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ProvableBlockHook.js","sourceRoot":"","sources":["../../src/protocol/ProvableBlockHook.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAIL,wBAAwB,GACzB,MAAM,2BAA2B,CAAC;AAQnC,MAAM,UAAU,+BAA+B,CAC7C,aAGC,EACD,YAA0B,EAC1B,KAAqD;IAErD,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,aAAa,CAAC;IAEjD,OAAO;QACL,YAAY;QACZ,WAAW;QACX,SAAS;QACT,MAAM,EAAE,wBAAwB,CAAC,KAAK,CAAC;KACxC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,8BAA8B,CAC5C,aAGC,EACD,YAA0B,EAC1B,KAAqD,EACrD,aAAiC;IAEjC,OAAO;QACL,GAAG,+BAA+B,CAAC,aAAa,EAAE,YAAY,EAAE,KAAK,CAAC;QACtE,aAAa;KACd,CAAC;AACJ,CAAC;AAED,0DAA0D;AAC1D,MAAM,OAAgB,iBAEpB,SAAQ,2BAAmC;CAU5C"}
|
|
@@ -1,7 +1,34 @@
|
|
|
1
1
|
import { NoConfig } from "@proto-kit/common";
|
|
2
|
-
import {
|
|
2
|
+
import { Signature } from "o1js";
|
|
3
|
+
import { RuntimeTransaction } from "../model/transaction/RuntimeTransaction";
|
|
4
|
+
import { NetworkState } from "../model/network/NetworkState";
|
|
5
|
+
import { MethodPublicOutput } from "../model/MethodPublicOutput";
|
|
6
|
+
import type { BlockProverState, BlockProverStateCommitments } from "../prover/block/BlockProvable";
|
|
3
7
|
import { TransitioningProtocolModule } from "./TransitioningProtocolModule";
|
|
8
|
+
export type ProvableHookBlockState = Pick<BlockProverStateCommitments, "transactionsHash" | "eternalTransactionsHash" | "incomingMessagesHash" | "blockHashRoot">;
|
|
9
|
+
export declare function toProvableHookBlockState(state: Pick<BlockProverState, "transactionList" | "eternalTransactionsList" | "incomingMessages" | "blockHashRoot">): {
|
|
10
|
+
transactionsHash: import("o1js/dist/node/lib/provable/field").Field;
|
|
11
|
+
eternalTransactionsHash: import("o1js/dist/node/lib/provable/field").Field;
|
|
12
|
+
incomingMessagesHash: import("o1js/dist/node/lib/provable/field").Field;
|
|
13
|
+
blockHashRoot: import("o1js/dist/node/lib/provable/field").Field;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* This type is a reduced set of the runtime method's public output.
|
|
17
|
+
* It omits internal commitments to data that is already present as data in
|
|
18
|
+
* the hook arguments
|
|
19
|
+
*/
|
|
20
|
+
export type TransactionResult = Omit<MethodPublicOutput, "networkStateHash" | "transactionHash">;
|
|
21
|
+
export interface BeforeTransactionHookArguments {
|
|
22
|
+
transaction: RuntimeTransaction;
|
|
23
|
+
signature: Signature;
|
|
24
|
+
networkState: NetworkState;
|
|
25
|
+
prover: ProvableHookBlockState;
|
|
26
|
+
}
|
|
27
|
+
export interface AfterTransactionHookArguments extends BeforeTransactionHookArguments {
|
|
28
|
+
runtimeResult: TransactionResult;
|
|
29
|
+
}
|
|
4
30
|
export declare abstract class ProvableTransactionHook<Config = NoConfig> extends TransitioningProtocolModule<Config> {
|
|
5
|
-
abstract
|
|
31
|
+
abstract beforeTransaction(executionData: BeforeTransactionHookArguments): Promise<void>;
|
|
32
|
+
abstract afterTransaction(execution: AfterTransactionHookArguments): Promise<void>;
|
|
6
33
|
}
|
|
7
34
|
//# sourceMappingURL=ProvableTransactionHook.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProvableTransactionHook.d.ts","sourceRoot":"","sources":["../../src/protocol/ProvableTransactionHook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"ProvableTransactionHook.d.ts","sourceRoot":"","sources":["../../src/protocol/ProvableTransactionHook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAEjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,KAAK,EACV,gBAAgB,EAChB,2BAA2B,EAC5B,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E,MAAM,MAAM,sBAAsB,GAAG,IAAI,CACvC,2BAA2B,EACzB,kBAAkB,GAClB,yBAAyB,GACzB,sBAAsB,GACtB,eAAe,CAClB,CAAC;AAEF,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,IAAI,CACT,gBAAgB,EACd,iBAAiB,GACjB,yBAAyB,GACzB,kBAAkB,GAClB,eAAe,CAClB;;;;;EAcF;AAED;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAClC,kBAAkB,EAClB,kBAAkB,GAAG,iBAAiB,CACvC,CAAC;AAEF,MAAM,WAAW,8BAA8B;IAC7C,WAAW,EAAE,kBAAkB,CAAC;IAChC,SAAS,EAAE,SAAS,CAAC;IACrB,YAAY,EAAE,YAAY,CAAC;IAC3B,MAAM,EAAE,sBAAsB,CAAC;CAChC;AAED,MAAM,WAAW,6BACf,SAAQ,8BAA8B;IACtC,aAAa,EAAE,iBAAiB,CAAC;CAClC;AAED,8BAAsB,uBAAuB,CAC3C,MAAM,GAAG,QAAQ,CACjB,SAAQ,2BAA2B,CAAC,MAAM,CAAC;aAC3B,iBAAiB,CAC/B,aAAa,EAAE,8BAA8B,GAC5C,OAAO,CAAC,IAAI,CAAC;aAEA,gBAAgB,CAC9B,SAAS,EAAE,6BAA6B,GACvC,OAAO,CAAC,IAAI,CAAC;CACjB"}
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import { TransitioningProtocolModule } from "./TransitioningProtocolModule";
|
|
2
|
+
export function toProvableHookBlockState(state) {
|
|
3
|
+
const { transactionList, eternalTransactionsList, incomingMessages, blockHashRoot, } = state;
|
|
4
|
+
return {
|
|
5
|
+
transactionsHash: transactionList.commitment,
|
|
6
|
+
eternalTransactionsHash: eternalTransactionsList.commitment,
|
|
7
|
+
incomingMessagesHash: incomingMessages.commitment,
|
|
8
|
+
blockHashRoot,
|
|
9
|
+
};
|
|
10
|
+
}
|
|
2
11
|
export class ProvableTransactionHook extends TransitioningProtocolModule {
|
|
3
12
|
}
|
|
4
13
|
//# sourceMappingURL=ProvableTransactionHook.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProvableTransactionHook.js","sourceRoot":"","sources":["../../src/protocol/ProvableTransactionHook.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ProvableTransactionHook.js","sourceRoot":"","sources":["../../src/protocol/ProvableTransactionHook.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAU5E,MAAM,UAAU,wBAAwB,CACtC,KAMC;IAED,MAAM,EACJ,eAAe,EACf,uBAAuB,EACvB,gBAAgB,EAChB,aAAa,GACd,GAAG,KAAK,CAAC;IACV,OAAO;QACL,gBAAgB,EAAE,eAAe,CAAC,UAAU;QAC5C,uBAAuB,EAAE,uBAAuB,CAAC,UAAU;QAC3D,oBAAoB,EAAE,gBAAgB,CAAC,UAAU;QACjD,aAAa;KACd,CAAC;AACJ,CAAC;AAwBD,MAAM,OAAgB,uBAEpB,SAAQ,2BAAmC;CAQ5C"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Bool, Field } from "o1js";
|
|
2
|
+
import { DefaultProvableHashList } from "../../utils/ProvableHashList";
|
|
3
|
+
import { NonMethods } from "../../utils/utils";
|
|
4
|
+
import { AppliedStateTransitionBatch } from "../../model/AppliedStateTransitionBatch";
|
|
5
|
+
/**
|
|
6
|
+
* A HashList for AppliedSTBatches, that in addition to the default
|
|
7
|
+
* functionality, checks that the pushed batches are not empty.
|
|
8
|
+
* If they are, the pushing is skipped.
|
|
9
|
+
* Note that if the batch has applied: false, the batch still has to be appended
|
|
10
|
+
* if it has STs inside
|
|
11
|
+
*/
|
|
12
|
+
export declare class AppliedBatchHashList extends DefaultProvableHashList<NonMethods<AppliedStateTransitionBatch>> {
|
|
13
|
+
constructor(commitment?: Field);
|
|
14
|
+
private isNotEmpty;
|
|
15
|
+
push(value: AppliedStateTransitionBatch): this;
|
|
16
|
+
pushIf(value: AppliedStateTransitionBatch, condition: Bool): this;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=AppliedBatchHashList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppliedBatchHashList.d.ts","sourceRoot":"","sources":["../../../src/prover/accumulators/AppliedBatchHashList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAEnC,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AAEtF;;;;;;GAMG;AACH,qBAAa,oBAAqB,SAAQ,uBAAuB,CAC/D,UAAU,CAAC,2BAA2B,CAAC,CACxC;gBACoB,UAAU,GAAE,KAAgB;IAI/C,OAAO,CAAC,UAAU;IAIX,IAAI,CAAC,KAAK,EAAE,2BAA2B;IAIvC,MAAM,CAAC,KAAK,EAAE,2BAA2B,EAAE,SAAS,EAAE,IAAI;CAGlE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Field } from "o1js";
|
|
2
|
+
import { DefaultProvableHashList } from "../../utils/ProvableHashList";
|
|
3
|
+
import { AppliedStateTransitionBatch } from "../../model/AppliedStateTransitionBatch";
|
|
4
|
+
/**
|
|
5
|
+
* A HashList for AppliedSTBatches, that in addition to the default
|
|
6
|
+
* functionality, checks that the pushed batches are not empty.
|
|
7
|
+
* If they are, the pushing is skipped.
|
|
8
|
+
* Note that if the batch has applied: false, the batch still has to be appended
|
|
9
|
+
* if it has STs inside
|
|
10
|
+
*/
|
|
11
|
+
export class AppliedBatchHashList extends DefaultProvableHashList {
|
|
12
|
+
constructor(commitment = Field(0)) {
|
|
13
|
+
super(AppliedStateTransitionBatch, commitment);
|
|
14
|
+
}
|
|
15
|
+
isNotEmpty(value) {
|
|
16
|
+
return value.batchHash.equals(Field(0)).not();
|
|
17
|
+
}
|
|
18
|
+
push(value) {
|
|
19
|
+
return super.pushIf(value, this.isNotEmpty(value));
|
|
20
|
+
}
|
|
21
|
+
pushIf(value, condition) {
|
|
22
|
+
return super.pushIf(value, condition.and(this.isNotEmpty(value)));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=AppliedBatchHashList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppliedBatchHashList.js","sourceRoot":"","sources":["../../../src/prover/accumulators/AppliedBatchHashList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,EAAE,MAAM,MAAM,CAAC;AAEnC,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AAEtF;;;;;;GAMG;AACH,MAAM,OAAO,oBAAqB,SAAQ,uBAEzC;IACC,YAAmB,aAAoB,KAAK,CAAC,CAAC,CAAC;QAC7C,KAAK,CAAC,2BAA2B,EAAE,UAAU,CAAC,CAAC;IACjD,CAAC;IAEO,UAAU,CAAC,KAAkC;QACnD,OAAO,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;IAChD,CAAC;IAEM,IAAI,CAAC,KAAkC;QAC5C,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;IACrD,CAAC;IAEM,MAAM,CAAC,KAAkC,EAAE,SAAe;QAC/D,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACpE,CAAC;CACF"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { ProvableStateTransition, StateTransition } from "
|
|
2
|
-
import { ProvableReductionHashList } from "
|
|
1
|
+
import { ProvableStateTransition, StateTransition } from "../../model/StateTransition";
|
|
2
|
+
import { ProvableReductionHashList } from "../../utils/ProvableReductionHashList";
|
|
3
3
|
export declare class StateTransitionReductionList extends ProvableReductionHashList<ProvableStateTransition> {
|
|
4
4
|
push(value: ProvableStateTransition): this;
|
|
5
5
|
pushWithMetadata(value: ProvableStateTransition): {
|
|
6
6
|
popLast: import("o1js/dist/node/lib/provable/bool").Bool;
|
|
7
7
|
value: ProvableStateTransition;
|
|
8
8
|
};
|
|
9
|
+
toField(): import("o1js/dist/node/lib/provable/field").Field;
|
|
9
10
|
}
|
|
10
11
|
export declare function reduceStateTransitions(transitions: StateTransition<unknown>[]): StateTransition<unknown>[];
|
|
11
12
|
//# sourceMappingURL=StateTransitionReductionList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StateTransitionReductionList.d.ts","sourceRoot":"","sources":["../../../src/prover/accumulators/StateTransitionReductionList.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,uBAAuB,EACvB,eAAe,EAChB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAC;AAElF,qBAAa,4BAA6B,SAAQ,yBAAyB,CAAC,uBAAuB,CAAC;IAC3F,IAAI,CAAC,KAAK,EAAE,uBAAuB;IAMnC,gBAAgB,CAAC,KAAK,EAAE,uBAAuB;;;;IA0C/C,OAAO;CAGf;AAED,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,eAAe,CAAC,OAAO,CAAC,EAAE,GACtC,eAAe,CAAC,OAAO,CAAC,EAAE,CA0B5B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Provable } from "o1js";
|
|
2
|
-
import { ProvableOption } from "
|
|
3
|
-
import { ProvableStateTransition, StateTransition, } from "
|
|
4
|
-
import { ProvableReductionHashList } from "
|
|
2
|
+
import { ProvableOption } from "../../model/Option";
|
|
3
|
+
import { ProvableStateTransition, StateTransition, } from "../../model/StateTransition";
|
|
4
|
+
import { ProvableReductionHashList } from "../../utils/ProvableReductionHashList";
|
|
5
5
|
export class StateTransitionReductionList extends ProvableReductionHashList {
|
|
6
6
|
push(value) {
|
|
7
7
|
this.pushWithMetadata(value);
|
|
@@ -32,6 +32,9 @@ export class StateTransitionReductionList extends ProvableReductionHashList {
|
|
|
32
32
|
return [transition, pathsMatch];
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
+
toField() {
|
|
36
|
+
return this.commitment;
|
|
37
|
+
}
|
|
35
38
|
}
|
|
36
39
|
export function reduceStateTransitions(transitions) {
|
|
37
40
|
const reduced = [];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StateTransitionReductionList.js","sourceRoot":"","sources":["../../../src/prover/accumulators/StateTransitionReductionList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAEhC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EACL,uBAAuB,EACvB,eAAe,GAChB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAC;AAElF,MAAM,OAAO,4BAA6B,SAAQ,yBAAkD;IAC3F,IAAI,CAAC,KAA8B;QACxC,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;QAE7B,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,gBAAgB,CAAC,KAA8B;QACpD,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC,QAAiC,EAAE,EAAE;YACrE,MAAM,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAEpD,sEAAsE;YACtE,MAAM,IAAI,GAAG,QAAQ,CAAC,EAAE,CACtB,UAA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AAC,EAAE,CAAC,CAAC;YACjB,OAAO;SACR;QAED,MAAM,IAAI,GAAG,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAE,CAAC;QAC7B,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE;YACzC,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE;gBACjC,OAAO,CAAC,GAAG,EAAE,CAAC;gBACd,OAAO,CAAC,IAAI,CACV,IAAI,eAAe,CAAU,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,CAClE,CAAC;aACH;iBAAM;gBACL,yCAAyC;gBACzC,8CAA8C;gBAC9C,iBAAiB;aAClB;SACF;aAAM;YACL,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;SAClB;IACH,CAAC,CAAC,CAAC;IACH,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Field } from "o1js";
|
|
2
|
+
import { DefaultProvableHashList } from "../../utils/ProvableHashList";
|
|
3
|
+
export declare class TransactionHashList extends DefaultProvableHashList<Field> {
|
|
4
|
+
constructor(commitment?: Field);
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=TransactionHashList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TransactionHashList.d.ts","sourceRoot":"","sources":["../../../src/prover/accumulators/TransactionHashList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAE7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,qBAAa,mBAAoB,SAAQ,uBAAuB,CAAC,KAAK,CAAC;gBAClD,UAAU,GAAE,KAAgB;CAGhD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Field } from "o1js";
|
|
2
|
+
import { DefaultProvableHashList } from "../../utils/ProvableHashList";
|
|
3
|
+
export class TransactionHashList extends DefaultProvableHashList {
|
|
4
|
+
constructor(commitment = Field(0)) {
|
|
5
|
+
super(Field, commitment);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=TransactionHashList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TransactionHashList.js","sourceRoot":"","sources":["../../../src/prover/accumulators/TransactionHashList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAE7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,MAAM,OAAO,mBAAoB,SAAQ,uBAA8B;IACrE,YAAmB,aAAoB,KAAK,CAAC,CAAC,CAAC;QAC7C,KAAK,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IAC3B,CAAC;CACF"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { Bool, Field } from "o1js";
|
|
2
|
+
import { DefaultProvableHashList } from "../../utils/ProvableHashList";
|
|
3
|
+
declare const WitnessedRoot_base: (new (value: {
|
|
4
|
+
appliedBatchListState: import("o1js/dist/node/lib/provable/field").Field;
|
|
5
|
+
root: import("o1js/dist/node/lib/provable/field").Field;
|
|
6
|
+
}) => {
|
|
7
|
+
appliedBatchListState: import("o1js/dist/node/lib/provable/field").Field;
|
|
8
|
+
root: import("o1js/dist/node/lib/provable/field").Field;
|
|
9
|
+
}) & {
|
|
10
|
+
_isStruct: true;
|
|
11
|
+
} & Omit<import("o1js/dist/node/lib/provable/types/provable-intf").Provable<{
|
|
12
|
+
appliedBatchListState: import("o1js/dist/node/lib/provable/field").Field;
|
|
13
|
+
root: import("o1js/dist/node/lib/provable/field").Field;
|
|
14
|
+
}, {
|
|
15
|
+
appliedBatchListState: bigint;
|
|
16
|
+
root: bigint;
|
|
17
|
+
}>, "fromFields"> & {
|
|
18
|
+
fromFields: (fields: import("o1js/dist/node/lib/provable/field").Field[]) => {
|
|
19
|
+
appliedBatchListState: import("o1js/dist/node/lib/provable/field").Field;
|
|
20
|
+
root: import("o1js/dist/node/lib/provable/field").Field;
|
|
21
|
+
};
|
|
22
|
+
} & {
|
|
23
|
+
fromValue: (value: {
|
|
24
|
+
appliedBatchListState: string | number | bigint | import("o1js/dist/node/lib/provable/field").Field;
|
|
25
|
+
root: string | number | bigint | import("o1js/dist/node/lib/provable/field").Field;
|
|
26
|
+
}) => {
|
|
27
|
+
appliedBatchListState: import("o1js/dist/node/lib/provable/field").Field;
|
|
28
|
+
root: import("o1js/dist/node/lib/provable/field").Field;
|
|
29
|
+
};
|
|
30
|
+
toInput: (x: {
|
|
31
|
+
appliedBatchListState: import("o1js/dist/node/lib/provable/field").Field;
|
|
32
|
+
root: import("o1js/dist/node/lib/provable/field").Field;
|
|
33
|
+
}) => {
|
|
34
|
+
fields?: import("o1js/dist/node/lib/provable/field").Field[] | undefined;
|
|
35
|
+
packed?: [import("o1js/dist/node/lib/provable/field").Field, number][] | undefined;
|
|
36
|
+
};
|
|
37
|
+
toJSON: (x: {
|
|
38
|
+
appliedBatchListState: import("o1js/dist/node/lib/provable/field").Field;
|
|
39
|
+
root: import("o1js/dist/node/lib/provable/field").Field;
|
|
40
|
+
}) => {
|
|
41
|
+
appliedBatchListState: string;
|
|
42
|
+
root: string;
|
|
43
|
+
};
|
|
44
|
+
fromJSON: (x: {
|
|
45
|
+
appliedBatchListState: string;
|
|
46
|
+
root: string;
|
|
47
|
+
}) => {
|
|
48
|
+
appliedBatchListState: import("o1js/dist/node/lib/provable/field").Field;
|
|
49
|
+
root: import("o1js/dist/node/lib/provable/field").Field;
|
|
50
|
+
};
|
|
51
|
+
empty: () => {
|
|
52
|
+
appliedBatchListState: import("o1js/dist/node/lib/provable/field").Field;
|
|
53
|
+
root: import("o1js/dist/node/lib/provable/field").Field;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Link between a certain applied batch stack and a given root hash that the
|
|
58
|
+
* stack has to evaluate to at that given point in time
|
|
59
|
+
*/
|
|
60
|
+
export declare class WitnessedRoot extends WitnessedRoot_base {
|
|
61
|
+
}
|
|
62
|
+
declare const WitnessedRootWitness_base: (new (value: {
|
|
63
|
+
witnessedRoot: import("o1js/dist/node/lib/provable/field").Field;
|
|
64
|
+
preimage: import("o1js/dist/node/lib/provable/field").Field;
|
|
65
|
+
}) => {
|
|
66
|
+
witnessedRoot: import("o1js/dist/node/lib/provable/field").Field;
|
|
67
|
+
preimage: import("o1js/dist/node/lib/provable/field").Field;
|
|
68
|
+
}) & {
|
|
69
|
+
_isStruct: true;
|
|
70
|
+
} & Omit<import("o1js/dist/node/lib/provable/types/provable-intf").Provable<{
|
|
71
|
+
witnessedRoot: import("o1js/dist/node/lib/provable/field").Field;
|
|
72
|
+
preimage: import("o1js/dist/node/lib/provable/field").Field;
|
|
73
|
+
}, {
|
|
74
|
+
witnessedRoot: bigint;
|
|
75
|
+
preimage: bigint;
|
|
76
|
+
}>, "fromFields"> & {
|
|
77
|
+
fromFields: (fields: import("o1js/dist/node/lib/provable/field").Field[]) => {
|
|
78
|
+
witnessedRoot: import("o1js/dist/node/lib/provable/field").Field;
|
|
79
|
+
preimage: import("o1js/dist/node/lib/provable/field").Field;
|
|
80
|
+
};
|
|
81
|
+
} & {
|
|
82
|
+
fromValue: (value: {
|
|
83
|
+
witnessedRoot: string | number | bigint | import("o1js/dist/node/lib/provable/field").Field;
|
|
84
|
+
preimage: string | number | bigint | import("o1js/dist/node/lib/provable/field").Field;
|
|
85
|
+
}) => {
|
|
86
|
+
witnessedRoot: import("o1js/dist/node/lib/provable/field").Field;
|
|
87
|
+
preimage: import("o1js/dist/node/lib/provable/field").Field;
|
|
88
|
+
};
|
|
89
|
+
toInput: (x: {
|
|
90
|
+
witnessedRoot: import("o1js/dist/node/lib/provable/field").Field;
|
|
91
|
+
preimage: import("o1js/dist/node/lib/provable/field").Field;
|
|
92
|
+
}) => {
|
|
93
|
+
fields?: import("o1js/dist/node/lib/provable/field").Field[] | undefined;
|
|
94
|
+
packed?: [import("o1js/dist/node/lib/provable/field").Field, number][] | undefined;
|
|
95
|
+
};
|
|
96
|
+
toJSON: (x: {
|
|
97
|
+
witnessedRoot: import("o1js/dist/node/lib/provable/field").Field;
|
|
98
|
+
preimage: import("o1js/dist/node/lib/provable/field").Field;
|
|
99
|
+
}) => {
|
|
100
|
+
witnessedRoot: string;
|
|
101
|
+
preimage: string;
|
|
102
|
+
};
|
|
103
|
+
fromJSON: (x: {
|
|
104
|
+
witnessedRoot: string;
|
|
105
|
+
preimage: string;
|
|
106
|
+
}) => {
|
|
107
|
+
witnessedRoot: import("o1js/dist/node/lib/provable/field").Field;
|
|
108
|
+
preimage: import("o1js/dist/node/lib/provable/field").Field;
|
|
109
|
+
};
|
|
110
|
+
empty: () => {
|
|
111
|
+
witnessedRoot: import("o1js/dist/node/lib/provable/field").Field;
|
|
112
|
+
preimage: import("o1js/dist/node/lib/provable/field").Field;
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
export declare class WitnessedRootWitness extends WitnessedRootWitness_base {
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Accumulator as of section "Intermediary state roots" of the STProver v2 spec
|
|
119
|
+
*/
|
|
120
|
+
export declare class WitnessedRootHashList extends DefaultProvableHashList<WitnessedRoot> {
|
|
121
|
+
constructor(commitment?: Field);
|
|
122
|
+
/**
|
|
123
|
+
* To be used by the BlockProver or for tracing
|
|
124
|
+
*
|
|
125
|
+
* The main purpose of this method compared to the simple push methods
|
|
126
|
+
* is for deduplicating witnessed roots. We need to do this because the
|
|
127
|
+
* STProver can only witness once per batch, therefore if multiple witness
|
|
128
|
+
* points fall back to the same ST (because any batches in between were empty),
|
|
129
|
+
* this has to be detected and compensated for.
|
|
130
|
+
* This function does this using the preimage of the current list state.
|
|
131
|
+
*
|
|
132
|
+
* @param preimage The preimage to the **current** state of the list.
|
|
133
|
+
*/
|
|
134
|
+
witnessRoot(witnessedRoot: WitnessedRoot, preimage: Field, condition: Bool): this;
|
|
135
|
+
}
|
|
136
|
+
export {};
|
|
137
|
+
//# sourceMappingURL=WitnessedRootHashList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WitnessedRootHashList.d.ts","sourceRoot":"","sources":["../../../src/prover/accumulators/WitnessedRootHashList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAU,MAAM,MAAM,CAAC;AAE3C,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEvE;;;GAGG;AACH,qBAAa,aAAc,SAAQ,kBAGjC;CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEL,qBAAa,oBAAqB,SAAQ,yBAGxC;CAAG;AAEL;;GAEG;AAEH,qBAAa,qBAAsB,SAAQ,uBAAuB,CAAC,aAAa,CAAC;gBAC5D,UAAU,GAAE,KAAgB;IAI/C;;;;;;;;;;;OAWG;IACI,WAAW,CAChB,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,KAAK,EACf,SAAS,EAAE,IAAI;CAkBlB"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Field, Struct } from "o1js";
|
|
2
|
+
import { DefaultProvableHashList } from "../../utils/ProvableHashList";
|
|
3
|
+
/**
|
|
4
|
+
* Link between a certain applied batch stack and a given root hash that the
|
|
5
|
+
* stack has to evaluate to at that given point in time
|
|
6
|
+
*/
|
|
7
|
+
export class WitnessedRoot extends Struct({
|
|
8
|
+
appliedBatchListState: Field,
|
|
9
|
+
root: Field,
|
|
10
|
+
}) {
|
|
11
|
+
}
|
|
12
|
+
export class WitnessedRootWitness extends Struct({
|
|
13
|
+
witnessedRoot: Field,
|
|
14
|
+
preimage: Field,
|
|
15
|
+
}) {
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Accumulator as of section "Intermediary state roots" of the STProver v2 spec
|
|
19
|
+
*/
|
|
20
|
+
export class WitnessedRootHashList extends DefaultProvableHashList {
|
|
21
|
+
constructor(commitment = Field(0)) {
|
|
22
|
+
super(WitnessedRoot, commitment);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* To be used by the BlockProver or for tracing
|
|
26
|
+
*
|
|
27
|
+
* The main purpose of this method compared to the simple push methods
|
|
28
|
+
* is for deduplicating witnessed roots. We need to do this because the
|
|
29
|
+
* STProver can only witness once per batch, therefore if multiple witness
|
|
30
|
+
* points fall back to the same ST (because any batches in between were empty),
|
|
31
|
+
* this has to be detected and compensated for.
|
|
32
|
+
* This function does this using the preimage of the current list state.
|
|
33
|
+
*
|
|
34
|
+
* @param preimage The preimage to the **current** state of the list.
|
|
35
|
+
*/
|
|
36
|
+
witnessRoot(witnessedRoot, preimage, condition) {
|
|
37
|
+
// Note, we don't have to validate the preimage here because of the following
|
|
38
|
+
// 1. If the sequencer doesn't provide the correct witness, the BlockProver's
|
|
39
|
+
// equality check will fail
|
|
40
|
+
// 2. If the list is empty, no preimage exists, therefore condition (2) doesn't
|
|
41
|
+
// apply, which is the same outcome when the sequencer provides an arbitrary witness
|
|
42
|
+
const preimageCheckList = new WitnessedRootHashList(preimage).push(witnessedRoot);
|
|
43
|
+
// Conditions:
|
|
44
|
+
// (1) don't append if witnessedRoot == finalizedRoot -> Already covered in BlockProver
|
|
45
|
+
// (2) don't append if preimage.push({ finalizedRoot, pendingSTBatchesHash }) == this.commitment
|
|
46
|
+
const skipPush = preimageCheckList.commitment.equals(this.commitment);
|
|
47
|
+
return this.pushIf(witnessedRoot, condition.and(skipPush.not()));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=WitnessedRootHashList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WitnessedRootHashList.js","sourceRoot":"","sources":["../../../src/prover/accumulators/WitnessedRootHashList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE3C,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE;;;GAGG;AACH,MAAM,OAAO,aAAc,SAAQ,MAAM,CAAC;IACxC,qBAAqB,EAAE,KAAK;IAC5B,IAAI,EAAE,KAAK;CACZ,CAAC;CAAG;AAEL,MAAM,OAAO,oBAAqB,SAAQ,MAAM,CAAC;IAC/C,aAAa,EAAE,KAAK;IACpB,QAAQ,EAAE,KAAK;CAChB,CAAC;CAAG;AAEL;;GAEG;AAEH,MAAM,OAAO,qBAAsB,SAAQ,uBAAsC;IAC/E,YAAmB,aAAoB,KAAK,CAAC,CAAC,CAAC;QAC7C,KAAK,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;IACnC,CAAC;IAED;;;;;;;;;;;OAWG;IACI,WAAW,CAChB,aAA4B,EAC5B,QAAe,EACf,SAAe;QAEf,6EAA6E;QAC7E,6EAA6E;QAC7E,8BAA8B;QAC9B,+EAA+E;QAC/E,uFAAuF;QACvF,MAAM,iBAAiB,GAAG,IAAI,qBAAqB,CAAC,QAAQ,CAAC,CAAC,IAAI,CAChE,aAAa,CACd,CAAC;QAEF,cAAc;QACd,wFAAwF;QACxF,gGAAgG;QAChG,MAAM,QAAQ,GAAG,iBAAiB,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAEtE,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IACnE,CAAC;CACF"}
|