Skip to content

Commit

Permalink
Revert "Feat(Engine): Precompiles for predecessor_account_id and curr…
Browse files Browse the repository at this point in the history
…ent_account_id (#462)"

This reverts commit ff1e9d7.
  • Loading branch information
birchmd committed Mar 22, 2022
1 parent 3df9602 commit b4a767a
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 272 deletions.
124 changes: 0 additions & 124 deletions engine-precompiles/src/account_ids.rs

This file was deleted.

27 changes: 4 additions & 23 deletions engine-precompiles/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(not(feature = "std"), feature(alloc_error_handler))]

pub mod account_ids;
pub mod blake2;
pub mod bn128;
pub mod hash;
Expand All @@ -15,7 +14,6 @@ pub mod secp256k1;
#[cfg(test)]
mod utils;

use crate::account_ids::{CurrentAccount, PredecessorAccount};
use crate::blake2::Blake2F;
use crate::bn128::{Bn128Add, Bn128Mul, Bn128Pair};
use crate::hash::{RIPEMD160, SHA256};
Expand Down Expand Up @@ -126,7 +124,6 @@ impl executor::stack::PrecompileSet for Precompiles {
pub struct PrecompileConstructorContext {
pub current_account_id: AccountId,
pub random_seed: H256,
pub predecessor_account_id: AccountId,
}

impl Precompiles {
Expand All @@ -139,18 +136,14 @@ impl Precompiles {
ExitToNear::ADDRESS,
ExitToEthereum::ADDRESS,
RandomSeed::ADDRESS,
CurrentAccount::ADDRESS,
PredecessorAccount::ADDRESS,
];
let fun: prelude::Vec<Box<dyn Precompile>> = vec![
Box::new(ECRecover),
Box::new(SHA256),
Box::new(RIPEMD160),
Box::new(ExitToNear::new(ctx.current_account_id.clone())),
Box::new(ExitToEthereum::new(ctx.current_account_id.clone())),
Box::new(ExitToEthereum::new(ctx.current_account_id)),
Box::new(RandomSeed::new(ctx.random_seed)),
Box::new(CurrentAccount::new(ctx.current_account_id)),
Box::new(PredecessorAccount::new(ctx.predecessor_account_id)),
];
let map: BTreeMap<Address, Box<dyn Precompile>> = addresses.into_iter().zip(fun).collect();

Expand All @@ -171,8 +164,6 @@ impl Precompiles {
ExitToNear::ADDRESS,
ExitToEthereum::ADDRESS,
RandomSeed::ADDRESS,
CurrentAccount::ADDRESS,
PredecessorAccount::ADDRESS,
];
let fun: prelude::Vec<Box<dyn Precompile>> = vec![
Box::new(ECRecover),
Expand All @@ -184,10 +175,8 @@ impl Precompiles {
Box::new(Bn128Mul::<Byzantium>::new()),
Box::new(Bn128Pair::<Byzantium>::new()),
Box::new(ExitToNear::new(ctx.current_account_id.clone())),
Box::new(ExitToEthereum::new(ctx.current_account_id.clone())),
Box::new(ExitToEthereum::new(ctx.current_account_id)),
Box::new(RandomSeed::new(ctx.random_seed)),
Box::new(CurrentAccount::new(ctx.current_account_id)),
Box::new(PredecessorAccount::new(ctx.predecessor_account_id)),
];
let map: BTreeMap<Address, Box<dyn Precompile>> = addresses.into_iter().zip(fun).collect();

Expand All @@ -208,8 +197,6 @@ impl Precompiles {
ExitToNear::ADDRESS,
ExitToEthereum::ADDRESS,
RandomSeed::ADDRESS,
CurrentAccount::ADDRESS,
PredecessorAccount::ADDRESS,
];
let fun: prelude::Vec<Box<dyn Precompile>> = vec![
Box::new(ECRecover),
Expand All @@ -222,10 +209,8 @@ impl Precompiles {
Box::new(Bn128Pair::<Istanbul>::new()),
Box::new(Blake2F),
Box::new(ExitToNear::new(ctx.current_account_id.clone())),
Box::new(ExitToEthereum::new(ctx.current_account_id.clone())),
Box::new(ExitToEthereum::new(ctx.current_account_id)),
Box::new(RandomSeed::new(ctx.random_seed)),
Box::new(CurrentAccount::new(ctx.current_account_id)),
Box::new(PredecessorAccount::new(ctx.predecessor_account_id)),
];
let map: BTreeMap<Address, Box<dyn Precompile>> = addresses.into_iter().zip(fun).collect();

Expand All @@ -246,8 +231,6 @@ impl Precompiles {
ExitToNear::ADDRESS,
ExitToEthereum::ADDRESS,
RandomSeed::ADDRESS,
CurrentAccount::ADDRESS,
PredecessorAccount::ADDRESS,
];
let fun: prelude::Vec<Box<dyn Precompile>> = vec![
Box::new(ECRecover),
Expand All @@ -260,10 +243,8 @@ impl Precompiles {
Box::new(Bn128Pair::<Istanbul>::new()),
Box::new(Blake2F),
Box::new(ExitToNear::new(ctx.current_account_id.clone())),
Box::new(ExitToEthereum::new(ctx.current_account_id.clone())),
Box::new(ExitToEthereum::new(ctx.current_account_id)),
Box::new(RandomSeed::new(ctx.random_seed)),
Box::new(CurrentAccount::new(ctx.current_account_id)),
Box::new(PredecessorAccount::new(ctx.predecessor_account_id)),
];
let map: BTreeMap<Address, Box<dyn Precompile>> = addresses.into_iter().zip(fun).collect();

Expand Down
69 changes: 0 additions & 69 deletions engine-tests/src/tests/account_id_precompiles.rs

This file was deleted.

1 change: 0 additions & 1 deletion engine-tests/src/tests/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
mod access_lists;
mod account_id_precompiles;
mod contract_call;
mod eip1559;
mod erc20;
Expand Down
45 changes: 0 additions & 45 deletions engine-tests/src/tests/res/AccountIds.sol

This file was deleted.

11 changes: 1 addition & 10 deletions engine/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,17 +346,11 @@ struct StackExecutorParams {
}

impl StackExecutorParams {
fn new(
gas_limit: u64,
current_account_id: AccountId,
predecessor_account_id: AccountId,
random_seed: H256,
) -> Self {
fn new(gas_limit: u64, current_account_id: AccountId, random_seed: H256) -> Self {
Self {
precompiles: Precompiles::new_london(PrecompileConstructorContext {
current_account_id,
random_seed,
predecessor_account_id,
}),
gas_limit,
}
Expand Down Expand Up @@ -516,7 +510,6 @@ impl<'env, I: IO + Copy, E: Env> Engine<'env, I, E> {
let executor_params = StackExecutorParams::new(
gas_limit,
self.current_account_id.clone(),
self.env.predecessor_account_id(),
self.env.random_seed(),
);
let mut executor = executor_params.make_executor(self);
Expand Down Expand Up @@ -601,7 +594,6 @@ impl<'env, I: IO + Copy, E: Env> Engine<'env, I, E> {
let executor_params = StackExecutorParams::new(
gas_limit,
self.current_account_id.clone(),
self.env.predecessor_account_id(),
self.env.random_seed(),
);
let mut executor = executor_params.make_executor(self);
Expand Down Expand Up @@ -651,7 +643,6 @@ impl<'env, I: IO + Copy, E: Env> Engine<'env, I, E> {
let executor_params = StackExecutorParams::new(
gas_limit,
self.current_account_id.clone(),
self.env.predecessor_account_id(),
self.env.random_seed(),
);
let mut executor = executor_params.make_executor(self);
Expand Down

0 comments on commit b4a767a

Please sign in to comment.