Skip to content

Commit

Permalink
Merge pull request #2947 from blockstack/next-costs
Browse files Browse the repository at this point in the history
Release 2.05.0.0.0
  • Loading branch information
kantai authored Nov 24, 2021
2 parents dee6d5c + ac6575c commit a783b27
Show file tree
Hide file tree
Showing 95 changed files with 10,105 additions and 1,189 deletions.
7 changes: 6 additions & 1 deletion .github/actions/bitcoin-int-tests/Dockerfile.bitcoin-tests
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,10 @@ FROM stacks-node:integrations
ARG test_name
ENV BITCOIND_TEST 1

RUN cargo test -- --test-threads 1 --ignored "$test_name"
RUN cargo build && \
cargo test -- --test-threads 1 --ignored "$test_name"

RUN grcov . --binary-path ../../target/debug/ -s ../.. -t lcov --branch --ignore-not-existing --ignore "/*" -o lcov.info && \
curl -Os https://uploader.codecov.io/latest/linux/codecov && \
chmod +x codecov && \
./codecov --name "$test_name"
4 changes: 3 additions & 1 deletion .github/actions/bitcoin-int-tests/Dockerfile.code-cov
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ RUN cargo build && \

# Generate coverage report and upload it to codecov
RUN grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "/*" -o lcov.info && \
bash -c "bash <(curl -s https://codecov.io/bash)"
curl -Os https://uploader.codecov.io/latest/linux/codecov && \
chmod +x codecov && \
./codecov --name "unit_tests"
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,16 @@ WORKDIR /src/
COPY . .

WORKDIR /src/testnet/stacks-node
RUN cargo test --no-run

RUN rustup override set nightly && \
rustup component add llvm-tools-preview && \
cargo install grcov

ENV RUSTFLAGS="-Zinstrument-coverage" \
LLVM_PROFILE_FILE="stacks-blockchain-%p-%m.profraw"

RUN cargo test --no-run && \
cargo build

RUN cd / && wget https://bitcoin.org/bin/bitcoin-core-0.20.0/bitcoin-0.20.0-x86_64-linux-gnu.tar.gz
RUN cd / && tar -xvzf bitcoin-0.20.0-x86_64-linux-gnu.tar.gz
Expand Down
17 changes: 15 additions & 2 deletions .github/actions/bitcoin-int-tests/Dockerfile.large-genesis
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,25 @@ WORKDIR /src

COPY . .

RUN cargo test --no-run --workspace

RUN cd / && wget https://bitcoin.org/bin/bitcoin-core-0.20.0/bitcoin-0.20.0-x86_64-linux-gnu.tar.gz
RUN cd / && tar -xvzf bitcoin-0.20.0-x86_64-linux-gnu.tar.gz

RUN ln -s /bitcoin-0.20.0/bin/bitcoind /bin/

RUN rustup override set nightly && \
rustup component add llvm-tools-preview && \
cargo install grcov

ENV RUSTFLAGS="-Zinstrument-coverage" \
LLVM_PROFILE_FILE="stacks-blockchain-%p-%m.profraw"

RUN cargo test --no-run --workspace && \
cargo build --workspace

ENV BITCOIND_TEST 1
RUN cd testnet/stacks-node && cargo test --release --features prod-genesis-chainstate -- --test-threads 1 --ignored neon_integrations::bitcoind_integration_test

RUN grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "/*" -o lcov.info && \
curl -Os https://uploader.codecov.io/latest/linux/codecov && \
chmod +x codecov && \
./codecov --name "large_genesis"
9 changes: 8 additions & 1 deletion .github/workflows/bitcoin-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ jobs:
- name: Build bitcoin integration testing image
env:
DOCKER_BUILDKIT: 1
run: docker build -f ./.github/actions/bitcoin-int-tests/Dockerfile.generic.bitcoin-tests -t stacks-node:integrations .
# Remove .dockerignore file so codecov has access to git info
run: |
rm .dockerignore
docker build -f ./.github/actions/bitcoin-int-tests/Dockerfile.generic.bitcoin-tests -t stacks-node:integrations .
- name: Export docker image as tarball
run: docker save -o integration-image.tar stacks-node:integrations
- name: Upload built docker image
Expand Down Expand Up @@ -50,6 +53,10 @@ jobs:
- tests::neon_integrations::filter_low_fee_tx_integration_test
- tests::neon_integrations::filter_long_runtime_tx_integration_test
- tests::neon_integrations::mining_transactions_is_fair
- tests::epoch_205::test_dynamic_db_method_costs
- tests::epoch_205::transition_empty_blocks
- tests::epoch_205::test_cost_limit_switch_version205
- tests::epoch_205::test_exact_block_costs
steps:
- uses: actions/checkout@v2
- name: Download docker image
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/stacks-blockchain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ jobs:
- name: Single full genesis integration test
env:
DOCKER_BUILDKIT: 1
run: docker build -f ./.github/actions/bitcoin-int-tests/Dockerfile.large-genesis .
# Remove .dockerignore file so codecov has access to git info
run: |
rm .dockerignore
docker build -f ./.github/actions/bitcoin-int-tests/Dockerfile.large-genesis .
# Run unit tests with code coverage
unit-tests:
Expand All @@ -49,7 +52,10 @@ jobs:
- name: Run units tests (with coverage)
env:
DOCKER_BUILDKIT: 1
run: docker build -f ./.github/actions/bitcoin-int-tests/Dockerfile.code-cov .
# Remove .dockerignore file so codecov has access to git info
run: |
rm .dockerignore
docker build -f ./.github/actions/bitcoin-int-tests/Dockerfile.code-cov .
open-api-validation:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -218,7 +224,7 @@ jobs:
tag_name: ${{ github.event.inputs.tag || github.ref }}
release_name: Release ${{ github.event.inputs.tag || github.ref }}
draft: false
prerelease: false
prerelease: true

# Upload distributables to a new release if we're building a tag or a tag was passed in
upload-dist:
Expand Down
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,37 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to the versioning scheme outlined in the [README.md](README.md).

## [2.05.0.0.0]

This software update is a consensus changing release and the
implementation of the proposed cost changes in SIP-012. This release's
chainstate directory is compatible with chainstate directories from
2.0.11.4.0. However, this release is only compatible with chainstate
directories before the 2.05 consensus changes activate (Bitcoin height
713,000). If you run a 2.00 stacks-node beyond this point, and wish to
run a 2.05 node afterwards, you must start from a new chainstate
directory.

## Added

- At height 713,000 a new `costs-2` contract will be launched by the
Stacks boot address.

## Changed

- Stacks blocks whose parents are mined >= 713,000 will use default costs
from the new `costs-2` contract.
- Stacks blocks whose parents are mined >= 713,000 will use the real
serialized length of Clarity values as the cost inputs to several methods
that previously used the maximum possible size for the associated types.
- Stacks blocks whose parents are mined >= 713,000 will use the new block
limit defined in SIP-012.

## Fixed

- Miners are now more aggressive in calculating their block limits
when confirming microblocks (#2916)

## [2.0.11.4.0]

This software update is a point-release to change the transaction
Expand Down
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 49 additions & 1 deletion docs/event-dispatcher.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,21 @@ Example:
"from_stacks_block_hash": "0xf5d4ce0efe1d42c963d615ce57f0d014f263a985175e4ece766eceff10e0a358",
"from_index_block_hash": "0x329efcbcc6daf5ac3f264522e0df50eddb5be85df6ee8a9fc2384c54274d7afc",
}
]
],
"anchored_cost": {
"runtime": 100,
"read_count": 10,
"write_count": 5,
"read_length": 150,
"write_length": 75
},
"confirmed_microblocks_cost": {
"runtime": 100,
"read_count": 10,
"write_count": 5,
"read_length": 150,
"write_length": 75
}
}
```

Expand Down Expand Up @@ -216,3 +230,37 @@ Reason can be one of:
* `ReplaceAcrossFork` - replaced by a transaction with the same nonce but in the canonical fork
* `TooExpensive` - the transaction is too expensive to include in a block
* `StaleGarbageCollect` - transaction was dropped because it became stale

### `POST /mined_block`

This payload includes data related to block mined by this Stacks node. This
will never be invoked if the node is configured only as a follower. This is invoked
when the miner **assembles** the block; this block may or may not win the sortition.

This endpoint will only broadcast events to observers that explicitly register for
`MinedBlocks` events, `AnyEvent` observers will not receive the events by default.

Example:

```json
{
"block_hash": "0x4eaabcd105865e471f697eff5dd5bd85d47ecb5a26a3379d74fae0ae87c40904",
"staks_height": 3,
"target_burn_height": 745000,
"block_size": 145000,
"anchored_cost": {
"runtime": 100,
"read_count": 10,
"write_count": 5,
"read_length": 150,
"write_length": 75
},
"confirmed_microblocks_cost": {
"runtime": 100,
"read_count": 10,
"write_count": 5,
"read_length": 150,
"write_length": 75
}
}
```
3 changes: 1 addition & 2 deletions src/blockstack_cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ use blockstack_lib::types::chainstate::StacksAddress;
use blockstack_lib::util::{
hash::hex_bytes, hash::to_hex, log, retry::LogReader, strings::StacksString,
};
use blockstack_lib::vm;
use blockstack_lib::vm::{
errors::{Error as ClarityError, RuntimeErrorType},
types::PrincipalData,
Expand Down Expand Up @@ -448,7 +447,7 @@ fn handle_contract_call(
Value::try_deserialize_hex_untyped(input)?
},
"-e" => {
vm::execute(input)?
blockstack_lib::clarity::vm_execute(input)?
.ok_or("Supplied argument did not evaluate to a Value")?
},
_ => {
Expand Down
Loading

0 comments on commit a783b27

Please sign in to comment.