From 058b2b477fc5986654cc825cb31f5a874f347910 Mon Sep 17 00:00:00 2001 From: NanezX Date: Sat, 16 Dec 2023 20:41:53 -0400 Subject: [PATCH] assert queries for expression deployer --- subgraph/tests/entities.rs | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/subgraph/tests/entities.rs b/subgraph/tests/entities.rs index 04c528158..bc29e40fb 100644 --- a/subgraph/tests/entities.rs +++ b/subgraph/tests/entities.rs @@ -1,4 +1,7 @@ -use utils::setup::get_deployer; +use ethers::{types::Bytes, utils::keccak256}; +use generated::RAINTERPRETEREXPRESSIONDEPLOYER_BYTECODE; +use utils::deploy::get_deployer_construction_meta; +use utils::setup::{get_deployer, get_extrospection}; use utils::subgraph; mod generated; @@ -8,12 +11,39 @@ mod utils; #[test] async fn test_deployer() -> anyhow::Result<()> { let deployer = get_deployer().await?; - subgraph::wait().await?; - let response = subgraph::Query::expression_deployer(&deployer.address()).await?; + let constructor_meta = get_deployer_construction_meta()?; + let extrospection = get_extrospection().await?; + assert_eq!(response.id, deployer.address()); + assert_eq!(response.interpreter, deployer.i_interpreter().call().await?); + assert_eq!(response.store, deployer.i_store().call().await?); + assert_eq!(response.parser, deployer.i_parser().call().await?); + assert_eq!(response.constructor_meta, constructor_meta); + assert_eq!( + response.constructor_meta_hash, + Bytes::from(keccak256(constructor_meta)) + ); + assert_eq!(response.bytecode, RAINTERPRETEREXPRESSIONDEPLOYER_BYTECODE); + assert_eq!( + response.bytecode_hash, + Bytes::from(keccak256(&RAINTERPRETEREXPRESSIONDEPLOYER_BYTECODE)) + ); + assert_eq!( + response.deployed_bytecode, + extrospection.bytecode(deployer.address()).call().await? + ); + assert_eq!( + response.deployed_bytecode_hash, + Bytes::from( + extrospection + .bytecode_hash(deployer.address()) + .call() + .await? + ) + ); Ok(()) }