Skip to content

Commit

Permalink
Release 1.0.0-rc.1 (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
alekseysidorov committed Feb 14, 2020
1 parent fdbbce9 commit 99338a6
Show file tree
Hide file tree
Showing 22 changed files with 377 additions and 288 deletions.
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ addons:
- zlib1g-dev

rust:
- 1.39.0
- 1.40.0

cache:
npm: true
Expand All @@ -53,6 +53,9 @@ before_install:
- export RUSTC_WRAPPER=sccache

jobs:
allow_failures:
- name: publish-with-rust-1.36
- name: deadlinks
include:
# Formatting & other lints that do not require compilation
- name: lints
Expand Down
11 changes: 9 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
## 1.0.0-rc.1 - 2020-02-13

## 0.13.0-rc.2 - 2018-12-04
### Breaking changes

- Updated to the [Exonum 1.0.0-rc.1](https://github.com/exonum/exonum/releases/tag/v1.0.0-rc.1)
release with some minor changes (#155).

- `api::TransactionProof` layout has been refined.

## 0.13.0-rc.2 - 2019-12-04

### Breaking changes

Expand Down
24 changes: 13 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "exonum-btc-anchoring"
edition = "2018"
version = "0.13.0-rc.2"
version = "1.0.0-rc.1"
authors = ["The Exonum Team <[email protected]>"]
homepage = "https://exonum.com/doc/advanced/bitcoin-anchoring/"
repository = "https://github.com/exonum/exonum-btc-anchoring"
Expand All @@ -22,17 +22,19 @@ bitcoincore-rpc = "0.7.0"
btc-transaction-utils = "0.6"
byteorder = "1.3"
derive_more = "0.15"
exonum = "0.13.0-rc.2"
exonum-cli = "0.13.0-rc.2"
exonum-crypto = { version = "0.13.0-rc.2", features = ["with-protobuf"] }
exonum-derive = "0.13.0-rc.2"
exonum-merkledb = "0.13.0-rc.2"
exonum-proto = "0.13.0-rc.2"
exonum-supervisor = "0.13.0-rc.2"
exonum-testkit = "0.13.0-rc.2"
exonum = "1.0.0-rc.1"
exonum-cli = "1.0.0-rc.1"
exonum-crypto = { version = "1.0.0-rc.1", features = ["with-protobuf"] }
exonum-derive = "1.0.0-rc.1"
exonum-explorer = "1.0.0-rc.1"
exonum-merkledb = "1.0.0-rc.1"
exonum-proto = "1.0.0-rc.1"
exonum-rust-runtime = "1.0.0-rc.1"
exonum-supervisor = "1.0.0-rc.1"
exonum-testkit = "1.0.0-rc.1"
failure = "0.1"
failure_derive = "0.1"
hex = "0.4"
hex = "=0.4.0" # 0.4.1 is not compatible with Rust 1.36
jsonrpc = "0.11"
log = "0.4"
protobuf = { version = "2.8", features = ["with-serde"] }
Expand All @@ -49,4 +51,4 @@ structopt = "0.3"
proptest = "0.9"

[build-dependencies]
exonum-build = "0.13.0-rc.2"
exonum-build = "1.0.0-rc.1"
8 changes: 2 additions & 6 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use exonum_build::{ProtoSources, ProtobufGenerator};
use exonum_build::ProtobufGenerator;

fn main() {
ProtobufGenerator::with_mod_name("protobuf_mod.rs")
.with_input_dir("src/proto")
.with_includes(&[
"src/proto".into(),
ProtoSources::Exonum,
ProtoSources::Crypto,
])
.with_crypto()
.generate();
}
2 changes: 1 addition & 1 deletion examples/btc_anchoring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ use exonum_cli::NodeBuilder;
fn main() -> Result<(), failure::Error> {
exonum::helpers::init_logger()?;
NodeBuilder::new()
.with_service(exonum_btc_anchoring::BtcAnchoringService)
.with_rust_service(exonum_btc_anchoring::BtcAnchoringService)
.run()
}
43 changes: 16 additions & 27 deletions guides/newbie.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,35 +56,22 @@ your account.

## Step 2. Compilation and Initial Run

- Be sure to have [`exonum_launcher`](https://github.com/popzxc/exonum-launcher)
installed via `pip` (see `exonum-launcher` README for details).
- Be sure to have [`exonum_launcher`](https://github.com/exonum/exonum-launcher)
installed via `pip3` (see `exonum-launcher` README for details).
- Install `exonum_btc_anchoring_plugin`
(if you are using `venv`, activate `venv` in which `exonum_launcher` is installed):

```sh
pip install -e exonum-btc-anchoring/launcher
```

- Compile and install `btc_anchoring` example:

```sh
cd exonum-btc-anchoring
cargo install --path . --example btc_anchoring --force
```

- Build the `exonum-btc-anchoring` project (it contains a binary that will be used later):

```sh
cargo build
pip3 install -e exonum-btc-anchoring/launcher
```

- Run the example:

```sh
RUST_LOG="exonum_btc_anchoring=info" btc_anchoring run-dev -a anchoring
RUST_LOG="exonum_btc_anchoring=info" cargo run --example btc_anchoring run-dev -a target/anchoring
```

`-a anchoring` here denotes the directory in which the data of the node will be generated.
`-a target/anchoring` here denotes the directory in which the data of the node will be generated.

## Step 3. Deploying and Running

Expand All @@ -97,10 +84,11 @@ installed via `pip` (see `exonum-launcher` README for details).
To obtain `bitcoin_key`, go to the `exonum-btc-anchoring` directory and launch the following command:

```sh
cargo run -- generate-config -o anchoring/sync.toml --bitcoin-rpc-host http://localhost --bitcoin-rpc-user user --bitcoin-rpc-password password
cargo run -- generate-config -o target/anchoring/sync.toml --bitcoin-rpc-host http://localhost:18332 --bitcoin-rpc-user user --bitcoin-rpc-password password
```

In the code above you should replace `anchoring` with the directory where the data of your node lies.
In the code above you should replace `target/anchoring` with the directory where the data of
your node lies.

As a result of this call you will obtain `bitcoin_key`.
- Create file `anchoring.yml` with the following contents:
Expand All @@ -122,18 +110,19 @@ installed via `pip` (see `exonum-launcher` README for details).
artifacts:
anchoring:
runtime: rust
name: "exonum-btc-anchoring:0.12.0"
name: "exonum-btc-anchoring"
version: "1.0.0-rc.1"

instances:
anchoring:
artifact: anchoring
config:
network: regtest
network: testnet
anchoring_interval: 500
transaction_fee: 10
anchoring_keys:
- bitcoin_key: "0332ab15173cf9ff8ad0946fbd515434bf1f04bb46482453474b6c38b94fa9d7b7"
service_key: "2b89c8e1f3a6a8f18ac3276b87403e39c54c33d8275e9626ab9478df4d6d5bfc"
- bitcoin_key: "02d6086aaccc86e6a711ac84ff21a266684c17d188aa7c4eeab0c0f12133308584"
service_key: "850eb20eebe0b07cf2721ecc9c90aa465a96413dccafad11045a9cb8abf04ed0"
```

Replace `bitcoin_key` and `service_key` with values obtained in the previous step.
Expand Down Expand Up @@ -177,7 +166,7 @@ setup a funding transaction.
```sh
curl --header "Content-Type: application/json" \
--request POST \
--data '"020000000001051aa3e2a53010c4863becf608fc9bfe1d06c7a2456c820de85ee9e65dc95bcc6300000000171600145058446ed566ce61f9511a28b5f35340bb7bfc9afeffffffbed3ee193e9b73d0b259d60a57cffc2310f228fce4658060e9dffd24514631400000000017160014475caf1c9227353fb8bc10252a634dffbf7d39e1feffffff2787ebd988bfeb449c1482c1877e0598c6d28ef2db426f7c8f83da219d0f23c20000000017160014475caf1c9227353fb8bc10252a634dffbf7d39e1feffffff53a188e10f648e97fa9a4ed84bb0355ad52a301643249217b05f8114e76f579c00000000171600145058446ed566ce61f9511a28b5f35340bb7bfc9afeffffff8676d4e58838387079589229344eea778d0b29d095407f42ecdcf423975537ea0000000017160014475caf1c9227353fb8bc10252a634dffbf7d39e1feffffff0200c817a8040000002200209959c79a416778463632a0a1164e312c5973865dbc9fa038c69fc9e5af71e3cae4c7052a010000001600148e8a01a394875fec3c51c3a8117f9b00b57286d5024730440220287b30723dc3ed88d06f0884611071ba7b547903c2937846befd51cb601701f502206f74e78aa2e74ee8494c22481c1b661f8fcc171f04dfce61ff05a2ab53cbb634012103a54ae66b63b6bdc2089f294d43611ee37deaaf346cffd16f23d5f521dbca757c02473044022012490b04d0623f25661445e9bbcbfc3491b2009763dafdfd15c109e0617278cd022027d9ac08e9877f01b7b6234bd921016b4f7135a32cc25abd2f19a8cddfa692e3012103a208fc3f46c7b815c3237636d21267c2610a975b03dffae657017ab33fa832bd024730440220203514c2473a1ccb3f5722c4afc4347e083669784700cd72d15316d3b8cef3d502207e1120d31288ee91e58499a37f41b88578556474e334d7327b3f47a983be95af012103a208fc3f46c7b815c3237636d21267c2610a975b03dffae657017ab33fa832bd02473044022005bbf3b54f16ccabd7d5d98d26597bc19ce4af14e4952fa571e7d5d83f4a284402202c54adde15a678f7ce57f723e0ea875681e9b5f13aeffcba3871135fc82401de012103a54ae66b63b6bdc2089f294d43611ee37deaaf346cffd16f23d5f521dbca757c02473044022052d4d19bcf133fdcdaf526c0ec0aca362dab5a75ead2fb33b2f7378ef3d8cbcb02206251d0d55680ab0f8463e964755c1a63791e7d6d637a84f907b82c94a18221a4012103a208fc3f46c7b815c3237636d21267c2610a975b03dffae657017ab33fa832bd48000000"' \
--data '"0200000000010151a7dcd1c2829f9c0a93ae6b054e9777528e88e3e0403c4313cf8cf41b27d1730000000000feffffff0240420f0000000000220020f86c30b7ec3496572220f40b21096b74dc5182942b8811d1bb0b3ab21e52b1337007360000000000160014e16cbf1202193f7de0eb058e0dc2b57cbc63d4040247304402203e23349dcda80acc85e94ada52269baf09624afeb794b696fb53f0f37d130f850220599eaa9bb50d5e14269228f4f5d63826d5554275877b5ffd77eca3cd3b1c408e012102604e1c50f8bdaec165e0bc7b81e608709f510c5bf4b18b6aefaf3996317fd9cf77641900"' \
http://127.0.0.1:8081/api/services/anchoring/add-funds
```

Expand All @@ -193,10 +182,10 @@ setup a funding transaction.

```sh
cd exonum-btc-anchoring
RUST_LOG="exonum_btc_anchoring=info" cargo run -- run --config anchoring/sync.toml
RUST_LOG="exonum_btc_anchoring=info" cargo run -- run --config target/anchoring/sync.toml
```

`anchoring/` in the code above means the directory where `sync.toml` was generated earlier.
`target/anchoring/` in the code above means the directory where `sync.toml` was generated earlier.

On the `regtest` it will exit with an error, since blocks should be mined manually.
The log of the example will show that anchoring was made:
Expand Down
31 changes: 14 additions & 17 deletions launcher/exonum_btc_anchoring_plugin/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,14 @@

from exonum_launcher.instances.instance_spec_loader import InstanceSpecLoader, InstanceSpecLoadError

RUST_RUNTIME_ID = 0
ANCHORING_ARTIFACT_NAME = "exonum-btc-anchoring"
ANCHORING_ARTIFACT_VERSION = "1.0.0-rc.1"

def import_or_load_module(loader: ProtobufLoader, instance: Instance, module_name: str):
try:
# Try to load module (if it's already compiled) first.
module = ModuleManager.import_service_module(
instance.artifact.name, module_name)
return module
except (ModuleNotFoundError, ImportError):
# If it's not compiled, load & compile protobuf.
loader.load_service_proto_files(
instance.artifact.runtime_id, instance.artifact.name)
module = ModuleManager.import_service_module(
instance.artifact.name, "service")
return module

def import_anchoring_module(name: str):
return ModuleManager.import_service_module(
ANCHORING_ARTIFACT_NAME, ANCHORING_ARTIFACT_VERSION, name)


def bitcoin_network_from_string(network_string: str) -> int:
Expand All @@ -38,10 +32,13 @@ class AnchoringInstanceSpecLoader(InstanceSpecLoader):

def load_spec(self, loader: ProtobufLoader, instance: Instance) -> bytes:
try:
service_module = import_or_load_module(loader, instance, "service")
btc_types_module = import_or_load_module(
loader, instance, "btc_types")
exonum_types_module = import_or_load_module(loader, instance, "types")
# Load proto files for the Exonum anchoring service:
loader.load_service_proto_files(
RUST_RUNTIME_ID, ANCHORING_ARTIFACT_NAME, ANCHORING_ARTIFACT_VERSION)

service_module = import_anchoring_module("service")
btc_types_module = import_anchoring_module("btc_types")
exonum_types_module = import_anchoring_module("types")

# Create config message
config = service_module.Config()
Expand Down
Loading

0 comments on commit 99338a6

Please sign in to comment.