Skip to content

Commit 85f07f1

Browse files
authored
Merge pull request #2665 from blockstack/develop
Release 2.0.11.1.0
2 parents 08c4b9d + ddc0a29 commit 85f07f1

File tree

150 files changed

+6370
-4940
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

150 files changed

+6370
-4940
lines changed

CHANGELOG.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,38 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to the versioning scheme outlined in the [README.md](README.md).
77

8+
## [2.0.11.1.0]
9+
10+
This software update is our monthly release. It introduces fixes and features for both developers and miners.
11+
This release's chainstate directory is compatible with chainstate directories from 2.0.11.0.0.
12+
13+
## Added
14+
15+
- `/new_microblock` endpoint to notify event observers when a valid microblock
16+
has been received (#2571).
17+
- Added new features to `clarity-cli` (#2597)
18+
- Exposing new mining-related metrics in prometheus (#2664)
19+
- Miner's computed relative miner score as a percentage
20+
- Miner's computed commitment, the min of their previous commitment and their median commitment
21+
- Miner's current median commitment
22+
- Add `key-for-seed` command to the `stacks-node` binary - outputs the associated secret key hex string
23+
and WIF formatted secret key for a given "seed" value (#2658).
24+
25+
## Changed
26+
27+
- Improved mempool walk order (#2514).
28+
- Renamed database `tx_tracking.db` to `tx_tracking.sqlite` (#2666).
29+
30+
## Fixed
31+
32+
- Alter the miner to prioritize spending the most recent UTXO when building a transaction,
33+
instead of the largest UTXO. In the event of a tie, it uses the smallest UTXO first (#2661).
34+
- Fix trait rpc lookups for implicitly implemented traits (#2602).
35+
- Fix `v2/pox` endpoint, broken on Mocknet (#2634).
36+
- Align cost limits on mocknet, testnet and mainnet (#2660).
37+
- Log peer addresses in the HTTP server (#2667)
38+
- Mine microblocks if there are no recent unprocessed Stacks blocks
39+
840
## [2.0.11.0.0]
941

1042
The chainstate directory has been restructured in this release. It is not

benches/block_limits.rs

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,26 @@ extern crate blockstack_lib;
22
extern crate rand;
33
extern crate serde_json;
44

5+
use std::fs;
6+
use std::process;
7+
use std::{env, time::Instant};
8+
9+
use rand::Rng;
10+
11+
use blockstack_lib::clarity_vm::database::marf::MarfedKV;
12+
use blockstack_lib::types::chainstate::{StacksAddress, StacksBlockId};
13+
use blockstack_lib::types::{BlockHeaderHash, BurnchainHeaderHash, VRFSeed};
14+
use blockstack_lib::util::boot::boot_code_id;
515
use blockstack_lib::{
6-
burnchains::BurnchainHeaderHash,
7-
chainstate::{
8-
self,
9-
burn::BlockHeaderHash,
10-
stacks::{index::MarfTrieId, StacksBlockId},
11-
},
16+
chainstate::{self, stacks::index::MarfTrieId},
1217
vm::clarity::ClarityInstance,
1318
vm::costs::ExecutionCost,
14-
vm::database::MarfedKV,
1519
vm::{
1620
database::{HeadersDB, NULL_BURN_STATE_DB},
1721
types::{PrincipalData, QualifiedContractIdentifier, StandardPrincipalData},
1822
Value,
1923
},
2024
};
21-
use chainstate::{
22-
burn::VRFSeed,
23-
stacks::{boot::boot_code_id, StacksAddress},
24-
};
25-
26-
use std::fs;
27-
use std::process;
28-
use std::{env, time::Instant};
29-
30-
use rand::Rng;
3125

3226
struct TestHeadersDB;
3327

benches/large_contract_bench.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,12 @@ extern crate criterion;
33
extern crate blockstack_lib;
44
extern crate rand;
55

6+
use blockstack_lib::clarity_vm::database::marf::MarfedKV;
7+
use blockstack_lib::types::BlockHeaderHash;
68
use blockstack_lib::{
7-
chainstate::burn::BlockHeaderHash,
8-
chainstate::stacks::index::storage::TrieFileStorage,
9-
vm::clarity::ClarityInstance,
10-
vm::database::{MarfedKV, NULL_HEADER_DB},
11-
vm::types::QualifiedContractIdentifier,
9+
chainstate::stacks::index::storage::TrieFileStorage, vm::clarity::ClarityInstance,
10+
vm::database::NULL_HEADER_DB, vm::types::QualifiedContractIdentifier,
1211
};
13-
1412
use criterion::Criterion;
1513

1614
pub fn rollback_log_memory_test() {

benches/marf_bench.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ extern crate criterion;
33
extern crate blockstack_lib;
44
extern crate rand;
55

6-
use blockstack_lib::chainstate::burn::BlockHeaderHash;
7-
use blockstack_lib::chainstate::stacks::index::{marf::MARF, storage::TrieFileStorage, MARFValue};
6+
use std::fs;
87

9-
use criterion::Criterion;
108
use rand::prelude::*;
11-
use std::fs;
9+
10+
use blockstack_lib::chainstate::stacks::index::{marf::MARF, storage::TrieFileStorage};
11+
use blockstack_lib::types::chainstate::MARFValue;
12+
use blockstack_lib::types::BlockHeaderHash;
13+
use criterion::Criterion;
1214

1315
fn benchmark_marf_usage(
1416
filename: &str,

net-test/tests/test_2_nat_miners_microblocks.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,9 @@ with_miner_1
8282
RC=$?
8383
if [ $RC -ne 0 ]; then
8484
logln "Failed to make a token transfer to $STX_DEST_ADDR at attempt $i: rc $RC"
85-
DONE=1
86-
break
85+
86+
# keep trying
87+
continue
8788
fi
8889

8990
TXID="$(echo "$TX" | send_tx "http://localhost:21443")"

net-test/tests/testlib.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,19 +195,21 @@ easy_token_transfer() {
195195
local ADDR="$(blockstack-cli --testnet addresses "$PRIVKEY" | jq -r '.STX')"
196196
local NONCE="$(get_unconfirmed_account_nonce "$STACKS_NODE_URL" "$ADDR")"
197197
local RC=$?
198-
if [ $RC -ne 0 ]; then
199-
logln "Failed to query unconfirmed account nonce: rc $RC"
198+
if [ $RC -ne 0 ] || [ -z "$NONCE" ]; then
199+
logln "Failed to query unconfirmed account nonce: rc '$RC' nonce '$NONCE'"
200200
return 1
201201
fi
202202

203203
local MEMO="test $NONCE"
204+
logln "blockstack-cli --testnet token-transfer '$PRIVKEY' '$FEE_RATE' '$NONCE' '$DEST' '$AMOUNT' '$MEMO' '$OPTS'"
204205
local TX="$(blockstack-cli --testnet token-transfer "$PRIVKEY" "$FEE_RATE" "$NONCE" "$DEST" "$AMOUNT" "$MEMO" "$OPTS" 2>&1)"
205206
RC=$?
206207
if [ $RC -ne 0 ]; then
207208
logln "Failed to generate tx: blockstack-cli --testnet token-transfer $PRIVKEY $FEE_RATE $NONCE $DEST $AMOUNT \"$MEMO\""
208209
return 1
209210
fi
210211

212+
logln "Generated tx: $TX"
211213
printf "$TX"
212214
return 0
213215
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
(begin
2+
(as-contract
3+
(contract-call? 'S1G2081040G2081040G2081040G208105NK8PE5.tokens-ft mint! u100)
4+
)
5+
)

sample-contracts/tokens-ft.clar

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
(define-fungible-token tokens)
2+
(define-private (get-balance (account principal))
3+
(ft-get-balance tokens account))
4+
5+
(define-private (token-credit! (account principal) (amount uint))
6+
(ft-mint? tokens amount account))
7+
8+
(define-public (token-transfer (to principal) (amount uint))
9+
(ft-transfer? tokens amount tx-sender to))
10+
11+
(define-public (mint! (amount uint))
12+
(token-credit! tx-sender amount))
13+
14+
(token-credit! tx-sender u10300)
15+
(token-transfer 'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR u10000)
16+
(token-transfer 'SM2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQVX8X0G u300)

sample-contracts/tokens-mint.clar

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
(as-contract
33
(contract-call? 'S1G2081040G2081040G2081040G208105NK8PE5.tokens mint! u100)
44
)
5-
)
5+
)

src/blockstack_cli.rs

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,28 @@
2121

2222
extern crate blockstack_lib;
2323

24+
use std::convert::TryFrom;
25+
use std::io::prelude::*;
26+
use std::io::Read;
27+
use std::{env, fs, io};
28+
29+
use blockstack_lib::address::b58;
2430
use blockstack_lib::address::AddressHashMode;
31+
use blockstack_lib::burnchains::bitcoin::address::{
32+
ADDRESS_VERSION_MAINNET_SINGLESIG, ADDRESS_VERSION_TESTNET_SINGLESIG,
33+
};
2534
use blockstack_lib::burnchains::Address;
2635
use blockstack_lib::chainstate::stacks::{
27-
StacksAddress, StacksBlock, StacksMicroblock, StacksPrivateKey, StacksPublicKey,
28-
StacksTransaction, StacksTransactionSigner, TokenTransferMemo, TransactionAnchorMode,
29-
TransactionAuth, TransactionContractCall, TransactionPayload, TransactionSmartContract,
36+
StacksBlock, StacksMicroblock, StacksPrivateKey, StacksPublicKey, StacksTransaction,
37+
StacksTransactionSigner, TokenTransferMemo, TransactionAnchorMode, TransactionAuth,
38+
TransactionContractCall, TransactionPayload, TransactionSmartContract,
3039
TransactionSpendingCondition, TransactionVersion, C32_ADDRESS_VERSION_MAINNET_SINGLESIG,
3140
C32_ADDRESS_VERSION_TESTNET_SINGLESIG,
3241
};
42+
use blockstack_lib::codec::{Error as CodecError, StacksMessageCodec};
3343
use blockstack_lib::core::{CHAIN_ID_MAINNET, CHAIN_ID_TESTNET};
34-
use blockstack_lib::net::{Error as NetError, StacksMessageCodec};
44+
use blockstack_lib::net::Error as NetError;
45+
use blockstack_lib::types::chainstate::StacksAddress;
3546
use blockstack_lib::util::{
3647
hash::hex_bytes, hash::to_hex, log, retry::LogReader, strings::StacksString,
3748
};
@@ -41,15 +52,6 @@ use blockstack_lib::vm::{
4152
types::PrincipalData,
4253
ClarityName, ContractName, Value,
4354
};
44-
use std::convert::TryFrom;
45-
use std::io::prelude::*;
46-
use std::io::Read;
47-
use std::{env, fs, io};
48-
49-
use blockstack_lib::address::b58;
50-
use blockstack_lib::burnchains::bitcoin::address::{
51-
ADDRESS_VERSION_MAINNET_SINGLESIG, ADDRESS_VERSION_TESTNET_SINGLESIG,
52-
};
5355

5456
const USAGE: &str = "blockstack-cli (options) [method] [args...]
5557
@@ -215,6 +217,12 @@ impl From<NetError> for CliError {
215217
}
216218
}
217219

220+
impl From<CodecError> for CliError {
221+
fn from(value: CodecError) -> Self {
222+
CliError::Message(format!("Stacks CodecError: {}", value))
223+
}
224+
}
225+
218226
impl From<std::num::ParseIntError> for CliError {
219227
fn from(value: std::num::ParseIntError) -> Self {
220228
CliError::Message(format!("Failed to parse integer: {}", value))
@@ -779,6 +787,7 @@ fn main_handler(mut argv: Vec<String>) -> Result<String, CliError> {
779787
#[cfg(test)]
780788
mod test {
781789
use super::*;
790+
782791
#[test]
783792
fn generate_should_work() {
784793
assert!(main_handler(vec!["generate-sk".into(), "--testnet".into()]).is_ok());

0 commit comments

Comments
 (0)