Skip to content

Commit

Permalink
Merge pull request #1215 from psgreco/elements-22_1_1_rc1
Browse files Browse the repository at this point in the history
elements-22.1.1-rc1
  • Loading branch information
jamesdorfman authored Feb 28, 2023
2 parents 5548997 + d45c79e commit eb83661
Show file tree
Hide file tree
Showing 34 changed files with 582 additions and 169 deletions.
2 changes: 2 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ task:

task:
name: 'macOS 11 native [gui] [no depends]'
# Intel macos is not supported anymore by cirrus, and elements doesn't build for arm64 yet
only_if: false
brew_install_script:
- brew install boost libevent berkeley-db4 qt@5 miniupnpc libnatpmp ccache zeromq qrencode sqlite libtool automake pkg-config gnu-getopt
<< : *GLOBAL_TASK_TEMPLATE
Expand Down
6 changes: 3 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
AC_PREREQ([2.69])
define(_CLIENT_VERSION_MAJOR, 22)
define(_CLIENT_VERSION_MINOR, 1)
define(_CLIENT_VERSION_BUILD, 0)
define(_CLIENT_VERSION_RC, 0)
define(_CLIENT_VERSION_BUILD, 1)
define(_CLIENT_VERSION_RC, 1)
define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2022)
define(_COPYRIGHT_YEAR, 2023)
define(_COPYRIGHT_HOLDERS,[The %s developers])
define(_COPYRIGHT_HOLDERS_SUBSTITUTION,[[Elements Project]])
AC_INIT([Elements Core],m4_join([.], _CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MINOR, _CLIENT_VERSION_BUILD)m4_if(_CLIENT_VERSION_RC, [0], [], [rc]_CLIENT_VERSION_RC),[https://github.com/ElementsProject/elements/issues],[elements],[https://elementsproject.org/])
Expand Down
229 changes: 162 additions & 67 deletions contrib/review-prs.py

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions doc/man/elements-cli.1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.2.
.TH ELEMENTS-CLI "1" "December 2022" "elements-cli v22.1.0" "User Commands"
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3.
.TH ELEMENTS-CLI "1" "February 2023" "elements-cli v22.1.1" "User Commands"
.SH NAME
elements-cli \- manual page for elements-cli v22.1.0
elements-cli \- manual page for elements-cli v22.1.1
.SH SYNOPSIS
.B elements-cli
[\fI\,options\/\fR] \fI\,<command> \/\fR[\fI\,params\/\fR] \fI\,Send command to Elements Core\/\fR
Expand All @@ -15,7 +15,7 @@ elements-cli \- manual page for elements-cli v22.1.0
.B elements-cli
[\fI\,options\/\fR] \fI\,help <command> Get help for a command\/\fR
.SH DESCRIPTION
Elements Core RPC client version v22.1.0
Elements Core RPC client version v22.1.1
.SH OPTIONS
.HP
\-?
Expand Down
15 changes: 11 additions & 4 deletions doc/man/elements-qt.1
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.2.
.TH ELEMENTS-QT "1" "December 2022" "elements-qt v22.1.0" "User Commands"
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3.
.TH ELEMENTS-QT "1" "February 2023" "elements-qt v22.1.1" "User Commands"
.SH NAME
elements-qt \- manual page for elements-qt v22.1.0
elements-qt \- manual page for elements-qt v22.1.1
.SH SYNOPSIS
.B elements-qt
[\fI\,command-line options\/\fR]
.SH DESCRIPTION
Elements Core version v22.1.0
Elements Core version v22.1.1
.SH OPTIONS
.HP
\-?
Expand Down Expand Up @@ -166,6 +166,13 @@ Execute command on startup.
Create new files with system default permissions, instead of umask 077
(only effective with disabled wallet functionality)
.HP
\fB\-trim_headers\fR
.IP
Trim old headers in memory (by default older than 2 epochs), removing
blocksigning and dynafed\-related fields. Saves memory, but blocks
us from serving blocks or headers to peers, and removes trimmed
fields from some JSON RPC outputs. (default: false)
.HP
\fB\-txindex\fR
.IP
Maintain a full transaction index, used by the getrawtransaction rpc
Expand Down
8 changes: 4 additions & 4 deletions doc/man/elements-tx.1
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.2.
.TH ELEMENTS-TX "1" "December 2022" "elements-tx v22.1.0" "User Commands"
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3.
.TH ELEMENTS-TX "1" "February 2023" "elements-tx v22.1.1" "User Commands"
.SH NAME
elements-tx \- manual page for elements-tx v22.1.0
elements-tx \- manual page for elements-tx v22.1.1
.SH SYNOPSIS
.B elements-tx
[\fI\,options\/\fR] \fI\,<hex-tx> \/\fR[\fI\,commands\/\fR] \fI\,Update hex-encoded Elements transaction\/\fR
.br
.B elements-tx
[\fI\,options\/\fR] \fI\,-create \/\fR[\fI\,commands\/\fR] \fI\,Create hex-encoded Elements transaction\/\fR
.SH DESCRIPTION
Elements Core elements\-tx utility version v22.1.0
Elements Core elements\-tx utility version v22.1.1
.SH OPTIONS
.HP
\-?
Expand Down
8 changes: 4 additions & 4 deletions doc/man/elements-util.1
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.2.
.TH ELEMENTS-UTIL "1" "December 2022" "elements-util v22.1.0" "User Commands"
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3.
.TH ELEMENTS-UTIL "1" "February 2023" "elements-util v22.1.1" "User Commands"
.SH NAME
elements-util \- manual page for elements-util v22.1.0
elements-util \- manual page for elements-util v22.1.1
.SH SYNOPSIS
.B elements-util
[\fI\,options\/\fR] [\fI\,commands\/\fR] \fI\,Do stuff\/\fR
.SH DESCRIPTION
Elements Core elements\-util utility version v22.1.0
Elements Core elements\-util utility version v22.1.1
.SH OPTIONS
.HP
\-?
Expand Down
8 changes: 4 additions & 4 deletions doc/man/elements-wallet.1
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.2.
.TH ELEMENTS-WALLET "1" "December 2022" "elements-wallet v22.1.0" "User Commands"
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3.
.TH ELEMENTS-WALLET "1" "February 2023" "elements-wallet v22.1.1" "User Commands"
.SH NAME
elements-wallet \- manual page for elements-wallet v22.1.0
elements-wallet \- manual page for elements-wallet v22.1.1
.SH DESCRIPTION
Elements Core elements\-wallet version v22.1.0
Elements Core elements\-wallet version v22.1.1
.PP
elements\-wallet is an offline tool for creating and interacting with Elements Core wallet files.
By default elements\-wallet will act on wallets in the default mainnet wallet directory in the datadir.
Expand Down
15 changes: 11 additions & 4 deletions doc/man/elementsd.1
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.2.
.TH ELEMENTSD "1" "December 2022" "elementsd v22.1.0" "User Commands"
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3.
.TH ELEMENTSD "1" "February 2023" "elementsd v22.1.1" "User Commands"
.SH NAME
elementsd \- manual page for elementsd v22.1.0
elementsd \- manual page for elementsd v22.1.1
.SH SYNOPSIS
.B elementsd
[\fI\,options\/\fR] \fI\,Start Elements Core\/\fR
.SH DESCRIPTION
Elements Core version v22.1.0
Elements Core version v22.1.1
Copyright \(co 2009\-2022 The Elements Project developers
Copyright \(co 2009\-2022 The Bitcoin Core developers
.PP
Expand Down Expand Up @@ -177,6 +177,13 @@ Execute command on startup.
Create new files with system default permissions, instead of umask 077
(only effective with disabled wallet functionality)
.HP
\fB\-trim_headers\fR
.IP
Trim old headers in memory (by default older than 2 epochs), removing
blocksigning and dynafed\-related fields. Saves memory, but blocks
us from serving blocks or headers to peers, and removes trimmed
fields from some JSON RPC outputs. (default: false)
.HP
\fB\-txindex\fR
.IP
Maintain a full transaction index, used by the getrawtransaction rpc
Expand Down
2 changes: 1 addition & 1 deletion src/block_proof.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
bool CheckChallenge(const CBlockHeader& block, const CBlockIndex& indexLast, const Consensus::Params& params)
{
if (g_signed_blocks) {
return block.proof.challenge == indexLast.proof.challenge;
return block.proof.challenge == indexLast.get_proof().challenge;
} else {
return block.nBits == GetNextWorkRequired(&indexLast, &block, params);
}
Expand Down
79 changes: 64 additions & 15 deletions src/chain.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,51 @@ class CBlockIndex
uint32_t nTime{0};
uint32_t nBits{0};
uint32_t nNonce{0};
CProof proof{};

protected:
std::optional<CProof> proof{};
// Dynamic federation fields
DynaFedParams dynafed_params{};
CScriptWitness m_signblock_witness{};
std::optional<DynaFedParams> m_dynafed_params{};
std::optional<CScriptWitness> m_signblock_witness{};

bool m_trimmed{false};

friend class CBlockTreeDB;

public:

// Irrevocably remove blocksigning and dynafed-related stuff from this
// in-memory copy of the block header.
void trim() {
assert_untrimmed();
m_trimmed = true;
proof = std::nullopt;
m_dynafed_params = std::nullopt;
m_signblock_witness = std::nullopt;
}

bool trimmed() const {
return m_trimmed;
}

void assert_untrimmed() const {
assert(!m_trimmed);
}

const CProof& get_proof() const {
assert_untrimmed();
return proof.value();
}

const DynaFedParams& dynafed_params() const {
assert_untrimmed();
return m_dynafed_params.value();
}

const CScriptWitness& signblock_witness() const {
assert_untrimmed();
return m_signblock_witness.value();
}

//! (memory only) Sequential id assigned to distinguish order in which blocks are received.
int32_t nSequenceId{0};
Expand All @@ -214,7 +255,7 @@ class CBlockIndex
nBits{block.nBits},
nNonce{block.nNonce},
proof{block.proof},
dynafed_params{block.m_dynafed_params},
m_dynafed_params{block.m_dynafed_params},
m_signblock_witness{block.m_signblock_witness}
{
}
Expand All @@ -239,6 +280,7 @@ class CBlockIndex

CBlockHeader GetBlockHeader() const
{
assert_untrimmed();
CBlockHeader block;
block.nVersion = nVersion;
if (pprev)
Expand All @@ -250,9 +292,9 @@ class CBlockIndex
}
block.nBits = nBits;
block.nNonce = nNonce;
block.proof = proof;
block.m_dynafed_params = dynafed_params;
block.m_signblock_witness = m_signblock_witness;
block.proof = proof.value();
block.m_dynafed_params = m_dynafed_params.value();
block.m_signblock_witness = m_signblock_witness.value();
return block;
}

Expand Down Expand Up @@ -366,12 +408,12 @@ class CDiskBlockIndex : public CBlockIndex
nVersion = ~CBlockHeader::DYNAFED_HF_MASK & nVersion;
return is_dyna;
} else {
return !dynafed_params.IsNull();
return !dynafed_params().IsNull();
}
}
bool RemoveDynaFedMaskOnSerialize(bool for_read) const {
assert(!for_read);
return !dynafed_params.IsNull();
return !dynafed_params().IsNull();
}

SERIALIZE_METHODS(CDiskBlockIndex, obj)
Expand All @@ -394,7 +436,7 @@ class CDiskBlockIndex : public CBlockIndex
READWRITE(obj.nVersion);
} else {
int32_t nVersion = obj.nVersion;
if (!obj.dynafed_params.IsNull()) {
if (!obj.dynafed_params().IsNull()) {
nVersion |= CBlockHeader::DYNAFED_HF_MASK;
}
READWRITE(nVersion);
Expand All @@ -404,13 +446,19 @@ class CDiskBlockIndex : public CBlockIndex
READWRITE(obj.hashPrev);
READWRITE(obj.hashMerkleRoot);
READWRITE(obj.nTime);

// Allocate objects in the optional<> fields when reading, since READWRITE will not do this
SER_READ(obj, obj.m_dynafed_params = DynaFedParams());
SER_READ(obj, obj.m_signblock_witness = CScriptWitness());
SER_READ(obj, obj.proof = CProof());

// For compatibility with elements 0.14 based chains
if (g_signed_blocks) {
if (is_dyna) {
READWRITE(obj.dynafed_params);
READWRITE(obj.m_signblock_witness.stack);
READWRITE(obj.m_dynafed_params.value());
READWRITE(obj.m_signblock_witness.value().stack);
} else {
READWRITE(obj.proof);
READWRITE(obj.proof.value());
}
} else {
READWRITE(obj.nBits);
Expand All @@ -420,6 +468,7 @@ class CDiskBlockIndex : public CBlockIndex

uint256 GetBlockHash() const
{
assert_untrimmed();
CBlockHeader block;
block.nVersion = nVersion;
block.hashPrevBlock = hashPrev;
Expand All @@ -430,8 +479,8 @@ class CDiskBlockIndex : public CBlockIndex
}
block.nBits = nBits;
block.nNonce = nNonce;
block.proof = proof;
block.m_dynafed_params = dynafed_params;
block.proof = proof.value();
block.m_dynafed_params = m_dynafed_params.value();
return block.GetHash();
}

Expand Down
2 changes: 2 additions & 0 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,7 @@ class CCustomParams : public CRegTestParams {

const CScript default_script(CScript() << OP_TRUE);
consensus.fedpegScript = StrHexToScriptWithDefault(args.GetArg("-fedpegscript", ""), default_script);
consensus.start_p2wsh_script = args.GetArg("-con_start_p2wsh_script", consensus.start_p2wsh_script);

// Calculate pegged Bitcoin asset
std::vector<unsigned char> commit = CommitToArguments(consensus, strNetworkID);
Expand Down Expand Up @@ -1460,6 +1461,7 @@ class CLiquidV1TestParams : public CLiquidV1Params {
if (args.IsArgSet("-fedpegscript")) {
consensus.fedpegScript = StrHexToScriptWithDefault(args.GetArg("-fedpegscript", ""), CScript());
}
consensus.start_p2wsh_script = args.GetArg("-con_start_p2wsh_script", consensus.start_p2wsh_script);

consensus.total_valid_epochs = args.GetArg("-total_valid_epochs", consensus.total_valid_epochs);

Expand Down
1 change: 1 addition & 0 deletions src/chainparamsbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ void SetupChainParamsBaseOptions(ArgsManager& argsman)
argsman.AddArg("-dynamic_epoch_length", "Per-chain parameter that sets how many blocks dynamic federation voting and enforcement are in effect for.", ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS);
argsman.AddArg("-total_valid_epochs", "Per-chain parameter that sets how long a particular fedpegscript is in effect for.", ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS);
argsman.AddArg("-evbparams=deployment:start:end:period:threshold", "Use given start/end times for specified version bits deployment (regtest or custom only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::ELEMENTS);
argsman.AddArg("-con_start_p2wsh_script", "Create p2wsh addresses when starting in dynafed mode (regtest or custom only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::ELEMENTS);
// END ELEMENTS
//
}
Expand Down
1 change: 1 addition & 0 deletions src/consensus/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ struct Params {
// default 1 to not break legacy chains implicitly.
size_t total_valid_epochs = 1;
bool elements_mode = false;
bool start_p2wsh_script = false;
};

} // namespace Consensus
Expand Down
Loading

0 comments on commit eb83661

Please sign in to comment.