From 9bb550e9938f48c80ec88ed03296eab2f48746fe Mon Sep 17 00:00:00 2001 From: Michael Birch Date: Wed, 27 Jul 2022 16:22:56 +0200 Subject: [PATCH] Fix compilation --- engine-precompiles/src/xcc.rs | 11 ++++++----- engine/src/engine.rs | 4 ++-- engine/src/lib.rs | 3 ++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/engine-precompiles/src/xcc.rs b/engine-precompiles/src/xcc.rs index 7a62b9fa1..29b77f64b 100644 --- a/engine-precompiles/src/xcc.rs +++ b/engine-precompiles/src/xcc.rs @@ -5,12 +5,11 @@ use crate::{Context, EvmPrecompileResult, Precompile, PrecompileOutput}; use aurora_engine_sdk::io::IO; -use aurora_engine_types::types::EthGas; +use aurora_engine_types::{types::EthGas, vec, Cow}; use evm_core::ExitError; -use std::borrow::Cow; mod costs { - use crate::prelude::types::{EthGas, NearGas}; + use crate::prelude::types::EthGas; // TODO(#483): Determine the correct amount of gas pub(super) const CROSS_CONTRACT_CALL: EthGas = EthGas::new(0); @@ -38,7 +37,7 @@ pub mod cross_contract_call { } impl Precompile for CrossContractCall { - fn required_gas(input: &[u8]) -> Result { + fn required_gas(_input: &[u8]) -> Result { Ok(costs::CROSS_CONTRACT_CALL) } @@ -55,9 +54,11 @@ impl Precompile for CrossContractCall { } } - // It's not allowed to call cross contract call precompile in static mode + // It's not allowed to call cross contract call precompile in static or delegate mode if is_static { return Err(ExitError::Other(Cow::from("ERR_INVALID_IN_STATIC"))); + } else if context.address != cross_contract_call::ADDRESS.raw() { + return Err(ExitError::Other(Cow::from("ERR_INVALID_IN_DELEGATE"))); } Ok(PrecompileOutput { diff --git a/engine/src/engine.rs b/engine/src/engine.rs index ffa120f7a..36fe17f3a 100644 --- a/engine/src/engine.rs +++ b/engine/src/engine.rs @@ -679,11 +679,11 @@ impl<'env, I: IO + Copy, E: Env> Engine<'env, I, E> { status.into_result(result) } - pub fn factory_propose(&mut self, code: Vec) -> H256 { + pub fn factory_propose(&mut self, _code: Vec) -> H256 { todo!(); // Store proposal in state. Return hash of the proposal. } - pub fn factory_accept(&mut self, hash: H256) -> bool { + pub fn factory_accept(&mut self, _hash: H256) -> bool { todo!(); // Find proposal, check it can only be called by admin. Update default contract and bump version. } diff --git a/engine/src/lib.rs b/engine/src/lib.rs index 7949a11fb..040546e87 100644 --- a/engine/src/lib.rs +++ b/engine/src/lib.rs @@ -95,6 +95,7 @@ mod contract { use aurora_engine_sdk::io::{StorageIntermediate, IO}; use aurora_engine_sdk::near_runtime::{Runtime, ViewEnv}; use aurora_engine_sdk::promise::PromiseHandler; + use aurora_engine_types::Vec; #[cfg(feature = "integration-test")] use crate::prelude::NearGas; @@ -350,7 +351,7 @@ mod contract { let io = Runtime; let proxy_bytecode_hash = io.read_input_arr32().sdk_unwrap(); - let mut state = engine::get_state(&io).sdk_unwrap(); + let state = engine::get_state(&io).sdk_unwrap(); let predecessor_account_id = io.predecessor_account_id(); require_owner_only(&state, &predecessor_account_id);