Emurgo / cardano-serialization-lib

This is a library, written in Rust, for serialization & deserialization of data structures used in Cardano's Haskell implementation of Alonzo along with useful utility functions.
Other
231 stars 125 forks source link

Obtaining network id from preprod Byron address failing with "Unknown network 1" error #583

Closed refi93 closed 1 year ago

refi93 commented 1 year ago

When I try to obtain the network id from a preprod Byron address it fails with an "Unknown network 1" error

const csl = require("@emurgo/cardano-serialization-lib-nodejs")
const address = 'KjgoiXJS2coTnqpCLHXFtd89Hv9ttjsE6yW4msyLXFNkykUpTsyBs85r2rDDia2uKrhdpGKCJnmFXwvPSWLe75564ixZWdTxRh7TnuaDLnHx'

csl.ByronAddress.from_base58(address).to_address().network_id() // error "Unknown network 1"

This logic seems to be missing a branch for preprod:

https://github.com/Emurgo/cardano-serialization-lib/blob/f90602b7f0edc4b6325cb50ea748f9220f039567/rust/src/address.rs#L278

lisicky commented 1 year ago

Thanks @refi93 ! Fix on the way