Skip to content

Commit c8fa869

Browse files
committed
Remove custom action handler of IBC
1 parent 29aa51c commit c8fa869

File tree

7 files changed

+8
-259
lines changed

7 files changed

+8
-259
lines changed

core/src/consensus/solo/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ use crate::client::ConsensusClient;
2525
use crate::codechain_machine::CodeChainMachine;
2626
use crate::consensus::{EngineError, EngineType};
2727
use crate::error::Error;
28-
use crate::ibc;
2928
use ckey::Address;
3029
use cstate::{ActionHandler, HitHandler, TopStateView};
3130
use ctypes::{BlockHash, CommonParams, Header};
@@ -49,7 +48,6 @@ impl Solo {
4948
action_handlers.push(Arc::new(HitHandler::new()));
5049
}
5150
action_handlers.push(Arc::new(stake::Stake::new(params.genesis_stakes.clone())));
52-
action_handlers.push(Arc::new(ibc::custom_action_handler::IBC::new()));
5351

5452
Solo {
5553
client: Default::default(),

core/src/consensus/tendermint/engine.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,6 @@ impl ConsensusEngine for Tendermint {
262262
fn register_client(&self, client: Weak<dyn ConsensusClient>) {
263263
*self.client.write() = Some(Weak::clone(&client));
264264
self.stake.register_resources(Weak::clone(&client), Arc::downgrade(&self.validators));
265-
self.ibc.register_resources(client);
266265
}
267266

268267
fn is_proposal(&self, header: &Header) -> bool {

core/src/consensus/tendermint/mod.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ pub use self::types::{Height, Step, View};
3232
pub use super::{stake, ValidatorSet};
3333
use crate::client::ConsensusClient;
3434
use crate::codechain_machine::CodeChainMachine;
35-
use crate::ibc;
3635
use crate::snapshot_notify::NotifySender as SnapshotNotifySender;
3736
use crate::ChainNotify;
3837
use crossbeam_channel as crossbeam;
@@ -72,7 +71,6 @@ pub struct Tendermint {
7271
action_handlers: Vec<Arc<dyn ActionHandler>>,
7372
/// stake object to register client data later
7473
stake: Arc<stake::Stake>,
75-
ibc: Arc<ibc::custom_action_handler::IBC>,
7674
/// Chain notify
7775
chain_notify: Arc<TendermintChainNotify>,
7876
has_signer: AtomicBool,
@@ -92,7 +90,6 @@ impl Tendermint {
9290
pub fn new(our_params: TendermintParams, machine: CodeChainMachine) -> Arc<Self> {
9391
let validators = Arc::clone(&our_params.validators);
9492
let stake = Arc::new(stake::Stake::new(our_params.genesis_stakes));
95-
let ibc = Arc::new(ibc::custom_action_handler::IBC::new());
9693
let timeouts = our_params.timeouts;
9794
let machine = Arc::new(machine);
9895

@@ -104,7 +101,7 @@ impl Tendermint {
104101
inner,
105102
quit_tendermint,
106103
) = worker::spawn(our_params.validators);
107-
let action_handlers: Vec<Arc<dyn ActionHandler>> = vec![stake.clone(), ibc.clone()];
104+
let action_handlers: Vec<Arc<dyn ActionHandler>> = vec![stake.clone()];
108105
let chain_notify = Arc::new(TendermintChainNotify::new(inner.clone()));
109106

110107
Arc::new(Tendermint {
@@ -121,7 +118,6 @@ impl Tendermint {
121118
machine,
122119
action_handlers,
123120
stake,
124-
ibc,
125121
chain_notify,
126122
has_signer: false.into(),
127123
})

core/src/ibc/context.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@
1414
// You should have received a copy of the GNU Affero General Public License
1515
// along with this program. If not, see <https://www.gnu.org/licenses/>.
1616
use super::kv_store;
17-
use crate::ibc::custom_action_handler::CUSTOM_ACTION_HANDLER_ID;
1817
use crate::ibc::KVStore;
19-
use cstate::{ActionDataKeyBuilder, TopLevelState, TopState, TopStateView};
18+
use ccrypto::blake256;
19+
use cstate::{TopLevelState, TopState, TopStateView};
2020
use primitives::H256;
21+
use rlp::RlpStream;
2122

2223
pub trait Context {
2324
fn get_kv_store(&mut self) -> &mut dyn kv_store::KVStore;
@@ -49,8 +50,10 @@ struct TopLevelKVStore<'a> {
4950

5051
impl<'a> TopLevelKVStore<'a> {
5152
fn key(path: &str) -> H256 {
52-
let key_builder = ActionDataKeyBuilder::new(CUSTOM_ACTION_HANDLER_ID, 1);
53-
key_builder.append(&path.as_bytes()).into_key()
53+
let mut rlp = RlpStream::new_list(2);
54+
rlp.append(&"IBCData");
55+
rlp.append(&path);
56+
blake256(rlp.drain())
5457
}
5558
}
5659

core/src/ibc/custom_action_handler/actions.rs

Lines changed: 0 additions & 111 deletions
This file was deleted.

core/src/ibc/custom_action_handler/mod.rs

Lines changed: 0 additions & 133 deletions
This file was deleted.

core/src/ibc/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ pub mod client_02;
1919
#[allow(unused_variables)]
2020
mod commitment_23;
2121
pub mod context;
22-
#[allow(dead_code)]
23-
#[allow(unused_variables)]
24-
pub mod custom_action_handler;
2522
mod kv_store;
2623
mod transaction_handler;
2724

0 commit comments

Comments
 (0)