I am trying to deploy a simple smart contract for testing. Attached are the output of: 'npm run test' as well as my test.js file and my package.json file
I hope its something obvious sorry if this is a noob question. Thank you for your time.
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.
Sign up to join this communitywell i figured it out. It was an issue with solc version 0.8.21
to fix it, I ran: 'npm uninstall solc'
then: npm install --save [email protected]
then, I of course changed the contract code from "pragma solidity ^0.8.21;" to "pragma solidity ^0.8.17;"
It works now, as to why, I couldnt tell you, but now 'npm run test' executes without throwing any errors.
Here is the reason why it worked with lesser version.
This is because solidity 0.8.20 introduces the PUSH0(0x5f) opcode which is only supported on the ETH mainnet and not on any other chains. That's why other chains can't find the PUSH0(0x5f) opcode and throw this error.
Consider either using a version less than 0.8.20 for other chains or using a different EVM version other than the Shanghai one.
If you want to learn more about PUSH0 opcode you can check this small article which explains it pretty well. https://www.zaryabs.com/push0-opcode/