Skip to content

Commit f1626ef

Browse files
chore: benches and test
1 parent 19673ea commit f1626ef

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

target_chains/ethereum/sdk/stylus/benches/src/proxy_calls.rs renamed to target_chains/ethereum/sdk/stylus/benches/src/extend_pyth.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use crate::{
1717

1818
sol!(
1919
#[sol(rpc)]
20-
contract ProxyCall{
20+
contract ExtendPyth{
2121
function getPriceUnsafe(bytes32 id) external returns (uint8[] price);
2222
function getEmaPriceUnsafe(bytes32 id) external returns (uint8[] price);
2323
function getPriceNoOlderThan(bytes32 id, uint age) external returns (uint8[] price);
@@ -26,16 +26,18 @@ sol!(
2626
function getValidTimePeriod() external returns (uint256 period);
2727
function updatePriceFeeds(bytes[] calldata updateData) external payable;
2828
function updatePriceFeedsIfNecessary(bytes[] calldata updateData, bytes32[] calldata priceIds, uint64[] calldata publishTimes) external payable;
29+
30+
function getData() external returns (uint[] calldata data);
2931
}
3032
);
3133

32-
sol!("../examples/proxy-calls/src/constructor.sol");
34+
sol!("../examples/extend-pyth-example/src/constructor.sol");
3335

3436
pub async fn bench() -> eyre::Result<ContractReport> {
3537
let reports = run_with(CacheOpt::None).await?;
3638
let report = reports
3739
.into_iter()
38-
.try_fold(ContractReport::new("ProxyCalls"), ContractReport::add)?;
40+
.try_fold(ContractReport::new("ExtendPyth"), ContractReport::add)?;
3941

4042
let cached_reports = run_with(CacheOpt::Bid(0)).await?;
4143
let report = cached_reports
@@ -57,7 +59,7 @@ pub async fn run_with(
5759

5860
let contract_addr = deploy(&alice, cache_opt).await?;
5961

60-
let contract = ProxyCall::new(contract_addr, &alice_wallet);
62+
let contract = ExtendPyth::new(contract_addr, &alice_wallet);
6163
let id = keccak_const::Keccak256::new().update(b"ETH").finalize().to_vec();
6264
let id = TypeFixedBytes::<32>::from_slice(&id);
6365
let time_frame = uint!(10000_U256);
@@ -74,7 +76,7 @@ pub async fn run_with(
7476
let _ = receipt!(contract.updatePriceFeeds(data.clone()))?;
7577

7678
// IMPORTANT: Order matters!
77-
use ProxyCall::*;
79+
use ExtendPyth::*;
7880
#[rustfmt::skip]
7981
let receipts = vec![
8082
(getPriceUnsafeCall::SIGNATURE, receipt!(contract.getPriceUnsafe(id))?),
@@ -97,7 +99,7 @@ async fn deploy(
9799
) -> eyre::Result<Address> {
98100
let pyth_addr = env("MOCK_PYTH_ADDRESS")?;
99101
let address = Address::from_str(&pyth_addr)?;
100-
let args = ProxyCallsExample::constructorCall { _pythAddress: address };
102+
let args = ExtendPythExample::constructorCall { _pythAddress: address };
101103
let args = alloy::hex::encode(args.abi_encode());
102-
crate::deploy(account, "proxy-calls", Some(args), cache_opt).await
104+
crate::deploy(account, "extend-pyth", Some(args), cache_opt).await
103105
}

target_chains/ethereum/sdk/stylus/benches/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use eyre::WrapErr;
1313
use koba::config::{Deploy, Generate, PrivateKey};
1414
use serde::Deserialize;
1515

16-
pub mod proxy_calls;
16+
pub mod extend_pyth;
1717
pub mod report;
1818

1919
#[derive(Debug, Deserialize)]

target_chains/ethereum/sdk/stylus/benches/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
use benches::{proxy_calls, report::BenchmarkReport};
1+
use benches::{extend_pyth, report::BenchmarkReport};
22
use futures::FutureExt;
33

44
#[tokio::main]
55
async fn main() -> eyre::Result<()> {
66
let report = futures::future::try_join_all([
7-
proxy_calls::bench().boxed(),
7+
extend_pyth::bench().boxed(),
88
])
99
.await?
1010
.into_iter()

0 commit comments

Comments
 (0)