Skip to content

Commit

Permalink
remove redundant code from fascrypto-zk and add performane test
Browse files Browse the repository at this point in the history
  • Loading branch information
Трепачева Алина committed May 15, 2024
1 parent 2f1c7bd commit 25dbad9
Show file tree
Hide file tree
Showing 470 changed files with 26,606 additions and 17,536 deletions.
1,614 changes: 1,540 additions & 74 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ members = [
"tvm_struct",
"tvm_tl_codegen",
"tvm_types",
"tvm_vm", "vrgrth",
"tvm_vm", "tvm_tests",
]
[workspace.package]
version = "1.47.0"
Expand Down Expand Up @@ -126,6 +126,10 @@ tvm_struct = { path = "./tvm_struct" }
tvm_types = { path = "./tvm_types" }
tvm_vm = { path = "./tvm_vm" }





[workspace.dependencies.tokio-tungstenite]
# TODO: upgrade when reqwest supports http@1, tungstenite 0.20.0 is the last version which uses http@0.2
version = "<0.21.0"
5 changes: 1 addition & 4 deletions tvm_api/src/ton/accountaddress.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use serde_derive::Deserialize;
use serde_derive::Serialize;
use serde_derive::{Deserialize, Serialize};
#[derive(Debug, Default, Clone, PartialEq)]
#[doc = "TL-derived from `accountAddress`\n\n```text\naccountAddress account_address:string = AccountAddress;\n```\n"]
pub struct AccountAddress {
Expand All @@ -10,7 +9,6 @@ impl crate::BareSerialize for AccountAddress {
fn constructor(&self) -> crate::ConstructorNumber {
crate::ConstructorNumber(0x2d09bdab)
}

fn serialize_bare(&self, _ser: &mut crate::Serializer) -> crate::Result<()> {
let AccountAddress { account_address } = self;
_ser.write_bare::<crate::ton::string>(account_address)?;
Expand All @@ -27,7 +25,6 @@ impl crate::BareDeserialize for AccountAddress {
}
impl crate::IntoBoxed for AccountAddress {
type Boxed = crate::ton::AccountAddress;

fn into_boxed(self) -> crate::ton::AccountAddress {
crate::ton::AccountAddress::AccountAddress(self)
}
Expand Down
5 changes: 1 addition & 4 deletions tvm_api/src/ton/accountlist.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use serde_derive::Deserialize;
use serde_derive::Serialize;
use serde_derive::{Deserialize, Serialize};
#[derive(Debug, Default, Clone, PartialEq)]
#[doc = "TL-derived from `accountList`\n\n```text\naccountList accounts:vector<fullAccountState> = AccountList;\n```\n"]
pub struct AccountList {
Expand All @@ -11,7 +10,6 @@ impl crate::BareSerialize for AccountList {
fn constructor(&self) -> crate::ConstructorNumber {
crate::ConstructorNumber(0x783eb255)
}

fn serialize_bare(&self, _ser: &mut crate::Serializer) -> crate::Result<()> {
let AccountList { accounts } = self;
_ser . write_bare :: < crate :: ton :: vector < crate :: ton :: Bare , crate :: ton :: fullaccountstate :: FullAccountState > > (accounts) ? ;
Expand All @@ -31,7 +29,6 @@ impl crate::BareDeserialize for AccountList {
}
impl crate::IntoBoxed for AccountList {
type Boxed = crate::ton::AccountList;

fn into_boxed(self) -> crate::ton::AccountList {
crate::ton::AccountList::AccountList(self)
}
Expand Down
5 changes: 1 addition & 4 deletions tvm_api/src/ton/accountrevisionlist.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use serde_derive::Deserialize;
use serde_derive::Serialize;
use serde_derive::{Deserialize, Serialize};
#[derive(Debug, Default, Clone, PartialEq)]
#[doc = "TL-derived from `accountRevisionList`\n\n```text\naccountRevisionList revisions:vector<fullAccountState> = AccountRevisionList;\n```\n"]
pub struct AccountRevisionList {
Expand All @@ -11,7 +10,6 @@ impl crate::BareSerialize for AccountRevisionList {
fn constructor(&self) -> crate::ConstructorNumber {
crate::ConstructorNumber(0x1f6c64ca)
}

fn serialize_bare(&self, _ser: &mut crate::Serializer) -> crate::Result<()> {
let AccountRevisionList { revisions } = self;
_ser . write_bare :: < crate :: ton :: vector < crate :: ton :: Bare , crate :: ton :: fullaccountstate :: FullAccountState > > (revisions) ? ;
Expand All @@ -31,7 +29,6 @@ impl crate::BareDeserialize for AccountRevisionList {
}
impl crate::IntoBoxed for AccountRevisionList {
type Boxed = crate::ton::AccountRevisionList;

fn into_boxed(self) -> crate::ton::AccountRevisionList {
crate::ton::AccountRevisionList::AccountRevisionList(self)
}
Expand Down
11 changes: 1 addition & 10 deletions tvm_api/src/ton/action.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use serde_derive::Deserialize;
use serde_derive::Serialize;
use serde_derive::{Deserialize, Serialize};
#[derive(Debug, Default, Clone, PartialEq)]
#[doc = "TL-derived from `actionDns`\n\n```text\nactionDns actions:vector<dns.Action> = Action;\n```\n"]
pub struct ActionDns {
Expand All @@ -10,7 +9,6 @@ impl crate::BareSerialize for ActionDns {
fn constructor(&self) -> crate::ConstructorNumber {
crate::ConstructorNumber(0x47273021)
}

fn serialize_bare(&self, _ser: &mut crate::Serializer) -> crate::Result<()> {
let ActionDns { actions } = self;
_ser.write_bare::<crate::ton::vector<crate::ton::Boxed, crate::ton::dns::Action>>(actions)?;
Expand All @@ -28,7 +26,6 @@ impl crate::BareDeserialize for ActionDns {
}
impl crate::IntoBoxed for ActionDns {
type Boxed = crate::ton::Action;

fn into_boxed(self) -> crate::ton::Action {
crate::ton::Action::ActionDns(self)
}
Expand All @@ -44,7 +41,6 @@ impl crate::BareSerialize for ActionMsg {
fn constructor(&self) -> crate::ConstructorNumber {
crate::ConstructorNumber(0x0eb67750)
}

fn serialize_bare(&self, _ser: &mut crate::Serializer) -> crate::Result<()> {
let ActionMsg { messages, allow_send_to_uninited } = self;
_ser.write_bare::<crate::ton::vector<crate::ton::Bare, crate::ton::msg::message::Message>>(
Expand All @@ -65,7 +61,6 @@ impl crate::BareDeserialize for ActionMsg {
}
impl crate::IntoBoxed for ActionMsg {
type Boxed = crate::ton::Action;

fn into_boxed(self) -> crate::ton::Action {
crate::ton::Action::ActionMsg(self)
}
Expand All @@ -80,7 +75,6 @@ impl crate::BareSerialize for ActionPchan {
fn constructor(&self) -> crate::ConstructorNumber {
crate::ConstructorNumber(0xa72dc5e1)
}

fn serialize_bare(&self, _ser: &mut crate::Serializer) -> crate::Result<()> {
let ActionPchan { action } = self;
_ser.write_boxed::<crate::ton::pchan::Action>(action)?;
Expand All @@ -97,7 +91,6 @@ impl crate::BareDeserialize for ActionPchan {
}
impl crate::IntoBoxed for ActionPchan {
type Boxed = crate::ton::Action;

fn into_boxed(self) -> crate::ton::Action {
crate::ton::Action::ActionPchan(self)
}
Expand All @@ -112,7 +105,6 @@ impl crate::BareSerialize for ActionRwallet {
fn constructor(&self) -> crate::ConstructorNumber {
crate::ConstructorNumber(0xf90237c5)
}

fn serialize_bare(&self, _ser: &mut crate::Serializer) -> crate::Result<()> {
let ActionRwallet { action } = self;
_ser.write_bare::<crate::ton::rwallet::actioninit::ActionInit>(action)?;
Expand All @@ -129,7 +121,6 @@ impl crate::BareDeserialize for ActionRwallet {
}
impl crate::IntoBoxed for ActionRwallet {
type Boxed = crate::ton::Action;

fn into_boxed(self) -> crate::ton::Action {
crate::ton::Action::ActionRwallet(self)
}
Expand Down
9 changes: 1 addition & 8 deletions tvm_api/src/ton/adnl/address/address.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use serde_derive::Deserialize;
use serde_derive::Serialize;
use serde_derive::{Deserialize, Serialize};
#[derive(Debug, Default, Clone, PartialEq)]
#[doc = "TL-derived from `adnl.address.tunnel`\n\n```text\nadnl.address.tunnel to:int256 pubkey:PublicKey = adnl.Address;\n```\n"]
pub struct Tunnel {
Expand All @@ -11,7 +10,6 @@ impl crate::BareSerialize for Tunnel {
fn constructor(&self) -> crate::ConstructorNumber {
crate::ConstructorNumber(0x092b02eb)
}

fn serialize_bare(&self, _ser: &mut crate::Serializer) -> crate::Result<()> {
let Tunnel { to, pubkey } = self;
_ser.write_bare::<crate::ton::int256>(to)?;
Expand All @@ -30,7 +28,6 @@ impl crate::BareDeserialize for Tunnel {
}
impl crate::IntoBoxed for Tunnel {
type Boxed = crate::ton::adnl::Address;

fn into_boxed(self) -> crate::ton::adnl::Address {
crate::ton::adnl::Address::Adnl_Address_Tunnel(self)
}
Expand All @@ -46,7 +43,6 @@ impl crate::BareSerialize for Udp {
fn constructor(&self) -> crate::ConstructorNumber {
crate::ConstructorNumber(0x670da6e7)
}

fn serialize_bare(&self, _ser: &mut crate::Serializer) -> crate::Result<()> {
let Udp { ip, port } = self;
_ser.write_bare::<crate::ton::int>(ip)?;
Expand All @@ -65,7 +61,6 @@ impl crate::BareDeserialize for Udp {
}
impl crate::IntoBoxed for Udp {
type Boxed = crate::ton::adnl::Address;

fn into_boxed(self) -> crate::ton::adnl::Address {
crate::ton::adnl::Address::Adnl_Address_Udp(self)
}
Expand All @@ -81,7 +76,6 @@ impl crate::BareSerialize for Udp6 {
fn constructor(&self) -> crate::ConstructorNumber {
crate::ConstructorNumber(0xe31d63fa)
}

fn serialize_bare(&self, _ser: &mut crate::Serializer) -> crate::Result<()> {
let Udp6 { ip, port } = self;
_ser.write_bare::<crate::ton::int128>(ip)?;
Expand All @@ -100,7 +94,6 @@ impl crate::BareDeserialize for Udp6 {
}
impl crate::IntoBoxed for Udp6 {
type Boxed = crate::ton::adnl::Address;

fn into_boxed(self) -> crate::ton::adnl::Address {
crate::ton::adnl::Address::Adnl_Address_Udp6(self)
}
Expand Down
2 changes: 2 additions & 0 deletions tvm_api/src/ton/adnl/address/zk_stuff
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
use serde_derive::{Deserialize, Serialize};
pub mod address;
5 changes: 1 addition & 4 deletions tvm_api/src/ton/adnl/addresslist.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use serde_derive::Deserialize;
use serde_derive::Serialize;
use serde_derive::{Deserialize, Serialize};
#[derive(Debug, Default, Clone, PartialEq)]
#[doc = "TL-derived from `adnl.addressList`\n\n```text\nadnl.addressList addrs:(vector adnl.Address) version:int reinit_date:int priority:int expire_at:int = adnl.AddressList;\n```\n"]
pub struct AddressList {
Expand All @@ -14,7 +13,6 @@ impl crate::BareSerialize for AddressList {
fn constructor(&self) -> crate::ConstructorNumber {
crate::ConstructorNumber(0x2227e658)
}

fn serialize_bare(&self, _ser: &mut crate::Serializer) -> crate::Result<()> {
let AddressList { addrs, version, reinit_date, priority, expire_at } = self;
_ser.write_bare::<crate::ton::vector<crate::ton::Boxed, crate::ton::adnl::Address>>(addrs)?;
Expand All @@ -40,7 +38,6 @@ impl crate::BareDeserialize for AddressList {
}
impl crate::IntoBoxed for AddressList {
type Boxed = crate::ton::adnl::AddressList;

fn into_boxed(self) -> crate::ton::adnl::AddressList {
crate::ton::adnl::AddressList::Adnl_AddressList(self)
}
Expand Down
5 changes: 1 addition & 4 deletions tvm_api/src/ton/adnl/config/global.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use serde_derive::Deserialize;
use serde_derive::Serialize;
use serde_derive::{Deserialize, Serialize};
#[derive(Debug, Default, Clone, PartialEq)]
#[doc = "TL-derived from `adnl.config.global`\n\n```text\nadnl.config.global static_nodes:adnl.nodes = adnl.config.Global;\n```\n"]
pub struct Global {
Expand All @@ -10,7 +9,6 @@ impl crate::BareSerialize for Global {
fn constructor(&self) -> crate::ConstructorNumber {
crate::ConstructorNumber(0xbe6f80d0)
}

fn serialize_bare(&self, _ser: &mut crate::Serializer) -> crate::Result<()> {
let Global { static_nodes } = self;
_ser.write_bare::<crate::ton::adnl::nodes::Nodes>(static_nodes)?;
Expand All @@ -27,7 +25,6 @@ impl crate::BareDeserialize for Global {
}
impl crate::IntoBoxed for Global {
type Boxed = crate::ton::adnl::config::Global;

fn into_boxed(self) -> crate::ton::adnl::config::Global {
crate::ton::adnl::config::Global::Adnl_Config_Global(self)
}
Expand Down
48 changes: 48 additions & 0 deletions tvm_api/src/ton/adnl/config/zk_stuff
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
use serde_derive::{Deserialize, Serialize};
#[derive(Debug, Clone, PartialEq)]
#[doc = "TL-derived from `adnl.config.Global`\n\n```text\nadnl.config.global static_nodes:adnl.nodes = adnl.config.Global;\n```\n"]
pub enum Global {
Adnl_Config_Global(crate::ton::adnl::config::global::Global),
}
impl Global {
pub fn static_nodes(&self) -> &crate::ton::adnl::nodes::Nodes {
match self {
Global::Adnl_Config_Global(ref x) => &x.static_nodes,
}
}
pub fn only(self) -> crate::ton::adnl::config::global::Global {
match self {
Global::Adnl_Config_Global(x) => x,
}
}
}
impl Eq for Global {}
impl Default for Global {
fn default() -> Self {
Global::Adnl_Config_Global(crate::ton::adnl::config::global::Global::default())
}
}
impl crate::BoxedSerialize for Global {
fn serialize_boxed(&self) -> (crate::ConstructorNumber, &dyn crate::BareSerialize) {
match self {
Global::Adnl_Config_Global(x) => (crate::ConstructorNumber(0xbe6f80d0), x),
}
}
}
impl crate::BoxedDeserialize for Global {
fn possible_constructors() -> Vec<crate::ConstructorNumber> {
vec![crate::ConstructorNumber(0xbe6f80d0)]
}
fn deserialize_boxed(
_id: crate::ConstructorNumber,
_de: &mut crate::Deserializer,
) -> crate::Result<Self> {
match _id {
crate::ConstructorNumber(0xbe6f80d0) => Ok(Global::Adnl_Config_Global(
_de.read_bare::<crate::ton::adnl::config::global::Global>()?,
)),
id => _invalid_id!(id),
}
}
}
pub mod global;
5 changes: 1 addition & 4 deletions tvm_api/src/ton/adnl/db/node/key.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use serde_derive::Deserialize;
use serde_derive::Serialize;
use serde_derive::{Deserialize, Serialize};
#[derive(Debug, Default, Clone, PartialEq)]
#[doc = "TL-derived from `adnl.db.node.key`\n\n```text\nadnl.db.node.key local_id:int256 peer_id:int256 = adnl.db.Key;\n```\n"]
pub struct Key {
Expand All @@ -11,7 +10,6 @@ impl crate::BareSerialize for Key {
fn constructor(&self) -> crate::ConstructorNumber {
crate::ConstructorNumber(0xc5a3e42e)
}

fn serialize_bare(&self, _ser: &mut crate::Serializer) -> crate::Result<()> {
let Key { local_id, peer_id } = self;
_ser.write_bare::<crate::ton::int256>(local_id)?;
Expand All @@ -30,7 +28,6 @@ impl crate::BareDeserialize for Key {
}
impl crate::IntoBoxed for Key {
type Boxed = crate::ton::adnl::db::Key;

fn into_boxed(self) -> crate::ton::adnl::db::Key {
crate::ton::adnl::db::Key::Adnl_Db_Node_Key(self)
}
Expand Down
5 changes: 1 addition & 4 deletions tvm_api/src/ton/adnl/db/node/value.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use serde_derive::Deserialize;
use serde_derive::Serialize;
use serde_derive::{Deserialize, Serialize};
#[derive(Debug, Default, Clone, PartialEq)]
#[doc = "TL-derived from `adnl.db.node.value`\n\n```text\nadnl.db.node.value date:int id:PublicKey addr_list:adnl.addressList priority_addr_list:adnl.addressList = adnl.db.node.Value;\n```\n"]
pub struct Value {
Expand All @@ -13,7 +12,6 @@ impl crate::BareSerialize for Value {
fn constructor(&self) -> crate::ConstructorNumber {
crate::ConstructorNumber(0x545d2707)
}

fn serialize_bare(&self, _ser: &mut crate::Serializer) -> crate::Result<()> {
let Value { date, id, addr_list, priority_addr_list } = self;
_ser.write_bare::<crate::ton::int>(date)?;
Expand All @@ -37,7 +35,6 @@ impl crate::BareDeserialize for Value {
}
impl crate::IntoBoxed for Value {
type Boxed = crate::ton::adnl::db::node::Value;

fn into_boxed(self) -> crate::ton::adnl::db::node::Value {
crate::ton::adnl::db::node::Value::Adnl_Db_Node_Value(self)
}
Expand Down
Loading

0 comments on commit 25dbad9

Please sign in to comment.