Skip to content

Commit 368010a

Browse files
authored
Merge pull request ElementsProject#1390 from ElementsProject/simplicity
Update to latest Simplicity
2 parents e9a9144 + 00399aa commit 368010a

40 files changed

+1364
-1238
lines changed

Makefile.am

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@ LCOV_FILTER_PATTERN = \
195195
-p "src/crypto/ctaes" \
196196
-p "src/minisketch" \
197197
-p "src/secp256k1" \
198-
-p "src/simplicity/secp256k1" \
199198
-p "depends"
200199

201200
DIR_FUZZ_SEED_CORPUS ?= qa-assets/fuzz_seed_corpus

src/Makefile.elementssimplicity.include

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ include simplicity/elements-sources.mk
33
LIBELEMENTSSIMPLICITY = libelementssimplicity.la
44
noinst_LTLIBRARIES += $(LIBELEMENTSSIMPLICITY)
55
libelementssimplicity_la_SOURCES = $(ELEMENTS_SIMPLICITY_LIB_SOURCES_INT) $(ELEMENTS_SIMPLICITY_DIST_HEADERS_INT) $(ELEMENTS_SIMPLICITY_LIB_HEADERS_INT)
6-
libelementssimplicity_la_CPPFLAGS = $(AM_CPPFLAGS) $(SHANI_CXXFLAGS) -I$(srcdir)/$(ELEMENTS_SIMPLICITY_INCLUDE_DIR_INT)
6+
libelementssimplicity_la_CPPFLAGS = $(AM_CPPFLAGS) $(SHANI_CXXFLAGS) $(SANITIZER_CXXFLAGS) -I$(srcdir)/$(ELEMENTS_SIMPLICITY_INCLUDE_DIR_INT)

src/script/interpreter.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2660,7 +2660,8 @@ void PrecomputedTransactionData::Init(const T& txTo, std::vector<CTxOut>&& spent
26602660
}
26612661

26622662
rawTransaction simplicityRawTx;
2663-
simplicityRawTx.txid = txTo.GetHash().begin();
2663+
uint256 rawHash = txTo.GetHash();
2664+
simplicityRawTx.txid = rawHash.begin();
26642665
simplicityRawTx.input = simplicityRawInput.data();
26652666
simplicityRawTx.numInputs = simplicityRawInput.size();
26662667
simplicityRawTx.output = simplicityRawOutput.data();
@@ -3123,7 +3124,7 @@ bool GenericTransactionSignatureChecker<T>::CheckSimplicity(const valtype& progr
31233124
if (!simplicity_elements_execSimplicity(&error, 0, txdata->m_simplicity_tx_data, nIn, simplicityTapEnv, txdata->m_hash_genesis_block.data(), budget, 0, program.data(), program.size(), witness.data(), witness.size())) {
31243125
assert(!"simplicity_elements_execSimplicity internal error");
31253126
}
3126-
free(simplicityTapEnv);
3127+
simplicity_elements_freeTapEnv(simplicityTapEnv);
31273128
switch (error) {
31283129
case SIMPLICITY_NO_ERROR: return set_success(serror);
31293130
case SIMPLICITY_ERR_MALLOC:
@@ -3133,7 +3134,7 @@ bool GenericTransactionSignatureChecker<T>::CheckSimplicity(const valtype& progr
31333134
case SIMPLICITY_ERR_DATA_OUT_OF_RANGE: return set_error(serror, SCRIPT_ERR_SIMPLICITY_DATA_OUT_OF_RANGE);
31343135
case SIMPLICITY_ERR_DATA_OUT_OF_ORDER: return set_error(serror, SCRIPT_ERR_SIMPLICITY_DATA_OUT_OF_ORDER);
31353136
case SIMPLICITY_ERR_FAIL_CODE: return set_error(serror, SCRIPT_ERR_SIMPLICITY_FAIL_CODE);
3136-
case SIMPLICITY_ERR_STOP_CODE: return set_error(serror, SCRIPT_ERR_SIMPLICITY_STOP_CODE);
3137+
case SIMPLICITY_ERR_RESERVED_CODE: return set_error(serror, SCRIPT_ERR_SIMPLICITY_RESERVED_CODE);
31373138
case SIMPLICITY_ERR_HIDDEN: return set_error(serror, SCRIPT_ERR_SIMPLICITY_HIDDEN);
31383139
case SIMPLICITY_ERR_BITSTREAM_EOF: return set_error(serror, SCRIPT_ERR_SIMPLICITY_BITSTREAM_EOF);
31393140
case SIMPLICITY_ERR_BITSTREAM_TRAILING_BYTES: return set_error(serror, SCRIPT_ERR_SIMPLICITY_BITSTREAM_TRAILING_BYTES);

src/script/interpreter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ struct PrecomputedTransactionData
222222
template <class T>
223223
explicit PrecomputedTransactionData(const T& tx);
224224
~PrecomputedTransactionData() {
225-
free(m_simplicity_tx_data);
225+
simplicity_elements_freeTransaction(m_simplicity_tx_data);
226226
}
227227
};
228228

src/script/script_error.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ std::string ScriptErrorString(const ScriptError serror)
140140
return SIMPLICITY_ERR_MSG(SIMPLICITY_ERR_DATA_OUT_OF_ORDER);
141141
case SCRIPT_ERR_SIMPLICITY_FAIL_CODE:
142142
return SIMPLICITY_ERR_MSG(SIMPLICITY_ERR_FAIL_CODE);
143-
case SCRIPT_ERR_SIMPLICITY_STOP_CODE:
144-
return SIMPLICITY_ERR_MSG(SIMPLICITY_ERR_STOP_CODE);
143+
case SCRIPT_ERR_SIMPLICITY_RESERVED_CODE:
144+
return SIMPLICITY_ERR_MSG(SIMPLICITY_ERR_RESERVED_CODE);
145145
case SCRIPT_ERR_SIMPLICITY_HIDDEN:
146146
return SIMPLICITY_ERR_MSG(SIMPLICITY_ERR_HIDDEN);
147147
case SCRIPT_ERR_SIMPLICITY_BITSTREAM_EOF:

src/script/script_error.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ typedef enum ScriptError_t
102102
SCRIPT_ERR_SIMPLICITY_DATA_OUT_OF_RANGE,
103103
SCRIPT_ERR_SIMPLICITY_DATA_OUT_OF_ORDER,
104104
SCRIPT_ERR_SIMPLICITY_FAIL_CODE,
105-
SCRIPT_ERR_SIMPLICITY_STOP_CODE,
105+
SCRIPT_ERR_SIMPLICITY_RESERVED_CODE,
106106
SCRIPT_ERR_SIMPLICITY_HIDDEN,
107107
SCRIPT_ERR_SIMPLICITY_BITSTREAM_EOF,
108108
SCRIPT_ERR_SIMPLICITY_BITSTREAM_TRAILING_BYTES,

src/simplicity/ctx8Pruned.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,8 @@ const uint32_t ctx8Pruned_cmr[] = {
270270
0x7f11746fu, 0xb68fdaedu, 0x3cadda80u, 0xc7cd0245u, 0xa341b927u, 0xe98e60f8u, 0x745dc441u, 0xe11ce1a3u
271271
};
272272

273-
/* The identity Merkle root of the above ctx8Pruned Simplicity expression. */
274-
const uint32_t ctx8Pruned_imr[] = {
273+
/* The identity hash of the root of the above ctx8Pruned Simplicity expression. */
274+
const uint32_t ctx8Pruned_ihr[] = {
275275
0x8e8742acu, 0x27f42d29u, 0xd87f5229u, 0x02bc0ae2u, 0xbcfc1298u, 0x1641a2ddu, 0x77091830u, 0xb79bf12du
276276
};
277277

src/simplicity/ctx8Pruned.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ extern const size_t sizeof_ctx8Pruned_witness;
1818
/* The commitment Merkle root of the above ctx8Pruned Simplicity expression. */
1919
extern const uint32_t ctx8Pruned_cmr[];
2020

21-
/* The identity Merkle root of the above ctx8Pruned Simplicity expression. */
22-
extern const uint32_t ctx8Pruned_imr[];
21+
/* The identity hash of the root of the above ctx8Pruned Simplicity expression. */
22+
extern const uint32_t ctx8Pruned_ihr[];
2323

2424
/* The annotated Merkle root of the above ctx8Pruned Simplicity expression. */
2525
extern const uint32_t ctx8Pruned_amr[];

src/simplicity/ctx8Unpruned.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,8 @@ const uint32_t ctx8Unpruned_cmr[] = {
260260
0x7f11746fu, 0xb68fdaedu, 0x3cadda80u, 0xc7cd0245u, 0xa341b927u, 0xe98e60f8u, 0x745dc441u, 0xe11ce1a3u
261261
};
262262

263-
/* The identity Merkle root of the above ctx8Unpruned Simplicity expression. */
264-
const uint32_t ctx8Unpruned_imr[] = {
263+
/* The identity hash of the root of the above ctx8Unpruned Simplicity expression. */
264+
const uint32_t ctx8Unpruned_ihr[] = {
265265
0x8e8742acu, 0x27f42d29u, 0xd87f5229u, 0x02bc0ae2u, 0xbcfc1298u, 0x1641a2ddu, 0x77091830u, 0xb79bf12du
266266
};
267267

src/simplicity/ctx8Unpruned.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ extern const size_t sizeof_ctx8Unpruned_witness;
1818
/* The commitment Merkle root of the above ctx8Unpruned Simplicity expression. */
1919
extern const uint32_t ctx8Unpruned_cmr[];
2020

21-
/* The identity Merkle root of the above ctx8Unpruned Simplicity expression. */
22-
extern const uint32_t ctx8Unpruned_imr[];
21+
/* The identity hash of the root of the above ctx8Unpruned Simplicity expression. */
22+
extern const uint32_t ctx8Unpruned_ihr[];
2323

2424
/* The annotated Merkle root of the above ctx8Unpruned Simplicity expression. */
2525
extern const uint32_t ctx8Unpruned_amr[];

0 commit comments

Comments
 (0)