Skip to content

Commit

Permalink
Fix test flakes in comparing ocr3 config (#14738)
Browse files Browse the repository at this point in the history
* fixing ocr3 config set up flake

* few more fixes
  • Loading branch information
AnieeG authored Oct 11, 2024
1 parent 4ac405a commit 7b67985
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
15 changes: 10 additions & 5 deletions integration-tests/deployment/ccip/deploy_home_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,11 @@ func AddDON(
return err
}

mapOfframpOCR3Configs := make(map[cctypes.PluginType]offramp.MultiOCR3BaseOCRConfigArgs)
for _, config := range offrampOCR3Configs {
mapOfframpOCR3Configs[cctypes.PluginType(config.OcrPluginType)] = config
}

for _, pluginType := range []cctypes.PluginType{cctypes.PluginTypeCCIPCommit, cctypes.PluginTypeCCIPExec} {
ocrConfig, err := offRamp.LatestConfigDetails(&bind.CallOpts{
Context: context.Background(),
Expand All @@ -809,24 +814,24 @@ func AddDON(
}
// TODO: assertions to be done as part of full state
// resprentation validation CCIP-3047
if offrampOCR3Configs[pluginType].ConfigDigest != ocrConfig.ConfigInfo.ConfigDigest {
if mapOfframpOCR3Configs[pluginType].ConfigDigest != ocrConfig.ConfigInfo.ConfigDigest {
return fmt.Errorf("%s OCR3 config digest mismatch", pluginType.String())
}
if offrampOCR3Configs[pluginType].F != ocrConfig.ConfigInfo.F {
if mapOfframpOCR3Configs[pluginType].F != ocrConfig.ConfigInfo.F {
return fmt.Errorf("%s OCR3 config F mismatch", pluginType.String())
}
if offrampOCR3Configs[pluginType].IsSignatureVerificationEnabled != ocrConfig.ConfigInfo.IsSignatureVerificationEnabled {
if mapOfframpOCR3Configs[pluginType].IsSignatureVerificationEnabled != ocrConfig.ConfigInfo.IsSignatureVerificationEnabled {
return fmt.Errorf("%s OCR3 config signature verification mismatch", pluginType.String())
}
if pluginType == cctypes.PluginTypeCCIPCommit {
// only commit will set signers, exec doesn't need them.
for i, signer := range offrampOCR3Configs[pluginType].Signers {
for i, signer := range mapOfframpOCR3Configs[pluginType].Signers {
if !bytes.Equal(signer.Bytes(), ocrConfig.Signers[i].Bytes()) {
return fmt.Errorf("%s OCR3 config signer mismatch", pluginType.String())
}
}
}
for i, transmitter := range offrampOCR3Configs[pluginType].Transmitters {
for i, transmitter := range mapOfframpOCR3Configs[pluginType].Transmitters {
if !bytes.Equal(transmitter.Bytes(), ocrConfig.Transmitters[i].Bytes()) {
return fmt.Errorf("%s OCR3 config transmitter mismatch", pluginType.String())
}
Expand Down
6 changes: 1 addition & 5 deletions integration-tests/deployment/devenv/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,7 @@ func NewChains(logger logger.Logger, configs []ChainConfig) (map[uint64]deployme
blockNumber = receipt.BlockNumber.Uint64()
}
if receipt.Status == 0 {
t, _, err := ec.TransactionByHash(context.Background(), tx.Hash())
if err != nil {
return fmt.Errorf("tx %s reverted, failed to get transaction: %w", tx.Hash().Hex(), err)
}
errReason, err := deployment.GetErrorReasonFromTx(ec, chainCfg.DeployerKey.From, *t, receipt)
errReason, err := deployment.GetErrorReasonFromTx(ec, chainCfg.DeployerKey.From, *tx, receipt)
if err == nil && errReason != "" {
return fmt.Errorf("tx %s reverted,error reason: %s", tx.Hash().Hex(), errReason)
}
Expand Down
6 changes: 5 additions & 1 deletion integration-tests/deployment/memory/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ func generateMemoryChain(t *testing.T, inputs map[uint64]EVMChain) map[uint64]de
continue
}
if receipt.Status == 0 {
t.Logf("Status (reverted) %d for txhash %s\n", receipt.Status, tx.Hash().Hex())
errReason, err := deployment.GetErrorReasonFromTx(chain.Backend, chain.DeployerKey.From, *tx, receipt)
if err == nil && errReason != "" {
return 0, fmt.Errorf("tx %s reverted,error reason: %s", tx.Hash().Hex(), errReason)
}
return 0, fmt.Errorf("tx %s reverted, could not decode error reason", tx.Hash().Hex())
}
return receipt.BlockNumber.Uint64(), nil
}
Expand Down

0 comments on commit 7b67985

Please sign in to comment.