mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 04:09:23 +00:00
Update monero-serai to limit the size of TX extra
This commit is contained in:
@@ -140,9 +140,9 @@ impl Metadata {
|
|||||||
/// A received output, defined as its absolute ID, data, and metadara.
|
/// A received output, defined as its absolute ID, data, and metadara.
|
||||||
#[derive(Clone, PartialEq, Eq, Debug, Zeroize, ZeroizeOnDrop)]
|
#[derive(Clone, PartialEq, Eq, Debug, Zeroize, ZeroizeOnDrop)]
|
||||||
pub struct ReceivedOutput {
|
pub struct ReceivedOutput {
|
||||||
pub absolute: AbsoluteId,
|
pub(crate) absolute: AbsoluteId,
|
||||||
pub data: OutputData,
|
pub(crate) data: OutputData,
|
||||||
pub metadata: Metadata,
|
pub(crate) metadata: Metadata,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ReceivedOutput {
|
impl ReceivedOutput {
|
||||||
|
|||||||
@@ -339,6 +339,12 @@ impl SignableTransaction {
|
|||||||
// Calculate the extra length
|
// Calculate the extra length
|
||||||
let extra = Extra::fee_weight(outputs, has_payment_id, data.as_ref());
|
let extra = Extra::fee_weight(outputs, has_payment_id, data.as_ref());
|
||||||
|
|
||||||
|
// https://github.com/monero-project/monero/pull/8733
|
||||||
|
const MAX_EXTRA_SIZE: usize = 1060;
|
||||||
|
if extra > MAX_EXTRA_SIZE {
|
||||||
|
Err(TransactionError::TooMuchData)?;
|
||||||
|
}
|
||||||
|
|
||||||
// This is a extremely heavy fee weight estimation which can only be trusted for two things
|
// This is a extremely heavy fee weight estimation which can only be trusted for two things
|
||||||
// 1) Ensuring we have enough for whatever fee we end up using
|
// 1) Ensuring we have enough for whatever fee we end up using
|
||||||
// 2) Ensuring we aren't over the max size
|
// 2) Ensuring we aren't over the max size
|
||||||
@@ -544,6 +550,7 @@ impl SignableTransaction {
|
|||||||
|
|
||||||
let mut serialized = Vec::with_capacity(extra_len);
|
let mut serialized = Vec::with_capacity(extra_len);
|
||||||
extra.write(&mut serialized).unwrap();
|
extra.write(&mut serialized).unwrap();
|
||||||
|
debug_assert_eq!(extra_len, extra);
|
||||||
serialized
|
serialized
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,9 @@ per not supporting integrated addresses.
|
|||||||
### In Instructions
|
### In Instructions
|
||||||
|
|
||||||
Monero In Instructions are present via `tx.extra`, specifically via inclusion
|
Monero In Instructions are present via `tx.extra`, specifically via inclusion
|
||||||
in a `TX_EXTRA_NONCE` tag, and accordingly limited to 255 bytes.
|
in a `TX_EXTRA_NONCE` tag. The tag is followed by the VarInt length of its
|
||||||
|
contents, and then additionally marked by a byte `127`. The following data is
|
||||||
|
limited to 254 bytes.
|
||||||
|
|
||||||
### Out Instructions
|
### Out Instructions
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user