diff --git a/pkg/chain/ethereum/tbtc.go b/pkg/chain/ethereum/tbtc.go index 7dab7d807d..9b20293ff6 100644 --- a/pkg/chain/ethereum/tbtc.go +++ b/pkg/chain/ethereum/tbtc.go @@ -1788,7 +1788,26 @@ func (tc *TbtcChain) ValidateMovedFundsSweepProposal( walletPublicKeyHash [20]byte, proposal *tbtc.MovedFundsSweepProposal, ) error { - // TODO: Implement + abiProposal := tbtcabi.WalletProposalValidatorMovedFundsSweepProposal{ + WalletPubKeyHash: walletPublicKeyHash, + MovingFundsTxHash: proposal.MovingFundsTxHash, + MovingFundsTxOutputIndex: proposal.MovingFundsTxOutputIndex, + MovedFundsSweepTxFee: proposal.SweepTxFee, + } + + valid, err := tc.walletProposalValidator.ValidateMovedFundsSweepProposal( + abiProposal, + ) + if err != nil { + return fmt.Errorf("validation failed: [%v]", err) + } + + // Should never happen because `validateMovedFundsSweepProposal` returns + // true or reverts (returns an error) but do the check just in case. + if !valid { + return fmt.Errorf("unexpected validation result") + } + return nil } diff --git a/pkg/tbtc/moved_funds_sweep.go b/pkg/tbtc/moved_funds_sweep.go index b10f09ca23..489a05ac03 100644 --- a/pkg/tbtc/moved_funds_sweep.go +++ b/pkg/tbtc/moved_funds_sweep.go @@ -1,6 +1,7 @@ package tbtc import ( + "fmt" "math/big" "time" @@ -63,6 +64,18 @@ func ValidateMovedFundsSweepProposal( ) error }, ) error { - // TODO: Implement + validateProposalLogger.Infof("calling chain for proposal validation") + + err := chain.ValidateMovedFundsSweepProposal( + walletPublicKeyHash, + proposal, + ) + + if err != nil { + return fmt.Errorf("moved funds sweep proposal is invalid: [%v]", err) + } + + validateProposalLogger.Infof("moved funds sweep proposal is valid") + return nil } diff --git a/pkg/tbtcpg/moved_funds_sweep_test.go b/pkg/tbtcpg/moved_funds_sweep_test.go index b3a6663b51..2b9d1aa827 100644 --- a/pkg/tbtcpg/moved_funds_sweep_test.go +++ b/pkg/tbtcpg/moved_funds_sweep_test.go @@ -9,7 +9,7 @@ import ( "github.com/keep-network/keep-core/pkg/tbtcpg" ) -func TestFindMovingFundsTxData(t *testing.T) { +func TestMovedFundsSweepAction_FindMovingFundsTxData(t *testing.T) { walletPublicKeyHash := hexToByte20( "92a6ec889a8fa34f731e639edede4c75e184307c", )