Skip to content

Commit c23b7fc

Browse files
committed
Add IBC transaction type
1 parent ce2d935 commit c23b7fc

File tree

5 files changed

+57
-0
lines changed

5 files changed

+57
-0
lines changed

core/src/codechain_machine.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,12 @@ impl CodeChainMachine {
110110
// FIXME
111111
0
112112
}
113+
Action::IBC {
114+
..
115+
} => {
116+
// FIXME
117+
0
118+
}
113119
}
114120
}
115121

core/src/miner/mem_pool_types.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,12 @@ impl MemPoolMinFees {
472472
// FIXME
473473
0
474474
}
475+
Action::IBC {
476+
..
477+
} => {
478+
// FIXME
479+
0
480+
}
475481
}
476482
}
477483
}

rpc/src/v1/types/action.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ pub enum Action {
5555
shard_id: ShardId,
5656
content: String,
5757
},
58+
IBC {
59+
bytes: Bytes,
60+
},
5861
}
5962

6063
#[derive(Debug, Serialize)]
@@ -91,6 +94,9 @@ pub enum ActionWithTracker {
9194
content: String,
9295
tracker: Tracker,
9396
},
97+
IBC {
98+
bytes: Bytes,
99+
},
94100
}
95101

96102
impl ActionWithTracker {
@@ -148,6 +154,11 @@ impl ActionWithTracker {
148154
content,
149155
tracker: tracker.unwrap(),
150156
},
157+
ActionType::IBC {
158+
bytes,
159+
} => ActionWithTracker::IBC {
160+
bytes,
161+
},
151162
}
152163
}
153164
}
@@ -212,6 +223,11 @@ impl TryFrom<Action> for ActionType {
212223
shard_id,
213224
content,
214225
},
226+
Action::IBC {
227+
bytes,
228+
} => ActionType::IBC {
229+
bytes,
230+
},
215231
})
216232
}
217233
}

state/src/impls/top_level.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,12 @@ impl TopLevelState {
405405
handler.execute(bytes, self, fee_payer, signer_public)?;
406406
return Ok(())
407407
}
408+
Action::IBC {
409+
..
410+
} => {
411+
// FIXME: call ibc transactions
412+
return Ok(())
413+
}
408414
};
409415
self.apply_shard_transaction(
410416
&transaction,

types/src/transaction/action.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ enum ActionTag {
3131
SetShardOwners = 0x05,
3232
SetShardUsers = 0x06,
3333
ShardStore = 0x19,
34+
IBC = 0x20,
3435
Custom = 0xFF,
3536
}
3637

@@ -86,6 +87,9 @@ pub enum Action {
8687
shard_id: ShardId,
8788
content: String,
8889
},
90+
IBC {
91+
bytes: Bytes,
92+
},
8993
}
9094

9195
impl Action {
@@ -231,6 +235,13 @@ impl Encodable for Action {
231235
s.append(shard_id);
232236
s.append(content);
233237
}
238+
Action::IBC {
239+
bytes,
240+
} => {
241+
s.begin_list(2);
242+
s.append(&ActionTag::IBC);
243+
s.append(bytes);
244+
}
234245
}
235246
}
236247
}
@@ -328,6 +339,18 @@ impl Decodable for Action {
328339
content: rlp.val_at(3)?,
329340
})
330341
}
342+
ActionTag::IBC => {
343+
let item_count = rlp.item_count()?;
344+
if item_count != 2 {
345+
return Err(DecoderError::RlpIncorrectListLen {
346+
got: item_count,
347+
expected: 2,
348+
})
349+
}
350+
Ok(Action::IBC {
351+
bytes: rlp.val_at(1)?,
352+
})
353+
}
331354
}
332355
}
333356
}

0 commit comments

Comments
 (0)