fix encode/decode

This commit is contained in:
akildemir
2024-10-04 13:19:26 +03:00
parent 43cdbb1bff
commit 1ea3ee05c6
2 changed files with 4 additions and 6 deletions

View File

@@ -95,7 +95,7 @@ impl Decode for NetworkId {
let kind = input.read_byte()?;
match kind {
0 => Ok(Self::Serai),
_ => Ok(ExternalNetworkId::decode(input)?.into()),
_ => Ok(ExternalNetworkId::decode(&mut [kind].as_slice())?.into()),
}
}
}
@@ -264,7 +264,7 @@ impl Decode for Coin {
let kind = input.read_byte()?;
match kind {
0 => Ok(Self::Serai),
_ => Ok(ExternalCoin::decode(input)?.into()),
_ => Ok(ExternalCoin::decode(&mut [kind].as_slice())?.into()),
}
}
}

View File

@@ -13,7 +13,7 @@ use serai_client::{
},
primitives::{
crypto::RuntimePublic, Amount, BlockHash, ExternalBalance, ExternalNetworkId, PublicKey,
SeraiAddress,
SeraiAddress, EXTERNAL_NETWORKS,
},
validator_sets::primitives::Session,
};
@@ -190,9 +190,7 @@ pub(crate) async fn substrate_block(
#[test]
fn batch_test() {
for network in
[ExternalNetworkId::Bitcoin, ExternalNetworkId::Ethereum, ExternalNetworkId::Monero]
{
for network in EXTERNAL_NETWORKS {
let (coordinators, test) = new_test(network);
test.run(|ops| async move {