Skip to content

Commit

Permalink
Merge branch 'develop' into BCI-4097-Update-the-TXM-confirmation-logi…
Browse files Browse the repository at this point in the history
…c-to-use-the-mined-nonce
  • Loading branch information
amit-momin committed Nov 7, 2024
2 parents 9744327 + 9fff611 commit b1ec4e8
Show file tree
Hide file tree
Showing 48 changed files with 1,264 additions and 320 deletions.
5 changes: 5 additions & 0 deletions .changeset/brave-frogs-greet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": minor
---

update plugin and evm chainwriter to remove evmConfig dependency #updated
5 changes: 5 additions & 0 deletions .changeset/strange-radios-teach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

Merge raw configs correctly #bugfix
5 changes: 5 additions & 0 deletions .changeset/tender-colts-return.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

#updated celo alfajores config
2 changes: 1 addition & 1 deletion .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ jobs:
contents: read
needs: [build-chainlink, changes]
if: github.event_name == 'pull_request' && ( needs.changes.outputs.core_changes == 'true' || needs.changes.outputs.github_ci_changes == 'true')
uses: smartcontractkit/.github/.github/workflows/run-e2e-tests.yml@ca50645120f0f07ed8c0df08175a5d6b3e4ac454 #ctf-run-tests@0.1.2
uses: smartcontractkit/.github/.github/workflows/run-e2e-tests.yml@5412507526722a7b1c5d719fa686eed5a1bc4035 #ctf-run-tests@0.2.0
with:
workflow_name: Run Core E2E Tests For PR
chainlink_version: ${{ inputs.evm-ref || github.sha }}
Expand Down
33 changes: 21 additions & 12 deletions ccip/config/evm/Celo_Testnet.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,30 @@
ChainID = '44787'
ChainType = 'celo'
FinalityDepth = 10
LogPollInterval = '5s'
MinIncomingConfirmations = 1
FinalityTagEnabled = true
FinalityDepth = 2750 # mean finality time of ~37 minutes + 500 block buffer
LogPollInterval = '1s' # 1 sec block rate
NoNewHeadsThreshold = '1m'
OCR.ContractConfirmations = 1
NoNewFinalizedHeadsThreshold = '1m'
MinIncomingConfirmations = 1
NoNewFinalizedHeadsThreshold = '45m' # Set slightly higher than mean finality time

[GasEstimator]
PriceDefault = '5 gwei'
PriceMax = '500 gwei'
PriceMin = '5 gwei'
BumpMin = '2 gwei'
EIP1559DynamicFees = true
PriceMin = '5 gwei' # Mean gas price around 5 gwei and celo txns are extremely cheap at ~0.00088 CELO per txn ($0.000058)
PriceMax = '1000 gwei' # DS&A recommendation

[GasEstimator.BlockHistory]
BlockHistorySize = 24
# Default is 8, which leads to bumpy gas prices. In CCIP
# we want to smooth out the gas prices, so we increase the sample size.
BlockHistorySize = 200

[Transactions]
ResendAfterThreshold = '30s'

[HeadTracker]
HistoryDepth = 50
PersistenceEnabled = false
HistoryDepth = 300

[NodePool]
SyncThreshold = 10 # recommended for OP stack chains

[OCR]
ContractConfirmations = 1 # recommended for OP stack chains
9 changes: 0 additions & 9 deletions core/capabilities/ccip/configs/evm/chain_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (

"github.com/smartcontractkit/chainlink-ccip/pkg/consts"

"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets"
evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/offramp"
evmrelaytypes "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types"
Expand All @@ -21,19 +20,12 @@ var (
// ChainWriterConfigRaw returns a ChainWriterConfig that can be used to transmit commit and execute reports.
func ChainWriterConfigRaw(
fromAddress common.Address,
maxGasPrice *assets.Wei,
commitGasLimit,
execBatchGasLimit uint64,
) (evmrelaytypes.ChainWriterConfig, error) {
if fromAddress == common.HexToAddress("0x0") {
return evmrelaytypes.ChainWriterConfig{}, fmt.Errorf("fromAddress cannot be zero")
}
if maxGasPrice == nil {
return evmrelaytypes.ChainWriterConfig{}, fmt.Errorf("maxGasPrice cannot be nil")
}
if maxGasPrice.Cmp(assets.NewWeiI(0)) <= 0 {
return evmrelaytypes.ChainWriterConfig{}, fmt.Errorf("maxGasPrice must be greater than zero")
}
if commitGasLimit == 0 {
return evmrelaytypes.ChainWriterConfig{}, fmt.Errorf("commitGasLimit must be greater than zero")
}
Expand All @@ -59,7 +51,6 @@ func ChainWriterConfigRaw(
},
},
},
MaxGasPrice: maxGasPrice,
}, nil
}

Expand Down
35 changes: 1 addition & 34 deletions core/capabilities/ccip/configs/evm/chain_writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,70 +8,40 @@ import (

"github.com/smartcontractkit/chainlink-ccip/pkg/consts"
"github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/configs/evm"
"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets"
)

func TestChainWriterConfigRaw(t *testing.T) {
tests := []struct {
name string
fromAddress common.Address
maxGasPrice *assets.Wei
commitGasLimit uint64
execBatchGasLimit uint64
expectedError string
}{
{
name: "valid input",
fromAddress: common.HexToAddress("0x1234567890abcdef1234567890abcdef12345678"),
maxGasPrice: assets.NewWeiI(1000000000),
commitGasLimit: 21000,
execBatchGasLimit: 42000,
expectedError: "",
},
{
name: "zero fromAddress",
fromAddress: common.HexToAddress("0x0"),
maxGasPrice: assets.NewWeiI(1000000000),
commitGasLimit: 21000,
execBatchGasLimit: 42000,
expectedError: "fromAddress cannot be zero",
},
{
name: "nil maxGasPrice",
fromAddress: common.HexToAddress("0x1234567890abcdef1234567890abcdef12345678"),
maxGasPrice: nil,
commitGasLimit: 21000,
execBatchGasLimit: 42000,
expectedError: "maxGasPrice cannot be nil",
},
{
name: "zero maxGasPrice",
fromAddress: common.HexToAddress("0x1234567890abcdef1234567890abcdef12345678"),
maxGasPrice: assets.NewWeiI(0),
commitGasLimit: 21000,
execBatchGasLimit: 42000,
expectedError: "maxGasPrice must be greater than zero",
},
{
name: "negative maxGasPrice",
fromAddress: common.HexToAddress("0x1234567890abcdef1234567890abcdef12345678"),
maxGasPrice: assets.NewWeiI(-1),
commitGasLimit: 21000,
execBatchGasLimit: 42000,
expectedError: "maxGasPrice must be greater than zero",
},
{
name: "zero commitGasLimit",
fromAddress: common.HexToAddress("0x1234567890abcdef1234567890abcdef12345678"),
maxGasPrice: assets.NewWeiI(1000000000),
commitGasLimit: 0,
execBatchGasLimit: 42000,
expectedError: "commitGasLimit must be greater than zero",
},
{
name: "zero execBatchGasLimit",
fromAddress: common.HexToAddress("0x1234567890abcdef1234567890abcdef12345678"),
maxGasPrice: assets.NewWeiI(1000000000),
commitGasLimit: 21000,
execBatchGasLimit: 0,
expectedError: "execBatchGasLimit must be greater than zero",
Expand All @@ -80,7 +50,7 @@ func TestChainWriterConfigRaw(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
config, err := evm.ChainWriterConfigRaw(tt.fromAddress, tt.maxGasPrice, tt.commitGasLimit, tt.execBatchGasLimit)
config, err := evm.ChainWriterConfigRaw(tt.fromAddress, tt.commitGasLimit, tt.execBatchGasLimit)
if tt.expectedError != "" {
assert.EqualError(t, err, tt.expectedError)
} else {
Expand All @@ -94,9 +64,6 @@ func TestChainWriterConfigRaw(t *testing.T) {
assert.Equal(t,
tt.execBatchGasLimit,
config.Contracts[consts.ContractNameOffRamp].Configs[consts.MethodExecute].GasLimit)
assert.Equal(t,
tt.maxGasPrice,
config.MaxGasPrice)
}
})
}
Expand Down
1 change: 0 additions & 1 deletion core/capabilities/ccip/delegate.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ func (d *Delegate) ServicesForSpec(ctx context.Context, spec job.Job) (services
bootstrapperLocators,
hcr,
cciptypes.ChainSelector(homeChainChainSelector),
d.evmConfigs,
)
} else {
oracleCreator = oraclecreator.NewBootstrapOracleCreator(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ func makeTestEvmTxm(
keyStore keystore.Eth) (txmgr.TxManager, gas.EvmFeeEstimator) {
config, dbConfig, evmConfig := MakeTestConfigs(t)

estimator, err := gas.NewEstimator(logger.TestLogger(t), ethClient, config.ChainType(), evmConfig.GasEstimator(), nil)
estimator, err := gas.NewEstimator(logger.TestLogger(t), ethClient, config.ChainType(), ethClient.ConfiguredChainID(), evmConfig.GasEstimator(), nil)
require.NoError(t, err, "failed to create gas estimator")

lggr := logger.TestLogger(t)
Expand Down
11 changes: 0 additions & 11 deletions core/capabilities/ccip/oraclecreator/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ type pluginOracleCreator struct {
homeChainReader ccipreaderpkg.HomeChain
homeChainSelector cciptypes.ChainSelector
relayers map[types.RelayID]loop.Relayer
evmConfigs toml.EVMConfigs
}

func NewPluginOracleCreator(
Expand All @@ -91,7 +90,6 @@ func NewPluginOracleCreator(
bootstrapperLocators []commontypes.BootstrapperLocator,
homeChainReader ccipreaderpkg.HomeChain,
homeChainSelector cciptypes.ChainSelector,
evmConfigs toml.EVMConfigs,
) cctypes.OracleCreator {
return &pluginOracleCreator{
ocrKeyBundles: ocrKeyBundles,
Expand All @@ -108,7 +106,6 @@ func NewPluginOracleCreator(
bootstrapperLocators: bootstrapperLocators,
homeChainReader: homeChainReader,
homeChainSelector: homeChainSelector,
evmConfigs: evmConfigs,
}
}

Expand Down Expand Up @@ -367,7 +364,6 @@ func (i *pluginOracleCreator) createReadersAndWriters(
cw, err1 := createChainWriter(
ctx,
chainID,
i.evmConfigs,
relayer,
i.transmitters,
execBatchGasLimit)
Expand Down Expand Up @@ -480,7 +476,6 @@ func isUSDCEnabled(ofc offChainConfig) bool {
func createChainWriter(
ctx context.Context,
chainID *big.Int,
evmConfigs toml.EVMConfigs,
relayer loop.Relayer,
transmitters map[types.RelayID][]string,
execBatchGasLimit uint64,
Expand All @@ -492,14 +487,8 @@ func createChainWriter(
fromAddress = common.HexToAddress(transmitter[0])
}

maxGasPrice := getKeySpecificMaxGasPrice(evmConfigs, chainID, fromAddress)
if maxGasPrice == nil {
return nil, fmt.Errorf("failed to find max gas price for chain %s", chainID.String())
}

chainWriterRawConfig, err := evmconfig.ChainWriterConfigRaw(
fromAddress,
maxGasPrice,
defaultCommitGasLimit,
execBatchGasLimit,
)
Expand Down
3 changes: 2 additions & 1 deletion core/capabilities/integration_tests/keystone/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ consensus:
observations:
- "$(trigger.outputs)"
config:
report_id: "0001"
report_id: "0001"
key_id: "evm"
aggregation_method: "data_feeds"
aggregation_config:
feeds:
Expand Down
6 changes: 3 additions & 3 deletions core/chains/evm/client/chain_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ type Client interface {
SuggestGasPrice(ctx context.Context) (*big.Int, error)
SuggestGasTipCap(ctx context.Context) (*big.Int, error)
LatestBlockHeight(ctx context.Context) (*big.Int, error)
FeeHistory(ctx context.Context, blockCount uint64, rewardPercentiles []float64) (feeHistory *ethereum.FeeHistory, err error)
FeeHistory(ctx context.Context, blockCount uint64, lastBlock *big.Int, rewardPercentiles []float64) (feeHistory *ethereum.FeeHistory, err error)

HeaderByNumber(ctx context.Context, n *big.Int) (*types.Header, error)
HeaderByHash(ctx context.Context, h common.Hash) (*types.Header, error)
Expand Down Expand Up @@ -473,12 +473,12 @@ func (c *chainClient) LatestFinalizedBlock(ctx context.Context) (*evmtypes.Head,
return r.LatestFinalizedBlock(ctx)
}

func (c *chainClient) FeeHistory(ctx context.Context, blockCount uint64, rewardPercentiles []float64) (feeHistory *ethereum.FeeHistory, err error) {
func (c *chainClient) FeeHistory(ctx context.Context, blockCount uint64, lastBlock *big.Int, rewardPercentiles []float64) (feeHistory *ethereum.FeeHistory, err error) {
r, err := c.multiNode.SelectRPC()
if err != nil {
return feeHistory, err
}
return r.FeeHistory(ctx, blockCount, rewardPercentiles)
return r.FeeHistory(ctx, blockCount, lastBlock, rewardPercentiles)
}

func (c *chainClient) CheckTxValidity(ctx context.Context, from common.Address, to common.Address, data []byte) *SendError {
Expand Down
29 changes: 15 additions & 14 deletions core/chains/evm/client/mocks/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion core/chains/evm/client/null_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,6 @@ func (nc *NullClient) CheckTxValidity(_ context.Context, _ common.Address, _ com
return nil
}

func (nc *NullClient) FeeHistory(ctx context.Context, blockCount uint64, rewardPercentiles []float64) (feeHistory *ethereum.FeeHistory, err error) {
func (nc *NullClient) FeeHistory(ctx context.Context, blockCount uint64, lastBlock *big.Int, rewardPercentiles []float64) (feeHistory *ethereum.FeeHistory, err error) {
return nil, nil
}
Loading

0 comments on commit b1ec4e8

Please sign in to comment.