Commit Graph

57 Commits

Author SHA1 Message Date
Michael Bradley, Jr 1574a2a13a test: make the db_smoke test identical to the same test in the nim-sqlcipher repo 2020-11-19 07:54:47 -06:00
Michael Bradley, Jr e9785f0386 refactor: upgrade to waku v2, impl/test minimum viable usage 2020-11-18 14:18:37 -06:00
Michael Bradley, Jr b88f736a32 feat: integrate nim-sqlcipher 2020-11-18 13:34:24 -06:00
Richard Ramos d1f4fa39d7 feat: implement saveAccountAndLogin using nim-waku in nim_status/lib
For now don't export it at the top-level nor in lib/shim. Implement a basic
test for subscribe and send with waku.
2020-09-15 14:41:57 -05:00
Michael Bradley, Jr 92826e958c test: refactor login test into an asyncTest
The original intention was to use `newFuture` of nim-chronos but mixing use of
futures and `setSignalEventCallback` proved problematic so use a while/sleep
loop instead.
2020-09-15 12:07:38 -05:00
Michael Bradley, Jr fcf81af89f feat: expose status-go's DeleteMultiaccount 2020-09-11 10:47:44 -05:00
Michael Bradley, Jr 63c17f7381
docs: add master branch filter to Tests badge URL 2020-09-04 13:07:31 -05:00
Michael Bradley, Jr 0f10cf59ec ci: use killall for macos/linux background tester tasks
The `killall` command's usage varies by platform, so use the correct options
per platform.
2020-09-04 09:33:45 -05:00
Michael Bradley, Jr 4927affd16 build: bump vendor/nimbus-build-system 2020-09-04 09:33:45 -05:00
Michael Bradley, Jr 7ba082751b build: don't swallow error when build fails 2020-09-03 12:51:24 -05:00
RichΛrd 46c93dd734
Expose StartWallet/StopWallet (#49) 2020-09-03 11:05:37 -04:00
Michael Bradley, Jr 46ffc74a1f feat: introduce Nim impl of identicon
Closes #33
2020-09-03 08:41:52 -05:00
Michael Bradley, Jr 149ea2c3db docs: add badge for Tests workflow (GitHub Actions) to README 2020-09-02 17:06:23 -05:00
Michael Bradley, Jr b71d69012c ci: run tests via GitHub Actions
Until login tests are refactored, kill the Nim and C tests after they've been
running for 10 minutes.

On Windows, using *Git Bash's* `kill` to stop the backround tester task doesn't
work correctly; instead use Windows built-in `taskkill`.
2020-09-02 15:58:35 -05:00
Michael Bradley, Jr 6c2265f8c9 feat: introduce Nim impl of generateAlias
Closes #32
2020-08-31 14:05:29 -05:00
Michael Bradley 9fb5c560f0
Merge pull request #41 from status-im/feat/nim-hashmessage
feat: introduce Nim impl of hashMessage in reorganized library
2020-08-31 14:02:07 -05:00
Michael Bradley, Jr 6f3998180e feat: introduce Nim impl of hashMessage in reorganized library
Introduce a Nim implementation of `hashMessage` situated in a reorganized
library with *Nim-oriented* and *C-oriented* entry points inspired by the
[shim strategy][shim-strat] suggested by @arnetheduck.

The goal of this approach (per @iurimatias, at least as I understood what was
discussed and tasked) is for Nim implementations of equivalent functionality to
eventually supersede existing [status-go][sgo] implementations.

These changes will benefit from feedback by @arnetheduck, @zah,
@stefantalpalaru, @siphiuel, other members of stimbus/desktop, et al. – my dev
experiences with Nim and C are quite limited to date. Some of the changes may
be problematic, unnecessary, suboptimal, etc. I may have reified the *"shim
strategy"* badly. Please shred this PR apart and lead me to the 💡
light. Thanks for your help!

N.B. `tests/nim/login.nim` and `tests/c/login.c` use loops that never
terminate (introduced prior to this PR). Future work will attempt to remedy
that shortcoming but it's out of scope for this PR.

The reorganized library can be grouped into two trees of `.nim` sources, but
note that `import` statements interlink some of them.

**Nim-oriented**
```
├── src
│   ├── nim_status
│   │   ├── go
│   │   │   └── shim.nim
│   │   ├── lib
│   │   │   ├── shim.nim
│   │   │   └── util.nim
│   │   ├── lib.nim
│   │   └── types.nim
│   └── nim_status.nim
```

**C-oriented**
```
├── src
│   ├── nim_status
│   │   ├── c
│   │   │   ├── go
│   │   │   │   └── shim.nim
│   │   │   ├── lib
│   │   │   │   └── shim.nim
│   │   │   ├── lib.nim
│   │   │   ├── nim_status.nim
│   │   │   └── sys.nim
```

The key difference between the Nim sources in one tree and the other is that
the Nim-oriented sources are intended to be consumed by other Nim
sources (e.g. [status-im/nim-status-client][nsc] via Nim's built-in `import`),
while the C-oriented sources are intended to be compiled to a C
library (e.g. `nim_status.a`) and then linked/called by other C code. To that
end, the former use e.g. `string` in call signatures while the latter use
`cstring`. Along the same lines, the C-oriented `proc`s may return pointers to
memory allocated with `c_malloc` such that it's up to the caller to free the
memory occupied by the return values.

Both `src/nim_status/go/shim.nim` and `src/nim_status/c/go/shim.nim` are pure
shims around status-go, the main difference being their call signatures.

With `src/nim_status/lib.nim` the intention is to implement functionality in a
manner independent of status-go's idioms.

In `src/nim_status/[c/]lib/shim.nim` the intention is to wrap around
`src/nim_status/lib.nim` in a way that preserves status-go's call signatures
and formatting. For example, the `hashMessage` proc introduced in this PR in
`src/nim_status/lib.nim` returns a hex string like `0xabcd...` while
`lib/shim.nim` returns JSON that's a match for status-go:
`{"result":"0xabcd..."}`.

Both `src/nim_status.nim` and `src/nim_status/c/nim_status.nim` represent a
hybrid of `go/shim.nim` and `lib/shim.nim`. Again, the goal is that over time
more and more `proc`s implemented in Nim replace the shims around status-go.

Callers that don't need to consume return values formatted according to
status-go conventions can use `lib.nim` directly, e.g. via `import
nim_status/lib` or by compiling `src/nim_status/c/lib.nim` and linking/calling
from C.

`c_malloc` has been copied (in `src/nim_status/c/sys.nim`) from the source of
Nim's `system/ansi_c` because `ansi_c` is an undocumented internal API.

A Nim template or pragma might be useful with respect to usgae of `c_malloc` in
`src/nim_status/c/*`, i.e. to cut down on repetition.

Use of `{.exportc.}` is limited to the `src/nim_status/c/nim_status.nim` hybrid
shim to avoid imposing exported symbols on C-oriented library consumers who may
wish to compose things in a different manner.

With respect to the Nim implementation of `hashMessage`, both Nim-oriented and
C-oriented tests have been implemented. Whether doubling up the tests is really
necessary/desirable for all `proc`s is probably worth discussing.

Adjust `.gitignore` and refactor `Makefile` accordingly; apply some lessons
learned while working on [status-im/nim-status-client][nsc].

Closes #34.

[shim-strat]: https://github.com/status-im/nim-status/issues/5#issuecomment-647497745
[sgo]: https://github.com/status-im/status-go
[nsc]: https://github.com/status-im/nim-status-client
2020-08-10 11:45:02 -05:00
Richard Ramos b3e3a8920b
Exporting loadAccount 2020-07-29 17:28:39 -04:00
Jonathan Rainville cffc38c9fa
Merge pull request #40 from status-im/fix/windows-cstring
fix: fix username not showing on Windows because of missing cstring
2020-07-27 15:55:26 -04:00
Jonathan Rainville ee92d8e792 fix: fix username not showing on Windows because of missing cstring 2020-07-27 15:30:28 -04:00
Richard Ramos 677a000c24
Export GoString 2020-07-20 10:52:29 -04:00
RichΛrd 4cb06e85d7
Add .git to .gitmodules 2020-07-17 20:42:09 -04:00
Iuri Matias 446bbcd139
Merge pull request #21 from status-im/feat/nim-test-and-gc
feat: add setup and teardown foreign thread  gc functions and nim-tests target
2020-07-14 14:25:31 -04:00
Iuri Matias 2cb064604a
Merge pull request #22 from status-im/feat/util-functions
feat: some utils functions and nim-test template
2020-07-14 14:25:22 -04:00
Iuri Matias 7f35ed4144
Merge pull request #23 from status-im/test/macos
fix:error when running nim-tests on macos
2020-07-14 14:25:14 -04:00
Richard Ramos 62a22fa1c6
test 2020-07-13 15:16:27 -04:00
Richard Ramos a550df769b
feat: adds some utils functions to create/import accounts and login 2020-07-13 14:07:17 -04:00
Richard Ramos 3cafe0ed43
fix: linking libstatus 2020-07-13 10:40:58 -04:00
Richard Ramos d007fdba2f
feat: add setup and teardown foreign thread gc functions and nim-tests target 2020-07-13 10:26:31 -04:00
Iuri Matias f493853581
Merge pull request #10 from status-im/feat/build-system
feat: include nimbus-build-system and initial version of the Makefile to generate a static library
2020-07-08 12:31:29 -04:00
Iuri Matias 00f549a2c4
Merge pull request #11 from status-im/feat/build-static-lib-1
feat: build nim_status.a static library and create simple test file in C
2020-07-08 12:31:20 -04:00
Iuri Matias 223d59cc9a
Merge pull request #13 from status-im/feat/build-static-lib-2
chore: verify signalCallback can be used with a pointer to a function
2020-07-08 12:31:04 -04:00
Richard Ramos 93f3c08e19
chore: verify signalCallback can be used with a pointer to a function 2020-07-06 10:01:07 -04:00
Richard Ramos 18f9715995
fix: add macos libraries for tests 2020-07-03 08:28:12 -04:00
Richard Ramos 2ae7d70f50
Adding missing functions 2020-07-02 15:54:45 -04:00
Richard Ramos 01d1fa97b6
fix: readme 2020-07-02 15:06:15 -04:00
Richard Ramos 80d9d2c8b7
feat: build nim_status.a static library and create simple test file in C 2020-07-02 14:40:49 -04:00
Richard Ramos 3dda55a8a3
feat: include nimbus-build-system and initial version of the Makefile to generate a static library 2020-07-02 09:20:16 -04:00
Oskar Thoren 471c58fb49 Remove old stuff 2020-03-01 19:12:41 +01:00
Oskar Thorén 67e5122c81
Update README.md 2020-03-01 19:10:13 +01:00
Oskar Thorén 6b402f2acb
Update README.md 2019-07-24 11:16:04 +08:00
Oskar Thoren a5693e6e48
Misc fixes 2019-07-24 10:31:17 +08:00
Oskar Thoren 9fdef12e3b
Comment out main for lib 2019-07-24 10:27:39 +08:00
Oskar Thoren 928f9729f6
Don't print so much 2019-07-24 10:19:30 +08:00
Oskar Thoren a8fcaa7829
fix 2019-06-29 10:29:15 +08:00
Oskar Thoren 78405fd66d
Make run standalone with local so 2019-06-29 10:27:54 +08:00
Oskar Thoren 7e06b15d3d
Print GOMAXPROCS 2019-06-29 10:27:53 +08:00
Oskar Thoren 1eb9a2d1e1
Add shared libs diff config 2019-06-29 10:27:53 +08:00
Oskar Thoren 40884ddb44
Increase logging 2019-06-29 10:27:53 +08:00
Oskar Thorén 04c928069b
Update README.md 2019-06-27 19:35:33 +08:00