Skip to content
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

Feat/native segwit #3283

Merged
merged 105 commits into from
Nov 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
96d01fc
feat: vendor bech32 and bech32m encoding logic
jcnelson Sep 8, 2022
26d2d0d
feat: document new pox-addr tuple versions and types
jcnelson Sep 8, 2022
cd1372b
feat: get-burn-block-info pox-addrs returns a tuple with a buff 32
jcnelson Sep 8, 2022
8de6bbe
feat: turn BitcoinAddress into an enum with a legacy variant and a se…
jcnelson Sep 8, 2022
3d85d35
feat: differentiate between "structured" and "raw" bitcoin inputs -- …
jcnelson Sep 8, 2022
999152b
feat: update the bitcoin block parser to epoch-gate logic that will, …
jcnelson Sep 8, 2022
44e8856
chore: BitcoinTxInput is now an enum containing either a structured (…
jcnelson Sep 8, 2022
23601f1
refactor: BurnchainSigner no longer represents any structure data; it…
jcnelson Sep 8, 2022
371dadb
chore: API sync
jcnelson Sep 8, 2022
2cac91c
chore: API sync -- block parser needs an epoch ID
jcnelson Sep 8, 2022
90535c7
refactor: remove functionality for getting the "signer" of a transact…
jcnelson Sep 8, 2022
e5ecb70
refactor: BurnchainSigner doesn't do anything anymore
jcnelson Sep 8, 2022
ed27ea2
refactor: BurnchainSigner doesn't do anything anymore, and leader key…
jcnelson Sep 8, 2022
3552be2
chore: update prometheus on the burn sample
jcnelson Sep 8, 2022
cca6f56
chore: seprate prometheus logging from burn sample calculation
jcnelson Sep 8, 2022
5048a2e
chore: apparent_sender is just a string representation of the change …
jcnelson Sep 8, 2022
1380d90
feat: leader key register txs don't need an identifyin address -- it'…
jcnelson Sep 8, 2022
ec57f6d
feat: remove `address` from `LeaderKeyRegisterOp`
jcnelson Sep 8, 2022
2bb5ac4
chore: can't get the signers directly anymore, so just use the quanti…
jcnelson Sep 8, 2022
0800f11
chore: can't use the signers anymore, so use the quantity of inputs (…
jcnelson Sep 8, 2022
045ad7b
chore: can't use tx signers anymore; need to look at just the quantity
jcnelson Sep 8, 2022
35b2f8b
chore: API sync
jcnelson Sep 8, 2022
a099b08
chore: API sync
jcnelson Sep 8, 2022
1ce6572
chore: API sync
jcnelson Sep 8, 2022
a6a7d00
feat: PoxAddress now has variants for 20-byte and 32-byte addresses, …
jcnelson Sep 8, 2022
62c4fff
chore: API sync
jcnelson Sep 8, 2022
b09d4a5
chore: API sync; direct PoX 2 lockup code for testing segwit addresses
jcnelson Sep 8, 2022
f0e2dbb
feat: pox-addr now takes a 32-byte buff, and now supports p2wpkh, p2w…
jcnelson Sep 8, 2022
54c1524
feat: test that we can stack with segwit addresses
jcnelson Sep 8, 2022
3881458
chore: API sync
jcnelson Sep 8, 2022
306eb2c
chore: import cleanup
jcnelson Sep 8, 2022
bd9bf48
chore: cargo fmt
jcnelson Sep 8, 2022
91d0e68
chore: import cleanup
jcnelson Sep 8, 2022
be930c4
chore: import cleanup
jcnelson Sep 8, 2022
7324ac5
docs: document purpose of AddressHashMode (w.r.t. segwit)
jcnelson Sep 8, 2022
435a50e
feat: implement enough of the sighash algorithm for segwit that we ca…
jcnelson Sep 8, 2022
7b3dd80
feat: add from_hex_le() for instantiating byte arrays from little-end…
jcnelson Sep 8, 2022
a92f97e
chore: export bech32
jcnelson Sep 8, 2022
522c074
chore: expand derives for u8 enums created by macro
jcnelson Sep 8, 2022
33b79d0
refactor: consolidate to_hex()
jcnelson Sep 8, 2022
b81a70e
feat: implement epoch-gated mining using a segwit p2wpkh input and ou…
jcnelson Sep 8, 2022
e6bdf83
chore: API sync
jcnelson Sep 8, 2022
53070ce
feat: submit_operation() returns the txid
jcnelson Sep 8, 2022
8c35141
chore: miner.segwit is now a supported field -- if true, the node wil…
jcnelson Sep 8, 2022
8ad2168
feat: scrub the use of BurnchainSigner to represent address informati…
jcnelson Sep 8, 2022
2d1885c
refactor: track pending leader key register txs by txid and block hei…
jcnelson Sep 8, 2022
7fbcf02
refactor: track key registration with txid, not BurnchainSigner
jcnelson Sep 8, 2022
39ff1a4
feat: determine if a node is a miner by also checking its segwit addr…
jcnelson Sep 8, 2022
22b580a
chore: API sync
jcnelson Sep 8, 2022
8f00f61
feat: test that we can stack to segwit addresses and query them with …
jcnelson Sep 8, 2022
a13c5bc
chore: API sync
jcnelson Sep 8, 2022
1c3af5e
Merge branch 'feat/pox-2-unlock' into feat/native-segwit
jcnelson Sep 8, 2022
541f598
Merge branch 'next' into feat/native-segwit
jcnelson Sep 8, 2022
7f144cd
fix: fix compile-time bugs in non-test variants of a couple functions
jcnelson Sep 8, 2022
423c548
Merge branch 'feat/native-segwit' of https://github.com/stacks-networ…
jcnelson Sep 8, 2022
629cc24
chore: run mine-from-segwit test
jcnelson Sep 8, 2022
4b18100
fix: p2tr hex begins with 0x51
jcnelson Sep 9, 2022
54d7f89
chore: cargo fmt
jcnelson Sep 9, 2022
680a028
fix: broken testcase had the wrong burn median
jcnelson Sep 9, 2022
8b8becb
fix: broken testcase had the wrong BurnchainSigner
jcnelson Sep 9, 2022
be58712
fix: logic error -- output 0 must be a burn address
jcnelson Sep 9, 2022
217aaec
fix: in the clarity sim environment, we have to instantiate pox-2 exp…
jcnelson Sep 9, 2022
eaf990e
fix: use txid from payload instead of deterministically-generated one…
jcnelson Sep 9, 2022
d9eeeb5
fix: fix bech32 doc test
jcnelson Sep 9, 2022
306a06b
fix: fix failing integration test by remembering an old chain tip acr…
jcnelson Sep 10, 2022
0ddd7b9
Merge branch 'next' into feat/native-segwit
jcnelson Sep 13, 2022
b631b3d
Merge branch 'next' into feat/native-segwit
jcnelson Sep 15, 2022
d327077
Merge branch 'next' into feat/native-segwit
jcnelson Sep 27, 2022
394c306
Merge branch 'next' into feat/native-segwit
jcnelson Oct 18, 2022
0f8d3de
chore: remove warning
jcnelson Oct 18, 2022
0be152a
feat: add PoxAddress::from_legacy() test helper
jcnelson Oct 18, 2022
3063f30
fix: buff 32 for address hash bytes
jcnelson Oct 18, 2022
8c843dd
chore: API sync
jcnelson Oct 18, 2022
0ba3594
Merge branch 'next' into feat/native-segwit
jcnelson Oct 18, 2022
6782f4f
Merge branch 'next' into feat/native-segwit
jcnelson Nov 1, 2022
e0bfc57
Merge branch 'next' into feat/native-segwit
jcnelson Nov 1, 2022
3982642
fix: merge artifacts
jcnelson Nov 1, 2022
4669a85
fix: no need for address argument in get_utxos()
jcnelson Nov 1, 2022
ae69290
fix: remove unused var
jcnelson Nov 1, 2022
282c4fd
fix: API sync
jcnelson Nov 1, 2022
d383f7e
fix: remove warnings
jcnelson Nov 1, 2022
8f99453
fix: remove warnings
jcnelson Nov 1, 2022
7caaced
chore: use sensible default mining config
jcnelson Nov 1, 2022
36afd9f
chore: cargo fmt
jcnelson Nov 1, 2022
f52e781
fix: merge artifact: use new segwit bitcoin types
jcnelson Nov 1, 2022
6f0479d
Merge branch 'feat/native-segwit' of https://github.com/stacks-networ…
jcnelson Nov 1, 2022
c2424f1
Merge branch 'next' into feat/native-segwit
jcnelson Nov 2, 2022
ac424d6
fix: merge errors
jcnelson Nov 2, 2022
132980c
fix: more merge errors
jcnelson Nov 2, 2022
138b046
Merge branch 'next' into feat/native-segwit
jcnelson Nov 2, 2022
6940930
configure test miner for segwit
donpdonp Oct 26, 2022
5007ecd
run bitcoind_integration test in both non-segwit miner and segwit min…
donpdonp Oct 26, 2022
f805cbd
move bitcoind wallet creation to before wallet operations
donpdonp Oct 26, 2022
fe0662a
bootstrap the burnchain to block 2001 to trigger Epoch21 which direct…
donpdonp Oct 26, 2022
06949f0
update bitcoin_regtest use new VRF public key (value changed due to h…
donpdonp Oct 27, 2022
18f53bd
cargo fmt
donpdonp Oct 28, 2022
5d05103
pull old fixed vrf key into a fixed_value rotate_vrf_pair test
donpdonp Oct 31, 2022
036576f
add support for docker bitcoind
igorsyl Nov 1, 2022
206fae8
bitcoind unexpected exit. write bitcoind_debug.log and RUN cat to get…
donpdonp Nov 1, 2022
af6e873
revert RUN cat bitcoind_debug.log
donpdonp Nov 2, 2022
014f0fd
Revert "revert RUN cat bitcoind_debug.log"
donpdonp Nov 3, 2022
1069443
Revert "bitcoind unexpected exit. write bitcoind_debug.log and RUN ca…
donpdonp Nov 3, 2022
d98d0a1
Revert "add support for docker bitcoind"
donpdonp Nov 3, 2022
8480eb4
Merge pull request #3357 from stacks-network/feat/native-segwit-test
jcnelson Nov 4, 2022
0f619fd
Merge branch 'next' into feat/native-segwit
jcnelson Nov 4, 2022
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
1 change: 1 addition & 0 deletions .github/workflows/bitcoin-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ jobs:
- tests::epoch_21::transition_fixes_bitcoin_rigidity
- tests::epoch_21::transition_adds_pay_to_contract
- tests::epoch_21::transition_adds_get_pox_addr_recipients
- tests::epoch_21::transition_adds_mining_from_segwit
- tests::epoch_21::transition_removes_pox_sunset
- tests::epoch_21::transition_empty_blocks
steps:
Expand Down
15 changes: 9 additions & 6 deletions clarity/src/vm/docs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1620,8 +1620,8 @@ this value is less than or equal to the value for `miner-spend-total` at the sam

const GET_BURN_BLOCK_INFO_API: SpecialAPI = SpecialAPI {
input_type: "BurnBlockInfoPropertyName, uint",
output_type: "(optional buff) | (optional (tuple (addrs (list 2 (tuple (hashbytes (buff 32)) (version (buff 1))))) (payout uint)))",
snippet: "get-burn-block-info? ${1:prop} ${2:block-height}",
output_type: "(optional buff) | (optional (tuple (addrs (list 2 (tuple (hashbytes (buff 20)) (version (buff 1))))) (payout uint)))",
signature: "(get-burn-block-info? prop-name block-height)",
description: "The `get-burn-block-info?` function fetches data for a block of the given *burnchain* block height. The
value and type returned are determined by the specified `BlockInfoPropertyName`. Valid values for `block-height` only
Expand All @@ -1639,12 +1639,15 @@ The list will include burn addresses -- that is, the unspendable addresses that
there will be exactly one burn address reported. During the reward phase, up to two burn addresses may be reported in the event that some PoX reward slots are not claimed.

The `addrs` list contains the same PoX address values passed into the PoX smart contract:
* They each have type signature `(tuple (hashbytes (buff 20)) (version (buff 1)))`
* They each have type signature `(tuple (hashbytes (buff 32)) (version (buff 1)))`
* The `version` field can be any of the following:
* `0x00` means this is a p2pkh address, and `hashbytes` is the hash160 of a single public key
* `0x01` means this is a p2sh address, and `hashbytes` is the hash160 of a redeemScript script
* `0x02` means this is a p2wpkh-p2sh address, and `hashbytes` is the hash160 of a p2wpkh witness script
* `0x03` means this is a p2wsh-p2sh address, and `hashbytes` is the hash160 of a p2wsh witness script
* `0x00` means this is a p2pkh address, and `hashbytes` is the 20-byte hash160 of a single public key
* `0x01` means this is a p2sh address, and `hashbytes` is the 20-byte hash160 of a redeemScript script
* `0x02` means this is a p2wpkh-p2sh address, and `hashbytes` is the 20-byte hash160 of a p2wpkh witness script
* `0x03` means this is a p2wsh-p2sh address, and `hashbytes` is the 20-byte hash160 of a p2wsh witness script
* `0x04` means this is a p2wpkh address, and `hashbytes` is the 20-byte hash160 of the witness script
* `0x05` means this is a p2wsh address, and `hashbytes` is the 32-byte sha256 of the witness script
* `0x06` means this is a p2tr address, and `hashbytes` is the 32-byte sha256 of the witness script
",
example: "
(get-burn-block-info? header-hash u677050) ;; Returns (some 0xe67141016c88a7f1203eca0b4312f2ed141531f59303a1c267d7d83ab6b977d8)
Expand Down
2 changes: 1 addition & 1 deletion clarity/src/vm/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ impl BurnBlockInfoProperty {
TypeSignature::TupleType(
TupleTypeSignature::try_from(vec![
("version".into(), BUFF_1.clone()),
("hashbytes".into(), BUFF_20.clone()),
("hashbytes".into(), BUFF_32.clone()),
])
.expect("FATAL: bad type signature for pox addr"),
),
Expand Down
Loading