Skip to content

Commit

Permalink
Merge pull request #3848 from stacks-network/feat/stackerdb-rpc
Browse files Browse the repository at this point in the history
Feat/stackerdb rpc
  • Loading branch information
jcnelson authored Sep 2, 2023
2 parents 7c107dc + ef6c5a4 commit f480846
Show file tree
Hide file tree
Showing 56 changed files with 4,703 additions and 1,856 deletions.
6 changes: 3 additions & 3 deletions .github/actions/bitcoin-int-tests/Dockerfile.atlas-test
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ 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 cd / && wget https://bitcoin.org/bin/bitcoin-core-25.0/bitcoin-25.0-x86_64-linux-gnu.tar.gz
RUN cd / && tar -xvzf bitcoin-25.0-x86_64-linux-gnu.tar.gz

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

ENV BITCOIND_TEST 1
WORKDIR /src/testnet/stacks-node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ ENV RUSTFLAGS="-Cinstrument-coverage" \
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
RUN cd / && wget https://bitcoin.org/bin/bitcoin-core-25.0/bitcoin-25.0-x86_64-linux-gnu.tar.gz
RUN cd / && tar -xvzf bitcoin-25.0-x86_64-linux-gnu.tar.gz

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

ENV BITCOIND_TEST 1
6 changes: 3 additions & 3 deletions .github/actions/bitcoin-int-tests/Dockerfile.large-genesis
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ WORKDIR /src

COPY . .

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 cd / && wget https://bitcoin.org/bin/bitcoin-core-25.0/bitcoin-25.0-x86_64-linux-gnu.tar.gz
RUN cd / && tar -xvzf bitcoin-25.0-x86_64-linux-gnu.tar.gz

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

RUN rustup component add llvm-tools-preview && \
cargo install grcov
Expand Down
8 changes: 4 additions & 4 deletions .github/actions/bitcoin-int-tests/Dockerfile.net-tests
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ WORKDIR /src

COPY . .

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 cd / && wget https://bitcoin.org/bin/bitcoin-core-25.0/bitcoin-25.0-x86_64-linux-gnu.tar.gz
RUN cd / && tar -xvzf bitcoin-25.0-x86_64-linux-gnu.tar.gz

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

RUN apt-get update
RUN apt-get install -y jq screen net-tools ncat sqlite3 xxd openssl curl
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/bitcoin-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ jobs:
- tests::neon_integrations::bad_microblock_pubkey
- tests::epoch_24::fix_to_pox_contract
- tests::epoch_24::verify_auto_unlock_behavior
- tests::stackerdb::test_stackerdb_load_store
- tests::stackerdb::test_stackerdb_event_observer
steps:
- name: Checkout the latest code
id: git_checkout
Expand Down
14 changes: 14 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ members = [
"pox-locking",
"clarity",
"stx-genesis",
"libstackerdb",
"testnet/stacks-node"]

# Use a bit more than default optimization for
Expand Down
27 changes: 27 additions & 0 deletions docs/event-dispatcher.md
Original file line number Diff line number Diff line change
Expand Up @@ -458,3 +458,30 @@ Example:
]
}
```

### `POST /stackerdb_chunks`

This payload includes data related to a single mutation to a StackerDB replica
that this node subscribes to. The data will only get sent here if the
corresponding chunk has already been successfully stored. The data includes the
chunk ID, chunk version, smart contract ID, signature, and data hash; the
consumer may request the chunk data itself with a follow-up GET request on the node.

This endpoint broadcasts events to `AnyEvent` observers, as well as to
`StackerDBChunks` observers.

Example:

```json
{
"contract_id": "STVN97YYA10MY5F6KQJHKNYJNM24C4A1AT39WRW.hello-world",
"modified_slots": [
{
"slot_id": 0,
"slot_version": 20,
"data_hash": "9d26b8009ab4693d3792791a4ea5e338822b5631af94e567a485b7265ba0f107",
"signature": "015814daf929d8700af344987681f44e913890a12e38550abe8e40f149ef5269f40f4008083a0f2e0ddf65dcd05ecfc151c7ff8a5308ad04c77c0e87b5aeadad31"
}
]
}
```
33 changes: 33 additions & 0 deletions libstackerdb/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[package]
name = "libstackerdb"
version = "0.0.1"
authors = [ "Jude Nelson <[email protected]>" ]
license = "GPLv3"
homepage = "https://github.com/blockstack/stacks-blockchain"
repository = "https://github.com/blockstack/stacks-blockchain"
description = "Client library for the StackerDB subsystem"
keywords = [ "stacks", "stx", "bitcoin", "crypto", "blockstack", "decentralized", "dapps", "blockchain" ]
readme = "README.md"
resolver = "2"
edition = "2021"

[lib]
name = "libstackerdb"
path = "./src/libstackerdb.rs"

[dependencies]
serde = "1"
serde_derive = "1"
serde_stacker = "0.1"
stacks-common = { path = "../stacks-common" }
clarity = { path = "../clarity" }

[dependencies.secp256k1]
version = "0.24.3"
features = ["serde", "recovery"]

[target.'cfg(all(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64"), not(target_env = "msvc")))'.dependencies]
sha2 = { version = "0.10", features = ["asm"] }

[target.'cfg(any(not(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64")), target_env = "msvc"))'.dependencies]
sha2 = { version = "0.10" }
Loading

0 comments on commit f480846

Please sign in to comment.