From d8ff39e9350542e25660acb2bcc02cf185e9961d Mon Sep 17 00:00:00 2001 From: Antonio Date: Wed, 22 Feb 2023 11:49:36 +0100 Subject: [PATCH 1/2] chore: update CAIP limits and allowed charset (#466) Fixes https://github.com/KILTprotocol/ticket/issues/2458. - CAIP-19 asset reference max length was increased to 128: https://github.com/ChainAgnostic/CAIPs/pull/179 - CAIP-2 chain reference now supports underscores: https://github.com/ChainAgnostic/CAIPs/pull/180 - CAIP-19 asset reference and asset identifier now support `.` and `%` symbols: https://github.com/ChainAgnostic/CAIPs/pull/160 Not a breaking change since it just relaxes some requirements. --- crates/assets/src/asset.rs | 12 ++++++------ crates/assets/src/chain.rs | 3 ++- runtimes/common/src/constants.rs | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/crates/assets/src/asset.rs b/crates/assets/src/asset.rs index 60b7e2b7d..ed1cfa210 100644 --- a/crates/assets/src/asset.rs +++ b/crates/assets/src/asset.rs @@ -48,7 +48,7 @@ pub mod v1 { /// The minimum length of a valid asset ID reference. pub const MINIMUM_REFERENCE_LENGTH: usize = 1; /// The maximum length of a valid asset ID reference. - pub const MAXIMUM_REFERENCE_LENGTH: usize = 64; + pub const MAXIMUM_REFERENCE_LENGTH: usize = 128; const MAXIMUM_REFERENCE_LENGTH_U32: u32 = MAXIMUM_REFERENCE_LENGTH as u32; /// The minimum length of a valid asset ID identifier. pub const MINIMUM_IDENTIFIER_LENGTH: usize = 1; @@ -604,7 +604,7 @@ pub mod v1 { check_reference_length_bounds(input)?; input.iter().try_for_each(|c| { - if !matches!(c, b'-' | b'a'..=b'z' | b'A'..=b'Z' | b'0'..=b'9') { + if !matches!(c, b'-' | b'.' | b'%' | b'a'..=b'z' | b'A'..=b'Z' | b'0'..=b'9') { log::trace!("Provided input has some invalid values as expected by a generic asset reference."); Err(ReferenceError::InvalidFormat) } else { @@ -653,7 +653,7 @@ pub mod v1 { check_identifier_length_bounds(input)?; input.iter().try_for_each(|c| { - if !matches!(c, b'-' | b'a'..=b'z' | b'A'..=b'Z' | b'0'..=b'9') { + if !matches!(c, b'-' | b'.' | b'%' | b'a'..=b'z' | b'A'..=b'Z' | b'0'..=b'9') { log::trace!("Provided input has some invalid values as expected by a generic asset identifier."); Err(IdentifierError::InvalidFormat) } else { @@ -727,7 +727,7 @@ pub mod v1 { "slip44:›", "slip44:😁", // Max chars + 1 - "slip44:99999999999999999999999999999999999999999999999999999999999999999", + "slip44:999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999", ]; for asset in invalid_assets { assert!( @@ -899,7 +899,7 @@ pub mod v1 { let valid_assets = [ "123:a", "12345678:-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-", - "12345678:-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-:-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ012345678901234567890123-", + "12345678:-.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789%-:-.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890123456789012%", "para:411f057b9107718c9624d6aa4a3f23c1", "para:kilt-spiritnet", "w3n:john-doe", @@ -928,7 +928,7 @@ pub mod v1 { "valid:valid:", // Too long "too-loong:valid", - "valid:too-loooooooooooooooooooooooooooooooooooooooooooooooooooooooooong", + "valid:too-loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong", "valid:valid:too-loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong", // Wrong characters "no-val!d:valid", diff --git a/crates/assets/src/chain.rs b/crates/assets/src/chain.rs index cb26ff947..eb64a9933 100644 --- a/crates/assets/src/chain.rs +++ b/crates/assets/src/chain.rs @@ -591,7 +591,7 @@ mod v1 { check_reference_length_bounds(input)?; input.iter().try_for_each(|c| { - if !matches!(c, b'-' | b'a'..=b'z' | b'A'..=b'Z' | b'0'..=b'9') { + if !matches!(c, b'-' | b'_' | b'a'..=b'z' | b'A'..=b'Z' | b'0'..=b'9') { log::trace!("Provided input has some invalid values as expected by a generic chain reference."); Err(ReferenceError::InvalidFormat) } else { @@ -806,6 +806,7 @@ mod v1 { let valid_chains = [ // Edge cases "abc:-", + "abc:_", "-as01-aa:A", "12345678:abcdefghjklmnopqrstuvwxyzABCD012", // Filecoin examples -> https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-23.md diff --git a/runtimes/common/src/constants.rs b/runtimes/common/src/constants.rs index 7ff7dc632..f10dba450 100644 --- a/runtimes/common/src/constants.rs +++ b/runtimes/common/src/constants.rs @@ -437,7 +437,7 @@ pub mod public_credentials { use super::*; /// The size is checked in the runtime by a test. - pub const MAX_PUBLIC_CREDENTIAL_STORAGE_LENGTH: u32 = 355; + pub const MAX_PUBLIC_CREDENTIAL_STORAGE_LENGTH: u32 = 419; // Each credential would have a different deposit, so no multiplier here pub const PUBLIC_CREDENTIAL_DEPOSIT: Balance = deposit(1, MAX_PUBLIC_CREDENTIAL_STORAGE_LENGTH); From 29e9c2b9abd20d99e569bd282fd2d4660576fef7 Mon Sep 17 00:00:00 2001 From: Antonio Date: Wed, 22 Feb 2023 13:35:23 +0100 Subject: [PATCH 2/2] chore: add manual trigger for Polkadot releases dependencies (#463) Fixes https://github.com/KILTprotocol/ticket/issues/2403. I was playing around with `subalfred` and found out this nice feature, which we might want to integrate into our update flow. The action is configured to be run manually by providing the versions we are updating from and to. ~There is one thing that would break if we keep changing the weekly board project name to include the sprint goal, I think we could start tracking that separately.~ -> replaced `project-name` with `project-number`, thanks @ggera What do you guys think? Would it make sense? --- .github/workflows/polkadot-release-list.yml | 60 +++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/polkadot-release-list.yml diff --git a/.github/workflows/polkadot-release-list.yml b/.github/workflows/polkadot-release-list.yml new file mode 100644 index 000000000..b9fd17bd8 --- /dev/null +++ b/.github/workflows/polkadot-release-list.yml @@ -0,0 +1,60 @@ +name: create-polkadot-release-ticket + +on: + workflow_dispatch: + inputs: + current-version: + description: Current version of the Polkadot/Cumulus dependency + required: true + type: string + target-version: + description: Target version of the Polkadot/Cumulus dependency + required: true + type: string + asignee: + description: Person assigned for this upgrade + required: false + default: weichweich + type: choice + options: + - weichweich + - ntn-x2 + - trusch + - Ad96el + +jobs: + create-ticket: + runs-on: ubuntu-latest + steps: + - name: Install cargo + run: curl https://sh.rustup.rs -sSf | sh + - name: Install subalfred + env: + - SUBALFRED_VERSION: 0.9.1 + run: cargo install --version $SUBALFRED_VERSION --git https://github.com/hack-ink/subalfred.git subalfred + - name: Run subalfred for Substrate + run: subalfred track-updates paritytech/substrate --from polkadot-v${{ inputs.current-version }} --to polkadot-v${{ inputs.target-version }} > substrate-out.md + - name: Run subalfred for Cumulus + run: subalfred track-updates paritytech/cumulus --from polkadot-v${{ inputs.current-version }} --to polkadot-v${{ inputs.target-version }} > cumulus-out.md + - name: Merge outputs into single file + run: | + echo "## Substrate changes" > out.md + cat substrate-out.md >> out.md + echo "## Cumulus changes" >> out.md + cat cumulus-out.md >> out.md + - name: Create issue from commands output + id: new-issue + uses: peter-evans/create-issue-from-file@v3 + with: + title: "chore: update Polkadot dependencies from ${{ inputs.current-version }} to ${{ inputs.target-version }}" + repository: KILTProtocol/ticket + token: ${{ secrets.REPO_ACCESS_TOKEN }} + content-filepath: out.md + - name: Put issue into weekly board + uses: peter-evans/create-or-update-project-card@v2 + with: + # Weekly board + project-number: 24 + column-name: "📥 Inbox" + issue-number: ${{ steps.new-issue.outputs.issue-number }} +