Skip to content

Commit 31b79da

Browse files
committed
Rename Action to Datagram in IBC code
1 parent 21763cc commit 31b79da

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

core/src/ibc/transaction_handler/actions.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616

1717
use rlp::{Decodable, DecoderError, Encodable, Rlp, RlpStream};
1818

19-
const ACTION_CREATE_CLIENT: u8 = 1;
20-
const ACTION_UPDATE_CLIENT: u8 = 2;
19+
const DATAGRAM_CREATE_CLIENT: u8 = 1;
20+
const DATAGRAM_UPDATE_CLIENT: u8 = 2;
2121

2222
#[derive(Debug, PartialEq)]
23-
pub enum Action {
23+
pub enum Datagram {
2424
CreateClient {
2525
id: String,
2626
kind: u8,
@@ -32,58 +32,58 @@ pub enum Action {
3232
},
3333
}
3434

35-
impl Encodable for Action {
35+
impl Encodable for Datagram {
3636
fn rlp_append(&self, s: &mut RlpStream) {
3737
match self {
38-
Action::CreateClient {
38+
Datagram::CreateClient {
3939
id,
4040
kind,
4141
consensus_state,
4242
} => {
43-
s.begin_list(4).append(&ACTION_CREATE_CLIENT).append(id).append(kind).append(consensus_state);
43+
s.begin_list(4).append(&DATAGRAM_CREATE_CLIENT).append(id).append(kind).append(consensus_state);
4444
}
45-
Action::UpdateClient {
45+
Datagram::UpdateClient {
4646
id,
4747
header,
4848
} => {
49-
s.begin_list(3).append(&ACTION_UPDATE_CLIENT).append(id).append(header);
49+
s.begin_list(3).append(&DATAGRAM_UPDATE_CLIENT).append(id).append(header);
5050
}
5151
};
5252
}
5353
}
5454

55-
impl Decodable for Action {
55+
impl Decodable for Datagram {
5656
fn decode(rlp: &Rlp) -> Result<Self, DecoderError> {
5757
let tag = rlp.val_at(0)?;
5858
match tag {
59-
ACTION_CREATE_CLIENT => {
59+
DATAGRAM_CREATE_CLIENT => {
6060
let item_count = rlp.item_count()?;
6161
if item_count != 4 {
6262
return Err(DecoderError::RlpInvalidLength {
6363
expected: 4,
6464
got: item_count,
6565
})
6666
}
67-
Ok(Action::CreateClient {
67+
Ok(Datagram::CreateClient {
6868
id: rlp.val_at(1)?,
6969
kind: rlp.val_at(2)?,
7070
consensus_state: rlp.val_at(3)?,
7171
})
7272
}
73-
ACTION_UPDATE_CLIENT => {
73+
DATAGRAM_UPDATE_CLIENT => {
7474
let item_count = rlp.item_count()?;
7575
if item_count != 3 {
7676
return Err(DecoderError::RlpInvalidLength {
7777
expected: 3,
7878
got: item_count,
7979
})
8080
}
81-
Ok(Action::UpdateClient {
81+
Ok(Datagram::UpdateClient {
8282
id: rlp.val_at(1)?,
8383
header: rlp.val_at(2)?,
8484
})
8585
}
86-
_ => Err(DecoderError::Custom("Unexpected IBC Action Type")),
86+
_ => Err(DecoderError::Custom("Unexpected IBC Datagram Type")),
8787
}
8888
}
8989
}

core/src/ibc/transaction_handler/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
mod actions;
1818

19-
use self::actions::Action;
19+
use self::actions::Datagram;
2020
use crate::ibc;
2121
use ckey::{Address, Public};
2222
use cstate::{StateResult, TopLevelState};
@@ -32,14 +32,14 @@ pub fn execute(
3232
fee_payer: &Address,
3333
_sender_public: &Public,
3434
) -> StateResult<()> {
35-
let action = Action::decode(&Rlp::new(bytes)).expect("Verification passed");
36-
match action {
37-
Action::CreateClient {
35+
let datagram = Datagram::decode(&Rlp::new(bytes)).expect("Verification passed");
36+
match datagram {
37+
Datagram::CreateClient {
3838
id,
3939
kind,
4040
consensus_state,
4141
} => create_client(state, fee_payer, &id, kind, &consensus_state),
42-
Action::UpdateClient {
42+
Datagram::UpdateClient {
4343
id,
4444
header,
4545
} => update_client(state, &id, &header),

0 commit comments

Comments
 (0)