From 59c11b9b20dcb11ba322a439ca935f17fafb0cd4 Mon Sep 17 00:00:00 2001 From: nogo <0xnogo@gmail.com> Date: Fri, 15 Nov 2024 11:58:42 +0400 Subject: [PATCH] addressing comments --- core/capabilities/ccip/ccipevm/gas_helpers.go | 1 + deployment/ccip/add_lane.go | 7 ++++--- integration-tests/ccip-tests/testsetups/ccip.go | 9 --------- integration-tests/smoke/ccip_messaging_test.go | 11 ++++++++++- integration-tests/smoke/fee_boosting_test.go | 4 ++-- 5 files changed, 17 insertions(+), 15 deletions(-) diff --git a/core/capabilities/ccip/ccipevm/gas_helpers.go b/core/capabilities/ccip/ccipevm/gas_helpers.go index b0657a55da1..2706650f48e 100644 --- a/core/capabilities/ccip/ccipevm/gas_helpers.go +++ b/core/capabilities/ccip/ccipevm/gas_helpers.go @@ -27,6 +27,7 @@ const ( ExecutionStateProcessingOverheadGas = 2_100 + // COLD_SLOAD_COST for first reading the state 20_000 + // SSTORE_SET_GAS for writing from 0 (untouched) to non-zero (in-progress) 100 //# SLOAD_GAS = WARM_STORAGE_READ_COST for rewriting from non-zero (in-progress) to non-zero (success/failure) + // TODO: investigate the write overhead for v1.6 DestGasOverhead = 110_000 + 110_000 + 130_000 // 110K for commit, 110K for RMN, 130K for Exec ) diff --git a/deployment/ccip/add_lane.go b/deployment/ccip/add_lane.go index deb2dfe9bc7..8af96277fc2 100644 --- a/deployment/ccip/add_lane.go +++ b/deployment/ccip/add_lane.go @@ -7,6 +7,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/smartcontractkit/chainlink/deployment" + "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/ccipevm" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/offramp" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/fee_quoter" @@ -122,15 +123,15 @@ func DefaultFeeQuoterDestChainConfig() fee_quoter.FeeQuoterDestChainConfig { MaxNumberOfTokensPerMsg: 10, MaxDataBytes: 256, MaxPerMsgGasLimit: 3_000_000, - DestGasOverhead: 350_000, + DestGasOverhead: ccipevm.DestGasOverhead, DefaultTokenFeeUSDCents: 1, - DestGasPerPayloadByte: 16, + DestGasPerPayloadByte: ccipevm.CalldataGasPerByte, DestDataAvailabilityOverheadGas: 100, DestGasPerDataAvailabilityByte: 100, DestDataAvailabilityMultiplierBps: 1, DefaultTokenDestGasOverhead: 125_000, DefaultTxGasLimit: 200_000, - GasMultiplierWeiPerEth: 11e17, + GasMultiplierWeiPerEth: 11e17, // Gas multiplier in wei per eth is scaled by 1e18, so 11e17 is 1.1 = 110% NetworkFeeUSDCents: 1, ChainFamilySelector: [4]byte(evmFamilySelector), } diff --git a/integration-tests/ccip-tests/testsetups/ccip.go b/integration-tests/ccip-tests/testsetups/ccip.go index a738904b281..eee424d50d1 100644 --- a/integration-tests/ccip-tests/testsetups/ccip.go +++ b/integration-tests/ccip-tests/testsetups/ccip.go @@ -37,7 +37,6 @@ import ( "github.com/smartcontractkit/chainlink-testing-framework/lib/networks" "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/testcontext" - ccipdeployment "github.com/smartcontractkit/chainlink/deployment/ccip" integrationactions "github.com/smartcontractkit/chainlink/integration-tests/actions" "github.com/smartcontractkit/chainlink/integration-tests/ccip-tests/actions" "github.com/smartcontractkit/chainlink/integration-tests/ccip-tests/contracts" @@ -1435,11 +1434,3 @@ func createEnvironmentConfig(t *testing.T, envName string, testConfig *CCIPTestC } return envConfig } - -func SleepAndReplay(t *testing.T, e ccipdeployment.DeployedEnv, sourceChain, destChain uint64) { - time.Sleep(30 * time.Second) - replayBlocks := make(map[uint64]uint64) - replayBlocks[sourceChain] = 1 - replayBlocks[destChain] = 1 - ccipdeployment.ReplayLogs(t, e.Env.Offchain, replayBlocks) -} diff --git a/integration-tests/smoke/ccip_messaging_test.go b/integration-tests/smoke/ccip_messaging_test.go index 775466d4730..5fb5adf0c6f 100644 --- a/integration-tests/smoke/ccip_messaging_test.go +++ b/integration-tests/smoke/ccip_messaging_test.go @@ -2,6 +2,7 @@ package smoke import ( "testing" + "time" "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" @@ -170,6 +171,14 @@ func Test_CCIPMessaging(t *testing.T) { }) } +func sleepAndReplay(t *testing.T, e ccipdeployment.DeployedEnv, sourceChain, destChain uint64) { + time.Sleep(30 * time.Second) + replayBlocks := make(map[uint64]uint64) + replayBlocks[sourceChain] = 1 + replayBlocks[destChain] = 1 + ccipdeployment.ReplayLogs(t, e.Env.Offchain, replayBlocks) +} + func runMessagingTestCase( tc messagingTestCase, receiver common.Address, @@ -198,7 +207,7 @@ func runMessagingTestCase( // hack if !tc.replayed { - testsetups.SleepAndReplay(tc.t, tc.deployedEnv, tc.sourceChain, tc.destChain) + sleepAndReplay(tc.t, tc.deployedEnv, tc.sourceChain, tc.destChain) out.replayed = true } diff --git a/integration-tests/smoke/fee_boosting_test.go b/integration-tests/smoke/fee_boosting_test.go index 249f6194f6f..8b213a71277 100644 --- a/integration-tests/smoke/fee_boosting_test.go +++ b/integration-tests/smoke/fee_boosting_test.go @@ -33,8 +33,8 @@ type priceFeedPrices struct { wethPrice *big.Int } +// TODO: find a way to reuse the same test setup for all tests func Test_CCIPFeeBoosting(t *testing.T) { - t.Skip("Skipping test as it is not fully implemented yet") ctx := ccdeploy.Context(t) setupTestEnv := func(t *testing.T, numChains int) (ccipdeployment.DeployedEnv, ccipdeployment.CCIPOnChainState, []uint64) { @@ -161,7 +161,7 @@ func runFeeboostTestCase(tc feeboostTestCase) { }) expectedSeqNum[tc.destChain] = seqNum - testsetups.SleepAndReplay(tc.t, tc.deployedEnv, tc.sourceChain, tc.destChain) + sleepAndReplay(tc.t, tc.deployedEnv, tc.sourceChain, tc.destChain) ccipdeployment.ConfirmCommitForAllWithExpectedSeqNums(tc.t, tc.deployedEnv.Env, tc.onchainState, expectedSeqNum, startBlocks) ccipdeployment.ConfirmExecWithSeqNrForAll(tc.t, tc.deployedEnv.Env, tc.onchainState, expectedSeqNum, startBlocks)