Hi, I am facing a problem with a very simple contract. Issue is that the contract is working fine in JVM but failing in testnet.
Sep 30, 2019, 7:27 AM
Hi! Can you share the code and to which network have you deployed it?
Sep 30, 2019, 6:53 PM
Code:
pragma solidity ^0.5.0;
contract carRegister{
struct car{
string liscence;
string color;
string brand;
string model;
uint256 serialNumber;
}
uint256 public totalCars = 0;
mapping(uint256 => car) public carSerialNumber;
function registerCar(string memory _liscence, string memory _color, string memory _brand, string memory _model) public{
totalCars++;
car memory newCar = car({
liscence: _liscence,
serialNumber: totalCars,
color: _color,
brand: _brand,
model: _model
});
carSerialNumber[totalCars] = newCar;
}
}
pragma solidity ^0.5.0;
contract carRegister{
struct car{
string liscence;
string color;
string brand;
string model;
uint256 serialNumber;
}
uint256 public totalCars = 0;
mapping(uint256 => car) public carSerialNumber;
function registerCar(string memory _liscence, string memory _color, string memory _brand, string memory _model) public{
totalCars++;
car memory newCar = car({
liscence: _liscence,
serialNumber: totalCars,
color: _color,
brand: _brand,
model: _model
});
carSerialNumber[totalCars] = newCar;
}
}
It was a private testnet that I deployed this code. Private testnet has same gas limit as that of mainnet. But I believe it will fail on rinkeby too.
Because the transaction was failing due to a revert operation being called when registerCar was invoked.
That piece of code does not have any revertable things. Everything is simple and direct
That piece of code does not have any revertable things. Everything is simple and direct
I haven't yet been able to find the cause of it.
Sep 30, 2019, 7:48 PM
@phantommlancer gonna go to bed now but I just run it here and had no issue
neither to the local JVM netiher to Rinkeby
https://lab.superblocks.com/ipfs/QmNt7YzuNrVkm1KkS7LoPXsGgXqGLwMvtzCfmsXGf5iBzv
Sep 30, 2019, 8:25 PM
Ohhh? Is it? I'll try on Rinkeby network then. I tried on private net. Maybe my private net doesn't have some upgrade.
Sep 30, 2019, 8:25 PM
Yeap it does work both in the local JVM and in Rinkeby Tesnet, so I would presume might be something strange going on in your private network 🙂
now time to sleep! Hope it helped!
Sep 30, 2019, 8:27 PM
I'll hope too it works 😃
Yeah, it works there :) nice
Sep 30, 2019, 8:39 PM
👍
@phantommlancer are you a student?
Sep 30, 2019, 8:46 PM
No, I graduated in 2017
Sep 30, 2019, 8:47 PM
Okay cool. Me 2016
What did you study?
Sep 30, 2019, 8:48 PM
Bachelors in Computer science and technology
and you?
Sep 30, 2019, 8:48 PM
Okay nice. Studied electrical and electronic engineering
Nice to meet you 🤝
Sep 30, 2019, 8:49 PM
Same here
Sep 30, 2019, 8:50 PM
👍
Sep 30, 2019, 8:50 PM
Yeah, exactly
Sep 30, 2019, 8:52 PM