mirror of
https://github.com/serai-dex/serai.git
synced 2024-11-16 17:07:35 +00:00
Update monero-serai to limit the size of TX extra
This commit is contained in:
parent
293731f739
commit
397d79040c
3 changed files with 13 additions and 4 deletions
|
@ -140,9 +140,9 @@ impl Metadata {
|
|||
/// A received output, defined as its absolute ID, data, and metadara.
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Zeroize, ZeroizeOnDrop)]
|
||||
pub struct ReceivedOutput {
|
||||
pub absolute: AbsoluteId,
|
||||
pub data: OutputData,
|
||||
pub metadata: Metadata,
|
||||
pub(crate) absolute: AbsoluteId,
|
||||
pub(crate) data: OutputData,
|
||||
pub(crate) metadata: Metadata,
|
||||
}
|
||||
|
||||
impl ReceivedOutput {
|
||||
|
|
|
@ -339,6 +339,12 @@ impl SignableTransaction {
|
|||
// Calculate the extra length
|
||||
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
|
||||
// 1) Ensuring we have enough for whatever fee we end up using
|
||||
// 2) Ensuring we aren't over the max size
|
||||
|
@ -544,6 +550,7 @@ impl SignableTransaction {
|
|||
|
||||
let mut serialized = Vec::with_capacity(extra_len);
|
||||
extra.write(&mut serialized).unwrap();
|
||||
debug_assert_eq!(extra_len, extra);
|
||||
serialized
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,9 @@ per not supporting integrated addresses.
|
|||
### In Instructions
|
||||
|
||||
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
|
||||
|
||||
|
|
Loading…
Reference in a new issue