Skip to content

Commit

Permalink
Mock gas table in TestClient
Browse files Browse the repository at this point in the history
  • Loading branch information
grarco committed Mar 31, 2023
1 parent 8103c26 commit beb5dbe
Showing 1 changed file with 2 additions and 33 deletions.
35 changes: 2 additions & 33 deletions shared/src/ledger/queries/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,39 +197,8 @@ mod testing {
// Initialize the `TestClient`
let mut wl_storage = TestWlStorage::default();

// Initialize gas table
let checksums: BTreeMap<String, String> = serde_json::from_slice(
&std::fs::read("../wasm/checksums.json").unwrap(),
)
.unwrap();

let gas_file: BTreeMap<String, u64> = serde_json::from_slice(
&std::fs::read("../wasm/gas.json").unwrap(),
)
.unwrap();

let mut gas_table = BTreeMap::<String, u64>::new();

for id in checksums.keys().chain(gas_file.keys()){
// Get tx/vp hash (or name if native)
let hash = match checksums.get(id.as_str()) {
Some(v) => {
v
.split_once('.')
.unwrap()
.1
.split_once('.')
.unwrap()
.0.to_owned()
}
None => {
id.to_owned()
}
};
let gas = gas_file.get(id).unwrap_or(&1_000).to_owned();
gas_table.insert(hash, gas);
}

// Initialize mock gas table and gas limit
let gas_table: BTreeMap<String, u64> = BTreeMap::default();
let gas_table_key =
namada_core::ledger::parameters::storage::get_gas_table_storage_key();
wl_storage
Expand Down

0 comments on commit beb5dbe

Please sign in to comment.