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

SubnetID parsing hides underlying error #384

Closed
aakoshh opened this issue Sep 5, 2023 · 0 comments
Closed

SubnetID parsing hides underlying error #384

aakoshh opened this issue Sep 5, 2023 · 0 comments
Labels
feature New feature or request s:ipc

Comments

@aakoshh
Copy link
Contributor

aakoshh commented Sep 5, 2023

The following is trying to parse a subnet ID copied from usage.md:

    #[test]
    fn parse_subnet_id() {
        let id = "/r31415926/t2xwzbdu7z5sam6hc57xxwkctciuaz7oe5omipwbq";
        SubnetID::from_str(id).unwrap();
    }

it panics:

---- settings::tests::parse_subnet_id stdout ----
thread 'settings::tests::parse_subnet_id' panicked at 'called `Result::unwrap()` on an `Err` value: InvalidID'

The reason turned out to be that t2 is unparseable, because the fvm_shared::address::network::Network::current_network() is Mainnet by default which has prefix f, and if the prefix is different it returns UnknownNetwork when it tries to parse.

It would be nice if parsing a subnet ID would return the most specific error it can find, because InvalidID is a catch-all for everything: if the rootnet ID isn't a u64, or if any of the children fail to parse. It could instead return the error and the offending part.

@aakoshh aakoshh added the feature New feature or request label Sep 5, 2023
@jsoares jsoares transferred this issue from consensus-shipyard/ipc-libs Dec 19, 2023
@jsoares jsoares added the s:ipc label Dec 19, 2023
@jsoares jsoares closed this as not planned Won't fix, can't repro, duplicate, stale Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request s:ipc
Projects
None yet
Development

No branches or pull requests

2 participants