diff --git a/.cirrus.yml b/.cirrus.yml index 6f1f676cb3..857d096be2 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -313,7 +313,7 @@ task: name: 'macOS 13 native arm64 [gui, sqlite only] [no depends]' macos_instance: # Use latest image, but hardcode version to avoid silent upgrades (and breaks) - image: ghcr.io/cirruslabs/macos-ventura-xcode:14.1 # https://cirrus-ci.org/guide/macOS + image: ghcr.io/cirruslabs/macos-runner:sequoia # https://cirrus-ci.org/guide/macOS << : *MACOS_NATIVE_TASK_TEMPLATE env: << : *CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV diff --git a/ci/test/00_setup_env_mac_native_arm64.sh b/ci/test/00_setup_env_mac_native_arm64.sh index ade2d2787c..1a7be56d5b 100755 --- a/ci/test/00_setup_env_mac_native_arm64.sh +++ b/ci/test/00_setup_env_mac_native_arm64.sh @@ -7,9 +7,7 @@ export LC_ALL=C.UTF-8 export HOST=arm64-apple-darwin -# Homebrew's python@3.12 is marked as externally managed (PEP 668). -# Therefore, `--break-system-packages` is needed. -export PIP_PACKAGES="--break-system-packages zmq" +export PIP_PACKAGES="zmq" export GOAL="install" # ELEMENTS: add -fno-stack-check to work around clang bug on macos export BITCOIN_CONFIG="--with-gui --with-miniupnpc --with-natpmp --enable-reduce-exports CXXFLAGS=-fno-stack-check" diff --git a/ci/test/04_install.sh b/ci/test/04_install.sh index 5e778f10e3..6244a74f7b 100755 --- a/ci/test/04_install.sh +++ b/ci/test/04_install.sh @@ -11,7 +11,7 @@ if [[ $QEMU_USER_CMD == qemu-s390* ]]; then fi if [ "$CI_OS_NAME" == "macos" ]; then - sudo -H pip3 install --upgrade --break-system-packages --ignore-installed pip + sudo -H pip3 install --upgrade --ignore-installed pip # shellcheck disable=SC2086 IN_GETOPT_BIN="$(brew --prefix gnu-getopt)/bin/getopt" ${CI_RETRY_EXE} pip3 install --user $PIP_PACKAGES fi diff --git a/contrib/guix/guix-build b/contrib/guix/guix-build index b38f91f3c7..c2e7a6b17a 100755 --- a/contrib/guix/guix-build +++ b/contrib/guix/guix-build @@ -238,7 +238,7 @@ SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-$(git -c log.showSignature=false log --f # across time. time-machine() { # shellcheck disable=SC2086 - guix time-machine --url=https://git.savannah.gnu.org/git/guix.git \ + guix time-machine --url=https://codeberg.org/guix.git \ --commit=ae03f401381e956c4c41b4cf495cbde964fa43d0 \ --cores="$JOBS" \ --keep-failed \ diff --git a/contrib/guix/guix-codesign b/contrib/guix/guix-codesign index 4b272f3084..2a9779aee2 100755 --- a/contrib/guix/guix-codesign +++ b/contrib/guix/guix-codesign @@ -226,7 +226,7 @@ SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-$(git -c log.showSignature=false log --f # across time. time-machine() { # shellcheck disable=SC2086 - guix time-machine --url=https://git.savannah.gnu.org/git/guix.git \ + guix time-machine --url=https://codeberg.org/guix.git \ --commit=ae03f401381e956c4c41b4cf495cbde964fa43d0 \ --cores="$JOBS" \ --keep-failed \ diff --git a/contrib/release-signing/BD0F3062F87842410B06A0432F656B0610604482.pub b/contrib/release-signing/BD0F3062F87842410B06A0432F656B0610604482.pub new file mode 100644 index 0000000000..814de9005c --- /dev/null +++ b/contrib/release-signing/BD0F3062F87842410B06A0432F656B0610604482.pub @@ -0,0 +1,47 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQINBF6i+TEBEADafn73f7PgLE0YbUCzVcQzLctsnFeAreGseYF2vC89pTZpelYP +Ulw6ALAW3ce5IDwAIDpNKwX8sluCySyOS66M8X+yPVWnyzqZYUqI5+cDAHsiNfH2 +I9owGkoCOv9/e2SixYuresznehjpfLzcitn5FzG/1k0hReAYMAaFKSfwhBuBQuhZ +Yd9LLQv4Ujhwm5uc+LbMgBlzVfvUgmdztuWA9RoEqtiRT83MIbEKO9e8V0w405xT +8SJqZBAwappUmar6fcGwvOuD82nmGsKMRvW/hm4213+D5s7j+qYla2vVT319sUqj ++GegD1bVofJkkD1ivksU7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Fasop8CkGhhVnL2qHGvzLMt46xUfraIpPcgnlnCuocoXSlw ++JF5vy0+Gcb14nDDMZAUW/RIgeF5MmiblLVwJtz2paZhrUF7G6Uo+X404Eq7aEwn +8+weikqFclABRKsmn/uA2xLJEpDaMupJLZE+VibXCIYBAl0xRn38PmfYHerjATtV +2XK+YgxvlN4WWmpGs3G7yfOTN9RgWpcUlZmVXTkyUmXIH14gI4hILm16qezzdv6D +oyVthSegrEARVcCyL6LuB5mZhO7c3elKHA== +=K/wp +-----END PGP PUBLIC KEY BLOCK----- diff --git a/share/genbuild.sh b/share/genbuild.sh index ecc96160e6..fb19a68ce2 100755 --- a/share/genbuild.sh +++ b/share/genbuild.sh @@ -28,6 +28,8 @@ if [ "${BITCOIN_GENBUILD_NO_GIT}" != "1" ] && [ -e "$(command -v git)" ] && [ "$ RAWDESC=$(git describe --abbrev=0 2>/dev/null) if [ "$(git rev-parse HEAD)" = "$(git rev-list -1 "$RAWDESC" 2>/dev/null)" ]; then git diff-index --quiet HEAD -- && GIT_TAG=$RAWDESC + # Replace elements- tag with the corresponding v + case "$GIT_TAG" in elements-*) GIT_TAG="v${GIT_TAG#elements-}";; esac fi # otherwise generate suffix from git, i.e. string like "59887e8-dirty" diff --git a/src/policy/policy.cpp b/src/policy/policy.cpp index 65d7bae3a5..b88cb53180 100644 --- a/src/policy/policy.cpp +++ b/src/policy/policy.cpp @@ -318,6 +318,10 @@ bool IsIssuanceInMoneyRange(const CTransaction& tx) if (issuance.nAmount.IsExplicit() && !MoneyRange(issuance.nAmount.GetAmount())) { return false; } + // check the reissuance token is in range + if (!issuance.nInflationKeys.IsNull() && issuance.nInflationKeys.IsExplicit() && !MoneyRange(issuance.nInflationKeys.GetAmount())) { + return false; + } } return true; } diff --git a/test/functional/p2p_invalid_messages.py b/test/functional/p2p_invalid_messages.py index 3109ad2b56..7160d0d27a 100755 --- a/test/functional/p2p_invalid_messages.py +++ b/test/functional/p2p_invalid_messages.py @@ -130,7 +130,7 @@ class InvalidMessagesTest(BitcoinTestFramework): def test_size(self): self.log.info("Test message with oversized payload disconnects peer") conn = self.nodes[0].add_p2p_connection(P2PDataStore()) - with self.nodes[0].assert_debug_log(['Header error: Size too large (badmsg, 4000001 bytes)']): + with self.nodes[0].assert_debug_log(['Header error: Size too large (badmsg, 16000001 bytes)']): msg = msg_unrecognized(str_data="d" * (VALID_DATA_LIMIT + 1)) msg = conn.build_message(msg) conn.send_raw_message(msg) diff --git a/test/functional/test_runner.py b/test/functional/test_runner.py index 3ff2738016..3dab02f832 100755 --- a/test/functional/test_runner.py +++ b/test/functional/test_runner.py @@ -244,8 +244,7 @@ BASE_SCRIPTS = [ 'p2p_invalid_block.py', 'feature_elements_taproot_activation.py', 'feature_elements_simplicity_activation.py', - # ELEMENTS: needs to be fixed - #'p2p_invalid_messages.py', + 'p2p_invalid_messages.py', 'p2p_invalid_tx.py', 'feature_assumevalid.py', 'example_test.py', diff --git a/test/functional/wallet_elements_21million.py b/test/functional/wallet_elements_21million.py index fb4d4a4695..73ef7feaa5 100755 --- a/test/functional/wallet_elements_21million.py +++ b/test/functional/wallet_elements_21million.py @@ -20,7 +20,7 @@ class WalletTest(BitcoinTestFramework): self.extra_args = [ args + ["-acceptunlimitedissuances=1"], args + ["-acceptunlimitedissuances=1"], - args, # node 2 blocks unblinded issuances out of moneyrange + args, # node 2 blocks unblinded issuances out of moneyrange (default -acceptunlimitedissuances=0) ] def setup_network(self, split=False): @@ -61,6 +61,12 @@ class WalletTest(BitcoinTestFramework): self.generate(self.nodes[0], 1) assert_equal(self.nodes[0].getbalance()[unblinded_asset], 500_000_000) + self.log.info("Issue more than 21 million of a unblinded reissuance token") + issuance = self.nodes[0].issueasset(300_000_000, 100_000_000, False) + self.generate(self.nodes[0], 1) + assert_equal(self.nodes[0].getbalance()[issuance['asset']], 300_000_000) + assert_equal(self.nodes[0].getbalance()[issuance['token']], 100_000_000) + # send more than 21 million of that asset addr = self.nodes[1].getnewaddress() self.nodes[0].sendtoaddress(address=addr, amount=22_000_000, assetlabel=asset) @@ -130,5 +136,40 @@ class WalletTest(BitcoinTestFramework): assert(asset not in self.nodes[0].getbalance()) assert_equal(self.nodes[2].getbalance()[asset], 300_000_000) + self.log.info("Reissue more than 21 million of a unblinded non-policy asset on node 2 - rejected from mempool") + issuance = self.nodes[2].issueasset(3_000_000, 100, False) + asset = issuance['asset'] + unblinded_asset = issuance['asset'] + self.generate(self.nodes[2], 1) + assert_equal(self.nodes[2].getbalance()[unblinded_asset], 3_000_000) + reissuance = self.nodes[2].reissueasset(unblinded_asset, 200_000_000) + reissuance_tx = self.nodes[2].gettransaction(reissuance["txid"]) + assert_raises_rpc_error(-26, "issuance-out-of-range", self.nodes[2].sendrawtransaction, reissuance_tx['hex']) + # transaction should be accepted on node 0 + self.nodes[0].sendrawtransaction(reissuance_tx["hex"]) + assert(reissuance['txid'] in self.nodes[0].getrawmempool()) + assert(reissuance['txid'] not in self.nodes[2].getrawmempool()) + self.generate(self.nodes[0], 1) + assert(asset not in self.nodes[0].getbalance()) + assert_equal(self.nodes[2].getbalance()[asset], 203_000_000) + + self.log.info("Issue more than 21 million reissuance tokens on node 2 - rejected from mempool") + issuance = self.nodes[2].issueasset(3_000_000, 200_000_000, False) + asset = issuance['asset'] + token = issuance['token'] + issuance_tx = self.nodes[2].gettransaction(issuance["txid"]) + assert_raises_rpc_error(-26, "issuance-out-of-range", self.nodes[2].sendrawtransaction, issuance_tx['hex']) + self.generate(self.nodes[0], 1) + assert(asset not in self.nodes[2].getbalance()) + assert(token not in self.nodes[2].getbalance()) + # transaction should be accepted on node 0 + self.nodes[0].sendrawtransaction(issuance_tx["hex"]) + assert(issuance['txid'] in self.nodes[0].getrawmempool()) + assert(issuance['txid'] not in self.nodes[2].getrawmempool()) + self.generate(self.nodes[0], 1) + assert(asset not in self.nodes[0].getbalance()) + assert_equal(self.nodes[2].getbalance()[asset], 3_000_000) + assert_equal(self.nodes[2].getbalance()[token], 200_000_000) + if __name__ == '__main__': WalletTest().main()