From b0b42cd2f789c623011272c7837baf22eefedffe Mon Sep 17 00:00:00 2001 From: stringhandler Date: Wed, 13 May 2026 16:55:05 +0200 Subject: [PATCH] chore(deps): update simplicity C backend to add op_return jets --- simplicity-sys/depend/jets_wrapper.c | 7 + .../depend/simplicity-HEAD-revision.txt | 2 +- .../elements/decodeElementsJets.inc | 7 + .../depend/simplicity/elements/elementsJets.c | 138 +++++++++++++++++- .../depend/simplicity/elements/elementsJets.h | 7 + .../depend/simplicity/elements/env.c | 19 ++- .../simplicity/elements/primitiveEnumJet.inc | 7 + .../simplicity/elements/primitiveEnumTy.inc | 6 + .../simplicity/elements/primitiveInitTy.inc | 6 + .../simplicity/elements/primitiveJetNode.inc | 56 +++++++ .../depend/simplicity/elements/txEnv.h | 15 +- simplicity-sys/depend/wrapper.c | 2 +- simplicity-sys/depend/wrapper.h | 13 +- simplicity-sys/src/c_jets/jets_ffi.rs | 14 ++ simplicity-sys/src/c_jets/jets_wrapper.rs | 28 ++++ simplicity-sys/vendor-simplicity.sh | 107 ++++++++------ src/jet/init/elements.rs | 124 +++++++++++++++- update_jets.sh | 2 + 18 files changed, 497 insertions(+), 63 deletions(-) diff --git a/simplicity-sys/depend/jets_wrapper.c b/simplicity-sys/depend/jets_wrapper.c index bbc84bcd..1c636be5 100644 --- a/simplicity-sys/depend/jets_wrapper.c +++ b/simplicity-sys/depend/jets_wrapper.c @@ -347,6 +347,13 @@ WRAP_(output_is_fee) WRAP_(output_nonce) WRAP_(output_nonces_hash) WRAP_(output_null_datum) +WRAP_(output_null_get_bytes_1) +WRAP_(output_null_get_bytes_16) +WRAP_(output_null_get_bytes_2) +WRAP_(output_null_get_bytes_32) +WRAP_(output_null_get_bytes_4) +WRAP_(output_null_get_bytes_64) +WRAP_(output_null_get_bytes_8) WRAP_(output_range_proof) WRAP_(output_range_proofs_hash) WRAP_(output_script_hash) diff --git a/simplicity-sys/depend/simplicity-HEAD-revision.txt b/simplicity-sys/depend/simplicity-HEAD-revision.txt index dc23e242..6d74462b 100644 --- a/simplicity-sys/depend/simplicity-HEAD-revision.txt +++ b/simplicity-sys/depend/simplicity-HEAD-revision.txt @@ -1,2 +1,2 @@ # This file has been automatically generated. -c6ab4dd8f17838506f92f0d829c40618168817cd +6190147fde1e49239d84834746d6fd215663a734 diff --git a/simplicity-sys/depend/simplicity/elements/decodeElementsJets.inc b/simplicity-sys/depend/simplicity/elements/decodeElementsJets.inc index f72ba6a3..6863b575 100644 --- a/simplicity-sys/depend/simplicity/elements/decodeElementsJets.inc +++ b/simplicity-sys/depend/simplicity/elements/decodeElementsJets.inc @@ -130,6 +130,13 @@ case 48: *result = VERSION; return SIMPLICITY_NO_ERROR; case 49: *result = GENESIS_BLOCK_HASH; return SIMPLICITY_NO_ERROR; case 50: *result = TRANSACTION_ID; return SIMPLICITY_NO_ERROR; + case 51: *result = OUTPUT_NULL_GET_BYTES_1; return SIMPLICITY_NO_ERROR; + case 52: *result = OUTPUT_NULL_GET_BYTES_2; return SIMPLICITY_NO_ERROR; + case 53: *result = OUTPUT_NULL_GET_BYTES_4; return SIMPLICITY_NO_ERROR; + case 54: *result = OUTPUT_NULL_GET_BYTES_8; return SIMPLICITY_NO_ERROR; + case 55: *result = OUTPUT_NULL_GET_BYTES_16; return SIMPLICITY_NO_ERROR; + case 56: *result = OUTPUT_NULL_GET_BYTES_32; return SIMPLICITY_NO_ERROR; + case 57: *result = OUTPUT_NULL_GET_BYTES_64; return SIMPLICITY_NO_ERROR; } break; } diff --git a/simplicity-sys/depend/simplicity/elements/elementsJets.c b/simplicity-sys/depend/simplicity/elements/elementsJets.c index a09183dd..ed7c8d22 100644 --- a/simplicity-sys/depend/simplicity/elements/elementsJets.c +++ b/simplicity-sys/depend/simplicity/elements/elementsJets.c @@ -427,7 +427,7 @@ bool rustsimplicity_0_7_output_null_datum(frameItem* dst, frameItem src, const t if (writeBit(dst, i < env->tx->numOutputs && env->tx->output[i].isNullData)) { uint_fast32_t j = rustsimplicity_0_7_read32(&src); if (writeBit(dst, j < env->tx->output[i].pnd.len)) { - if (writeBit(dst, OP_PUSHDATA4 < env->tx->output[i].pnd.op[j].code)) { + if (writeBit(dst, OP_PUSHBYTES_64 < env->tx->output[i].pnd.op[j].code)) { skipBits(dst, 2 + 256 - 5); if (writeBit(dst, OP_1 <= env->tx->output[i].pnd.op[j].code)) { switch (env->tx->output[i].pnd.op[j].code) { @@ -457,10 +457,19 @@ bool rustsimplicity_0_7_output_null_datum(frameItem* dst, frameItem src, const t } } else { switch (env->tx->output[i].pnd.op[j].code) { - case OP_IMMEDIATE: writeBit(dst, 0); writeBit(dst, 0); break; - case OP_PUSHDATA: writeBit(dst, 0); writeBit(dst, 1); break; - case OP_PUSHDATA2: writeBit(dst, 1); writeBit(dst, 0); break; - case OP_PUSHDATA4: writeBit(dst, 1); writeBit(dst, 1); break; + case OP_IMMEDIATE: writeBit(dst, 0); writeBit(dst, 0); break; + case OP_PUSHDATA: writeBit(dst, 0); writeBit(dst, 1); break; + case OP_PUSHDATA2: writeBit(dst, 1); writeBit(dst, 0); break; + case OP_PUSHDATA4: writeBit(dst, 1); writeBit(dst, 1); break; + case OP_PUSHBYTES_1: + case OP_PUSHBYTES_2: + case OP_PUSHBYTES_4: + case OP_PUSHBYTES_8: + case OP_PUSHBYTES_16: + case OP_PUSHBYTES_32: + case OP_PUSHBYTES_64: + /* These were historically part of OP_IMMEDIATE*/ + writeBit(dst, 0); writeBit(dst, 0); break; default: SIMPLICITY_UNREACHABLE; } writeHash(dst, &env->tx->output[i].pnd.op[j].dataHash); @@ -474,6 +483,125 @@ bool rustsimplicity_0_7_output_null_datum(frameItem* dst, frameItem src, const t return true; } +/* output_null_get_8 : TWO^32 * TWO^32 |- S (S TWO^64) */ +bool rustsimplicity_0_7_output_null_get_bytes_8(frameItem* dst, frameItem src, const txEnv* env) { + uint_fast32_t i = rustsimplicity_0_7_read32(&src); + if (writeBit(dst, i < env->tx->numOutputs && env->tx->output[i].isNullData)) { + uint_fast32_t j = rustsimplicity_0_7_read32(&src); + if (writeBit(dst, j < env->tx->output[i].pnd.len && + OP_PUSHBYTES_8 == env->tx->output[i].pnd.op[j].code)) { + write8s(dst, env->tx->output[i].pnd.op[j].data, 8); + } else { + skipBits(dst, 64); + } + } else { + skipBits(dst, 1 + 64); + } + return true; +} + +/* output_null_get_1 : TWO^32 * TWO^32 |- S (S TWO^8) */ +bool rustsimplicity_0_7_output_null_get_bytes_1(frameItem* dst, frameItem src, const txEnv* env) { + uint_fast32_t i = rustsimplicity_0_7_read32(&src); + if (writeBit(dst, i < env->tx->numOutputs && env->tx->output[i].isNullData)) { + uint_fast32_t j = rustsimplicity_0_7_read32(&src); + if (writeBit(dst, j < env->tx->output[i].pnd.len && + OP_PUSHBYTES_1 == env->tx->output[i].pnd.op[j].code)) { + write8s(dst, env->tx->output[i].pnd.op[j].data, 1); + } else { + skipBits(dst, 8); + } + } else { + skipBits(dst, 1 + 8); + } + return true; +} + +/* output_null_get_2 : TWO^32 * TWO^32 |- S (S TWO^16) */ +bool rustsimplicity_0_7_output_null_get_bytes_2(frameItem* dst, frameItem src, const txEnv* env) { + uint_fast32_t i = rustsimplicity_0_7_read32(&src); + if (writeBit(dst, i < env->tx->numOutputs && env->tx->output[i].isNullData)) { + uint_fast32_t j = rustsimplicity_0_7_read32(&src); + if (writeBit(dst, j < env->tx->output[i].pnd.len && + OP_PUSHBYTES_2 == env->tx->output[i].pnd.op[j].code)) { + write8s(dst, env->tx->output[i].pnd.op[j].data, 2); + } else { + skipBits(dst, 16); + } + } else { + skipBits(dst, 1 + 16); + } + return true; +} + +/* output_null_get_4 : TWO^32 * TWO^32 |- S (S TWO^32) */ +bool rustsimplicity_0_7_output_null_get_bytes_4(frameItem* dst, frameItem src, const txEnv* env) { + uint_fast32_t i = rustsimplicity_0_7_read32(&src); + if (writeBit(dst, i < env->tx->numOutputs && env->tx->output[i].isNullData)) { + uint_fast32_t j = rustsimplicity_0_7_read32(&src); + if (writeBit(dst, j < env->tx->output[i].pnd.len && + OP_PUSHBYTES_4 == env->tx->output[i].pnd.op[j].code)) { + write8s(dst, env->tx->output[i].pnd.op[j].data, 4); + } else { + skipBits(dst, 32); + } + } else { + skipBits(dst, 1 + 32); + } + return true; +} + +/* output_null_get_16 : TWO^32 * TWO^32 |- S (S TWO^128) */ +bool rustsimplicity_0_7_output_null_get_bytes_16(frameItem* dst, frameItem src, const txEnv* env) { + uint_fast32_t i = rustsimplicity_0_7_read32(&src); + if (writeBit(dst, i < env->tx->numOutputs && env->tx->output[i].isNullData)) { + uint_fast32_t j = rustsimplicity_0_7_read32(&src); + if (writeBit(dst, j < env->tx->output[i].pnd.len && + OP_PUSHBYTES_16 == env->tx->output[i].pnd.op[j].code)) { + write8s(dst, env->tx->output[i].pnd.op[j].data, 16); + } else { + skipBits(dst, 128); + } + } else { + skipBits(dst, 1 + 128); + } + return true; +} + +/* output_null_get_32 : TWO^32 * TWO^32 |- S (S TWO^256) */ +bool rustsimplicity_0_7_output_null_get_bytes_32(frameItem* dst, frameItem src, const txEnv* env) { + uint_fast32_t i = rustsimplicity_0_7_read32(&src); + if (writeBit(dst, i < env->tx->numOutputs && env->tx->output[i].isNullData)) { + uint_fast32_t j = rustsimplicity_0_7_read32(&src); + if (writeBit(dst, j < env->tx->output[i].pnd.len && + OP_PUSHBYTES_32 == env->tx->output[i].pnd.op[j].code)) { + write8s(dst, env->tx->output[i].pnd.op[j].data, 32); + } else { + skipBits(dst, 256); + } + } else { + skipBits(dst, 1 + 256); + } + return true; +} + +/* output_null_get_64 : TWO^32 * TWO^32 |- S (S TWO^512) */ +bool rustsimplicity_0_7_output_null_get_bytes_64(frameItem* dst, frameItem src, const txEnv* env) { + uint_fast32_t i = rustsimplicity_0_7_read32(&src); + if (writeBit(dst, i < env->tx->numOutputs && env->tx->output[i].isNullData)) { + uint_fast32_t j = rustsimplicity_0_7_read32(&src); + if (writeBit(dst, j < env->tx->output[i].pnd.len && + OP_PUSHBYTES_64 == env->tx->output[i].pnd.op[j].code)) { + write8s(dst, env->tx->output[i].pnd.op[j].data, 64); + } else { + skipBits(dst, 512); + } + } else { + skipBits(dst, 1 + 512); + } + return true; +} + /* output_is_fee : TWO^32 |- S TWO */ bool rustsimplicity_0_7_output_is_fee(frameItem* dst, frameItem src, const txEnv* env) { uint_fast32_t i = rustsimplicity_0_7_read32(&src); diff --git a/simplicity-sys/depend/simplicity/elements/elementsJets.h b/simplicity-sys/depend/simplicity/elements/elementsJets.h index d07fb1b0..1d6d190b 100644 --- a/simplicity-sys/depend/simplicity/elements/elementsJets.h +++ b/simplicity-sys/depend/simplicity/elements/elementsJets.h @@ -28,6 +28,13 @@ bool rustsimplicity_0_7_output_amount(frameItem* dst, frameItem src, const txEnv bool rustsimplicity_0_7_output_nonce(frameItem* dst, frameItem src, const txEnv* env); bool rustsimplicity_0_7_output_script_hash(frameItem* dst, frameItem src, const txEnv* env); bool rustsimplicity_0_7_output_null_datum(frameItem* dst, frameItem src, const txEnv* env); +bool rustsimplicity_0_7_output_null_get_bytes_1(frameItem* dst, frameItem src, const txEnv* env); +bool rustsimplicity_0_7_output_null_get_bytes_2(frameItem* dst, frameItem src, const txEnv* env); +bool rustsimplicity_0_7_output_null_get_bytes_4(frameItem* dst, frameItem src, const txEnv* env); +bool rustsimplicity_0_7_output_null_get_bytes_8(frameItem* dst, frameItem src, const txEnv* env); +bool rustsimplicity_0_7_output_null_get_bytes_16(frameItem* dst, frameItem src, const txEnv* env); +bool rustsimplicity_0_7_output_null_get_bytes_32(frameItem* dst, frameItem src, const txEnv* env); +bool rustsimplicity_0_7_output_null_get_bytes_64(frameItem* dst, frameItem src, const txEnv* env); bool rustsimplicity_0_7_output_is_fee(frameItem* dst, frameItem src, const txEnv* env); bool rustsimplicity_0_7_output_surjection_proof(frameItem* dst, frameItem src, const txEnv* env); bool rustsimplicity_0_7_output_range_proof(frameItem* dst, frameItem src, const txEnv* env); diff --git a/simplicity-sys/depend/simplicity/elements/env.c b/simplicity-sys/depend/simplicity/elements/env.c index 06757b83..d888a4dc 100644 --- a/simplicity-sys/depend/simplicity/elements/env.c +++ b/simplicity-sys/depend/simplicity/elements/env.c @@ -200,7 +200,16 @@ static void parseNullData(parsedNullData* result, opcode** allocation, size_t* a uint_fast32_t skip = 0; if (code < 0x4c) { skip = code; - (*allocation)[result->len].code = OP_IMMEDIATE; + switch (skip) { + case 1: (*allocation)[result->len].code = OP_PUSHBYTES_1; break; + case 2: (*allocation)[result->len].code = OP_PUSHBYTES_2; break; + case 4: (*allocation)[result->len].code = OP_PUSHBYTES_4; break; + case 8: (*allocation)[result->len].code = OP_PUSHBYTES_8; break; + case 16: (*allocation)[result->len].code = OP_PUSHBYTES_16; break; + case 32: (*allocation)[result->len].code = OP_PUSHBYTES_32; break; + case 64: (*allocation)[result->len].code = OP_PUSHBYTES_64; break; + default: (*allocation)[result->len].code = OP_IMMEDIATE; break; + } } else { if (scriptPubKey->len == i) { result->op = NULL; return; } skip = scriptPubKey->buf[i++]; @@ -225,6 +234,14 @@ static void parseNullData(parsedNullData* result, opcode** allocation, size_t* a sha256_context ctx = sha256_init((*allocation)[result->len].dataHash.s); sha256_uchars(&ctx, &scriptPubKey->buf[i], skip); sha256_finalize(&ctx); + opcodeType oc = (*allocation)[result->len].code; + if (OP_PUSHBYTES_1 == oc || OP_PUSHBYTES_2 == oc || OP_PUSHBYTES_4 == oc || + OP_PUSHBYTES_8 == oc || OP_PUSHBYTES_16 == oc || OP_PUSHBYTES_32 == oc || OP_PUSHBYTES_64 == oc) { + memcpy((*allocation)[result->len].data, &scriptPubKey->buf[i], skip); + (*allocation)[result->len].len = (uint_fast8_t)skip; + } else { + (*allocation)[result->len].len = 0; + } } i += skip; } diff --git a/simplicity-sys/depend/simplicity/elements/primitiveEnumJet.inc b/simplicity-sys/depend/simplicity/elements/primitiveEnumJet.inc index 57420913..6d393d43 100644 --- a/simplicity-sys/depend/simplicity/elements/primitiveEnumJet.inc +++ b/simplicity-sys/depend/simplicity/elements/primitiveEnumJet.inc @@ -342,6 +342,13 @@ OUTPUT_IS_FEE, OUTPUT_NONCE, OUTPUT_NONCES_HASH, OUTPUT_NULL_DATUM, +OUTPUT_NULL_GET_BYTES_1, +OUTPUT_NULL_GET_BYTES_16, +OUTPUT_NULL_GET_BYTES_2, +OUTPUT_NULL_GET_BYTES_32, +OUTPUT_NULL_GET_BYTES_4, +OUTPUT_NULL_GET_BYTES_64, +OUTPUT_NULL_GET_BYTES_8, OUTPUT_RANGE_PROOF, OUTPUT_RANGE_PROOFS_HASH, OUTPUT_SCRIPT_HASH, diff --git a/simplicity-sys/depend/simplicity/elements/primitiveEnumTy.inc b/simplicity-sys/depend/simplicity/elements/primitiveEnumTy.inc index d4ab68ff..e7b453bc 100644 --- a/simplicity-sys/depend/simplicity/elements/primitiveEnumTy.inc +++ b/simplicity-sys/depend/simplicity/elements/primitiveEnumTy.inc @@ -43,7 +43,13 @@ ty_mw512, ty_mw1Ki, ty_mw2Ki, ty_mmb, +ty_mmw8, +ty_mmw16, +ty_mmw32, +ty_mmw64, +ty_mmw128, ty_mmw256, +ty_mmw512, ty_mmspbw256w64, ty_mmspbw256w256, ty_mmspw2w256sbw4, diff --git a/simplicity-sys/depend/simplicity/elements/primitiveInitTy.inc b/simplicity-sys/depend/simplicity/elements/primitiveInitTy.inc index 56713027..3a97012c 100644 --- a/simplicity-sys/depend/simplicity/elements/primitiveInitTy.inc +++ b/simplicity-sys/depend/simplicity/elements/primitiveInitTy.inc @@ -43,7 +43,13 @@ (*bound_var)[ty_mw1Ki] = (unification_var){ .isBound = true, .bound = { .kind = SUM, .arg = { &(*bound_var)[ty_u], &(*bound_var)[ty_w1Ki] } }}; (*bound_var)[ty_mw2Ki] = (unification_var){ .isBound = true, .bound = { .kind = SUM, .arg = { &(*bound_var)[ty_u], &(*bound_var)[ty_w2Ki] } }}; (*bound_var)[ty_mmb] = (unification_var){ .isBound = true, .bound = { .kind = SUM, .arg = { &(*bound_var)[ty_u], &(*bound_var)[ty_mb] } }}; +(*bound_var)[ty_mmw8] = (unification_var){ .isBound = true, .bound = { .kind = SUM, .arg = { &(*bound_var)[ty_u], &(*bound_var)[ty_mw8] } }}; +(*bound_var)[ty_mmw16] = (unification_var){ .isBound = true, .bound = { .kind = SUM, .arg = { &(*bound_var)[ty_u], &(*bound_var)[ty_mw16] } }}; +(*bound_var)[ty_mmw32] = (unification_var){ .isBound = true, .bound = { .kind = SUM, .arg = { &(*bound_var)[ty_u], &(*bound_var)[ty_mw32] } }}; +(*bound_var)[ty_mmw64] = (unification_var){ .isBound = true, .bound = { .kind = SUM, .arg = { &(*bound_var)[ty_u], &(*bound_var)[ty_mw64] } }}; +(*bound_var)[ty_mmw128] = (unification_var){ .isBound = true, .bound = { .kind = SUM, .arg = { &(*bound_var)[ty_u], &(*bound_var)[ty_mw128] } }}; (*bound_var)[ty_mmw256] = (unification_var){ .isBound = true, .bound = { .kind = SUM, .arg = { &(*bound_var)[ty_u], &(*bound_var)[ty_mw256] } }}; +(*bound_var)[ty_mmw512] = (unification_var){ .isBound = true, .bound = { .kind = SUM, .arg = { &(*bound_var)[ty_u], &(*bound_var)[ty_mw512] } }}; (*bound_var)[ty_mmspbw256w64] = (unification_var){ .isBound = true, .bound = { .kind = SUM, .arg = { &(*bound_var)[ty_u], &(*bound_var)[ty_mspbw256w64] } }}; (*bound_var)[ty_mmspbw256w256] = (unification_var){ .isBound = true, .bound = { .kind = SUM, .arg = { &(*bound_var)[ty_u], &(*bound_var)[ty_mspbw256w256] } }}; (*bound_var)[ty_mmspw2w256sbw4] = (unification_var){ .isBound = true, .bound = { .kind = SUM, .arg = { &(*bound_var)[ty_u], &(*bound_var)[ty_mspw2w256sbw4] } }}; diff --git a/simplicity-sys/depend/simplicity/elements/primitiveJetNode.inc b/simplicity-sys/depend/simplicity/elements/primitiveJetNode.inc index 7a026915..7ecdd16d 100644 --- a/simplicity-sys/depend/simplicity/elements/primitiveJetNode.inc +++ b/simplicity-sys/depend/simplicity/elements/primitiveJetNode.inc @@ -2743,6 +2743,62 @@ , .targetIx = ty_mmspw2w256sbw4 , .cost = 87 /* milli weight units */ } +,[OUTPUT_NULL_GET_BYTES_1] = +{ .tag = JET +, .jet = rustsimplicity_0_7_output_null_get_bytes_1 +, .cmr = {{0x8bf23336u, 0xd47f9e5eu, 0x06ddd129u, 0xf85abde1u, 0xbd3c7348u, 0x6f67492eu, 0x4f9a75e0u, 0xdc49dab3u}} +, .sourceIx = ty_w64 +, .targetIx = ty_mmw8 +, .cost = 87 /* milli weight units */ +} +,[OUTPUT_NULL_GET_BYTES_16] = +{ .tag = JET +, .jet = rustsimplicity_0_7_output_null_get_bytes_16 +, .cmr = {{0x6e8728a5u, 0x5aea2152u, 0x7c65df6cu, 0x723f183fu, 0xdcf21755u, 0x4f1ec023u, 0x351bd996u, 0xd867f865u}} +, .sourceIx = ty_w64 +, .targetIx = ty_mmw128 +, .cost = 87 /* milli weight units */ +} +,[OUTPUT_NULL_GET_BYTES_2] = +{ .tag = JET +, .jet = rustsimplicity_0_7_output_null_get_bytes_2 +, .cmr = {{0x407b4a04u, 0x151832c0u, 0x01155e4bu, 0xd5d1ba1fu, 0xc281be56u, 0x7a6c4854u, 0x15a08c88u, 0x44fa469cu}} +, .sourceIx = ty_w64 +, .targetIx = ty_mmw16 +, .cost = 87 /* milli weight units */ +} +,[OUTPUT_NULL_GET_BYTES_32] = +{ .tag = JET +, .jet = rustsimplicity_0_7_output_null_get_bytes_32 +, .cmr = {{0x8f86b4e8u, 0x74192318u, 0x0f76e15du, 0xc253ab5du, 0x1d4789f5u, 0x92bd89deu, 0xde5fa48eu, 0xbf36a7b0u}} +, .sourceIx = ty_w64 +, .targetIx = ty_mmw256 +, .cost = 87 /* milli weight units */ +} +,[OUTPUT_NULL_GET_BYTES_4] = +{ .tag = JET +, .jet = rustsimplicity_0_7_output_null_get_bytes_4 +, .cmr = {{0xf3490672u, 0x71087129u, 0xe32317a4u, 0x8437cdfau, 0x73ea391fu, 0x2bbddcf2u, 0xc6481f57u, 0xd3bf0761u}} +, .sourceIx = ty_w64 +, .targetIx = ty_mmw32 +, .cost = 87 /* milli weight units */ +} +,[OUTPUT_NULL_GET_BYTES_64] = +{ .tag = JET +, .jet = rustsimplicity_0_7_output_null_get_bytes_64 +, .cmr = {{0x2d472c26u, 0xb6382ddau, 0x0f0bbd8au, 0x7b3e2445u, 0xd0ff1b81u, 0x0ceb2317u, 0x0a22c013u, 0xd21f4838u}} +, .sourceIx = ty_w64 +, .targetIx = ty_mmw512 +, .cost = 87 /* milli weight units */ +} +,[OUTPUT_NULL_GET_BYTES_8] = +{ .tag = JET +, .jet = rustsimplicity_0_7_output_null_get_bytes_8 +, .cmr = {{0xeb1c3a7fu, 0xc1a71350u, 0x9c597ebcu, 0x67661bdbu, 0x48e81105u, 0x69009969u, 0xe24fcf2cu, 0x458d66a7u}} +, .sourceIx = ty_w64 +, .targetIx = ty_mmw64 +, .cost = 87 /* milli weight units */ +} ,[OUTPUT_RANGE_PROOF] = { .tag = JET , .jet = rustsimplicity_0_7_output_range_proof diff --git a/simplicity-sys/depend/simplicity/elements/txEnv.h b/simplicity-sys/depend/simplicity/elements/txEnv.h index 013d81b4..11c45c64 100644 --- a/simplicity-sys/depend/simplicity/elements/txEnv.h +++ b/simplicity-sys/depend/simplicity/elements/txEnv.h @@ -60,12 +60,21 @@ typedef struct confAmount { /* In Elements, a null-data scriptPubKey consists of an OP_RETURN followed by data only pushes (i.e. only opcodes less than OP_16). * This is an enumeration of all such data only push operation names. * OP_IMMEDIATE represents OP_0 and all the one-byte prefixes of data pushes up to 75 bytes. + * OP_PUSHBYTES_1/2/4/8/16/32/64 represent push operations whose data is exactly 1, 2, 4, 8, 16, 32, or 64 bytes; + * these store the raw bytes inline rather than a hash. */ typedef enum opcodeType { OP_IMMEDIATE, OP_PUSHDATA, OP_PUSHDATA2, OP_PUSHDATA4, + OP_PUSHBYTES_1, + OP_PUSHBYTES_2, + OP_PUSHBYTES_4, + OP_PUSHBYTES_8, + OP_PUSHBYTES_16, + OP_PUSHBYTES_32, + OP_PUSHBYTES_64, OP_1NEGATE, OP_RESERVED, OP_1, @@ -90,10 +99,14 @@ typedef enum opcodeType { * This is a structure represents a digest of all such operations. * 'code' represents the operation name. * If 'code' \in {OP_IMMEDIATE, OP_PUSHDATA, OP_PUSHDATA2, OP_PUSHDATA4} then 'dataHash' represents the SHA-256 hash of data pushed - * by the push operation. + * by the push operation, and 'len' is 0. + * If 'code' \in {OP_PUSHBYTES_1, OP_PUSHBYTES_2, OP_PUSHBYTES_4, OP_PUSHBYTES_8, OP_PUSHBYTES_16, OP_PUSHBYTES_32, OP_PUSHBYTES_64} + * then 'dataHash' is the SHA-256 hash of the pushed bytes, 'data' holds the raw pushed bytes, and 'len' is their count. */ typedef struct opcode { sha256_midstate dataHash; + uint8_t data[64]; + uint_fast8_t len; opcodeType code; } opcode; diff --git a/simplicity-sys/depend/wrapper.c b/simplicity-sys/depend/wrapper.c index 72122ef5..3912b819 100644 --- a/simplicity-sys/depend/wrapper.c +++ b/simplicity-sys/depend/wrapper.c @@ -92,4 +92,4 @@ void c_skipBits(frameItem *frame, size_t n) skipBits(frame, n); } -#endif +#endif \ No newline at end of file diff --git a/simplicity-sys/depend/wrapper.h b/simplicity-sys/depend/wrapper.h index 976f28df..171747c1 100644 --- a/simplicity-sys/depend/wrapper.h +++ b/simplicity-sys/depend/wrapper.h @@ -1,11 +1,12 @@ #ifndef WRAPPER_H #define WRAPPER_H -#define WRAP_(jet) \ -bool rustsimplicity_0_7_c_##jet(frameItem* dst, const frameItem* src, const txEnv* env) { \ - bool result = rustsimplicity_0_7_##jet(dst, *src, env); \ - rustsimplicity_0_7_assert(!result || 0 == dst->offset); \ - return result; \ -} +#define WRAP_(jet) \ + bool rustsimplicity_0_7_c_##jet(frameItem *dst, const frameItem *src, const txEnv *env) \ + { \ + bool result = rustsimplicity_0_7_##jet(dst, *src, env); \ + rustsimplicity_0_7_assert(!result || 0 == dst->offset); \ + return result; \ + } #endif diff --git a/simplicity-sys/src/c_jets/jets_ffi.rs b/simplicity-sys/src/c_jets/jets_ffi.rs index 3cc9b957..301a11a7 100644 --- a/simplicity-sys/src/c_jets/jets_ffi.rs +++ b/simplicity-sys/src/c_jets/jets_ffi.rs @@ -690,6 +690,20 @@ extern "C" { pub fn output_nonces_hash(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; #[link_name = "rustsimplicity_0_7_c_output_null_datum"] pub fn output_null_datum(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; + #[link_name = "rustsimplicity_0_7_c_output_null_get_bytes_1"] + pub fn output_null_get_bytes_1(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; + #[link_name = "rustsimplicity_0_7_c_output_null_get_bytes_16"] + pub fn output_null_get_bytes_16(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; + #[link_name = "rustsimplicity_0_7_c_output_null_get_bytes_2"] + pub fn output_null_get_bytes_2(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; + #[link_name = "rustsimplicity_0_7_c_output_null_get_bytes_32"] + pub fn output_null_get_bytes_32(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; + #[link_name = "rustsimplicity_0_7_c_output_null_get_bytes_4"] + pub fn output_null_get_bytes_4(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; + #[link_name = "rustsimplicity_0_7_c_output_null_get_bytes_64"] + pub fn output_null_get_bytes_64(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; + #[link_name = "rustsimplicity_0_7_c_output_null_get_bytes_8"] + pub fn output_null_get_bytes_8(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; #[link_name = "rustsimplicity_0_7_c_output_range_proof"] pub fn output_range_proof(dst: *mut CFrameItem, src: *const CFrameItem, env: *const CElementsTxEnv) -> bool; #[link_name = "rustsimplicity_0_7_c_output_range_proofs_hash"] diff --git a/simplicity-sys/src/c_jets/jets_wrapper.rs b/simplicity-sys/src/c_jets/jets_wrapper.rs index ed8fe1b8..94824002 100644 --- a/simplicity-sys/src/c_jets/jets_wrapper.rs +++ b/simplicity-sys/src/c_jets/jets_wrapper.rs @@ -1375,6 +1375,34 @@ pub fn output_null_datum(dst: &mut CFrameItem, src: CFrameItem, env: &CElementsT unsafe { elements_ffi::output_null_datum(dst, &src, env) } } +pub fn output_null_get_bytes_1(dst: &mut CFrameItem, src: CFrameItem, env: &CElementsTxEnv) -> bool { + unsafe { elements_ffi::output_null_get_bytes_1(dst, &src, env) } +} + +pub fn output_null_get_bytes_16(dst: &mut CFrameItem, src: CFrameItem, env: &CElementsTxEnv) -> bool { + unsafe { elements_ffi::output_null_get_bytes_16(dst, &src, env) } +} + +pub fn output_null_get_bytes_2(dst: &mut CFrameItem, src: CFrameItem, env: &CElementsTxEnv) -> bool { + unsafe { elements_ffi::output_null_get_bytes_2(dst, &src, env) } +} + +pub fn output_null_get_bytes_32(dst: &mut CFrameItem, src: CFrameItem, env: &CElementsTxEnv) -> bool { + unsafe { elements_ffi::output_null_get_bytes_32(dst, &src, env) } +} + +pub fn output_null_get_bytes_4(dst: &mut CFrameItem, src: CFrameItem, env: &CElementsTxEnv) -> bool { + unsafe { elements_ffi::output_null_get_bytes_4(dst, &src, env) } +} + +pub fn output_null_get_bytes_64(dst: &mut CFrameItem, src: CFrameItem, env: &CElementsTxEnv) -> bool { + unsafe { elements_ffi::output_null_get_bytes_64(dst, &src, env) } +} + +pub fn output_null_get_bytes_8(dst: &mut CFrameItem, src: CFrameItem, env: &CElementsTxEnv) -> bool { + unsafe { elements_ffi::output_null_get_bytes_8(dst, &src, env) } +} + pub fn output_range_proof(dst: &mut CFrameItem, src: CFrameItem, env: &CElementsTxEnv) -> bool { unsafe { elements_ffi::output_range_proof(dst, &src, env) } } diff --git a/simplicity-sys/vendor-simplicity.sh b/simplicity-sys/vendor-simplicity.sh index 15544905..224fb3f0 100755 --- a/simplicity-sys/vendor-simplicity.sh +++ b/simplicity-sys/vendor-simplicity.sh @@ -37,24 +37,12 @@ if [ ! -d "$LIBSIM_PATH" ]; then exit 1 fi -if [ -d "$VENDORED_SIM_DIR" ]; then - while true; do - read -r -p "$VENDORED_SIM_DIR will be deleted [yn]: " yn - case $yn in - [Yy]* ) break;; - [Nn]* ) exit;; - * ) echo "Please answer y or n.";; - esac - done - - rm -rf "$VENDORED_SIM_DIR" -elif [ -e "$VENDORED_SIM_DIR" ]; then - echo "'simplicity' inside depend directory exists but appears not to be a directory." - echo "Please move or delete this file." - exit 1 -fi +## 2. Set up output directory on Linux filesystem (avoids all NTFS permission issues) +OUT_DIR=/tmp/simplicity_vendor_out +rm -rf "$OUT_DIR" +mkdir -p "$OUT_DIR/depend" "$OUT_DIR/src" -## 2. Copy files from libsimplicity +## 3. Copy files from libsimplicity into output dir pushd "$LIBSIM_PATH/C" if test -n "$(git status --porcelain)"; then @@ -62,41 +50,72 @@ if test -n "$(git status --porcelain)"; then fi HEAD=$(git rev-parse HEAD) -echo "# This file has been automatically generated." > "$DEPEND_PATH/simplicity-HEAD-revision.txt" -echo "$HEAD" >> "$DEPEND_PATH/simplicity-HEAD-revision.txt" +{ + echo "# This file has been automatically generated." + echo "$HEAD" +} > "$OUT_DIR/depend/simplicity-HEAD-revision.txt" -# Copy C folder to simplicity-sys/depend/simplicity -# Use rsync to copy only files tracked by git -git ls-files | rsync -av --files-from=- . "$VENDORED_SIM_DIR" +git ls-files | rsync -av --files-from=- . "$OUT_DIR/depend/simplicity" popd -## 3. Patch things to include versions +## 4. Patch things to include versions (all on Linux fs, no NTFS issues) -# a. patch our own drop/new functions for C structures. -find "$DEPEND_PATH/.." -name "*.rs" -type f -exec sed -i "s/rust_[0-9_]*_free/rust_${SIMPLICITY_ALLOC_VERSION_CODE}_free/" {} \; -find "$DEPEND_PATH/.." -name "*.rs" -type f -exec sed -i "s/rust_[0-9_]*_malloc/rust_${SIMPLICITY_ALLOC_VERSION_CODE}_malloc/" {} \; -find "$DEPEND_PATH/.." -name "*.rs" -type f -exec sed -i "s/rust_[0-9_]*_calloc/rust_${SIMPLICITY_ALLOC_VERSION_CODE}_calloc/" {} \; +# a. patch rust alloc function names in .rs files +find "$DEPEND_PATH/.." -name "*.rs" -type f | while IFS= read -r src; do + # compute destination path relative to simplicity-sys root + rel="${src#$DEPEND_PATH/../}" + dest="$OUT_DIR/$rel" + mkdir -p "$(dirname "$dest")" + sed "s/rust_[0-9_]*_free/rust_${SIMPLICITY_ALLOC_VERSION_CODE}_free/; + s/rust_[0-9_]*_malloc/rust_${SIMPLICITY_ALLOC_VERSION_CODE}_malloc/; + s/rust_[0-9_]*_calloc/rust_${SIMPLICITY_ALLOC_VERSION_CODE}_calloc/" "$src" > "$dest" +done # b. patch the rust_{malloc,calloc,free} functions in simplicity_alloc.h sed "s/rust_/rust_${SIMPLICITY_ALLOC_VERSION_CODE}_/" \ < "$DEPEND_PATH/simplicity_alloc.h.patch" \ - | patch "$VENDORED_SIM_DIR/simplicity_alloc.h" + | patch "$OUT_DIR/depend/simplicity/simplicity_alloc.h" -# c. patch every single simplicity_* symbol in the library (every instance except -# those in #includes, which is overkill but doesn't hurt anything) -find "$DEPEND_PATH/simplicity" \( -name "*.[ch]" -o -name '*.inc' \) -type f -print0 | xargs -0 \ - sed -i "/^#include/! s/simplicity_/rustsimplicity_${SIMPLICITY_ALLOC_VERSION_CODE}_/g" +# c. patch every single simplicity_* symbol in the library +find "$OUT_DIR/depend/simplicity" -not -path "*/secp256k1/*" \( -name "*.[ch]" -o -name '*.inc' \) -type f | while IFS= read -r f; do + sed "/^#include/! s/simplicity_/rustsimplicity_${SIMPLICITY_ALLOC_VERSION_CODE}_/g" "$f" > /tmp/_sv_tmp && mv /tmp/_sv_tmp "$f" +done # ...ok, actually we didn't want to replace simplicity_err -find "$DEPEND_PATH/simplicity" \( -name "*.[ch]" -o -name '*.inc' \) -type f -print0 | xargs -0 \ - sed -i "s/rustsimplicity_${SIMPLICITY_ALLOC_VERSION_CODE}_err/simplicity_err/g" -# Special-case calls in depend/env.c and depend/warpper.h -sed -i -r "s/rustsimplicity_[0-9]+_[0-9]+_/rustsimplicity_${SIMPLICITY_ALLOC_VERSION_CODE}_/" \ - "$DEPEND_PATH/env.c" \ - "$DEPEND_PATH/wrapper.h" - -# d. ...also update the corresponding link_name= entries in the Rust source code -find "./src/" -name "*.rs" -type f -print0 | xargs -0 \ - sed -i -r "s/rustsimplicity_[0-9]+_[0-9]+_(.*)([\"\(])/rustsimplicity_${SIMPLICITY_ALLOC_VERSION_CODE}_\1\2/g" -# e. ...and the links= field in the manifest file -sed -i -r "s/^links = \".*\"$/links = \"rustsimplicity_${SIMPLICITY_ALLOC_VERSION_CODE}\"/" Cargo.toml +find "$OUT_DIR/depend/simplicity" -not -path "*/secp256k1/*" \( -name "*.[ch]" -o -name '*.inc' \) -type f | while IFS= read -r f; do + sed "s/rustsimplicity_${SIMPLICITY_ALLOC_VERSION_CODE}_err/simplicity_err/g" "$f" > /tmp/_sv_tmp && mv /tmp/_sv_tmp "$f" +done + +# Special-case calls in depend/env.c and depend/wrapper.h +sed "s/rustsimplicity_[0-9]\+_[0-9]\+_/rustsimplicity_${SIMPLICITY_ALLOC_VERSION_CODE}_/" \ + "$DEPEND_PATH/env.c" > "$OUT_DIR/depend/env.c" +sed "s/rustsimplicity_[0-9]\+_[0-9]\+_/rustsimplicity_${SIMPLICITY_ALLOC_VERSION_CODE}_/" \ + "$DEPEND_PATH/wrapper.h" > "$OUT_DIR/depend/wrapper.h" + +# d. update link_name= entries in Rust source code +find "$DEPEND_PATH/../src" -name "*.rs" -type f | while IFS= read -r src; do + rel="${src#$DEPEND_PATH/../}" + dest="$OUT_DIR/$rel" + mkdir -p "$(dirname "$dest")" + sed "s/rustsimplicity_[0-9]\+_[0-9]\+_\(.*\)\([\"(]\)/rustsimplicity_${SIMPLICITY_ALLOC_VERSION_CODE}_\1\2/g" "$src" > "$dest" +done + +# e. update the links= field in the manifest file +sed "s/^links = \".*\"$/links = \"rustsimplicity_${SIMPLICITY_ALLOC_VERSION_CODE}\"/" \ + "$DEPEND_PATH/../Cargo.toml" > "$OUT_DIR/Cargo.toml" + +## 5. Copy results back to NTFS destination +if [ -d "$VENDORED_SIM_DIR" ]; then + rm -rf "$VENDORED_SIM_DIR" +fi +cp -r "$OUT_DIR/depend/simplicity" "$VENDORED_SIM_DIR" +cp "$OUT_DIR/depend/simplicity-HEAD-revision.txt" "$DEPEND_PATH/simplicity-HEAD-revision.txt" +cp "$OUT_DIR/depend/env.c" "$DEPEND_PATH/env.c" +cp "$OUT_DIR/depend/wrapper.h" "$DEPEND_PATH/wrapper.h" +cp "$OUT_DIR/Cargo.toml" "$DEPEND_PATH/../Cargo.toml" +find "$OUT_DIR/src" -name "*.rs" -type f | while IFS= read -r f; do + rel="${f#$OUT_DIR/}" + cp "$f" "$DEPEND_PATH/../$rel" +done + +echo "Done." diff --git a/src/jet/init/elements.rs b/src/jet/init/elements.rs index 18c2bf9e..3679a70e 100644 --- a/src/jet/init/elements.rs +++ b/src/jet/init/elements.rs @@ -358,6 +358,13 @@ pub enum Elements { OutputNonce, OutputNoncesHash, OutputNullDatum, + OutputNullGetBytes1, + OutputNullGetBytes16, + OutputNullGetBytes2, + OutputNullGetBytes32, + OutputNullGetBytes4, + OutputNullGetBytes64, + OutputNullGetBytes8, OutputRangeProof, OutputRangeProofsHash, OutputScriptHash, @@ -490,7 +497,7 @@ pub enum Elements { impl Elements { /// Array of all Elements jets. - pub const ALL: [Self; 471] = [ + pub const ALL: [Self; 478] = [ Self::Add16, Self::Add32, Self::Add64, @@ -834,6 +841,13 @@ impl Elements { Self::OutputNonce, Self::OutputNoncesHash, Self::OutputNullDatum, + Self::OutputNullGetBytes1, + Self::OutputNullGetBytes16, + Self::OutputNullGetBytes2, + Self::OutputNullGetBytes32, + Self::OutputNullGetBytes4, + Self::OutputNullGetBytes64, + Self::OutputNullGetBytes8, Self::OutputRangeProof, Self::OutputRangeProofsHash, Self::OutputScriptHash, @@ -2684,6 +2698,41 @@ impl Jet for Elements { 0xc8, 0x62, 0x8b, 0x7f, 0xd3, 0xb4, 0xcf, 0x8e, 0x7b, 0xce, 0x70, 0x75, 0x8f, 0xa6, 0xf6, 0xf1, 0x47, 0xbf, ], + Elements::OutputNullGetBytes1 => [ + 0x8b, 0xf2, 0x33, 0x36, 0xd4, 0x7f, 0x9e, 0x5e, 0x06, 0xdd, 0xd1, 0x29, 0xf8, 0x5a, + 0xbd, 0xe1, 0xbd, 0x3c, 0x73, 0x48, 0x6f, 0x67, 0x49, 0x2e, 0x4f, 0x9a, 0x75, 0xe0, + 0xdc, 0x49, 0xda, 0xb3, + ], + Elements::OutputNullGetBytes16 => [ + 0x6e, 0x87, 0x28, 0xa5, 0x5a, 0xea, 0x21, 0x52, 0x7c, 0x65, 0xdf, 0x6c, 0x72, 0x3f, + 0x18, 0x3f, 0xdc, 0xf2, 0x17, 0x55, 0x4f, 0x1e, 0xc0, 0x23, 0x35, 0x1b, 0xd9, 0x96, + 0xd8, 0x67, 0xf8, 0x65, + ], + Elements::OutputNullGetBytes2 => [ + 0x40, 0x7b, 0x4a, 0x04, 0x15, 0x18, 0x32, 0xc0, 0x01, 0x15, 0x5e, 0x4b, 0xd5, 0xd1, + 0xba, 0x1f, 0xc2, 0x81, 0xbe, 0x56, 0x7a, 0x6c, 0x48, 0x54, 0x15, 0xa0, 0x8c, 0x88, + 0x44, 0xfa, 0x46, 0x9c, + ], + Elements::OutputNullGetBytes32 => [ + 0x8f, 0x86, 0xb4, 0xe8, 0x74, 0x19, 0x23, 0x18, 0x0f, 0x76, 0xe1, 0x5d, 0xc2, 0x53, + 0xab, 0x5d, 0x1d, 0x47, 0x89, 0xf5, 0x92, 0xbd, 0x89, 0xde, 0xde, 0x5f, 0xa4, 0x8e, + 0xbf, 0x36, 0xa7, 0xb0, + ], + Elements::OutputNullGetBytes4 => [ + 0xf3, 0x49, 0x06, 0x72, 0x71, 0x08, 0x71, 0x29, 0xe3, 0x23, 0x17, 0xa4, 0x84, 0x37, + 0xcd, 0xfa, 0x73, 0xea, 0x39, 0x1f, 0x2b, 0xbd, 0xdc, 0xf2, 0xc6, 0x48, 0x1f, 0x57, + 0xd3, 0xbf, 0x07, 0x61, + ], + Elements::OutputNullGetBytes64 => [ + 0x2d, 0x47, 0x2c, 0x26, 0xb6, 0x38, 0x2d, 0xda, 0x0f, 0x0b, 0xbd, 0x8a, 0x7b, 0x3e, + 0x24, 0x45, 0xd0, 0xff, 0x1b, 0x81, 0x0c, 0xeb, 0x23, 0x17, 0x0a, 0x22, 0xc0, 0x13, + 0xd2, 0x1f, 0x48, 0x38, + ], + Elements::OutputNullGetBytes8 => [ + 0xeb, 0x1c, 0x3a, 0x7f, 0xc1, 0xa7, 0x13, 0x50, 0x9c, 0x59, 0x7e, 0xbc, 0x67, 0x66, + 0x1b, 0xdb, 0x48, 0xe8, 0x11, 0x05, 0x69, 0x00, 0x99, 0x69, 0xe2, 0x4f, 0xcf, 0x2c, + 0x45, 0x8d, 0x66, 0xa7, + ], Elements::OutputRangeProof => [ 0x6f, 0xf9, 0xef, 0x3d, 0xac, 0x50, 0x43, 0x10, 0xdf, 0xbc, 0x60, 0x56, 0x1d, 0x2a, 0xdd, 0xeb, 0x44, 0x93, 0x2f, 0x77, 0x7e, 0x7f, 0x13, 0xad, 0xf0, 0x77, 0x4e, 0xb6, @@ -3674,6 +3723,13 @@ impl Jet for Elements { Elements::OutputNonce => b"i", Elements::OutputNoncesHash => b"1", Elements::OutputNullDatum => b"l", + Elements::OutputNullGetBytes1 => b"l", + Elements::OutputNullGetBytes16 => b"l", + Elements::OutputNullGetBytes2 => b"l", + Elements::OutputNullGetBytes32 => b"l", + Elements::OutputNullGetBytes4 => b"l", + Elements::OutputNullGetBytes64 => b"l", + Elements::OutputNullGetBytes8 => b"l", Elements::OutputRangeProof => b"i", Elements::OutputRangeProofsHash => b"1", Elements::OutputScriptHash => b"i", @@ -4152,6 +4208,13 @@ impl Jet for Elements { Elements::OutputNonce => b"+1+1+*2hh", Elements::OutputNoncesHash => b"h", Elements::OutputNullDatum => b"+1+1+**22h+2**22*22", + Elements::OutputNullGetBytes1 => b"+1+1***22*22**22*22", + Elements::OutputNullGetBytes16 => b"+1+1*ll", + Elements::OutputNullGetBytes2 => b"+1+1****22*22**22*22***22*22**22*22", + Elements::OutputNullGetBytes32 => b"+1+1h", + Elements::OutputNullGetBytes4 => b"+1+1i", + Elements::OutputNullGetBytes64 => b"+1+1*hh", + Elements::OutputNullGetBytes8 => b"+1+1l", Elements::OutputRangeProof => b"+1h", Elements::OutputRangeProofsHash => b"h", Elements::OutputScriptHash => b"+1h", @@ -4758,6 +4821,13 @@ impl Jet for Elements { Elements::Version => (462384, 19), Elements::GenesisBlockHash => (462385, 19), Elements::TransactionId => (462386, 19), + Elements::OutputNullGetBytes1 => (462387, 19), + Elements::OutputNullGetBytes2 => (462388, 19), + Elements::OutputNullGetBytes4 => (462389, 19), + Elements::OutputNullGetBytes8 => (462390, 19), + Elements::OutputNullGetBytes16 => (462391, 19), + Elements::OutputNullGetBytes32 => (462392, 19), + Elements::OutputNullGetBytes64 => (462393, 19), }; w.write_bits_be(n, len) @@ -7388,12 +7458,30 @@ impl Jet for Elements { }, 1 => { 0 => {Elements::TransactionId}, - 1 => {} + 1 => {Elements::OutputNullGetBytes1} } }, - 1 => {} + 1 => { + 0 => { + 0 => {Elements::OutputNullGetBytes2}, + 1 => {Elements::OutputNullGetBytes4} + }, + 1 => { + 0 => {Elements::OutputNullGetBytes8}, + 1 => {Elements::OutputNullGetBytes16} + } + } }, - 1 => {} + 1 => { + 0 => { + 0 => { + 0 => {Elements::OutputNullGetBytes32}, + 1 => {Elements::OutputNullGetBytes64} + }, + 1 => {} + }, + 1 => {} + } } } }, @@ -7764,6 +7852,13 @@ impl Jet for Elements { Elements::OutputNonce => Cost::from_milliweight(196), Elements::OutputNoncesHash => Cost::from_milliweight(151), Elements::OutputNullDatum => Cost::from_milliweight(87), + Elements::OutputNullGetBytes1 => Cost::from_milliweight(87), + Elements::OutputNullGetBytes16 => Cost::from_milliweight(87), + Elements::OutputNullGetBytes2 => Cost::from_milliweight(87), + Elements::OutputNullGetBytes32 => Cost::from_milliweight(87), + Elements::OutputNullGetBytes4 => Cost::from_milliweight(87), + Elements::OutputNullGetBytes64 => Cost::from_milliweight(87), + Elements::OutputNullGetBytes8 => Cost::from_milliweight(87), Elements::OutputRangeProof => Cost::from_milliweight(154), Elements::OutputRangeProofsHash => Cost::from_milliweight(136), Elements::OutputScriptHash => Cost::from_milliweight(151), @@ -8246,6 +8341,13 @@ impl fmt::Display for Elements { Elements::OutputNonce => f.write_str("output_nonce"), Elements::OutputNoncesHash => f.write_str("output_nonces_hash"), Elements::OutputNullDatum => f.write_str("output_null_datum"), + Elements::OutputNullGetBytes1 => f.write_str("output_null_get_bytes_1"), + Elements::OutputNullGetBytes16 => f.write_str("output_null_get_bytes_16"), + Elements::OutputNullGetBytes2 => f.write_str("output_null_get_bytes_2"), + Elements::OutputNullGetBytes32 => f.write_str("output_null_get_bytes_32"), + Elements::OutputNullGetBytes4 => f.write_str("output_null_get_bytes_4"), + Elements::OutputNullGetBytes64 => f.write_str("output_null_get_bytes_64"), + Elements::OutputNullGetBytes8 => f.write_str("output_null_get_bytes_8"), Elements::OutputRangeProof => f.write_str("output_range_proof"), Elements::OutputRangeProofsHash => f.write_str("output_range_proofs_hash"), Elements::OutputScriptHash => f.write_str("output_script_hash"), @@ -8726,6 +8828,13 @@ impl str::FromStr for Elements { "output_nonce" => Ok(Elements::OutputNonce), "output_nonces_hash" => Ok(Elements::OutputNoncesHash), "output_null_datum" => Ok(Elements::OutputNullDatum), + "output_null_get_bytes_1" => Ok(Elements::OutputNullGetBytes1), + "output_null_get_bytes_16" => Ok(Elements::OutputNullGetBytes16), + "output_null_get_bytes_2" => Ok(Elements::OutputNullGetBytes2), + "output_null_get_bytes_32" => Ok(Elements::OutputNullGetBytes32), + "output_null_get_bytes_4" => Ok(Elements::OutputNullGetBytes4), + "output_null_get_bytes_64" => Ok(Elements::OutputNullGetBytes64), + "output_null_get_bytes_8" => Ok(Elements::OutputNullGetBytes8), "output_range_proof" => Ok(Elements::OutputRangeProof), "output_range_proofs_hash" => Ok(Elements::OutputRangeProofsHash), "output_script_hash" => Ok(Elements::OutputScriptHash), @@ -9204,6 +9313,13 @@ pub(crate) fn c_jet_ptr(jet: &Elements) -> fn(&mut CFrameItem, CFrameItem, &CEle Elements::OutputNonce => simplicity_sys::c_jets::jets_wrapper::output_nonce, Elements::OutputNoncesHash => simplicity_sys::c_jets::jets_wrapper::output_nonces_hash, Elements::OutputNullDatum => simplicity_sys::c_jets::jets_wrapper::output_null_datum, + Elements::OutputNullGetBytes1 => simplicity_sys::c_jets::jets_wrapper::output_null_get_bytes_1, + Elements::OutputNullGetBytes16 => simplicity_sys::c_jets::jets_wrapper::output_null_get_bytes_16, + Elements::OutputNullGetBytes2 => simplicity_sys::c_jets::jets_wrapper::output_null_get_bytes_2, + Elements::OutputNullGetBytes32 => simplicity_sys::c_jets::jets_wrapper::output_null_get_bytes_32, + Elements::OutputNullGetBytes4 => simplicity_sys::c_jets::jets_wrapper::output_null_get_bytes_4, + Elements::OutputNullGetBytes64 => simplicity_sys::c_jets::jets_wrapper::output_null_get_bytes_64, + Elements::OutputNullGetBytes8 => simplicity_sys::c_jets::jets_wrapper::output_null_get_bytes_8, Elements::OutputRangeProof => simplicity_sys::c_jets::jets_wrapper::output_range_proof, Elements::OutputRangeProofsHash => simplicity_sys::c_jets::jets_wrapper::output_range_proofs_hash, Elements::OutputScriptHash => simplicity_sys::c_jets::jets_wrapper::output_script_hash, diff --git a/update_jets.sh b/update_jets.sh index 2156b35e..98d65f33 100755 --- a/update_jets.sh +++ b/update_jets.sh @@ -40,6 +40,8 @@ mv "${C_DIR}/jets_wrapper.c" "./simplicity-sys/depend/jets_wrapper.c" # Tweak the c_ prefixes in the wrappers sed -i -r "s/\"c_/\"rustsimplicity_${SIMPLICITY_ALLOC_VERSION_CODE}_c_/" \ "./simplicity-sys/src/c_jets/jets_ffi.rs" + +# Update version prefix in wrapper.h if the version changed sed -i -r "s/ rustsimplicity_[0-9]+_[0-9]+_/ rustsimplicity_${SIMPLICITY_ALLOC_VERSION_CODE}_/" \ "./simplicity-sys/depend/wrapper.h"