Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--rpclisten-borsh/json should support ip only like --grpclisten #402

Closed
supertypo opened this issue Jan 22, 2024 · 3 comments
Closed

--rpclisten-borsh/json should support ip only like --grpclisten #402

supertypo opened this issue Jan 22, 2024 · 3 comments
Assignees
Labels
good first issue Good for newcomers

Comments

@supertypo
Copy link
Contributor

kaspad supports specifying --rpclisten=0.0.0.0 for listening on all interfaces on default network port.

However, it doesn't support the same for --rpclisten-borsh and --rpclisten-json, even though the --help text specifies it as optional and is identical for the three:

      --rpclisten[=<IP[:PORT]>]
          Interface:port to listen for gRPC connections (default port: 16110, testnet: 16210).
      --rpclisten-borsh[=<IP[:PORT]>]
          Interface:port to listen for wRPC Borsh connections (default port: 17110, testnet: 17210).
      --rpclisten-json[=<IP[:PORT]>]
          Interface:port to listen for wRPC JSON connections (default port: 18110, testnet: 18210).
@aspect aspect self-assigned this Jan 29, 2024
@aspect aspect removed their assignment Mar 20, 2024
@coderofstuff coderofstuff added the good first issue Good for newcomers label Mar 20, 2024
@coderofstuff
Copy link
Collaborator

For rpclisten-borsh the input is parsed into a WrpcNetAddress which can be any of default, public or an <ip>:<port>. The goal here is to also support just <ip>.

The string parsing logic in rpc/wrpc/server/src/addresses.rs is:

impl FromStr for WrpcNetAddress {
    type Err = AddrParseError;
    fn from_str(s: &str) -> Result<Self, Self::Err> {
        match s {
            "default" => Ok(WrpcNetAddress::Default),
            "public" => Ok(WrpcNetAddress::Public),
            _ => {
                let addr: ContextualNetAddress = s.parse()?;
                Ok(Self::Custom(addr))
            }
        }
    }
}

The work is focused on the _ arm of this match.

NOTE: Make sure that if only the IP is passed that you use the default port for the given network. Mainnet, testnet, simnet, devnet may have different default ports.

@gvbgduh
Copy link
Contributor

gvbgduh commented Mar 23, 2024

I have drafted a PR for this issue, but forgot to include a reference in the commit #439

coderofstuff pushed a commit that referenced this issue Jun 17, 2024
* Add support for IP only for --rpclisten-borsh/json

* Fix cehck complaints
D-Stacks pushed a commit to D-Stacks/rusty-kaspa that referenced this issue Jul 12, 2024
…spanet#439)

* Add support for IP only for --rpclisten-borsh/json

* Fix cehck complaints
michaelsutton added a commit to michaelsutton/rusty-kaspa that referenced this issue Jul 14, 2024
commit 6a56461
Author: Maxim <59533214+biryukovmaxim@users.noreply.github.com>
Date:   Tue Jun 18 18:09:29 2024 +0300

    Implement  PSKT(Partially Signed Kaspa Transaction) (kaspanet#481)

    * initial support of pskt:
        supported roles: creator, constructor, updater, signer roles

    * add builder

    * handle combine errors

    * finalize

    * extractor

    * chore: typo

    * style: fmt

    * expose txid to global

    * chore: change version

    * feat: serde for optional bytes

    * feat: impl (de)serialization

    * style: fmt

    * add example, fixes

    * style: fmt

    * style: clippy

    * rollback unrelated changes

    * psbt -> pskt

    * refactor: avoid copy-paste by using recursion

    * docs: add description of roles

commit a797e1e
Author: George Bogodukhov <gvbgduh@gmail.com>
Date:   Mon Jun 17 15:50:16 2024 +1000

    Add support for IP only for --rpclisten-borsh/json (kaspanet#402) (kaspanet#439)

    * Add support for IP only for --rpclisten-borsh/json

    * Fix cehck complaints
D-Stacks pushed a commit to D-Stacks/rusty-kaspa that referenced this issue Jul 17, 2024
…spanet#439)

* Add support for IP only for --rpclisten-borsh/json

* Fix cehck complaints
@aspect
Copy link
Collaborator

aspect commented Aug 17, 2024

This has been implemented in one of the merged PRs. Closing.

@aspect aspect closed this as completed Aug 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants