Skip to content

Commit

Permalink
Merge pull request #861 from tonlabs/update-deps4
Browse files Browse the repository at this point in the history
Update dependencies
  • Loading branch information
IgorKoval authored Aug 25, 2023
2 parents 316e473 + a7e5aa4 commit 266b361
Show file tree
Hide file tree
Showing 10 changed files with 226 additions and 112 deletions.
283 changes: 198 additions & 85 deletions Cargo.lock

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ license-file = 'LICENSE.md'
name = 'tvm_linker'
readme = 'README.md'
repository = 'https://github.com/tonlabs/TVM-linker'
version = '0.20.5'
version = '0.20.6'

[[bin]]
name = 'tvm_linker'
Expand All @@ -33,11 +33,11 @@ serde_json = '1.0'
sha2 = '0.10'
simplelog = '0.6'
serde = { features = [ 'derive' ], version = '1.0' }
ton_abi = { git = 'https://github.com/tonlabs/ever-abi.git', tag = '2.3.130' }
ton_block = { features = [ 'gosh' ], git = 'https://github.com/tonlabs/ever-block.git', tag = '1.9.88' }
ton_labs_assembler = { features = [ 'gosh' ], git = 'https://github.com/tonlabs/ever-assembler.git', tag = '1.2.130' }
ton_types = { git = 'https://github.com/tonlabs/ever-types.git', tag = '2.0.18' }
ton_vm = { features = [ 'gosh' ], git = 'https://github.com/tonlabs/ever-vm.git', tag = '1.8.190' }
ton_abi = { git = 'https://github.com/tonlabs/ever-abi.git', tag = '2.3.134' }
ton_block = { features = [ 'gosh' ], git = 'https://github.com/tonlabs/ever-block.git', tag = '1.9.92' }
ton_labs_assembler = { features = [ 'gosh' ], git = 'https://github.com/tonlabs/ever-assembler.git', tag = '1.2.132' }
ton_types = { git = 'https://github.com/tonlabs/ever-types.git', tag = '2.0.20' }
ton_vm = { features = [ 'gosh' ], git = 'https://github.com/tonlabs/ever-vm.git', tag = '1.8.195' }

[dev-dependencies]
assert_cmd = '2.0.5'
Expand Down
8 changes: 4 additions & 4 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,25 @@ fn main() {
let mut build_time = String::from("Unknown");

let branch = Command::new("git")
.args(&["rev-parse", "--abbrev-ref", "HEAD"])
.args(["rev-parse", "--abbrev-ref", "HEAD"])
.output();
if let Ok(branch) = branch {
git_branch = from_utf8(branch.stdout);
}

let last = Command::new("git").args(&["rev-parse", "HEAD"]).output();
let last = Command::new("git").args(["rev-parse", "HEAD"]).output();
if let Ok(last) = last {
git_commit = from_utf8(last.stdout);
}

let time = Command::new("git")
.args(&["log", "-1", "--date=iso", "--pretty=format:%cd"])
.args(["log", "-1", "--date=iso", "--pretty=format:%cd"])
.output();
if let Ok(time) = time {
commit_date = from_utf8(time.stdout);
}

let b_time = Command::new("date").args(&["+%Y-%m-%d %T %z"]).output();
let b_time = Command::new("date").args(["+%Y-%m-%d %T %z"]).output();
if let Ok(b_time) = b_time {
build_time = from_utf8(b_time.stdout);
}
Expand Down
5 changes: 2 additions & 3 deletions src/disasm/codedict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ impl Code {
process(code);
for insn in code.iter_mut() {
for param in insn.params_mut() {
match param {
InstructionParameter::Code { code: ref mut inner, cell: _ } => stack.push(inner),
_ => ()
if let InstructionParameter::Code { code: ref mut inner, cell: _ } = param {
stack.push(inner)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/disasm/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use std::{collections::HashMap, slice::ChunksMut};
use ton_types::{Cell, Result, /*Bitmask,*/ SliceData, fail};

#[derive(Debug, Clone)]
#[derive(Debug, Default, Clone)]
pub struct Code {
storage: Vec<Instruction>
}
Expand Down
8 changes: 4 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ use resolver::resolve_name;
use testcall::{call_contract, MsgInfo, TestCallParams, TraceLevel};
use disasm::commands::disasm_command;

const DEFAULT_CAPABILITIES:u64 = 0x880116ae; // Default capabilities on the main network
const DEFAULT_CAPABILITIES: u64 = 0x880116ae; // Default capabilities on the main network

fn main() -> std::result::Result<(), i32> {
linker_main().map_err(|err_str| {
Expand Down Expand Up @@ -257,7 +257,7 @@ fn linker_main() -> Status {
let cell = compile_code_to_cell(code.as_str())
.map_err(|e| format_err!("failed to assemble: {}", e))?;
let bytes = ton_types::write_boc(&cell)?;
let mut file = File::create(&output).unwrap();
let mut file = File::create(output).unwrap();
file.write_all(&bytes)?;
return Ok(())
}
Expand Down Expand Up @@ -389,7 +389,7 @@ fn replace_command(matches: &ArgMatches) -> Status {
}
Err(_) => {
let data = std::fs::read(path)?;
ton_types::read_boc(&data)?.withdraw_single_root()?
ton_types::read_boc(data)?.withdraw_single_root()?
}
};

Expand Down Expand Up @@ -587,7 +587,7 @@ fn run_test_subcmd(matches: &ArgMatches) -> Status {
} else {
format!("{}.tvc", input)
};
let addr = MsgAddressInt::from_str(&address)?;
let addr = MsgAddressInt::from_str(address)?;
let state_init = load_from_file(&input)?;
let config_cell_opt = matches.value_of("CONFIG").and_then(testcall::load_config);

Expand Down
2 changes: 1 addition & 1 deletion src/methdict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl Program {
}
let id = key.clone().get_next_i32()
.map_err(|e| (pair.0.clone(), format!("Failed to decode data: {}", e)))?;
if adjust_entry_points || id < -2 || id > 0 {
if adjust_entry_points || !(-2..=0).contains(&id) {
let before = val.0;
let after = map.get(key)
.map_err(|e| (pair.0.clone(), format!("Failed to find key: {}", e)))?
Expand Down
8 changes: 4 additions & 4 deletions src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ impl ParseEngine {
for (_, func) in self.internal_id_to_code.iter_mut() {
Self::compat_rename_macro_calls(&mut func.body);
}
for (_, lines) in &mut self.macro_name_to_lines {
for lines in &mut self.macro_name_to_lines.values_mut() {
Self::compat_rename_macro_calls(lines);
}
Ok(())
Expand Down Expand Up @@ -985,15 +985,15 @@ impl ParseEngine {
pers_dict.data().cloned()
}

fn encode_computed_cell(&self, cell: &Cell, toplevel: bool) -> Lines {
fn encode_computed_cell(cell: &Cell, toplevel: bool) -> Lines {
let slice = SliceData::load_cell(cell.clone()).unwrap();
let mut lines = vec!();
let opening = if toplevel { "{\n" } else { ".cell {\n" };
lines.push(Line::new(opening, "", 0));
lines.push(Line::new(format!(".blob x{}\n", slice.to_hex_string()).as_str(), "", 0));
for i in slice.get_references() {
let child = cell.reference(i).unwrap();
let mut child_lines = self.encode_computed_cell(&child, false);
let mut child_lines = Self::encode_computed_cell(&child, false);
lines.append(&mut child_lines);
}
lines.push(Line::new("}\n", "", 0));
Expand Down Expand Up @@ -1036,7 +1036,7 @@ impl ParseEngine {
};

let cell = engine.stack().get(0).as_cell().map_err(|e| format_err!("{}: {}", name, e))?;
let res = self.encode_computed_cell(cell, true);
let res = Self::encode_computed_cell(cell, true);
self.computed.insert(String::from(name), res.clone());
Ok(res)
}
Expand Down
4 changes: 2 additions & 2 deletions src/printer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub fn tree_of_cells_into_base64(root_cell: Option<&Cell>) -> String {
match root_cell {
Some(cell) => {
match write_boc(cell) {
Ok(bytes) => base64::encode(&bytes),
Ok(bytes) => base64::encode(bytes),
Err(_) => "None".to_string()
}
}
Expand Down Expand Up @@ -84,7 +84,7 @@ pub fn msg_printer(msg: &Message) -> Result<String> {
.map(|slice| slice.into_cell())
.as_ref(),
),
base64::encode(&bytes),
base64::encode(bytes),
))
}

Expand Down
6 changes: 4 additions & 2 deletions src/testcall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use ton_vm::{
stack::{StackItem, Stack, savelist::SaveList, integer::IntegerData},
SmartContractInfo,
};
use ton_types::{AccountId, BuilderData, Cell, SliceData, Result, Status};
use ton_types::{AccountId, BuilderData, Cell, SliceData, Result, Status, HashmapE};
use ton_block::{
CurrencyCollection, Deserializable, ExternalInboundMessageHeader, Grams,
InternalMessageHeader, Message, MsgAddressExt, MsgAddressInt, OutAction,
Expand Down Expand Up @@ -410,11 +410,13 @@ pub fn call_contract<F>(
Gas::test()
};

let library_map = HashmapE::with_hashmap(256, state_init.library.root().cloned());

println!("Engine capabilities: {}", params.capabilities);
let mut engine = Engine::with_capabilities(
params.capabilities
).setup_with_libraries(
code, Some(registers), Some(stack), Some(gas), vec![]
code, Some(registers), Some(stack), Some(gas), vec!(library_map)
);
engine.set_trace(0);
let debug_info = params.debug_info;
Expand Down

0 comments on commit 266b361

Please sign in to comment.