Skip to content

eth/gasprice: add query limit for FeeHistory to defend DDOS attack #29644

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

Merged
merged 2 commits into from
May 7, 2024

Conversation

NathanBSC
Copy link
Contributor

@NathanBSC NathanBSC commented Apr 25, 2024

Add query limit to defend DDoS attack. Max allow 100 different percentiles in rewardPercentiles.

this PR is ported from bsc 2423

@NathanBSC NathanBSC marked this pull request as ready for review April 25, 2024 06:18
@NathanBSC NathanBSC marked this pull request as draft April 25, 2024 07:23
@NathanBSC NathanBSC marked this pull request as ready for review April 25, 2024 07:42
@NathanBSC
Copy link
Contributor Author

I checked the failed golangci-lint, It's strange
and on my mac, it's ok
image

@AaronChen0
Copy link
Contributor

AaronChen0 commented Apr 25, 2024

Please rebase your commit. Your branch is 236 commits behind the master branch. And the return values of function FeeHistory was changed in this commit 1ec7af2

@NathanBSC NathanBSC force-pushed the add_query_limit_FeeHistory branch from 5600e1e to fce2b5b Compare April 25, 2024 08:33
@fjl
Copy link
Contributor

fjl commented Apr 29, 2024

This new limit is not necessary because it is already covered by other limits. The percentiles have to be in increasing order, and < 100. It is therefore impossible to submit more than 100.

There was a bug in the validation until recently, but it got fixed in #28954 .

@fjl fjl closed this Apr 29, 2024
@buddh0
Copy link
Contributor

buddh0 commented Apr 30, 2024

This new limit is not necessary because it is already covered by other limits. The percentiles have to be in increasing order, and < 100. It is therefore impossible to submit more than 100.

the element of rewardPercentiles is type float64 now, not integer, so is it impossible to submit more than 100? @fjl

Copy link
Member

@karalabe karalabe left a comment

Choose a reason for hiding this comment

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

LGTM

@karalabe karalabe added this to the 1.14.1 milestone May 7, 2024
Copy link
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

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

LGTM

@karalabe karalabe merged commit e4b8058 into ethereum:master May 7, 2024
2 of 3 checks passed
jorgemmsilva pushed a commit to iotaledger/go-ethereum that referenced this pull request Jun 17, 2024
…thereum#29644)

* eth/gasprice: add query limit for FeeHistory to defend DDOS attack

* fix return values after cherry-pick

---------

Co-authored-by: Eric <[email protected]>
stwiname pushed a commit to subquery/data-node-go-ethereum that referenced this pull request Sep 9, 2024
…thereum#29644)

* eth/gasprice: add query limit for FeeHistory to defend DDOS attack

* fix return values after cherry-pick

---------

Co-authored-by: Eric <[email protected]>
ARR4N pushed a commit to ava-labs/libevm that referenced this pull request Feb 14, 2025
…thereum#29644)

* eth/gasprice: add query limit for FeeHistory to defend DDOS attack

* fix return values after cherry-pick

---------

Co-authored-by: Eric <[email protected]>
ARR4N pushed a commit to ava-labs/libevm that referenced this pull request Feb 16, 2025
…thereum#29644)

* eth/gasprice: add query limit for FeeHistory to defend DDOS attack

* fix return values after cherry-pick

---------

Co-authored-by: Eric <[email protected]>
ARR4N pushed a commit to ava-labs/libevm that referenced this pull request Feb 17, 2025
…thereum#29644)

* eth/gasprice: add query limit for FeeHistory to defend DDOS attack

* fix return values after cherry-pick

---------

Co-authored-by: Eric <[email protected]>
ARR4N pushed a commit to ava-labs/libevm that referenced this pull request Feb 17, 2025
…thereum#29644)

* eth/gasprice: add query limit for FeeHistory to defend DDOS attack

* fix return values after cherry-pick

---------

Co-authored-by: Eric <[email protected]>
ARR4N pushed a commit to ava-labs/libevm that referenced this pull request Feb 17, 2025
…thereum#29644)

* eth/gasprice: add query limit for FeeHistory to defend DDOS attack

* fix return values after cherry-pick

---------

Co-authored-by: Eric <[email protected]>
ARR4N pushed a commit to ava-labs/libevm that referenced this pull request Feb 17, 2025
…thereum#29644)

* eth/gasprice: add query limit for FeeHistory to defend DDOS attack

* fix return values after cherry-pick

---------

Co-authored-by: Eric <[email protected]>
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Mar 13, 2025
ARR4N pushed a commit to ava-labs/libevm that referenced this pull request Mar 13, 2025
…thereum#29644)

* eth/gasprice: add query limit for FeeHistory to defend DDOS attack

* fix return values after cherry-pick

---------

Co-authored-by: Eric <[email protected]>
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Mar 14, 2025
github-merge-queue bot pushed a commit to ava-labs/libevm that referenced this pull request Mar 17, 2025
## Why this should be merged

Safer release process by enforcing invariants of `release/*` branches as
automated in #137 to fulfil #25.

## How this works

New test for `go_tooling` CI job.

If the PR target branch is `main` then only the `params.ReleaseType` is
checked. If the target is neither `main` nor a release branch then the
test is skipped. The checks performed on `release/*` branches are
described in the test.

## How this was tested

Locally against a dummy release branch with deliberate problems created
by (a) including this PR's changes in the final commit and (b) not
updating the libevm version.

```
$ go test -v ./... --target_branch="release/v1.13.14-0.1.0.rc.3"
=== RUN   TestCherryPicksFormat
--- PASS: TestCherryPicksFormat (0.39s)
=== RUN   TestBranchProperties
=== RUN   TestBranchProperties/branch_name
    release_test.go:172: 
                Error Trace:    .../ava-labs/libevm/libevm/tooling/release/release_test.go:172
                Error:          Not equal: 
                                expected: "release/v1.13.14-0.1.0.beta"
                                actual  : "release/v1.13.14-0.1.0.rc.3"
                            
                                Diff:
                                --- Expected
                                +++ Actual
                                @@ -1 +1 @@
                                -release/v1.13.14-0.1.0.beta
                                +release/v1.13.14-0.1.0.rc.3
                Test:           TestBranchProperties/branch_name
    release_test.go:175: On release branch; params.LibEVMReleaseType = "beta", which is unsuitable for release branches
=== RUN   TestBranchProperties/commit_history
    release_test.go:192: Forked from "main" at commit 4c6e50e (chore: module-renaming workflow inverts between `libevm` and `geth` (#152))
    release_test.go:314: ### History since fork from default branch (8 commits):
    release_test.go:316: internal/build, rpc: add missing HTTP response body Close() calls (ethereum#29223) by Shiming Zhang <[email protected]>
    release_test.go:316: core/state: fix bug in statedb.Copy and remove unnecessary preallocation (ethereum#29563) by Aaron Chen <[email protected]>
    release_test.go:316: params: print time value instead of pointer in ConfigCompatError (ethereum#29514) by Nathan <[email protected]>
    release_test.go:316: eth/gasprice: add query limit for FeeHistory to defend DDOS attack (ethereum#29644) by Nathan <[email protected]>
    release_test.go:316: core/state/snapshot: add a missing lock (ethereum#30001) by maskpp <[email protected]>
    release_test.go:316: crypto: add IsOnCurve check (ethereum#31100) by Felix Lange <[email protected]>
    release_test.go:316: internal/ethapi: fix panic in debug methods (ethereum#31157) by Sina M <[email protected]>
    release_test.go:316: x by Arran Schlosberg <[email protected]>
=== RUN   TestBranchProperties/commit_history/cherry_picked_commits
    release_test.go:314: ### Expected cherry-picks (7 commits):
    release_test.go:316: internal/build, rpc: add missing HTTP response body Close() calls (ethereum#29223) by Shiming Zhang <[email protected]>
    release_test.go:316: core/state: fix bug in statedb.Copy and remove unnecessary preallocation (ethereum#29563) by Aaron Chen <[email protected]>
    release_test.go:316: params: print time value instead of pointer in ConfigCompatError (ethereum#29514) by Nathan <[email protected]>
    release_test.go:316: eth/gasprice: add query limit for FeeHistory to defend DDOS attack (ethereum#29644) by Nathan <[email protected]>
    release_test.go:316: core/state/snapshot: add a missing lock (ethereum#30001) by maskpp <[email protected]>
    release_test.go:316: crypto: add IsOnCurve check (ethereum#31100) by Felix Lange <[email protected]>
    release_test.go:316: internal/ethapi: fix panic in debug methods (ethereum#31157) by Sina M <[email protected]>
=== RUN   TestBranchProperties/commit_history/final_commit
    release_test.go:365: Modified disallowed file "go.yml"
    release_test.go:365: Modified disallowed file "go.mod"
    release_test.go:365: Modified disallowed file "go.sum"
    release_test.go:365: Modified disallowed file "release_test.go"
--- FAIL: TestBranchProperties (2.07s)
    --- FAIL: TestBranchProperties/branch_name (0.00s)
    --- FAIL: TestBranchProperties/commit_history (2.07s)
        --- PASS: TestBranchProperties/commit_history/cherry_picked_commits (1.81s)
        --- FAIL: TestBranchProperties/commit_history/final_commit (0.01s)
FAIL
FAIL    github.com/ava-labs/libevm/libevm/tooling/release       2.712s
FAIL
```
JukLee0ira pushed a commit to JukLee0ira/XDPoSChain that referenced this pull request Mar 26, 2025
gzliudan added a commit to XinFinOrg/XDPoSChain that referenced this pull request Mar 26, 2025
qdm12 pushed a commit to ava-labs/libevm that referenced this pull request Mar 26, 2025
…thereum#29644)

* eth/gasprice: add query limit for FeeHistory to defend DDOS attack

* fix return values after cherry-pick

---------

Co-authored-by: Eric <[email protected]>
qdm12 pushed a commit to ava-labs/libevm that referenced this pull request Mar 26, 2025
…thereum#29644)

* eth/gasprice: add query limit for FeeHistory to defend DDOS attack

* fix return values after cherry-pick

---------

Co-authored-by: Eric <[email protected]>
qdm12 pushed a commit to ava-labs/libevm that referenced this pull request Mar 26, 2025
…thereum#29644)

* eth/gasprice: add query limit for FeeHistory to defend DDOS attack

* fix return values after cherry-pick

---------

Co-authored-by: Eric <[email protected]>
qdm12 pushed a commit to ava-labs/libevm that referenced this pull request Mar 26, 2025
…thereum#29644)

* eth/gasprice: add query limit for FeeHistory to defend DDOS attack

* fix return values after cherry-pick

---------

Co-authored-by: Eric <[email protected]>
qdm12 pushed a commit to ava-labs/libevm that referenced this pull request Mar 26, 2025
…thereum#29644)

* eth/gasprice: add query limit for FeeHistory to defend DDOS attack

* fix return values after cherry-pick

---------

Co-authored-by: Eric <[email protected]>
qdm12 pushed a commit to ava-labs/libevm that referenced this pull request Mar 26, 2025
…thereum#29644)

* eth/gasprice: add query limit for FeeHistory to defend DDOS attack

* fix return values after cherry-pick

---------

Co-authored-by: Eric <[email protected]>
ceyonur pushed a commit to ava-labs/libevm that referenced this pull request Apr 10, 2025
…thereum#29644)

* eth/gasprice: add query limit for FeeHistory to defend DDOS attack

* fix return values after cherry-pick

---------

Co-authored-by: Eric <[email protected]>
ceyonur pushed a commit to ava-labs/libevm that referenced this pull request Apr 10, 2025
…thereum#29644)

* eth/gasprice: add query limit for FeeHistory to defend DDOS attack

* fix return values after cherry-pick

---------

Co-authored-by: Eric <[email protected]>
gzliudan added a commit to XinFinOrg/XDPoSChain that referenced this pull request Apr 11, 2025
ceyonur pushed a commit to ava-labs/libevm that referenced this pull request Apr 11, 2025
…thereum#29644)

* eth/gasprice: add query limit for FeeHistory to defend DDOS attack

* fix return values after cherry-pick

---------

Co-authored-by: Eric <[email protected]>
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.

7 participants