Skip to content

Commit

Permalink
Merge branch 'master' into ledger
Browse files Browse the repository at this point in the history
  • Loading branch information
MrCyjaneK authored Oct 21, 2024
2 parents f956f6b + d04dcf6 commit d54c902
Show file tree
Hide file tree
Showing 41 changed files with 1,860 additions and 1,387 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Build documentation

on: [push]

env:
# Name of module and id separated by a slash
INSTANCE: Writerside/in
# Replace HI with the ID of the instance in capital letters
ARTIFACT: webHelpIN2-all.zip
# Docker image version
DOCKER_VERSION: "242.21870"

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: '^1.23.2'
- uses: hecrj/setup-rust-action@v2
with:
rust-version: stable
- name: Update image
run: cd docs && ./update_screenshot.sh
- name: Build Writerside docs using Docker
uses: JetBrains/writerside-github-action@v4
with:
location: "docs"
instance: ${{ env.INSTANCE }}
artifact: ${{ env.ARTIFACT }}
docker-version: ${{ env.DOCKER_VERSION }}

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: artifact
path: artifacts/${{ env.ARTIFACT }}

- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: artifacts/${{ env.ARTIFACT }}
token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
32 changes: 29 additions & 3 deletions .github/workflows/full_check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
strategy:
matrix:
coin: [monero, wownero]
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
# container:
# image: debian:bookworm
steps:
Expand Down Expand Up @@ -391,7 +391,7 @@ jobs:
key: depends-${{ github.job }}-${{ matrix.coin }}-${{ hashFiles('*/contrib/depends/packages/*.mk') }}
- name: build
run: |
./build_single.sh ${{ matrix.coin }} aarch64-host-apple-darwin -j$(sysctl -n hw.logicalcpu)
./build_single.sh ${{ matrix.coin }} aarch64-host-apple-darwin -j$(sysctl -n hw.logicalcpu)
- name: rename artifacts
run: |
mkdir release/gh/
Expand Down Expand Up @@ -448,7 +448,7 @@ jobs:
key: depends-${{ github.job }}-${{ matrix.coin }}-${{ hashFiles('*/contrib/depends/packages/*.mk') }}
- name: build
run: |
./build_single.sh ${{ matrix.coin }} host-apple-ios -j$(sysctl -n hw.logicalcpu)
./build_single.sh ${{ matrix.coin }} host-apple-ios -j$(sysctl -n hw.logicalcpu)
- name: rename artifacts
run: |
mkdir release/gh/
Expand Down Expand Up @@ -585,6 +585,32 @@ jobs:
cd impls/monero.ts
deno run --unstable-ffi --allow-ffi checksum.ts
regression_check:
strategy:
matrix:
coin: [monero, wownero]
needs: [
lib_linux
]
runs-on: ubuntu-24.04
steps:
- uses: denoland/setup-deno@v2
with:
deno-version: v2.x

- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive

- uses: actions/download-artifact@v4
with:
name: linux ${{ matrix.coin }}
path: release/${{ matrix.coin }}

- name: Run regression tests
run: COIN="${{ matrix.coin }}" deno test -A tests/

comment_pr:
name: comment on pr
runs-on: ubuntu-latest
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
release/
build/
build/
tests/monero-cli
tests/libs
tests/wallets
87 changes: 4 additions & 83 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,94 +2,15 @@

> Wrapper around wallet2_api.h that can be called using C api.
[![status-badge](https://ci.mrcyjanek.net/api/badges/5/status.svg?branch=rewrite-wip)](https://ci.mrcyjanek.net/repos/5/branches/rewrite-wip)

## Building

to "clean" everything:
TL;DR:

```bash
$ rm -rf monero wownero release
$ git submodule update --init --recursive --force
$ for coin in monero wownero; do ./apply_patches $coin; done
$ ./build_single monero $(gcc -dumpmachine) -j$(nproc)
```

fix ownership (if you build in docker but clone as a local user)

```bash
$ sudo chown $(whoami) . -R
```

patch codebase

```bash
$ ./apply_patches.sh monero
$ ./apply_patches.sh wownero
```

build monero_c

```bash
$ ./build_single.sh monero x86_64-linux-gnu -j$(nproc)
wownero i686-linux-gnu
aarch64-linux-gnu
x86_64-linux-android
i686-linux-android
aarch64-linux-android
arm-linux-androideabi
i686-w64-mingw32
x86_64-w64-mingw32
host-apple-darwin
host-apple-ios
```

While building I aim to compile the code at oldest supported release of debian, using default toolchain to ensure that all linux distributions are able to run monero_c libraries, below I present a supported builders for given targets

| x | builder | notes |
| ---------------------- | -------------------- | ----- |
| x86_64-linux-gnu | debian:buster | |
| i686-linux-gnu | debian:buster | |
| aarch64-linux-gnu | debian:buster | |
| x86_64-linux-android | debian:buster | |
| i686-linux-android | debian:buster | |
| aarch64-linux-android | debian:buster | |
| arm-linux-androideabi | debian:buster | |
| i686-w64-mingw32 | debian:buster | hardcoded DLL paths in build_single.sh |
| x86_64-w64-mingw32 | debian:buster | -"- |
| x86_64-apple-darwin11 | debian:bookworm | extra build step: `${HOST_ABI}-ranlib $PWD/$repo/contrib/depends/${HOST_ABI}/lib/libpolyseed.a` |
| aarch64-apple-darwin11 | debian:bookworm | -"- |
| host-apple-darwin | arm64-apple-darwin23 | dependencies: `brew install unbound [email protected] zmq cmake ccache autoconf automake libtool && brew link [email protected]` |
| host-apple-ios | arm64-apple-darwin23 | |

## Design

Functions are as simple as reasonably possible as few steps should be performed to get from the exposed C api to actual wallet2 (or wallet3 in future) api calls.

The only things passed in and out are:

- void
- bool
- int
- uint64_t
- void*
- const char*

All more complex structures are serialized into `const char*`, take look at MONERO_Wallet_createTransaction which uses `splitString(std::string(preferredInputs), std::string(separator));` to convert string into a std::set, so no implementation will need to worry about that.

Is there more effective way to do that? Probably. Is there more universal way to pass that (JSON, or others?)? Most likely. That being said, I'm against doing that. You can easily join a string in any language, and I like to keep dependency count as low as possible.

As for function naming `${COIN}_namespaceOrClass_functionName` is being used, currently these cryptocurrencies are supported

- monero
- wownero

both using wallet2 api, and both being patched with our secret ingredient(tm) (check patches directory).

Since monero_c aims to be one-fits-all solution for monero wallets, there are some special things inside, like functions prefixed with `DEBUG_*`, these are not quarenteed to stay in the code, and can be changed, the only reason they are in is because I needed some testing early in the development when bringing support for variety of platforms.

If you are a wallet developer and you **really** need this one function that doesn't exist, feel free to let me know I'll be happy to implement that.

Currently there are enterprise resitents in our library: `${COIN}_cw_*` these functions are not guaranteed to stay stable, and are made for cake wallet to implement features that are not used in xmruw nor in stack_wallet (which I need to double-check later?).

## Contributing

To contribute you can visit git.mrcyjanek.net/mrcyjanek/monero_c and open a PR, alternatively use any other code mirror or send patches directly.
Broken? Not working? Need help? https://moneroc.mrcyjanek.net/
3 changes: 3 additions & 0 deletions docs/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions docs/.idea/docs.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions docs/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions docs/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added docs/Writerside/assets/onefetch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions docs/Writerside/c.list
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE categories
SYSTEM "https://resources.jetbrains.com/writerside/1.0/categories.dtd">
<categories>
<category id="wrs" name="Writerside documentation" order="1"/>
</categories>
13 changes: 13 additions & 0 deletions docs/Writerside/cfg/buildprofiles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE buildprofiles SYSTEM "https://resources.jetbrains.com/writerside/1.0/build-profiles.dtd">
<buildprofiles xsi:noNamespaceSchemaLocation="https://resources.jetbrains.com/writerside/1.0/build-profiles.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<variables></variables>
<build-profile instance="in">
<variables>
<noindex-content>true</noindex-content>
</variables>
</build-profile>

</buildprofiles>
7 changes: 7 additions & 0 deletions docs/Writerside/cfg/glossary.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE terms SYSTEM "https://resources.jetbrains.com/writerside/1.0/glossary.dtd">
<terms>
<term name="foo">
Description of what "foo" is.
</term>
</terms>
17 changes: 17 additions & 0 deletions docs/Writerside/in.tree
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE instance-profile
SYSTEM "https://resources.jetbrains.com/writerside/1.0/product-profile.dtd">

<instance-profile id="in"
name="monero_c docs"
start-page="about.md">

<toc-element topic="about.md"/>
<toc-element topic="Building.md">
<toc-element topic="Using-prebuilds.md"/>
<toc-element topic="Linux.md"/>
<toc-element topic="Android.md"/>
<toc-element topic="Windows.md"/>
<toc-element topic="macOS.md"/>
</toc-element>
</instance-profile>
52 changes: 52 additions & 0 deletions docs/Writerside/topics/Android.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Android

Building on linux has been tested on
- `ubuntu:22.04` (docker tag)

## Install dependencies

```bash
$ apt update
$ apt install -y build-essential pkg-config autoconf libtool \
ccache make cmake gcc g++ git curl lbzip2 libtinfo5 gperf \
unzip python-is-python3
```

## Prepare source

> If you are running in docker or have not configured git you may need to do the following:
> ```bash
> git config --global --add safe.directory '*'
> git config --global user.email "[email protected]"
> git config --global user.name "CI mrcyjanek.net"
> ```
```bash
$ git clone https://github.com/mrcyjanek/monero_c --recursive
$ cd monero_c
$ ./apply_patches.sh monero
```
## Building

<tabs>
<tab title="x86_64">
<code-block>
$ ./build_single.sh monero x86_64-linux-android -j$(nproc)
</code-block>
</tab>
<tab title="aarch64">
<code-block>
$ ./build_single.sh monero aarch64-linux-android -j$(nproc)
</code-block>
</tab>
<tab title="armv7a">
<code-block>
$ ./build_single.sh monero armv7a-linux-androideabi -j$(nproc)
</code-block>
</tab>
</tabs>

## Known issues

None. Open an issue if you find something not working.
Loading

0 comments on commit d54c902

Please sign in to comment.