Skip to content
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

Fix for duplicatiing transactions (IS-869) #1687

Merged
merged 16 commits into from
Oct 13, 2023

Conversation

dimalit
Copy link
Contributor

@dimalit dimalit commented Oct 6, 2023

  1. Skip invalid transactions from block, starting from "patch timestamp"
  2. Ignore them in historic build, if they are present in block

Fixes https://github.com/skalenetwork/internal-support/issues/869

Tests:

  1. test/unittests/libethereum/SkaleHost.cpp tests how various kinds of invalid transactions are skipped from block (both for enabled patch and for disabled patch)
  2. test/unittests/libweb3jsonrpc/jsonrpc.cpp -> skip_invalid_transactions tests affected JSON-RPC calls on historic node

Copy link
Collaborator

@kladkogex kladkogex left a comment

Choose a reason for hiding this comment

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

Please specify in detail how the fix was tested.

Also please add comments to the code describing the fix

@dimalit dimalit requested a review from kladkogex October 9, 2023 10:12
Copy link
Collaborator

@kladkogex kladkogex left a comment

Choose a reason for hiding this comment

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

Please check the case if there is a single invalid transaction in the block.

libskale/SkipInvalidTransactionsPatch.cpp Outdated Show resolved Hide resolved
@@ -654,7 +656,7 @@ size_t Client::syncTransactions(
RevertableFSPatch::lastBlockTimestamp = blockChain().info().timestamp();
StorageDestructionPatch::lastBlockTimestamp = blockChain().info().timestamp();
POWCheckPatch::lastBlockTimestamp = blockChain().info().timestamp();

SkipInvalidTransactionsPatch::setLastBlock( blockChain().info() );
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please follow the logic of other patches above - the code needs to be consistent

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems bad idea to stick just to timestamps - in general, patches can have different logic of activation. E.g. see AmsterdamFixPatch.

class SkipInvalidTransactionsPatch : public SchainPatch {
public:
static void init( const dev::eth::ChainParams& cp ) {
activationTimestamp = cp.sChain.skipInvalidTransactionsPatchTimestamp;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add setter and print logs as other patch

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems bad idea to just stick to timestamp-only approach. Different patches can have different logic of activation. E.g. see AmsterdamFixPatch

Copy link
Collaborator

@kladkogex kladkogex left a comment

Choose a reason for hiding this comment

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

Please check the case if there is a single invalid transaction in the block.

@dimalit
Copy link
Contributor Author

dimalit commented Oct 9, 2023

Case of single invalid transaction in block is checked in test/unittests/libethereum/SkaleHost.cpp

@codecov
Copy link

codecov bot commented Oct 9, 2023

Codecov Report

Merging #1687 (b8ef14c) into develop (5b3ccae) will increase coverage by 0.35%.
The diff coverage is 91.62%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1687      +/-   ##
===========================================
+ Coverage    44.89%   45.24%   +0.35%     
===========================================
  Files          347      349       +2     
  Lines        51283    51405     +122     
===========================================
+ Hits         23023    23260     +237     
+ Misses       28260    28145     -115     

@dimalit dimalit merged commit d580980 into develop Oct 13, 2023
8 checks passed
@dimalit dimalit deleted the bug/IS-869-transaction-duplicates branch October 13, 2023 13:22
@github-actions github-actions bot locked and limited conversation to collaborators Oct 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants