Skip to content

Commit d855a06

Browse files
Update to latest Simplicity
The main difference is that there is now explicit simplicity deallocation functions to go with the allocation functions in the API. There are some minor changes to error message text. The deserialization code is now automatically generated. The are some other minor internal changes.
1 parent 806c825 commit d855a06

File tree

8 files changed

+13
-8
lines changed

8 files changed

+13
-8
lines changed

src/script/interpreter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3123,7 +3123,7 @@ bool GenericTransactionSignatureChecker<T>::CheckSimplicity(const valtype& progr
31233123
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())) {
31243124
assert(!"simplicity_elements_execSimplicity internal error");
31253125
}
3126-
free(simplicityTapEnv);
3126+
simplicity_elements_freeTapEnv(simplicityTapEnv);
31273127
switch (error) {
31283128
case SIMPLICITY_NO_ERROR: return set_success(serror);
31293129
case SIMPLICITY_ERR_MALLOC:
@@ -3133,7 +3133,7 @@ bool GenericTransactionSignatureChecker<T>::CheckSimplicity(const valtype& progr
31333133
case SIMPLICITY_ERR_DATA_OUT_OF_RANGE: return set_error(serror, SCRIPT_ERR_SIMPLICITY_DATA_OUT_OF_RANGE);
31343134
case SIMPLICITY_ERR_DATA_OUT_OF_ORDER: return set_error(serror, SCRIPT_ERR_SIMPLICITY_DATA_OUT_OF_ORDER);
31353135
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);
3136+
case SIMPLICITY_ERR_RESERVED_CODE: return set_error(serror, SCRIPT_ERR_SIMPLICITY_RESERVED_CODE);
31373137
case SIMPLICITY_ERR_HIDDEN: return set_error(serror, SCRIPT_ERR_SIMPLICITY_HIDDEN);
31383138
case SIMPLICITY_ERR_BITSTREAM_EOF: return set_error(serror, SCRIPT_ERR_SIMPLICITY_BITSTREAM_EOF);
31393139
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/support/lockedpool.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
#endif
2323

2424
#include <algorithm>
25+
#include <limits>
26+
#include <stdexcept>
27+
#include <utility>
2528
#ifdef ARENA_DEBUG
2629
#include <iomanip>
2730
#include <iostream>

src/support/lockedpool.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
#ifndef BITCOIN_SUPPORT_LOCKEDPOOL_H
66
#define BITCOIN_SUPPORT_LOCKEDPOOL_H
77

8-
#include <stdint.h>
8+
#include <cstddef>
99
#include <list>
1010
#include <map>
11-
#include <mutex>
1211
#include <memory>
12+
#include <mutex>
1313
#include <unordered_map>
1414

1515
/**

src/util/bip32.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#define BITCOIN_UTIL_BIP32_H
77

88
#include <attributes.h>
9+
#include <cstdint>
910
#include <string>
1011
#include <vector>
1112

src/util/string.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include <algorithm>
1111
#include <array>
12+
#include <cstdint>
1213
#include <cstring>
1314
#include <locale>
1415
#include <sstream>

0 commit comments

Comments
 (0)