by

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
Rakesh Ranjan
@bitcyber
@rahul70392 You should correct your @param description
Kumar Gaurav
@arkhaminferno
Hello all i want make a timer contract. Where there is create function that stores some numbers into a mapping of the contract. The create function will take the number and will take user defined timestamp. There would be another getter function that would access the number but there will be a condition. If the current time stamp is greater than the user defined timestamp .then only you can access the number. Can anyone provide me code for this?
Marvin Kruse
@marvinkruse
Hey everyone, just a quick question, what's the safest way to send ether? is this considered safe?
(bool success, ) = recipient.call.value(amount).gas(2300)("");
chriseth
@chriseth
@marvinkruse msg.sender.call{value: amount}() is the currently recommended way. You just send to msg.sender to avoid stalling. You do it at the end of your contract's execution to avoid reentrancy and you send all gas to allow for smart contract wallets to receive ether.
Kumar Gaurav
@arkhaminferno
.now keyword solidity.displays timestamp in milliseconds or nanoseconds?
chriseth
@chriseth
seconds
Marvin Kruse
@marvinkruse
thanks a lot @chriseth! Does that also work in solidity 0.5.12 or is your syntax from 0.6.x?
chriseth
@chriseth
oh yeah, that's the current syntax, in older compilers you need msg.sender.call.value(amount)()
Marvin Kruse
@marvinkruse
alright, so just dropping the gas part, since it only introduces problems with smart contract wallets otherwise. makes sense. thanks as lot! 🙇‍♂️
chriseth
@chriseth
"You do it at the end of your contract's execution to avoid reentrancy" - this is also essential
Marvin Kruse
@marvinkruse
Gotcha, will do so!
Nick Dodson
@SilentCicero
@chriseth @axic what is the status on Berlin, what is the timeline like for that?
chriseth
@chriseth
@SilentCicero no required changes from the solidity side, so you probably have to ask client authors
Nick Dodson
@SilentCicero
Where does Peter hang out @chriseth ?
go-ethereum I suppose, thanks @chriseth
Genysys
@Genysys

I have a node application that manually deploys a smart contract and stores the details in a database. It works fine when I run it on a local docker machine.

However when I run it on a k8 pod, it throws the following error:

Error: unable to get local issuer certificate
    at TLSSocket.onConnectSecure (_tls_wrap.js:1486:34)
    at TLSSocket.emit (events.js:315:20)
    at TLSSocket._finishInit (_tls_wrap.js:921:8)
    at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:695:12) {
  code: 'UNABLE_TO_GET_ISSUER_CERT_LOCALLY'
}
Error: unable to get local issuer certificate
    at TLSSocket.onConnectSecure (_tls_wrap.js:1486:34)
    at TLSSocket.emit (events.js:315:20)
    at TLSSocket._finishInit (_tls_wrap.js:921:8)
    at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:695:12) {
  code: 'UNABLE_TO_GET_ISSUER_CERT_LOCALLY'
}
/src/node_modules/solc/soljson.js:32
(Module.asmGlobalArg,Module.asmLibraryArg,buffer);var 
<!--snip (Really long error) -->
abort({"code":"UNABLE_TO_GET_ISSUER_CERT_LOCALLY"}). Build with -s ASSERTIONS=1 for more info.
(Use `node --trace-uncaught ...` to show where the exception was thrown)
command terminated with exit code 1

Building the image with

RUN npm config set strict-ssl false

Does not seem to help either. I will appreciate any guidance on this

Genysys
@Genysys

I think this is what is breaking it on the k8 cluster https://github.com/ethereum/solc-js/blob/40e3844eb04c659db4e94ef600cc180babf306a2/wrapper.js#L331

Is there a way of bypassing this? I want to avoiid the overhead of having to install a root cert on my k8 clustter

Elena Gesheva
@elenadimitrova

In the new inheritance model with 0.6 it appears interfaces are inherited rather than implemented, so this

// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.6.8;

interface Module {
    function init(address _wallet) external;
}

contract BaseModule is Module {
    event ModuleInitialised(address wallet);
    function init(address _wallet) public {
        emit ModuleInitialised(_wallet);
    }
}

errors with TypeError: Overriding function is missing "override" specifier.

I don’t expect to be overriding interface implementations as there is nothing to override (interfaces don’t implement)
Perhaps this calls for abstract to be applied to interface functions instead of virtual?
skyge
@Skyge
Can I use a contract in the version 0.5.x to read data from another contract in the version 0.4.x? Are they compatible with each other?
chriseth
@chriseth
@Genysys loadRemoteVersion should be optional, unless you want to change the compiler version. If you can retrieve the compiler binary from somewhere, you can also use setupMethods manually like loadRemoteVersion does it. Can you debug where loadRemoteVersion is called?
@elenadimitrova there is an issue about that: ethereum/solidity#8281
@Skyge no know compatibility problems between the versions, neither in storage nor in the call ABI
Elena Gesheva
@elenadimitrova
@Skyge Your Data contract does not match the storage layout of the contract you are wrapping. Also the getter function there isn’t implemented
skyge
@Skyge
Yeah, I found that, so I deleted my message. :joy:
matrixbot
@matrixbot
alex_chambet Let's say I have a mapping of users to id (stored on chain) and also a function that returns all the existing users. Obviously due to gas constraints, at some point when there will be too much users stored (I'd guess around a few thousands or dozen of thousands) calling the function will result in an out of gas exception. Is there any way to do this kind of stuff and not be blocked by the gas limit?
skyge
@Skyge
The result of call() is bool, returndata, the first one bool is true or false, but what is the later one, when it true, what is I will get, and how about false. I do not find more details on doc: https://solidity.readthedocs.io/en/develop/types.html#address
Elena Gesheva
@elenadimitrova
@matrixbot Hellow bot :wave: Don't think about the blockchain as a relational database where this kind of queries are a given, think of it as a platform for validating state rather than executing large queries. Most dapps solve this by having a distributed database solution off chain which indexes events to build up a datastore that it queries
@Skyge It’s the return data of the underlysing .call() when you are calling a function that has a return value, otherwise it’s empty bytes
matrixbot
@matrixbot

KaiRo > <@alex_chambet:matrix.org> Let's say I have a mapping of users to id (stored on chain) and also a function that returns all the existing users. Obviously due to gas constraints, at some point when there will be too much users stored (I'd guess around a few thousands or dozen of thousands) calling the function will result in an out of gas exception. Is there any way to do this kind of stuff and not be blocked by the gas limit?

I would do this the way ERC721Enumerable does it: Have the total number of users available to query somewhere and then a getUserByIndex(x) function that gives you the xth user.

Genysys
@Genysys
@chriseth it seems like the setupMethods wrapper in solcjs by default dials a remotes solson file : https://github.com/ethereum/solc-js/blob/master/wrapper.js#L329
skyge
@Skyge
@elenadimitrova eg: my function returns uint256, so call() is true, I can get a uint256, and when call is false, I get empty, right?
chriseth
@chriseth
@Genysys you are citing the loadRemoteVersion function - but is it required to be executed by setupMethods?
Genysys
@Genysys
Apologies my js is weak, but it is returned by the call, https://github.com/ethereum/solc-js/blob/master/wrapper.js#L310-L346
Elena Gesheva
@elenadimitrova
@Skyge correct
chriseth
@chriseth
@Genysys it is not executed, though
Genysys
@Genysys
I find this confusing, if i am running a fresh container, with no version of solc then the only source of it is solcjs. I do not see any other method within the source code that provides a soljson.js file apart from this. My question is : If it isntt executed, then where is soljs which binary does the library use @chriseth ?
Genysys
@Genysys

following what I think is the execution path ;

solcjs

var solc = require(`./index.js`)

index.js

var wrapper = require('./wrapper.js');

module.exports = wrapper(require('./soljson.js'));
@chriseth
chriseth
@chriseth
@Genysys the question is if https.get is executed or not.
are you sure, the network access is not done by another part of your stack?
Genysys
@Genysys

It might be the network, but I do not have much control over that. I am trying to figure out where the code to use call solcjson manually should inserted; From here: https://github.com/ethereum/solc-js/blob/5c1280ca2c73dfba58bad21849b16eb1fa5618e5/README.md#using-a-legacy-version

You can also load the "binary" manually and use setupMethods to create the familiar wrapper functions described above: var solc = solc.setupMethods(require("/my/local/soljson.js")).

where do i add this?

@chriseth
chriseth
@chriseth
var wrapper = require('./wrapper.js'); var solc = wrapper.setupMethods(soljsonModule) - something like that.
coinmaster4you
@coinmaster4you
Is possible to interact with onchain contracts wich is ^0.5.0 with ^0.6.0
?
Elena Gesheva
@elenadimitrova
@coinmaster4you yes. It depends on your level of integration but generally an interface on top of your 0.5 contract that compiles with 0.6 will suffice
Kumar Gaurav
@arkhaminferno
I'm building a DApp in solidity where I want give a bonus to the users that wants promote it. My problem is that, to use my Referral system in solidity. How is it fine in solidity? Whenever someone enters my site with a referral link your backend gives a reward (1% bonus)to the address in the referral link.