-
Notifications
You must be signed in to change notification settings - Fork 94
feat(node): apply op-node v1.0.3 to kroma #34
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
0xHansLee
merged 3 commits into
feat/apply-optimism-v1.0.3
from
apply-optimism-v1.0.3-node
Apr 27, 2023
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,7 @@ | ||
| 568f0805d2f427ee2d78ff1eb13233883a0737bb | ||
| # Fork | ||
|
|
||
| ## optimism | ||
|
|
||
| - tag: `v1.0.3` | ||
| - differences | ||
| - to be updated |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| package client | ||
|
|
||
| import ( | ||
| "context" | ||
| "time" | ||
|
|
||
| "github.com/ethereum/go-ethereum" | ||
| "github.com/ethereum/go-ethereum/rpc" | ||
| "golang.org/x/time/rate" | ||
| ) | ||
|
|
||
| // RateLimitingClient is a wrapper around a pure RPC that implements a global rate-limit on requests. | ||
| type RateLimitingClient struct { | ||
| c RPC | ||
| rl *rate.Limiter | ||
| } | ||
|
|
||
| // NewRateLimitingClient implements a global rate-limit for all RPC requests. | ||
| // A limit of N will ensure that over a long enough time-frame the given number of tokens per second is targeted. | ||
| // Burst limits how far off we can be from the target, by specifying how many requests are allowed at once. | ||
| func NewRateLimitingClient(c RPC, limit rate.Limit, burst int) *RateLimitingClient { | ||
| return &RateLimitingClient{c: c, rl: rate.NewLimiter(limit, burst)} | ||
| } | ||
|
|
||
| func (b *RateLimitingClient) Close() { | ||
| b.c.Close() | ||
| } | ||
|
|
||
| func (b *RateLimitingClient) CallContext(ctx context.Context, result any, method string, args ...any) error { | ||
| if err := b.rl.Wait(ctx); err != nil { | ||
| return err | ||
| } | ||
| cCtx, cancel := context.WithTimeout(ctx, 10*time.Second) | ||
| defer cancel() | ||
| return b.c.CallContext(cCtx, result, method, args...) | ||
| } | ||
|
|
||
| func (b *RateLimitingClient) BatchCallContext(ctx context.Context, batch []rpc.BatchElem) error { | ||
| if err := b.rl.WaitN(ctx, len(batch)); err != nil { | ||
| return err | ||
| } | ||
| cCtx, cancel := context.WithTimeout(ctx, 20*time.Second) | ||
| defer cancel() | ||
| return b.c.BatchCallContext(cCtx, batch) | ||
| } | ||
|
|
||
| func (b *RateLimitingClient) EthSubscribe(ctx context.Context, channel any, args ...any) (ethereum.Subscription, error) { | ||
| if err := b.rl.Wait(ctx); err != nil { | ||
| return nil, err | ||
| } | ||
| return b.c.EthSubscribe(ctx, channel, args...) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.