From cfebfbf93ae4bb99aa6f6dd696da1b79d83bb8c7 Mon Sep 17 00:00:00 2001 From: Anirudh Warrier <12178754+anirudhwarrier@users.noreply.github.com> Date: Wed, 27 Mar 2024 13:38:12 +0530 Subject: [PATCH] add streams lookup load test (AUTO-9008) (#12587) * support streams lookup in load test * make MaxRevertSize configurable * update contract * update contract * lint * prettier * update toml config * update contract * fix abi decode * prettier * update config * fix config * fix config * update test --- .../testhelpers/SimpleLogUpkeepCounter.sol | 82 +++++-- .../simple_log_upkeep_counter_wrapper.go | 201 +++++++++++++++++- ...rapper-dependency-versions-do-not-edit.txt | 2 +- integration-tests/benchmark/keeper_test.go | 1 + .../chaos/automation_chaos_test.go | 1 + .../contracts/contract_deployer.go | 6 +- .../contracts/ethereum_keeper_contracts.go | 5 +- .../automationv2_1/automationv2_1_test.go | 46 +++- .../reorg/automation_reorg_test.go | 1 + integration-tests/smoke/automation_test.go | 1 + .../testconfig/automation/automation.toml | 7 + .../testconfig/automation/config.go | 55 ++++- 12 files changed, 363 insertions(+), 45 deletions(-) diff --git a/contracts/src/v0.8/automation/testhelpers/SimpleLogUpkeepCounter.sol b/contracts/src/v0.8/automation/testhelpers/SimpleLogUpkeepCounter.sol index 979cc6138ac..c4d577134c2 100644 --- a/contracts/src/v0.8/automation/testhelpers/SimpleLogUpkeepCounter.sol +++ b/contracts/src/v0.8/automation/testhelpers/SimpleLogUpkeepCounter.sol @@ -3,14 +3,16 @@ pragma solidity 0.8.6; import {ILogAutomation, Log} from "../interfaces/ILogAutomation.sol"; +import "../interfaces/StreamsLookupCompatibleInterface.sol"; struct CheckData { uint256 checkBurnAmount; uint256 performBurnAmount; bytes32 eventSig; + string[] feeds; } -contract SimpleLogUpkeepCounter is ILogAutomation { +contract SimpleLogUpkeepCounter is ILogAutomation, StreamsLookupCompatibleInterface { event PerformingUpkeep( address indexed from, uint256 initialBlock, @@ -27,36 +29,77 @@ contract SimpleLogUpkeepCounter is ILogAutomation { uint256 public initialBlock; uint256 public counter; uint256 public timeToPerform; - bool public isRecovered; + bool internal isRecovered; + bool public isStreamsLookup; + bool public shouldRetryOnError; + string public feedParamKey = "feedIDs"; + string public timeParamKey = "timestamp"; - constructor() { + constructor(bool _isStreamsLookup) { previousPerformBlock = 0; lastBlock = block.number; initialBlock = 0; counter = 0; + isStreamsLookup = _isStreamsLookup; } function _checkDataConfig(CheckData memory) external {} + function setTimeParamKey(string memory timeParam) external { + timeParamKey = timeParam; + } + + function setFeedParamKey(string memory feedParam) external { + feedParamKey = feedParam; + } + + function setShouldRetryOnErrorBool(bool value) public { + shouldRetryOnError = value; + } + function checkLog(Log calldata log, bytes calldata checkData) external view override returns (bool, bytes memory) { - (uint256 checkBurnAmount, uint256 performBurnAmount, bytes32 eventSig) = abi.decode( - checkData, - (uint256, uint256, bytes32) - ); + CheckData memory _checkData = abi.decode(checkData, (CheckData)); uint256 startGas = gasleft(); bytes32 dummyIndex = blockhash(block.number - 1); bool dummy; // burn gas - if (checkBurnAmount > 0) { - while (startGas - gasleft() < checkBurnAmount) { + if (_checkData.checkBurnAmount > 0) { + while (startGas - gasleft() < _checkData.checkBurnAmount) { dummy = dummy && dummyMap[dummyIndex]; // arbitrary storage reads dummyIndex = keccak256(abi.encode(dummyIndex, address(this))); } } - if (log.topics[2] == eventSig) { - return (true, abi.encode(log, block.number, checkData)); + bytes[] memory values = new bytes[](2); + values[0] = abi.encode(0x00); + values[1] = abi.encode(0x00); + bytes memory extraData = abi.encode(log, block.number, checkData); + if (log.topics[2] == _checkData.eventSig) { + if (isStreamsLookup) { + revert StreamsLookup(feedParamKey, _checkData.feeds, timeParamKey, block.timestamp, extraData); + } + return (true, abi.encode(values, extraData)); } - return (false, abi.encode(log, block.number, checkData)); + return (false, abi.encode(values, extraData)); + } + + function checkCallback( + bytes[] memory values, + bytes memory extraData + ) external view override returns (bool, bytes memory) { + // do sth about the chainlinkBlob data in values and extraData + bytes memory performData = abi.encode(values, extraData); + return (true, performData); + } + + function checkErrorHandler( + uint256 errCode, + bytes memory extraData + ) external view override returns (bool upkeepNeeded, bytes memory performData) { + bytes[] memory values = new bytes[](2); + values[0] = abi.encode(errCode); + values[1] = abi.encode(extraData); + bytes memory returnData = abi.encode(values, extraData); + return (shouldRetryOnError, returnData); } function performUpkeep(bytes calldata performData) external override { @@ -66,22 +109,23 @@ contract SimpleLogUpkeepCounter is ILogAutomation { lastBlock = block.number; counter = counter + 1; previousPerformBlock = lastBlock; - (Log memory log, uint256 checkBlock, bytes memory extraData) = abi.decode(performData, (Log, uint256, bytes)); + (, bytes memory extraData) = abi.decode(performData, (bytes[], bytes)); + (Log memory log, uint256 checkBlock, bytes memory checkData) = abi.decode(extraData, (Log, uint256, bytes)); timeToPerform = block.timestamp - log.timestamp; isRecovered = false; if (checkBlock != log.blockNumber) { isRecovered = true; } - (uint256 checkBurnAmount, uint256 performBurnAmount, bytes32 eventSig) = abi.decode( - extraData, - (uint256, uint256, bytes32) - ); + CheckData memory _checkData = abi.decode(checkData, (CheckData)); uint256 startGas = gasleft(); bytes32 dummyIndex = blockhash(block.number - 1); bool dummy; + if (log.topics[2] != _checkData.eventSig) { + revert("Invalid event signature"); + } // burn gas - if (performBurnAmount > 0) { - while (startGas - gasleft() < performBurnAmount) { + if (_checkData.performBurnAmount > 0) { + while (startGas - gasleft() < _checkData.performBurnAmount) { dummy = dummy && dummyMap[dummyIndex]; // arbitrary storage reads dummyIndex = keccak256(abi.encode(dummyIndex, address(this))); } diff --git a/core/gethwrappers/generated/simple_log_upkeep_counter_wrapper/simple_log_upkeep_counter_wrapper.go b/core/gethwrappers/generated/simple_log_upkeep_counter_wrapper/simple_log_upkeep_counter_wrapper.go index 1409bcb1548..bfd6644e11e 100644 --- a/core/gethwrappers/generated/simple_log_upkeep_counter_wrapper/simple_log_upkeep_counter_wrapper.go +++ b/core/gethwrappers/generated/simple_log_upkeep_counter_wrapper/simple_log_upkeep_counter_wrapper.go @@ -34,6 +34,7 @@ type CheckData struct { CheckBurnAmount *big.Int PerformBurnAmount *big.Int EventSig [32]byte + Feeds []string } type Log struct { @@ -48,15 +49,15 @@ type Log struct { } var SimpleLogUpkeepCounterMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"initialBlock\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"lastBlock\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"previousBlock\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"counter\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"timeToPerform\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"isRecovered\",\"type\":\"bool\"}],\"name\":\"PerformingUpkeep\",\"type\":\"event\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"checkBurnAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"performBurnAmount\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"eventSig\",\"type\":\"bytes32\"}],\"internalType\":\"structCheckData\",\"name\":\"\",\"type\":\"tuple\"}],\"name\":\"_checkDataConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"txHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"source\",\"type\":\"address\"},{\"internalType\":\"bytes32[]\",\"name\":\"topics\",\"type\":\"bytes32[]\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"internalType\":\"structLog\",\"name\":\"log\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"checkData\",\"type\":\"bytes\"}],\"name\":\"checkLog\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"counter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"dummyMap\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isRecovered\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"performData\",\"type\":\"bytes\"}],\"name\":\"performUpkeep\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"previousPerformBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"timeToPerform\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", - Bin: "0x608060405234801561001057600080fd5b5060006002819055436001556003819055600455610d12806100336000396000f3fe608060405234801561001057600080fd5b50600436106100be5760003560e01c80637145f11b11610076578063917d895f1161005b578063917d895f1461016b578063c6066f0d14610174578063eb950ce71461017d57600080fd5b80637145f11b1461012f578063806b984f1461016257600080fd5b80634585e33b116100a75780634585e33b1461010057806361bc221a14610115578063697794731461011e57600080fd5b80632cb15864146100c357806340691db4146100df575b600080fd5b6100cc60035481565b6040519081526020015b60405180910390f35b6100f26100ed3660046106c6565b61018a565b6040516100d692919061092d565b61011361010e366004610628565b6102c2565b005b6100cc60045481565b61011361012c36600461066a565b50565b61015261013d36600461060f565b60006020819052908152604090205460ff1681565b60405190151581526020016100d6565b6100cc60015481565b6100cc60025481565b6100cc60055481565b6006546101529060ff1681565b6000606081808061019d8688018861083b565b92509250925060005a905060006101b5600143610c61565b40905060008515610224575b855a6101cd9085610c61565b1015610224578080156101ee575060008281526020819052604090205460ff165b604080516020810185905230918101919091529091506060016040516020818303038152906040528051906020012091506101c1565b8361023260c08d018d610a9d565b600281811061024357610243610ca7565b9050602002013514156102875760018b438c8c60405160200161026994939291906109aa565b604051602081830303815290604052975097505050505050506102ba565b60008b438c8c6040516020016102a094939291906109aa565b604051602081830303815290604052975097505050505050505b935093915050565b6003546102ce57436003555b4360019081556004546102e091610c49565b600455600154600255600080806102f984860186610738565b92509250925082602001514261030f9190610c61565b600555600680547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556060830151821461037157600680547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790555b60008060008380602001905181019061038a9190610867565b92509250925060005a905060006103a2600143610c61565b40905060008415610411575b845a6103ba9085610c61565b1015610411578080156103db575060008281526020819052604090205460ff165b604080516020810185905230918101919091529091506060016040516020818303038152906040528051906020012091506103ae565b600354600154600254600454600554600654604080519687526020870195909552938501929092526060840152608083015260ff16151560a082015232907f29eff4cb37911c3ea85db4630638cc5474fdd0631ec42215aef1d7ec96c8e63d9060c00160405180910390a25050505050505050505050565b803573ffffffffffffffffffffffffffffffffffffffff811681146104ad57600080fd5b919050565b600082601f8301126104c357600080fd5b8135602067ffffffffffffffff8211156104df576104df610cd6565b8160051b6104ee828201610b2f565b83815282810190868401838801850189101561050957600080fd5b600093505b8584101561052c57803583526001939093019291840191840161050e565b50979650505050505050565b60008083601f84011261054a57600080fd5b50813567ffffffffffffffff81111561056257600080fd5b60208301915083602082850101111561057a57600080fd5b9250929050565b600082601f83011261059257600080fd5b813567ffffffffffffffff8111156105ac576105ac610cd6565b6105dd60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601610b2f565b8181528460208386010111156105f257600080fd5b816020850160208301376000918101602001919091529392505050565b60006020828403121561062157600080fd5b5035919050565b6000806020838503121561063b57600080fd5b823567ffffffffffffffff81111561065257600080fd5b61065e85828601610538565b90969095509350505050565b60006060828403121561067c57600080fd5b6040516060810181811067ffffffffffffffff8211171561069f5761069f610cd6565b80604052508235815260208301356020820152604083013560408201528091505092915050565b6000806000604084860312156106db57600080fd5b833567ffffffffffffffff808211156106f357600080fd5b90850190610100828803121561070857600080fd5b9093506020850135908082111561071e57600080fd5b5061072b86828701610538565b9497909650939450505050565b60008060006060848603121561074d57600080fd5b833567ffffffffffffffff8082111561076557600080fd5b90850190610100828803121561077a57600080fd5b610782610b05565b82358152602083013560208201526040830135604082015260608301356060820152608083013560808201526107ba60a08401610489565b60a082015260c0830135828111156107d157600080fd5b6107dd898286016104b2565b60c08301525060e0830135828111156107f557600080fd5b61080189828601610581565b60e083015250945060208601359350604086013591508082111561082457600080fd5b5061083186828701610581565b9150509250925092565b60008060006060848603121561085057600080fd5b505081359360208301359350604090920135919050565b60008060006060848603121561087c57600080fd5b8351925060208401519150604084015190509250925092565b81835260007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8311156108c757600080fd5b8260051b8083602087013760009401602001938452509192915050565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b821515815260006020604081840152835180604085015260005b8181101561096357858101830151858201606001528201610947565b81811115610975576000606083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01692909201606001949350505050565b606081528435606082015260208501356080820152604085013560a0820152606085013560c0820152608085013560e082015260006109eb60a08701610489565b61010073ffffffffffffffffffffffffffffffffffffffff821681850152610a1660c0890189610b7e565b925081610120860152610a2e61016086018483610895565b92505050610a3f60e0880188610be5565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa085840301610140860152610a758382846108e4565b925050508560208401528281036040840152610a928185876108e4565b979650505050505050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112610ad257600080fd5b83018035915067ffffffffffffffff821115610aed57600080fd5b6020019150600581901b360382131561057a57600080fd5b604051610100810167ffffffffffffffff81118282101715610b2957610b29610cd6565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715610b7657610b76610cd6565b604052919050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112610bb357600080fd5b830160208101925035905067ffffffffffffffff811115610bd357600080fd5b8060051b360383131561057a57600080fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112610c1a57600080fd5b830160208101925035905067ffffffffffffffff811115610c3a57600080fd5b80360383131561057a57600080fd5b60008219821115610c5c57610c5c610c78565b500190565b600082821015610c7357610c73610c78565b500390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fdfea164736f6c6343000806000a", + ABI: "[{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_isStreamsLookup\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"feedParamKey\",\"type\":\"string\"},{\"internalType\":\"string[]\",\"name\":\"feeds\",\"type\":\"string[]\"},{\"internalType\":\"string\",\"name\":\"timeParamKey\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"time\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"StreamsLookup\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"initialBlock\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"lastBlock\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"previousBlock\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"counter\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"timeToPerform\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"isRecovered\",\"type\":\"bool\"}],\"name\":\"PerformingUpkeep\",\"type\":\"event\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"checkBurnAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"performBurnAmount\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"eventSig\",\"type\":\"bytes32\"},{\"internalType\":\"string[]\",\"name\":\"feeds\",\"type\":\"string[]\"}],\"internalType\":\"structCheckData\",\"name\":\"\",\"type\":\"tuple\"}],\"name\":\"_checkDataConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"values\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"checkCallback\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"errCode\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"checkErrorHandler\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"upkeepNeeded\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"performData\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"txHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"source\",\"type\":\"address\"},{\"internalType\":\"bytes32[]\",\"name\":\"topics\",\"type\":\"bytes32[]\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"internalType\":\"structLog\",\"name\":\"log\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"checkData\",\"type\":\"bytes\"}],\"name\":\"checkLog\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"counter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"dummyMap\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"feedParamKey\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isStreamsLookup\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"performData\",\"type\":\"bytes\"}],\"name\":\"performUpkeep\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"previousPerformBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"feedParam\",\"type\":\"string\"}],\"name\":\"setFeedParamKey\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"value\",\"type\":\"bool\"}],\"name\":\"setShouldRetryOnErrorBool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"timeParam\",\"type\":\"string\"}],\"name\":\"setTimeParamKey\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"shouldRetryOnError\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"timeParamKey\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"timeToPerform\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", + Bin: "0x60c060405260076080819052666665656449447360c81b60a090815262000028919081620000bd565b5060408051808201909152600980825268074696d657374616d760bc1b60209092019182526200005b91600891620000bd565b503480156200006957600080fd5b5060405162001af938038062001af98339810160408190526200008c9162000163565b60006002819055436001556003819055600455600680549115156101000261ff0019909216919091179055620001cb565b828054620000cb906200018e565b90600052602060002090601f016020900481019282620000ef57600085556200013a565b82601f106200010a57805160ff19168380011785556200013a565b828001600101855582156200013a579182015b828111156200013a5782518255916020019190600101906200011d565b50620001489291506200014c565b5090565b5b808211156200014857600081556001016200014d565b6000602082840312156200017657600080fd5b815180151581146200018757600080fd5b9392505050565b600181811c90821680620001a357607f821691505b60208210811415620001c557634e487b7160e01b600052602260045260246000fd5b50919050565b61191e80620001db6000396000f3fe608060405234801561001057600080fd5b50600436106101365760003560e01c8063601d5a71116100b2578063917d895f11610081578063afb28d1f11610066578063afb28d1f146102a7578063c6066f0d146102bc578063c98f10b0146102c557600080fd5b8063917d895f1461028b5780639525d5741461029457600080fd5b8063601d5a711461024357806361bc221a146102565780637145f11b1461025f578063806b984f1461028257600080fd5b806340691db41161010957806342eb3d92116100ee57806342eb3d921461020a5780634585e33b1461021d5780634b56a42e1461023057600080fd5b806340691db4146101e657806342b0fe9e146101f957600080fd5b80630fb172fb1461013b57806313fab5901461016557806323148cee146101ad5780632cb15864146101cf575b600080fd5b61014e610149366004611104565b6102cd565b60405161015c92919061138e565b60405180910390f35b6101ab610173366004610cbd565b6006805491151562010000027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ffff909216919091179055565b005b6006546101bf90610100900460ff1681565b604051901515815260200161015c565b6101d860035481565b60405190815260200161015c565b61014e6101f4366004610f8e565b6103d4565b6101ab610207366004610d77565b50565b6006546101bf9062010000900460ff1681565b6101ab61022b366004610cf8565b610659565b61014e61023e366004610be3565b6108c5565b6101ab610251366004610d3a565b610919565b6101d860045481565b6101bf61026d366004610cdf565b60006020819052908152604090205460ff1681565b6101d860015481565b6101d860025481565b6101ab6102a2366004610d3a565b610930565b6102af610943565b60405161015c91906113a9565b6101d860055481565b6102af6109d1565b6040805160028082526060828101909352600092918391816020015b60608152602001906001900390816102e95750506040805160208101889052919250016040516020818303038152906040528160008151811061032e5761032e611891565b60200260200101819052508360405160200161034a91906113a9565b6040516020818303038152906040528160018151811061036c5761036c611891565b60200260200101819052506000818560405160200161038c9291906112fa565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001815291905260065462010000900460ff169450925050505b9250929050565b60006060816103e584860186610d77565b905060005a905060006103f96001436117c7565b8351904091506000901561046c575b83515a61041590856117c7565b101561046c57808015610436575060008281526020819052604090205460ff165b60408051602081018590523091810191909152909150606001604051602081830303815290604052805190602001209150610408565b60408051600280825260608201909252600091816020015b606081526020019060019003908161048457905050604080516000602082015291925001604051602081830303815290604052816000815181106104ca576104ca611891565b602002602001018190525060006040516020016104f0919060ff91909116815260200190565b6040516020818303038152906040528160018151811061051257610512611891565b602002602001018190525060008a438b8b604051602001610536949392919061147b565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291815287015190915061057760c08d018d611576565b600281811061058857610588611891565b90506020020135141561062257600654610100900460ff16156105ef5760608601516040517ff055e4a20000000000000000000000000000000000000000000000000000000081526105e691600791600890429086906004016113bc565b60405180910390fd5b600182826040516020016106049291906112fa565b60405160208183030381529060405297509750505050505050610651565b600082826040516020016106379291906112fa565b604051602081830303815290604052975097505050505050505b935093915050565b60035461066557436003555b436001908155600454610677916117af565b600455600154600255600061068e82840184610be3565b9150506000806000838060200190518101906106aa9190611000565b9250925092508260200151426106c091906117c7565b600555600680547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556060830151821461072257600680547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790555b6000818060200190518101906107389190610e79565b905060005a9050600061074c6001436117c7565b409050600083604001518760c0015160028151811061076d5761076d611891565b6020026020010151146107dc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f496e76616c6964206576656e74207369676e617475726500000000000000000060448201526064016105e6565b60208401511561084e575b83602001515a6107f790856117c7565b101561084e57808015610818575060008281526020819052604090205460ff165b604080516020810185905230918101919091529091506060016040516020818303038152906040528051906020012091506107e7565b600354600154600254600454600554600654604080519687526020870195909552938501929092526060840152608083015260ff16151560a082015232907f29eff4cb37911c3ea85db4630638cc5474fdd0631ec42215aef1d7ec96c8e63d9060c00160405180910390a250505050505050505050565b60006060600084846040516020016108de9291906112fa565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe00181529190526001969095509350505050565b805161092c9060089060208401906109de565b5050565b805161092c9060079060208401906109de565b600780546109509061180e565b80601f016020809104026020016040519081016040528092919081815260200182805461097c9061180e565b80156109c95780601f1061099e576101008083540402835291602001916109c9565b820191906000526020600020905b8154815290600101906020018083116109ac57829003601f168201915b505050505081565b600880546109509061180e565b8280546109ea9061180e565b90600052602060002090601f016020900481019282610a0c5760008555610a52565b82601f10610a2557805160ff1916838001178555610a52565b82800160010185558215610a52579182015b82811115610a52578251825591602001919060010190610a37565b50610a5e929150610a62565b5090565b5b80821115610a5e5760008155600101610a63565b6000610a8a610a858461169e565b61162b565b9050828152838383011115610a9e57600080fd5b610aac8360208301846117de565b9392505050565b8051610abe816118ef565b919050565b600082601f830112610ad457600080fd5b81516020610ae4610a858361167a565b80838252828201915082860187848660051b8901011115610b0457600080fd5b60005b85811015610b2357815184529284019290840190600101610b07565b5090979650505050505050565b60008083601f840112610b4257600080fd5b50813567ffffffffffffffff811115610b5a57600080fd5b6020830191508360208285010111156103cd57600080fd5b600082601f830112610b8357600080fd5b8135610b91610a858261169e565b818152846020838601011115610ba657600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f830112610bd457600080fd5b610aac83835160208501610a77565b60008060408385031215610bf657600080fd5b823567ffffffffffffffff80821115610c0e57600080fd5b818501915085601f830112610c2257600080fd5b81356020610c32610a858361167a565b8083825282820191508286018a848660051b8901011115610c5257600080fd5b60005b85811015610c8d57813587811115610c6c57600080fd5b610c7a8d87838c0101610b72565b8552509284019290840190600101610c55565b50909750505086013592505080821115610ca657600080fd5b50610cb385828601610b72565b9150509250929050565b600060208284031215610ccf57600080fd5b81358015158114610aac57600080fd5b600060208284031215610cf157600080fd5b5035919050565b60008060208385031215610d0b57600080fd5b823567ffffffffffffffff811115610d2257600080fd5b610d2e85828601610b30565b90969095509350505050565b600060208284031215610d4c57600080fd5b813567ffffffffffffffff811115610d6357600080fd5b610d6f84828501610b72565b949350505050565b60006020808385031215610d8a57600080fd5b823567ffffffffffffffff80821115610da257600080fd5b9084019060808287031215610db657600080fd5b610dbe6115de565b82358152838301358482015260408301356040820152606083013582811115610de657600080fd5b80840193505086601f840112610dfb57600080fd5b8235610e09610a858261167a565b8082825286820191508686018a888560051b8901011115610e2957600080fd5b6000805b85811015610e6457823588811115610e43578283fd5b610e518e8c838d0101610b72565b8652509389019391890191600101610e2d565b50505060608401525090979650505050505050565b60006020808385031215610e8c57600080fd5b825167ffffffffffffffff80821115610ea457600080fd5b9084019060808287031215610eb857600080fd5b610ec06115de565b82518152838301518482015260408084015181830152606084015183811115610ee857600080fd5b80850194505087601f850112610efd57600080fd5b8351610f0b610a858261167a565b8082825287820191508787018b898560051b8a01011115610f2b57600080fd5b60005b84811015610f7957815188811115610f4557600080fd5b8901603f81018e13610f5657600080fd5b610f668e8c830151898401610a77565b8552509289019290890190600101610f2e565b50506060850152509198975050505050505050565b600080600060408486031215610fa357600080fd5b833567ffffffffffffffff80821115610fbb57600080fd5b908501906101008288031215610fd057600080fd5b90935060208501359080821115610fe657600080fd5b50610ff386828701610b30565b9497909650939450505050565b60008060006060848603121561101557600080fd5b835167ffffffffffffffff8082111561102d57600080fd5b90850190610100828803121561104257600080fd5b61104a611607565b825181526020830151602082015260408301516040820152606083015160608201526080830151608082015261108260a08401610ab3565b60a082015260c08301518281111561109957600080fd5b6110a589828601610ac3565b60c08301525060e0830151828111156110bd57600080fd5b6110c989828601610bc3565b60e0830152506020870151604088015191965094509150808211156110ed57600080fd5b506110fa86828701610bc3565b9150509250925092565b6000806040838503121561111757600080fd5b82359150602083013567ffffffffffffffff81111561113557600080fd5b610cb385828601610b72565b81835260007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83111561117357600080fd5b8260051b8083602087013760009401602001938452509192915050565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b600081518084526111f18160208601602086016117de565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b8054600090600181811c908083168061123d57607f831692505b6020808410821415611278577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b8388526020880182801561129357600181146112c2576112ed565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff008716825282820197506112ed565b60008981526020902060005b878110156112e7578154848201529086019084016112ce565b83019850505b5050505050505092915050565b6000604082016040835280855180835260608501915060608160051b8601019250602080880160005b8381101561136f577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa088870301855261135d8683516111d9565b95509382019390820190600101611323565b50508584038187015250505061138581856111d9565b95945050505050565b8215158152604060208201526000610d6f60408301846111d9565b602081526000610aac60208301846111d9565b60a0815260006113cf60a0830188611223565b6020838203818501528188518084528284019150828160051b850101838b0160005b8381101561143d577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe087840301855261142b8383516111d9565b948601949250908501906001016113f1565b50508681036040880152611451818b611223565b945050505050846060840152828103608084015261146f81856111d9565b98975050505050505050565b606081528435606082015260208501356080820152604085013560a0820152606085013560c0820152608085013560e0820152600060a08601356114be816118ef565b6101006114e28185018373ffffffffffffffffffffffffffffffffffffffff169052565b6114ef60c08901896116e4565b92508161012086015261150761016086018483611141565b9250505061151860e088018861174b565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa08584030161014086015261154e838284611190565b92505050856020840152828103604084015261156b818587611190565b979650505050505050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126115ab57600080fd5b83018035915067ffffffffffffffff8211156115c657600080fd5b6020019150600581901b36038213156103cd57600080fd5b6040516080810167ffffffffffffffff81118282101715611601576116016118c0565b60405290565b604051610100810167ffffffffffffffff81118282101715611601576116016118c0565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715611672576116726118c0565b604052919050565b600067ffffffffffffffff821115611694576116946118c0565b5060051b60200190565b600067ffffffffffffffff8211156116b8576116b86118c0565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261171957600080fd5b830160208101925035905067ffffffffffffffff81111561173957600080fd5b8060051b36038313156103cd57600080fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261178057600080fd5b830160208101925035905067ffffffffffffffff8111156117a057600080fd5b8036038313156103cd57600080fd5b600082198211156117c2576117c2611862565b500190565b6000828210156117d9576117d9611862565b500390565b60005b838110156117f95781810151838201526020016117e1565b83811115611808576000848401525b50505050565b600181811c9082168061182257607f821691505b6020821081141561185c577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff8116811461020757600080fdfea164736f6c6343000806000a", } var SimpleLogUpkeepCounterABI = SimpleLogUpkeepCounterMetaData.ABI var SimpleLogUpkeepCounterBin = SimpleLogUpkeepCounterMetaData.Bin -func DeploySimpleLogUpkeepCounter(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *SimpleLogUpkeepCounter, error) { +func DeploySimpleLogUpkeepCounter(auth *bind.TransactOpts, backend bind.ContractBackend, _isStreamsLookup bool) (common.Address, *types.Transaction, *SimpleLogUpkeepCounter, error) { parsed, err := SimpleLogUpkeepCounterMetaData.GetAbi() if err != nil { return common.Address{}, nil, nil, err @@ -65,7 +66,7 @@ func DeploySimpleLogUpkeepCounter(auth *bind.TransactOpts, backend bind.Contract return common.Address{}, nil, nil, errors.New("GetABI returned nil") } - address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(SimpleLogUpkeepCounterBin), backend) + address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(SimpleLogUpkeepCounterBin), backend, _isStreamsLookup) if err != nil { return common.Address{}, nil, nil, err } @@ -188,6 +189,59 @@ func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounterTransactorRaw) Transact(opt return _SimpleLogUpkeepCounter.Contract.contract.Transact(opts, method, params...) } +func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounterCaller) CheckCallback(opts *bind.CallOpts, values [][]byte, extraData []byte) (bool, []byte, error) { + var out []interface{} + err := _SimpleLogUpkeepCounter.contract.Call(opts, &out, "checkCallback", values, extraData) + + if err != nil { + return *new(bool), *new([]byte), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + out1 := *abi.ConvertType(out[1], new([]byte)).(*[]byte) + + return out0, out1, err + +} + +func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounterSession) CheckCallback(values [][]byte, extraData []byte) (bool, []byte, error) { + return _SimpleLogUpkeepCounter.Contract.CheckCallback(&_SimpleLogUpkeepCounter.CallOpts, values, extraData) +} + +func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounterCallerSession) CheckCallback(values [][]byte, extraData []byte) (bool, []byte, error) { + return _SimpleLogUpkeepCounter.Contract.CheckCallback(&_SimpleLogUpkeepCounter.CallOpts, values, extraData) +} + +func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounterCaller) CheckErrorHandler(opts *bind.CallOpts, errCode *big.Int, extraData []byte) (CheckErrorHandler, + + error) { + var out []interface{} + err := _SimpleLogUpkeepCounter.contract.Call(opts, &out, "checkErrorHandler", errCode, extraData) + + outstruct := new(CheckErrorHandler) + if err != nil { + return *outstruct, err + } + + outstruct.UpkeepNeeded = *abi.ConvertType(out[0], new(bool)).(*bool) + outstruct.PerformData = *abi.ConvertType(out[1], new([]byte)).(*[]byte) + + return *outstruct, err + +} + +func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounterSession) CheckErrorHandler(errCode *big.Int, extraData []byte) (CheckErrorHandler, + + error) { + return _SimpleLogUpkeepCounter.Contract.CheckErrorHandler(&_SimpleLogUpkeepCounter.CallOpts, errCode, extraData) +} + +func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounterCallerSession) CheckErrorHandler(errCode *big.Int, extraData []byte) (CheckErrorHandler, + + error) { + return _SimpleLogUpkeepCounter.Contract.CheckErrorHandler(&_SimpleLogUpkeepCounter.CallOpts, errCode, extraData) +} + func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounterCaller) CheckLog(opts *bind.CallOpts, log Log, checkData []byte) (bool, []byte, error) { var out []interface{} err := _SimpleLogUpkeepCounter.contract.Call(opts, &out, "checkLog", log, checkData) @@ -255,6 +309,28 @@ func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounterCallerSession) DummyMap(arg return _SimpleLogUpkeepCounter.Contract.DummyMap(&_SimpleLogUpkeepCounter.CallOpts, arg0) } +func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounterCaller) FeedParamKey(opts *bind.CallOpts) (string, error) { + var out []interface{} + err := _SimpleLogUpkeepCounter.contract.Call(opts, &out, "feedParamKey") + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounterSession) FeedParamKey() (string, error) { + return _SimpleLogUpkeepCounter.Contract.FeedParamKey(&_SimpleLogUpkeepCounter.CallOpts) +} + +func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounterCallerSession) FeedParamKey() (string, error) { + return _SimpleLogUpkeepCounter.Contract.FeedParamKey(&_SimpleLogUpkeepCounter.CallOpts) +} + func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounterCaller) InitialBlock(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} err := _SimpleLogUpkeepCounter.contract.Call(opts, &out, "initialBlock") @@ -277,9 +353,9 @@ func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounterCallerSession) InitialBlock return _SimpleLogUpkeepCounter.Contract.InitialBlock(&_SimpleLogUpkeepCounter.CallOpts) } -func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounterCaller) IsRecovered(opts *bind.CallOpts) (bool, error) { +func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounterCaller) IsStreamsLookup(opts *bind.CallOpts) (bool, error) { var out []interface{} - err := _SimpleLogUpkeepCounter.contract.Call(opts, &out, "isRecovered") + err := _SimpleLogUpkeepCounter.contract.Call(opts, &out, "isStreamsLookup") if err != nil { return *new(bool), err @@ -291,12 +367,12 @@ func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounterCaller) IsRecovered(opts *b } -func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounterSession) IsRecovered() (bool, error) { - return _SimpleLogUpkeepCounter.Contract.IsRecovered(&_SimpleLogUpkeepCounter.CallOpts) +func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounterSession) IsStreamsLookup() (bool, error) { + return _SimpleLogUpkeepCounter.Contract.IsStreamsLookup(&_SimpleLogUpkeepCounter.CallOpts) } -func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounterCallerSession) IsRecovered() (bool, error) { - return _SimpleLogUpkeepCounter.Contract.IsRecovered(&_SimpleLogUpkeepCounter.CallOpts) +func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounterCallerSession) IsStreamsLookup() (bool, error) { + return _SimpleLogUpkeepCounter.Contract.IsStreamsLookup(&_SimpleLogUpkeepCounter.CallOpts) } func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounterCaller) LastBlock(opts *bind.CallOpts) (*big.Int, error) { @@ -343,6 +419,50 @@ func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounterCallerSession) PreviousPerf return _SimpleLogUpkeepCounter.Contract.PreviousPerformBlock(&_SimpleLogUpkeepCounter.CallOpts) } +func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounterCaller) ShouldRetryOnError(opts *bind.CallOpts) (bool, error) { + var out []interface{} + err := _SimpleLogUpkeepCounter.contract.Call(opts, &out, "shouldRetryOnError") + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounterSession) ShouldRetryOnError() (bool, error) { + return _SimpleLogUpkeepCounter.Contract.ShouldRetryOnError(&_SimpleLogUpkeepCounter.CallOpts) +} + +func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounterCallerSession) ShouldRetryOnError() (bool, error) { + return _SimpleLogUpkeepCounter.Contract.ShouldRetryOnError(&_SimpleLogUpkeepCounter.CallOpts) +} + +func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounterCaller) TimeParamKey(opts *bind.CallOpts) (string, error) { + var out []interface{} + err := _SimpleLogUpkeepCounter.contract.Call(opts, &out, "timeParamKey") + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounterSession) TimeParamKey() (string, error) { + return _SimpleLogUpkeepCounter.Contract.TimeParamKey(&_SimpleLogUpkeepCounter.CallOpts) +} + +func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounterCallerSession) TimeParamKey() (string, error) { + return _SimpleLogUpkeepCounter.Contract.TimeParamKey(&_SimpleLogUpkeepCounter.CallOpts) +} + func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounterCaller) TimeToPerform(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} err := _SimpleLogUpkeepCounter.contract.Call(opts, &out, "timeToPerform") @@ -389,6 +509,42 @@ func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounterTransactorSession) PerformU return _SimpleLogUpkeepCounter.Contract.PerformUpkeep(&_SimpleLogUpkeepCounter.TransactOpts, performData) } +func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounterTransactor) SetFeedParamKey(opts *bind.TransactOpts, feedParam string) (*types.Transaction, error) { + return _SimpleLogUpkeepCounter.contract.Transact(opts, "setFeedParamKey", feedParam) +} + +func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounterSession) SetFeedParamKey(feedParam string) (*types.Transaction, error) { + return _SimpleLogUpkeepCounter.Contract.SetFeedParamKey(&_SimpleLogUpkeepCounter.TransactOpts, feedParam) +} + +func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounterTransactorSession) SetFeedParamKey(feedParam string) (*types.Transaction, error) { + return _SimpleLogUpkeepCounter.Contract.SetFeedParamKey(&_SimpleLogUpkeepCounter.TransactOpts, feedParam) +} + +func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounterTransactor) SetShouldRetryOnErrorBool(opts *bind.TransactOpts, value bool) (*types.Transaction, error) { + return _SimpleLogUpkeepCounter.contract.Transact(opts, "setShouldRetryOnErrorBool", value) +} + +func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounterSession) SetShouldRetryOnErrorBool(value bool) (*types.Transaction, error) { + return _SimpleLogUpkeepCounter.Contract.SetShouldRetryOnErrorBool(&_SimpleLogUpkeepCounter.TransactOpts, value) +} + +func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounterTransactorSession) SetShouldRetryOnErrorBool(value bool) (*types.Transaction, error) { + return _SimpleLogUpkeepCounter.Contract.SetShouldRetryOnErrorBool(&_SimpleLogUpkeepCounter.TransactOpts, value) +} + +func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounterTransactor) SetTimeParamKey(opts *bind.TransactOpts, timeParam string) (*types.Transaction, error) { + return _SimpleLogUpkeepCounter.contract.Transact(opts, "setTimeParamKey", timeParam) +} + +func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounterSession) SetTimeParamKey(timeParam string) (*types.Transaction, error) { + return _SimpleLogUpkeepCounter.Contract.SetTimeParamKey(&_SimpleLogUpkeepCounter.TransactOpts, timeParam) +} + +func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounterTransactorSession) SetTimeParamKey(timeParam string) (*types.Transaction, error) { + return _SimpleLogUpkeepCounter.Contract.SetTimeParamKey(&_SimpleLogUpkeepCounter.TransactOpts, timeParam) +} + type SimpleLogUpkeepCounterPerformingUpkeepIterator struct { Event *SimpleLogUpkeepCounterPerformingUpkeep @@ -522,6 +678,11 @@ func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounterFilterer) ParsePerformingUp return event, nil } +type CheckErrorHandler struct { + UpkeepNeeded bool + PerformData []byte +} + func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounter) ParseLog(log types.Log) (generated.AbigenLog, error) { switch log.Topics[0] { case _SimpleLogUpkeepCounter.abi.Events["PerformingUpkeep"].ID: @@ -541,26 +702,44 @@ func (_SimpleLogUpkeepCounter *SimpleLogUpkeepCounter) Address() common.Address } type SimpleLogUpkeepCounterInterface interface { + CheckCallback(opts *bind.CallOpts, values [][]byte, extraData []byte) (bool, []byte, error) + + CheckErrorHandler(opts *bind.CallOpts, errCode *big.Int, extraData []byte) (CheckErrorHandler, + + error) + CheckLog(opts *bind.CallOpts, log Log, checkData []byte) (bool, []byte, error) Counter(opts *bind.CallOpts) (*big.Int, error) DummyMap(opts *bind.CallOpts, arg0 [32]byte) (bool, error) + FeedParamKey(opts *bind.CallOpts) (string, error) + InitialBlock(opts *bind.CallOpts) (*big.Int, error) - IsRecovered(opts *bind.CallOpts) (bool, error) + IsStreamsLookup(opts *bind.CallOpts) (bool, error) LastBlock(opts *bind.CallOpts) (*big.Int, error) PreviousPerformBlock(opts *bind.CallOpts) (*big.Int, error) + ShouldRetryOnError(opts *bind.CallOpts) (bool, error) + + TimeParamKey(opts *bind.CallOpts) (string, error) + TimeToPerform(opts *bind.CallOpts) (*big.Int, error) CheckDataConfig(opts *bind.TransactOpts, arg0 CheckData) (*types.Transaction, error) PerformUpkeep(opts *bind.TransactOpts, performData []byte) (*types.Transaction, error) + SetFeedParamKey(opts *bind.TransactOpts, feedParam string) (*types.Transaction, error) + + SetShouldRetryOnErrorBool(opts *bind.TransactOpts, value bool) (*types.Transaction, error) + + SetTimeParamKey(opts *bind.TransactOpts, timeParam string) (*types.Transaction, error) + FilterPerformingUpkeep(opts *bind.FilterOpts, from []common.Address) (*SimpleLogUpkeepCounterPerformingUpkeepIterator, error) WatchPerformingUpkeep(opts *bind.WatchOpts, sink chan<- *SimpleLogUpkeepCounterPerformingUpkeep, from []common.Address) (event.Subscription, error) diff --git a/core/gethwrappers/generation/generated-wrapper-dependency-versions-do-not-edit.txt b/core/gethwrappers/generation/generated-wrapper-dependency-versions-do-not-edit.txt index 31a61dc770d..40847f3bc5f 100644 --- a/core/gethwrappers/generation/generated-wrapper-dependency-versions-do-not-edit.txt +++ b/core/gethwrappers/generation/generated-wrapper-dependency-versions-do-not-edit.txt @@ -69,7 +69,7 @@ optimism_module: ../../contracts/solc/v0.8.19/OptimismModule/OptimismModule.abi oracle_wrapper: ../../contracts/solc/v0.6/Oracle/Oracle.abi ../../contracts/solc/v0.6/Oracle/Oracle.bin 7af2fbac22a6e8c2847e8e685a5400cac5101d72ddf5365213beb79e4dede43a perform_data_checker_wrapper: ../../contracts/solc/v0.8.16/PerformDataChecker/PerformDataChecker.abi ../../contracts/solc/v0.8.16/PerformDataChecker/PerformDataChecker.bin 48d8309c2117c29a24e1155917ab0b780956b2cd6a8a39ef06ae66a7f6d94f73 scroll_module: ../../contracts/solc/v0.8.19/ScrollModule/ScrollModule.abi ../../contracts/solc/v0.8.19/ScrollModule/ScrollModule.bin 8de157cb7e5bc78146548212803d60926c8483aca7e912d802b7c66dc5d2ab11 -simple_log_upkeep_counter_wrapper: ../../contracts/solc/v0.8.6/SimpleLogUpkeepCounter/SimpleLogUpkeepCounter.abi ../../contracts/solc/v0.8.6/SimpleLogUpkeepCounter/SimpleLogUpkeepCounter.bin a2532ca73e227f846be39b52fa63cfa9d088116c3cfc311d972fe8db886fa915 +simple_log_upkeep_counter_wrapper: ../../contracts/solc/v0.8.6/SimpleLogUpkeepCounter/SimpleLogUpkeepCounter.abi ../../contracts/solc/v0.8.6/SimpleLogUpkeepCounter/SimpleLogUpkeepCounter.bin 7557d117a066cd8cf35f635bc085ee11795442073c18f8610ede9037b74fd814 solidity_vrf_consumer_interface: ../../contracts/solc/v0.6/VRFConsumer/VRFConsumer.abi ../../contracts/solc/v0.6/VRFConsumer/VRFConsumer.bin ecc99378aa798014de9db42b2eb81320778b0663dbe208008dad75ccdc1d4366 solidity_vrf_consumer_interface_v08: ../../contracts/solc/v0.8.6/VRFConsumer/VRFConsumer.abi ../../contracts/solc/v0.8.6/VRFConsumer/VRFConsumer.bin b14f9136b15e3dc9d6154d5700f3ed4cf88ddc4f70f20c3bb57fc46050904c8f solidity_vrf_coordinator_interface: ../../contracts/solc/v0.6/VRFCoordinator/VRFCoordinator.abi ../../contracts/solc/v0.6/VRFCoordinator/VRFCoordinator.bin a23d3c395156804788c7f6fbda2994e8f7184304c0f0c9f2c4ddeaf073d346d2 diff --git a/integration-tests/benchmark/keeper_test.go b/integration-tests/benchmark/keeper_test.go index e6cda6d7f27..8aa733ea101 100644 --- a/integration-tests/benchmark/keeper_test.go +++ b/integration-tests/benchmark/keeper_test.go @@ -165,6 +165,7 @@ func TestAutomationBenchmark(t *testing.T) { FallbackLinkPrice: big.NewInt(2e18), MaxCheckDataSize: uint32(5_000), MaxPerformDataSize: uint32(5_000), + MaxRevertDataSize: uint32(5_000), }, Upkeeps: &testsetups.UpkeepConfig{ NumberOfUpkeeps: *config.Keeper.Common.NumberOfUpkeeps, diff --git a/integration-tests/chaos/automation_chaos_test.go b/integration-tests/chaos/automation_chaos_test.go index fac9f83ba79..56b0d1e32b6 100644 --- a/integration-tests/chaos/automation_chaos_test.go +++ b/integration-tests/chaos/automation_chaos_test.go @@ -92,6 +92,7 @@ ListenAddresses = ["0.0.0.0:6690"]` FallbackLinkPrice: big.NewInt(2e18), MaxCheckDataSize: uint32(5000), MaxPerformDataSize: uint32(5000), + MaxRevertDataSize: uint32(5000), } ) diff --git a/integration-tests/contracts/contract_deployer.go b/integration-tests/contracts/contract_deployer.go index 11dae558f7d..c8b1d18d0bd 100644 --- a/integration-tests/contracts/contract_deployer.go +++ b/integration-tests/contracts/contract_deployer.go @@ -111,7 +111,7 @@ type ContractDeployer interface { LoadKeeperRegistry(address common.Address, registryVersion eth_contracts.KeeperRegistryVersion) (KeeperRegistry, error) DeployKeeperConsumer(updateInterval *big.Int) (KeeperConsumer, error) DeployAutomationLogTriggerConsumer(testInterval *big.Int) (KeeperConsumer, error) - DeployAutomationSimpleLogTriggerConsumer() (KeeperConsumer, error) + DeployAutomationSimpleLogTriggerConsumer(isStreamsLookup bool) (KeeperConsumer, error) DeployAutomationStreamsLookupUpkeepConsumer(testRange *big.Int, interval *big.Int, useArbBlock bool, staging bool, verify bool) (KeeperConsumer, error) DeployAutomationLogTriggeredStreamsLookupUpkeepConsumer() (KeeperConsumer, error) DeployKeeperConsumerPerformance( @@ -1517,13 +1517,13 @@ func (e *EthereumContractDeployer) DeployAutomationLogTriggerConsumer(testInterv }, err } -func (e *EthereumContractDeployer) DeployAutomationSimpleLogTriggerConsumer() (KeeperConsumer, error) { +func (e *EthereumContractDeployer) DeployAutomationSimpleLogTriggerConsumer(isStreamsLookup bool) (KeeperConsumer, error) { address, _, instance, err := e.client.DeployContract("SimpleLogUpkeepCounter", func( auth *bind.TransactOpts, backend bind.ContractBackend, ) (common.Address, *types.Transaction, interface{}, error) { return simple_log_upkeep_counter_wrapper.DeploySimpleLogUpkeepCounter( - auth, backend, + auth, backend, isStreamsLookup, ) }) if err != nil { diff --git a/integration-tests/contracts/ethereum_keeper_contracts.go b/integration-tests/contracts/ethereum_keeper_contracts.go index 0a516d5029b..337e3009f16 100644 --- a/integration-tests/contracts/ethereum_keeper_contracts.go +++ b/integration-tests/contracts/ethereum_keeper_contracts.go @@ -174,6 +174,7 @@ type KeeperRegistrySettings struct { FallbackLinkPrice *big.Int // LINK price used if the LINK price feed is stale MaxCheckDataSize uint32 MaxPerformDataSize uint32 + MaxRevertDataSize uint32 RegistryVersion ethereum.KeeperRegistryVersion } @@ -258,7 +259,7 @@ func (rcs *KeeperRegistrySettings) Create22OnchainConfig(registrar string, regis MaxPerformGas: rcs.MaxPerformGas, MaxCheckDataSize: rcs.MaxCheckDataSize, MaxPerformDataSize: rcs.MaxPerformDataSize, - MaxRevertDataSize: uint32(1000), + MaxRevertDataSize: rcs.MaxRevertDataSize, FallbackGasPrice: rcs.FallbackGasPrice, FallbackLinkPrice: rcs.FallbackLinkPrice, Transcoder: common.Address{}, @@ -280,7 +281,7 @@ func (rcs *KeeperRegistrySettings) Create21OnchainConfig(registrar string, regis MaxPerformGas: rcs.MaxPerformGas, MaxCheckDataSize: rcs.MaxCheckDataSize, MaxPerformDataSize: rcs.MaxPerformDataSize, - MaxRevertDataSize: uint32(1000), + MaxRevertDataSize: rcs.MaxRevertDataSize, FallbackGasPrice: rcs.FallbackGasPrice, FallbackLinkPrice: rcs.FallbackLinkPrice, Transcoder: common.Address{}, diff --git a/integration-tests/load/automationv2_1/automationv2_1_test.go b/integration-tests/load/automationv2_1/automationv2_1_test.go index d199ddd7b85..eb53d3e0989 100644 --- a/integration-tests/load/automationv2_1/automationv2_1_test.go +++ b/integration-tests/load/automationv2_1/automationv2_1_test.go @@ -2,6 +2,7 @@ package automationv2_1 import ( "context" + "encoding/hex" "fmt" "math" "math/big" @@ -62,6 +63,11 @@ Enabled = true Enabled = true AnnounceAddresses = ["0.0.0.0:6690"] ListenAddresses = ["0.0.0.0:6690"]` + secretsTOML = `[Mercury.Credentials.%s] +LegacyURL = '%s' +URL = '%s' +Username = '%s' +Password = '%s'` minimumNodeSpec = map[string]interface{}{ "resources": map[string]interface{}{ @@ -177,6 +183,7 @@ Load Config: FallbackLinkPrice: big.NewInt(2e18), MaxCheckDataSize: uint32(5_000), MaxPerformDataSize: uint32(5_000), + MaxRevertDataSize: uint32(5_000), RegistryVersion: contractseth.RegistryVersion_2_1, } @@ -235,6 +242,16 @@ Load Config: loadedTestConfig.Pyroscope.Environment = &testEnvironment.Cfg.Namespace } + if *loadedTestConfig.Automation.DataStreams.Enabled { + secretsTOML = fmt.Sprintf( + secretsTOML, "cred1", + *loadedTestConfig.Automation.DataStreams.URL, *loadedTestConfig.Automation.DataStreams.URL, + *loadedTestConfig.Automation.DataStreams.Username, *loadedTestConfig.Automation.DataStreams.Password, + ) + } else { + secretsTOML = "" + } + numberOfUpkeeps := *loadedTestConfig.Automation.General.NumberOfNodes for i := 0; i < numberOfUpkeeps+1; i++ { // +1 for the OCR boot node @@ -252,10 +269,11 @@ Load Config: } cd := chainlink.NewWithOverride(i, map[string]any{ - "toml": nodeTOML, - "chainlink": nodeSpec, - "db": dbSpec, - "prometheus": *loadedTestConfig.Automation.General.UsePrometheus, + "toml": nodeTOML, + "chainlink": nodeSpec, + "db": dbSpec, + "prometheus": *loadedTestConfig.Automation.General.UsePrometheus, + "secretsToml": secretsTOML, }, loadedTestConfig.ChainlinkImage, overrideFn) testEnvironment.AddHelm(cd) @@ -310,6 +328,10 @@ Load Config: F: 1, } + if *loadedTestConfig.Automation.DataStreams.Enabled { + a.MercuryCredentialName = "cred1" + } + startTimeTestSetup := time.Now() l.Info().Str("START_TIME", startTimeTestSetup.String()).Msg("Test setup started") @@ -344,7 +366,7 @@ Load Config: for _, u := range loadedTestConfig.Automation.Load { for i := 0; i < *u.NumberOfUpkeeps; i++ { - consumerContract, err := contractDeployer.DeployAutomationSimpleLogTriggerConsumer() + consumerContract, err := contractDeployer.DeployAutomationSimpleLogTriggerConsumer(*u.IsStreamsLookup) require.NoError(t, err, "Error deploying automation consumer contract") consumerContracts = append(consumerContracts, consumerContract) l.Debug(). @@ -361,6 +383,11 @@ Load Config: PerformBurnAmount: u.PerformBurnAmount, UpkeepGasLimit: u.UpkeepGasLimit, SharedTrigger: u.SharedTrigger, + Feeds: []string{}, + } + + if *u.IsStreamsLookup { + loadCfg.Feeds = u.Feeds } loadConfigs = append(loadConfigs, loadCfg) @@ -394,17 +421,22 @@ Load Config: } encodedLogTriggerConfig, err := convenienceABI.Methods["_logTriggerConfig"].Inputs.Pack(&logTriggerConfigStruct) require.NoError(t, err, "Error encoding log trigger config") - l.Debug().Bytes("Encoded Log Trigger Config", encodedLogTriggerConfig).Msg("Encoded Log Trigger Config") + l.Debug(). + Interface("logTriggerConfigStruct", logTriggerConfigStruct). + Str("Encoded Log Trigger Config", hex.EncodeToString(encodedLogTriggerConfig)).Msg("Encoded Log Trigger Config") checkDataStruct := simple_log_upkeep_counter_wrapper.CheckData{ CheckBurnAmount: loadConfigs[i].CheckBurnAmount, PerformBurnAmount: loadConfigs[i].PerformBurnAmount, EventSig: bytes1, + Feeds: loadConfigs[i].Feeds, } encodedCheckDataStruct, err := consumerABI.Methods["_checkDataConfig"].Inputs.Pack(&checkDataStruct) require.NoError(t, err, "Error encoding check data struct") - l.Debug().Bytes("Encoded Check Data Struct", encodedCheckDataStruct).Msg("Encoded Check Data Struct") + l.Debug(). + Interface("checkDataStruct", checkDataStruct). + Str("Encoded Check Data Struct", hex.EncodeToString(encodedCheckDataStruct)).Msg("Encoded Check Data Struct") upkeepConfig := automationv2.UpkeepConfig{ UpkeepName: fmt.Sprintf("LogTriggerUpkeep-%d", i), diff --git a/integration-tests/reorg/automation_reorg_test.go b/integration-tests/reorg/automation_reorg_test.go index fe87ac1aa3f..7a2215c36f0 100644 --- a/integration-tests/reorg/automation_reorg_test.go +++ b/integration-tests/reorg/automation_reorg_test.go @@ -96,6 +96,7 @@ LimitDefault = 5_000_000` FallbackLinkPrice: big.NewInt(2e18), MaxCheckDataSize: uint32(5000), MaxPerformDataSize: uint32(5000), + MaxRevertDataSize: uint32(5000), } ) diff --git a/integration-tests/smoke/automation_test.go b/integration-tests/smoke/automation_test.go index 2ee01fa21c9..d69173b47d3 100644 --- a/integration-tests/smoke/automation_test.go +++ b/integration-tests/smoke/automation_test.go @@ -58,6 +58,7 @@ var ( FallbackLinkPrice: big.NewInt(2e18), MaxCheckDataSize: uint32(5000), MaxPerformDataSize: uint32(5000), + MaxRevertDataSize: uint32(5000), } ) diff --git a/integration-tests/testconfig/automation/automation.toml b/integration-tests/testconfig/automation/automation.toml index 58b95f9b4cc..c1fec4f1f8a 100644 --- a/integration-tests/testconfig/automation/automation.toml +++ b/integration-tests/testconfig/automation/automation.toml @@ -25,6 +25,9 @@ spec_type="minimum" chainlink_node_log_level="info" use_prometheus=false +[Load.Automation.DataStreams] +enabled=false + [[Load.Automation.Load]] number_of_upkeeps=5 number_of_events = 1 @@ -34,6 +37,8 @@ check_burn_amount = 0 perform_burn_amount = 0 upkeep_gas_limit = 1000000 shared_trigger = false +is_streams_lookup = false +feeds = ["0x000200"] [[Load.Automation.Load]] number_of_upkeeps=5 @@ -44,6 +49,8 @@ check_burn_amount = 0 perform_burn_amount = 0 upkeep_gas_limit = 1000000 shared_trigger = true +is_streams_lookup = false +feeds = ["0x000200"] [Load.Pyroscope] enabled=false \ No newline at end of file diff --git a/integration-tests/testconfig/automation/config.go b/integration-tests/testconfig/automation/config.go index 4431a640d0d..cb70cde2d8f 100644 --- a/integration-tests/testconfig/automation/config.go +++ b/integration-tests/testconfig/automation/config.go @@ -6,8 +6,9 @@ import ( ) type Config struct { - General *General `toml:"General"` - Load []Load `toml:"Load"` + General *General `toml:"General"` + Load []Load `toml:"Load"` + DataStreams *DataStreams `toml:"DataStreams"` } func (c *Config) Validate() error { @@ -23,6 +24,11 @@ func (c *Config) Validate() error { } } } + if c.DataStreams != nil { + if err := c.DataStreams.Validate(); err != nil { + return err + } + } return nil } @@ -65,6 +71,8 @@ type Load struct { PerformBurnAmount *big.Int `toml:"perform_burn_amount"` SharedTrigger *bool `toml:"shared_trigger"` UpkeepGasLimit *uint32 `toml:"upkeep_gas_limit"` + IsStreamsLookup *bool `toml:"is_streams_lookup"` + Feeds []string `toml:"feeds"` } func (c *Load) Validate() error { @@ -86,6 +94,49 @@ func (c *Load) Validate() error { if c.PerformBurnAmount == nil || c.PerformBurnAmount.Cmp(big.NewInt(0)) < 0 { return errors.New("perform_burn_amount must be set to a non-negative integer") } + if c.SharedTrigger == nil { + return errors.New("shared_trigger must be set") + } + if c.UpkeepGasLimit == nil || *c.UpkeepGasLimit < 1 { + return errors.New("upkeep_gas_limit must be set to a positive integer") + } + if c.IsStreamsLookup == nil { + return errors.New("is_streams_lookup must be set") + } + if *c.IsStreamsLookup { + if len(c.Feeds) == 0 { + return errors.New("feeds must be set") + } + } + + return nil +} +type DataStreams struct { + Enabled *bool `toml:"enabled"` + URL *string `toml:"url"` + Username *string `toml:"username"` + Password *string `toml:"password"` + DefaultFeedID *string `toml:"default_feed_id"` +} + +func (c *DataStreams) Validate() error { + if c.Enabled != nil && *c.Enabled { + if c.URL == nil { + return errors.New("data_streams_url must be set") + } + if c.Username == nil { + return errors.New("data_streams_username must be set") + } + if c.Password == nil { + return errors.New("data_streams_password must be set") + } + if c.DefaultFeedID == nil { + return errors.New("data_streams_feed_id must be set") + } + } else { + c.Enabled = new(bool) + *c.Enabled = false + } return nil }