neonevm / neon-evm

Other
258 stars 58 forks source link

Deployment of contracts spends too much gas and fails #594

Closed mich-master closed 2 years ago

mich-master commented 2 years ago

A member of Solidity Focus Group has faced a problem with contract deployment on Neon EVM. The deployment of his contracts spends too much gas. The guy declares he spent 2.4 Neons for the deployment while he spends 80K of gas on Rinkeby. The Rinkeby case is here: https://rinkeby.etherscan.io/address/0x80E1d0665b1c0DF0B3f88AA25596289f1e5077d8#code

After that, the deployment on Neon EVM failed. It's appear to be a problem and should be investigated in details.

┆Issue is synchronized with this Jira Task by Unito

AHartTN commented 2 years ago

hardhat.config.js: /**

require('dotenv').config(); require('hardhat-deploy'); require("@nomiclabs/hardhat-ethers"); require("@nomiclabs/hardhat-etherscan"); require("@nomiclabs/hardhat-truffle5"); require("@nomiclabs/hardhat-waffle"); require("@nomiclabs/hardhat-web3"); require("@nomiclabs/hardhat-solhint"); require("hardhat-gas-reporter"); require("solidity-coverage");

// This is a sample Hardhat task. To learn how to create your own go to // https://hardhat.org/guides/create-task.html task("accounts", "Prints the list of accounts", async (taskArgs, hre) => { const accounts = await hre.ethers.getSigners();

for (const account of accounts) { console.log(account); } });

// task action function receives the Hardhat Runtime Environment as second argument task( "blockNumber", "Prints the current block number", async (_, { ethers }) => { await ethers.provider.getBlockNumber().then((blockNumber) => { console.log("Current block number: " + blockNumber); }); } );

// task action function receives the Hardhat Runtime Environment as second argument task( "providerInfo", "Prints the current provider", async (taskArgs, hre) => { console.log(hre.SignerWithAddress); } );

// task action function receives the Hardhat Runtime Environment as second argument task( "XXX", "XXX | TESTING", async (taskArgs, { ethers }) => { console.log(hre.NetworkName); } );

// You need to export an object to set up your config // Go to https://hardhat.org/config/ to learn more const { REPORT_GAS, RINKEBY_API_URL, ROPSTEN_API_URL, ALCHEMY_API_KEY, PRIVATE_KEY, PUBLIC_KEY, ETHERSCAN_API_KEY, SOLANA_PRIVATE_KEY, LOCAL_ACCOUNT_0_ADDRESS, LOCAL_ACCOUNT_1_ADDRESS, LOCAL_ACCOUNT_2_ADDRESS, LOCAL_ACCOUNT_3_ADDRESS, LOCAL_ACCOUNT_4_ADDRESS, LOCAL_ACCOUNT_5_ADDRESS, LOCAL_ACCOUNT_6_ADDRESS, LOCAL_ACCOUNT_7_ADDRESS, LOCAL_ACCOUNT_8_ADDRESS, LOCAL_ACCOUNT_9_ADDRESS, LOCAL_ACCOUNT_0_PRIVATE_KEY, LOCAL_ACCOUNT_1_PRIVATE_KEY, LOCAL_ACCOUNT_2_PRIVATE_KEY, LOCAL_ACCOUNT_3_PRIVATE_KEY, LOCAL_ACCOUNT_4_PRIVATE_KEY, LOCAL_ACCOUNT_5_PRIVATE_KEY, LOCAL_ACCOUNT_6_PRIVATE_KEY, LOCAL_ACCOUNT_7_PRIVATE_KEY, LOCAL_ACCOUNT_8_PRIVATE_KEY, LOCAL_ACCOUNT_9_PRIVATE_KEY } = process.env;

const networkTimeout = 120000;

const runCount = 1; const optimizerEnabled = false;

module.exports = { solidity: { compilers: [ { version: "0.8.10", settings: { optimizer: { enabled: optimizerEnabled, runs: runCount, } } }, { version: "0.7.0", settings: { optimizer: { enabled: optimizerEnabled, runs: runCount, } } }, { version: "0.6.6", settings: { optimizer: { enabled: optimizerEnabled, runs: runCount, } } }, { version: "0.6.0", settings: { optimizer: { enabled: optimizerEnabled, runs: runCount, } } }, { version: "0.4.24", settings: { optimizer: { enabled: optimizerEnabled, runs: runCount, } } }, { version: "0.4.11", settings: { optimizer: { enabled: optimizerEnabled, runs: runCount, } } } ] }, paths: { sources: "./contracts", tests: "./test", cache: "./cache", artifacts: "./artifacts" }, namedAccounts: { deployer: 0, payer: 0, qaA: 1, qaB: 2, qaC: 3, qaD: 4, qaE: 5, qaF: 6, qaG: 7, qaH: 8, qaI: 9, qaJ: 10 }, defaultNetwork: "ganache", networks: { hardhat: {}, ropsten: { url: ${ROPSTEN_API_URL}${ALCHEMY_API_KEY}, timeout: networkTimeout, accounts: [ 0x${PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_0_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_1_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_2_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_3_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_4_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_5_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_6_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_7_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_8_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_9_PRIVATE_KEY} ] }, rinkeby: { url: ${RINKEBY_API_URL}${ALCHEMY_API_KEY}, timeout: networkTimeout, accounts: [ 0x${PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_0_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_1_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_2_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_3_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_4_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_5_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_6_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_7_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_8_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_9_PRIVATE_KEY} ] }, ganache: { url: "http://10.0.0.237:7545", timeout: networkTimeout, accounts: [ 0x${LOCAL_ACCOUNT_0_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_1_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_2_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_3_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_4_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_5_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_6_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_7_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_8_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_9_PRIVATE_KEY}, 0x${PRIVATE_KEY}, ] }, localneon: {
url: "http://localhost:9090/solana", timeout: networkTimeout, accounts: [ 0x${LOCAL_ACCOUNT_0_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_1_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_2_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_3_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_4_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_5_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_6_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_7_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_8_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_9_PRIVATE_KEY}, 0x${PRIVATE_KEY}, ] }, devneon: { url: "https://proxy.devnet.neonlabs.org/solana", timeout: networkTimeout, accounts: [ 0x${LOCAL_ACCOUNT_0_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_1_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_2_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_3_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_4_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_5_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_6_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_7_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_8_PRIVATE_KEY}, 0x${LOCAL_ACCOUNT_9_PRIVATE_KEY}, 0x${PRIVATE_KEY}, ] } }, etherscan: { apiKey: ETHERSCAN_API_KEY },

// Set default mocha options here, use special reporters etc. mocha: { timeout: 360000 }, gasReporter: { enabled: REPORT_GAS !== undefined && REPORT_GAS === "true", currency: "USD", }, };

extendEnvironment(async (hre) => { const Web3 = require("web3"); const { networkConfig, developmentChains } = require('./helper-hardhat-config'); const chainId = await hre.getChainId(); const { deployer, payer, qaA, qaB, qaC, qaD, qaE, qaF, qaG, qaH, qaI, qaJ } = await getNamedAccounts(); const chainConfig = networkConfig[chainId]; const networkName = chainConfig['name'];

console.log(${networkName} | Extending Environment);

hre.Web3 = Web3; hre.web3 = new Web3(hre.network.provider);

hre.ChainId = chainId; hre.ChainConfig = chainConfig; hre.NetworkName = networkName;

// The account deploying the contract(s) hre.Deployer = deployer;

// The account paying for the transaction (hopefully) hre.Payer = payer;

// QA Accounts hre.QAA = qaA; hre.QAB = qaB; hre.QAC = qaC; hre.QAD = qaD; hre.QAE = qaE; hre.QAF = qaF; hre.QAG = qaG; hre.QAH = qaH; hre.QAI = qaI; hre.QAJ = qaJ;

// A list of environments which are for development hre.DevelopmentChains = developmentChains;

// Whether or not the current chain is a development chain hre.IsDevelopmentChain = developmentChains.includes(hre.NetworkName);

// console.log(Chain ID: ${chainId}); // console.log(Deployer: ${deployer}); // console.log(Payer: ${payer}); // console.log(QA A: ${qaA}); // console.log(QA B: ${qaB}); // console.log(QA C: ${qaC}); // console.log(QA D: ${qaD}); // console.log(QA E: ${qaE}); // console.log(QA F: ${qaF}); // console.log(QA G: ${qaG}); // console.log(QA H: ${qaH}); // console.log(QA I: ${qaI}); // console.log(QA J: ${qaJ});

console.log(${hre.NetworkName} | Environment Extended); });

AHartTN commented 2 years ago

helper-hardhat-config.js: const networkConfig = { default: { fee: '100000000000000000', keyHash: '0x6c3699283bda56ad74f6b855546325b68d482e983852a7a82979cc4807b641f4', jobId: '29fa9aa13bf1468788b7cc4a500a45b8', fundAmount: "1000000000000000000" }, 1: { name: 'mainnet', linkToken: '0x514910771af9ca656af840dff83e8264ecf986ca', fundAmount: "0" }, 2: { name: 'expanse' }, 3: { name: 'ropsten' }, 4: { name: 'rinkeby', linkToken: '0x01be23585060835e02b77ef475b0cc51aa1e0709', ethUsdPriceFeed: '0x8A753747A1Fa494EC906cE90E9f37563A8AF630e', keyHash: '0x2ed0feb3e7fd2022120aa84fab1945545a9f2ffc9076fd6156fa96eaff4c1311', vrfCoordinator: '0xb3dCcb4Cf7a26f6cf6B120Cf5A73875B7BBc655B', oracle: '0x7AFe1118Ea78C1eae84ca8feE5C65Bc76CcF879e', jobId: '6d1bfe27e7034b1d87b5270556b17277', fee: '100000000000000000', fundAmount: "1000000000000000000" }, 5: { name: 'goerli', linkToken: '0x326c977e6efc84e512bb9c30f76e30c160ed06fb', fundAmount: "0" }, 6: { name: 'kotti' }, 42: { name: 'kovan', linkToken: '0xa36085F69e2889c224210F603D836748e7dC0088', ethUsdPriceFeed: '0x9326BFA02ADD2366b30bacB125260Af641031331', keyHash: '0x6c3699283bda56ad74f6b855546325b68d482e983852a7a82979cc4807b641f4', vrfCoordinator: '0xdD3782915140c8f3b190B5D67eAc6dc5760C46E9', oracle: '0x2f90A6D021db21e1B2A077c5a37B3C7E75D15b7e', jobId: '29fa9aa13bf1468788b7cc4a500a45b8', fee: '100000000000000000', fundAmount: "1000000000000000000" }, 111: { name: 'localneon' }, 137: { name: 'polygon', linkToken: '0xb0897686c545045aFc77CF20eC7A532E3120E0F1', keyHash: '0xf86195cf7690c55907b2b611ebb7343a6f649bff128701cc542f0569e2c549da', vrfCoordinator: '0x3d2341ADb2D31f1c5530cDC622016af293177AE0', fee: '100000000000000', fundAmount: '200000000000000' }, 2018: { name: 'dev' }, 61: { name: 'classic' }, 63: { name: 'mordor' }, 212: { name: 'astor' }, 1337: { name: 'ganache', fee: '100000000000000000', keyHash: '0x6c3699283bda56ad74f6b855546325b68d482e983852a7a82979cc4807b641f4', jobId: '29fa9aa13bf1468788b7cc4a500a45b8', fundAmount: "1000000000000000000" }, 5777: { name: 'ganache', fee: '100000000000000000', keyHash: '0x6c3699283bda56ad74f6b855546325b68d482e983852a7a82979cc4807b641f4', jobId: '29fa9aa13bf1468788b7cc4a500a45b8', fundAmount: "1000000000000000000" }, 31337: { name: 'hardhat', fee: '100000000000000000', keyHash: '0x6c3699283bda56ad74f6b855546325b68d482e983852a7a82979cc4807b641f4', jobId: '29fa9aa13bf1468788b7cc4a500a45b8', fundAmount: "1000000000000000000" }, 245022926: { name: 'devneon' },
};

const developmentChains = ["ganache", "dev", "hardhat", "localhost", "localneon"];

const getNetworkIdFromName = async (networkIdName) => { for (const id in networkConfig) { if (networkConfig[id]['name'] == networkIdName) { return id; } } return null; };

const autoFundCheck = async (contractAddr, networkName, linkTokenAddress, additionalMessage) => { const chainId = await getChainId(); console.log("Checking to see if contract can be auto-funded with LINK:"); const amount = networkConfig[chainId]['fundAmount']; //check to see if user has enough LINK const accounts = await ethers.getSigners(); const signer = accounts[0]; const LinkToken = await ethers.getContractFactory("LinkToken"); const linkTokenContract = new ethers.Contract(linkTokenAddress, LinkToken.interface, signer); const balanceHex = await linkTokenContract.balanceOf(signer.address); const balance = await web3.utils.toBN(balanceHex._hex).toString(); const contractBalanceHex = await linkTokenContract.balanceOf(contractAddr); const contractBalance = await web3.utils.toBN(contractBalanceHex._hex).toString(); if (balance > amount && amount > 0 && contractBalance < amount) { //user has enough LINK to auto-fund //and the contract isn't already funded return true; } else { //user doesn't have enough LINK, print a warning console.log("Account doesn't have enough LINK to fund contracts, or you're deploying to a network where auto funding isnt' done by default"); console.log("Please obtain LINK via the faucet at https://" + networkName + ".chain.link/, then run the following command to fund contract with LINK:"); console.log("npx hardhat fund-link --contract " + contractAddr + " --network " + networkName + additionalMessage); return false; } }

module.exports = { networkConfig, getNetworkIdFromName, autoFundCheck, developmentChains };

AHartTN commented 2 years ago

My primary contract deployment script: const logDiamondDeployment = async (source) => { console.log("Logging Deployment"); const { newlyDeployed, address, transactionHash, receipt, facets } = source; const { gasUsed, cumulativeGasUsed } = receipt;

const deployString = newlyDeployed ? "Diamond Deployed" : "Reusing Diamond";
const facetCount = facets.length;

console.log(`${deployString} with ${facetCount} facets`);
console.log(`Address: ${address}`);
console.log(`Transaction Hash: ${transactionHash}`);
console.log(`${gasUsed} (${cumulativeGasUsed} Cumulative) Gas Used`);
console.log("Deployment Logging Complete");

};

const deployContracts = async () => { console.log('\n================================================================================================================'); console.log(${hre.ChainId} - ${hre.NetworkName} | DEPLOYING CONTRACTS); console.log('================================================================================================================');

const { deploy, log, diamond } = deployments;

const facets = ['DiamondInit'];
const testFacetsA = ['Test1Facet'];
const testFacetCutsA = ['Test2Facet'];
const testFacetsB = ['DiamondInit','Test1Facet'];
const testFacetCutsB = ['Test1Facet','Test2Facet'];
const testFacetsC = ['DiamondInit','Test1Facet'];
const testFacetCutsC = ['Test2Facet'];

log(`${hre.NetworkName} | Deploying GachaLibrary`);
const GachaLibrary = await deploy("GachaLibrary", {
    from: hre.Deployer,
    log: true,
    gasLimit: 5000000,
    skipIfAlreadyDeployed: false,
    //libraries: {GachaLibrary: GachaLibrary.address},
    //args: [GachaPlayer.address, GachaCharacter.address, GachaInventory.address, GachaItem.address, GachaCreature.address]
});
log(`${hre.NetworkName} | GachaLibrary Contract Deployed to ${GachaLibrary.address}`);

log(`${hre.NetworkName} | Experience ERC-20 Contract deploying`);
const experienceDeployment = await deploy('Experience', {
    from: hre.Deployer,
    log: true,
    gasLimit: 5000000,
    skipIfAlreadyDeployed: false,
    libraries: {GachaLibrary: GachaLibrary.address}
});
log(`${hre.NetworkName} | Experience ERC-20 Contract deployed to ${experienceDeployment.address}`);

log(`${hre.NetworkName} | GachaTest ERC-20 Contract deploying`);
const gachaTestDeployment = await deploy('GachaTest', {
    from: hre.Deployer,
    log: true,
    gasLimit: 5000000,
    skipIfAlreadyDeployed: false,
    libraries: {GachaLibrary: GachaLibrary.address}
});
log(`${hre.NetworkName} | GachaTest ERC-20 Contract deployed to ${gachaTestDeployment.address}`);

log(`${hre.NetworkName} | HART ERC-20 Contract deploying`);
const hartDeployment = await deploy('HART', {
    from: hre.Deployer,
    log: true,
    gasLimit: 5000000,
    skipIfAlreadyDeployed: false,
    libraries: {GachaLibrary: GachaLibrary.address}
});
log(`${hre.NetworkName} | HART ERC-20 Contract deployed to ${hartDeployment.address}`);

log(`${hre.NetworkName} | Population ERC-20 Contract deploying`);

const populationDeployment = await deploy('Population', {
    from: hre.Deployer,
    log: true,
    gasLimit: 5000000,
    skipIfAlreadyDeployed: false,
    libraries: {GachaLibrary: GachaLibrary.address}
});
log(`${hre.NetworkName} | Population ERC-20 Contract deployed to ${populationDeployment.address}`);

console.log(`${hre.NetworkName} | Deploying Diamond!`);

const diamondDeployment = await diamond.deploy('Diamond', {
    from: hre.Deployer,
    owner: hre.Payer,
    log: true,
    gasLimit: 5000000,
    skipIfAlreadyDeployed: false,
    facets: facets,
    libraries: {GachaLibrary: GachaLibrary.address},
});

logDiamondDeployment(diamondDeployment);
console.log(`${hre.NetworkName} | Diamond Deployment Complete!`);

// console.log('Conducting Diamond Deployment Tests!');

// const diamondDeploymentTestA = await diamond.deploy('Diamond', {
//     from: hre.Deployer,
//     owner: hre.Payer,  
//     facets: testFacetsA,
//     libraries: {GachaLibrary: GachaLibrary.address},
// });

// //logDiamondDeployment(diamondDeploymentTestA);
// console.log('Test A Diamond Deployment Complete!');

// const diamondDeploymentTestCutA = await diamond.deploy('Diamond', {
//     from: hre.Deployer,
//     owner: hre.Payer,
//     facets: testFacetCutsA,
//     libraries: {GachaLibrary: GachaLibrary.address},
// });

// //logDiamondDeployment(diamondDeploymentTestCutA);
// console.log('Test Cut ADiamond Deployment Complete!');

// const diamondDeploymentTestB = await diamond.deploy('Diamond', {
//     from: hre.Deployer,
//     owner: hre.Payer,
//     facets: testFacetsB,
//     libraries: {GachaLibrary: GachaLibrary.address},
// });

// //logDiamondDeployment(diamondDeploymentTestB);
// console.log('Test BDiamond Deployment Complete!');

// const diamondDeploymentTestCutB = await diamond.deploy('Diamond', {
//     from: hre.Deployer,
//     owner: hre.Payer,
//     facets: testFacetCutsB,
//     libraries: {GachaLibrary: GachaLibrary.address},
// });

// //logDiamondDeployment(diamondDeploymentTestCutB);
// console.log('Test Cut B Diamond Deployment Complete!');

// const diamondDeploymentTestC = await diamond.deploy('Diamond', {
//     from: hre.Deployer,
//     owner: hre.Payer,
//     facets: testFacetsC,
//     libraries: {GachaLibrary: GachaLibrary.address},
// });

// //logDiamondDeployment(diamondDeploymentTestC);
// console.log('Test C Diamond Deployment Complete!');

// const diamondDeploymentTestCutC = await diamond.deploy('Diamond', {
//     from: hre.Deployer,
//     owner: hre.Payer,
//     facets: testFacetCutsC,
//     libraries: {GachaLibrary: GachaLibrary.address},
// });

// //logDiamondDeployment(diamondDeploymentTestCutC);
// console.log('Test C Diamond Deployment Complete!');

console.log(`\n${hre.ChainId} - ${hre.NetworkName} | CONTRACTS DEPLOYMENT COMPLETE`);
console.log('****************************************************************************************************************\n');

};

module.exports = deployContracts;

AHartTN commented 2 years ago

package.json { "name": "gachanft", "version": "1.0.0", "description": "Anthony Hart's Solidity Project", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "Anthony Hart", "license": "ISC", "devDependencies": { "@chainlink/contracts": "^0.2.2", "@chainlink/token": "^1.1.0", "@nomiclabs/hardhat-ethers": "^2.0.2", "@nomiclabs/hardhat-etherscan": "^2.1.7", "@nomiclabs/hardhat-solhint": "^2.0.0", "@nomiclabs/hardhat-truffle5": "^2.0.2", "@nomiclabs/hardhat-waffle": "^2.0.1", "@nomiclabs/hardhat-web3": "^2.0.0", "@openzeppelin/contracts": "^4.3.3", "base64-sol": "^1.1.0", "chai": "^4.3.4", "dotenv": "^10.0.0", "ethereum-waffle": "^3.4.0", "ethers": "^5.4.1", "hardhat": "^2.6.8", "hardhat-deploy": "^0.9.8", "hardhat-gas-reporter": "^1.0.4", "prettier": "^2.3.2", "prettier-plugin-solidity": "^1.0.0-beta.13", "solc": "^0.8.9", "solidity-coverage": "^0.7.17", "standard": "^16.0.3" } }

AHartTN commented 2 years ago

Failed TX that was 425 billion gas: 0x9522be54f27fba3551887527bb13fefd22565b9f05ab418f78c7b19fbc5ffebb

AHartTN commented 2 years ago

Deployed and verified contract on Rinkeby: https://rinkeby.etherscan.io/address/0x80E1d0665b1c0DF0B3f88AA25596289f1e5077d8#code

afalaleev commented 2 years ago

I'm sorry, but you misunderstood.

Gas used = 5,000,000 gas units. Gas price = 429'585'600'000 Alan = 429,585'600 GAlan = 0,000'000'429'585'600 NEON 1 NEON = 10^9 GAlan = 10^18 GAlan 1 NEON ~ $0.25 Total tx cost = 0,000'000'429'585'600 * 5'000'000 = 2,147'928 NEON ~ $0,54

Neon EVM doesn't use Ethereum rules for Gas Calculation, because:

This is mean that 1 Gas unit on Neon is aligned on calculations. But if you create new storage for data in the Solana storage, Neon will calculate more Gas units than on Ethereum.

If Neon uses Ethereum gas rules, the transaction cost will be high, because the Gas unit will be aligned on Storage, and the cost of simple calculations will became expensive.

I want to say that we have more differences with Ethereum. For example, if NEON price will grow, the Gas price will go down, when on Ethereum Gas price doesn't depend on market price of ETH.

afalaleev commented 2 years ago

We tried to deploy your contract and it requires more than 20'000'000 Gas units. https://neonscan.org/tx/0x21193000e309bf4391a8f5268d42c5ea038105dfc3d6afdb691eb0f28a3350f5

The total cost of tx is 10 NEONs ~ $2.5

afalaleev commented 2 years ago

The main issue in your case, that the tx was failed with error and spent your NEONs.

We've already fixed your case on the Solana devnet. Please check, that when you set only 5'000'000 Gas tx fails with error, and doesn't spend your NEONs.

AHartTN commented 2 years ago

After you all let me know that things got resolved, I was able to deploy successfully. Curious what caused this to be reopened?