Skip to content

Commit

Permalink
Resolve conflicts
Browse files Browse the repository at this point in the history
Signed-off-by: Sneha Agnihotri <[email protected]>
  • Loading branch information
snehaagni committed Mar 15, 2024
2 parents b87cb58 + 8d415c1 commit 6e97e63
Show file tree
Hide file tree
Showing 13 changed files with 766 additions and 46 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,7 @@ jobs:
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
repository: smartcontractkit/chainlink-solana
ref: ${{ needs.get_solana_sha.outputs.sha }}
ref: a28100b7f2954604a8ca2ff9ec7bccc6ec952953 # temporarily using specific commit for release branch ${{ needs.get_solana_sha.outputs.sha }}
- name: Run Setup
if: needs.changes.outputs.src == 'true' || github.event_name == 'workflow_dispatch'
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/setup-run-tests-environment@ea889b3133bd7f16ab19ba4ba130de5d9162c669 # v2.3.4
Expand Down
29 changes: 29 additions & 0 deletions core/chains/evm/config/v2/defaults/Base_Goerli.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
ChainID = '84531'
ChainType = 'optimismBedrock'
FinalityDepth = 200
LogPollInterval = '2s'
NoNewHeadsThreshold = '40s'
MinIncomingConfirmations = 1

[GasEstimator]
EIP1559DynamicFees = true
PriceMin = '1 wei'
BumpMin = '100 wei'

[GasEstimator.BlockHistory]
BlockHistorySize = 60

[Transactions]
ResendAfterThreshold = '30s'

[HeadTracker]
HistoryDepth = 300

[NodePool]
SyncThreshold = 10

[OCR]
ContractConfirmations = 1

[OCR2.Automation]
GasLimit = 6500000
29 changes: 29 additions & 0 deletions core/chains/evm/config/v2/defaults/Base_Mainnet.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
ChainID = '8453'
ChainType = 'optimismBedrock'
FinalityDepth = 200
LogPollInterval = '2s'
NoNewHeadsThreshold = '40s'
MinIncomingConfirmations = 1

[GasEstimator]
EIP1559DynamicFees = true
PriceMin = '1 wei'
BumpMin = '100 wei'

[GasEstimator.BlockHistory]
BlockHistorySize = 24

[Transactions]
ResendAfterThreshold = '30s'

[HeadTracker]
HistoryDepth = 300

[NodePool]
SyncThreshold = 10

[OCR]
ContractConfirmations = 1

[OCR2.Automation]
GasLimit = 6500000
53 changes: 25 additions & 28 deletions core/scripts/chaincli/handler/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,19 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/logger"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/core"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/encoding"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/mercury"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/mercury/streams"
bigmath "github.com/smartcontractkit/chainlink/v2/core/utils/big_math"
)

const (
ConditionTrigger uint8 = iota
LogTrigger

blockNumber = "blockNumber"
expectedTypeAndVersion = "KeeperRegistry 2.1.0"
feedIdHex = "feedIdHex"
feedIDs = "feedIDs"
timestamp = "timestamp"
)

var mercuryPacker = mercury.NewAbiPacker()
Expand Down Expand Up @@ -135,8 +139,6 @@ func (k *Keeper) Debug(ctx context.Context, args []string) {
var checkResult iregistry21.CheckUpkeep
var blockNum uint64
var performData []byte
var workID [32]byte
var trigger ocr2keepers.Trigger
upkeepNeeded := false
// check upkeep
if triggerType == ConditionTrigger {
Expand Down Expand Up @@ -211,8 +213,7 @@ func (k *Keeper) Debug(ctx context.Context, args []string) {
}
// check that tx for this upkeep / tx was not already performed
message(fmt.Sprintf("LogTrigger{blockNum: %d, blockHash: %s, txHash: %s, logIndex: %d}", blockNum, receipt.BlockHash.Hex(), txHash, logIndex))
trigger = mustAutomationTrigger(txHash, logIndex, blockNum, receipt.BlockHash)
workID = mustUpkeepWorkID(upkeepID, trigger)
workID := mustUpkeepWorkID(upkeepID, blockNum, receipt.BlockHash, txHash, logIndex)
message(fmt.Sprintf("workID computed: %s", hex.EncodeToString(workID[:])))
var hasKey bool
hasKey, err = keeperRegistry21.HasDedupKey(latestCallOpts, workID)
Expand Down Expand Up @@ -308,12 +309,15 @@ func (k *Keeper) Debug(ctx context.Context, args []string) {
if !allowed {
resolveIneligible("upkeep reverted with StreamsLookup but is not allowed to access streams")
}
} else if streamsLookup.IsMercuryV03() {
} else if streamsLookupErr.FeedParamKey != feedIDs || streamsLookupErr.TimeParamKey != timestamp {
// handle v0.3
message("using data streams lookup v0.3")
} else {
resolveIneligible("upkeep reverted with StreamsLookup but the configuration is invalid")
} else {
message("using mercury lookup v0.3")
}
streamsLookup := &StreamsLookup{streamsLookupErr.FeedParamKey, streamsLookupErr.Feeds, streamsLookupErr.TimeParamKey, streamsLookupErr.Time, streamsLookupErr.ExtraData, upkeepID, blockNum}

if k.cfg.DataStreamsLegacyURL == "" || k.cfg.DataStreamsURL == "" || k.cfg.DataStreamsID == "" || k.cfg.DataStreamsKey == "" {
failCheckConfig("Data streams configs not set properly, check your DATA_STREAMS_LEGACY_URL, DATA_STREAMS_URL, DATA_STREAMS_ID and DATA_STREAMS_KEY", nil)
Expand Down Expand Up @@ -486,27 +490,9 @@ func packTriggerData(log *types.Log, blockTime uint64) ([]byte, error) {
return b, nil
}

func mustUpkeepWorkID(upkeepID *big.Int, trigger ocr2keepers.Trigger) [32]byte {
upkeepIdentifier := mustUpkeepIdentifier(upkeepID)

workID := core.UpkeepWorkID(upkeepIdentifier, trigger)
workIDBytes, err := hex.DecodeString(workID)
if err != nil {
failUnknown("failed to decode workID", err)
}

var result [32]byte
copy(result[:], workIDBytes[:])
return result
}

func mustUpkeepIdentifier(upkeepID *big.Int) ocr2keepers.UpkeepIdentifier {
upkeepIdentifier := &ocr2keepers.UpkeepIdentifier{}
upkeepIdentifier.FromBigInt(upkeepID)
return *upkeepIdentifier
}

func mustAutomationTrigger(txHash [32]byte, logIndex int64, blockNum uint64, blockHash [32]byte) ocr2keepers.Trigger {
func mustUpkeepWorkID(upkeepID *big.Int, blockNum uint64, blockHash [32]byte, txHash [32]byte, logIndex int64) [32]byte {
// TODO - this is a copy of the code in core.UpkeepWorkID
// We should refactor that code to be more easily exported ex not rely on Trigger structs
trigger := ocr2keepers.Trigger{
LogTriggerExtension: &ocr2keepers.LogTriggerExtension{
TxHash: txHash,
Expand All @@ -515,7 +501,16 @@ func mustAutomationTrigger(txHash [32]byte, logIndex int64, blockNum uint64, blo
BlockHash: blockHash,
},
}
return trigger
upkeepIdentifier := &ocr2keepers.UpkeepIdentifier{}
upkeepIdentifier.FromBigInt(upkeepID)
workID := core.UpkeepWorkID(*upkeepIdentifier, trigger)
workIDBytes, err := hex.DecodeString(workID)
if err != nil {
failUnknown("failed to decode workID", err)
}
var result [32]byte
copy(result[:], workIDBytes[:])
return result
}

func message(msg string) {
Expand Down Expand Up @@ -633,3 +628,5 @@ func tenderlySimLink(ctx context.Context, cfg *config.Config, chainID int64, blo
}
return common.TenderlySimLink(responseJSON.Simulation.Id)
}

// TODO - link to performUpkeep tx if exists
Loading

0 comments on commit 6e97e63

Please sign in to comment.