55#include < cstdio>
66#include < primitives/transaction.h>
77extern " C" {
8- #include < simplicity/cmr.h>
8+ #include < simplicity/elements/ cmr.h>
99#include < simplicity/elements/env.h>
1010#include < simplicity/elements/exec.h>
1111}
@@ -31,9 +31,9 @@ static std::vector<unsigned char> TAPROOT_ANNEX(99, 0x50);
3131
3232// Defined in simplicity_compute_amr.c
3333extern " C" {
34- bool simplicity_computeAmr ( simplicity_err* error, unsigned char * amr
35- , const unsigned char * program, size_t program_len
36- , const unsigned char * witness, size_t witness_len);
34+ bool simplicity_elements_computeAmr ( simplicity_err* error, unsigned char * amr
35+ , const unsigned char * program, size_t program_len
36+ , const unsigned char * witness, size_t witness_len);
3737}
3838
3939void initialize_simplicity ()
@@ -149,8 +149,8 @@ FUZZ_TARGET_INIT(simplicity, initialize_simplicity)
149149 simplicity_err error;
150150 unsigned char cmr[32 ];
151151 unsigned char amr[32 ];
152- assert (simplicity_computeAmr (&error, amr, prog_data, prog_data_len, wit_data, wit_data_len));
153- assert (simplicity_computeCmr (&error, cmr, prog_data, prog_data_len));
152+ assert (simplicity_elements_computeAmr (&error, amr, prog_data, prog_data_len, wit_data, wit_data_len));
153+ assert (simplicity_elements_computeCmr (&error, cmr, prog_data, prog_data_len));
154154
155155 // The remainder is just copy/pasted from the original fuzztest
156156
@@ -196,7 +196,7 @@ FUZZ_TARGET_INIT(simplicity, initialize_simplicity)
196196 }
197197
198198 // 5. Set up Simplicity environment and tx environment
199- rawTapEnv simplicityRawTap;
199+ rawElementsTapEnv simplicityRawTap;
200200 simplicityRawTap.controlBlock = TAPROOT_CONTROL.data ();
201201 simplicityRawTap.pathLen = (TAPROOT_CONTROL.size () - TAPROOT_CONTROL_BASE_SIZE) / TAPROOT_CONTROL_NODE_SIZE;
202202 simplicityRawTap.scriptCMR = cmr;
@@ -210,15 +210,15 @@ FUZZ_TARGET_INIT(simplicity, initialize_simplicity)
210210 unsigned char imr_out[32 ];
211211 unsigned char *imr = mtx.vin [0 ].prevout .hash .data ()[2 ] & 2 ? imr_out : NULL ;
212212
213- const transaction * tx = txdata.m_simplicity_tx_data .get ();
214- tapEnv * taproot = simplicity_elements_mallocTapEnv (&simplicityRawTap);
215- simplicity_elements_execSimplicity (&error, imr, tx, nIn, taproot, GENESIS_HASH.data (), budget, amr, prog_bytes.data (), prog_bytes.size (), wit_bytes.data (), wit_bytes.size ());
213+ const elementsTransaction * tx = txdata.m_simplicity_tx_data .get ();
214+ elementsTapEnv * taproot = simplicity_elements_mallocTapEnv (&simplicityRawTap);
215+ simplicity_elements_execSimplicity (&error, imr, tx, nIn, taproot, GENESIS_HASH.data (), 0 , budget, amr, prog_bytes.data (), prog_bytes.size (), wit_bytes.data (), wit_bytes.size ());
216216
217217 // 5. Secondary test -- try flipping a bunch of bits and check that this doesn't mess things up
218218 for (size_t j = 0 ; j < 8 * prog_bytes.size (); j++) {
219219 if (j > 32 && j % 23 != 0 ) continue ; // skip most bits so this test doesn't overwhelm the fuzz time
220220 prog_bytes.data ()[j / 8 ] ^= (1 << (j % 8 ));
221- simplicity_elements_execSimplicity (&error, imr, tx, nIn, taproot, GENESIS_HASH.data (), budget, amr, prog_bytes.data (), prog_bytes.size (), wit_bytes.data (), wit_bytes.size ());
221+ simplicity_elements_execSimplicity (&error, imr, tx, nIn, taproot, GENESIS_HASH.data (), 0 , budget, amr, prog_bytes.data (), prog_bytes.size (), wit_bytes.data (), wit_bytes.size ());
222222 }
223223
224224 // 6. Cleanup
0 commit comments