Skip to content

Commit 59c5ce0

Browse files
Export functionality for setting test heights in the SDK + allow the SDK to set test version heights when the CONSENSUS_VERSION_HEIGHTS envar is set
1 parent 8e56de5 commit 59c5ce0

File tree

7 files changed

+175
-175
lines changed

7 files changed

+175
-175
lines changed

sdk/src/browser.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ export {
106106
VerifyingKey,
107107
ViewKey,
108108
initThreadPool,
109+
setConsensusVersionTestHeights,
109110
verifyFunctionExecution,
110111
} from "./wasm.js";
111112

sdk/src/node.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,13 @@
11
import "./node-polyfill.js";
2+
import { setConsensusVersionTestHeights } from "./browser.js";
23
export * from "./browser.js";
4+
5+
// Attempt to set the default test heights for the consensus versions from the CONSENSUS_VERSION_HEIGHTS envar when nodeJS loads its wasm module.
6+
function setDefaultTestHeights() {
7+
const consensusVersionHeights = process.env["CONSENSUS_VERSION_HEIGHTS"];
8+
if (consensusVersionHeights) {
9+
setConsensusVersionTestHeights(consensusVersionHeights)
10+
}
11+
}
12+
13+
setDefaultTestHeights()

sdk/src/wasm.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,6 @@ export {
4848
VerifyingKey,
4949
ViewKey,
5050
initThreadPool,
51+
setConsensusVersionTestHeights,
5152
verifyFunctionExecution,
5253
} from "@provablehq/wasm/%%NETWORK%%.js";

sdk/tests/wasm.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expect } from "chai";
2-
import { Address, AleoNetworkClient, CREDITS_PROGRAM_KEYS, Field, FunctionKeyPair, PrivateKey, ViewKey, Signature, RecordCiphertext, RecordPlaintext, PrivateKeyCiphertext, EncryptionToolkit, Transition, VerifyingKey, AleoKeyProvider} from "../src/node.js";
2+
import { Address, AleoNetworkClient, CREDITS_PROGRAM_KEYS, Field, FunctionKeyPair, PrivateKey, ViewKey, Signature, RecordCiphertext, RecordPlaintext, PrivateKeyCiphertext, EncryptionToolkit, Transition, VerifyingKey, AleoKeyProvider, setConsensusVersionTestHeights} from "../src/node.js";
33
import {
44
seed,
55
message,

0 commit comments

Comments
 (0)