Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 62d83db

Browse files
authored
ci: Update twoxtx patch file (#4018)
1 parent e71ea00 commit 62d83db

File tree

1 file changed

+14
-28
lines changed

1 file changed

+14
-28
lines changed

token/twoxtx.patch

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,20 @@ Subject: [PATCH] Multiply packet size by 2
1010
ledger/src/shred/shred_code.rs | 2 +-
1111
rpc/src/rpc.rs | 16 +++++++++++-----
1212
sdk/src/packet.rs | 3 ++-
13-
web3.js/src/transaction/constants.ts | 2 +-
14-
7 files changed, 20 insertions(+), 13 deletions(-)
13+
6 files changed, 19 insertions(+), 12 deletions(-)
1514

1615
diff --git a/ledger/src/shred.rs b/ledger/src/shred.rs
1716
index 0695236214..1c52b164a9 100644
1817
--- a/ledger/src/shred.rs
1918
+++ b/ledger/src/shred.rs
2019
@@ -112,7 +112,7 @@ const OFFSET_OF_SHRED_INDEX: usize = OFFSET_OF_SHRED_SLOT + SIZE_OF_SHRED_SLOT;
2120
pub const DATA_SHREDS_PER_FEC_BLOCK: usize = 32;
22-
21+
2322
// For legacy tests and benchmarks.
2423
-const_assert_eq!(LEGACY_SHRED_DATA_CAPACITY, 1051);
2524
+const_assert_eq!(LEGACY_SHRED_DATA_CAPACITY, 2283);
2625
pub const LEGACY_SHRED_DATA_CAPACITY: usize = legacy::ShredData::CAPACITY;
27-
26+
2827
// LAST_SHRED_IN_SLOT also implies DATA_COMPLETE_SHRED.
2928
diff --git a/ledger/src/shred/legacy.rs b/ledger/src/shred/legacy.rs
3029
index ca6310bdcb..c0ab2b1de4 100644
@@ -38,14 +37,14 @@ index ca6310bdcb..c0ab2b1de4 100644
3837
-const_assert_eq!(ShredData::CAPACITY, 1051);
3938
+const_assert_eq!(ShredData::SIZE_OF_PAYLOAD, 2460);
4039
+const_assert_eq!(ShredData::CAPACITY, 2283);
41-
40+
4241
// ShredCode::SIZE_OF_HEADERS bytes at the end of data shreds
4342
// is never used and is not part of erasure coding.
4443
-const_assert_eq!(SIZE_OF_ERASURE_ENCODED_SLICE, 1139);
4544
+const_assert_eq!(SIZE_OF_ERASURE_ENCODED_SLICE, 2371);
4645
pub(super) const SIZE_OF_ERASURE_ENCODED_SLICE: usize =
4746
ShredCode::SIZE_OF_PAYLOAD - ShredCode::SIZE_OF_HEADERS;
48-
47+
4948
diff --git a/ledger/src/shred/merkle.rs b/ledger/src/shred/merkle.rs
5049
index 90b686f5c8..ff47c745d1 100644
5150
--- a/ledger/src/shred/merkle.rs
@@ -56,7 +55,7 @@ index 90b686f5c8..ff47c745d1 100644
5655
const SIZE_OF_MERKLE_PROOF_ENTRY: usize = std::mem::size_of::<MerkleProofEntry>();
5756
-const_assert_eq!(ShredData::SIZE_OF_PAYLOAD, 1203);
5857
+const_assert_eq!(ShredData::SIZE_OF_PAYLOAD, 2435);
59-
58+
6059
// Defense against second preimage attack:
6160
// https://en.wikipedia.org/wiki/Merkle_tree#Second_preimage_attack
6261
diff --git a/ledger/src/shred/shred_code.rs b/ledger/src/shred/shred_code.rs
@@ -66,10 +65,10 @@ index 3b01b8826d..3e3ebfbf78 100644
6665
@@ -17,7 +17,7 @@ const_assert_eq!(MAX_CODE_SHREDS_PER_SLOT, 32_768 * 17);
6766
pub(crate) const MAX_CODE_SHREDS_PER_SLOT: usize =
6867
MAX_DATA_SHREDS_PER_SLOT * (ERASURE_BATCH_SIZE[1] - 1);
69-
68+
7069
-const_assert_eq!(ShredCode::SIZE_OF_PAYLOAD, 1228);
7170
+const_assert_eq!(ShredCode::SIZE_OF_PAYLOAD, 2460);
72-
71+
7372
#[derive(Clone, Debug, Eq, PartialEq)]
7473
pub enum ShredCode {
7574
diff --git a/rpc/src/rpc.rs b/rpc/src/rpc.rs
@@ -79,7 +78,7 @@ index 1167b21eaf..c9689f7039 100644
7978
@@ -4478,8 +4478,11 @@ pub mod rpc_obsolete_v1_7 {
8079
}
8180
}
82-
81+
8382
-const MAX_BASE58_SIZE: usize = 1683; // Golden, bump if PACKET_DATA_SIZE changes
8483
-const MAX_BASE64_SIZE: usize = 1644; // Golden, bump if PACKET_DATA_SIZE changes
8584
+// These values need to be updated if PACKET_DATA_SIZE changes. The correct values can
@@ -92,15 +91,15 @@ index 1167b21eaf..c9689f7039 100644
9291
encoding: TransactionBinaryEncoding,
9392
@@ -8773,7 +8776,7 @@ pub mod tests {
9493
}
95-
94+
9695
#[test]
9796
- fn test_worst_case_encoded_tx_goldens() {
9897
+ fn test_max_encoded_tx_goldens() {
9998
let ff_tx = vec![0xffu8; PACKET_DATA_SIZE];
10099
let tx58 = bs58::encode(&ff_tx).into_string();
101100
assert_eq!(tx58.len(), MAX_BASE58_SIZE);
102101
@@ -8783,8 +8786,11 @@ pub mod tests {
103-
102+
104103
#[test]
105104
fn test_decode_and_deserialize_too_large_payloads_fail() {
106105
- // +2 because +1 still fits in base64 encoded worst-case
@@ -111,7 +110,7 @@ index 1167b21eaf..c9689f7039 100644
111110
+ let extra_bytes = 4 - (PACKET_DATA_SIZE % 3);
112111
+ let too_big = PACKET_DATA_SIZE + extra_bytes;
113112
let tx_ser = vec![0xffu8; too_big];
114-
113+
115114
let tx58 = bs58::encode(&tx_ser).into_string();
116115
diff --git a/sdk/src/packet.rs b/sdk/src/packet.rs
117116
index 08389860f9..12714028d7 100644
@@ -124,22 +123,9 @@ index 08389860f9..12714028d7 100644
124123
-pub const PACKET_DATA_SIZE: usize = 1280 - 40 - 8;
125124
+/// Double the minimum to support larger than MTU transactions
126125
+pub const PACKET_DATA_SIZE: usize = 2 * (1280 - 40 - 8);
127-
126+
128127
bitflags! {
129128
#[repr(C)]
130-
diff --git a/web3.js/src/transaction/constants.ts b/web3.js/src/transaction/constants.ts
131-
index 075337e8dc..618d48cdfd 100644
132-
--- a/web3.js/src/transaction/constants.ts
133-
+++ b/web3.js/src/transaction/constants.ts
134-
@@ -5,7 +5,7 @@
135-
* 40 bytes is the size of the IPv6 header
136-
* 8 bytes is the size of the fragment header
137-
*/
138-
-export const PACKET_DATA_SIZE = 1280 - 40 - 8;
139-
+export const PACKET_DATA_SIZE = 2464;
140-
141-
export const VERSION_PREFIX_MASK = 0x7f;
142-
143-
--
129+
--
144130
2.38.1
145131

0 commit comments

Comments
 (0)