Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions rust/chains/tw_binance/src/transaction/message/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub mod side_chain_delegate;
pub mod time_lock_order;
pub mod token_order;
pub mod trade_order;
pub mod tranfer_out_order;
pub mod transfer_out_order;

pub trait BinanceMessage {
fn to_amino_protobuf(&self) -> SigningResult<Data>;
Expand All @@ -29,7 +29,7 @@ pub trait TWBinanceProto: Sized {
fn to_tw_proto(&self) -> Self::Proto<'static>;
}

/// Please note that some of the fields are typped such as `SideDelegateOrder`.
/// Please note that some of the fields are typed such as `SideDelegateOrder`.
#[derive(Deserialize, Serialize)]
#[serde(untagged)]
pub enum BinanceMessageEnum {
Expand All @@ -52,7 +52,7 @@ pub enum BinanceMessageEnum {
TokenBurnOrder(token_order::TokenBurnOrder),
NewTradeOrder(trade_order::NewTradeOrder),
CancelTradeOrder(trade_order::CancelTradeOrder),
TransferOutOrder(tranfer_out_order::TransferOutOrder),
TransferOutOrder(transfer_out_order::TransferOutOrder),
}

impl TWBinanceProto for BinanceMessageEnum {
Expand Down Expand Up @@ -107,7 +107,7 @@ impl TWBinanceProto for BinanceMessageEnum {
.map(BinanceMessageEnum::TokenBurnOrder)
},
BinanceMessageProto::transfer_out_order(ref order) => {
tranfer_out_order::TransferOutOrder::from_tw_proto(coin, order)
transfer_out_order::TransferOutOrder::from_tw_proto(coin, order)
.map(BinanceMessageEnum::TransferOutOrder)
},
BinanceMessageProto::side_delegate_order(ref order) => {
Expand Down
4 changes: 2 additions & 2 deletions rust/chains/tw_bitcoin/tests/babylon_staking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ fn test_babylon_scripts() {
let expected = &test["expected"];

let covenant_public_keys = parse_pks(&params["covenant_public_keys"]);
let convenant_quorum = params["covenant_quorum"].as_u64().unwrap() as u32;
let covenant_quorum = params["covenant_quorum"].as_u64().unwrap() as u32;
let finality_provider_public_keys = parse_pks(&params["finality_provider_public_keys"]);
let staker_public_key = parse_pk(&params["staker_public_key"]);
let staker_time = params["staking_time"].as_u64().unwrap() as u16;

let covenants = MultiSigOrderedKeys::new(covenant_public_keys, convenant_quorum).unwrap();
let covenants = MultiSigOrderedKeys::new(covenant_public_keys, covenant_quorum).unwrap();
let finality_providers =
MultiSigOrderedKeys::new(finality_provider_public_keys, 1).unwrap();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
}
},
{
"name": "1 finality key, 3/5 covenant committe, 1 staker key with op_return",
"name": "1 finality key, 3/5 covenant committee, 1 staker key with op_return",
"parameters": {
"covenant_public_keys": [
"02cc5c77da065c490a320834fdcf2c3da70ecd442054c90f874a1edb4669607b83",
Expand Down Expand Up @@ -70,7 +70,7 @@
}
},
{
"name": "3 finality keys, 3/5 covenant committe, 1 staker key with no op_return",
"name": "3 finality keys, 3/5 covenant committee, 1 staker key with no op_return",
"parameters": {
"covenant_public_keys": [
"02042916c9cd52cfa146118c37b6b118f082bb50fb91da1c51b76dfc2100e66f00",
Expand Down Expand Up @@ -109,7 +109,7 @@
}
},
{
"name": "1 finality keys, 7/9 covenant committe, 1 staker key with op_return",
"name": "1 finality keys, 7/9 covenant committee, 1 staker key with op_return",
"parameters": {
"covenant_public_keys": [
"0287ed5bb2d036baf209eb49520327f6bd05285dabd30c97f239c3a69ff419950b",
Expand Down Expand Up @@ -150,7 +150,7 @@
}
},
{
"name": "10 finality keys, 18/20 covenant committe, 1 staker key with no op_return",
"name": "10 finality keys, 18/20 covenant committee, 1 staker key with no op_return",
"parameters": {
"covenant_public_keys": [
"02e3803a6ecff76daf35709c8484f382783d211970f22397d7a258f40ca3b46304",
Expand Down
2 changes: 1 addition & 1 deletion rust/chains/tw_bitcoincash/src/cash_address/checksum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub fn calculate_checksum(prefix: &str, payload: &[u8]) -> u64 {
poly_mod(&raw_data)
}

pub fn cacl_and_append_checksum(prefix: &str, payload: &[u8]) -> Data {
pub fn calc_and_append_checksum(prefix: &str, payload: &[u8]) -> Data {
// The checksum sits in the last eight bytes.
// Append the phantom checksum to calculate an actual value.
let mut payload_with_checksum: Vec<_> =
Expand Down
2 changes: 1 addition & 1 deletion rust/chains/tw_bitcoincash/src/cash_address/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ impl CashAddress {
bech32::convert_bits(&payload, from, to, pad).map_err(|_| AddressError::InvalidInput)?
};

let payload_with_checksum = checksum::cacl_and_append_checksum(hrp, &payload_u5);
let payload_with_checksum = checksum::calc_and_append_checksum(hrp, &payload_u5);
let encoded_payload =
cash_base32::encode(&payload_with_checksum).map_err(|_| AddressError::InvalidInput)?;
Ok(format!("{hrp}:{encoded_payload}"))
Expand Down
4 changes: 2 additions & 2 deletions rust/chains/tw_decred/src/modules/decred_sighash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ impl DecredSighash {
let mut tx_preimage = tx.clone();

let inputs_to_preimage = LegacySighash::inputs_for_preimage(&tx_preimage, args)?;
let outpus_to_preimage = LegacySighash::outputs_for_preimage(&tx_preimage, args);
let outputs_to_preimage = LegacySighash::outputs_for_preimage(&tx_preimage, args);

tx_preimage.replace_inputs(inputs_to_preimage);
tx_preimage.replace_outputs(outpus_to_preimage);
tx_preimage.replace_outputs(outputs_to_preimage);

let prefix_hash = Self::tx_prefix_hash(&tx_preimage);
let witness_hash = Self::tx_witness_hash(&tx_preimage);
Expand Down
4 changes: 2 additions & 2 deletions rust/chains/tw_ripple/src/definitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use lazy_static::lazy_static;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use tw_misc::serde::hashmap_as_tupple_list;
use tw_misc::serde::hashmap_as_tuple_list;

pub const DEFINITIONS_JSON: &str = include_str!("../definitions/definitions.json");

Expand Down Expand Up @@ -39,7 +39,7 @@ pub struct FieldInfo {
#[serde(rename_all = "UPPERCASE")]
pub struct Definitions {
pub types: HashMap<String, i16>,
#[serde(with = "hashmap_as_tupple_list")]
#[serde(with = "hashmap_as_tuple_list")]
pub fields: HashMap<String, FieldInfo>,
pub transaction_types: HashMap<String, i16>,
}
Expand Down
2 changes: 1 addition & 1 deletion rust/chains/tw_solana/src/modules/tx_signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl TxSigner {

let message_encoded = Self::preimage_versioned(&unsigned_msg)?;

// Add external signatures first, so they can be overriden if corresponding private keys are specified.
// Add external signatures first, so they can be overridden if corresponding private keys are specified.
key_signs.extend(external_signatures.clone());

// Sign the message with all given private keys.
Expand Down
2 changes: 1 addition & 1 deletion rust/frameworks/tw_utxo/src/transaction/asset/brc20.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ mod tests {
let ticker = Brc20Ticker::new("asdf".to_string());
assert!(ticker.is_ok());

// Cover clone implemenation.
// Cover clone implementation.
let ticker = ticker.unwrap();

let _cloned = ticker.clone();
Expand Down
2 changes: 1 addition & 1 deletion rust/frameworks/tw_utxo/src/transaction/asset/ordinal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ fn create_envelope(
.push_slice(b"ord")
// Separator.
.push_opcode(OP_PUSHBYTES_1)
// MIME types require this addtional push. It seems that the original
// MIME types require this additional push. It seems that the original
// creator inadvertently used `push_slice(&[1])`, which leads to
// `<1><1>`, which denotes a length prefix followed by the value. On the
// other hand, for the data, `push_slice(&[])` is used, producing `<0>`.
Expand Down
8 changes: 4 additions & 4 deletions rust/tw_any_coin/src/ffi/tw_any_address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ pub unsafe extern "C" fn tw_any_address_create_with_string(

/// Creates an address from a public key and derivation option.
///
/// \param public_key derivates the address from the public key.
/// \param public_key derives the address from the public key.
/// \param coin coin type of the address.
/// \param derivation the custom derivation to use.
/// \return `TWAnyAddress` pointer or nullptr if public key is invalid.
Expand All @@ -145,7 +145,7 @@ pub unsafe extern "C" fn tw_any_address_create_with_public_key_derivation(

/// Creates an bech32 address from a public key and a given hrp.
///
/// \param public_key derivates the address from the public key.
/// \param public_key derives the address from the public key.
/// \param coin coin type of the address.
/// \param hrp hrp of the address.
/// \return TWAnyAddress pointer or nullptr if public key is invalid.
Expand Down Expand Up @@ -174,7 +174,7 @@ pub unsafe extern "C" fn tw_any_address_create_bech32_with_public_key(

/// Creates an Base58 Bitcoin address from a public key and a given hrp.
///
/// \param public_key derivates the address from the public key.
/// \param public_key derives the address from the public key.
/// \param coin coin type of the address.
/// \param p2pkh pay-to-public-key-hash address prefix.
/// \param p2sh pay-to-script-hash address prefix.
Expand Down Expand Up @@ -202,7 +202,7 @@ pub unsafe extern "C" fn tw_any_address_create_base58_with_public_key(

/// Creates an SS58 Substrate address from a public key and a given ss58 prefix.
///
/// \param public_key derivates the address from the public key.
/// \param public_key derives the address from the public key.
/// \param coin coin type of the address.
/// \param ss58 SS58 address prefix.
/// \return TWAnyAddress pointer or nullptr if public key is invalid.
Expand Down
2 changes: 1 addition & 1 deletion rust/tw_base58_address/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl<const SIZE: usize, const CHECKSUM_SIZE: usize, ChecksumHasher> fmt::Display
// }

// /// Deserializes a `Base58Address<SIZE>` with Bitcoin alphabet.
// pub fn deserialize_with_bitcoin_alph<'de, const SIZE: usize, const CHECKSUM_SIZE: usize, D>(
// pub fn deserialize_with_bitcoin_alpha<'de, const SIZE: usize, const CHECKSUM_SIZE: usize, D>(
// deserializer: D,
// ) -> Result<Base58Address<SIZE, CHECKSUM_SIZE>, D::Error>
// where
Expand Down
2 changes: 1 addition & 1 deletion rust/tw_coin_entry/src/prefix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub enum AddressPrefix {
SubstrateNetwork(u16),
}

/// A blockchain's address prefix should be convertable from an `AddressPrefix`.
/// A blockchain's address prefix should be convertible from an `AddressPrefix`.
pub trait Prefix: TryFrom<AddressPrefix, Error = AddressError> {}

impl<T> Prefix for T where T: TryFrom<AddressPrefix, Error = AddressError> {}
Expand Down
2 changes: 1 addition & 1 deletion rust/tw_cosmos_sdk/src/test_utils/sign_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub struct TestInput<'a> {
pub struct TestCompileInput<'a> {
pub coin: &'a dyn CoinContext,
pub input: Proto::SigningInput<'a>,
/// Either a stringified JSON object or a hex-encoded serialzied `SignDoc`.
/// Either a stringified JSON object or a hex-encoded serialized `SignDoc`.
pub tx_preimage: &'a str,
/// Expected transaction preimage hash.
pub tx_prehash: &'a str,
Expand Down
2 changes: 1 addition & 1 deletion rust/tw_evm/src/abi/encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ mod tests {

#[test]
fn test_pad_u32() {
// this will fail if endianess is not supported
// this will fail if endianness is not supported
assert_eq!(pad_u32(0x1)[31], 1);
assert_eq!(pad_u32(0x100)[30], 1);
}
Expand Down
2 changes: 1 addition & 1 deletion rust/tw_evm/src/abi/param_type/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::abi::param_type::ParamType;
pub struct Writer;

impl Writer {
/// Returns string which is a formatted represenation of param.
/// Returns string which is a formatted representation of param.
pub fn write(param: &ParamType) -> String {
Writer::write_for_abi(param, true)
}
Expand Down
4 changes: 2 additions & 2 deletions rust/tw_keypair/src/ffi/privkey.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ pub unsafe extern "C" fn tw_private_key_size(data: *const TWPrivateKey) -> usize
///
/// \param key *non-null* byte array.
/// \param key_len the length of the `key` array.
/// \param curve Eliptic curve of the private key.
/// \param curve Elliptic curve of the private key.
/// \return true if the private key is valid, false otherwise.
#[no_mangle]
pub unsafe extern "C" fn tw_private_key_is_valid(
Expand All @@ -94,7 +94,7 @@ pub unsafe extern "C" fn tw_private_key_is_valid(
/// \param key *non-null* pointer to a Private key
/// \param message *non-null* byte array.
/// \param message_len the length of the `input` array.
/// \param curve Eliptic curve.
/// \param curve Elliptic curve.
/// \return Signature as a C-compatible result with a C-compatible byte array.
#[no_mangle]
pub unsafe extern "C" fn tw_private_key_sign(
Expand Down
2 changes: 1 addition & 1 deletion rust/tw_misc/src/serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ macro_rules! deserialize_from_str {
};
}

pub mod hashmap_as_tupple_list {
pub mod hashmap_as_tuple_list {
use serde::de::{SeqAccess, Visitor};
use serde::ser::SerializeSeq;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
Expand Down
2 changes: 1 addition & 1 deletion rust/tw_proto/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ fn main() {
}

/// Unfortunately, `pb-rs` does not provide a proper support of custom derives.
/// [`ConfigBuilder::custom_struct_derive`] adds the derive macroses for structs only,
/// [`ConfigBuilder::custom_struct_derive`] adds the derive macros for structs only,
/// however they should be added for enums too.
/// Issues: https://github.com/tafia/quick-protobuf/issues/195, https://github.com/tafia/quick-protobuf/issues/212
#[cfg(feature = "fuzz")]
Expand Down
2 changes: 1 addition & 1 deletion rust/tw_tests/tests/chains/bitcoin/bitcoin_sign/p2sh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ fn test_bitcoin_sign_output_p2sh_with_address() {
//
// let sig = &signatures[0];
//
// // Construc the final redeem scrip with the necessary stack items (signature + pubkey).
// // Construct the final redeem scrip with the necessary stack items (signature + pubkey).
// let mut sig_buf = PushBytesBuf::new();
// sig_buf.extend_from_slice(sig).unwrap();
//
Expand Down
2 changes: 1 addition & 1 deletion rust/tw_tests/tests/chains/polymesh/polymesh_sign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ fn test_polymesh_encode_and_sign() {
helper_encode_and_compile(CoinType::Polymesh, input, signature, public_key, true);

assert_eq!(preimage, "050100849e2f6b165d4b28b39ef3d98f86c0520d82bc349536324365c10af08f323f8302093d00014d454d4f2050414444454420574954482053504143455320202020202020202025010400c20b0000020000006fbd74e5e1d0a61d52ccfe9d4adaed16dd3a7caa37c6bc4d0c2fa12e8b2f4063898bba6413c38f79a284aec8749f297f6c8734c501f67517b5a6aadc338d1102");
// This signed tranaction is different from the original C++ test, but matches the transaction on Polymesh.
// This signed transaction is different from the original C++ test, but matches the transaction on Polymesh.
assert_eq!(signed, "bd0284004322cf71da08f9d56181a707af7c0c437dfcb93e6caac9825a5aba57548142ee000791ee378775eaff34ef7e529ab742f0d81d281fdf20ace0aa765ca484f5909c4eea0a59c8dbbc534c832704924b424ba3230c38acd0ad5360cef023ca2a420f25010400050100849e2f6b165d4b28b39ef3d98f86c0520d82bc349536324365c10af08f323f8302093d00014d454d4f20504144444544205749544820535041434553202020202020202020");
}

Expand Down
6 changes: 3 additions & 3 deletions rust/wallet_core_rs/src/ffi/utils/bit_reader_ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub enum CBitReaderCode {
/// Requested more bits than the returned variable can hold, for example more than 8 bits when
/// reading into a u8.
TooManyBitsForType = 2,
InalidInput = 3,
InvalidInput = 3,
}

impl From<BitReaderError> for CBitReaderCode {
Expand Down Expand Up @@ -126,7 +126,7 @@ pub unsafe extern "C" fn tw_bit_reader_read_u8(
) -> CUInt8Result {
let tw_reader = try_or_else!(
TWBitReader::from_ptr_as_mut(reader),
|| CUInt8Result::error(CBitReaderCode::InalidInput)
|| CUInt8Result::error(CBitReaderCode::InvalidInput)
);
tw_reader.read_u8(bit_count).into()
}
Expand All @@ -143,7 +143,7 @@ pub unsafe extern "C" fn tw_bit_reader_read_u8_slice(
byte_count: usize,
) -> CByteArrayResult {
let tw_reader = try_or_else!(TWBitReader::from_ptr_as_mut(reader), || {
CByteArrayResult::error(CBitReaderCode::InalidInput)
CByteArrayResult::error(CBitReaderCode::InvalidInput)
});
tw_reader
.read_u8_slice(byte_count)
Expand Down
Loading