From 6d220a2dbb42c92f744e8648b4f78e1f659f5a03 Mon Sep 17 00:00:00 2001 From: Jon C Date: Tue, 3 Sep 2024 15:14:17 +0200 Subject: [PATCH] ci: Remove all references to twoxtx (#7234) --- .github/workflows/pull-request-token.yml | 7 +- token/.gitignore | 1 - token/program-2022-test/build.rs | 9 -- token/twoxtx-setup.sh | 29 ----- token/twoxtx.patch | 131 ----------------------- 5 files changed, 3 insertions(+), 174 deletions(-) delete mode 100644 token/.gitignore delete mode 100755 token/twoxtx-setup.sh delete mode 100644 token/twoxtx.patch diff --git a/.github/workflows/pull-request-token.yml b/.github/workflows/pull-request-token.yml index 3e2c7261d6e..2dd92f3b1bc 100644 --- a/.github/workflows/pull-request-token.yml +++ b/.github/workflows/pull-request-token.yml @@ -209,7 +209,7 @@ jobs: path: "target/deploy/*.so" if-no-files-found: error - cargo-test-sbf-twoxtx: + cargo-test-sbf-token-2022: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -242,12 +242,11 @@ jobs: ./ci/install-program-deps.sh echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH - - name: Build and test token-2022 twoxtx (TEMPORARY) + - name: Build and test token-2022 run: | cargo build-sbf --manifest-path token/program-2022/Cargo.toml cargo build-sbf --manifest-path instruction-padding/program/Cargo.toml - ./token/twoxtx-setup.sh - ./token/twoxtx-solana/cargo-test-sbf --manifest-path token/program-2022-test/Cargo.toml -- --nocapture + ./ci/cargo-test-sbf.sh token/program-2022-test js-test: runs-on: ubuntu-latest diff --git a/token/.gitignore b/token/.gitignore deleted file mode 100644 index 2a77c909079..00000000000 --- a/token/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/twoxtx-solana/ diff --git a/token/program-2022-test/build.rs b/token/program-2022-test/build.rs index 12e0f75b217..2cde9ec6201 100644 --- a/token/program-2022-test/build.rs +++ b/token/program-2022-test/build.rs @@ -64,13 +64,4 @@ fn main() { } } } - - // Set the temporary `twoxtx` cfg if `../twoxtx-setup.sh` was run - let twoxtx_solana_dir = cwd - .parent() - .expect("Unable to get parent directory of current working dir") - .join("twoxtx-solana"); - if twoxtx_solana_dir.exists() { - println!("cargo:rustc-cfg=twoxtx"); - } } diff --git a/token/twoxtx-setup.sh b/token/twoxtx-setup.sh deleted file mode 100755 index d20f35d49fc..00000000000 --- a/token/twoxtx-setup.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash -# -# Patch in a Solana monorepo that supports 2x transactions for testing the -# SPL Token 2022 Confidential Transfer extension -# - -set -e - -here="$(dirname "$0")" -cd "$here" - -if [[ ! -d twoxtx-solana ]]; then - if [[ -n $CI ]]; then - git config --global user.email "you@example.com" - git config --global user.name "Your Name" - git clone https://github.com/anza-xyz/agave.git twoxtx-solana - else - git clone git@github.com:anza-xyz/agave.git twoxtx-solana - fi -fi - -if [[ ! -f twoxtx-solana/.twoxtx-patched ]]; then - git -C twoxtx-solana am -3 "$PWD"/twoxtx.patch - touch twoxtx-solana/.twoxtx-patched -fi - -../patch.crates-io.sh twoxtx-solana - -exit 0 diff --git a/token/twoxtx.patch b/token/twoxtx.patch deleted file mode 100644 index bd1ea0a9032..00000000000 --- a/token/twoxtx.patch +++ /dev/null @@ -1,131 +0,0 @@ -From e5f7a7a9584edd4eef3c06df2d33069b78770c4a Mon Sep 17 00:00:00 2001 -From: Jon Cinque -Date: Wed, 31 Aug 2022 01:44:22 +0200 -Subject: [PATCH] Multiply packet size by 2 - ---- - ledger/src/shred.rs | 2 +- - ledger/src/shred/legacy.rs | 6 +++--- - ledger/src/shred/merkle.rs | 2 +- - ledger/src/shred/shred_code.rs | 2 +- - rpc/src/rpc.rs | 16 +++++++++++----- - sdk/src/packet.rs | 3 ++- - 6 files changed, 19 insertions(+), 12 deletions(-) - -diff --git a/ledger/src/shred.rs b/ledger/src/shred.rs -index 0695236214..1c52b164a9 100644 ---- a/ledger/src/shred.rs -+++ b/ledger/src/shred.rs -@@ -112,7 +112,7 @@ const OFFSET_OF_SHRED_INDEX: usize = OFFSET_OF_SHRED_SLOT + SIZE_OF_SHRED_SLOT; - pub const DATA_SHREDS_PER_FEC_BLOCK: usize = 32; - - // For legacy tests and benchmarks. --const_assert_eq!(LEGACY_SHRED_DATA_CAPACITY, 1051); -+const_assert_eq!(LEGACY_SHRED_DATA_CAPACITY, 2283); - pub const LEGACY_SHRED_DATA_CAPACITY: usize = legacy::ShredData::CAPACITY; - - // LAST_SHRED_IN_SLOT also implies DATA_COMPLETE_SHRED. -diff --git a/ledger/src/shred/legacy.rs b/ledger/src/shred/legacy.rs -index ca6310bdcb..c0ab2b1de4 100644 ---- a/ledger/src/shred/legacy.rs -+++ b/ledger/src/shred/legacy.rs -@@ -17,12 +17,12 @@ use { - // Code and data shreds have the same payload size. - pub(super) const SIGNED_MESSAGE_RANGE: Range = SIZE_OF_SIGNATURE..ShredData::SIZE_OF_PAYLOAD; - const_assert_eq!(ShredData::SIZE_OF_PAYLOAD, ShredCode::SIZE_OF_PAYLOAD); --const_assert_eq!(ShredData::SIZE_OF_PAYLOAD, 1228); --const_assert_eq!(ShredData::CAPACITY, 1051); -+const_assert_eq!(ShredData::SIZE_OF_PAYLOAD, 2460); -+const_assert_eq!(ShredData::CAPACITY, 2283); - - // ShredCode::SIZE_OF_HEADERS bytes at the end of data shreds - // is never used and is not part of erasure coding. --const_assert_eq!(SIZE_OF_ERASURE_ENCODED_SLICE, 1139); -+const_assert_eq!(SIZE_OF_ERASURE_ENCODED_SLICE, 2371); - pub(super) const SIZE_OF_ERASURE_ENCODED_SLICE: usize = - ShredCode::SIZE_OF_PAYLOAD - ShredCode::SIZE_OF_HEADERS; - -diff --git a/ledger/src/shred/merkle.rs b/ledger/src/shred/merkle.rs -index 90b686f5c8..ff47c745d1 100644 ---- a/ledger/src/shred/merkle.rs -+++ b/ledger/src/shred/merkle.rs -@@ -39,7 +39,7 @@ const_assert_eq!(SIZE_OF_MERKLE_ROOT, 20); - const SIZE_OF_MERKLE_ROOT: usize = std::mem::size_of::(); - const_assert_eq!(SIZE_OF_MERKLE_PROOF_ENTRY, 20); - const SIZE_OF_MERKLE_PROOF_ENTRY: usize = std::mem::size_of::(); --const_assert_eq!(ShredData::SIZE_OF_PAYLOAD, 1203); -+const_assert_eq!(ShredData::SIZE_OF_PAYLOAD, 2435); - - // Defense against second preimage attack: - // https://en.wikipedia.org/wiki/Merkle_tree#Second_preimage_attack -diff --git a/ledger/src/shred/shred_code.rs b/ledger/src/shred/shred_code.rs -index 3b01b8826d..3e3ebfbf78 100644 ---- a/ledger/src/shred/shred_code.rs -+++ b/ledger/src/shred/shred_code.rs -@@ -17,7 +17,7 @@ const_assert_eq!(MAX_CODE_SHREDS_PER_SLOT, 32_768 * 17); - pub(crate) const MAX_CODE_SHREDS_PER_SLOT: usize = - MAX_DATA_SHREDS_PER_SLOT * (ERASURE_BATCH_SIZE[1] - 1); - --const_assert_eq!(ShredCode::SIZE_OF_PAYLOAD, 1228); -+const_assert_eq!(ShredCode::SIZE_OF_PAYLOAD, 2460); - - #[derive(Clone, Debug, Eq, PartialEq)] - pub enum ShredCode { -diff --git a/rpc/src/rpc.rs b/rpc/src/rpc.rs -index 1167b21eaf..c9689f7039 100644 ---- a/rpc/src/rpc.rs -+++ b/rpc/src/rpc.rs -@@ -4478,8 +4478,11 @@ pub mod rpc_obsolete_v1_7 { - } - } - --const MAX_BASE58_SIZE: usize = 1683; // Golden, bump if PACKET_DATA_SIZE changes --const MAX_BASE64_SIZE: usize = 1644; // Golden, bump if PACKET_DATA_SIZE changes -+// These values need to be updated if PACKET_DATA_SIZE changes. The correct values can -+// be found by hand or by simply encoding `PACKET_DATA_SIZE` bytes and checking length. -+// `test_max_encoded_tx_goldens` ensures these values are correct. -+const MAX_BASE58_SIZE: usize = 3365; -+const MAX_BASE64_SIZE: usize = 3288; - fn decode_and_deserialize( - encoded: String, - encoding: TransactionBinaryEncoding, -@@ -8773,7 +8776,7 @@ pub mod tests { - } - - #[test] -- fn test_worst_case_encoded_tx_goldens() { -+ fn test_max_encoded_tx_goldens() { - let ff_tx = vec![0xffu8; PACKET_DATA_SIZE]; - let tx58 = bs58::encode(&ff_tx).into_string(); - assert_eq!(tx58.len(), MAX_BASE58_SIZE); -@@ -8783,8 +8786,11 @@ pub mod tests { - - #[test] - fn test_decode_and_deserialize_too_large_payloads_fail() { -- // +2 because +1 still fits in base64 encoded worst-case -- let too_big = PACKET_DATA_SIZE + 2; -+ // 4 base64 digits are generated from groups of 3 bytes; however, those 4 digits -+ // are generated even if the group only has 1 or 2 bytes. -+ // So, we need 4 - (PACKET_DATA_SIZE % 3) extra bytes to ensure we'll spill over -+ let extra_bytes = 4 - (PACKET_DATA_SIZE % 3); -+ let too_big = PACKET_DATA_SIZE + extra_bytes; - let tx_ser = vec![0xffu8; too_big]; - - let tx58 = bs58::encode(&tx_ser).into_string(); -diff --git a/sdk/src/packet.rs b/sdk/src/packet.rs -index 08389860f9..12714028d7 100644 ---- a/sdk/src/packet.rs -+++ b/sdk/src/packet.rs -@@ -15,7 +15,8 @@ static_assertions::const_assert_eq!(PACKET_DATA_SIZE, 1232); - /// 1280 is IPv6 minimum MTU - /// 40 bytes is the size of the IPv6 header - /// 8 bytes is the size of the fragment header --pub const PACKET_DATA_SIZE: usize = 1280 - 40 - 8; -+/// Double the minimum to support larger than MTU transactions -+pub const PACKET_DATA_SIZE: usize = 2 * (1280 - 40 - 8); - - bitflags! { - #[repr(C)] --- -2.38.1 -