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

Error migrating from legacy maxCodeSizeConfig to Transitions.contractsizelimit #1622

Open
vdamle opened this issue Mar 10, 2023 · 1 comment · May be fixed by #1623
Open

Error migrating from legacy maxCodeSizeConfig to Transitions.contractsizelimit #1622

vdamle opened this issue Mar 10, 2023 · 1 comment · May be fixed by #1623

Comments

@vdamle
Copy link
Contributor

vdamle commented Mar 10, 2023

System information

Geth version: Geth/v1.10.3-stable-e73afc9b(quorum-v22.7.6)/linux-amd64/go1.19.6
OS & Version: Linux
Commit hash : N/A

Expected behaviour

A migration of genesis config MaxCodeSizeConfig to Transitions.ContractSizeLimit should be allowed via a re-initialization of the genesis config, after an update of the genesis file. There is a log as well which tells users to migrate their genesis config since MaxCodeSizeConfig is deprecated, reference: #1376

WARN [03-09|19:20:03.005] WARNING: The attribute config.maxCodeSizeConfig is deprecated and will be removed in the future, please use config.transitions.contractsizelimit on genesis file

Actual behaviour

During an upgrade from Quorum v22.4.4 to v22.7.6, we applied the below change to the genesis file and executed a geth init, to re-initialize the chain configuration. The command throws the error shows below.

INFO [03-09|21:11:49.374] Running with private transaction manager disabled - quorum private transactions will not be supported
INFO [03-09|21:11:49.376] Maximum peer count                       ETH=50 LES=0 total=50
INFO [03-09|21:11:49.376] Smartcard socket not found, disabling    err="stat /run/pcscd/pcscd.comm: no such file or directory"
INFO [03-09|21:11:49.468] Enabling recording of key preimages since archive mode is used
INFO [03-09|21:11:49.468] Set global gas cap                       cap=25,000,000
INFO [03-09|21:11:49.472] Allocated cache and file handles         database=/qdata/ethereum/chaindata-bk/geth/chaindata cache=16.00MiB handles=16
INFO [03-09|21:11:49.737] Persisted trie from memory database      nodes=1 size=151.00B time="10.4µs" gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00B
Fatal: Failed to write genesis block: mismatching genesis file missing max code size information in database (have 1211, want 1211, rewindto 1210)

Steps to reproduce the behaviour

  • Create a node with maxCodeSizeConfig specified in the genesis config and let the chain run for some time by issuing some transactions.
  • Stop the node, edit the genesis file and remove maxCodeSizeConfig and introduce config.transitions.contractsizelimit.
  • Run geth init with the updated genesis file, the client throws the error: Fatal: Failed to write genesis block: mismatching genesis file missing max code size information in database (have x, want y, rewindto z)

It appears that isMaxCodeSizeConfigCompatible() was not updated in #1376 to handle the case where the old genesis contained maxCodeSizeConfig and the new genesis contains the new style config.transitions.contractsizelimit: https://github.com/ConsenSys/quorum/blob/master/params/config.go#L790-L803

Old Genesis file
{
  "alloc": {
    "c3190225b07f62a25e2919d9099e6c9573ba5354": {
      "balance": "1000000000000000000000000000"
    }
  },
  "coinbase": "0x0000000000000000000000000000000000000000",
  "config": {
    "homesteadBlock": 0,
    "eip150Block": 0,
    "eip155Block": 0,
    "eip158Block": 0,
    "byzantiumBlock": 0,
    "constantinopleBlock": 0,
    "petersburgBlock": 0,
    "istanbulBlock": 0,
    "isQuorum": true,
    "maxCodeSizeConfig": [
      {
        "block": 0,
        "size": 128
      }
    ],
    "istanbul": {
      "epoch": 30000,
      "policy": 0,
      "ceil2Nby3Block": 0
    },
    "chainId": 701348146
  },
  "difficulty": "0x1",
  "extraData": "0x0000000000000000000000000000000000000000000000000000000000000000f85ad5943a053c2a9af1bef5b55e1b4b03d18f9e0069a99ab8410000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0",
  "gasLimit": "0x2FEFD800",
  "mixHash": "0x63746963616c2062797a616e74696e65206661756c7420746f6c6572616e6365",
  "nonce": "0x0",
  "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "timestamp": "0x00"
}
New Genesis file
{
  "alloc": {
    "c3190225b07f62a25e2919d9099e6c9573ba5354": {
      "balance": "1000000000000000000000000000"
    }
  },
  "coinbase": "0x0000000000000000000000000000000000000000",
  "config": {
    "homesteadBlock": 0,
    "eip150Block": 0,
    "eip155Block": 0,
    "eip158Block": 0,
    "byzantiumBlock": 0,
    "constantinopleBlock": 0,
    "petersburgBlock": 0,
    "istanbulBlock": 0,
    "isQuorum": true,
    "chainId": 701348146,
    "transitions": [
      {
        "block": 0,
        "contractSizeLimit": 128
      },
      {
        "block": 0,
        "transactionSizeLimit": 128
      }
    ],
    "ibft": {
      "policy": 0,
      "ceil2Nby3Block": 0,
      "epochlength": 30000,
      "blockperiodseconds": 10,
      "requesttimeoutseconds": 20
    }
  },
  "difficulty": "0x1",
  "extraData": "0x0000000000000000000000000000000000000000000000000000000000000000f85ad5943a053c2a9af1bef5b55e1b4b03d18f9e0069a99ab8410000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0",
  "gasLimit": "0x2FEFD800",
  "mixHash": "0x63746963616c2062797a616e74696e65206661756c7420746f6c6572616e6365",
  "nonce": "0x0",
  "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "timestamp": "0x00"
}

Backtrace

N/A

@antonydenyer
Copy link
Contributor

Good spot! Should probably fix this before deprecating the maxCodeSizeConfig 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants