-
Notifications
You must be signed in to change notification settings - Fork 24
Retry on icon skip transaction error #82
base: icondao
Are you sure you want to change the base?
Conversation
|
As we talked in slack, this issue regarding score execution time doesn't happen only when fragmentation sends. it could occur when it is normal sending. why don't you change the source code as it sends new TX after confirming previous TX state is transitioned to EXECUTION. let me know if any side effect is expected |
To add a mechanism to wait previous transaction state from pending into execution, we have to map a shared Interface in any blockchain connect by BTP in relay() loop. I'm not sure other chain we do will support getting transaction state by reSegment := true
for j, segment := range rm.Segments {
reSegment = false
if segment.GetResultParam == nil {
segment.TransactionResult = nil
if resultParam, err := b.sender.Relay(segment); err != nil {
b.log.Panicf("fail to Relay err:%+v", err)
} else {
segment.GetResultParam = resultParam
}
// wait for pending transaction state to execution state here
b.logRelaying("after relay", rm, segment, j)
b.updateResult(rm, segment)
}
}
if reSegment {
rm.Segments = make([]*chain.Segment, 0)
} |
|
Can we add one more function like checkTxState() to "type Sender interface" . reSegment := true
for j, segment := range rm.Segments {
reSegment = false
if segment.GetResultParam == nil {
segment.TransactionResult = nil
if resultParam, err := b.sender.Relay(segment); err != nil {
b.log.Panicf("fail to Relay err:%+v", err)
} else {
segment.GetResultParam = resultParam
}
// wait for pending transaction state to execution state here
b.sender. checkTxState(resultParam) // if there is no check logic, it just let it go.
b.logRelaying("after relay", rm, segment, j)
b.updateResult(rm, segment)
}
}
if reSegment {
rm.Segments = make([]*chain.Segment, 0)
}Since it should not block forever, it can continue after certain time. and after that it can retry skipped one. feel free to share your thought. |
|
@dhlee-icon I think you are misunderstanding what he is doing here. This code doesn't handle the SKIP_TRANSACTION at the time of sending a transaction. It catches this error when getting the result of the transaction at here The mapErrorWithTransactionResult function will map error that returned from tx's result. With the corresponding error, we will decide what should we need to do next. In this case, We will retry to send the message again by passing it back to the buffered messages. Here is where we handle the What do you think? |
canhlinh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@trmaphi looks good to me. Could you do a manual test on your side?
canhlinh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@trmaphi I've reviewed this PR again.
I discovered that this PR does not totally solve the problem. We only dealt with retrying to send a new transaction for Segment, not Fragment.
As a result, if the problem is caused by sending a Fragment, it does not appear to work.
Look at this line of code. We're missing the ability to manage the state of a large number of fragments. The code grp, err = s.signAndSendTransaction(tps[i]) will overwrite the previous transaction.
Let's come up with a new way to retry sending failed fragments.
|
I'd like to explain how we come with this solution to make sure we are on the same page. And we're welcome any suggestions with a clear justifications on pros and cons of a given solution Sum up: The error root cause is the execution of the transaction takes a too long time to complete the block. The skipped state of transactions can happen to all states of a transaction, except for the final state like NOTFOUND, SUCCEED, FAILED. There's no state as EXECUTION, as MoonKyu Song - ICONLOOP pointed out:
PENDING or EXECUTING can transit to SKIPPED, but in the last state (SUCCESS/NOTFOUND/REVERTED) the transaction state can't be transited SKIPPED BMR design relates to this error:
The solution is to retry the same TransactionParams with different signature + timestamp of signature. In BMR resend solution is activated by set The term resend meaning that the buffered RelayMessage will go through the Segmentation and/or Fragmentation again. And BMR send it with the same TransactionParams with different signature + timestamp of signature |
|
Q & A:
Yes, we don't need to put the state checking of the previous transaction
Sender.Relay() call Sender.signAndSendTransaction(), then Sender.signAndSendTransaction() call Sender.Client.SignTransaction(). If we call Sender.Relay() with a Segment after Resegmentation, we will have the new transactions with new signature timestamp. |
|
@dhlee-icon Feel free to ask any question relates to this MR. |
bed834f to
a1e5149
Compare
|
Because the max number of relay chain blocks in a message is 3599 blocks and the justifications with vote message have fixed size. During the test, the maximum number of Fragmentation is 5. So the worst scenario, we only need to resegment and/or refragment, then send 5 transactions @canhlinh we don't need to save the state of fragments locally anymore if only 5 transactions need to be built and sent at the worst case. |
|
@trmaphi Your idea is ok. It would be nice if you can provide some tests. |
b2134f2 to
e0047c5
Compare
No description provided.