Skip to content

Commit

Permalink
Increase ASA URL size (algorand#2147)
Browse files Browse the repository at this point in the history
Increase the ASA URL size from a limiting 32 bytes to 96 bytes to support NFTs with longer IPFS URLs. 

Closes algorand/go-algorand-internal#1179.
  • Loading branch information
jdtzmn authored May 21, 2021
1 parent 943b3ab commit 93278a8
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 3 deletions.
3 changes: 3 additions & 0 deletions config/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -924,6 +924,9 @@ func initConsensusProtocols() {
// Enable TEAL 4
vFuture.LogicSigVersion = 4

// Increase asset URL length to allow for IPFS URLs
vFuture.MaxAssetURLBytes = 96

Consensus[protocol.ConsensusFuture] = vFuture
}

Expand Down
5 changes: 4 additions & 1 deletion test/scripts/e2e_subs/asset-misc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ ACCOUNTD=$(${gcmd} account new|awk '{ print $6 }')

ASSET_NAME='Birlot : décollage vs. ࠶🦪'

${gcmd} asset create --creator ${ACCOUNT} --name "${ASSET_NAME}" --unitname amisc --total 1000000000000
# to ensure IPFS URLs longer than 32 characters are supported
ASSET_URL="/ipfs/QmXoypizjW3WknFiJnKLwHCnL72vedxjQkDDP1mXWo6uco/wiki/Verifiable_random_function.html"

${gcmd} asset create --creator "${ACCOUNT}" --name "${ASSET_NAME}" --unitname amisc --total 1000000000000 --asseturl "${ASSET_URL}"

ASSET_ID=$(${gcmd} asset info --creator $ACCOUNT --unitname amisc|grep 'Asset ID'|awk '{ print $3 }')

Expand Down
30 changes: 30 additions & 0 deletions test/scripts/e2e_subs/v26/short-asset-url-only.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

filename=$(basename "$0")
scriptname="${filename%.*}"
date "+${scriptname} start %Y%m%d_%H%M%S"

set -e
set -x
set -o pipefail
export SHELLOPTS

WALLET=$1

gcmd="goal -w ${WALLET}"

ACCOUNT=$(${gcmd} account list|awk '{ print $3 }')
ASSET_NAME='Birlot : décollage vs. ࠶🦪'

set +o pipefail
# longer than 32-byte ASA URLs should fail
${gcmd} asset create \
--creator "${ACCOUNT}" \
--name "${ASSET_NAME}" \
--unitname amisc \
--total 1000000000000 \
--asseturl "123456789012345678901234567890123" 2>&1 \
| grep "is too long (max 32 bytes)"
set -o pipefail

date "+${scriptname} finish %Y%m%d_%H%M%S"
6 changes: 4 additions & 2 deletions test/scripts/e2e_subs/v26/teal-v3-only.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/bash

date '+teal-v3-only start %Y%m%d_%H%M%S'
filename=$(basename "$0")
scriptname="${filename%.*}"
date "+${scriptname} start %Y%m%d_%H%M%S"

set -e
set -x
Expand Down Expand Up @@ -96,4 +98,4 @@ set -o pipefail



date '+teal-v3-only OK %Y%m%d_%H%M%S'
date "+${scriptname} finish %Y%m%d_%H%M%S"

0 comments on commit 93278a8

Please sign in to comment.