These are chat archives for Nethereum/Nethereum

3rd
Oct 2018
Psilon
@Pzixel
Oct 03 2018 11:32
hey @juanfranblanco
I'd like to ask how do you fix Transaction gas price is too low. There is another transaction with same nonce in the queue. Try increasing the gas price or incrementing the nonce.
I mean it's hard to me to clean tx queue so I'd like to increase gas price, but it doesn't work
Juan Blanco
@juanfranblanco
Oct 03 2018 13:40
@Pzixel you can get the transaction using the transaction hash
and create another transaction input
with that transaction data
but changing the price
other option create another transaction, with all the same data, but input the same nonce and a higher price
Christ0ff
@Christ0ff
Oct 03 2018 14:54
Hello! Is there a possibility to execute a fallback function from contract. Or how should I proceed in nethereum with Proxy contracts - assuming MyContract has function "publish" and MyContractProxy is the proxy of it, how should I execute the "publish" from MyContractProxy
Christ0ff
@Christ0ff
Oct 03 2018 15:02
/**
* @dev Fallback function allowing to perform a delegatecall to the given implementation.
* This function will return whatever the implementation call returns
*/
function () 
payable 
public 
{
    address _impl = _currentImplementation;
    require(_impl != address(0));
    bytes memory data = msg.data;

    assembly {
      let result := delegatecall(gas, _impl, add(data, x20), mload(data), 0, 0)
      let size := returndatasize
      let ptr := mload(x40)
      returndatacopy(ptr, 0, size)
      switch result
      case 0 { revert(ptr, size) }
      default { return(ptr, size) }
    }
}
Just to give some background of the proxy contract
Juan Blanco
@juanfranblanco
Oct 03 2018 15:05
just send the functionmessage to that contract
that should fallback
and delegate as above to your implementation
using the address _currentImplementation
obviously you should not have a function call the same in the contract
so you should not have a function publish
another option will be to:
  • have a publish function which accepts the call data
so if you have your FunctionMessage using the extension GetData()
FunctionMessage for the proxied contract (which you will need anyway to do the fall back)
Juan Blanco
@juanfranblanco
Oct 03 2018 15:10
and then have the PublishFunction which has a byte array as the with the data as the parameter
@Christ0ff
something like above ^^
Michael Ilchuk
@Ilchuk-Mihail
Oct 03 2018 15:20

Hi guys.

Maybe somebody deal with this error in geth -> "Synchronisation failed, dropping peer"
and more and more errors in geth
How to configure this node, it's very not stable

I use windows server
Juan Blanco
@juanfranblanco
Oct 03 2018 15:21
you may want to add more peers
Michael Ilchuk
@Ilchuk-Mihail
Oct 03 2018 15:23
static nodes ?
or how?
sorry that one for mainnet
Psilon
@Pzixel
Oct 03 2018 15:38
@juanfranblanco hello, I'd also like to ask if nethereum works with ABIEncoderV2
Juan Blanco
@juanfranblanco
Oct 03 2018 15:38
yes
it does
but it does not code generate (yet)
check above ^^
Christ0ff
@Christ0ff
Oct 03 2018 15:51
sorry, just a stupid question - is there a way to install Nethereum.Contracts.Extensions via the npm or should I include the code from the master/src
Juan Blanco
@juanfranblanco
Oct 03 2018 15:51
that is in 3.0 rc1
so just get the latest version (remember to tick pre-release if using visual studio)
when getting the nuget
Michael Ilchuk
@Ilchuk-Mihail
Oct 03 2018 15:52
@juanfranblanco So, need find some nodes this https://www.ethernodes.org/network/2/nodes , and add to parameter --bootnodes ?
But, nodes change, it's network. It's is supposed to be like that.
how about mainet, the same issue ?
Juan Blanco
@juanfranblanco
Oct 03 2018 15:52
my idea was just to use AddNode from the console
or configure it
Michael Ilchuk
@Ilchuk-Mihail
Oct 03 2018 15:53
but how do it in production - when it's not stable
?
Juan Blanco
@juanfranblanco
Oct 03 2018 15:53
you open the console
Michael Ilchuk
@Ilchuk-Mihail
Oct 03 2018 15:53
or I missed somenthing
Juan Blanco
@juanfranblanco
Oct 03 2018 15:53
in geth
Christ0ff
@Christ0ff
Oct 03 2018 15:56
@juanfranblanco Thanks!
Juan Blanco
@juanfranblanco
Oct 03 2018 15:57
but you need to start your rpc client with admin enabled
Michael Ilchuk
@Ilchuk-Mihail
Oct 03 2018 16:01

I add peer enode://0f85643adb3b33abb5119bdb8f61e7b87ec33dbc97eab5d4f5e58c1a3ace63de5dd1955eed999eba5dc187fb6c6b7a4582a869e6a80841b171daaf6924c411bc@149.28.130.31:30303

result -> true, but peerCount not changed, and I not see it on admin.peers

Psilon
@Pzixel
Oct 03 2018 17:36
@juanfranblanco wow, so I don't have to use these ugly deconstructor methods?
    function getRequestByIndex(uint64 index) public view returns (bytes30, uint64, Types.DeclarantType, string, uint64, uint8[], uint64, uint64, string, uint64[], bytes16) {
        Request storage request = nodes[index].request;
        return (request.serviceNumber, request.date, request.declarantType, request.declarantName, request.fairId, request.assortment, request.district, request.region, request.details, request.periods, request.userId);
    }
I'd be very happy if it's the case
What codegen do you mention? I don't recall anything similar
Juan Blanco
@juanfranblanco
Oct 03 2018 17:37
oh the .net / javascript one
the one in vscode
everything in the CodeGenerator namespace
but until is properly released I don't want to do anything
I was talking with Christian in Berlin about the possibility of having typedefinitions out of solidity
that way we can reuse the same "struct" in functions and events (as per the sample)
also that way you only need to generate a struct type once :)
Psilon
@Pzixel
Oct 03 2018 17:41
Well, I have my own generator which works flawlessly without external depdendencies (it's pure nuget package being referenced as regular Analyzer)
So I think i'm not affected :)
I linked it above so you can play if you interested in. The only drawback is it currently is not working under Ubuntu (some weird issues with dependency resolution), but it does on windows and mac
Juan Blanco
@juanfranblanco
Oct 03 2018 17:42
sure each on its own
Psilon
@Pzixel
Oct 03 2018 17:43

also that way you only need to generate a struct type once :)

It's an interesting idea

Agente del Caos
@Genzafel_twitter
Oct 03 2018 17:43

I have this doubt, I have this method

function getMedicine(uint256 _id) external returns(uint256, uint256){
require(MedicineList[_id].isActivated != false, "ERR: El ID proporcionado no Existe");
return (MedicineList[_id].price,MedicineList[_id].stock);
}

And in my Nethereum Get method I try to use this to get the return values

var contract = geth.Eth.GetContract(abi, contractAddress);
var getMedicineFunction = contract.GetFunction("getMedicine");
mainNodeAddress = mainNodeAddress.ToLower().RemoveHexPrefix().PadLeft(40,'0').EnsureHexPrefix();
var response = await getMedicineFunction.CallAsync<int>(Convert.ToUInt64(_idMedicina));

But it only bring the first value (price) not the stock one, how can I correct this?

Psilon
@Pzixel
Oct 03 2018 17:43
however, I currently generate one type for each encounter even for derived contracts
Juan Blanco
@juanfranblanco
Oct 03 2018 17:43
that is mainly the stopper to add it to the generator
for the output
input
yeah but that is specific
but if you get structs / types and are reused you can put specific logic into them
Psilon
@Pzixel
Oct 03 2018 17:44
I think we may suspend this conversation until this guy gets its answer :)
Juan Blanco
@juanfranblanco
Oct 03 2018 17:44
might be validation / custom encoding
@Genzafel_twitter sorry
Agente del Caos
@Genzafel_twitter
Oct 03 2018 17:46
@Pzixel Jeje sorry I think I interrupted ^^U
Juan Blanco
@juanfranblanco
Oct 03 2018 17:46
oh you need to create a FunctionOuput
mainly a DTO to Deserialise both values
let me find a sample
Agente del Caos
@Genzafel_twitter
Oct 03 2018 17:47
Thank you
Juan Blanco
@juanfranblanco
Oct 03 2018 17:47
although you can code generate it if you are using vscode
that gives you an overview
Juan Blanco
@juanfranblanco
Oct 03 2018 17:53
if you are using Typed functions / messages this is a sample for ENS link https://github.com/Nethereum/Nethereum/blob/master/src/Nethereum.ENS/RegistrarService.cs#L160-L166
Agente del Caos
@Genzafel_twitter
Oct 03 2018 17:53

I already read that and created this:

public class MedicinaObj
{
[Parameter("int", "price", 1)]
public int Price {get; set;}

        [Parameter("int", "stock", 2)]
        public int Stock {get; set;}
    }

and tried to use it like this

var response = await getMedicineFunction.CallAsync<MedicinaObj>(Convert.ToUInt64(_idMedicina));

But didnt work, as I could undestand in the document you send it is to get values from the mapping documents, not to get the boolean return from the method

Juan Blanco
@juanfranblanco
Oct 03 2018 17:53
need to add one to the docs
you need to use DeserialisingToObject<MedicinaObj>()
Agente del Caos
@Genzafel_twitter
Oct 03 2018 17:54
Oh ok
it worked! thank you so much
Juan Blanco
@juanfranblanco
Oct 03 2018 18:07
cool
@Pzixel are you going to DevCon4?
Psilon
@Pzixel
Oct 03 2018 18:08
Wow
I don't know what it is
Juan Blanco
@juanfranblanco
Oct 03 2018 18:08
ah well there are no tickets now.. as it has been a nightmare
Psilon
@Pzixel
Oct 03 2018 18:08
I'm actually not visiting a lot of conferences: primarly dotnext (biggest russian .net conference) and sometimes highload
Juan Blanco
@juanfranblanco
Oct 03 2018 18:09
this is the Ethereum Dev conference in prague this year
Psilon
@Pzixel
Oct 03 2018 18:09
Well, I'm not sure if Ethereum deserve its own conference
Juan Blanco
@juanfranblanco
Oct 03 2018 18:09
well 3000 people thing so :)
Psilon
@Pzixel
Oct 03 2018 18:09
just to share your hacks with community, probably :)

well 3000 people thing so :)

it's more up to marketing imho

I currently have ~1k lines smart contracts
and it works really sad
so I have to split it in several smaller
Juan Blanco
@juanfranblanco
Oct 03 2018 18:10
oh no, there are so many other stuff, like scaling, plasma, 2.0 etc
Psilon
@Pzixel
Oct 03 2018 18:10
One picture from my private network
image.png
I have just burnt 1B of gas and tx ran out of it
I do a lot of computations in the blockchain but it couldn't handle it
I even can't deploy a contract if it's big enough
Juan Blanco
@juanfranblanco
Oct 03 2018 18:12
lol
Psilon
@Pzixel
Oct 03 2018 18:12
so
it makes me really sad
I spent ~2months just to make code that already works small enough to get work on large amounts of data :)
and it's not here yet
So I invented some workarounds, for example creating a shim that has exactly same signature but empty body, that allows me to call it without getting the entire contract body inlined in the depending contract
Juan Blanco
@juanfranblanco
Oct 03 2018 18:48
ah got you it would have been nice if you could do that with an interface