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

remove nightly condition for alt_bn256 #386

Merged
merged 1 commit into from
Apr 19, 2024
Merged
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
6 changes: 0 additions & 6 deletions packages/near-sdk-js/builder/builder.c
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,6 @@ static JSValue near_uint8array_to_utf8_string(JSContext *ctx, JSValueConst this_
return JS_NewStringLen(ctx, (const char *)data_ptr, data_len);
}

#ifdef NIGHTLY
static JSValue near_alt_bn128_g1_multiexp(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
{
uint64_t register_id;
Expand Down Expand Up @@ -1104,7 +1103,6 @@ static JSValue near_alt_bn128_pairing_check(JSContext *ctx, JSValueConst this_va
ret = alt_bn128_pairing_check(data_len, (uint64_t)data_ptr);
return JS_NewBigUint64(ctx, ret);
}
#endif

static void js_add_near_host_functions(JSContext* ctx) {
JSValue global_obj, env;
Expand Down Expand Up @@ -1165,13 +1163,9 @@ static void js_add_near_host_functions(JSContext* ctx) {
JS_SetPropertyStr(ctx, env, "storage_has_key", JS_NewCFunction(ctx, near_storage_has_key, "storage_has_key", 2));
JS_SetPropertyStr(ctx, env, "validator_stake", JS_NewCFunction(ctx, near_validator_stake, "validator_stake", 2));
JS_SetPropertyStr(ctx, env, "validator_total_stake", JS_NewCFunction(ctx, near_validator_total_stake, "validator_total_stake", 1));
#ifdef NIGHTLY
// as of Jun 24, 2022, alt_bn128 is not a nightly protocol feature any more. It's part of protocol version 55. But, testnet
// is at protocol version 54 and mainnet is at protocol version 53. We'll enable and add alt_bn128 as they in testnet.
JS_SetPropertyStr(ctx, env, "alt_bn128_g1_multiexp", JS_NewCFunction(ctx, near_alt_bn128_g1_multiexp, "alt_bn128_g1_multiexp", 2));
JS_SetPropertyStr(ctx, env, "alt_bn128_g1_sum", JS_NewCFunction(ctx, near_alt_bn128_g1_sum, "alt_bn128_g1_sum", 2));
JS_SetPropertyStr(ctx, env, "alt_bn128_pairing_check", JS_NewCFunction(ctx, near_alt_bn128_pairing_check, "alt_bn128_pairing_check", 1));
#endif

JS_SetPropertyStr(ctx, env, "latin1_string_to_uint8array", JS_NewCFunction(ctx, near_latin1_string_to_uint8array, "latin1_string_to_uint8array", 1));
JS_SetPropertyStr(ctx, env, "utf8_string_to_uint8array", JS_NewCFunction(ctx, near_utf8_string_to_uint8array, "utf8_string_to_uint8array", 1));
Expand Down
4 changes: 1 addition & 3 deletions tests/__tests__/test_math_api.ava.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,4 @@ test("ecrecover", async (t) => {
);
});

// As of Jun 24, 2022, near-sandbox is using 97c0410de519ecaca369aaee26f0ca5eb9e7de06, in which alt_bn256 is still
// under nightly protocol feature. As near-sandbox is built without nightly protocol feature, alt_bn256 operations
// cannot be tested yet
// TODO add test for alt_bn256 functions
Loading