Skip to content

Commit

Permalink
query optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
harryliisme3 committed Apr 27, 2023
1 parent e14fc9a commit 4c24b2d
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/components/contracts/baseapp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ protobuf = "2.16"
ruc = "1.0"
serde = {version = "1.0.124", features = ["derive"]}
serde_json = "1.0.40"
storage = { git = "https://github.com/FindoraNetwork/storage.git", tag = "v1.1.4" }
fin_db = { git = "https://github.com/FindoraNetwork/storage.git", tag = "v1.1.4" }
storage = { git = "https://github.com/FindoraNetwork/storage.git", branch = "query_optimize" }
fin_db = { git = "https://github.com/FindoraNetwork/storage.git", branch = "query_optimize" }
sha3 = "0.8"

config = { path = "../../config"}
Expand Down
4 changes: 2 additions & 2 deletions src/components/contracts/modules/account/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ primitive-types = { version = "0.11.1", default-features = false, features = ["r
ruc = "1.0"
serde = { version = "1.0.124", features = ["derive"] }
serde_json = "1.0.64"
storage = { git = "https://github.com/FindoraNetwork/storage.git", tag = "v1.1.4" }
storage = { git = "https://github.com/FindoraNetwork/storage.git", branch = "query_optimize" }

# primitives, don't depend on any modules
fp-core = { path = "../../primitives/core" }
Expand All @@ -29,4 +29,4 @@ config = { path = "../../../config"}
rand_chacha = "0.2"
parking_lot = "0.12"
zei = { git = "https://github.com/FindoraNetwork/zei", branch = "stable-main" }
fin_db = { git = "https://github.com/FindoraNetwork/storage.git", tag = "v1.1.4" }
fin_db = { git = "https://github.com/FindoraNetwork/storage.git", branch = "query_optimize" }
4 changes: 2 additions & 2 deletions src/components/contracts/modules/ethereum/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ enterprise-web3 = { path = "../../primitives/enterprise-web3" }
baseapp = { path = "../../baseapp" }
fp-mocks = { path = "../../primitives/mocks" }
module-account = { path = "../account" }
storage = { git = "https://github.com/FindoraNetwork/storage.git", tag = "v1.1.4" }
fin_db = { git = "https://github.com/FindoraNetwork/storage.git", tag = "v1.1.4" }
storage = { git = "https://github.com/FindoraNetwork/storage.git", branch = "query_optimize" }
fin_db = { git = "https://github.com/FindoraNetwork/storage.git", branch = "query_optimize" }

[features]
default = []
Expand Down
4 changes: 2 additions & 2 deletions src/components/contracts/modules/evm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ fp-traits = { path = "../../primitives/traits" }
fp-types = { path = "../../primitives/types" }
fp-utils = { path = "../../primitives/utils" }
config = { path = "../../../config"}
storage = { git = "https://github.com/FindoraNetwork/storage.git", tag = "v1.1.4" }
fin_db = { git = "https://github.com/FindoraNetwork/storage.git", tag = "v1.1.4" }
storage = { git = "https://github.com/FindoraNetwork/storage.git", branch = "query_optimize" }
fin_db = { git = "https://github.com/FindoraNetwork/storage.git", branch = "query_optimize" }
ledger = { path = "../../../../ledger" }
enterprise-web3 = { path = "../../primitives/enterprise-web3" }

Expand Down
4 changes: 2 additions & 2 deletions src/components/contracts/primitives/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ parking_lot = "0.12"
primitive-types = { version = "0.11.1", default-features = false, features = ["rlp", "byteorder", "serde"] }
ruc = "1.0"
serde = { version = "1.0.124", features = ["derive"] }
storage = { git = "https://github.com/FindoraNetwork/storage.git", tag = "v1.1.4", optional = true }
fin_db = { git = "https://github.com/FindoraNetwork/storage.git", tag = "v1.1.4", optional = true }
storage = { git = "https://github.com/FindoraNetwork/storage.git", branch = "query_optimize", optional = true }
fin_db = { git = "https://github.com/FindoraNetwork/storage.git", branch = "query_optimize", optional = true }
serde_with = { version = "1.9.4"}

# primitives
Expand Down
4 changes: 2 additions & 2 deletions src/components/contracts/primitives/storage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ ruc = "1.0"
serde = { version = "1.0.124", features = ["derive"] }
serde_json = "1.0"
sha2 = "0.9.5"
storage = { git = "https://github.com/FindoraNetwork/storage.git", tag = "v1.1.4" }
storage = { git = "https://github.com/FindoraNetwork/storage.git", branch = "query_optimize" }

# primitives
fp-core = { path = "../core" }
config = { path = "../../../config"}

[dev-dependencies]
temp_db = { git = "https://github.com/FindoraNetwork/storage.git", tag = "v1.1.4" }
temp_db = { git = "https://github.com/FindoraNetwork/storage.git", branch = "query_optimize" }
16 changes: 14 additions & 2 deletions src/components/contracts/rpc/src/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,8 @@ impl EthApi for EthApiImpl {
ctx.header.height = block.header.number.as_u64() as i64;
ctx.header.proposer_address = Vec::from(block.header.beneficiary.as_bytes());

ctx.state.write().create_query_cache();

match to {
Some(to) => {
let call = Call {
Expand All @@ -382,7 +384,12 @@ impl EthApi for EthApiImpl {
)
.map_err(|err| {
internal_err(format!("evm runner call error: {err:?}"))
})?;
});

ctx.state.write().clear_query_cache();

let info = info?;

debug!(target: "eth_rpc", "evm runner call result: {info:?}");

error_on_execution_failure(&info.exit_reason, &info.value)?;
Expand All @@ -404,7 +411,12 @@ impl EthApi for EthApiImpl {
)
.map_err(|err| {
internal_err(format!("evm runner create error: {err:?}"))
})?;
});

ctx.state.write().clear_query_cache();

let info = info?;

debug!(target: "eth_rpc", "evm runner create result: {info:?}");

error_on_execution_failure(&info.exit_reason, &[])?;
Expand Down

0 comments on commit 4c24b2d

Please sign in to comment.