Skip to content

Commit 9a74bc9

Browse files
committed
Merge #1519: simplicity: update to d1905055
87c0b44 Squashed 'src/simplicity/' changes from 6d503ea4f8..49b96499a6 (Byron Hambly) 73d1e52 docs: add simplicity code update instructions (Byron Hambly) Pull request description: Updates Simplicity C source subtree from current master BlockstreamResearch/simplicity@d190505 Adds new document describing the process. Pushed the C-master branch subtree split to my repo [delta1/simplicity/tree/C-master](https://github.com/delta1/simplicity/tree/C-master) and upstreamed in BlockstreamResearch/simplicity#330 ACKs for top commit: delta1: ACK 4539002; compiled and tested locally Tree-SHA512: e9fab8baa728ac122597bf2e3c5ae4fe1c5956c655fc336e1cc7a2be591f1deebcab32004a8b6b4ad359c51154ad47bca5f40c21d06823d5d059a6d66efb15af
2 parents a98bad7 + 4539002 commit 9a74bc9

25 files changed

+5725
-91
lines changed

doc/simplicity-c-code-update.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Updating Simplicity C code in Elements
2+
3+
This document describes how to update the Simplicity C code subtree in the Elements repository.
4+
5+
Reference: https://github.com/BlockstreamResearch/simplicity/issues/329#issuecomment-3715844042
6+
7+
## Simplicity
8+
9+
- Clone or pull the latest `master` branch of the [Simplicity](https://github.com/BlockstreamResearch/simplicity) repository.
10+
11+
- Split out a new subtree of the Simplicity `C` source to the `C-master` branch.
12+
13+
```
14+
git subtree split -P C -b C-master
15+
```
16+
17+
- Push the `C-master` branch to a public remote.
18+
19+
```
20+
git push <remote> C-master
21+
```
22+
23+
## Elements
24+
25+
- Add a reference to the above simplicity remote in your Elements repo.
26+
27+
```
28+
git remote add <new-remote-name> git@github.com:<user>/simplicity.git
29+
```
30+
31+
- Pull and squash the `C-master` branch subtree into the `src/simplicity` directory in Elements.
32+
33+
```
34+
git subtree pull --prefix src/simplicity <new-remote-name> C-master --squash
35+
```
36+
37+
- Run build and tests.
38+
39+
- Create a new PR to Elements.

src/simplicity/Makefile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
OBJS := bitstream.o dag.o deserialize.o eval.o frame.o jets.o jets-secp256k1.o rsort.o sha256.o type.o typeInference.o elements/env.o elements/exec.o elements/ops.o elements/elementsJets.o elements/primitive.o elements/cmr.o elements/txEnv.o
1+
CORE_OBJS := bitstream.o dag.o deserialize.o eval.o frame.o jets.o jets-secp256k1.o rsort.o sha256.o type.o typeInference.o
2+
BITCOIN_OBJS := bitcoin/env.o bitcoin/ops.o bitcoin/bitcoinJets.o bitcoin/primitive.o bitcoin/txEnv.o
3+
ELEMENTS_OBJS := elements/env.o elements/exec.o elements/ops.o elements/elementsJets.o elements/primitive.o elements/cmr.o elements/txEnv.o
24
TEST_OBJS := test.o ctx8Pruned.o ctx8Unpruned.o hashBlock.o regression4.o schnorr0.o schnorr6.o typeSkipTest.o elements/checkSigHashAllTx1.o
35

46
# From https://fastcompression.blogspot.com/2019/01/compiler-warnings.html
@@ -18,18 +20,21 @@ elements/elementsJets.o: elements/elementsJets.c
1820
$(CC) -c $(CFLAGS) $(CWARN) -Wno-switch-enum -Wswitch $(CPPFLAGS) -o $@ $<
1921

2022
sha256.o: sha256.c
21-
$(CC) -c $(CFLAGS) -msha -msse4 $(CWARN) -Wno-cast-align -Wno-sign-conversion $(CPPFLAGS) -o $@ $<
23+
$(CC) -c $(CFLAGS) $(X86_SHANI_CXXFLAGS) $(CWARN) -Wno-cast-align -Wno-sign-conversion $(CPPFLAGS) -o $@ $<
2224

2325
%.o: %.c
2426
$(CC) -c $(CFLAGS) $(CWARN) $(CPPFLAGS) -o $@ $<
2527

26-
libElementsSimplicity.a: $(OBJS)
28+
libBitcoinSimplicity.a: $(CORE_OBJS) $(BITCOIN_OBJS)
29+
ar rcs $@ $^
30+
31+
libElementsSimplicity.a: $(CORE_OBJS) $(ELEMENTS_OBJS)
2732
ar rcs $@ $^
2833

2934
test: $(TEST_OBJS) libElementsSimplicity.a
3035
$(CC) $^ -o $@ $(LDFLAGS)
3136

32-
install: libElementsSimplicity.a
37+
install: libBitcoinSimplicity.a libElementsSimplicity.a
3338
mkdir -p $(out)/lib
3439
cp $^ $(out)/lib/
3540
cp -R include $(out)/include

0 commit comments

Comments
 (0)