Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into joroshiba/celestia-he…
Browse files Browse the repository at this point in the history
…ight-storage
  • Loading branch information
joroshiba committed May 31, 2024
2 parents 0ee2dc9 + 9185612 commit c143ea0
Show file tree
Hide file tree
Showing 7 changed files with 960 additions and 49 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ require (
buf.build/gen/go/astria/execution-apis/grpc/go v1.3.0-00000000000000-84e5e35facb9.3
buf.build/gen/go/astria/execution-apis/protocolbuffers/go v1.34.1-00000000000000-84e5e35facb9.1
buf.build/gen/go/astria/primitives/protocolbuffers/go v1.34.1-20240529204957-2697e2110d78.1
buf.build/gen/go/astria/sequencerblock-apis/protocolbuffers/go v1.34.1-20240529204957-1b3cb2034833.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 @@ -80,7 +81,6 @@ require (
)

require (
buf.build/gen/go/astria/sequencerblock-apis/protocolbuffers/go v1.34.1-20240529204957-1b3cb2034833.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
53 changes: 5 additions & 48 deletions grpc/execution/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,55 +239,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 := validateAndUnmarshalSequencerTx(tx, s.bridgeAddresses, s.bridgeAllowedAssetIDs)
if err != nil {
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

0 comments on commit c143ea0

Please sign in to comment.