Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V2.0.2 #37

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ bin/
pre_build.js
jest.config.js
src/__bls_signatures__/loader.js
src/__clvm_wasm__/loader.js
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Setup Node 16
uses: actions/setup-node@v3
- name: Setup Node 18
uses: actions/setup-node@v4
with:
node-version: '16.x'
node-version: '18.x'

- name: Get yarn version
run: echo "yarn_version=$(yarn -v)" >> $GITHUB_ENV
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [2.0.2]
This version is compatible with [`960f8d139940fa0814d3fac44da9a2975642f5d3`](https://github.com/Chia-Network/clvm/tree/960f8d139940fa0814d3fac44da9a2975642f5d3) of [clvm](https://github.com/Chia-Network/clvm)

### Changed
- Now `op_div` does not accept negative operands.
- `convert_atom_to_bytes()` now is able to convert an object which has `toBytes()` method.
- Update tests.

## [2.0.1]
This version is compatible with [`480b32840c525e17b5ab2f29036c033febaae71e`](https://github.com/Chia-Network/clvm/tree/480b32840c525e17b5ab2f29036c033febaae71e) of [clvm](https://github.com/Chia-Network/clvm)

Expand Down Expand Up @@ -263,6 +271,7 @@ At this version, I've managed to improve test complete time to `79s` -> `2s` by
Initial (beta) release.

<!--[Unreleased]: https://github.com/Chia-Mine/clvm-js/compare/v0.0.1...v0.0.2-->
[2.0.2]: https://github.com/Chia-Mine/clvm-js/compare/v2.0.1...v2.0.2
[2.0.1]: https://github.com/Chia-Mine/clvm-js/compare/v2.0.0...v2.0.1
[2.0.0]: https://github.com/Chia-Mine/clvm-js/compare/v1.0.9...v2.0.0
[1.0.9]: https://github.com/Chia-Mine/clvm-js/compare/v1.0.8...v1.0.9
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ If you find something not compatible with Python's clvm, please report it to Git

## Compatibility
This code is compatible with:
- [`480b32840c525e17b5ab2f29036c033febaae71e`](https://github.com/Chia-Network/clvm/tree/480b32840c525e17b5ab2f29036c033febaae71e) of [clvm](https://github.com/Chia-Network/clvm)
- [Diff to the latest clvm](https://github.com/Chia-Network/clvm/compare/480b32840c525e17b5ab2f29036c033febaae71e...main)
- [`960f8d139940fa0814d3fac44da9a2975642f5d3`](https://github.com/Chia-Network/clvm/tree/960f8d139940fa0814d3fac44da9a2975642f5d3) of [clvm](https://github.com/Chia-Network/clvm)
- [Diff to the latest clvm](https://github.com/Chia-Network/clvm/compare/960f8d139940fa0814d3fac44da9a2975642f5d3...main)
- [`34f504bd0ef2cd3a219fea8ce6b15ff7684687fd`](https://github.com/Chia-Network/bls-signatures/tree/34f504bd0ef2cd3a219fea8ce6b15ff7684687fd) of [bls-signatures](https://github.com/Chia-Network/bls-signatures)
- [Diff to the latest bls-signatures](https://github.com/Chia-Network/bls-signatures/compare/34f504bd0ef2cd3a219fea8ce6b15ff7684687fd...main)

Expand Down
33 changes: 17 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "clvm",
"version": "2.0.1",
"version": "2.0.2",
"author": "ChiaMineJP <[email protected]>",
"description": "Javascript implementation of chia lisp",
"license": "MIT",
Expand All @@ -26,24 +26,25 @@
},
"dependencies": {
"bls-signatures": "^1.0.14",
"clvm_wasm": "^0.3.2",
"jscrypto": "^1.0.2"
},
"devDependencies": {
"@types/jest": "^26.0.24",
"@types/node": "^15.0.2",
"@typescript-eslint/eslint-plugin": "^4.1.0",
"@typescript-eslint/parser": "^4.1.0",
"eslint": "^7.8.1",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jsdoc": "^30.4.1",
"fork-ts-checker-webpack-plugin": "^6.2.12",
"jest": "^27.0.6",
"terser-webpack-plugin": "^5.1.3",
"ts-jest": "^27.0.3",
"ts-loader": "^9.2.3",
"typescript": "^4.2.4",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0"
"@types/jest": "^29.5.12",
"@types/node": "^20.11.28",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"eslint": "^8.57.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsdoc": "^48.2.1",
"fork-ts-checker-webpack-plugin": "^9.0.2",
"jest": "^29.7.0",
"terser-webpack-plugin": "^5.3.10",
"ts-jest": "^29.1.2",
"ts-loader": "^9.5.1",
"typescript": "^5.4.2",
"webpack": "^5.90.3",
"webpack-cli": "^5.1.4"
},
"browserslist": [
"edge >= 79",
Expand Down
11 changes: 11 additions & 0 deletions pre_build.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ if(!fs.existsSync(blsWasmSrcPath)){
return;
}
fs.copyFileSync(blsWasmSrcPath, blsWasmDestPath);

const clvmWasmSrcPath = path.join(__dirname, "node_modules", "clvm_wasm", "clvm_wasm_bg.wasm");
const clvmWasmDestPath = path.join(browserDir, "clvm_wasm_bg.wasm");
if (!fs.existsSync(clvmWasmSrcPath)) {
console.error("clvm_wasm_bg.wasm not found at:");
console.error(clvmWasmSrcPath);
console.error("Probably you haven't execute npm install yet");
return;
}
fs.copyFileSync(clvmWasmSrcPath, clvmWasmDestPath);

const browserDtsPath = path.join(browserDir, "index.d.ts");
fs.writeFileSync(browserDtsPath, 'export * from "..";\n');

Expand Down
10 changes: 9 additions & 1 deletion src/SExp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,16 @@ export function convert_atom_to_bytes(v: any): Bytes {
else if(typeof v.serialize === "function"){
return Bytes.from(v, "G1Element");
}
else if(typeof v.toBytes === "function"){
return v.toBytes() as Bytes;
}

throw new Error(`can't cast ${JSON.stringify(v)} to bytes`);
try {
return Bytes.from(v);
}
catch (_) {
throw new Error(`can't cast ${JSON.stringify(v)} to bytes`);
}
}

const op_convert = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/__bls_signatures__/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import type {G1Element as G1ElementType, ModuleInstance} from "bls-signatures";
import * as blsLoader from "./loader";

type TCreateModule = () => Promise<ModuleInstance>;
export let BLS: ModuleInstance | undefined;
export let loadPromise: Promise<ModuleInstance> | undefined;
let BLS: ModuleInstance | undefined;
let loadPromise: Promise<ModuleInstance> | undefined;

/**
* Load BLS Module instance.
Expand Down
Loading
Loading