forked from ethereum-optimism/op-geth
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge tag 'v1.101411.2-rc.2' into merge-latest
Tag created with op-workbench. Conflicts: core/state_transition.go miner/worker.go
- Loading branch information
Showing
35 changed files
with
1,220 additions
and
133 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -4,6 +4,11 @@ orbs: | |
gcp-cli: circleci/[email protected] | ||
slack: circleci/[email protected] | ||
|
||
parameters: | ||
go_version: | ||
type: string | ||
default: 1.22.7 # update CI Go version here | ||
|
||
commands: | ||
gcp-oidc-authenticate: | ||
description: "Authenticate with GCP using a CircleCI OIDC token." | ||
|
@@ -134,7 +139,7 @@ jobs: | |
build-geth: | ||
docker: | ||
- image: cimg/go:1.21 | ||
- image: cimg/go:<<pipeline.parameters.go_version>> | ||
resource_class: xlarge | ||
steps: | ||
- checkout | ||
|
@@ -143,30 +148,30 @@ jobs: | |
unit-test: | ||
resource_class: xlarge | ||
docker: | ||
- image: cimg/go:1.21 | ||
- image: cimg/go:<<pipeline.parameters.go_version>> | ||
steps: | ||
- checkout | ||
- run: | ||
command: go run build/ci.go test | ||
lint-geth: | ||
resource_class: medium | ||
docker: | ||
- image: cimg/go:1.21 | ||
- image: cimg/go:<<pipeline.parameters.go_version>> | ||
steps: | ||
- checkout | ||
- run: | ||
command: go run build/ci.go lint | ||
tidy-geth: | ||
resource_class: small | ||
docker: | ||
- image: cimg/go:1.21 | ||
- image: cimg/go:<<pipeline.parameters.go_version>> | ||
steps: | ||
- checkout | ||
- run: | ||
command: go mod tidy && git diff --exit-code | ||
check-releases: | ||
docker: | ||
- image: cimg/go:1.21 | ||
- image: cimg/go:<<pipeline.parameters.go_version>> | ||
steps: | ||
- checkout | ||
- run: | ||
|
This file contains 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 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 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 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 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 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,57 @@ | ||
package txpool | ||
|
||
import ( | ||
"context" | ||
"time" | ||
|
||
"github.com/ethereum/go-ethereum/core/types" | ||
"github.com/ethereum/go-ethereum/core/types/interoptypes" | ||
"github.com/ethereum/go-ethereum/log" | ||
) | ||
|
||
// IngressFilter is an interface that allows filtering of transactions before they are added to the transaction pool. | ||
// Implementations of this interface can be used to filter transactions based on various criteria. | ||
// FilterTx will return true if the transaction should be allowed, and false if it should be rejected. | ||
type IngressFilter interface { | ||
FilterTx(ctx context.Context, tx *types.Transaction) bool | ||
} | ||
|
||
type interopFilter struct { | ||
logsFn func(tx *types.Transaction) ([]*types.Log, error) | ||
checkFn func(ctx context.Context, ems []interoptypes.Message, safety interoptypes.SafetyLevel) error | ||
} | ||
|
||
func NewInteropFilter( | ||
logsFn func(tx *types.Transaction) ([]*types.Log, error), | ||
checkFn func(ctx context.Context, ems []interoptypes.Message, safety interoptypes.SafetyLevel) error) IngressFilter { | ||
return &interopFilter{ | ||
logsFn: logsFn, | ||
checkFn: checkFn, | ||
} | ||
} | ||
|
||
// FilterTx implements IngressFilter.FilterTx | ||
// it gets logs checks for message safety based on the function provided | ||
func (f *interopFilter) FilterTx(ctx context.Context, tx *types.Transaction) bool { | ||
logs, err := f.logsFn(tx) | ||
if err != nil { | ||
log.Debug("Failed to retrieve logs of tx", "txHash", tx.Hash(), "err", err) | ||
return false // default to deny if logs cannot be retrieved | ||
} | ||
if len(logs) == 0 { | ||
return true // default to allow if there are no logs | ||
} | ||
ems, err := interoptypes.ExecutingMessagesFromLogs(logs) | ||
if err != nil { | ||
log.Debug("Failed to parse executing messages of tx", "txHash", tx.Hash(), "err", err) | ||
return false // default to deny if logs cannot be parsed | ||
} | ||
if len(ems) == 0 { | ||
return true // default to allow if there are no executing messages | ||
} | ||
|
||
ctx, cancel := context.WithTimeout(ctx, time.Second*2) | ||
defer cancel() | ||
// check with the supervisor if the transaction should be allowed given the executing messages | ||
return f.checkFn(ctx, ems, interoptypes.Unsafe) == nil | ||
} |
Oops, something went wrong.