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

Blastwjb #383

Closed
wants to merge 64 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
143e817
first pass
wjblanke Jun 2, 2023
1e99e7a
bn_t
wjblanke Jun 2, 2023
3fdd03f
more fixes
wjblanke Jun 3, 2023
a654e98
more fixes
wjblanke Jun 3, 2023
5b1ff23
more fixes
wjblanke Jun 3, 2023
2ffd581
more fixes
wjblanke Jun 3, 2023
b693544
more fixes
wjblanke Jun 3, 2023
2be7c16
more fixes
wjblanke Jun 3, 2023
443875e
more fixes
wjblanke Jun 3, 2023
8cc4e85
more fixes
wjblanke Jun 4, 2023
6f687d1
more fixes
wjblanke Jun 4, 2023
f167a85
more fixes
wjblanke Jun 4, 2023
64b1547
more fixes
wjblanke Jun 4, 2023
b11e8e5
more fixes
wjblanke Jun 4, 2023
2dcc151
more fixes
wjblanke Jun 4, 2023
5c86319
more fixes
wjblanke Jun 4, 2023
9f6ea3f
more fixes
wjblanke Jun 4, 2023
b621fda
more fixes
wjblanke Jun 4, 2023
65d9f8f
more fixes
wjblanke Jun 4, 2023
b6403c1
more fixes
wjblanke Jun 4, 2023
4f2b5b0
more fixes
wjblanke Jun 4, 2023
06ce7ab
link
wjblanke Jun 4, 2023
a7b6093
fix private key
wjblanke Jun 4, 2023
250483c
fixes..maybe
wjblanke Jun 5, 2023
8b4cb49
fix ubuntu
wjblanke Jun 5, 2023
ec89afd
affine fix
wjblanke Jun 5, 2023
bbd0f29
use blst keygen
wjblanke Jun 5, 2023
bc0118e
cleanup
wjblanke Jun 5, 2023
b38c540
test couts
wjblanke Jun 5, 2023
5764c25
Verification working - along with other fixes
emlowe Jun 5, 2023
38b431e
Some fixes - PopVerify is broken
emlowe Jun 5, 2023
88bcafa
PopProve and PopVerify are working
emlowe Jun 5, 2023
1aa2618
fixed python bindings by removing mul and rmul
wjblanke Jun 5, 2023
8ef1883
More fixes and improvements
emlowe Jun 5, 2023
937a3a5
cmake
wjblanke Jun 6, 2023
fda4d55
remove gmp
wjblanke Jun 6, 2023
58a6073
Use _bendian instead
emlowe Jun 6, 2023
11a31d0
Handle infinity similar to bls-signatures did before
emlowe Jun 6, 2023
a67278c
fix cmake
wjblanke Jun 6, 2023
5eaf52d
Fixed up issues with unhardned - all tests pass
emlowe Jun 6, 2023
21a7980
Fix up PrivateKey deserialization and checks
emlowe Jun 6, 2023
b766fb5
put back proper iterations into benchmarks
emlowe Jun 6, 2023
6599e05
hopeful fixes
wjblanke Jun 7, 2023
eab697d
hopeful fixes
wjblanke Jun 7, 2023
bef4553
change workflows
wjblanke Jun 7, 2023
1853a8f
msvc extension
wjblanke Jun 7, 2023
9282fae
windows
wjblanke Jun 7, 2023
ccf8f7e
ml64
wjblanke Jun 7, 2023
5a3077b
fix
wjblanke Jun 7, 2023
65e4251
fix
wjblanke Jun 7, 2023
87a0352
fix
wjblanke Jun 7, 2023
28dd06e
fix
wjblanke Jun 7, 2023
6df6550
fix
wjblanke Jun 7, 2023
fc70696
static lib for asm
wjblanke Jun 7, 2023
b6b599d
fix workflow
wjblanke Jun 7, 2023
5db6545
fix
wjblanke Jun 7, 2023
14986f4
fix
wjblanke Jun 7, 2023
22c8bd6
added binary lib
wjblanke Jun 7, 2023
495dda0
temp comment assert
wjblanke Jun 7, 2023
7337ae3
temp comment assert
wjblanke Jun 7, 2023
1906119
remove relic from js
wjblanke Jun 7, 2023
682a7f9
remove Bignum from js bindings
wjblanke Jun 8, 2023
2f3fac4
scrub bn_t
wjblanke Jun 8, 2023
796cdf4
remove mul bindings
wjblanke Jun 8, 2023
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
19 changes: 3 additions & 16 deletions .github/workflows/build-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,23 +157,10 @@ jobs:
CIBW_BEFORE_ALL_WINDOWS: >
curl -L https://download.libsodium.org/libsodium/releases/libsodium-1.0.18-stable-msvc.zip > libsodium-1.0.18-stable-msvc.zip
&& 7z x libsodium-1.0.18-stable-msvc.zip
&& git clone https://github.com/Chia-Network/relic_ietf_64.git
&& ls -l relic_ietf_64
&& git clone https://github.com/Chia-Network/mpir_gc_x64.git
&& ls -l mpir_gc_x64
&& git clone https://github.com/supranational/blst.git
&& ls -l blst
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >
ls -l mpir_gc_x64 && pip uninstall -y delocate
&& pip install git+https://github.com/Chia-Network/delocate.git
&& delocate-wheel -v -i mpir_gc_x64/mpir.dll {wheel}
&& delocate-wheel -v -i mpir_gc_x64/mpir_gc.dll {wheel}
&& delocate-wheel -v -i mpir_gc_x64/mpir_broadwell.dll {wheel}
&& delocate-wheel -v -i mpir_gc_x64/mpir_broadwell_avx.dll {wheel}
&& delocate-wheel -v -i mpir_gc_x64/mpir_bulldozer.dll {wheel}
&& delocate-wheel -v -i mpir_gc_x64/mpir_haswell.dll {wheel}
&& delocate-wheel -v -i mpir_gc_x64/mpir_piledriver.dll {wheel}
&& delocate-wheel -v -i mpir_gc_x64/mpir_sandybridge.dll {wheel}
&& delocate-wheel -v -i mpir_gc_x64/mpir_skylake_avx.dll {wheel}
&& cp {wheel} {dest_dir}
cp {wheel} {dest_dir}
CIBW_TEST_REQUIRES: pytest
CIBW_TEST_COMMAND: py.test -v {project}/python-bindings/test.py
run:
Expand Down
78 changes: 0 additions & 78 deletions .github/workflows/relic-nightly.yml

This file was deleted.

102 changes: 8 additions & 94 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if(NOT CMAKE_BUILD_TYPE)
)
endif()

project(BLS)
project(BLS C CXX ASM)

set(BUILD_BLS_PYTHON_BINDINGS "1" CACHE STRING "")
set(BUILD_BLS_TESTS "1" CACHE STRING "")
Expand Down Expand Up @@ -42,104 +42,18 @@ set(SODIUM_DISABLE_TESTS "on" CACHE STRING "")
set(SODIUM_CHIA_MINIMAL "on" CACHE STRING "")
FetchContent_MakeAvailable(Sodium)

if(DEFINED ENV{RELIC_MAIN})
set(RELIC_GIT_TAG "origin/main")
set(RELIC_REPOSITORY "https://github.com/relic-toolkit/relic.git")
else()
# This is currently anchored to upstream aecdcae7956f542fbee2392c1f0feb0a8ac41dc5
set(RELIC_GIT_TAG "215c69966cb78b255995f0ee9c86bbbb41c3c42b")
set(RELIC_REPOSITORY "https://github.com/Chia-Network/relic.git")
endif()
set(BLST_GIT_TAG "origin/master")
set(BLST_REPOSITORY "https://github.com/supranational/blst")

message(STATUS "Relic will be built from: ${RELIC_GIT_TAG} and repository ${RELIC_REPOSITORY}")
message(STATUS "blst will be built from: ${BLST_GIT_TAG} and repository ${BLST_REPOSITORY}")

FetchContent_Declare(
relic
GIT_REPOSITORY ${RELIC_REPOSITORY}
GIT_TAG ${RELIC_GIT_TAG}
blst
GIT_REPOSITORY ${BLST_REPOSITORY}
GIT_TAG ${BLST_GIT_TAG}
)

# Relic related options

set(STBIN "off" CACHE STRING "Relic - Build static binaries")

find_package(gmp)
if (GMP_FOUND)
message(STATUS "Found libgmp")
set(ARITH "gmp" CACHE STRING "")
else()
set(ARITH "easy" CACHE STRING "")
endif()

if(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(WSIZE "32" CACHE STRING "Relic - Processor word size")
else()
set(WSIZE "64" CACHE STRING "Relic - Processor word size")
endif()

if(EMSCRIPTEN)
# emscripten needs arch set to be none since it can't compile assembly
set(ARCH "" CACHE STRING "")
# emscripten is a 32 bit compiler
set(WSIZE "32" CACHE STRING "Relic - Processor word size")
endif()

if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(TIMER "ANSI" CACHE STRING "")
set(MULTI "OPENMP" CACHE STRING "")
else()
set(TIMER "CYCLE" CACHE STRING "")
set(MULTI "PTHREAD" CACHE STRING "")
endif()

set(CHECK "off" CACHE STRING "")
set(VERBS "off" CACHE STRING "")
set(ALLOC "AUTO" CACHE STRING "")
set(SHLIB "off" CACHE STRING "")
set(DOCUM "off" CACHE STRING "")
set(FP_PRIME "381" CACHE STRING "Relic - Prime modulus size")

if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(SEED "UDEV" CACHE STRING "")
set(FP_QNRES "off" CACHE STRING "")
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(SEED "WCGR" CACHE STRING "")
set(FP_QNRES "on" CACHE STRING "")
else()
set(SEED "UDEV" CACHE STRING "")
set(FP_QNRES "on" CACHE STRING "")
endif()

if(DEFINED ENV{RELIC_MAIN})
set(FP_METHD "INTEG;INTEG;INTEG;MONTY;LOWER;JMPDS;SLIDE" CACHE STRING "")
if(MSVC)
set(CFLAGS "" CACHE STRING "")
else()
set(CFLAGS "-O3 -funroll-loops -fomit-frame-pointer" CACHE STRING "")
endif()
else()
set(FP_METHD "INTEG;INTEG;INTEG;MONTY;LOWER;SLIDE" CACHE STRING "")
if(MSVC)
set(COMP_FLAGS "" CACHE STRING "")
else()
set(COMP_FLAGS "-O3 -funroll-loops -fomit-frame-pointer" CACHE STRING "")
endif()
endif()

set(FP_PMERS "off" CACHE STRING "")
set(FPX_METHD "INTEG;INTEG;LAZYR" CACHE STRING "")
set(EP_PLAIN "off" CACHE STRING "")
set(EP_SUPER "off" CACHE STRING "")
# Disable relic tests and benchmarks
set(TESTS "0" CACHE STRING "Relic - Number of times each test is ran")
set(BENCH "0" CACHE STRING "Relic - Number of times each benchmark is ran")

set(QUIET "on" CACHE STRING "Relic - Build with printing disabled")

set(PP_EXT "LAZYR" CACHE STRING "")
set(PP_METHD "LAZYR;OATEP" CACHE STRING "")

FetchContent_MakeAvailable(relic)
FetchContent_MakeAvailable(blst)

add_subdirectory(src)

Expand Down
87 changes: 0 additions & 87 deletions cmake_modules/Findgmp.cmake

This file was deleted.

9 changes: 0 additions & 9 deletions js-bindings/blsjs.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export declare class G1Element {
deepcopy(): G1Element;
get_fingerprint(): number;
add(el: G1Element): G1Element;
mul(bn: Bignum): G1Element;
equal_to(el: G1Element): boolean;
delete(): void;
}
Expand All @@ -62,7 +61,6 @@ export declare class G2Element {
negate(): G2Element;
deepcopy(): G2Element;
add(el: G2Element): G2Element;
mul(bn: Bignum): G2Element;
equal_to(el: G2Element): boolean;
delete(): void;
}
Expand All @@ -81,12 +79,6 @@ export declare class PrivateKey {
delete(): void;
}

export declare class Bignum {
static from_string(s: string, radix: number): Bignum;
toString(radix: number): string;
delete(): void;
}

export declare class Util {
static hash256(msg: Uint8Array): Uint8Array;
static hex_str(msg: Uint8Array): string;
Expand All @@ -99,7 +91,6 @@ export interface ModuleInstance {
G1Element: typeof G1Element;
G2Element: typeof G2Element;
PrivateKey: typeof PrivateKey;
Bignum: typeof Bignum;
Util: typeof Util;
}

Expand Down
27 changes: 0 additions & 27 deletions js-bindings/helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@ namespace helpers {
return buffer;
}

val toUint8Array(bn_t bn) {
std::vector<uint8_t> vec = toVector(bn);
val buffer = toUint8Array(vec);
return buffer;
}

std::vector<uint8_t> toVector(uint8_t *pointer, size_t data_size) {
std::vector<uint8_t> data;
data.reserve(data_size);
Expand All @@ -48,13 +42,6 @@ namespace helpers {
return vec;
}

std::vector<uint8_t> toVector(bn_t bn) {
uint8_t buf[bn_size_bin(bn)];
bn_write_bin(buf, bn_size_bin(bn), bn);
std::vector<uint8_t> vec = helpers::toVector(buf, bn_size_bin(bn));
return vec;
}

std::vector<std::vector<uint8_t>> jsBuffersArrayToVector(val buffersArray) {
auto l = buffersArray["length"].as<unsigned>();
std::vector<std::vector<uint8_t>> vec;
Expand All @@ -64,20 +51,6 @@ namespace helpers {
return vec;
}

std::vector<bn_t *> jsBuffersArrayToBnVector(val buffersArray) {
auto l = buffersArray["length"].as<unsigned>();
std::vector<bn_t *> vec;
for (unsigned i = 0; i < l; ++i) {
bn_t data;
bn_new(data);
std::vector<uint8_t> bnVec = toVector(buffersArray[i]);
bn_read_bin(data, bnVec.data(), static_cast<int>(bnVec.size()));
bn_t *point = &data;
vec.push_back(point);
}
return vec;
}

val byteArraysVectorToJsBuffersArray(std::vector<uint8_t *> arraysVector, size_t element_size) {
auto vecSize = arraysVector.size();
std::vector<val> valVector;
Expand Down
Loading