Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 10 2017 22:42
    @jpitts banned @etherchamp1_twitter
  • Jun 05 2016 10:33
    @chriseth banned @adamskee
Cyyber Ttechno
@cyyber
Hi. How can I make function call within same contract using Solidity Inline Assembly?
katbury
@katbury
@EighthLayer thank you so much for giving an alternative! ISince I'm still on the planning process I'll make sure to look at it too!
@VarietyDavids I tried a different sample, an updated one that works great! thank you for pointing it out!
Enrique Alcázar Garzás
@kikoncuo
Hello everyone, found a bug with create2 OP code while using libraries
wanna check if someone else has experienced it before I open an issue
Rick Park
@rpsnoopy
@kikoncuo create2 is a very new achievement just introduced and its working way is no so well known in the community at the moment. Could you please describe your problem? This is a good description to be used as short reference https://hackernoon.com/the-create2-opcode-and-dapp-onboarding-in-ethereum-e2178e6c20cb
Enrique Alcázar Garzás
@kikoncuo

@rpsnoopy
We got it to work with a simple function in a smart contract:

  function deploy(bytes memory code, uint256 salt) public onlyOwner {
    address addr;
    assembly {
      addr := create2(0, add(code, 0x20), mload(code), salt)
      if iszero(extcodesize(addr)) {
        revert(0, "Problem deploying contract")
      }
    }
    emit Deployed(addr, salt);
  }

It works fine, we´ve been using it for a while.
But when trying to deploy bytecode with library references the transaction always fails

Enrique Alcázar Garzás
@kikoncuo

@rpsnoopy
To check where the problem was we followed the following process:

  1. Deployed library using truffle
  2. Linked library to SC using truffle
  3. Deployed SC
  4. Worked SC deployed!

  5. Took the bytecode from the deployment (Deployed bytecode with the address substitution, copied directly from step 3, double checked, no errors there)

  6. Deployed using the function deployed (Code using create2 posted above)
  7. Transaction reverted

  8. Tested with a different smart contract without libraries
    9 Process worked with both truffle and using the deploy function

Conclusion:
Create2 fails when the bytecode references libraries

Rick Park
@rpsnoopy
@kikoncuo I understood that it is no so assured a proper return value from the extcodesize after the last Ethereum fork, but you should investigate further because I’ve no evidence of it at the moment. Let me know if you know more
Enrique Alcázar Garzás
@kikoncuo
@rpsnoopy What kind of tests do you recommend? debug the transaction looking at the returned value?
Rick Park
@rpsnoopy
Yes. As I understood it is no more guaranteed that it returns zero in the conditions before assured or something similar. But you should verify it.
Danilo
@danilozabeu_twitter

Guys, can anyone tell why a call from require (.....) in ganache returns the message, but when I send to rinkeby network, it does not return me?

Ex (forcing him to fall into require):

require (master == msg.sender, "Error 1");
Ganache Error: Error 1
Rinkeby error: Error: Returned error: gas required exceeded allowance (xxxxx) or always failing transaction

Already confirmed and this msg in Rinkeby happens because it did not pass require ... if I remove it, passes normal.

I'm deploying with this master (which I save at the time of deploy, so it loads the address of the account I deployed). In case, I'm forcing him to fall into this require. The problem is that when it falls, the return is not coming from the require message, but this generic return. This is happening to all the other requires that I have in this contract.

The same code, without changing any points, in remix / ganache, works fine, that is, it returns me the require custom message

Rick Park
@rpsnoopy
Both ganache and remix VM are local JavaScript based environment. Rinkeby it is not. You should find your message in the transaction report on etherscan, not as a local message. This could be the reason.
Danilo
@danilozabeu_twitter

hi @rpsnoopy , but the transaction didnt finish because its stop on require. Look, my intention was to force the contract stop on require, to check if the custom mensagem was return to my API. So, once a have this functionality (to use custom message on require), why its not return to me?

My function:

function setEntity(address _wallet) public returns (bool) {
    require(msg.sender != _wallet,"This wallet is the Master");
    return true;
}

So, if it stop on require, i understood that the return message should be : "This wallet is the Master", but, on Rinkeby, the message is : Returned error: gas required exceeded allowance (xxxxx) or always failing transaction

So, how can i have this return, when i force to stop on require?
Rick Park
@rpsnoopy
Are you sure your transaction IS NOT FAILING FOR GAS RELATED REASONS ON RINKEBY? (Sorry for the uppercase)
Rinkeby has the lower gas limit value... even if I’m not able to@find it now, but ropsten!
Anyway failed transaction are visible on rinkeby.etherscan.io as successful are
Danilo
@danilozabeu_twitter

the function has only a require, not more. So, i dont think that gas is the main problem....

Look, the message say two things: "gas required exceeded allowance (xxxxx) or always failing transaction"

So, this should be the issue: always failing transaction

If i remove the require, it work (return true). If i stay with "require", this message return to me. Ganache and Remix return me "This wallet is the master", and this is the exactly what i need.

EighthLayer
@EighthLayer
If anyone has free time please take a look at this gambling contract I created, have only done some testing but it is my first contract and want to make sure there is no vulnerabilities. The contract should allow two people to send 1 eth to the contract, grab a random number (0 or 1) from provable, and then determine a winner to get 2 eth. Any comments/concerns would be much appreciated! https://github.com/EighthLayer/FiftyFiftyContracts/blob/master/OneEthFiftyFifty.sol
matrixbot
@matrixbot
ivanmarx Good afternoon.
ZeptoBook
@zeptobook
@zeptobook
Struggling with web3 call() for 1 day. This line const result = await HelloContract.methods.getGreeting().call(); throwing console error. Uncaught (in promise) Error: Returned values aren't valid, did it run Out of Gas? You might also see this error if you are not using the correct ABI for the contract you are retrieving data from, requesting data from a block number that does not exist, or querying a node which is not fully synced.
at ABICoder.push../node_modules/web3-eth-abi/src/index.js.ABICoder.decodeParameters (index.js:226)
at Contract.push../node_modules/web3-eth-contract/src/index.js.Contract._decodeMethodReturn (index.js:471)
at Method.outputFormatter (index.js:824)
at Method.push../node_modules/web3-core-method/src/index.js.Method.formatOutput (index.js:165)
at sendTxCallback (index.js:540)
does anyone know what is the right way of using web3 call() method
Danilo
@danilozabeu_twitter

the function has only a require, not more. So, i dont think that gas is the main problem....

Look, the message say two things: "gas required exceeded allowance (xxxxx) or always failing transaction"

So, this should be the issue: always failing transaction

If i remove the require, it work (return true). If i stay with "require", this message return to me. Ganache and Remix return me "This wallet is the master", and this is the exactly what i need.

Guys, i found this comment:
image.png
"Note: solidity doesn’t support this return value argument yet, but you can watch this issue for that update"
This is the problem? Solidity cant send me the custom msg of require, not yet?
Luis Schliesske
@gitpusha
Hi @chriseth - a question about low-level delegatecalls:
Do they automatically catch any reverts and convert their revert message into bytes memory returndata?
Or can I bubble up revert messages through them, in order for them to be caught by a high-level try catch Error(string memory reason) ?
Ivan Martinez
@0xKiwi
Hey guys, anyone looking for support can join https://discord.gg/5W5tVb3 on Discord for a more active community :)
Largest ETH focused discord :D
You can also access it on ENS now http://devs.eth.link :P
yk272
@yk272
hi im new to solidity i have been getting this error lately can anyone tell me whats it about ? this is the error " Warning! Error encountered during contract execution [Out of stack]"
chriseth
@chriseth
@gitpusha yes, reverts do not auto-bubble up
if you want that, you have to manually call revert.
Evgeniy Shishkin
@unboxedtype
Can I compile Solidity into WASM or native x86? There is some --ir flag, I suppose this is for translating IR into some native assembly ?
Woops, there is --machine ewasm switch. Sorry for bothering.
chriseth
@chriseth
@unboxedtype you can use --ir and take that ir and compile to ewasm using solc --strict-assembly --machine wasm, but the support is not complete yet
Luis Schliesske
@gitpusha
@chriseth ok, thanks for clarifying.
I seem to have achieved my wanted result by converting the bytes memory returndata from the low-level call to string and then
Luis Schliesske
@gitpusha
(bool success,
 bytes memory revertReason) = address(_action).delegatecall.gas(_actionGas)(
     _actionPayloadWithSelector
);
if (!success) revert(string(revertReason));
this seems to have bubbled up the revert string from below correctly
in fact I catch the revert(string(revertReason)); with a
} catch Error(string memory revertReason) {
        executionFailureReason = revertReason;
} catch {
and emit the string executionFailureReason and it has worked. I can read the caught revertReason in UTF-8 in the etherscan event logs.
not sure if this is a good practice, or too hacky
but in his way I was able to bubble up revert messages as string even through the non-auto bubble up low-level call, and then catch them with the new try catch { Error (string memory revertReason) syntax
yk272
@yk272
hi there ,i encountered one more error .I want to import two contracts contract A and Contract B into another contract C. Contract A inherits open zeppelin ERC20 Contract and Contract B Inherits open zeppelin ERC721 contract. What i did was i flattened Contract A and Contract B . And im trying to import Contract A_Flat.sol and Contract B_flat.sol into Contract C. The error reads "Identifier Already Declared" .It says that Context and Safe Math are already there in one of the Contracts A and B. Is there a way to import ERC20 and ERC721 into a single contract ?
chriseth
@chriseth
@yk272 can you try not flattening and using the multi-file verifier instead?
yk272
@yk272
how do i use it to verify multiple imports from open zeppelin ?
chriseth
@chriseth
@yk272 you can also use import "file.sol" as A; and then use A.ContractName to access the contract.
Oliver wood
@Oliverw32039642_twitter
buenas tengo un problema con remix ethereum ide y esque no me deja importar contratos