Skip to content

Commit

Permalink
Add libs support
Browse files Browse the repository at this point in the history
  • Loading branch information
hacker-volodya committed Sep 10, 2024
1 parent d342a2b commit 869f16c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ services:
| ✅ | GetMasterchainInfoExt
| ✅ | GetConfigParams
| ✅ | GetBlockProof
| ✅ | SendMessage | no library support
| ✅ | RunSmcMethod | no proofs, no library support
| ✅ | SendMessage
| ✅ | RunSmcMethod | no proofs
| | **high priority** (toncenter)
| ⚠️ | GetShardBlockProof | block proof research in progress
| | **medium priority**
Expand Down
4 changes: 4 additions & 0 deletions src/liteserver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,7 @@ impl LiteServer {
};
let code = serialize_toc(state_init.code().ok_or(anyhow!("no code in state"))?)?;
let data = serialize_toc(state_init.data().ok_or(anyhow!("no data in state"))?)?;
let libs = state_stuff.state().libraries().write_to_bytes()?;
let mc_state = self.engine.load_state(&reference_id).await?;
let config = mc_state.shard_state_extra()?.config.config_params.write_to_bytes()?;
let balance = account.balance().and_then(|x| x.grams.as_u64()).unwrap_or(0);
Expand All @@ -757,6 +758,7 @@ impl LiteServer {
let result = EmulatorBuilder::new(&code, &data)
.with_gas_limit(1000000)
.with_c7(&req.account, now(), balance, &[0u8; 32], &config)
.with_libs(&libs)
.run_get_method(req.method_id as i32, stack);
let result = match result {
crate::tvm::TvmEmulatorRunGetMethodResult::Error(e) => return Err(anyhow!("tvm error: {:?}", e)),
Expand Down Expand Up @@ -799,12 +801,14 @@ impl LiteServer {
};
let code = serialize_toc(state_init.code().ok_or(anyhow!("no code in state"))?)?;
let data = serialize_toc(state_init.data().ok_or(anyhow!("no data in state"))?)?;
let libs = state_stuff.state().libraries().write_to_bytes()?;
let mc_state = self.engine.load_state(&reference_id).await?;
let config = mc_state.shard_state_extra()?.config.config_params.write_to_bytes()?;
let balance = acc.balance().and_then(|x| x.grams.as_u64()).unwrap_or(0);
let result = EmulatorBuilder::new(&code, &data)
.with_gas_limit(1000000)
.with_c7(&acc_id, now(), balance, &[0u8; 32], &config)
.with_libs(&libs)
.run_external(&req.body);
let result = match result {
crate::tvm::TvmEmulatorSendExternalMessageResult::Error(e) => return Err(anyhow!("tvm error: {:?}", e)),
Expand Down

0 comments on commit 869f16c

Please sign in to comment.