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

[actpool] forbid processing system action #3867

Merged
merged 3 commits into from
May 30, 2023

Conversation

dustinxie
Copy link
Member

Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes #(issue)

Type of change

Please delete options that are not relevant.

  • [] Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • [] Code refactor or improvement
  • [] Breaking change (fix or feature that would cause a new or changed behavior of existing functionality)
  • [] This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • make test
  • [] fullsync
  • [] Other test (please specify)

Test Configuration:

  • Firmware version:
  • Hardware:
  • Toolchain:
  • SDK:

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

// system action is only added by proposer when creating a block
if action.IsSystemAction(selp) {
return "", errors.New("cannot process system action")
}
Copy link
Member Author

@dustinxie dustinxie May 25, 2023

Choose a reason for hiding this comment

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

for safety, to prevent potential replay of grantreward

@codecov
Copy link

codecov bot commented May 25, 2023

Codecov Report

Merging #3867 (a2f50f8) into master (e1f0636) will increase coverage by 0.01%.
The diff coverage is 60.79%.

❗ Current head a2f50f8 differs from pull request most recent head ed9954f. Consider uploading reports for the commit ed9954f to get more accurate results

@@            Coverage Diff             @@
##           master    #3867      +/-   ##
==========================================
+ Coverage   75.38%   75.39%   +0.01%     
==========================================
  Files         303      318      +15     
  Lines       25923    27303    +1380     
==========================================
+ Hits        19541    20586    +1045     
- Misses       5360     5661     +301     
- Partials     1022     1056      +34     
Impacted Files Coverage Δ
action/protocol/execution/evm/evm.go 43.52% <0.00%> (-2.95%) ⬇️
action/protocol/execution/evm/evmstatedbadapter.go 66.77% <ø> (ø)
action/protocol/poll/consortium.go 0.00% <0.00%> (ø)
action/protocol/poll/staking_committee.go 43.85% <0.00%> (ø)
...tion/protocol/staking/contractstake_bucket_type.go 0.00% <0.00%> (ø)
api/web3server_marshal.go 93.21% <ø> (ø)
blockchain/config.go 74.54% <ø> (ø)
blockindex/contractstaking/dummy_indexer.go 0.00% <0.00%> (ø)
blockindex/sgd_indexer.go 2.45% <2.45%> (ø)
action/protocol/staking/contractstake_indexer.go 14.28% <14.28%> (ø)
... and 29 more

... and 6 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@CoderZhi
Copy link
Collaborator

Copy link
Collaborator

@CoderZhi CoderZhi left a comment

Choose a reason for hiding this comment

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

It has been prevented in workingset

@dustinxie
Copy link
Member Author

It has been prevented in workingset

yes, but that's after a block is proposed (and then found invalid), so a block is wasted. In other words, someone can potentially keep sending such a system action and prevent block being generated, like a DoS attack?

so it's worthwhile to early-detect this and throw it out of action pool?

@CoderZhi
Copy link
Collaborator

It has been prevented in workingset

yes, but that's after a block is proposed (and then found invalid), so a block is wasted. In other words, someone can potentially keep sending such a system action and prevent block being generated, like a DoS attack?

so it's worthwhile to early-detect this and throw it out of action pool?

if so, we need to prevent adding it to actpool.

@dustinxie
Copy link
Member Author

It has been prevented in workingset

yes, but that's after a block is proposed (and then found invalid), so a block is wasted. In other words, someone can potentially keep sending such a system action and prevent block being generated, like a DoS attack?
so it's worthwhile to early-detect this and throw it out of action pool?

if so, we need to prevent adding it to actpool.

yes, by early-exiting here, system action is neither added to local actpool (L436 below), nor being propagated to p2p network (L460 below)

@CoderZhi
Copy link
Collaborator

It has been prevented in workingset

yes, but that's after a block is proposed (and then found invalid), so a block is wasted. In other words, someone can potentially keep sending such a system action and prevent block being generated, like a DoS attack?
so it's worthwhile to early-detect this and throw it out of action pool?

if so, we need to prevent adding it to actpool.

yes, by early-exiting here, system action is neither added to local actpool (L436 below), nor being propagated to p2p network (L460 below)

actpool is the component which is responsible to gate system action

@dustinxie dustinxie changed the title [api] forbid processing system action [actpool] forbid processing system action May 30, 2023
@sonarcloud
Copy link

sonarcloud bot commented May 30, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
9.3% 9.3% Duplication

@dustinxie dustinxie merged commit eb8aba8 into iotexproject:master May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants