No job show up in Runs page while trying to run a Chainlink node locally - ethereum

I am trying to fulfil requests on my local test chainlink node on rinkeby (following https://docs.chain.link/docs/fulfilling-requests/) but can't see any job runs appear on my operator ui.
The Oracle contract is at 0xA66f738a4688A9E51c2c6FF901CC3B11ce31AE6C
The ATestnetConsumer contract is at 0x977129EE2f404F4327A2A60C5fD9E57890D85FD0
My job toml screenshot below
Have confirmed my .env that it is running the rinkeby wss url from infura and the chain is 4 and the link token contract address is 0x01BE23585060835E02B77ef475b0Cc51aA1e0709
My node wallet has ETH and LINK. Both the contracts have Link too (but no ETH).
I run the setFulfillmentPermission function in remix with my Node wallet address and true
When I execute the requestEthereumPrice function with my oracle address and job id, I can see the LINK being sent by the ATestnetConsumer contract to the Oracle contract but no job run gets created in my local Chainlink node.
Confirming that the job hasn't run, I get the 0 value when I run the currentPrice function on ATestnetConsumer.
Can anyone please point me to where I am going wrong? Thanks in advance!

Finally got it to work. Posting my two findings as I do think the documentation needs an update to account for these.
The external job id in the Jobs screen on the Operator UI has dashes in them. To use them in the ATestnetConsumer contract you need to remove the dashes (so 0e84f38985eb4edb98c2e2a09b589666 and not 0e84f389-85eb-4edb-98c2-e2a09b589666).
The direct request toml doesn't seem to work as is. I had to append allowunrestrictednetworkaccess="true" to the fetch section so it becomes
fetch [type="http" method=GET url="$(decode_cbor.get)" allowunrestrictednetworkaccess="true"]

Related

Chainlink Automation upKeep not working. checkUpKeep is not calling performUpKeep

Our Dapp will have an NFT Auction functionality, which we are trying to automate 100% using chainlink. The auction winner will get the NFT and the Previous owner will get the highest Bid, Platform will get a small cut as well.
To do that, we are using CHainlink Keeper/Automation. I've set the checkUpKeep & performUpKeep, both are working fine when I'm doing everything manually. But when I am registering an upKeep for automaton.
When I input the deployed contract's address into the register upkeep box, it says Unable to verify if this is an Automation compatible contract. Why this warning?
How do I make the contract Automation compatible contract?
checkUpKeep is working good:
If I pass this performData into performUpKeep everything will work fine.
Code/Contracts: https://mumbai.polygonscan.com/address/0x7e2DA19C130cb3B483FA7f17C45c70716ABF5Fe8
Chainlink upKeep: https://automation.chain.link/mumbai/21891159634677518530356555981285976030474691922841692133624884405593696766700
Pls help, Thanks.
Unable to verify if this is an Automation compatible contract usually stems from a contract that is not verified on the block explorer. The contract you linked is verified and if you create an automation with it everything is good
Your checkUpKeep function does return true when supplied with the input you show(checkData). However, you have the checkData set to 0x in your automation.
With that input, it returns false.
You will need to change the checkData to match your screenshot.

DeployedBytecode doesn't match

so I encountered a weird issue with deploying bytecodes via a deployer contract. On 1 of 5 deployed contracts via the same compilation round & deployment flow I ended having a different deployedBytecode (but same bytecode) as with my original truffle compiled source. Therefore I can't get it verified. The issue seems that the address of the deployer contract is part of the deployedBytecode (while on my local file it is the null address). The issue is also only for 1 contract, while all 5 contracts share the same code (especially around the deployer address mentioned inside the contract.
So here i.e. is the deployer contract (+ verified source code):
https://polygonscan.com/address/0xd54716865c58d11e7c39c3cf634d9e919c0c6cce#code
I deployed my contract (SignerVaultV1.sol) via that tx:
https://polygonscan.com/tx/0x4d6e3a002b448e675ba6a2374737d4eaf0e18b163a57a66c09109ba332c8c5e3
The bytecode of it is exactly the same as on my local file, but if the deployedBytecodes are compared, 3 changes can be seen: Diff between online vs offline deployedBytecode (I can't post pics yet^^)
The difference in it is the address of the deployer contract (d54716865c58d11e7c39c3cf634d9e919c0c6cce). But like I said, the deployerContract delivered multiple contracts, all are correct, only this one is having that issue and I cant figure it out why.
I personally would like to get that contract verified without having to redeploy it (and maybe rund into the same issue...) I tried already to alter the source code to match the online deployedBytecode, but it seems also a harsh idea :D
Well after testing different ways, I dont honestly why, but sending a verification request via hardhat got it working... I couldn't manually verify or via truffle, but hardhat seems to know the magic for the last contract :)

When we call a solidity function via web3js , how does the code flows along with data formats during all the process

When we call a solidity function via web3js, how does the code flows along with data formats during all the process?
For example, if I call a solidity function through web3js, how does it get executed. Can anyone explain the complete flow?
First of all, I recommend taking the time to read How does Ethereum work, anyway?
But for now, a short explanation
When you call a method on a contract through web3.js, the library
will encode your method call as data attribute on the transaction.
Here's a good explanation about ethereum transactions and data
attribute
The ethereum node your web3.js is connected to will receive your transactions and do some basic checks of nonce and balance
Once the basic checks pass, the node will broadcast the transaction to the rest of the network
When a network node receives a transaction with data attribute, it will execute the transaction using the Ethereum EVM. The outcome
of the transaction is modified state of the contract storage. More
about contract storage
The expectation is that the transaction will produce the same state change on every single node in the network. This is how
consensus is reached and the transaction (and the contract state
change) become part of the canonical chain (mined and not belonging
to an uncle block)

Gas required exceeds limit

I'm trying to deploy the following contract on Ropsten using an injected web3 environment (i.e. metamask) on remix.ethereum.org/
pragma solidity ^0.4.16;
contract Coin {
// The keyword "public" makes those variables
// readable from outside.
address public minter;
mapping (address => uint) public balances;
// Events allow light clients to react on
// changes efficiently.
event Sent(address from, address to, uint amount);
// This is the constructor whose code is
// run only when the contract is created.
function Coin() public {
minter = msg.sender;
}
}
I've been able to create contracts with ease using remix before. I'm not sure what has changed, but I can't create contracts at all because of the gas limit thing. I've even gone as far as setting the gas limit to 2 full Ethers (i.e. value 1 ether with max of 2). I have close to 3 ethers in my metamask wallet. The remix "Account" dropdown also displays my metamask address correctly so it seems that the injected environment is connected.
When I try to create this contract I can't get past the gas required exceeds limit 2 error. I'm scratching my head as to why this simple contract would exceed the cost of 2 full Ethers.
Other parameters for remix in use:
optimize=false&version=soljson-v0.4.20+commit.3155dd80.js
Is there a setting on remix that I've forgotten? I'm Trying to deploy this from Chrome.
edit: I'm still scratching my head on this one. I was able to create the contract above for a brief moment after refreshing my page, but I came in today to try and run the code from https://www.ethereum.org/token and I can't get past the exceeds gas error with a value of 20 Gwei and a limit of 3000000. Note, I tried using the simple sample contract above and I'm back to where I was when I started - even the simple "Coin" contract above apparently exceeds the gas limit.
edit 2: Well, I think I'm getting somewhere. I've changed the compiler version from "soljson-v0.4.20+commit.3155dd80.js" to "soljson-v0.4.19+commit.c4cbbb05.js". Then I refresh the page 3 times. After that I wait a couple of minutes and things seem to be working again. There is something else happening here because when I reject the transaction in metamask and then return to remix to create again, I encounter the gas exceeded error. I don't believe the issue here is metamask as I've tried to connect locally using testrpc - localhost:8545 - and experience the same issue. All I can say is that the same code that I try to create fails to submit because of the gas error most of the time but occasionally works regardless of compiler version.

VM Exception in solidity

I am using testrpc and truffle to test my smart contract before deploying it to the real network.
In my contract, each node has to register in the contract by calling the function register, after that he can send or receive messages to/from contract( the blockchain )
The problem is, when an address ( let say account 1 from testrpc accounts) call the functions (send or receive ) the transaction doesn't occur and this message appears
VM Exception while processing transaction: invalid JUMP at
But when I use another unregistered account to call this function, it works.
Although no messages have been sent or received but no exceptions..
Any idea how I can solve this.
Thanks
Unless your using an old version of solc to compile your solidity the chance of this being an optimization problem is almost none.
Now, what does this mean then, it can happen when for example you run a modifier and it doesn't work. or if you try to call a function you are not allowed to and it throws. For example, it happens a lot after an ICO finishes and you try to use a function that can't be used anymore due to a date constraint it returns an Invalid Jump
I can't see your code but I think you might have reversed your if condition in your modifier and now it returns true if the user is not registered.