Skip to content

Commit c4ed30d

Browse files
hugoclrdMicaiahReid
andcommitted
chore: update clarinet and clarity-vm (#475)
### Description Upgrade clarinet dependency --------- Co-authored-by: MicaiahReid <[email protected]>
1 parent fb49e28 commit c4ed30d

File tree

10 files changed

+1297
-334
lines changed

10 files changed

+1297
-334
lines changed

Cargo.lock

Lines changed: 1263 additions & 311 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/chainhook-cli/Cargo.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ rand = "0.8.5"
1818
chainhook-sdk = { version = "0.12.1", default-features = false, features = [
1919
"zeromq",
2020
], path = "../chainhook-sdk" }
21-
hiro-system-kit = "0.3.2"
22-
# clarinet-files = { path = "../../../clarinet/components/clarinet-files" }
21+
hiro-system-kit = "0.3.1"
2322
# hiro-system-kit = { path = "../../../clarinet/components/hiro-system-kit" }
2423
clap = { version = "3.2.23", features = ["derive"], optional = true }
2524
clap_generate = { version = "3.0.3", optional = true }
@@ -52,7 +51,6 @@ features = ["lz4", "snappy"]
5251
[dev-dependencies]
5352
criterion = "0.3"
5453
redis = "0.21.5"
55-
clarity-vm = "=2.1.1"
5654
hex = "0.4.3"
5755
test-case = "3.1.0"
5856
serial_test = "2.0.0"

components/chainhook-sdk/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ serde = { version = "1", features = ["rc"] }
1212
serde_json = { version = "1", features = ["arbitrary_precision"] }
1313
serde-hex = "0.1.0"
1414
serde_derive = "1"
15-
stacks-rpc-client = "2"
16-
hiro-system-kit = { version = "0.3.2", optional = true }
15+
stacks-rpc-client = { version = "2", git = "https://github.com/hirosystems/clarinet.git" }
16+
hiro-system-kit = { version = "0.3.1", optional = true }
1717
# stacks-rpc-client = { version = "1", path = "../../../clarinet/components/stacks-rpc-client" }
1818
# hiro-system-kit = { version = "0.1.0", path = "../../../clarinet/components/hiro-system-kit" }
1919
chainhook-types = { version = "1.3.3", path = "../chainhook-types-rs" }
@@ -50,4 +50,4 @@ test-case = "3.1.0"
5050
default = ["hiro-system-kit/log"]
5151
zeromq = ["zmq"]
5252
debug = ["hiro-system-kit/debug"]
53-
release = ["hiro-system-kit/release_debug", "hiro-system-kit/full_log_level_prefix"]
53+
release = ["hiro-system-kit/release"]

components/chainhook-sdk/src/chainhooks/stacks/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use hiro_system_kit::slog;
1212
use regex::Regex;
1313
use reqwest::{Client, Method};
1414
use serde_json::Value as JsonValue;
15-
use stacks_rpc_client::clarity::stacks_common::codec::StacksMessageCodec;
15+
use stacks_rpc_client::clarity::codec::StacksMessageCodec;
1616
use stacks_rpc_client::clarity::vm::types::{CharType, SequenceData, Value as ClarityValue};
1717
use std::collections::{BTreeMap, HashMap};
1818
use std::io::Cursor;

components/chainhook-sdk/src/indexer/stacks/mod.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ use chainhook_types::*;
1010
use hiro_system_kit::slog;
1111
use rocket::serde::json::Value as JsonValue;
1212
use rocket::serde::Deserialize;
13+
use stacks_rpc_client::clarity::codec::StacksMessageCodec;
1314
use stacks_rpc_client::clarity::codec::{StacksTransaction, TransactionAuth, TransactionPayload};
14-
use stacks_rpc_client::clarity::stacks_common::codec::StacksMessageCodec;
1515
use stacks_rpc_client::clarity::vm::types::{SequenceData, Value as ClarityValue};
1616
use std::collections::{BTreeMap, HashMap, HashSet};
1717
use std::convert::TryInto;
@@ -332,7 +332,7 @@ pub fn standardize_stacks_block(
332332
.into();
333333
let current_len = u64::saturating_sub(
334334
block.burn_block_height,
335-
1 + chain_ctx.pox_info.first_burnchain_block_height,
335+
1 + (chain_ctx.pox_info.first_burnchain_block_height as u64),
336336
);
337337
let pox_cycle_id: u32 = (current_len / pox_cycle_length).try_into().unwrap_or(0);
338338
let mut events: HashMap<&String, Vec<&NewEvent>> = HashMap::new();
@@ -818,10 +818,16 @@ pub fn get_tx_description(
818818
StacksTransactionKind::ContractDeployment(data),
819819
)
820820
}
821-
TransactionPayload::Coinbase(_, _) => {
821+
TransactionPayload::Coinbase(_, _, _) => {
822822
(format!("coinbase"), StacksTransactionKind::Coinbase)
823823
}
824-
_ => (format!("other"), StacksTransactionKind::Unsupported),
824+
TransactionPayload::TenureChange(_) => (
825+
format!("tenure change"),
826+
StacksTransactionKind::TenureChange,
827+
),
828+
TransactionPayload::PoisonMicroblock(_, _) => {
829+
unimplemented!()
830+
}
825831
};
826832
Ok((description, tx_type, fee, nonce, sender, sponsor))
827833
}

components/chainhook-sdk/src/observer/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ pub async fn start_stacks_event_observer(
639639

640640
let ingestion_config = Config {
641641
port: ingestion_port,
642-
workers: 3,
642+
workers: 1,
643643
address: IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)),
644644
keep_alive: 5,
645645
temp_dir: std::env::temp_dir().into(),

components/chainhook-types-js/src/index.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ export interface StacksTransactionMetadata {
323323
* @memberof StacksTransactionMetadata
324324
*/
325325
position: AnchorBlockPosition | MicroBlockPosition;
326-
/**
326+
/**
327327
* @type {string}
328328
* @memberof StacksTransactionMetadata
329329
*/
@@ -335,18 +335,18 @@ export interface StacksTransactionMetadata {
335335
* @export
336336
* @interface MicroBlockPosition
337337
*/
338-
export interface MicroBlockPosition {
339-
micro_block_identifier: BlockIdentifier,
340-
index: number
338+
export interface MicroBlockPosition {
339+
micro_block_identifier: BlockIdentifier;
340+
index: number;
341341
}
342342

343343
/**
344344
* AnchorBlockPosition
345345
* @export
346346
* @interface AnchorBlockPosition
347347
*/
348-
export interface AnchorBlockPosition {
349-
index: number
348+
export interface AnchorBlockPosition {
349+
index: number;
350350
}
351351

352352
export interface StacksTransactionReceipt {
@@ -428,11 +428,13 @@ export interface StacksTransactionExecutionCost {
428428
runtime: number;
429429
}
430430

431+
// todo: tenure change
431432
export enum StacksTransactionKind {
432433
ContractCall = "ContractCall",
433434
ContractDeployment = "ContractDeployment",
434435
NativeTokenTransfer = "NativeTokenTransfer",
435436
Coinbase = "Coinbase",
437+
TenureChange = "TenureChange",
436438
Other = "Other",
437439
}
438440

@@ -1061,9 +1063,7 @@ export function checkBitcoinProof(
10611063
blockHash: string,
10621064
merkleProof: string[],
10631065
index: number
1064-
): boolean {
1065-
1066-
}
1066+
): boolean {}
10671067

10681068
// I'll add some documentation, but this is a "standard" bitcoin proof, so it goes as follow:
10691069
// So for instance, you'll receive something like this:

components/chainhook-types-rs/src/rosetta.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ pub enum StacksTransactionKind {
163163
ContractDeployment(StacksContractDeploymentData),
164164
NativeTokenTransfer,
165165
Coinbase,
166+
TenureChange,
166167
BitcoinOp(BitcoinOpData),
167168
Unsupported,
168169
}

components/client/typescript/src/schemas/stacks/tx_kind.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ export const StacksTransactionCoinbaseKindSchema = Type.Object({
2828
});
2929
export type StacksTransactionCoinbaseKind = Static<typeof StacksTransactionCoinbaseKindSchema>;
3030

31+
export const StacksTransactionTenureChangeKindSchema = Type.Object({
32+
type: Type.Literal('TenureChange'),
33+
});
34+
export type StacksTransactionTenureChangeKind = Static<typeof StacksTransactionTenureChangeKindSchema>;
35+
3136
export const StacksTransactionNativeTokenTransferKindSchema = Type.Object({
3237
type: Type.Literal('NativeTokenTransfer'),
3338
});
@@ -70,6 +75,7 @@ export type StacksTransactionUnsupportedKind = Static<
7075

7176
export const StacksTransactionKindSchema = Type.Union([
7277
StacksTransactionCoinbaseKindSchema,
78+
StacksTransactionTenureChangeKindSchema,
7379
StacksTransactionContractCallKindSchema,
7480
StacksTransactionContractDeploymentKindSchema,
7581
StacksTransactionNativeTokenTransferKindSchema,

dockerfiles/components/chainhook-node.dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ WORKDIR /src
44

55
RUN apt update && apt install -y ca-certificates pkg-config libssl-dev libclang-11-dev
66

7-
RUN rustup update 1.70.0 && rustup default 1.70.0
7+
RUN rustup update 1.73.0 && rustup default 1.73.0
88

99
COPY ./Cargo.* /src/
1010

@@ -30,4 +30,4 @@ COPY --from=build /out/ /bin/
3030

3131
WORKDIR /workspace
3232

33-
ENTRYPOINT ["chainhook"]
33+
ENTRYPOINT ["chainhook"]

0 commit comments

Comments
 (0)