Contracts do not compile with zksync-solc. Their ABI and bytecode seem to be printed as an error - compilation

I am pretty new to development and asking questions on stackoverflow, so if there is something else I could provide, please tell me in comments!
I have installed docker, #matterlabs/hardhat-zksync-solc, #matterlabs/hardhat-zksync-deploy, zksync-web3, hardhat, #openzeppelin/contracts-upgradeable, #openzeppelin/contracts and everything else.
A simple contract that stores uint and deploys ERC20 contract compiles fine, but the project I am working on does not compile and instead prints a very long error that seem to be ABIs and bytecodes of every contract that is used in the project.
Here is the beginning of the error:
Error in plugin #matterlabs/hardhat-zksync-solc: {"contracts":{"#openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol":{"ERC1967Proxy":{"abi":[{"inputs":[{"internalType":"address","name":"_logic","type":"address"},{"internalType":"bytes","name":"_data","type":"bytes"}],"stateMutability":"payable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"stateMutability":"payable","type":"fallback"},{"stateMutability":"payable","type":"receive"}],"evm":{"legacyAssembly":null,"bytecode":{"object":"0c0000040004000000010000000000000000ffffffffffffffff0000000000000c000004000400000000ffffffffffffffffffffffffffffffff0000000000000e000000000200000001000000000000000000000000000000000000000000001a020004000800000002000000000000000000000000000000000000000000000c000010001000000001000000000000000001000000000000000000000000000c00001000100

Do you know at what point the code stops, like the specific line/method/function that is causing the contract to fail at compile?
Another option would be to join their discord and drop in on the dev chat here. They've been incredibly helpful and are patient with new devs.

Related

How to develop for PIC32MM without either MPLABX or XC32

While working for just one month with the MPLABX5.5 + XC32 3.01 I've already had 3 separate instances where code compiled incorrectly, causing my program to fail after either the stack or frame pointer began using an incorrect address. I would like to dump these tools and try something else as tracking down compiler errors is sucking up too much of my time. Is there anything else available that I can use to work with a PIC32MM? Even access to a different compiler than XC32 might help.
I would like to do the same thing. Maybe we can collect the best options for how to get there, as after many many tries, I haven't yet been successful. As one starting point, I'd also like to be able to recompile xc32-gcc from source to understand exactly what it's doing, and to be able to compile xc32 binaries for other architectures (like, as insane as it may sound, I'd like to compile some code for the pic32mm platform with clang or gcc running on a raspberry pi.)
I would love to be able to even just compile xc32-gcc from source. I know this is possible, but I've not been successful. Some links and starts:
https://github.com/zeha/xc32
This seems to be the most recent grouping of source I've found, but I haven't yet figured out how to compile it.
ChipKit is cited a lot, but, I haven't gotten to the bottom of getting that to build for me either. There are numerous projects here, and I'm not sure how they all fit together yet:
https://github.com/chipKIT32
I suspect somebody (maybe someone who will see this post) knows the formula or script or docker file, or whatever to make this simple.
https://gitlab.com/spicastack/pic32-parts-free
This project seems close to what we're talking about, but, the
recommended way to install is with podman and gentoo. I'm not a
gentoo person (yet?), and the docker version failed for me. It's
probably a simple fix to the dockerfile for a gentoo person, but.. I
didn't get there yet. (I did try installing gentoo and started down
the path but holy cow, talk about being down a rabbit hole when what
I'm trying to do is get a pic cross-compiler working.. when emerge on my new gentoo install failed with a python error, I gave up.)
https://github.com/andeha/Twinbeam
This project also says some of the "right things" about building pic32 code using llvm, and has references to llvm2pic32 in this project: https://github.com/andeha/Sprinkle
I've also not yet managed to get this to make viable intel hex files that I can use on a pic just yet, but there's promise.
Use clang/llvm to generate code. I think it will compile C and generate mips out of the box and I've gotten that far, but I can't get it to link and produce a valid hex file yet. The linker scripts from microchip seem sort of ok, but the hex files end up putting the code in the wrong place, I think. I should probably put together a blinky-light example and try to push it farther, and share it with others to figure out what the deal is, but even stepping one step further back and just trying to get a super simple mips assembly program to get linked and be uploadable to a PIC32MM part would be a great success to me.
Maybe others have better references and links?

TFS/C#: Logging a custom warning during the build process

I am hacking around a problem we've created for ourselves. What I would like to do is log a warning in our TFS builds for any code that is instantiating a specific class. I don't want a run time warning (I've got one in place already), I want a build time warning that ProjectX is using BadClass.cs. The idea being it will give us an additional place to see things that need to be fixed once our hack is no longer needed.
So something like this:
public class BadClass
{}
public class OkClass
{}
public class MyBadService
{
var a = new BadClass(); <-- Logs a warning to the build output
}
public class MyOkService
{
var a = new OkClass(); <-- Does not log a warning
}
Edit:
I do not like the idea of using Obsolete; its a misnomer. We've already got code with Obsolete attributes and this would get lost in the noise. I don't want a generic warning that I can't control the message for. I want bright neon signs with klaxons firing and a thousand exclamation points in the message. Basically everything I can do short of failing the build. I'm using the #warning precompiler directive right now and its mostly doing what I want but it requires a human to remember to add the warning. I'm looking for something more automagic. I've seen third party libraries do stuff like this so I know its possible.
Why not just use the Obsolete attribute? It can generate a build warning for you:
https://learn.microsoft.com/en-us/dotnet/api/system.obsoleteattribute?view=netframework-4.8
You can even make it emit an error too if you want.
The answer could be negative I think.
It seems that you use or call msbuild.exe to build your C# projects. But as far as I know, MSBuild in fact calls csc.exe to build C# projects in build time.
So actually what you want is logging a warning when the compiler compile the C# code if it recognize somewhere in your code uses the BadClass in build time.
If you have the source code of BadClass in the same solution, add a project reference format to the xx.csproj which contains BadClass, and set a #warning in the BadClass it may generate the warning in build time.
But I think the scenario you're in is something like: You developed one Assembly and distribute it to your user, so you want it generates a warning when the user calls one BadClass in your assembly and builds his own project to remind him of taking care when using this bad class. If so, this is impossible for msbuild AFAIK. If I misunderstand anything, feel free to know me know :)
Update:
As Daniel and Johnson said, ObsoleteAttribute is enough to do this. Though no valid way to generate warnings from msbuild aspect directly, but msbuild will call C# compiler during build process, so generates a compiler warning can output to build output window.

How in Object Pascal find whether a character is alphanumeric or underscore working in both Delphi compiler and FPC?

There are similar or same questions all over the internet, but the answers don't work for me. We develop multiplatform product, which is compiled both under Delphi's compiler and under FPC.
First, I used:
Uses:
System.Character;
and
Character.TCharacter.IsLetterOrDigit(..)
, but it couldn't be compiled under FPC, so according to some other source, I used:
Uses:
Character;
and
TCharacter.IsLetterOrDigit(..)
instead, but still can't be compiled under FPC.
Can someone find a way that the code will work on both Delphi compiler and FPC? I don't have FPC set up to work with my project, so I can't figure out on my own, how to fix the code to work in FPC (I can test it only in complicated way via build server) and can't find a way, how to do it.
I also wanted to write it using regex, but colleagues say, that it would be too complicated for them.
Both Delphi and FPC include a class named TCharacter which exposes a method named IsLetterOrDigit. In other words, the premise of your question is wrong. It is perfectly reasonable to use TCharacter.IsLetterOrDigit.
Documentation links:
Delphi: http://docwiki.embarcadero.com/Libraries/en/System.Character.TCharacter
FPC: https://www.freepascal.org/docs-html/3.0.0/rtl/character/tcharacter.html
It's entirely possible that you are using an out of date version of FPC, which would explain why your code fails. Although that is guesswork since you did not include any details of the error message.

Trying to compile win32 app with winelib; type errors from winelib's header files?

I would consider myself a beginner programmer, so please bear with me if am I leaving out helpful information as I might not realize it.
I am trying to port a Win32 application to Ubuntu 10.04 LTS (Lucid Lynx).
All of the source files are written in visual C++, and everything was built with the Windows API. I have been trying to use winelib to compile the program from source, however I have been getting error messages such as these:
shobjidl.h:13: error: 'interface' does not name a type
The errors are coming from winelib's header files mostly I believe. I think that these errors are furthermore responsible for some of the scope errors generated with other winelib headers, but I would like to just try to attack this one error at a time for now.
Going into this project I felt that winelib was a good solution since the application of interest was built with the windows API, but I am confused as to why I am getting type errors with the winelib's headers...
Could it be I am missing important paths in the generated Makefile (from winemaker), or that Wine was not installed correctly on my machine?
Any help would be greatly appreciated.

Lots of type errors in Visual Studio Error List -- until I build and then they are gone

I recently added a new project to my Visual Studio 2008 solution. Now, as I make edits in the new project, I receive a ton (~50) of type checking errors - indicating that an assembly reference may be missing. However, when I actually build the solution, the errors go away. As best I can tell, my dependencies are set and the build order is correct. What could be wrong?
It doesn't prevent me from building and deploying, but it's a major nuisance. It makes it hard to tell when I actually have introduced new errors (until I do compile). Thus, it erodes the usefulness of having the error window do static analysis.
Example, one of the 50 errors is this:
"The type of namespace name 'PersonManager' does not exist in the namespace 'Gideon' (are you missing an assembly reference?"
In reference to this line of code:
Gideon.PersonManager pm = new Gideon.PersonManager()
PersonManager is underlined in both places, and when I right click the type and selected 'find all references' I get an alert box that says "Cannot navigate to PersonManager"
However, the references are definitely there, because when I build, it works.
One other detail is that there is a mixture of C# and VB.net code, though I don't think that should make a difference.
Well, yes, the IntelliSense parser is not an exact replica of the C# compiler. It has a very different job to do, it needs to do something meaningful while the code is utterly broken since you are editing it. Tough assignment, they did a tremendous job with it. But as a side-effect, it can fail to parse things that are actually legal. It's quite rare but not unheard of, seen it myself a few times.
This won't go anywhere concrete until you at least give us some idea of what kind of errors you are seeing, along with a snippet of the code that generates them. You didn't do so, I can only recommend that you select another window so you don't have to look at them.
I had the same problem. I had a project in my solution that was causing the problem - I removed the project from the solution, then added a reference to that project in the main solution and the errors went away. Strange that it only happened on 1 machine. Opening the solution on another machine was fine...

Resources