Skip to content

Commit

Permalink
bump dependencies (#69)
Browse files Browse the repository at this point in the history
* bump ic-agent to 0.24.1

* bump candid, ic-wasm, rustyline

* bump base64

* bump version

* cargo update
  • Loading branch information
chenyan-dfinity authored Jul 3, 2023
1 parent b85b148 commit cbfb3aa
Show file tree
Hide file tree
Showing 10 changed files with 620 additions and 529 deletions.
1,065 changes: 573 additions & 492 deletions Cargo.lock

Large diffs are not rendered by default.

45 changes: 25 additions & 20 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ic-repl"
version = "0.4.0"
version = "0.4.1"
authors = ["DFINITY Team"]
edition = "2021"
default-run = "ic-repl"
Expand All @@ -11,42 +11,47 @@ path = "src/main.rs"
doc = false

[build-dependencies]
lalrpop = "0.19"
lalrpop = "0.20"

[dependencies]
candid = { version = "0.9.0-beta.2", features = ["all"] }
rustyline = "10.0"
rustyline-derive = "0.7"
candid = { version = "0.9.0", features = ["all"] }
rustyline = "12.0"
rustyline-derive = "0.9"
ansi_term = "0.12"
pretty_assertions = "0.7"
pretty_assertions = "1.3"
terminal_size = "0.2"
codespan-reporting = "0.11"
pretty = "0.10"
pem = "1.1"
shellexpand = "3.0"
ic-agent = "0.23"
ic-identity-hsm = "0.23"
ic-wasm = { version = "0.3.5", default-features = false }
pem = "2.0"
shellexpand = "3.1"
ic-agent = "0.24"
ic-identity-hsm = "0.24"
ic-wasm = { version = "0.4.0", default-features = false }
inferno = { version = "0.11", default-features = false, features = ["multithreaded", "nameattr"] }
tokio = { version = "1.24", features = ["full"] }
tokio = { version = "1.29", features = ["full"] }
anyhow = "1.0"
rand = "0.8"
logos = "0.12"
lalrpop-util = "0.19"
clap = { version = "4.1", features = ["derive"] }
lalrpop-util = "0.20"
clap = { version = "4.3", features = ["derive"] }
ring = "0.16"
rpassword = "7.0"
rpassword = "7.2"
serde = "1.0"
serde_json = "1.0"
hex = { version = "0.4", features = ["serde"] }
sha2 = "0.10"
crc32fast = "1.2"
crc32fast = "1.3"
qrcode = "0.12"
image = { version = "0.23", default-features = false, features = ["png"] }
libflate = "1.2"
base64 = "0.13"
libflate = "1.4"
base64 = "0.21"

[patch.crates-io.ic-agent]
version = "0.23"
git = "https://github.com/dfinity/agent-rs.git"
version = "0.24"
git = "https://github.com/chenyan-dfinity/agent-rs.git"
branch = "bump-candid"
[patch.crates-io.ic-identity-hsm]
version = "0.24"
git = "https://github.com/chenyan-dfinity/agent-rs.git"
branch = "bump-candid"

2 changes: 1 addition & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fn report(e: &ParserError) -> Diagnostic<()> {
InvalidToken { location } => {
Label::primary((), *location..location + 1).with_message("Invalid token")
}
UnrecognizedEOF { location, expected } => {
UnrecognizedEof { location, expected } => {
diag = diag.with_notes(report_expected(expected));
Label::primary((), *location..location + 1).with_message("Unexpected EOF")
}
Expand Down
6 changes: 3 additions & 3 deletions src/exp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ use super::utils::{
};
use anyhow::{anyhow, Context, Result};
use candid::{
parser::typing::check_unique,
types::value::{IDLArgs, IDLField, IDLValue, VariantValue},
types::{Function, Label, Type, TypeInner},
utils::check_unique,
Principal, TypeEnv,
};
use ic_agent::Agent;
Expand Down Expand Up @@ -543,7 +543,7 @@ async fn call(
.unwrap_or(false);
let bytes = if is_query {
let mut builder = agent.query(canister_id, method);
builder
builder = builder
.with_arg(args)
.with_effective_canister_id(effective_id);
if let Some(offline) = offline {
Expand All @@ -560,7 +560,7 @@ async fn call(
}
} else {
let mut builder = agent.update(canister_id, method);
builder
builder = builder
.with_arg(args)
.with_effective_canister_id(effective_id);
if let Some(offline) = offline {
Expand Down
2 changes: 1 addition & 1 deletion src/grammar.lalrpop
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use super::exp::{Field, Exp, Method, CallMode};
use super::selector::Selector;
use candid::parser::types::{IDLType, TypeField, PrimType, FuncType, Binding};
use candid::parser::typing::check_unique;
use candid::utils::check_unique;
use super::token::{Token, error2, LexicalError, Span};
use candid::{Principal, types::{FuncMode, Label, TypeEnv}};
use super::command::{Command, Commands, BinOp};
Expand Down
9 changes: 5 additions & 4 deletions src/helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ enum Partial {
}

fn partial_parse(line: &str, pos: usize, helper: &MyHelper) -> Option<(usize, Partial)> {
let (start, _) = extract_word(line, pos, None, b" ");
let (start, _) = extract_word(line, pos, None, |c| c == ' ');
let iter = Tokenizer::new(&line[start..pos]);
let mut tokens = Vec::new();
let mut pos_start = 0;
Expand Down Expand Up @@ -403,7 +403,7 @@ async fn fetch_actor(agent: &Agent, canister_id: Principal) -> anyhow::Result<Ca
Err(_) => {
let response = agent
.query(&canister_id, "__get_candid_interface_tmp_hack")
.with_arg(&Encode!()?)
.with_arg(Encode!()?)
.call()
.await;
match response {
Expand Down Expand Up @@ -439,8 +439,9 @@ async fn fetch_metadata_(
sub_paths: &str,
) -> anyhow::Result<Vec<u8>> {
use ic_agent::{hash_tree::Label, lookup_value};
let mut path: Vec<Label> = vec!["canister".into(), canister_id.into()];
path.extend(sub_paths.split('/').map(|str| str.into()));
let mut path: Vec<Label<Vec<u8>>> =
vec!["canister".as_bytes().into(), canister_id.as_slice().into()];
path.extend(sub_paths.split('/').map(|str| str.as_bytes().into()));
let cert = agent
.read_state_raw(vec![path.clone()], canister_id)
.await?;
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ fn repl(opts: Opts) -> anyhow::Result<()> {
let input = rl.readline(&p);
match input {
Ok(line) => {
rl.add_history_entry(&line);
rl.add_history_entry(&line)?;
unwrap(pretty_parse::<Command>("stdin", &line), |cmd| {
let helper = rl.helper_mut().unwrap();
helper.history.push(line.clone());
Expand Down
12 changes: 8 additions & 4 deletions src/offline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,23 @@ pub fn output_message(json: String, format: &OfflineOutput) -> anyhow::Result<()
match format {
OfflineOutput::Json => println!("{json}"),
_ => {
use base64::{
engine::general_purpose::{STANDARD_NO_PAD, URL_SAFE_NO_PAD},
Engine,
};
use libflate::gzip;
use qrcode::{render::unicode, QrCode};
use std::io::Write;
eprintln!("json length: {}", json.len());
let mut encoder = gzip::Encoder::new(Vec::new())?;
encoder.write_all(json.as_bytes())?;
let zipped = encoder.finish().into_result()?;
let config = if matches!(format, OfflineOutput::PngNoUrl | OfflineOutput::AsciiNoUrl) {
base64::STANDARD_NO_PAD
let engine = if matches!(format, OfflineOutput::PngNoUrl | OfflineOutput::AsciiNoUrl) {
STANDARD_NO_PAD
} else {
base64::URL_SAFE_NO_PAD
URL_SAFE_NO_PAD
};
let base64 = base64::encode_config(zipped, config);
let base64 = engine.encode(zipped);
eprintln!("base64 length: {}", base64.len());
let msg = match format {
OfflineOutput::Ascii(url) | OfflineOutput::Png(url) => url.to_owned() + &base64,
Expand Down
4 changes: 2 additions & 2 deletions src/profiling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub fn ok_to_profile<'a>(helper: &'a MyHelper, info: &'a MethodInfo) -> bool {
#[tokio::main]
pub async fn get_cycles(agent: &Agent, canister_id: &Principal) -> anyhow::Result<i64> {
use candid::{Decode, Encode};
let mut builder = agent.query(canister_id, "__get_cycles");
let builder = agent.query(canister_id, "__get_cycles");
let bytes = builder
.with_arg(Encode!()?)
.with_effective_canister_id(*canister_id)
Expand All @@ -37,7 +37,7 @@ pub async fn get_profiling(
filename: PathBuf,
) -> anyhow::Result<u64> {
use candid::{Decode, Encode};
let mut builder = agent.query(canister_id, "__get_profiling");
let builder = agent.query(canister_id, "__get_profiling");
let bytes = builder
.with_arg(Encode!()?)
.with_effective_canister_id(*canister_id)
Expand Down
2 changes: 1 addition & 1 deletion src/selector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ use super::exp::Exp;
use super::helper::MyHelper;
use anyhow::{anyhow, Result};
use candid::{
parser::typing::check_unique,
types::value::{IDLField, IDLValue, VariantValue},
types::Label,
utils::check_unique,
};

#[derive(Debug, Clone)]
Expand Down

0 comments on commit cbfb3aa

Please sign in to comment.