Conversation
There was a problem hiding this comment.
Summary of Changes
Hello @MaxMoskalenko, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request addresses a significant architectural concern by proposing and documenting a standardized API protocol, particularly for the params field in both requests and responses. The goal is to enforce a consistent object-based structure for API data, especially for list-returning endpoints, which will greatly improve future code maintenance, development, and backward compatibility by avoiding the current ad-hoc usage of various JSON data structures. This is a foundational step towards a more robust and scalable API.
Highlights
- API Response Standardization: I've standardized the structure of the
paramsfield in API responses for endpoints that return lists of items. Previously, these often returned a direct array of items (e.g.,[[item1, item2]]). Now, they consistently return an array containing a single object, where the list of items is nested under a descriptive key (e.g.,[{ "channels": [item1, item2] }]). This makes the API more predictable and extensible. - Pagination Metadata: For paginated endpoints, I've introduced a
metadataobject within the standardized response structure. This object provides crucial pagination details such aspage,per_page,total_count, andpage_count, enhancing client-side pagination logic. - API Request Parameter Clarification: I've updated the documentation for several API request examples (
get_channels,get_app_sessions,get_ledger_entries,get_ledger_transactions) to explicitly show that optional parameters should be provided within an object, even if the request can be empty. - Documentation-First Approach: The changes in this pull request are primarily documentation updates in
API.md, reflecting the proposed API standard. I've also addedTODOcomments in the Go codebase (rpc_node.go,rpc_router_private.go) to guide future implementation work towards this new standard.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Code Review
This pull request introduces a standard for the API's params field in responses, enhancing consistency and extensibility. The changes in API.md document the new structure, wrapping response data in a named object. I've provided suggestions to improve consistency across endpoints and to implement the new error format.
clearnode/rpc_node.go
Outdated
| // TODO: send messages according to API.md: Params: [{"error": message}] | ||
| Params: []any{message}, | ||
| Timestamp: uint64(time.Now().UnixMilli()), | ||
| } |
There was a problem hiding this comment.
The TODO comment indicates a need to align the error message format with the new API standard. To ensure consistency across the API, update the error responses to follow the new standard, where params is an array containing an object with an error key.
c.Message.Res = &RPCData{
RequestID: c.Message.Req.RequestID,
Method: "error",
Params: []any{map[string]string{"error": message}},
Timestamp: uint64(time.Now().UnixMilli()),
}|
|
||
| ```json | ||
| { | ||
| "res": [1, "get_app_definition", [ | ||
| { | ||
| "protocol": "NitroRPC/0.2", | ||
| "participants": [ | ||
| "0xAaBbCcDdEeFf0011223344556677889900aAbBcC", | ||
| "0x00112233445566778899AaBbCcDdEeFf00112233" | ||
| ], | ||
| "weights": [50, 50], | ||
| "quorum": 100, | ||
| "challenge": 86400, | ||
| "nonce": 1 | ||
| } | ||
| ], 1619123456789], | ||
| "res": [1, "get_app_definition", [{ | ||
| "protocol": "NitroRPC/0.2", | ||
| "participants": [ | ||
| "0xAaBbCcDdEeFf0011223344556677889900aAbBcC", | ||
| "0x00112233445566778899AaBbCcDdEeFf00112233" | ||
| ], | ||
| "weights": [50, 50], | ||
| "quorum": 100, | ||
| "challenge": 86400, | ||
| "nonce": 1 | ||
| }], 1619123456789], | ||
| "sig": ["0xabcd1234..."] | ||
| } | ||
| ``` |
There was a problem hiding this comment.
The response for get_app_definition should follow the new standard, wrapping the app_definition in an object with a key, similar to other endpoints like get_channels and get_app_sessions. This ensures consistency across the API.
Consider the following structure:
{
"res": [1, "get_app_definition", [{
"app_definition": {
"protocol": "NitroRPC/0.2",
"participants": [
"0xAaBbCcDdEeFf0011223344556677889900aAbBcC",
"0x00112233445566778899AaBbCcDdEeFf00112233"
],
"weights": [50, 50],
"quorum": 100,
"challenge": 86400,
"nonce": 1
}
}], 1619123456789],
"sig": ["0xabcd1234..."]
}
alessio
left a comment
There was a problem hiding this comment.
Looks ok to me. Please ask for someone else's opinion too before merging 🙏
b34ae1c to
941cb3f
Compare
philanton
left a comment
There was a problem hiding this comment.
Right now that is only proposal, do you plan to change implementation in this PR too?
I'm just not sure whether that's a right decision to merge it before actual logic is done, - documentation will be out of sync with application
|
|
and I think API changes should be more collaborative, and we need @akushniruk opinion here too, not only BE guys |
941cb3f to
71752a0
Compare
clearnode/rpc_router_private.go
Outdated
| ) | ||
|
|
||
| type GetLedgerBalancesParams struct { | ||
| // TODO: add XOR validation |
There was a problem hiding this comment.
It's same field. As I know currently SDK is using participant field, but this field must be deprecated and account_id field should be used. If we do so many changes in this PR, I suggest dropping participant and keeping account_id as it was intended
|
rebase please |
a9ef6aa to
92188d5
Compare
9e19d74 to
6006868
Compare
|
Please,
|
256843b to
41f4cba
Compare
41f4cba to
6edf152
Compare
6edf152 to
2290bb2
Compare
* refactor: API protocol * fix: resolve issues after rebase
* feat: add system support for EIP-191, contracts support for EIP-(712,1271,6492) (#294) * feat: move erc7824 documentation to nitrolite (#272) * feat: move erc7824 documentation to nitrolite * feat: move GH actions to common scope * fix: comment GITHUB_TOKEN * feat(custody): add EIP-191, EIP-712 signature support (#257) * feat(custody): add EIP-191, EIP-712 support * feat(custody): correct EIP-712 sig impl * feat(utils): add POLA principle comment * feat(contract): add EIP712AdjudicatorBase * feat(contract): integrate EIP712AdjudicatorBase to supported adjs * fix(contract): tests with updated adjs * test(contract): EIP712AdjudicatorBase * test(contract): SimpleConsensus EIP191, EIP712 sigs * test(contract): Utils signatures * test(contract): Custody, SimpleConsensus integration tests for sigs * refactor(contract): migrate sig to bytes (#279) * refactor(Types): replace Signature{v,r,s} with bytes * style(contract): add empty lines at the end * refactor(clearnode): replace Signature{r,s,v} with []byte (#283) * refactor(sdk): migrate `Signature{r,s,v}` to `Hex` (#284) * refactor(sdk): replace Signature{r,s,v} with Hex * fix(NitroliteService): perform convertStateFromContract correctly * fix(rpc): expect updated signature type from rpc * style(sdk/rpc): remove ServerSignatureSchema var * feat(sdk/rpc): add empty signatures array by default * feat(sdk): add build:force command * feat(sdk): remove npm build:force * refactor(clearnode): define `Signature []byte` type (#287) * refactor(clearnode): define `Signature []byte` type * refactor(clearnode::RPCEntry): replace sig `[]string` with `[]Signature` * feat(clearnode/nitrolite): add Sigs2Strings, Strings2Sigs helpers * fix(integration): tests sig migration (#289) * feat(docker-compose): add ability to pass logger visibility to clearnode * fix(clearnode): raw ECDSA sign and verify * fix(clearnode): try to extract req id on ummarshal error * fix(integration): update sig to new type * feat(sdk): change type of sig array to contain only Hex * refactor(clearnode): remove check on nil Req, zero-init instead * fix(clearnode:nitrolite): remove unintended side-effect of sig param modif * feat(custody): add note about ephemeral final state * style(contract): run forge fmt * fix(clearnode/docs): remove legacy signature format * feat(custody): eip-1271, eip-6492 sigs support (#293) * feat(contract): add ERC-1271,6492 support * test(contract/Utils.sol): add ERC-1271, 6492 tests * refactor(contract:Utils.t.sol): separate tests into contracts * refactor(UtilsHarness): do NOT expose constants * fix(contracts/adjudicators): use verifyStateSignature instead of just EOA sig * test(contract/Custody): add ERC-1271, 6492 sig to integration test * test(contract/Custody): add challenge with EIP-712, EIP-1271 tests * refactor(contract/Utils): reorder recoverStateEIP712Signer params for consistency * test(contract): remove console.logs * feat(contract): clarify Utils comments * refactor(contract): optimize Custody and Utils sig verification functions * style(contract): run forge fmt * feat: replace `stateHash` with `packedState` in message signing (#295) * feat(contract): replace stateHash with packedState in signing * test(contract): migrate to getPackedState * feat(contract): remove getStateHash * feat(clearnode): remove state_hash, rename EncodeState to Pack * feat(sdk): remove state_hash, add getPackedState * refactor(sdk): supply channelId and state to signState * docs(website): migrate Sig to Hex, add supported signature formats --------- Co-authored-by: MaxMoskalenko <mx.msklnk@gmail.com> * feat: replace stateWalletClient with StateSigner (#297) * feat: redesign and improve joining channels by broker, refactor endpoints (#290) * feat: custody updates feat(custody): add EIP-191, EIP-712 signature support (#257) * feat(custody): add EIP-191, EIP-712 support * feat(custody): correct EIP-712 sig impl * feat(utils): add POLA principle comment * feat(contract): add EIP712AdjudicatorBase * feat(contract): integrate EIP712AdjudicatorBase to supported adjs * fix(contract): tests with updated adjs * test(contract): EIP712AdjudicatorBase * test(contract): SimpleConsensus EIP191, EIP712 sigs * test(contract): Utils signatures * test(contract): Custody, SimpleConsensus integration tests for sigs refactor(contract): migrate sig to bytes (#279) * refactor(Types): replace Signature{v,r,s} with bytes * style(contract): add empty lines at the end refactor(clearnode): replace Signature{r,s,v} with []byte (#283) refactor(sdk): migrate `Signature{r,s,v}` to `Hex` (#284) * refactor(sdk): replace Signature{r,s,v} with Hex * fix(NitroliteService): perform convertStateFromContract correctly * fix(rpc): expect updated signature type from rpc * style(sdk/rpc): remove ServerSignatureSchema var * feat(sdk/rpc): add empty signatures array by default * feat(sdk): add build:force command * feat(sdk): remove npm build:force refactor(clearnode): define `Signature []byte` type (#287) * refactor(clearnode): define `Signature []byte` type * refactor(clearnode::RPCEntry): replace sig `[]string` with `[]Signature` * feat(clearnode/nitrolite): add Sigs2Strings, Strings2Sigs helpers fix(integration): tests sig migration (#289) * feat(docker-compose): add ability to pass logger visibility to clearnode * fix(clearnode): raw ECDSA sign and verify * fix(clearnode): try to extract req id on ummarshal error * fix(integration): update sig to new type * feat(sdk): change type of sig array to contain only Hex * refactor(clearnode): remove check on nil Req, zero-init instead * fix(clearnode:nitrolite): remove unintended side-effect of sig param modif feat(custody): add note about ephemeral final state style(contract): run forge fmt fix(clearnode/docs): remove legacy signature format feat(custody): eip-1271, eip-6492 sigs support (#293) * feat(contract): add ERC-1271,6492 support * test(contract/Utils.sol): add ERC-1271, 6492 tests * refactor(contract:Utils.t.sol): separate tests into contracts * refactor(UtilsHarness): do NOT expose constants * fix(contracts/adjudicators): use verifyStateSignature instead of just EOA sig * test(contract/Custody): add ERC-1271, 6492 sig to integration test * test(contract/Custody): add challenge with EIP-712, EIP-1271 tests * refactor(contract/Utils): reorder recoverStateEIP712Signer params for consistency * test(contract): remove console.logs * feat(contract): clarify Utils comments * refactor(contract): optimize Custody and Utils sig verification functions * style(contract): run forge fmt feat(custody): add ability to create channel w/ server sig feat(contract/Custody): add ability to broker deposit in create * feat: clearnode updates feat: improve and simplify channel joining by broker drop join by broker feat: add create channel endpoint draft feat: use proper state format feat: code improvements and fix tests add doc feat: use state as encode state arg address comments feat: add tests for request create method update docs feat: refactor channel service tests rename encode state into encode state data feat: update response feat: unify channel operation responses feat: alling app session service structure to channel service update docs improve errors consistency * feat(rpc): add create_channel method and unify channel response types (#296) * feat: remove state hash from channel operation response * update erc-7824 docs * feat: include channel in channel operation response * fix: use chain id as key in network config * fix(Custody::join): allow 2 signatures * feat: add an optional session key for create_channel request * return state data as an encoded string * fix(Custody::join): add Server wallet * test(custody::join): broker auto-join tests (#303) * test(Custody::join): broker auto-join * refactor(contract/test): signState usage * refactor(Custody.t.sol): enhance broker auto join test name readability * feat: add sdk and integration support for simplified join (#304) --------- Co-authored-by: Sazonov Nikita <35502225+nksazonov@users.noreply.github.com> Co-authored-by: Max Pushkarov <mpushkarov@yellow.org> Co-authored-by: nksazonov <nsazonov@openware.com> Co-authored-by: MaxMoskalenko <mx.msklnk@gmail.com> * refactor: API protocol (#285) * refactor: API protocol * fix: resolve issues after rebase * feat(Custody): update domain version to 0.3.0 * config(contract): set optimizer runs to 45 000 * docs(contract/deployments): add UAT 137, 11155111, PROD 137 * fix: add missing exports * bump sdk version * fix(sdk::RPCNetworkInfo): remove chain name * update uat release values * feat: migrate cerebro to v0.3.0 (#306) * fix: channel amount * feat(examples): remove snake, tictactoe, aura * fix(main-pr): remove test-examples action * build(contract): add separate config for linea * docs(contract): add v0.3.0 deployments for mainnet * add linea support & update prod config --------- Co-authored-by: MaxMoskalenko <mx.msklnk@gmail.com> Co-authored-by: Dmytro Steblyna <80773046+dimast-x@users.noreply.github.com> Co-authored-by: Max Pushkarov <mpushkarov@yellow.org> Co-authored-by: Anton Filonenko <phil@yellow.org>
* feat: add system support for EIP-191, contracts support for EIP-(712,1271,6492) (erc7824#294) * feat: move erc7824 documentation to nitrolite (erc7824#272) * feat: move erc7824 documentation to nitrolite * feat: move GH actions to common scope * fix: comment GITHUB_TOKEN * feat(custody): add EIP-191, EIP-712 signature support (erc7824#257) * feat(custody): add EIP-191, EIP-712 support * feat(custody): correct EIP-712 sig impl * feat(utils): add POLA principle comment * feat(contract): add EIP712AdjudicatorBase * feat(contract): integrate EIP712AdjudicatorBase to supported adjs * fix(contract): tests with updated adjs * test(contract): EIP712AdjudicatorBase * test(contract): SimpleConsensus EIP191, EIP712 sigs * test(contract): Utils signatures * test(contract): Custody, SimpleConsensus integration tests for sigs * refactor(contract): migrate sig to bytes (erc7824#279) * refactor(Types): replace Signature{v,r,s} with bytes * style(contract): add empty lines at the end * refactor(clearnode): replace Signature{r,s,v} with []byte (erc7824#283) * refactor(sdk): migrate `Signature{r,s,v}` to `Hex` (erc7824#284) * refactor(sdk): replace Signature{r,s,v} with Hex * fix(NitroliteService): perform convertStateFromContract correctly * fix(rpc): expect updated signature type from rpc * style(sdk/rpc): remove ServerSignatureSchema var * feat(sdk/rpc): add empty signatures array by default * feat(sdk): add build:force command * feat(sdk): remove npm build:force * refactor(clearnode): define `Signature []byte` type (erc7824#287) * refactor(clearnode): define `Signature []byte` type * refactor(clearnode::RPCEntry): replace sig `[]string` with `[]Signature` * feat(clearnode/nitrolite): add Sigs2Strings, Strings2Sigs helpers * fix(integration): tests sig migration (erc7824#289) * feat(docker-compose): add ability to pass logger visibility to clearnode * fix(clearnode): raw ECDSA sign and verify * fix(clearnode): try to extract req id on ummarshal error * fix(integration): update sig to new type * feat(sdk): change type of sig array to contain only Hex * refactor(clearnode): remove check on nil Req, zero-init instead * fix(clearnode:nitrolite): remove unintended side-effect of sig param modif * feat(custody): add note about ephemeral final state * style(contract): run forge fmt * fix(clearnode/docs): remove legacy signature format * feat(custody): eip-1271, eip-6492 sigs support (erc7824#293) * feat(contract): add ERC-1271,6492 support * test(contract/Utils.sol): add ERC-1271, 6492 tests * refactor(contract:Utils.t.sol): separate tests into contracts * refactor(UtilsHarness): do NOT expose constants * fix(contracts/adjudicators): use verifyStateSignature instead of just EOA sig * test(contract/Custody): add ERC-1271, 6492 sig to integration test * test(contract/Custody): add challenge with EIP-712, EIP-1271 tests * refactor(contract/Utils): reorder recoverStateEIP712Signer params for consistency * test(contract): remove console.logs * feat(contract): clarify Utils comments * refactor(contract): optimize Custody and Utils sig verification functions * style(contract): run forge fmt * feat: replace `stateHash` with `packedState` in message signing (erc7824#295) * feat(contract): replace stateHash with packedState in signing * test(contract): migrate to getPackedState * feat(contract): remove getStateHash * feat(clearnode): remove state_hash, rename EncodeState to Pack * feat(sdk): remove state_hash, add getPackedState * refactor(sdk): supply channelId and state to signState * docs(website): migrate Sig to Hex, add supported signature formats --------- Co-authored-by: MaxMoskalenko <mx.msklnk@gmail.com> * feat: replace stateWalletClient with StateSigner (erc7824#297) * feat: redesign and improve joining channels by broker, refactor endpoints (erc7824#290) * feat: custody updates feat(custody): add EIP-191, EIP-712 signature support (erc7824#257) * feat(custody): add EIP-191, EIP-712 support * feat(custody): correct EIP-712 sig impl * feat(utils): add POLA principle comment * feat(contract): add EIP712AdjudicatorBase * feat(contract): integrate EIP712AdjudicatorBase to supported adjs * fix(contract): tests with updated adjs * test(contract): EIP712AdjudicatorBase * test(contract): SimpleConsensus EIP191, EIP712 sigs * test(contract): Utils signatures * test(contract): Custody, SimpleConsensus integration tests for sigs refactor(contract): migrate sig to bytes (erc7824#279) * refactor(Types): replace Signature{v,r,s} with bytes * style(contract): add empty lines at the end refactor(clearnode): replace Signature{r,s,v} with []byte (erc7824#283) refactor(sdk): migrate `Signature{r,s,v}` to `Hex` (erc7824#284) * refactor(sdk): replace Signature{r,s,v} with Hex * fix(NitroliteService): perform convertStateFromContract correctly * fix(rpc): expect updated signature type from rpc * style(sdk/rpc): remove ServerSignatureSchema var * feat(sdk/rpc): add empty signatures array by default * feat(sdk): add build:force command * feat(sdk): remove npm build:force refactor(clearnode): define `Signature []byte` type (erc7824#287) * refactor(clearnode): define `Signature []byte` type * refactor(clearnode::RPCEntry): replace sig `[]string` with `[]Signature` * feat(clearnode/nitrolite): add Sigs2Strings, Strings2Sigs helpers fix(integration): tests sig migration (erc7824#289) * feat(docker-compose): add ability to pass logger visibility to clearnode * fix(clearnode): raw ECDSA sign and verify * fix(clearnode): try to extract req id on ummarshal error * fix(integration): update sig to new type * feat(sdk): change type of sig array to contain only Hex * refactor(clearnode): remove check on nil Req, zero-init instead * fix(clearnode:nitrolite): remove unintended side-effect of sig param modif feat(custody): add note about ephemeral final state style(contract): run forge fmt fix(clearnode/docs): remove legacy signature format feat(custody): eip-1271, eip-6492 sigs support (erc7824#293) * feat(contract): add ERC-1271,6492 support * test(contract/Utils.sol): add ERC-1271, 6492 tests * refactor(contract:Utils.t.sol): separate tests into contracts * refactor(UtilsHarness): do NOT expose constants * fix(contracts/adjudicators): use verifyStateSignature instead of just EOA sig * test(contract/Custody): add ERC-1271, 6492 sig to integration test * test(contract/Custody): add challenge with EIP-712, EIP-1271 tests * refactor(contract/Utils): reorder recoverStateEIP712Signer params for consistency * test(contract): remove console.logs * feat(contract): clarify Utils comments * refactor(contract): optimize Custody and Utils sig verification functions * style(contract): run forge fmt feat(custody): add ability to create channel w/ server sig feat(contract/Custody): add ability to broker deposit in create * feat: clearnode updates feat: improve and simplify channel joining by broker drop join by broker feat: add create channel endpoint draft feat: use proper state format feat: code improvements and fix tests add doc feat: use state as encode state arg address comments feat: add tests for request create method update docs feat: refactor channel service tests rename encode state into encode state data feat: update response feat: unify channel operation responses feat: alling app session service structure to channel service update docs improve errors consistency * feat(rpc): add create_channel method and unify channel response types (erc7824#296) * feat: remove state hash from channel operation response * update erc-7824 docs * feat: include channel in channel operation response * fix: use chain id as key in network config * fix(Custody::join): allow 2 signatures * feat: add an optional session key for create_channel request * return state data as an encoded string * fix(Custody::join): add Server wallet * test(custody::join): broker auto-join tests (erc7824#303) * test(Custody::join): broker auto-join * refactor(contract/test): signState usage * refactor(Custody.t.sol): enhance broker auto join test name readability * feat: add sdk and integration support for simplified join (erc7824#304) --------- Co-authored-by: Sazonov Nikita <35502225+nksazonov@users.noreply.github.com> Co-authored-by: Max Pushkarov <mpushkarov@yellow.org> Co-authored-by: nksazonov <nsazonov@openware.com> Co-authored-by: MaxMoskalenko <mx.msklnk@gmail.com> * refactor: API protocol (erc7824#285) * refactor: API protocol * fix: resolve issues after rebase * feat(Custody): update domain version to 0.3.0 * config(contract): set optimizer runs to 45 000 * docs(contract/deployments): add UAT 137, 11155111, PROD 137 * fix: add missing exports * bump sdk version * fix(sdk::RPCNetworkInfo): remove chain name * update uat release values * feat: migrate cerebro to v0.3.0 (erc7824#306) * fix: channel amount * feat(examples): remove snake, tictactoe, aura * fix(main-pr): remove test-examples action * build(contract): add separate config for linea * docs(contract): add v0.3.0 deployments for mainnet * add linea support & update prod config --------- Co-authored-by: MaxMoskalenko <mx.msklnk@gmail.com> Co-authored-by: Dmytro Steblyna <80773046+dimast-x@users.noreply.github.com> Co-authored-by: Max Pushkarov <mpushkarov@yellow.org> Co-authored-by: Anton Filonenko <phil@yellow.org>
* feat: add system support for EIP-191, contracts support for EIP-(712,1271,6492) (erc7824#294) * feat: move erc7824 documentation to nitrolite (erc7824#272) * feat: move erc7824 documentation to nitrolite * feat: move GH actions to common scope * fix: comment GITHUB_TOKEN * feat(custody): add EIP-191, EIP-712 signature support (erc7824#257) * feat(custody): add EIP-191, EIP-712 support * feat(custody): correct EIP-712 sig impl * feat(utils): add POLA principle comment * feat(contract): add EIP712AdjudicatorBase * feat(contract): integrate EIP712AdjudicatorBase to supported adjs * fix(contract): tests with updated adjs * test(contract): EIP712AdjudicatorBase * test(contract): SimpleConsensus EIP191, EIP712 sigs * test(contract): Utils signatures * test(contract): Custody, SimpleConsensus integration tests for sigs * refactor(contract): migrate sig to bytes (erc7824#279) * refactor(Types): replace Signature{v,r,s} with bytes * style(contract): add empty lines at the end * refactor(clearnode): replace Signature{r,s,v} with []byte (erc7824#283) * refactor(sdk): migrate `Signature{r,s,v}` to `Hex` (erc7824#284) * refactor(sdk): replace Signature{r,s,v} with Hex * fix(NitroliteService): perform convertStateFromContract correctly * fix(rpc): expect updated signature type from rpc * style(sdk/rpc): remove ServerSignatureSchema var * feat(sdk/rpc): add empty signatures array by default * feat(sdk): add build:force command * feat(sdk): remove npm build:force * refactor(clearnode): define `Signature []byte` type (erc7824#287) * refactor(clearnode): define `Signature []byte` type * refactor(clearnode::RPCEntry): replace sig `[]string` with `[]Signature` * feat(clearnode/nitrolite): add Sigs2Strings, Strings2Sigs helpers * fix(integration): tests sig migration (erc7824#289) * feat(docker-compose): add ability to pass logger visibility to clearnode * fix(clearnode): raw ECDSA sign and verify * fix(clearnode): try to extract req id on ummarshal error * fix(integration): update sig to new type * feat(sdk): change type of sig array to contain only Hex * refactor(clearnode): remove check on nil Req, zero-init instead * fix(clearnode:nitrolite): remove unintended side-effect of sig param modif * feat(custody): add note about ephemeral final state * style(contract): run forge fmt * fix(clearnode/docs): remove legacy signature format * feat(custody): eip-1271, eip-6492 sigs support (erc7824#293) * feat(contract): add ERC-1271,6492 support * test(contract/Utils.sol): add ERC-1271, 6492 tests * refactor(contract:Utils.t.sol): separate tests into contracts * refactor(UtilsHarness): do NOT expose constants * fix(contracts/adjudicators): use verifyStateSignature instead of just EOA sig * test(contract/Custody): add ERC-1271, 6492 sig to integration test * test(contract/Custody): add challenge with EIP-712, EIP-1271 tests * refactor(contract/Utils): reorder recoverStateEIP712Signer params for consistency * test(contract): remove console.logs * feat(contract): clarify Utils comments * refactor(contract): optimize Custody and Utils sig verification functions * style(contract): run forge fmt * feat: replace `stateHash` with `packedState` in message signing (erc7824#295) * feat(contract): replace stateHash with packedState in signing * test(contract): migrate to getPackedState * feat(contract): remove getStateHash * feat(clearnode): remove state_hash, rename EncodeState to Pack * feat(sdk): remove state_hash, add getPackedState * refactor(sdk): supply channelId and state to signState * docs(website): migrate Sig to Hex, add supported signature formats --------- Co-authored-by: MaxMoskalenko <mx.msklnk@gmail.com> * feat: replace stateWalletClient with StateSigner (erc7824#297) * feat: redesign and improve joining channels by broker, refactor endpoints (erc7824#290) * feat: custody updates feat(custody): add EIP-191, EIP-712 signature support (erc7824#257) * feat(custody): add EIP-191, EIP-712 support * feat(custody): correct EIP-712 sig impl * feat(utils): add POLA principle comment * feat(contract): add EIP712AdjudicatorBase * feat(contract): integrate EIP712AdjudicatorBase to supported adjs * fix(contract): tests with updated adjs * test(contract): EIP712AdjudicatorBase * test(contract): SimpleConsensus EIP191, EIP712 sigs * test(contract): Utils signatures * test(contract): Custody, SimpleConsensus integration tests for sigs refactor(contract): migrate sig to bytes (erc7824#279) * refactor(Types): replace Signature{v,r,s} with bytes * style(contract): add empty lines at the end refactor(clearnode): replace Signature{r,s,v} with []byte (erc7824#283) refactor(sdk): migrate `Signature{r,s,v}` to `Hex` (erc7824#284) * refactor(sdk): replace Signature{r,s,v} with Hex * fix(NitroliteService): perform convertStateFromContract correctly * fix(rpc): expect updated signature type from rpc * style(sdk/rpc): remove ServerSignatureSchema var * feat(sdk/rpc): add empty signatures array by default * feat(sdk): add build:force command * feat(sdk): remove npm build:force refactor(clearnode): define `Signature []byte` type (erc7824#287) * refactor(clearnode): define `Signature []byte` type * refactor(clearnode::RPCEntry): replace sig `[]string` with `[]Signature` * feat(clearnode/nitrolite): add Sigs2Strings, Strings2Sigs helpers fix(integration): tests sig migration (erc7824#289) * feat(docker-compose): add ability to pass logger visibility to clearnode * fix(clearnode): raw ECDSA sign and verify * fix(clearnode): try to extract req id on ummarshal error * fix(integration): update sig to new type * feat(sdk): change type of sig array to contain only Hex * refactor(clearnode): remove check on nil Req, zero-init instead * fix(clearnode:nitrolite): remove unintended side-effect of sig param modif feat(custody): add note about ephemeral final state style(contract): run forge fmt fix(clearnode/docs): remove legacy signature format feat(custody): eip-1271, eip-6492 sigs support (erc7824#293) * feat(contract): add ERC-1271,6492 support * test(contract/Utils.sol): add ERC-1271, 6492 tests * refactor(contract:Utils.t.sol): separate tests into contracts * refactor(UtilsHarness): do NOT expose constants * fix(contracts/adjudicators): use verifyStateSignature instead of just EOA sig * test(contract/Custody): add ERC-1271, 6492 sig to integration test * test(contract/Custody): add challenge with EIP-712, EIP-1271 tests * refactor(contract/Utils): reorder recoverStateEIP712Signer params for consistency * test(contract): remove console.logs * feat(contract): clarify Utils comments * refactor(contract): optimize Custody and Utils sig verification functions * style(contract): run forge fmt feat(custody): add ability to create channel w/ server sig feat(contract/Custody): add ability to broker deposit in create * feat: clearnode updates feat: improve and simplify channel joining by broker drop join by broker feat: add create channel endpoint draft feat: use proper state format feat: code improvements and fix tests add doc feat: use state as encode state arg address comments feat: add tests for request create method update docs feat: refactor channel service tests rename encode state into encode state data feat: update response feat: unify channel operation responses feat: alling app session service structure to channel service update docs improve errors consistency * feat(rpc): add create_channel method and unify channel response types (erc7824#296) * feat: remove state hash from channel operation response * update erc-7824 docs * feat: include channel in channel operation response * fix: use chain id as key in network config * fix(Custody::join): allow 2 signatures * feat: add an optional session key for create_channel request * return state data as an encoded string * fix(Custody::join): add Server wallet * test(custody::join): broker auto-join tests (erc7824#303) * test(Custody::join): broker auto-join * refactor(contract/test): signState usage * refactor(Custody.t.sol): enhance broker auto join test name readability * feat: add sdk and integration support for simplified join (erc7824#304) --------- Co-authored-by: Sazonov Nikita <35502225+nksazonov@users.noreply.github.com> Co-authored-by: Max Pushkarov <mpushkarov@yellow.org> Co-authored-by: nksazonov <nsazonov@openware.com> Co-authored-by: MaxMoskalenko <mx.msklnk@gmail.com> * refactor: API protocol (erc7824#285) * refactor: API protocol * fix: resolve issues after rebase * feat(Custody): update domain version to 0.3.0 * config(contract): set optimizer runs to 45 000 * docs(contract/deployments): add UAT 137, 11155111, PROD 137 * fix: add missing exports * bump sdk version * fix(sdk::RPCNetworkInfo): remove chain name * update uat release values * feat: migrate cerebro to v0.3.0 (erc7824#306) * fix: channel amount * feat(examples): remove snake, tictactoe, aura * fix(main-pr): remove test-examples action * build(contract): add separate config for linea * docs(contract): add v0.3.0 deployments for mainnet * add linea support & update prod config --------- Co-authored-by: MaxMoskalenko <mx.msklnk@gmail.com> Co-authored-by: Dmytro Steblyna <80773046+dimast-x@users.noreply.github.com> Co-authored-by: Max Pushkarov <mpushkarov@yellow.org> Co-authored-by: Anton Filonenko <phil@yellow.org>
This PR was partially started as a fix of this issue #277. But there is even a bigger issue in the current API protocol: there are no strict standards for params field. Therefore right now
paramsfield could contain string, array, object or any other JSON-supported data structure.In my opinion, it makes further code maintenance and developing harder. As adding new field to non-object structure (e.g. add
metadataobject to array structure inget_channelsresp.) will require changes on sdk side and could cause type and compilation errors on product (that uses nitrolite) side. Also support backward compatibility for these changes would create huge amount of legacy code (aka code debt). So it would be nice to solve this issue ASAPPS. is there are any incentives to wrap params in array, could we simplify it by making:
[id, "message", params{}, ts]instead of[id, "message", [params{}], ts]?