-
Notifications
You must be signed in to change notification settings - Fork 329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hermes resubmits already received packet #1608
Comments
Hey, thanks for submitting this bug report. The log output is quite minimal, it's not clear if this is an error from gas simulation step (which is OK), or from tx submission step (which would be a bug indeed). Can you provide more context to your logs? Thank you. |
Hey, adizere |
I try to add log code at send_tx like that fn send_tx(&mut self, proto_msgs: Vec<Any>) -> Result<Response, Error> {
for msg in &proto_msgs {
if msg.type_url == "/ibc.core.channel.v1.MsgRecvPacket" {
let packet: MsgRecvPacket = prost::Message::decode(msg.value.as_slice()).unwrap();
println!("{:?}",packet);
}
} when this error occurs,the output of the above code is MsgRecvPacket { packet: Some(Packet { sequence: 7, source_port: "oracle", source_channel: "channel-0",.......
MsgRecvPacket { packet: Some(Packet { sequence: 7, source_port: "oracle", source_channel: "channel-0",....... this method is called twice in the same NewBlock, I can't reproduce the problem, but it does exist |
I see, thank you! One more question: Do you happen to know if this problem with duplicate sequences appears for a certain network? Or did you notice the problem for any network? Any additional feedback would be welcome, since it still seems difficult for us to reproduce & fix this based on the discussion so far. |
bandprotocol , it produce ibc-packet at Endblock , only in this scenario can the above situation occur. At present, I am gradually narrowing the scope of bugs |
add some log at get_all_events pub fn get_all_events(
chain_id: &ChainId,
result: RpcEvent,
latest_height: u64,
) -> Result<Vec<(Height, IbcEvent)>, String> {
let mut vals: Vec<(Height, IbcEvent)> = vec![];
match &result.data {
RpcEventData::NewBlock { block, .. } => {
let height = Height::new(
ChainId::chain_version(chain_id.to_string().as_str()),
u64::from(block.as_ref().ok_or("tx.height")?.header.height),
);
if height.revision_height <= latest_height {
return Ok(vals);
}
tracing::info!("Chain:{:?} height:{:?}",chain_id,height); log output, same thread call twice 2021-12-01T02:07:15.849061Z INFO ThreadId(16) Chain:ChainId { id: "bandchain", version: 0 } height:Height { revision: 0, height: 2279 }
2021-12-01T02:07:15.852507Z INFO ThreadId(16) Chain:ChainId { id: "bandchain", version: 0 } height:Height { revision: 0, height: 2279 } now, I use a temporary solution: filter the same messages when sending msgs in same batch. |
Hey @adizere I found the cause of the problem https://github.com/informalsystems/ibc-rs/blob/master/relayer/src/event/monitor.rs#L103 pub fn all() -> Vec<Query> {
// Note: Tendermint-go supports max 5 query specifiers!
vec![
new_block(),
ibc_client(),
ibc_connection(),
ibc_channel(),
// This will be needed when we send misbehavior evidence to full node
// Query::eq("message.module", "evidence"),
]
} hermes EventMonitor Subscribe NewBlock and Channel Events Topic, Bandchain Produce SendPacket Ibc Event at NewBlock Events, so Hermes captured the same SendPacket event from both topics. Try the following steps:
{
"jsonrpc": "2.0",
"method": "subscribe",
"id": 0,
"params": {
"query": "message.module='ibc_channel'"
}
}
{ "jsonrpc": "2.0", "id": 0, "result": { "query": "message.module='ibc_channel'", "data": { "type": "tendermint/event/NewBlockHeader", "value": { "header":
{ "jsonrpc": "2.0", "id": 0, "result": { "query": "message.module='ibc_channel'", "data": { "type": "tendermint/event/NewBlock", "value": { "block":
{ "jsonrpc": "2.0", "id": 0, "result": { "query": "message.module='ibc_channel'", "data": { "type": "tendermint/event/Tx", "value": conclution:when SendPacket produce at BeginBlock/EndBlock and websocket subscribe condition is "message.module='ibc_channel'" It seems that this problem only occurs in the lower version of Cosmos-SDK, which is not found in the latest Cosmos-Hub solutionfilter RpcEvent.query string at get_all_events pub fn get_all_events(
chain_id: &ChainId,
result: RpcEvent,
) -> Result<Vec<(Height, IbcEvent)>, String> {
let mut vals: Vec<(Height, IbcEvent)> = vec![];
match &result.data {
RpcEventData::NewBlock { block, .. } => {
// filter NewBlock query string
if result.query == queries::new_block().to_string() {
let height = Height::new(
ChainId::chain_version(chain_id.to_string().as_str()),
u64::from(block.as_ref().ok_or("tx.height")?.header.height),
);
vals.push((height, ClientEvents::NewBlock::new(height).into()));
if let Some(events) = &result.events {
let ibc_events =
send_packet_from_block_events(height, events.clone().into_iter().collect());
if !ibc_events.is_empty() {
vals.extend(ibc_events);
}
}
}
} now hermes works normally! |
That's quite a subtle bug. Your solution is pretty good I would say, and the debugging part even more so, thanks for sharing these findings with us!
This is very interesting, and makes me wonder if it should be a priority to include a permanent fix in Hermes for this problem, if at all. It's a matter of time until Bandchain also updates their SDK version and then the problem will disappear. That being said, we are pushing to releasing a couple of major improvements in a new version, and it's unlikely we'll have the capacity to fix this in the next release (#1648), but we'll keep it on our radar. I assume you're running a forked version of Hermes. So it's not a problem if this fix is delayed, no? Let me know otherwise and maybe we can include it. Thank you for you understanding. |
two same txn in one block: it's normal situation? |
Yes, I running a forked version of Hermes, but I still hope Hermes can permanently fix the problem. because this is a problem caused by the SDK and will affect all chains using this version. |
@lyqingye Can you please test with this branch and see if it fixes the problem? (cf. #1844) |
Crate
hermes
Summary of Bug
Ref: #1479
This bug still appears with v0.9.0
Version
v0.9.0
Steps to Reproduce
Acceptance Criteria
For Admin Use
The text was updated successfully, but these errors were encountered: