-
Notifications
You must be signed in to change notification settings - Fork 4
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
Changes from 10 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
dd68b8e
fix tests
bharath-123 34fd089
add github workflow to run tests
bharath-123 80058a9
fix CI file
bharath-123 f96d50d
remove log
bharath-123 feccaf1
add unit tests for execution grpc server
bharath-123 dd3e382
add test case for deposit tx
bharath-123 3c23c83
update tests
bharath-123 f1523a1
add tests for astria bridge address config validation
bharath-123 9fe377c
abstract out sequencer tx validation
bharath-123 1a4b890
remove block check in get genesis info test
bharath-123 4784e07
refactor tests to make them more readable
bharath-123 ad553f4
remove stray print stmt
bharath-123 641cc3c
take in bridge addresses and allowed asset ids in ValidateAndUnmarsha…
bharath-123 b8b9cd9
fix minor nit
bharath-123 7f64d5f
use require package to make assertions in tests
bharath-123 2273524
avoid using grpc server
bharath-123 168d8a0
address review comments
bharath-123 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 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 |
---|---|---|
|
@@ -22,4 +22,4 @@ jobs: | |
- name: Run tests | ||
run: go test -short ./... | ||
env: | ||
GOOS: linux | ||
GOOS: linux |
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 |
---|---|---|
|
@@ -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") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove? |
||
return errUnauthorizedSigner | ||
} | ||
for seen, recent := range snap.Recents { | ||
|
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
Large diffs are not rendered by default.
Oops, something went wrong.
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 | ||||
---|---|---|---|---|---|---|
|
@@ -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) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
continue | ||||||
} | ||||||
txsToProcess = append(txsToProcess, unmarshalledTx) | ||||||
} | ||||||
|
||||||
// This set of ordered TXs on the TxPool is has been configured to be used by | ||||||
|
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: new line