Skip to content

Commit

Permalink
fix: CCIP-2950 fix ManuallyExecute testHelper
Browse files Browse the repository at this point in the history
  • Loading branch information
defistar committed Aug 5, 2024
1 parent 12db93e commit 09d0248
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
3 changes: 0 additions & 3 deletions core/scripts/ccip/manual-execution/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,8 @@ func (args *execArgs) execute() error {
ProofFlagBits: helpers.ProofFlagsToBits(proof.SourceFlags),
}

// Execute. CCIP-2910: Declare a slice for gasLimitOverrides
gasLimitOverrides := make([]*helpers.EVM2EVMOffRampGasLimitOverride, len(offRampProof.Messages))

//CCIP-2910 initialize and populate the gasLimitOverride struct in loop
for range offRampProof.Messages {
evm2evmOffRampGasLimitOverride := &helpers.EVM2EVMOffRampGasLimitOverride{
ReceiverExecutionGasLimit: big.NewInt(int64(args.cfg.GasLimitOverride)),
Expand All @@ -312,7 +310,6 @@ func (args *execArgs) execute() error {
gasLimitOverrides = append(gasLimitOverrides, evm2evmOffRampGasLimitOverride)
}

// TODO-CCIP-2910: - should take slice of GasLimitOverrides Struct which contain gas limit overrides for each message
tx, err := helpers.ManuallyExecute(args.destChain, args.destUser, args.cfg.OffRamp, offRampProof, gasLimitOverrides)
if err != nil {
return err
Expand Down
10 changes: 7 additions & 3 deletions core/services/ocr2/plugins/ccip/testhelpers/ccip_contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -1274,6 +1274,7 @@ type ManualExecArgs struct {
OffRamp string
SeqNr uint64
GasLimit *big.Int
destGasAmounts []*big.Int
}

// ApproxDestStartBlock attempts to locate a block in destination chain with timestamp closest to the timestamp of the block
Expand Down Expand Up @@ -1416,6 +1417,9 @@ func (args *ManualExecArgs) ExecuteManually() (*types.Transaction, error) {
return nil, fmt.Errorf("unable to find seq num %d in commit report", args.SeqNr)
}

// initialize the destGasAmounts in the executeArgs
args.destGasAmounts = make([]*big.Int, 1)

return args.execute(commitReport)
}

Expand All @@ -1437,7 +1441,7 @@ func (args *ManualExecArgs) execute(report *commit_store.CommitStoreCommitReport
var curr, prove int
var msgs []evm_2_evm_offramp.InternalEVM2EVMMessage

// TODO-CCIP-2910 TestHelper for CCIPContracts and initialisation of EVM2EVMOffRampGasLimitOverride
// CCIP-2950 TestHelper for CCIPContracts and initialisation of EVM2EVMOffRampGasLimitOverride
var manualExecGasLimits []*evm_2_evm_offramp.EVM2EVMOffRampGasLimitOverride
var tokenData [][][]byte
sendRequestedIterator, err := onRampContract.FilterCCIPSendRequested(&bind.FilterOpts{
Expand Down Expand Up @@ -1484,10 +1488,10 @@ func (args *ManualExecArgs) execute(report *commit_store.CommitStoreCommitReport
msg.GasLimit = args.GasLimit
}

// CCIP-2910 create a new object for evm_2_evm_offramp.EVM2EVMOffRampGasLimitOverride
// CCIP-2950 create a new object for evm_2_evm_offramp.EVM2EVMOffRampGasLimitOverride
evm2evmOffRampGasLimitOverride := &evm_2_evm_offramp.EVM2EVMOffRampGasLimitOverride{
ReceiverExecutionGasLimit: msg.GasLimit,
DestGasAmounts: []*big.Int{},
DestGasAmounts: args.destGasAmounts,
}

manualExecGasLimits = append(manualExecGasLimits, evm2evmOffRampGasLimitOverride)
Expand Down

0 comments on commit 09d0248

Please sign in to comment.