Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set max gas limit on Mainnet #82

Closed
JakeHartnell opened this issue Nov 9, 2021 · 8 comments
Closed

Set max gas limit on Mainnet #82

JakeHartnell opened this issue Nov 9, 2021 · 8 comments
Assignees
Labels
Priority This needs to be done ASAP

Comments

@JakeHartnell
Copy link
Contributor

We should implement a gas limit like Terra. Kudos to @the-frey for this suggestion.

A gas limit will set an absolute maximum amount of gas a contract can use.

@JakeHartnell JakeHartnell added the Priority This needs to be done ASAP label Nov 9, 2021
@the-frey the-frey self-assigned this Nov 9, 2021
@the-frey
Copy link
Contributor

the-frey commented Nov 9, 2021

I'll pick this up and look into it.

@the-frey
Copy link
Contributor

the-frey commented Nov 9, 2021

Okay, so I don't think we should hard code something programmatically. I think we can use governance and propose a sensible number. .ConsensusParams.Block.MaxGas is the param we're after.

junod query params subspace baseapp BlockParams --chain-id uni

Reveals that it is currently set to:

value: '{"max_bytes":"22020096","max_gas":"-1"}'

@the-frey
Copy link
Contributor

the-frey commented Nov 9, 2021

Going to try this on testnet:

{
  "title": "Governance Proposal to add maximum per block gas",
  "description": "To mitigate potential attacks against the network, we need to set a max per block gas ceiling.",
  "changes": [{
    "subspace": "baseapp",
    "key": "BlockParams",
    "value": {
      "max_bytes": "22020096",
      "max_gas": "40000000"
    }
  }],
  "deposit": "100000000ujunox"
}

@the-frey the-frey added this to the v2.0.0 moneta: juno<->cw milestone Nov 9, 2021
@the-frey
Copy link
Contributor

This worked and mitigated the attack vector on testnet, so we need to implement on mainnet.

@JakeHartnell
Copy link
Contributor Author

This worked and mitigated the attack vector on testnet, so we need to implement on mainnet.

Awesome, will leave this open as a reminder until it passes. We should do some more testing to make sure we set it high enough to run contracts like JunoSwap and DAO DAO.

@giansalex
Copy link
Member

The gas used in attack was 2'163'370'243, I think the max_gas can be increased , to allow more txs

@nullmames
Copy link
Member

nullmames commented Nov 12, 2021

We have maxed out tx on testnet with just a few tx spammers. So we can simulate load on the network during SC testing, going to double max gas per block.

{
  "title": "Governance Proposal to add maximum per block gas to increase tx",
  "description": "To be able to simulate network load in the 300tx range in addition to SC load",
  "changes": [{
    "subspace": "baseapp",
    "key": "BlockParams",
    "value": {
      "max_gas": "80000000"
    }
  }],
  "deposit": "100000000ujunox"
}

@JakeHartnell JakeHartnell changed the title Set max gas limit Set max gas limit on Mainnet Nov 16, 2021
@the-frey
Copy link
Contributor

Note for future: mainnet prop for this was initially 100,000,000

{
  "title": "Governance Proposal to set maximum per block gas",
  "description": "To stop attacks against the network via the use of malicious smart contracts, we need to set a max per block gas limit. From tes
ting on the Uni testnet, the core team feel this value is a good starting point, and it can be increased in future if necessary. This proposal mar
ks the first step required to release Moneta. If you would like to discuss further, please use the governance channel on the Juno Discord.",
  "changes": [{
    "subspace": "baseapp",
    "key": "BlockParams",
    "value": {"max_gas":"100000000"}
  }],
  "deposit": "100000000ujuno"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority This needs to be done ASAP
Projects
None yet
Development

No branches or pull requests

4 participants