Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

MST: fixed expired incoming state logic #2211

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

MBoldyrev
Copy link
Contributor

@MBoldyrev MBoldyrev commented Apr 4, 2019

Description of the Change

This change removes a very strange line the rationale behind which was not found:
https://github.com/hyperledger/iroha/blob/df5272c243db9eadaf737fa510af1e5566c823d0/irohad/multi_sig_transactions/impl/mst_processor_impl.cpp#L110

...and adds early removal of expired batches from incoming MstState. Also move semantics get used.

Benefits

see above

Possible Drawbacks

There remains a possibility that the removed line of code was helpful...

Usage Examples or Tests [optional]

Regarding the removed line, it broke no tests when it was commented out.
Regarding the outdated batches, please see mst_processor_test MstProcessorTest.receivedOutdatedState test.

Alternate Designs [optional]

Signed-off-by: Mikhail Boldyrev <miboldyrev@gmail.com>
Signed-off-by: Mikhail Boldyrev <miboldyrev@gmail.com>
@MBoldyrev MBoldyrev added needs-review pr awaits review from maintainers mst multisignature transactions labels Apr 4, 2019
@MBoldyrev MBoldyrev self-assigned this Apr 4, 2019
log_->info("Applying new state");
auto current_time = time_provider_->getCurrentTime();

new_state.eraseExpired(current_time);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is could be an explanation of why we throw batches from new_state

log_->info("Applying new state");
auto current_time = time_provider_->getCurrentTime();

new_state.eraseExpired(current_time);
auto state_update = storage_->apply(from, new_state);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems, there is missing expiredBatchesNotify invocation.

// ---------------------------------| then |----------------------------------
EXPECT_FALSE(storage->batchInStorage(expired_batch));
check(observers);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, there could be another test which checks that expired transactions from new_state will be not propagated by the expired notifier.

Signed-off-by: Mikhail Boldyrev <miboldyrev@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
mst multisignature transactions needs-review pr awaits review from maintainers
Development

Successfully merging this pull request may close these issues.

None yet

3 participants