cardano-foundation / testnets-cardano-org

Official Cardano Testnets website repository
https://testnets.cardano.org/
MIT License
57 stars 34 forks source link

Invalid content /en/virtual-machines/kevm/getting-started/mallet-end-to-end/ #488

Closed facutk closed 2 years ago

facutk commented 3 years ago

Where does the issue occur? Expected: image Actual: image

Describe the issue Getting started does not work

Expected changes Should return Hello World, but returns empty string

web3.toAscii(web3.eth.call({to: myContractAddress, data: '0xc605f76c'}))
testacode commented 3 years ago

image same here

mallet> myContract = "0x" + fs.readFileSync('HelloWorld.bin', 'utf8');
'0x608060405234801561001057600080fd5b50610139806100206000396000f3fe60806040526004361061003b576000357c010000000000000000000000000000000000000000000000000000000090048063c605f76c14610040575b600080fd5b34801561004c57600080fd5b506100556100d0565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561009557808201518184015260208101905061007a565b50505050905090810190601f1680156100c25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60606040805190810160405280600d81526020017f48656c6c6f2c20576f726c64210000000000000000000000000000000000000081525090509056fea165627a7a723058208a049ee3518ebb37f4a4b9179c0e00c5ff8db1f05054360eb08807e06a2939dd0029'
mallet> tx = { gas: 470000, data: myContract}
{ gas: 470000,
  data:
   '0x608060405234801561001057600080fd5b50610139806100206000396000f3fe60806040526004361061003b576000357c010000000000000000000000000000000000000000000000000000000090048063c605f76c14610040575b600080fd5b34801561004c57600080fd5b506100556100d0565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561009557808201518184015260208101905061007a565b50505050905090810190601f1680156100c25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60606040805190810160405280600d81526020017f48656c6c6f2c20576f726c64210000000000000000000000000000000000000081525090509056fea165627a7a723058208a049ee3518ebb37f4a4b9179c0e00c5ff8db1f05054360eb08807e06a2939dd0029' }
mallet> deploymentHash = sendTransaction(tx)
Enter password:
'0xab824031814f6dff2f3c4ef5e8f328aedf8b764f36c54692dabe456df7926829'
mallet> getReceipt(deploymentHash)
null
mallet> getReceipt(deploymentHash)
null
mallet> getReceipt(deploymentHash)
{ transactionHash:
   '0xab824031814f6dff2f3c4ef5e8f328aedf8b764f36c54692dabe456df7926829',
  transactionIndex: 0,
  blockNumber: 60900,
  blockHash:
   '0x8c248aa006cbcd359a73b99b75595fb2263fc76946c1cc3cde086f2a626331ac',
  cumulativeGasUsed: 120427,
  gasUsed: 120427,
  contractAddress: '0x656cf09de6758cc025b2c0ecc12d1a0a4173c03d',
  logs: [] }
mallet> myContractAddress = getReceipt(deploymentHash).contractAddress
'0x656cf09de6758cc025b2c0ecc12d1a0a4173c03d'
mallet> web3.toAscii(web3.eth.call({to: myContractAddress, data: '0xc605f76c'}))
dylode commented 3 years ago

Two weeks later. Same issue.

HennyH commented 3 years ago

I cannot find the block number or transaction hash found in @testacode's answer on the KEVM devnet explorer https://explorer-kevm.portal.dev.cardano.org, presumably it should be there correct? The contract address exists though.

testacode commented 3 years ago

I'm starting to think on cardano as a shitcoin...

facutk commented 3 years ago

I just tried again today, 16 days after the original issue, and the same result image

tx here https://explorer-kevm.portal.dev.cardano.org/transaction/0xdb5f14f2bed0b4bc8528671e85fc08173620cd43021b73390ae7bb3fc9633693

cleisthenes-alpha commented 3 years ago

I've been able to replicate this issue and have found what seems to work as a fix on my end; full disclosure, I don't know enough about Solidity to know why this is the case.

First, note that all the network-side stuff in Mallet seems to be working fine, so it appears to be an issue with the underlying Solidity code. After some putzing around, I've found the following tweak produces the expected output: function helloWorld() public pure returns (string memory){

rather than the code from the tutorial which uses external on this line instead of public as I provide in the tweak above: function helloWorld() external pure returns (string memory){

Can you test this out and see if it helps? I'm not sure exactly what the repercussions of this minor tweak are, but take a look at this and this for more info on public v. external calls.

facutk commented 3 years ago

Hello @cleisthenes-alpha!

Thanks for taking your time on this.

I followed your advice. Updated the contract, compiled it again photo_2021-03-10 16 55 33

Then deployed it again, and called it. photo_2021-03-10 16 55 37

The same issue again

cleisthenes-alpha commented 3 years ago

I'm noticing your call to set myContract is missing the "0x" prefix in this newest iteration. I don't know what the consequences of that are; can you double-check that?

EDIT: Note also your versioning in the pragma line reflects my weird adjustments (I was replicating this on an old REMIX IDE instance), it most likely should read: pragma solidity >=0.5.1 <0.9.0; since that is the version of the compiler you're running afterwards (the solc lines)

facutk commented 3 years ago

image

image

still failing

tx: https://explorer-kevm.portal.dev.cardano.org/transaction/0xa8b9f74cab2557cd3e538d6d4d6c508f44da28c3bc3f63e6897b3d113f7df698

contract: https://explorer-kevm.portal.dev.cardano.org/account/0x1ADEC841580bCAbcD21307964462c9F05b75206a

cleisthenes-alpha commented 3 years ago

I'm mostly out of ideas at this point, as I'm not perfectly replicating your setup (again, playing with Solidity proper in Remix). My last idea: the documentation on this page for mallet is almost beat-for-beat what is posted in the KEVM docs, but with the last call different: sendTransaction({to: myContractAddress,gas:10000,arguments: []}) rather than web3.toAscii(web3.eth.call({to: myContractAddress, data: '0xc605f76c'})) This is the last idea I've got, so if that doesn't work, I'm sorry I can't be more helpful. Frustrating that something relatively simple in a starter tutorial like this isn't working for many.

facutk commented 3 years ago

Thanks a lot for your input cleisthenes-alpha. We still could not make it work. Maybe the kevm can only interpret some very specific solidity binary.

I've also run out of ideas.

Hopefully someone can go through the starter tutorial and make it work, and fix it so everyone can start testing this.

cleisthenes-alpha commented 3 years ago

Alright, I took some time to really dig into this. I've recreated the setup in the tutorial and have run into the exact same problem as you all. I have attempted the following:

No progress whatsoever. I've also noticed about four separate sets of conflicting documentation for simple interaction with the KEVM/IELE devnet, all of which feels very roughshod in compilation.

Would love someone else to take a look at this, I've genuinely given it everything I can possibly think of

facutk commented 3 years ago

Here is the commit where the KEVM docs were updated. https://github.com/cardano-foundation/testnets-cardano-org/pull/379/commits/613988f2598789d0a588b7c8f77f44fe2b75a77a

git blame shows https://github.com/fsancheziohk

Maybe we can reach out to him?

facutk commented 3 years ago

The PR was merged by https://github.com/jonnysmillie

https://www.jonnysmillie.co.uk/ hello@jonnysmillie.co.uk

Maybe he has any context whatsoever?

SL13PNIR commented 3 years ago

@gmanroney @elviejo79 Do either of you guys know who is responsible for the kevm testnet? Any chance the community could get some assistance please?

dylode commented 3 years ago

Guys, i asked them to make a video demostrating this hello world example and he said there are problems with rpc calls at the moment. They are looking into it.

cleisthenes-alpha commented 3 years ago

Yes, it appears they're recognizing there's a problem and working to solve it. See this commit comment; they're going to remove the Hello World tutorial for now until it's fixed.

https://github.com/cardano-foundation/testnets-cardano-org/commit/ad762daafecf50ac9534c6fb2dee24f711cd46e9#diff-73fc8ad49869b0b7235fc30466f275d0b6428a4850a6ad6f1de348ea265eec6c

avilsmeier commented 3 years ago

Hi guys, I was helping Facu troubleshoot this last night but I was able to run the "Hello world" without issues. I used Chrome's web cache to pull up the old version of the website, these are my steps and environment.

Ubuntu 18 topo-test:~/src/mallet$ nvm --version 0.37.2 topo-test:~/src/mallet$ npm --version 6.9.0 topo-test:~/src/mallet$ node --version v10.16.3 python -V Python 2.7.18

Contract address: 0xc00db93ebf8d41b1b6245bc9163315d4703d251b Account address: 0x08007446d66f54ed8e76cc6e9a9ce7168b4ce94e

I installed everything according to the steps here: https://developers.cardano.org/en/virtual-machines/kevm/getting-started/mallet-end-to-end/

And then used these steps for the SC in "Create A HelloWorld Smart Contract". https://webcache.googleusercontent.com/search?q=cache:YMGZ9pP2mIgJ:https://developers.cardano.org/en/virtual-machines/evm/getting-started/mallet-end-to-end/+&cd=18&hl=es-419&ct=clnk&gl=ar

myAccount = newAccount() selectAccount(myAccount) requestFunds() getBalance()

fs = require("fs"); myContract = "0x" + fs.readFileSync('HelloWorld.bin', 'utf8'); tx = { gas: 470000, data: myContract} deploymentHash = sendTransaction(tx)

getReceipt(deploymentHash) myContractAddress = getReceipt(deploymentHash).contractAddress web3.toAscii(web3.eth.call({to: myContractAddress, data: '0xc605f76c'}))

image

When querying Facu's contract however I also got ' ' as response. If he queries mine he also receives ' ';

Thank you all and have a good one!

facutk commented 3 years ago

@avilsmeier gave me a huge hand debugging it from his end.

I tried a different approach and called the RPC directly from Python

https://colab.research.google.com/drive/11fA1WE_GPlVh4_TlAON8Dj9qqjYEHju7#scrollTo=2FdfNYXQBOqt

And the result is working fine

image

facutk commented 3 years ago

One thing to mention, is that it only works on the EVM network, not the KEVM.

image

Where it says

./mallet kevm -d ./data

It should say

./mallet evm -d ./data

EVM works as expected image

danielrodd commented 3 years ago

That's it! I'm moving to Algorand