Commit graph

8 commits

Author SHA1 Message Date
hinto-janai
a2bca1b889
rpc: add JSON doc-tests (#232)
Some checks are pending
Audit / audit (push) Waiting to run
CI / fmt (push) Waiting to run
CI / typo (push) Waiting to run
CI / ci (macos-latest, stable, bash) (push) Waiting to run
CI / ci (ubuntu-latest, stable, bash) (push) Waiting to run
CI / ci (windows-latest, stable-x86_64-pc-windows-gnu, msys2 {0}) (push) Waiting to run
Deny / audit (push) Waiting to run
Doc / build (push) Waiting to run
Doc / deploy (push) Blocked by required conditions
* fixed-bytes: add `serde`, document feature flags

* fixed-bytes: add derives

* rpc: add `as _` syntax to macro

* rpc: use `ByteArrayVec` and `ContainerAsBlob` for binary types

* fixed-bytes: re-add derives

* rpc-types: dedup default value within macro

* readme: fixed bytes section

* types: custom epee - `BlockCompleteEntry`

* types: custom epee - `KeyImageSpentStatus`

* types: custom epee - `PoolInfoExtent`

* types: add `Status::Other(String)` variant

* types: custom epee - `TxEntry`, add `read_epee_field` macro

* bin: custom epee - `GetBlocks`

* types: add `serde.rs`

* misc: make `TxEntry` an `enum`, impl serde

* misc: `unimplemented!()` for `TxEntry`'s epee

* types: add `BlockCompleteEntry`

* rpc: replace `BlockCompleteEntry` with `cuprate-types`

* types: document `BlockCompleteEntry`

* bin: fix `number_of_fields` for `GetBlocksResponse`

* misc: add `Distribution`

* distribution: add todo

* misc fixes

* readme: add `(De)serialization invariants`

* distribution: compress variants

* types: add `block_complete_entry.rs`

* net: fix imports

* p2p: fix imports

* turn off default-features

* p2p: fix imports

* misc fixes

* Update net/wire/Cargo.toml

Co-authored-by: Boog900 <boog900@tutanota.com>

* distribution: module doc

* wire: re-export types

* test-utils: add `crate::rpc::types` module

* test-utils: conditional json doc-tests

* bin: use enum for `GetBlocksResponse`

* misc: use lowercase for stringify

* json: add test data, fix macro doc tests

* json: add all data

* other: add all data

* bin: add skeleton

* docs

* move type to correct file

* remove duplicated fields for custom epee

* rpc: `client/{client,constants}.rs` -> `client.rs`

* lib.rs: remove `clippy::module_inception`

* macros: add json doc test macro

* json: add some tests

* json: add doc-test for all types

* add all other JSON doc-tests

* move doc-test macros to files

* base: add doc-tests

* json: TODO distribution test

---------

Co-authored-by: Boog900 <boog900@tutanota.com>
2024-07-28 21:43:16 +01:00
hinto-janai
929d19c450
rpc: custom epee for misc/bin types (#229)
* fixed-bytes: add `serde`, document feature flags

* fixed-bytes: add derives

* rpc: add `as _` syntax to macro

* rpc: use `ByteArrayVec` and `ContainerAsBlob` for binary types

* fixed-bytes: re-add derives

* rpc-types: dedup default value within macro

* readme: fixed bytes section

* types: custom epee - `BlockCompleteEntry`

* types: custom epee - `KeyImageSpentStatus`

* types: custom epee - `PoolInfoExtent`

* types: add `Status::Other(String)` variant

* types: custom epee - `TxEntry`, add `read_epee_field` macro

* bin: custom epee - `GetBlocks`

* types: add `serde.rs`

* misc: make `TxEntry` an `enum`, impl serde

* misc: `unimplemented!()` for `TxEntry`'s epee

* types: add `BlockCompleteEntry`

* rpc: replace `BlockCompleteEntry` with `cuprate-types`

* types: document `BlockCompleteEntry`

* bin: fix `number_of_fields` for `GetBlocksResponse`

* misc: add `Distribution`

* distribution: add todo

* misc fixes

* readme: add `(De)serialization invariants`

* distribution: compress variants

* types: add `block_complete_entry.rs`

* net: fix imports

* p2p: fix imports

* turn off default-features

* p2p: fix imports

* misc fixes

* Update net/wire/Cargo.toml

Co-authored-by: Boog900 <boog900@tutanota.com>

* distribution: module doc

* wire: re-export types

* bin: use enum for `GetBlocksResponse`

* misc: use lowercase for stringify

* remove duplicated fields for custom epee

* types: remove `should_write()` for custom epee

* bin: split `GetBlocksResponse` variant fields into structs

* misc: split `Distribution` variant fields into structs

* small fixes

* put all fields in `read_epee_field!`

* distribution: (de)compress during epee/serde (de)serialization

* distribution: leave (de)compression functions as `todo!()`

---------

Co-authored-by: Boog900 <boog900@tutanota.com>
2024-07-25 16:46:41 +01:00
hinto-janai
0910c0a231
rpc: use ByteArrayVec and ContainerAsBlob (#227)
Some checks failed
Audit / audit (push) Has been cancelled
CI / fmt (push) Has been cancelled
CI / typo (push) Has been cancelled
CI / ci (macos-latest, stable, bash) (push) Has been cancelled
Deny / audit (push) Has been cancelled
Doc / build (push) Has been cancelled
CI / ci (ubuntu-latest, stable, bash) (push) Has been cancelled
CI / ci (windows-latest, stable-x86_64-pc-windows-gnu, msys2 {0}) (push) Has been cancelled
Doc / deploy (push) Has been cancelled
* fixed-bytes: add `serde`, document feature flags

* fixed-bytes: add derives

* rpc: add `as _` syntax to macro

* rpc: use `ByteArrayVec` and `ContainerAsBlob` for binary types

* fixed-bytes: re-add derives

* rpc-types: dedup default value within macro

* readme: fixed bytes section
2024-07-13 01:26:11 +01:00
hinto-janai
5aeb8af4b4
rpc: implement other JSON types (#221)
Some checks are pending
CI / fmt (push) Waiting to run
CI / typo (push) Waiting to run
CI / ci (macos-latest, stable, bash) (push) Waiting to run
CI / ci (ubuntu-latest, stable, bash) (push) Waiting to run
CI / ci (windows-latest, stable-x86_64-pc-windows-gnu, msys2 {0}) (push) Waiting to run
Doc / build (push) Waiting to run
Doc / deploy (push) Blocked by required conditions
* `serde/epee` feature flags

* modify type generator macros

* add `defaults.rs`

* add `free.rs`

* add `misc` module

* modify `base.rs`, `contants.rs`

* remove `binary_string.rs`, `status.rs`

* fix macro usage

* impl `other.rs`

* base: re-add `AccessRequestBase`

* fix default functions

* tx_entry: fix link

* other: fix default functions

* Update rpc/types/src/other.rs

Co-authored-by: Boog900 <boog900@tutanota.com>

* Update rpc/types/src/other.rs

Co-authored-by: Boog900 <boog900@tutanota.com>

---------

Co-authored-by: Boog900 <boog900@tutanota.com>
2024-07-10 22:31:56 +01:00
hinto-janai
303c165df7
rpc: implement .bin types (#220)
* `serde/epee` feature flags

* modify type generator macros

* add `defaults.rs`

* add `free.rs`

* add `misc` module

* modify `base.rs`, `contants.rs`

* remove `binary_string.rs`, `status.rs`

* fix macro usage

* impl `bin.rs`

* base: re-add `AccessRequestBase`

* fix default functions

* tx_entry: fix link

* bin: fix default functions
2024-07-10 21:19:19 +01:00
hinto-janai
ecbb5ad3dc
rpc: implement /json_rpc types (#219)
* `serde/epee` feature flags

* modify type generator macros

* add `defaults.rs`

* add `free.rs`

* add `misc` module

* modify `base.rs`, `contants.rs`

* remove `binary_string.rs`, `status.rs`

* fix macro usage

* impl `json.rs`

* base: re-add `AccessRequestBase`

* fix default functions

* tx_entry: fix link

* json: fix default functions

* json: fix `on_get_block_hash`, `submit_block`

* json: `status` -> `block_id`

* json: fix `SubmitBlockRequest`

* json: fix `OnGetBlockHashResponse`

The serialized `result` field will come from our `json-rpc` crate,
so the inner type should be a `transparent` string.

* json: `Response` -> `ResponseBase` for `SubmitBlock`

* Update rpc/types/src/json.rs

Co-authored-by: Boog900 <boog900@tutanota.com>

* json: fix `SubmitBlockRequest` doc test

---------

Co-authored-by: Boog900 <boog900@tutanota.com>
2024-07-10 21:12:40 +01:00
hinto-janai
136abf7edd
rpc: feature flags, macro changes, misc setup (#218)
* `serde/epee` feature flags

* modify type generator macros

* add `defaults.rs`

* add `free.rs`

* add `misc` module

* modify `base.rs`, `contants.rs`

* remove `binary_string.rs`, `status.rs`

* fix macro usage

* base: re-add `AccessRequestBase`

* fix default functions

* tx_entry: fix link
2024-07-09 22:58:02 +01:00
hinto-janai
e405786a73
rpc: start cuprate-rpc-types (#147)
* rpc: add `monero-rpc-types`

* lib.rs: add lints

* add base files, deps

* fix macro generation, doc test

* add `strum`, add `misc` module

* document struct generation macro

* add `GetHeight`

* lib.rs: create re-export macro

* macro changes, add few more types

* docs

* `monero-rpc-types` -> `cuprate-rpc-types`

* fix modules

* specify commit in macro, add () type aliases

* macro docs, fixes

* add `Status::Other(String)`

* add TODO for `strum`

* Update rpc/types/Cargo.toml

Co-authored-by: Boog900 <boog900@tutanota.com>

* add `BinaryString`

* add `ResponseBase`

* add `CORE_RPC_*` constants

* fix status; use `CORE_RPC_*` constants

* cargo.toml: add `epee_encoding`

* rpc: add epee_encoding impl for `Status`

* macro: add epee_encoding for every type

* remove `strum`

* add response bases

* add `CORE_RPC_STATUS_UNKNOWN`

* add response/request bases for epee

* create `base` module

* use different type for macro example

* move base / root types around

* docs, status serde test

* status: use `Status::Unknown` for `epee_default_value`

* json: add missing fields to `GetBlockTemplateRequest`

not sure I missed these

cc73fe7116/src/rpc/core_rpc_server_commands_defs.h (L947-L950)

---------

Co-authored-by: Boog900 <boog900@tutanota.com>
2024-06-26 22:24:05 +01:00