Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 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/ethereum/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ serde = { workspace = true }
prost = { workspace = true }
prost-types = { workspace = true }
anyhow = "1.0"
tiny-keccak = "1.5.0"
hex = "0.4.3"
semver = { workspace = true }
thiserror = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion chain/ethereum/src/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use graph::data_source::common::ContractCall;
use graph::firehose::CallToFilter;
use graph::firehose::CombinedFilter;
use graph::firehose::LogFilter;
use graph::prelude::alloy::primitives::keccak256;
use graph::prelude::alloy::primitives::{Address, B256};
use graph::prelude::alloy::rpc::types::Log;
use graph::prelude::alloy::transports::{RpcError, TransportErrorKind};
Expand All @@ -19,7 +20,6 @@ use std::cmp;
use std::collections::{HashMap, HashSet};
use std::fmt;
use thiserror::Error;
use tiny_keccak::keccak256;

use graph::prelude::*;
use graph::{
Expand Down
2 changes: 1 addition & 1 deletion chain/ethereum/src/call_helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ fn is_rpc_revert_message(message: &str) -> bool {

/// Decode a Solidity revert(reason) payload, returning the reason string when possible.
fn as_solidity_revert_reason(bytes: &[u8]) -> Option<String> {
let selector = &tiny_keccak::keccak256(b"Error(string)")[..4];
let selector = &graph::prelude::alloy::primitives::keccak256(b"Error(string)")[..4];
if bytes.len() >= 4 && &bytes[..4] == selector {
abi::DynSolType::String
.abi_decode(&bytes[4..])
Expand Down
10 changes: 2 additions & 8 deletions chain/ethereum/src/data_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use graph::env::ENV_VARS;
use graph::futures03::TryStreamExt;
use graph::futures03::future::try_join;
use graph::futures03::stream::FuturesOrdered;
use graph::prelude::alloy::primitives::keccak256;
use graph::prelude::alloy::{
consensus::{TxEnvelope, TxLegacy},
network::TransactionResponse,
Expand All @@ -37,7 +38,6 @@ use std::num::NonZeroU32;
use std::str::FromStr;
use std::sync::Arc;
use std::time::{Duration, Instant};
use tiny_keccak::{Keccak, keccak256};

use graph::{
blockchain::{self, Blockchain},
Expand Down Expand Up @@ -1589,13 +1589,7 @@ impl MappingEventHandler {

/// Hashes a string to a B256 hash.
fn string_to_b256(s: &str) -> B256 {
let mut result = [0u8; 32];
let data = s.replace(' ', "").into_bytes();
let mut sponge = Keccak::new_keccak256();
sponge.update(&data);
sponge.finalize(&mut result);

B256::from_slice(&result)
keccak256(s.replace(' ', "").as_bytes())
}

#[derive(Clone, Debug, Default, Hash, Eq, PartialEq, Deserialize)]
Expand Down
2 changes: 1 addition & 1 deletion core/src/subgraph/context/instance/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ where
};

let mapping_request_sender = {
let module_hash = tiny_keccak::keccak256(module_bytes.as_ref());
let module_hash = alloy::primitives::keccak256(module_bytes.as_ref()).0;
if let Some(sender) = self.module_cache.get(&module_hash) {
sender.clone()
} else {
Expand Down
1 change: 0 additions & 1 deletion graph/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ slog-async = "2.5.0"
slog-envlogger = "2.1.0"
slog-term = "2.7.0"
petgraph = "0.8.3"
tiny-keccak = "1.5.0"
tokio = { workspace = true}
tokio-stream = { workspace = true }
tokio-retry = { workspace = true }
Expand Down
3 changes: 2 additions & 1 deletion graph/src/components/subgraph/proof_of_indexing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ mod tests {
// return the same result.
check_for_child_errors(&case.data).expect("Found child errors");

let offline_fast = tiny_keccak::keccak256(&fast_stable_hash(&case.data).to_le_bytes());
let offline_fast =
alloy::primitives::keccak256(fast_stable_hash(&case.data).to_le_bytes()).0;
let offline_legacy = stable_hash_legacy::<SetHasher, _>(&case.data);

for (version, offline, hardcoded) in [
Expand Down
2 changes: 1 addition & 1 deletion graph/src/components/subgraph/proof_of_indexing/online.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ impl ProofOfIndexingFinisher {

match self.state {
Hashers::Legacy(legacy) => legacy.finish(),
Hashers::Fast(fast) => tiny_keccak::keccak256(&fast.finish().to_le_bytes()),
Hashers::Fast(fast) => alloy::primitives::keccak256(fast.finish().to_le_bytes()).0,
}
}
}
1 change: 0 additions & 1 deletion graph/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ pub mod prelude {
pub use std::sync::Arc;
pub use std::time::Duration;
pub use thiserror;
pub use tiny_keccak;
pub use tokio;
pub use toml;
pub use tonic;
Expand Down
2 changes: 1 addition & 1 deletion runtime/wasm/src/host_exports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ impl HostExports {
gas::DEFAULT_GAS_OP.with_args(complexity::Size, data),
"crypto_keccak_256",
)?;
Ok(tiny_keccak::keccak256(data))
Ok(alloy::primitives::keccak256(data).0)
}

pub(crate) fn big_int_plus(
Expand Down
8 changes: 4 additions & 4 deletions tests/src/fixture/ethereum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ use graph::blockchain::client::ChainClient;
use graph::blockchain::{BlockPtr, Trigger, TriggersAdapterSelector};
use graph::cheap_clone::CheapClone;
use graph::data_source::subgraph;
use graph::prelude::alloy::primitives::{Address, B256, U256};
use graph::prelude::alloy::primitives::{Address, B256, U256, keccak256};
use graph::prelude::alloy::rpc::types::BlockTransactions;
use graph::prelude::{
DeploymentHash, ENV_VARS, Entity, LightEthereumBlock, create_dummy_transaction,
create_minimal_block_for_test, tiny_keccak,
create_minimal_block_for_test,
};
use graph::schema::EntityType;
use graph_chain_ethereum::network::EthereumNetworkAdapters;
Expand Down Expand Up @@ -143,7 +143,7 @@ pub fn push_test_log(block: &mut BlockWithTriggers<Chain>, payload: impl Into<St
inner: alloy::primitives::Log {
address: Address::ZERO,
data: LogData::new_unchecked(
vec![tiny_keccak::keccak256(b"TestEvent(string)").into()],
vec![keccak256(b"TestEvent(string)")],
abi::DynSolValue::String(payload.into()).abi_encode().into(),
),
},
Expand Down Expand Up @@ -199,7 +199,7 @@ pub fn push_test_command(
inner: alloy::primitives::Log {
address: Address::ZERO,
data: LogData::new_unchecked(
vec![tiny_keccak::keccak256(b"TestEvent(string,string)").into()],
vec![keccak256(b"TestEvent(string,string)")],
abi::DynSolValue::Tuple(vec![
abi::DynSolValue::String(test_command.into()),
abi::DynSolValue::String(data.into()),
Expand Down
Loading