Skip to content

Commit

Permalink
move runtime-wasm into graph
Browse files Browse the repository at this point in the history
  • Loading branch information
mangas committed Nov 20, 2023
1 parent 2e99c23 commit 8d52ee4
Show file tree
Hide file tree
Showing 59 changed files with 186 additions and 262 deletions.
45 changes: 8 additions & 37 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion chain/arweave/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ prost-types = { workspace = true }
serde = "1.0"
sha2 = "0.10.7"

graph-runtime-wasm = { path = "../../runtime/wasm" }
graph-runtime-derive = { path = "../../runtime/derive" }

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion chain/arweave/src/runtime/abi.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::codec;
use crate::trigger::TransactionWithBlockPtr;
use graph::runtime::gas::GasCounter;
use graph::runtime::wasm::asc_abi::class::{Array, Uint8Array};
use graph::runtime::{asc_new, AscHeap, AscPtr, HostExportError, ToAscObj};
use graph_runtime_wasm::asc_abi::class::{Array, Uint8Array};

pub(crate) use super::generated::*;

Expand Down
2 changes: 1 addition & 1 deletion chain/arweave/src/runtime/generated.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use graph::runtime::wasm::asc_abi::class::{Array, AscString, Uint8Array};
use graph::runtime::{AscIndexId, AscPtr, AscType, DeterministicHostError, IndexForAscTypeId};
use graph::semver::Version;
use graph_runtime_derive::AscType;
use graph_runtime_wasm::asc_abi::class::{Array, AscString, Uint8Array};

#[repr(C)]
#[derive(AscType, Default)]
Expand Down
2 changes: 1 addition & 1 deletion chain/arweave/src/trigger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ use graph::prelude::web3::types::H256;
use graph::prelude::BlockNumber;
use graph::runtime::asc_new;
use graph::runtime::gas::GasCounter;
use graph::runtime::wasm::module::ToAscPtr;
use graph::runtime::AscHeap;
use graph::runtime::AscPtr;
use graph::runtime::HostExportError;
use graph_runtime_wasm::module::ToAscPtr;
use std::{cmp::Ordering, sync::Arc};

use crate::codec;
Expand Down
3 changes: 1 addition & 2 deletions chain/cosmos/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "graph-chain-cosmos"
version.workspace = true
edition = "2018"
edition.workspace = true

[build-dependencies]
tonic-build = { workspace = true }
Expand All @@ -15,5 +15,4 @@ serde = "1.0"
anyhow = "1.0"
semver = "1.0.20"

graph-runtime-wasm = { path = "../../runtime/wasm" }
graph-runtime-derive = { path = "../../runtime/derive" }
2 changes: 1 addition & 1 deletion chain/cosmos/src/protobuf/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#[path = "sf.cosmos.r#type.v1.rs"]
pub mod pbcodec;

pub use graph_runtime_wasm::asc_abi::class::{Array, AscEnum, AscString, Uint8Array};
pub use graph::runtime::wasm::asc_abi::class::{Array, AscEnum, AscString, Uint8Array};

pub use crate::runtime::abi::*;
pub use pbcodec::*;
4 changes: 2 additions & 2 deletions chain/cosmos/src/runtime/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl ToAscObj<AscBytesArray> for Vec<Vec<u8>> {
) -> Result<AscBytesArray, HostExportError> {
let content: Result<Vec<_>, _> = self
.iter()
.map(|x| asc_new(heap, &graph_runtime_wasm::asc_abi::class::Bytes(x), gas))
.map(|x| asc_new(heap, &graph::runtime::wasm::asc_abi::class::Bytes(x), gas))
.collect();

Ok(AscBytesArray(Array::new(&content?, heap, gas)?))
Expand Down Expand Up @@ -58,7 +58,7 @@ impl ToAscObj<AscAny> for prost_types::Any {
type_url: asc_new(heap, &self.type_url, gas)?,
value: asc_new(
heap,
&graph_runtime_wasm::asc_abi::class::Bytes(&self.value),
&graph::runtime::wasm::asc_abi::class::Bytes(&self.value),
gas,
)?,
..Default::default()
Expand Down
2 changes: 1 addition & 1 deletion chain/cosmos/src/trigger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use std::{cmp::Ordering, sync::Arc};
use graph::blockchain::{Block, BlockHash, MappingTriggerTrait, TriggerData};
use graph::cheap_clone::CheapClone;
use graph::prelude::{BlockNumber, Error};
use graph::runtime::wasm::module::ToAscPtr;
use graph::runtime::HostExportError;
use graph::runtime::{asc_new, gas::GasCounter, AscHeap, AscPtr};
use graph_runtime_wasm::module::ToAscPtr;

use crate::codec;
use crate::data_source::EventOrigin;
Expand Down
1 change: 0 additions & 1 deletion chain/ethereum/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ semver = "1.0.20"

itertools = "0.11.0"

graph-runtime-wasm = { path = "../../runtime/wasm" }
graph-runtime-derive = { path = "../../runtime/derive" }

[dev-dependencies]
Expand Down
8 changes: 4 additions & 4 deletions chain/ethereum/src/runtime/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ use super::runtime_adapter::UnresolvedContractCall;
use crate::trigger::{
EthereumBlockData, EthereumCallData, EthereumEventData, EthereumTransactionData,
};
use graph::runtime::wasm::asc_abi::class::{
Array, AscAddress, AscBigInt, AscEnum, AscH160, AscString, AscWrapped, EthereumValueKind,
Uint8Array,
};
use graph::{
prelude::{
ethabi,
Expand All @@ -14,10 +18,6 @@ use graph::{
},
};
use graph_runtime_derive::AscType;
use graph_runtime_wasm::asc_abi::class::{
Array, AscAddress, AscBigInt, AscEnum, AscH160, AscString, AscWrapped, EthereumValueKind,
Uint8Array,
};
use semver::Version;

type AscH256 = Uint8Array;
Expand Down
2 changes: 1 addition & 1 deletion chain/ethereum/src/runtime/runtime_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use anyhow::{Context, Error};
use blockchain::HostFn;
use graph::blockchain::ChainIdentifier;
use graph::runtime::gas::Gas;
use graph::runtime::wasm::asc_abi::class::{AscEnumArray, EthereumValueKind};
use graph::runtime::{AscIndexId, IndexForAscTypeId};
use graph::{
blockchain::{self, BlockPtr, HostFnCtx},
Expand All @@ -22,7 +23,6 @@ use graph::{
semver::Version,
slog::{info, trace, Logger},
};
use graph_runtime_wasm::asc_abi::class::{AscEnumArray, EthereumValueKind};

use super::abi::{AscUnresolvedContractCall, AscUnresolvedContractCall_0_0_4};

Expand Down
2 changes: 1 addition & 1 deletion chain/ethereum/src/trigger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ use graph::prelude::BlockPtr;
use graph::prelude::{CheapClone, EthereumCall};
use graph::runtime::asc_new;
use graph::runtime::gas::GasCounter;
use graph::runtime::wasm::module::ToAscPtr;
use graph::runtime::AscHeap;
use graph::runtime::AscPtr;
use graph::runtime::HostExportError;
use graph::semver::Version;
use graph_runtime_wasm::module::ToAscPtr;
use std::convert::TryFrom;
use std::ops::Deref;
use std::{cmp::Ordering, sync::Arc};
Expand Down
1 change: 0 additions & 1 deletion chain/near/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ prost-types = { workspace = true }
serde = "1.0"
anyhow = "1"

graph-runtime-wasm = { path = "../../runtime/wasm" }
graph-runtime-derive = { path = "../../runtime/derive" }

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion chain/near/src/runtime/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use crate::codec;
use crate::trigger::ReceiptWithOutcome;
use graph::anyhow::anyhow;
use graph::runtime::gas::GasCounter;
use graph::runtime::wasm::asc_abi::class::{Array, AscEnum, EnumPayload, Uint8Array};
use graph::runtime::{asc_new, AscHeap, AscPtr, DeterministicHostError, HostExportError, ToAscObj};
use graph_runtime_wasm::asc_abi::class::{Array, AscEnum, EnumPayload, Uint8Array};

pub(crate) use super::generated::*;

Expand Down
2 changes: 1 addition & 1 deletion chain/near/src/runtime/generated.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use graph::runtime::wasm::asc_abi::class::{Array, AscBigInt, AscEnum, AscString, Uint8Array};
use graph::runtime::{
AscIndexId, AscPtr, AscType, AscValue, DeterministicHostError, IndexForAscTypeId,
};
use graph::semver::Version;
use graph_runtime_derive::AscType;
use graph_runtime_wasm::asc_abi::class::{Array, AscBigInt, AscEnum, AscString, Uint8Array};

pub(crate) type AscCryptoHash = Uint8Array;
pub(crate) type AscAccountId = AscString;
Expand Down
2 changes: 1 addition & 1 deletion chain/near/src/trigger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use graph::cheap_clone::CheapClone;
use graph::prelude::hex;
use graph::prelude::web3::types::H256;
use graph::prelude::BlockNumber;
use graph::runtime::wasm::module::ToAscPtr;
use graph::runtime::HostExportError;
use graph::runtime::{asc_new, gas::GasCounter, AscHeap, AscPtr};
use graph_runtime_wasm::module::ToAscPtr;
use std::{cmp::Ordering, sync::Arc};

use crate::codec;
Expand Down
1 change: 0 additions & 1 deletion chain/starknet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@ serde = "1.0"
sha3 = "0.10.8"
starknet-ff = "0.3.4"

graph-runtime-wasm = { path = "../../runtime/wasm" }
graph-runtime-derive = { path = "../../runtime/derive" }
2 changes: 1 addition & 1 deletion chain/starknet/src/runtime/abi.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use graph::runtime::wasm::asc_abi::class::{Array, AscEnum, EnumPayload};
use graph::{
prelude::BigInt,
runtime::{asc_new, gas::GasCounter, AscHeap, HostExportError, ToAscObj},
};
use graph_runtime_wasm::asc_abi::class::{Array, AscEnum, EnumPayload};

use crate::{
codec,
Expand Down
2 changes: 1 addition & 1 deletion chain/starknet/src/runtime/generated.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use graph::runtime::wasm::asc_abi::class::{Array, AscBigInt, AscEnum, Uint8Array};
use graph::runtime::{
AscIndexId, AscPtr, AscType, AscValue, DeterministicHostError, IndexForAscTypeId,
};
use graph::semver::Version;
use graph_runtime_derive::AscType;
use graph_runtime_wasm::asc_abi::class::{Array, AscBigInt, AscEnum, Uint8Array};

pub struct AscBytesArray(pub(crate) Array<AscPtr<Uint8Array>>);

Expand Down
2 changes: 1 addition & 1 deletion chain/starknet/src/trigger.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use graph::runtime::wasm::module::ToAscPtr;
use graph::{
blockchain::{MappingTriggerTrait, TriggerData},
runtime::{asc_new, gas::GasCounter, AscPtr, HostExportError},
};
use graph_runtime_wasm::module::ToAscPtr;
use starknet_ff::FieldElement;
use std::{cmp::Ordering, sync::Arc};

Expand Down
1 change: 0 additions & 1 deletion chain/substreams/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ futures = "0.1.21"
http = "0.2.4"
jsonrpc-core = "18.0.0"
graph = { path = "../../graph" }
graph-runtime-wasm = { path = "../../runtime/wasm" }
lazy_static = "1.2.0"
serde = "1.0"
prost = { workspace = true }
Expand Down
Loading

0 comments on commit 8d52ee4

Please sign in to comment.