mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 04:09:23 +00:00
Ensure InInstruction data is properly limited
Bitcoin didn't check, assuming data was <= 80 bytes thanks to being in OP_RETURN. An additional global check has been added.
This commit is contained in:
@@ -53,8 +53,8 @@ impl TryFrom<Vec<u8>> for Address {
|
||||
EncodedAddress::P2WSH(hash) => {
|
||||
Payload::WitnessProgram { version: WitnessVersion::V0, program: hash.to_vec() }
|
||||
}
|
||||
EncodedAddress::P2TR(hash) => {
|
||||
Payload::WitnessProgram { version: WitnessVersion::V1, program: hash.to_vec() }
|
||||
EncodedAddress::P2TR(key) => {
|
||||
Payload::WitnessProgram { version: WitnessVersion::V1, program: key.to_vec() }
|
||||
}
|
||||
},
|
||||
}))
|
||||
|
||||
@@ -27,9 +27,10 @@ pub use balance::*;
|
||||
mod account;
|
||||
pub use account::*;
|
||||
|
||||
// Monero, our current longest address candidate, has a longest address of featured with payment ID
|
||||
// 1 (enum) + 1 (flags) + 64 (two keys) + 8 (payment ID) = 74
|
||||
pub const MAX_ADDRESS_LEN: u32 = 74;
|
||||
// Monero, our current longest address candidate, has a longest address of featured
|
||||
// 1 (enum) + 1 (flags) + 64 (two keys) = 66
|
||||
// When JAMTIS arrives, it'll become 114 bytes
|
||||
pub const MAX_ADDRESS_LEN: u32 = 128;
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Encode, Decode, MaxEncodedLen, TypeInfo)]
|
||||
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
||||
|
||||
Reference in New Issue
Block a user