From 5b9097a9cafa0b819125fb77a4d7e031ae0b6150 Mon Sep 17 00:00:00 2001 From: Tomusdrw Date: Sat, 16 Jan 2016 17:24:42 +0100 Subject: [PATCH] Renaming NO_OF_LOG_INSTRUCTIONS -> MAX_NO_OF_TOPICS --- src/evm/instructions.rs | 2 +- src/evm/interpreter.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/evm/instructions.rs b/src/evm/instructions.rs index 78b111342..d574fd565 100644 --- a/src/evm/instructions.rs +++ b/src/evm/instructions.rs @@ -380,7 +380,7 @@ pub const LOG1: Instruction = 0xa1; //< Makes a log entry; 1 topic. pub const LOG2: Instruction = 0xa2; //< Makes a log entry; 2 topics. pub const LOG3: Instruction = 0xa3; //< Makes a log entry; 3 topics. pub const LOG4: Instruction = 0xa4; //< Makes a log entry; 4 topics. -pub const NO_OF_LOG_INSTRUCTIONS : usize = 5; +pub const MAX_NO_OF_TOPICS : usize = 4; pub const CREATE: Instruction = 0xf0; //< create a new account with associated code pub const CALL: Instruction = 0xf1; //< message-call into an account diff --git a/src/evm/interpreter.rs b/src/evm/interpreter.rs index fe4f039ef..520bfab52 100644 --- a/src/evm/interpreter.rs +++ b/src/evm/interpreter.rs @@ -40,7 +40,7 @@ trait Stack { fn has(&self, no_of_elems: usize) -> bool; /// Get element from top and remove it from Stack. Panics if stack is empty. fn pop_back(&mut self) -> T; - /// Get (up to 5) elements from top and remove them from Stack. Panics if stack is empty. + /// Get (up to `instructions::MAX_NO_OF_TOPICS`) elements from top and remove them from Stack. Panics if stack is empty. fn pop_n(&mut self, no_of_elems: usize) -> &[T]; /// Add element on top of the Stack fn push(&mut self, elem: T); @@ -50,14 +50,14 @@ trait Stack { struct VecStack { stack: Vec, - logs: [S; instructions::NO_OF_LOG_INSTRUCTIONS] + logs: [S; instructions::MAX_NO_OF_TOPICS] } impl VecStack { fn with_capacity(capacity: usize, zero: S) -> Self { VecStack { stack: Vec::with_capacity(capacity), - logs: [zero; instructions::NO_OF_LOG_INSTRUCTIONS] + logs: [zero; instructions::MAX_NO_OF_TOPICS] } } } @@ -91,7 +91,7 @@ impl Stack for VecStack { } fn pop_n(&mut self, no_of_elems: usize) -> &[S] { - assert!(no_of_elems < instructions::NO_OF_LOG_INSTRUCTIONS); + assert!(no_of_elems <= instructions::MAX_NO_OF_TOPICS); for i in 0..no_of_elems { self.logs[i] = self.pop_back();