Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions C/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
OBJS := bitstream.o cmr.o dag.o deserialize.o eval.o frame.o jets.o jets-secp256k1.o rsort.o sha256.o type.o typeInference.o primitive/elements/env.o primitive/elements/exec.o primitive/elements/ops.o primitive/elements/elementsJets.o primitive/elements/primitive.o
OBJS := bitstream.o dag.o deserialize.o eval.o frame.o jets.o jets-secp256k1.o rsort.o sha256.o type.o typeInference.o primitive/elements/env.o primitive/elements/exec.o primitive/elements/ops.o primitive/elements/jets.o primitive/elements/primitive.o primitive/elements/cmr.o
TEST_OBJS := test.o ctx8Pruned.o ctx8Unpruned.o hashBlock.o regression4.o schnorr0.o schnorr6.o typeSkipTest.o primitive/elements/checkSigHashAllTx1.o

# From https://fastcompression.blogspot.com/2019/01/compiler-warnings.html
Expand All @@ -14,7 +14,7 @@ CFLAGS := $(CFLAGS) -I include
jets-secp256k1.o: jets-secp256k1.c
$(CC) -c $(CFLAGS) $(CWARN) -Wno-conversion $(CPPFLAGS) -o $@ $<

primitive/elements/elementsJets.o: primitive/elements/elementsJets.c
primitive/elements/jets.o: primitive/elements/jets.c
$(CC) -c $(CFLAGS) $(CWARN) -Wno-switch-enum -Wswitch $(CPPFLAGS) -o $@ $<

sha256.o: sha256.c
Expand Down
8 changes: 4 additions & 4 deletions C/elements-sources.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@
ELEMENTS_SIMPLICITY_INCLUDE_DIR_INT = %reldir%/include

ELEMENTS_SIMPLICITY_DIST_HEADERS_INT =
ELEMENTS_SIMPLICITY_DIST_HEADERS_INT += %reldir%/include/simplicity/cmr.h
ELEMENTS_SIMPLICITY_DIST_HEADERS_INT += %reldir%/include/simplicity/errorCodes.h
ELEMENTS_SIMPLICITY_DIST_HEADERS_INT += %reldir%/include/simplicity/elements/cmr.h
ELEMENTS_SIMPLICITY_DIST_HEADERS_INT += %reldir%/include/simplicity/elements/env.h
ELEMENTS_SIMPLICITY_DIST_HEADERS_INT += %reldir%/include/simplicity/elements/exec.h

ELEMENTS_SIMPLICITY_LIB_SOURCES_INT =
ELEMENTS_SIMPLICITY_LIB_SOURCES_INT += %reldir%/bitstream.c
ELEMENTS_SIMPLICITY_LIB_SOURCES_INT += %reldir%/cmr.c
ELEMENTS_SIMPLICITY_LIB_SOURCES_INT += %reldir%/dag.c
ELEMENTS_SIMPLICITY_LIB_SOURCES_INT += %reldir%/deserialize.c
ELEMENTS_SIMPLICITY_LIB_SOURCES_INT += %reldir%/eval.c
Expand All @@ -24,9 +23,10 @@ ELEMENTS_SIMPLICITY_LIB_SOURCES_INT += %reldir%/sha256.c
ELEMENTS_SIMPLICITY_LIB_SOURCES_INT += %reldir%/type.c
ELEMENTS_SIMPLICITY_LIB_SOURCES_INT += %reldir%/typeInference.c

ELEMENTS_SIMPLICITY_LIB_SOURCES_INT += %reldir%/primitive/elements/cmr.c
ELEMENTS_SIMPLICITY_LIB_SOURCES_INT += %reldir%/primitive/elements/env.c
ELEMENTS_SIMPLICITY_LIB_SOURCES_INT += %reldir%/primitive/elements/exec.c
ELEMENTS_SIMPLICITY_LIB_SOURCES_INT += %reldir%/primitive/elements/elementsJets.c
ELEMENTS_SIMPLICITY_LIB_SOURCES_INT += %reldir%/primitive/elements/jets.c
ELEMENTS_SIMPLICITY_LIB_SOURCES_INT += %reldir%/primitive/elements/ops.c
ELEMENTS_SIMPLICITY_LIB_SOURCES_INT += %reldir%/primitive/elements/primitive.c

Expand Down Expand Up @@ -90,7 +90,7 @@ ELEMENTS_SIMPLICITY_LIB_HEADERS_INT += %reldir%/secp256k1/secp256k1_impl.h
ELEMENTS_SIMPLICITY_LIB_HEADERS_INT += %reldir%/secp256k1/util.h

ELEMENTS_SIMPLICITY_LIB_HEADERS_INT += %reldir%/primitive/elements/decodeElementsJets.inc
ELEMENTS_SIMPLICITY_LIB_HEADERS_INT += %reldir%/primitive/elements/elementsJets.h
ELEMENTS_SIMPLICITY_LIB_HEADERS_INT += %reldir%/primitive/elements/jets.h
ELEMENTS_SIMPLICITY_LIB_HEADERS_INT += %reldir%/primitive/elements/ops.h
ELEMENTS_SIMPLICITY_LIB_HEADERS_INT += %reldir%/primitive/elements/primitive.h
ELEMENTS_SIMPLICITY_LIB_HEADERS_INT += %reldir%/primitive/elements/primitiveEnumJet.inc
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef SIMPLICITY_CMR_H
#define SIMPLICITY_CMR_H
#ifndef SIMPLICITY_ELEMENTS_CMR_H
#define SIMPLICITY_ELEMENTS_CMR_H

#include <stdbool.h>
#include <stddef.h>
Expand All @@ -18,6 +18,6 @@
* unsigned char cmr[32]
* unsigned char program[program_len]
*/
extern bool simplicity_computeCmr( simplicity_err* error, unsigned char* cmr
, const unsigned char* program, size_t program_len);
extern bool simplicity_elements_computeCmr( simplicity_err* error, unsigned char* cmr
, const unsigned char* program, size_t program_len);
#endif
14 changes: 7 additions & 7 deletions C/cmr.c → C/primitive/elements/cmr.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include <simplicity/cmr.h>
#include <simplicity/elements/cmr.h>

#include "deserialize.h"
#include "limitations.h"
#include "simplicity_alloc.h"
#include "simplicity_assert.h"
#include "../../deserialize.h"
#include "../../limitations.h"
#include "../../simplicity_alloc.h"
#include "../../simplicity_assert.h"

/* Deserialize a Simplicity 'program' and compute its CMR.
*
Expand All @@ -18,8 +18,8 @@
* unsigned char cmr[32]
* unsigned char program[program_len]
*/
bool simplicity_computeCmr( simplicity_err* error, unsigned char* cmr
, const unsigned char* program, size_t program_len) {
bool simplicity_elements_computeCmr( simplicity_err* error, unsigned char* cmr
, const unsigned char* program, size_t program_len) {
simplicity_assert(NULL != error);
simplicity_assert(NULL != cmr);
simplicity_assert(NULL != program || 0 == program_len);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "elementsJets.h"
#include "jets.h"

#include "ops.h"
#include "primitive.h"
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion C/primitive/elements/primitive.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*/
#include "primitive.h"

#include "elementsJets.h"
#include "jets.h"
#include "../../limitations.h"
#include "../../primitive.h"
#include "../../simplicity_alloc.h"
Expand Down
6 changes: 3 additions & 3 deletions C/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <time.h>
#include <getopt.h>
#include <simplicity/elements/exec.h>
#include <simplicity/cmr.h>
#include <simplicity/elements/cmr.h>
#include "ctx8Pruned.h"
#include "ctx8Unpruned.h"
#include "dag.h"
Expand Down Expand Up @@ -391,7 +391,7 @@ static void test_elements(void) {
simplicity_err execResult;
{
unsigned char cmrResult[32];
if (simplicity_computeCmr(&execResult, cmrResult, elementsCheckSigHashAllTx1, sizeof_elementsCheckSigHashAllTx1) && IS_OK(execResult)) {
if (simplicity_elements_computeCmr(&execResult, cmrResult, elementsCheckSigHashAllTx1, sizeof_elementsCheckSigHashAllTx1) && IS_OK(execResult)) {
if (0 == memcmp(cmrResult, cmr, sizeof(unsigned char[8]))) {
successes++;
} else {
Expand All @@ -400,7 +400,7 @@ static void test_elements(void) {
}
} else {
failures++;
printf("simplicity_computeCmr of elementsCheckSigHashAllTx1 unexpectedly produced %d.\n", execResult);
printf("simplicity_elements_computeCmr of elementsCheckSigHashAllTx1 unexpectedly produced %d.\n", execResult);
}
}
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "primitive/elements/elementsJets.h"
#include "primitive/elements/jets.h"
#include "../wrappers.h"

WRAP_(version)
Expand Down
6 changes: 3 additions & 3 deletions Simplicity.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ library Simplicity-Indef
vector >=0.12 && <0.14

library
C-sources: C/rsort.c C/primitive/elements/elementsJets.c C/primitive/elements/ops.c C/primitive/elements/env.c
Haskell/cbits/elements/elementsJets.c Haskell/cbits/elements/env.c
C-sources: C/rsort.c C/primitive/elements/jets.c C/primitive/elements/ops.c C/primitive/elements/env.c
Haskell/cbits/elements/jets.c Haskell/cbits/elements/env.c
Include-dirs: C C/include
Includes: primitive/elements/elementsJets.h primitive/elements/primitive.h simplicity/elements/env.h
Includes: primitive/elements/jets.h primitive/elements/primitive.h simplicity/elements/env.h
exposed-modules: Simplicity.Bitcoin.Programs.Transaction, Simplicity.Bitcoin.Programs.Transaction.Lib,
Simplicity.Bitcoin.Programs.TimeLock, Simplicity.Elements.Programs.TimeLock,
Simplicity.Elements.Programs.Issuance, Simplicity.Elements.Programs.Issuance.Lib,
Expand Down
Loading