Skip to content

Prepare 23.3.0rc6 #1441

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Mar 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
335 changes: 61 additions & 274 deletions SECURITY.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ AC_PREREQ([2.69])
define(_CLIENT_VERSION_MAJOR, 23)
define(_CLIENT_VERSION_MINOR, 3)
define(_CLIENT_VERSION_BUILD, 0)
define(_CLIENT_VERSION_RC, 5)
define(_CLIENT_VERSION_RC, 6)
define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2024)
define(_COPYRIGHT_HOLDERS,[The %s developers])
Expand Down
4 changes: 3 additions & 1 deletion src/blindpsbt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,13 @@ bool CreateAssetSurjectionProof(std::vector<unsigned char>& output_proof, const

bool VerifyBlindAssetProof(const uint256& asset, const std::vector<unsigned char>& proof, const CConfidentialAsset& conf_asset)
{
if (conf_asset.vchCommitment.size() != CConfidentialAsset::nCommittedSize || proof.empty()) {
return false;
}
secp256k1_surjectionproof surj_proof;
if (secp256k1_surjectionproof_parse(secp256k1_blind_context, &surj_proof, proof.data(), proof.size()) == 0) {
return false;
}

secp256k1_generator blinded_asset_gen;
if (secp256k1_generator_parse(secp256k1_blind_context, &blinded_asset_gen, conf_asset.vchCommitment.data()) == 0) {
return false;
Expand Down
10 changes: 5 additions & 5 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ class CMainParams : public CChainParams {
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].min_activation_height = 709632; // Approximately November 12th, 2021

// Simplicity
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].bit = 24;
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].bit = 21;
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].nStartTime = Consensus::BIP9Deployment::NEVER_ACTIVE;
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].min_activation_height = 0; // No activation delay
Expand Down Expand Up @@ -361,7 +361,7 @@ class CTestNetParams : public CChainParams {
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].min_activation_height = 0; // No activation delay

// Simplicity
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].bit = 24;
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].bit = 21;
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].nStartTime = Consensus::BIP9Deployment::NEVER_ACTIVE;
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].min_activation_height = 0; // No activation delay
Expand Down Expand Up @@ -527,7 +527,7 @@ class SigNetParams : public CChainParams {
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].min_activation_height = 0; // No activation delay

// Simplicity
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].bit = 24;
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].bit = 21;
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].nStartTime = Consensus::BIP9Deployment::NEVER_ACTIVE;
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].min_activation_height = 0; // No activation delay
Expand Down Expand Up @@ -626,7 +626,7 @@ class CRegTestParams : public CChainParams {
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nThreshold = 128;

// Simplicity
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].bit = 24;
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].bit = 21;
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].nStartTime = Consensus::BIP9Deployment::NEVER_ACTIVE;
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].min_activation_height = 0; // No activation delay
Expand Down Expand Up @@ -1288,7 +1288,7 @@ class CLiquidV1Params : public CChainParams {
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nThreshold = 10080; // ...of 100% signalling

// Simplicity
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].bit = 24;
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].bit = 21;
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].nStartTime = Consensus::BIP9Deployment::NEVER_ACTIVE;
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].min_activation_height = 0; // No activation delay
Expand Down
3 changes: 3 additions & 0 deletions src/confidential_validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,9 @@ bool VerifyAmounts(const std::vector<CTxOut>& inputs, const CTransaction& tx, st
}
if (!ptxoutwit)
return false;
if (asset.vchCommitment.size() != CConfidentialAsset::nCommittedSize || ptxoutwit->vchSurjectionproof.empty()) {
return false;
}
if (secp256k1_generator_parse(secp256k1_ctx_verify_amounts, &gen, &asset.vchCommitment[0]) != 1)
return false;

Expand Down
5 changes: 4 additions & 1 deletion src/policy/policy.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static const unsigned int MAX_STANDARD_SCRIPTSIG_SIZE = 1650;
* standard and should be done with care and ideally rarely. It makes sense to
* only increase the dust limit after prior releases were already not creating
* outputs below the new threshold */
static const unsigned int DUST_RELAY_TX_FEE = 3000;
static const unsigned int DUST_RELAY_TX_FEE = 100;
/**
* Standard script verification flags that standard transactions will comply
* with. However scripts violating these flags may still be present in valid
Expand Down Expand Up @@ -89,6 +89,9 @@ static constexpr unsigned int STANDARD_NOT_MANDATORY_VERIFY_FLAGS = STANDARD_SCR
static constexpr unsigned int STANDARD_LOCKTIME_VERIFY_FLAGS = LOCKTIME_VERIFY_SEQUENCE |
LOCKTIME_MEDIAN_TIME_PAST;

// ELEMENTS: keep a copy of the upstream default dust relay fee rate
static const unsigned int DUST_RELAY_TX_FEE_BITCOIN = 3000;

CAmount GetDustThreshold(const CTxOut& txout, const CFeeRate& dustRelayFee);

bool IsDust(const CTxOut& txout, const CFeeRate& dustRelayFee);
Expand Down
3 changes: 2 additions & 1 deletion src/test/transaction_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,7 @@ BOOST_AUTO_TEST_CASE(test_IsStandard)
CheckIsStandard(t);

// Check dust with default relay fee:
dustRelayFee = CFeeRate(DUST_RELAY_TX_FEE_BITCOIN); // ELEMENTS: use the Bitcoin default dust relay feerate
CAmount nDustThreshold = 182 * dustRelayFee.GetFeePerK() / 1000;
BOOST_CHECK_EQUAL(nDustThreshold, 546);
// dust:
Expand Down Expand Up @@ -830,7 +831,7 @@ BOOST_AUTO_TEST_CASE(test_IsStandard)
// not dust:
t.vout[0].nValue = 674;
CheckIsStandard(t);
dustRelayFee = CFeeRate(DUST_RELAY_TX_FEE);
dustRelayFee = CFeeRate(DUST_RELAY_TX_FEE_BITCOIN); // ELEMENTS: use the Bitcoin default dust relay feerate

t.vout[0].scriptPubKey = CScript() << OP_1;
CheckIsNotStandard(t, "scriptpubkey");
Expand Down
44 changes: 44 additions & 0 deletions test/functional/feature_confidential_transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,44 @@ def test_wallet_recovery(self):
# clean up blind_details
os.remove(file_path)

def test_no_surj(self):
self.generate(self.nodes[0], 1)

tx_hex = self.nodes[0].createrawtransaction([], [{self.nodes[1].getnewaddress(): 1000}])
tx_hex = self.nodes[0].fundrawtransaction(tx_hex)['hex']
tx_hex = self.nodes[0].blindrawtransaction(tx_hex)
# coming from initial free coins: no need to sign
assert_equal(self.nodes[0].testmempoolaccept([tx_hex])[0]['allowed'], True) # tx is ok

# remove a surjection proof from the tx
tx = CTransaction()
tx.deserialize(io.BytesIO(bytes.fromhex(tx_hex)))
tx.wit.vtxoutwit[0].vchSurjectionproof = b''
tx_hex = tx.serialize().hex()

# Both of these make the node crash
assert_equal(self.nodes[0].testmempoolaccept([tx_hex])[0]['allowed'], False)
assert_raises_rpc_error(-26, "bad-txns-in-ne-out", self.nodes[0].sendrawtransaction, tx_hex)

def test_no_range(self):
self.generate(self.nodes[0], 1)

tx_hex = self.nodes[0].createrawtransaction([], [{self.nodes[1].getnewaddress(): 1000}])
tx_hex = self.nodes[0].fundrawtransaction(tx_hex)['hex']
tx_hex = self.nodes[0].blindrawtransaction(tx_hex)
# coming from initial free coins: no need to sign
assert_equal(self.nodes[0].testmempoolaccept([tx_hex])[0]['allowed'], True) # tx is ok

# remove a surjection proof from the tx
tx = CTransaction()
tx.deserialize(io.BytesIO(bytes.fromhex(tx_hex)))
tx.wit.vtxoutwit[0].vchRangeproof = b''
tx_hex = tx.serialize().hex()

# Both of these make the node crash
assert_equal(self.nodes[0].testmempoolaccept([tx_hex])[0]['allowed'], False)
assert_raises_rpc_error(-26, "bad-txns-in-ne-out", self.nodes[0].sendrawtransaction, tx_hex)

def test_null_rangeproof_enforcement(self):
self.generate(self.nodes[0], 1)

Expand Down Expand Up @@ -160,6 +198,12 @@ def test_null_rangeproof_enforcement(self):

def run_test(self):

print("Testing a transaction with a missing surjection proof")
self.test_no_surj()

print("Testing a transaction with a missing range proof")
self.test_no_range()

print("Testing that null issuances must have null rangeproofs")
self.test_null_rangeproof_enforcement()

Expand Down
23 changes: 12 additions & 11 deletions test/functional/feature_elements_simplicity_activation.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class SimplicityActivationTest(BitcoinTestFramework):
def set_test_params(self):
self.setup_clean_chain = True
self.num_nodes = 1
self.extra_args = [["-evbparams=dynafed:0:::"]]

def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
Expand All @@ -36,8 +37,8 @@ def test_activation(self, rpc, activation_height):
if n < 143:
assert_equal (decode["versionHex"], "20000000")
elif n < 431:
# TESTDUMMY deployment: 144 blocks active, 144 blocks locked in
assert_equal (decode["versionHex"], "30000000")
# TESTDUMMY and DYNAFED deployment: 144 blocks active, 144 blocks locked in
assert_equal (decode["versionHex"], "32000000")
else:
assert_equal (decode["versionHex"], "20000000")

Expand All @@ -52,38 +53,38 @@ def test_activation(self, rpc, activation_height):
blocks = self.generatetoaddress(rpc, 127, rpc.getnewaddress())
for n, block in enumerate(blocks):
decode = rpc.getblockheader(block)
assert_equal (decode["versionHex"], "21000000")
assert_equal (decode["versionHex"], "20200000")
assert_equal(rpc.getdeploymentinfo()["deployments"]["simplicity"]["bip9"]["status"], "started")

# Fail to signal on the 128th block. Since the threshold for Simplicity is
# 100% this will prevent activation. Note that our period is 128, not
# 144 (the default), as we have overridden the period for Simplicity. On
# the main Liquid chain it is overridden to be one week of signalling.
block = rpc.getnewblockhex()
block = block[:7] + "0" + block[8:] # turn off Simplicity signal
block = block[:4] + "0" + block[5:] # turn off Simplicity signal
rpc.submitblock(block)
assert_equal(rpc.getdeploymentinfo()["deployments"]["simplicity"]["bip9"]["status"], "started")

# Run through another 128 blocks, without failing to signal
blocks = self.generatetoaddress(rpc, 127, rpc.getnewaddress())
for n, block in enumerate(blocks):
decode = rpc.getblockheader(block)
assert_equal (decode["versionHex"], "21000000")
assert_equal (decode["versionHex"], "20200000")
assert_equal(rpc.getdeploymentinfo()["deployments"]["simplicity"]["bip9"]["status"], "started")
# The 128th block then switches from "started" to "locked_in"
blocks = self.generatetoaddress(rpc, 1, rpc.getnewaddress())
assert_equal(rpc.getdeploymentinfo()["deployments"]["simplicity"]["bip9"]["status"], "started")
assert_equal(rpc.getdeploymentinfo()["deployments"]["simplicity"]["bip9"]["status_next"], "locked_in")
assert_equal(rpc.getblockheader(blocks[0])["versionHex"], "21000000")
assert_equal(rpc.getblockheader(blocks[0])["versionHex"], "20200000")

# Run through another 128 blocks, which will go from "locked in" to "active" regardless of signalling
blocks = self.generatetoaddress(rpc, 127, rpc.getnewaddress())
for n, block in enumerate(blocks):
decode = rpc.getblockheader(block)
assert_equal (decode["versionHex"], "21000000")
assert_equal (decode["versionHex"], "20200000")
assert_equal(rpc.getdeploymentinfo()["deployments"]["simplicity"]["bip9"]["status"], "locked_in")
block = rpc.getnewblockhex()
block = block[:7] + "0" + block[8:] # turn off Simplicity signal
block = block[:4] + "0" + block[5:] # turn off Simplicity signal
rpc.submitblock(block)
assert_equal(rpc.getdeploymentinfo()["deployments"]["simplicity"]["bip9"]["status"], "locked_in")
assert_equal(rpc.getdeploymentinfo()["deployments"]["simplicity"]["bip9"]["status_next"], "active")
Expand All @@ -103,15 +104,15 @@ def run_test(self):
if n < 143:
assert_equal (decode["versionHex"], "20000000")
elif n < 431:
# TESTDUMMY deployment: 144 blocks active, 144 blocks locked in
assert_equal (decode["versionHex"], "30000000")
# TESTDUMMY and DYNAFED deployment: 144 blocks active, 144 blocks locked in
assert_equal (decode["versionHex"], "32000000")
else:
assert_equal (decode["versionHex"], "20000000")

# Test activation starting from height 1000
# Note that for Simplicity this is an illogical combination (Simplicity without
# Taproot) but for purposes of this test it's fine.
self.restart_node(0, ["-evbparams=simplicity:500:::"])
self.restart_node(0, ["-evbparams=dynafed:0:::", "-evbparams=simplicity:500:::"])
self.nodes[0].invalidateblock(self.nodes[0].getblockhash(1))
self.test_activation(self.nodes[0], 500)

Expand Down
1 change: 1 addition & 0 deletions test/functional/mempool_accept.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def set_test_params(self):
'-txindex',
'-txindex','-permitbaremultisig=0',
'-multi_data_permitted=1', # Elements test
'-dustrelayfee=0.00003000', # ELEMENTS: use the Bitcoin default dust relay fee rate
]] * self.num_nodes
self.supports_cli = False

Expand Down
1 change: 1 addition & 0 deletions test/functional/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
'wallet_elements_regression_1172.py --legacy-wallet',
'wallet_elements_regression_1259.py --legacy-wallet',
'wallet_elements_21million.py',
'wallet_elements_dust_relay.py',
'feature_trim_headers.py',
# Longest test should go first, to favor running tests in parallel
'wallet_hd.py --legacy-wallet',
Expand Down
Loading