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

feat: Add tests for execution grpc server and astria configs #17

Merged
merged 17 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ jobs:
- name: Run tests
run: go test -short ./...
env:
GOOS: linux
Copy link
Member

Choose a reason for hiding this comment

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

nit: new line

GOOS: linux
1 change: 1 addition & 0 deletions consensus/clique/clique.go
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,7 @@ func (c *Clique) verifySeal(snap *Snapshot, header *types.Header, parents []*typ
return err
}
if _, ok := snap.Signers[signer]; !ok {
fmt.Printf("Failing here")
Copy link
Member

Choose a reason for hiding this comment

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

remove?

return errUnauthorizedSigner
}
for seen, recent := range snap.Recents {
Expand Down
30 changes: 16 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ module github.com/ethereum/go-ethereum
go 1.21

require (
buf.build/gen/go/astria/execution-apis/grpc/go v1.3.0-20240423053323-ccf38db75f2f.2
buf.build/gen/go/astria/execution-apis/protocolbuffers/go v1.33.0-20240423053323-ccf38db75f2f.1
buf.build/gen/go/astria/primitives/protocolbuffers/go v1.33.0-20240422195039-812e347acd6b.1
buf.build/gen/go/astria/execution-apis/grpc/go v1.3.0-20240515213934-11def93fe8c2.3
buf.build/gen/go/astria/execution-apis/protocolbuffers/go v1.34.1-20240515213934-11def93fe8c2.1
buf.build/gen/go/astria/primitives/protocolbuffers/go v1.34.1-20240515213932-4cda3260523c.1
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.2.0
github.com/Microsoft/go-winio v0.6.1
github.com/VictoriaMetrics/fastcache v1.12.1
Expand Down Expand Up @@ -36,7 +36,7 @@ require (
github.com/golang/protobuf v1.5.4
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb
github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa
github.com/google/uuid v1.3.0
github.com/google/uuid v1.4.0
github.com/gorilla/websocket v1.5.0
github.com/graph-gophers/graphql-go v1.3.0
github.com/hashicorp/go-bexpr v0.1.10
Expand Down Expand Up @@ -66,21 +66,21 @@ require (
github.com/tyler-smith/go-bip39 v1.1.0
github.com/urfave/cli/v2 v2.25.7
go.uber.org/automaxprocs v1.5.2
golang.org/x/crypto v0.14.0
golang.org/x/crypto v0.15.0
golang.org/x/exp v0.0.0-20230905200255-921286631fa9
golang.org/x/sync v0.3.0
golang.org/x/sys v0.13.0
golang.org/x/text v0.13.0
golang.org/x/sync v0.5.0
golang.org/x/sys v0.14.0
golang.org/x/text v0.14.0
golang.org/x/time v0.3.0
golang.org/x/tools v0.13.0
google.golang.org/grpc v1.53.0
google.golang.org/protobuf v1.33.0
google.golang.org/grpc v1.61.2
google.golang.org/protobuf v1.34.1
gopkg.in/natefinch/lumberjack.v2 v2.0.0
gopkg.in/yaml.v3 v3.0.1
)

require (
buf.build/gen/go/astria/sequencerblock-apis/protocolbuffers/go v1.33.0-20240423053322-44396ca8658a.1 // indirect
buf.build/gen/go/astria/sequencerblock-apis/protocolbuffers/go v1.34.1-20240515213933-356887db1177.1 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect
github.com/DataDog/zstd v1.4.5 // indirect
Expand Down Expand Up @@ -133,7 +133,7 @@ require (
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.12.0 // indirect
github.com/prometheus/client_model v0.2.1-0.20210607210712-147c58e9608a // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
Expand All @@ -143,8 +143,10 @@ require (
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/net v0.17.0 // indirect
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
golang.org/x/net v0.18.0 // indirect
google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
rsc.io/tmplfunc v0.0.3 // indirect
)
1,136 changes: 1,136 additions & 0 deletions go.sum

Large diffs are not rendered by default.

53 changes: 5 additions & 48 deletions grpc/execution/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,55 +240,12 @@ func (s *ExecutionServiceServerV1Alpha2) ExecuteBlock(ctx context.Context, req *

txsToProcess := types.Transactions{}
for _, tx := range req.Transactions {
if deposit := tx.GetDeposit(); deposit != nil {
bridgeAddress := string(deposit.BridgeAddress.GetInner())
bac, ok := s.bridgeAddresses[bridgeAddress]
if !ok {
log.Debug("ignoring deposit tx from unknown bridge", "bridgeAddress", bridgeAddress)
continue
}

if len(deposit.AssetId) != 32 {
log.Debug("ignoring deposit tx with invalid asset ID", "assetID", deposit.AssetId)
continue
}
assetID := [32]byte{}
copy(assetID[:], deposit.AssetId[:32])
if _, ok := s.bridgeAllowedAssetIDs[assetID]; !ok {
log.Debug("ignoring deposit tx with disallowed asset ID", "assetID", deposit.AssetId)
continue
}

amount := protoU128ToBigInt(deposit.Amount)
address := common.HexToAddress(deposit.DestinationChainAddress)
txdata := types.DepositTx{
From: address,
Value: bac.ScaledDepositAmount(amount),
Gas: 0,
}

tx := types.NewTx(&txdata)
txsToProcess = append(txsToProcess, tx)
} else {
ethTx := new(types.Transaction)
err := ethTx.UnmarshalBinary(tx.GetSequencedData())
if err != nil {
log.Error("failed to unmarshal sequenced data into transaction, ignoring", "tx hash", sha256.Sum256(tx.GetSequencedData()), "err", err)
continue
}

if ethTx.Type() == types.DepositTxType {
log.Debug("ignoring deposit tx in sequenced data", "tx hash", sha256.Sum256(tx.GetSequencedData()))
continue
}

if ethTx.Type() == types.BlobTxType {
log.Debug("ignoring blob tx in sequenced data", "tx hash", sha256.Sum256(tx.GetSequencedData()))
continue
}

txsToProcess = append(txsToProcess, ethTx)
unmarshalledTx, err := s.ValidateAndUnmarshalSequencerTx(tx)
if err != nil {
log.Error("failed to validate sequencer tx, ignoring", "tx", tx, "err", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
log.Error("failed to validate sequencer tx, ignoring", "tx", tx, "err", err)
log.Debug("failed to validate sequencer tx, ignoring", "tx", tx, "err", err)

continue
}
txsToProcess = append(txsToProcess, unmarshalledTx)
}

// This set of ordered TXs on the TxPool is has been configured to be used by
Expand Down
Loading
Loading