Skip to content

Commit c9e70ed

Browse files
committed
update libsimplicity to 121b2951d8cca3d73dccd6fcbe721f2195025067
This update renames a bunch of symbols from x to simplicity_x. This commit has a small number of non-mechanical changes to address that. It also updates the benchmarks and therefore the CMRs and AMRs of many jets. The one "judgement call" was to update wrapper.h in accordance with BlockstreamResearch/simplicity#248 (comment) to cover all the jet wrapper renames.
1 parent e42b267 commit c9e70ed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+6381
-6363
lines changed

simplicity-sys/depend/env.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,5 @@ void c_set_txEnv(txEnv *result, const transaction *tx, const tapEnv *taproot, co
6464
{
6565
sha256_midstate genesis;
6666
sha256_toMidstate(genesis.s, genesisHash);
67-
*result = build_txEnv(tx, taproot, &genesis, ix);
67+
*result = simplicity_build_txEnv(tx, taproot, &genesis, ix);
6868
}
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# This file has been automatically generated.
2-
714b44dafd66ab5d164c9247a0f793c320272162
2+
121b2951d8cca3d73dccd6fcbe721f2195025067

simplicity-sys/depend/simplicity/bitstream.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
* Precondition: NULL != stream
1212
*/
13-
simplicity_err closeBitstream(bitstream* stream) {
13+
simplicity_err simplicity_closeBitstream(bitstream* stream) {
1414
if (1 < stream->len) return SIMPLICITY_ERR_BITSTREAM_TRAILING_BYTES; /* If there is more than one byte remaining. */
1515
if (1 == stream->len) {
1616
if (0 == stream->offset) return SIMPLICITY_ERR_BITSTREAM_TRAILING_BYTES; /* If there is one byte remaining */
@@ -30,7 +30,7 @@ simplicity_err closeBitstream(bitstream* stream) {
3030
* Precondition: 0 <= n < 32
3131
* NULL != stream
3232
*/
33-
int32_t readNBits(int n, bitstream* stream) {
33+
int32_t simplicity_readNBits(int n, bitstream* stream) {
3434
simplicity_assert(0 <= n && n < 32);
3535

3636
uint32_t result = 0;
@@ -109,7 +109,7 @@ static int32_t decodeUpto3Bits(int32_t* result, bitstream* stream) {
109109
} else {
110110
int32_t n = decodeUpto3(stream);
111111
if (0 <= n) {
112-
*result = readNBits(n, stream);
112+
*result = simplicity_readNBits(n, stream);
113113
if (*result < 0) return *result;
114114
}
115115
return n;
@@ -153,7 +153,7 @@ static int32_t decodeUpto15Bits(int32_t* result, bitstream* stream) {
153153
} else {
154154
int32_t n = decodeUpto15(stream);
155155
if (0 <= n) {
156-
*result = readNBits(n, stream);
156+
*result = simplicity_readNBits(n, stream);
157157
if (*result < 0) return *result;
158158
}
159159
return n;
@@ -184,7 +184,7 @@ static int32_t decodeUpto65535(bitstream* stream) {
184184
*
185185
* Precondition: NULL != stream
186186
*/
187-
int32_t decodeUptoMaxInt(bitstream* stream) {
187+
int32_t simplicity_decodeUptoMaxInt(bitstream* stream) {
188188
int32_t bit = read1Bit(stream);
189189
if (bit < 0) return bit;
190190
if (0 == bit) {
@@ -194,7 +194,7 @@ int32_t decodeUptoMaxInt(bitstream* stream) {
194194
if (n < 0) return n;
195195
if (30 < n) return SIMPLICITY_ERR_DATA_OUT_OF_RANGE;
196196
{
197-
int32_t result = readNBits(n, stream);
197+
int32_t result = simplicity_readNBits(n, stream);
198198
if (result < 0) return result;
199199
return ((1 << n) | result);
200200
}
@@ -211,7 +211,7 @@ int32_t decodeUptoMaxInt(bitstream* stream) {
211211
* n <= 2^31
212212
* NULL != stream
213213
*/
214-
simplicity_err readBitstring(bitstring* result, size_t n, bitstream* stream) {
214+
simplicity_err simplicity_readBitstring(bitstring* result, size_t n, bitstream* stream) {
215215
static_assert(0x80000000u + 2*(CHAR_BIT - 1) <= SIZE_MAX, "size_t needs to be at least 32-bits");
216216
simplicity_assert(n <= 0x80000000u);
217217
size_t total_offset = n + stream->offset;

simplicity-sys/depend/simplicity/bitstream.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static inline bitstream initializeBitstream(const unsigned char* arr, size_t len
3636
*
3737
* Precondition: NULL != stream
3838
*/
39-
simplicity_err closeBitstream(bitstream* stream);
39+
simplicity_err simplicity_closeBitstream(bitstream* stream);
4040

4141
/* Fetches up to 31 bits from 'stream' as the 'n' least significant bits of return value.
4242
* The 'n' bits are set from the MSB to the LSB.
@@ -45,15 +45,15 @@ simplicity_err closeBitstream(bitstream* stream);
4545
* Precondition: 0 <= n < 32
4646
* NULL != stream
4747
*/
48-
int32_t readNBits(int n, bitstream* stream);
48+
int32_t simplicity_readNBits(int n, bitstream* stream);
4949

5050
/* Returns one bit from 'stream', 0 or 1.
5151
* Returns 'SIMPLICITY_ERR_BITSTREAM_EOF' if no bits are available.
5252
*
5353
* Precondition: NULL != stream
5454
*/
5555
static inline int32_t read1Bit(bitstream* stream) {
56-
return readNBits(1, stream);
56+
return simplicity_readNBits(1, stream);
5757
}
5858

5959
/* Decode an encoded number between 1 and 2^31 - 1 inclusive.
@@ -64,7 +64,7 @@ static inline int32_t read1Bit(bitstream* stream) {
6464
*
6565
* Precondition: NULL != stream
6666
*/
67-
int32_t decodeUptoMaxInt(bitstream* stream);
67+
int32_t simplicity_decodeUptoMaxInt(bitstream* stream);
6868

6969
/* Fills a 'bitstring' containing 'n' bits from 'stream'.
7070
* Returns 'SIMPLICITY_ERR_BITSTREAM_EOF' if not enough bits are available.
@@ -76,5 +76,5 @@ int32_t decodeUptoMaxInt(bitstream* stream);
7676
* n <= 2^31
7777
* NULL != stream
7878
*/
79-
simplicity_err readBitstring(bitstring* result, size_t n, bitstream* stream);
79+
simplicity_err simplicity_readBitstring(bitstring* result, size_t n, bitstream* stream);
8080
#endif

simplicity-sys/depend/simplicity/cmr.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ bool simplicity_computeCmr( simplicity_err* error, unsigned char* cmr
2626

2727
bitstream stream = initializeBitstream(program, program_len);
2828
dag_node* dag = NULL;
29-
int32_t dag_len = decodeMallocDag(&dag, NULL, &stream);
29+
int_fast32_t dag_len = simplicity_decodeMallocDag(&dag, NULL, &stream);
3030
if (dag_len <= 0) {
3131
simplicity_assert(dag_len < 0);
32-
*error = dag_len;
32+
*error = (simplicity_err)dag_len;
3333
} else {
3434
simplicity_assert(NULL != dag);
35-
simplicity_assert((size_t)dag_len <= DAG_LEN_MAX);
36-
*error = closeBitstream(&stream);
35+
simplicity_assert((uint_fast32_t)dag_len <= DAG_LEN_MAX);
36+
*error = simplicity_closeBitstream(&stream);
3737
sha256_fromMidstate(cmr, dag[dag_len-1].cmr.s);
3838
}
3939

0 commit comments

Comments
 (0)