Reputation: 1
We're trying to get our Chainlink AnyAPI stack to work with an Arbitrum Chainlink node. The same stack is being used on Ethereum, Polygon and Avalanche without issue.
Chainlink AnyAPI empowers some of the use cases of DSLA Protocol, a middleware for adding consumer protection capabilities to any monitorable marketplace (e.g. OpenSea) using peer-to-peer service level agreements (SLA).
Here are the different steps involved in verifying that a SLA contract has been respected, using Chainlink:
A user calls the verification function on the Messenger smart contract that implements Chainlink.
The Messenger
smart contract sends the request the PreCoordinator
smart contract .
The PreCoordinator
forwards the request to the Oracles defined in a Service Agreement (proxy of Oracles).
Upon receiving LINK, each Oracle sends the request to the Chainlink node, by emitting an OracleRequest
event with the id of the job to be executed.
The Chainlink node captures such event, and executes the corresponding job.
Once the job is executed, the Chainlink node calls the fulfillOracleRequest2
function to return the result from the external adapter to the PreCoordinator.
The PreCoordinator takes the mean of all Oracle results and ultimately registers the SLI in the messenger.
The SLA is verified (real vs goal) by comparing the SLI (real) and the SLO (goal).
It appears our node doesn't pick the OracleRequest event of our PreCoordinator v0.6 / Operator v0.7 setup.
The request is never fulfilled so we've been wondering if our job id syntax is correct in the PreCoordinator service agreements (among other things) and if, perhaps, there's a peculiar configuration to apply to the node / v2 job specs.
PreCoordinator.sol: a proxy for using multiple Chainlink oracles using service agreements
v0.6 Chainlink contracts:
import '@chainlink/contracts/src/v0.6/ChainlinkClient.sol';
import '@chainlink/contracts/src/v0.6/LinkTokenReceiver.sol';
import '@chainlink/contracts/src/v0.6/Median.sol';
import '@chainlink/contracts/src/v0.6/vendor/Ownable.sol';
import '@chainlink/contracts/src/v0.6/vendor/SafeMathChainlink.sol';
Operator.sol
* contracttype = "directrequest"
schemaVersion = 1
name = "StakingParametricRequest"
forwardingAllowed = false
maxTaskDuration = "0s"
contractAddress = "0x6Dc1147ca16C020579642D90042CeA252474fD67"
minContractPaymentLinkJuels = "0"
observationSource = """
decode_log [type=ethabidecodelog
abi="OracleRequest(bytes32 indexed specId, address requester, bytes32 requestId, uint256 payment, address callbackAddr, bytes4 callbackFunctionId, uint256 cancelExpiration, uint256 dataVersion, bytes data)"
data="$(jobRun.logData)"
topics="$(jobRun.logTopics)"]
decode_cbor [type=cborparse data="$(decode_log.data)"]
fetch [type=bridge name="staking-parametric" requestData="{\\"id\\": $(jobSpec.externalJobID), \\"data\\": { \\"sla_monitoring_start\\": $(decode_cbor.sla_monitoring_start), \\"sla_monitoring_end\\": $(decode_cbor.sla_monitoring_end), \\"sla_address\\": $(decode_cbor.sla_address), \\"network_name\\": $(decode_cbor.network_name)}}"]
parse [type=jsonparse path="data,result" data="$(fetch)"]
encode_large [type="ethabiencode"
abi="(bytes32 requestId, bytes _data)"
data="{\\"requestId\\": $(decode_log.requestId), \\"_data\\": $(parse)}"
]
encode_tx [type=ethabiencode
abi="fulfillOracleRequest2(bytes32 requestId, uint256 payment, address callbackAddress, bytes4 callbackFunctionId, uint256 expiration, bytes calldata data)"
data="{\\"requestId\\": $(decode_log.requestId), \\"payment\\": $(decode_log.payment), \\"callbackAddress\\": $(decode_log.callbackAddr), \\"callbackFunctionId\\": $(decode_log.callbackFunctionId), \\"expiration\\": $(decode_log.cancelExpiration), \\"data\\": $(encode_large)}"
]
submit_tx [type=ethtx to="0x6Dc1147ca16C020579642D90042CeA252474fD67" data="$(encode_tx)"]
decode_log -> decode_cbor -> fetch -> parse -> encode_large -> encode_tx -> submit_tx
"""
ETH_CHAIN_ID: "42161"
LINK_CONTRACT_ADDRESS: "0xf97f4df75117a78c1A5a0DBb814Af92458539FB4"
ETH_URL: "wss://arbitrum-mainnet.s.chainbase.online/v1/[redacted]"
ETH_SECONDARY_URLS: "https://morning-dimensional-morning.arbitrum-mainnet.quiknode.pro/[redacted]/"
Has anybody experienced a similar issue?
Thanks a tons for your help! Wilhem
Upvotes: 0
Views: 114
Reputation: 11
After a quick glance I can say that the encode_tx
task has a wrong abi
value. fulfillOracleRequest2
must have data
as bytes
not bytes32
.
From: https://github.com/smartcontractkit/chainlink/blob/develop/contracts/src/v0.7/Operator.sol#L208
Upvotes: 1