This repository has been archived by the owner on Aug 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* show gas usage; added some utilitary functions; * show gas usage everywhere
- Loading branch information
Showing
15 changed files
with
2,818 additions
and
2,586 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,19 @@ | ||
pub mod helpers; | ||
#[macro_use] | ||
extern crate prettytable; | ||
|
||
pub mod helpers; | ||
pub mod setup; | ||
|
||
use prettytable::Table; | ||
|
||
pub type GasResult = Vec<(String, i64)>; | ||
|
||
pub fn create_gas_table(gas_result: GasResult) -> Table { | ||
let mut table = Table::new(); | ||
table.add_row(row!["Function", "Gas"]); | ||
gas_result.iter().for_each(|(description, gas)| { | ||
table.add_row(row![description, gas]); | ||
}); | ||
|
||
table | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use cid::Cid; | ||
use fvm::machine::Manifest; | ||
use fvm_ipld_blockstore::MemoryBlockstore; | ||
use fvm_integration_tests::tester::Tester; | ||
use fvm_shared::state::StateTreeVersion; | ||
use fvm_shared::version::NetworkVersion; | ||
use fvm_integration_tests::bundle; | ||
use fvm_ipld_encoding::CborStore; | ||
use fvm_integration_tests::dummy::DummyExterns; | ||
|
||
pub fn setup_tester() -> (Tester<MemoryBlockstore, DummyExterns>, Manifest) { | ||
let bs = MemoryBlockstore::default(); | ||
let actors = std::fs::read("./builtin-actors/output/builtin-actors-devnet-wasm.car") | ||
.expect("Unable to read actor devnet file"); | ||
let bundle_root = bundle::import_bundle(&bs, &actors).unwrap(); | ||
|
||
let (manifest_version, manifest_data_cid): (u32, Cid) = | ||
bs.get_cbor(&bundle_root).unwrap().unwrap(); | ||
let manifest = Manifest::load(&bs, &manifest_data_cid, manifest_version).unwrap(); | ||
|
||
let tester = | ||
Tester::new(NetworkVersion::V18, StateTreeVersion::V5, bundle_root, bs).unwrap(); | ||
|
||
return (tester, manifest) | ||
} | ||
|
||
pub fn load_evm(path: &str) -> Vec<u8> { | ||
let wasm_path = std::env::current_dir() | ||
.unwrap() | ||
.join(path) | ||
.canonicalize() | ||
.unwrap(); | ||
let evm_hex = std::fs::read(wasm_path).expect("Unable to read file"); | ||
|
||
hex::decode(evm_hex).unwrap() | ||
} |
Oops, something went wrong.