Skip to content

Commit

Permalink
Merge pull request #316 from multiversx/refund-tests
Browse files Browse the repository at this point in the history
Refund workflow test & sc calls executor module main app
  • Loading branch information
iulianpascalau authored Aug 6, 2024
2 parents 2375733 + 2519e1c commit b09e8df
Show file tree
Hide file tree
Showing 66 changed files with 1,552 additions and 678 deletions.
15 changes: 8 additions & 7 deletions bridges/ethMultiversX/bridgeExecutor.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/multiversx/mx-bridge-eth-go/clients"
"github.com/multiversx/mx-bridge-eth-go/clients/ethereum/contract"
bridgeCommon "github.com/multiversx/mx-bridge-eth-go/common"
"github.com/multiversx/mx-bridge-eth-go/core"
"github.com/multiversx/mx-bridge-eth-go/core/batchProcessor"
"github.com/multiversx/mx-bridge-eth-go/parsers"
Expand Down Expand Up @@ -50,7 +51,7 @@ type bridgeExecutor struct {
maxQuorumRetriesOnMultiversX uint64
maxRetriesOnWasProposed uint64

batch *clients.TransferBatch
batch *bridgeCommon.TransferBatch
actionID uint64
msgHash common.Hash
quorumRetriesOnEthereum uint64
Expand Down Expand Up @@ -150,7 +151,7 @@ func (executor *bridgeExecutor) MyTurnAsLeader() bool {
}

// GetBatchFromMultiversX fetches the pending batch from MultiversX
func (executor *bridgeExecutor) GetBatchFromMultiversX(ctx context.Context) (*clients.TransferBatch, error) {
func (executor *bridgeExecutor) GetBatchFromMultiversX(ctx context.Context) (*bridgeCommon.TransferBatch, error) {
batch, err := executor.multiversXClient.GetPendingBatch(ctx)
if err == nil {
executor.statusHandler.SetIntMetric(core.MetricNumBatches, int(batch.ID)-1)
Expand All @@ -159,7 +160,7 @@ func (executor *bridgeExecutor) GetBatchFromMultiversX(ctx context.Context) (*cl
}

// StoreBatchFromMultiversX saves the pending batch from MultiversX
func (executor *bridgeExecutor) StoreBatchFromMultiversX(batch *clients.TransferBatch) error {
func (executor *bridgeExecutor) StoreBatchFromMultiversX(batch *bridgeCommon.TransferBatch) error {
if batch == nil {
return ErrNilBatch
}
Expand All @@ -169,7 +170,7 @@ func (executor *bridgeExecutor) StoreBatchFromMultiversX(batch *clients.Transfer
}

// GetStoredBatch returns the stored batch
func (executor *bridgeExecutor) GetStoredBatch() *clients.TransferBatch {
func (executor *bridgeExecutor) GetStoredBatch() *bridgeCommon.TransferBatch {
return executor.batch
}

Expand Down Expand Up @@ -461,7 +462,7 @@ func (executor *bridgeExecutor) GetAndStoreBatchFromEthereum(ctx context.Context
}

// addBatchSCMetadata fetches the logs containing sc calls metadata for the current batch
func (executor *bridgeExecutor) addBatchSCMetadata(ctx context.Context, transfers *clients.TransferBatch) (*clients.TransferBatch, error) {
func (executor *bridgeExecutor) addBatchSCMetadata(ctx context.Context, transfers *bridgeCommon.TransferBatch) (*bridgeCommon.TransferBatch, error) {
if transfers == nil {
return nil, ErrNilBatch
}
Expand All @@ -478,7 +479,7 @@ func (executor *bridgeExecutor) addBatchSCMetadata(ctx context.Context, transfer
return transfers, nil
}

func (executor *bridgeExecutor) addMetadataToTransfer(transfer *clients.DepositTransfer, events []*contract.ERC20SafeERC20SCDeposit) *clients.DepositTransfer {
func (executor *bridgeExecutor) addMetadataToTransfer(transfer *bridgeCommon.DepositTransfer, events []*contract.ERC20SafeERC20SCDeposit) *bridgeCommon.DepositTransfer {
for _, event := range events {
if event.DepositNonce.Uint64() == transfer.Nonce {
transfer.Data = []byte(event.CallData)
Expand All @@ -492,7 +493,7 @@ func (executor *bridgeExecutor) addMetadataToTransfer(transfer *clients.DepositT
}
}

transfer.Data = []byte{parsers.MissingDataProtocolMarker}
transfer.Data = []byte{parsers.MissingDataProtocolMarker} // make([]byte, 0)
transfer.DisplayableData = ""

return transfer
Expand Down
Loading

0 comments on commit b09e8df

Please sign in to comment.