Truffle MetaCoin example not working as expected - ethereum

So I have a testrpc running, and two instances of the initial project created with truffle init. And they both connect to the same testrpc.
1.
When I fill in an amount and no address, it will subtract the amount from my current balance. I would expect that same balance to show up at the other instance, which is using the same account[0] ID. But it doesn't, it shows the initial 10000 there, while i would expect the actual balance to be extracted from the testrpc? What am I doing/thinking wrong here?
2.
When I try to transfer MetaCoins from account[0] to account[1] (or rather, enter the id), then modify app.js in one of the instances to account[1], run truffle build and refresh, the balance is still 0.
3.
When I try the above two on the same instance/device, it does work?
I suspect that either I'm misunderstanding some fundamental thing here, or there's a bug somewhere.
Although the testrpc is receiving an eth_sendTransaction in the terminal, when either instance does a transaction..

Related

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 :)

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

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"]

Disable confirm parameters for transactions

I'm trying to call a smart contract method with .send passing arrays of addresses with web3js and ledger nano. When i call the method ask me an endless list of confirms parameters ( not very clear what it is also) and the confirms are growing with the array size. How I can DISABLE it? I played with the settings but no success at all.
Just re-install the ethereum applicaton. Probably the firmware was updated with some setting changes and the application need to be re installed to be up to date.

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.

How do BundleActivator, ManagedService, and my application interact on start/stop?

I had a non-OSGi application. To convert it to OSGi, I first bundled it up and gave it a simple BundleActivator. The activator's start() started up a thread of what used to be the main() of my app (and is now a Runnable), and remembered that thread. The activator's stop() interrupted that thread, and waited for it to end (via join()), then returned. This all seemed to be working fine.
As a next step in the OSGiification process, I am now trying to use OSGi configuration management instead of the Properties-based configuration that the application used to use. So I am adding in a ManagedService in addition to the Activator.
But it's no longer clear to me how I am supposed to start and stop my application; examples that I've seen are only serving to confuse me. Specifically, here:
http://felix.apache.org/site/apache-felix-config-admin.html
They no longer seem to do any real starting of the application in BundleActivator.start(). Instead, they just register a ManagedService to receive configuration. So I'm guessing maybe I start up the app's main thread when I receive configuration, in the ManagedService? They don't show it - the ManagedService's updated() just has vague comments saying to "apply configuration from config admin" when it is passed a non-null Dictionary.
So then I look here:
http://blog.osgi.org/2010/06/how-to-use-config-admin.html
In there, it seems like maybe they're doing what I guessed. They seem to have moved the actual app from BundleActivator to ManagedService, and are dealing with starting it when updated() receives non-null configuration, stopping it first if it's already started.
But now what about when the BundleActivator's stop() gets called?
Back on the first example page that I mentioned above, they unregister the ManagedService. On the second example page, they don't show what they do.
So I'm guessing maybe unregistering the ManagedService will cause null configuration to be sent to ManagedService.updated(), at which point I can interrupte the app thread, wait for it to end, and then return?
I suspect that I'm thoroughly incorrect, but I don't know what the "real" way to do this is. Thanks in advance for any help.
BundleActivator (BA) and ManagedService (MS) are callbacks to your bundle. BundleActivator is for the active state of your bundle. BA.start is when you bundle is being started and BA.stop is when it is being stopped. MS is called to provide your bundle a configuration, if there is one, or notify you there is no configuration.
So in BA.start, you register your MS service and return. When MS is called (on some other thread), you will either receive your configuration or be told there is no configuration and you can act accordingly (start app, etc.)
Your MS can also be called at anytime to advice of the modification or deletion of your configuration and you should act accordingly (i.e. adjust your app behavior).
When you are called at BA.stop, you need to stop your app. You can unregister the MS or let the framework do it for you as part of normal bundle stop processing.