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

Redundant adding accounts with their balance when creating the Genesis Block #35

Open
hsyodyssey opened this issue Mar 5, 2022 · 3 comments
Labels
invalid This doesn't seem right

Comments

@hsyodyssey
Copy link

hsyodyssey commented Mar 5, 2022

System information

Geth version: geth version
OS & Version: OSX
Commit hash : zkrollup-smt

Expected behaviour

The geth adds two predefiend accounts and their balance from in the genesis.json.

Actual behaviour

After call adding two predefiend accounts and their balance from in the genesis.json, geth also calls "Writing default main-net genesis block" and creates extra 8893 accounts.

!!! These accounts can get additional Tokens on our layer.

Steps to reproduce the behaviour

  • Here is the genesis.json I used for testing (from new_trie:debug/huai).
{
    "config": {
      "chainId": 53077,
      "homesteadBlock": 0,
      "eip150Block": 0,
      "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
      "eip155Block": 0,
      "eip158Block": 0,
      "byzantiumBlock": 0,
      "constantinopleBlock": 0,
      "petersburgBlock": 0,
      "istanbulBlock": 0
    },
    "nonce": "0x0",
    "timestamp": "0x61bc34a0",
    "extraData": "0x0000000000000000000000000000000000000000000000000000000000000000221cb8Cd97223442754493A31184CF81F418E7280000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "gasLimit": "0x47b760",
    "difficulty": "0x1",
    "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "coinbase": "0x0000000000000000000000000000000000000000",
    "alloc": {
      "221cb8Cd97223442754493A31184CF81F418E728": {
        "balance": "0x56BC75E2D63100000"
      },
      "6CCf3e5FEbdEe9a3B263Eb3eAd5A19fa95Dc8ADf": {
        "balance": "0x0"
      }
    },
    "number": "0x0",
    "gasUsed": "0x0",
    "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "baseFeePerGas": null
  }
  • Here are some logs I print for debug.
INFO [03-05|15:53:18.464] Maximum peer count                       ETH=50 LES=0 total=50
INFO [03-05|15:53:18.465] Set global gas cap                       cap=50,000,000
INFO [03-05|15:53:18.465] Allocated cache and file handles         database=/Users/siyuan/workspace/go/src/github.com/scroll-tech/go-ethereum/testchain/geth/chaindata cache=16.00MiB handles=16
INFO [03-05|15:53:18.509] Writing custom genesis block
INFO [03-05|15:53:18.566] Genesis Block Alloc Account number:      LOG15_ERROR= LOG15_ERROR="Normalized odd number of arguments by adding nil"
Genesis Block Alloc Account number 2
INFO [03-05|15:53:18.566] Genesis Block ToBlock function Call AddBalance for Address/Balance (in Alloc): 0x6CCf3e5FEbdEe9a3B263Eb3eAd5A19fa95Dc8ADf=0
INFO [03-05|15:53:18.566] Call AddBalance # Target Address:        0x6CCf3e5FEbdEe9a3B263Eb3eAd5A19fa95Dc8ADf=nil LOG15_ERROR="Normalized odd number of arguments by adding nil"
ERROR[03-05|15:53:18.566] [Error-Log] getDeletedStateObject function: <nil>
ERROR[03-05|15:53:18.566] [Error-Log] TryGet function: Key not found in the MerkleTree
INFO [03-05|15:53:18.566] GetOrNewStateObject function call createObject because of stateObject == nil
INFO [03-05|15:53:18.566] Call createObject
ERROR[03-05|15:53:18.566] [Error-Log] getDeletedStateObject function: <nil>
ERROR[03-05|15:53:18.566] [Error-Log] TryGet function: Key not found in the MerkleTree
INFO [03-05|15:53:18.566] The new Object Address/Balance           0x6CCf3e5FEbdEe9a3B263Eb3eAd5A19fa95Dc8ADf=0
INFO [03-05|15:53:18.566] Genesis Block ToBlock function Call AddBalance for Address/Balance (in Alloc): 0x221cb8Cd97223442754493A31184CF81F418E728=100,000,000,000,000,000,000
INFO [03-05|15:53:18.566] Call AddBalance # Target Address:        0x221cb8Cd97223442754493A31184CF81F418E728=nil                         LOG15_ERROR="Normalized odd number of arguments by adding nil"
ERROR[03-05|15:53:18.566] [Error-Log] getDeletedStateObject function: <nil>
ERROR[03-05|15:53:18.566] [Error-Log] TryGet function: Key not found in the MerkleTree
INFO [03-05|15:53:18.566] GetOrNewStateObject function call createObject because of stateObject == nil
INFO [03-05|15:53:18.566] Call createObject
ERROR[03-05|15:53:18.566] [Error-Log] getDeletedStateObject function: <nil>
ERROR[03-05|15:53:18.566] [Error-Log] TryGet function: Key not found in the MerkleTree
INFO [03-05|15:53:18.566] The new Object Address/Balance           0x221cb8Cd97223442754493A31184CF81F418E728=0
INFO [03-05|15:53:18.568] Successfully wrote genesis state         database=chaindata hash=be088c..4ae275
INFO [03-05|15:53:18.568] Allocated cache and file handles         database=/Users/siyuan/workspace/go/src/github.com/scroll-tech/go-ethereum/testchain/geth/lightchaindata cache=16.00MiB handles=16
INFO [03-05|15:53:18.597] Writing custom genesis block
INFO [03-05|15:53:18.597] Genesis Block Alloc Account number:      LOG15_ERROR= LOG15_ERROR="Normalized odd number of arguments by adding nil"
**Genesis Block Alloc Account number 2**
INFO [03-05|15:53:18.597] Genesis Block ToBlock function Call AddBalance for Address/Balance (in Alloc): 0x221cb8Cd97223442754493A31184CF81F418E728=100,000,000,000,000,000,000
INFO [03-05|15:53:18.597] Call AddBalance # Target Address:        0x221cb8Cd97223442754493A31184CF81F418E728=nil                         LOG15_ERROR="Normalized odd number of arguments by adding nil"
ERROR[03-05|15:53:18.597] [Error-Log] getDeletedStateObject function: <nil>
ERROR[03-05|15:53:18.597] [Error-Log] TryGet function: Key not found in the MerkleTree
INFO [03-05|15:53:18.597] GetOrNewStateObject function call createObject because of stateObject == nil
INFO [03-05|15:53:18.597] Call createObject
ERROR[03-05|15:53:18.597] [Error-Log] getDeletedStateObject function: <nil>
ERROR[03-05|15:53:18.597] [Error-Log] TryGet function: Key not found in the MerkleTree
INFO [03-05|15:53:18.597] The new Object Address/Balance           0x221cb8Cd97223442754493A31184CF81F418E728=0
INFO [03-05|15:53:18.597] Genesis Block ToBlock function Call AddBalance for Address/Balance (in Alloc): 0x6CCf3e5FEbdEe9a3B263Eb3eAd5A19fa95Dc8ADf=0
INFO [03-05|15:53:18.597] Call AddBalance # Target Address:        0x6CCf3e5FEbdEe9a3B263Eb3eAd5A19fa95Dc8ADf=nil LOG15_ERROR="Normalized odd number of arguments by adding nil"
ERROR[03-05|15:53:18.597] [Error-Log] getDeletedStateObject function: <nil>
ERROR[03-05|15:53:18.597] [Error-Log] TryGet function: Key not found in the MerkleTree
INFO [03-05|15:53:18.597] GetOrNewStateObject function call createObject because of stateObject == nil
INFO [03-05|15:53:18.597] Call createObject
ERROR[03-05|15:53:18.597] [Error-Log] getDeletedStateObject function: <nil>
ERROR[03-05|15:53:18.598] [Error-Log] TryGet function: Key not found in the MerkleTree
INFO [03-05|15:53:18.598] The new Object Address/Balance           0x6CCf3e5FEbdEe9a3B263Eb3eAd5A19fa95Dc8ADf=0
INFO [03-05|15:53:18.599] Successfully wrote genesis state         database=lightchaindata hash=be088c..4ae275
INFO [03-05|15:53:18.669] Starting Geth on Ethereum mainnet...
INFO [03-05|15:53:18.669] Bumping default cache on mainnet         provided=1024 updated=4096
INFO [03-05|15:53:18.671] Maximum peer count                       ETH=0 LES=0 total=0
INFO [03-05|15:53:18.672] Set global gas cap                       cap=50,000,000
INFO [03-05|15:53:18.672] Allocated trie memory caches             clean=614.00MiB dirty=1024.00MiB
INFO [03-05|15:53:18.672] Allocated cache and file handles         database=/Users/siyuan/workspace/go/src/github.com/scroll-tech/go-ethereum/testchain/geth/chaindata cache=2.00GiB handles=5120
INFO [03-05|15:53:18.729] Opened ancient database                  database=/Users/siyuan/workspace/go/src/github.com/scroll-tech/go-ethereum/testchain/geth/chaindata/ancient readonly=false
INFO [03-05|15:53:18.729] Writing default main-net genesis block
INFO [03-05|15:53:18.773] Genesis Block Alloc Account number:      LOG15_ERROR= LOG15_ERROR="Normalized odd number of arguments by adding nil"
**Genesis Block Alloc Account number 8893**
INFO [03-05|15:53:18.773] Genesis Block ToBlock function Call AddBalance for Address/Balance (in Alloc): 0x2F13657526B177CaD547C3908c840Eff647b45D9=1,170,685,000,000,000,000,000
INFO [03-05|15:53:18.773] Call AddBalance # Target Address:        0x2F13657526B177CaD547C3908c840Eff647b45D9=nil                           LOG15_ERROR="Normalized odd number of arguments by adding nil"
ERROR[03-05|15:53:18.773] [Error-Log] getDeletedStateObject function: <nil>
ERROR[03-05|15:53:18.773] [Error-Log] TryGet function: Key not found in the MerkleTree
INFO [03-05|15:53:18.773] GetOrNewStateObject function call createObject because of stateObject == nil
INFO [03-05|15:53:18.773] Call createObject
ERROR[03-05|15:53:18.773] [Error-Log] getDeletedStateObject function: <nil>
ERROR[03-05|15:53:18.773] [Error-Log] TryGet function: Key not found in the MerkleTree
INFO [03-05|15:53:18.773] The new Object Address/Balance           0x2F13657526B177CaD547C3908c840Eff647b45D9=0
INFO [03-05|15:53:18.773] Genesis Block ToBlock function Call AddBalance for Address/Balance (in Alloc): 0xB2BFAa58B5196c5CB7F89de15f479D1838de713D=21,000,000,000,000,000,000
INFO [03-05|15:53:18.773] Call AddBalance # Target Address:        0xB2BFAa58B5196c5CB7F89de15f479D1838de713D=nil                        LOG15_ERROR="Normalized odd number of arguments by adding nil"
ERROR[03-05|15:53:18.773] [Error-Log] getDeletedStateObject function: <nil>
ERROR[03-05|15:53:18.773] [Error-Log] TryGet function: Key not found in the MerkleTree
INFO [03-05|15:53:18.773] GetOrNewStateObject function call createObject because of stateObject == nil
INFO [03-05|15:53:18.773] Call createObject
ERROR[03-05|15:53:18.773] [Error-Log] getDeletedStateObject function: <nil>
ERROR[03-05|15:53:18.774] [Error-Log] TryGet function: Key not found in the MerkleTree
INFO [03-05|15:53:18.774] The new Object Address/Balance           0xB2BFAa58B5196c5CB7F89de15f479D1838de713D=0
INFO [03-05|15:53:18.774] Genesis Block ToBlock function Call AddBalance for Address/Balance (in Alloc): 0xeC2CB8B9378dff31aeC3c22e0e6DAdFf314AB5Dd=2,000,000,000,000,000,000,000
INFO [03-05|15:53:18.774] Call AddBalance # Target Address:        0xeC2CB8B9378dff31aeC3c22e0e6DAdFf314AB5Dd=nil                           LOG15_ERROR="Normalized odd number of arguments by adding nil"

For example: Account "0xbEA0AfC93aae2108a3FAc059623BF86FA582a75e" is not defined in the genesis file but still has 1700 eth(So many).

// Not in our genesis.json
> eth.getBalance("0xbEA0AfC93aae2108a3FAc059623BF86FA582a75e")
ERROR[03-05|16:17:25.845] [Error-Log] getDeletedStateObject function: not covered yet
WARN [03-05|16:17:25.845] 1700000000000000000000
1.7e+21

When submitting logs: please submit them as text and not screenshots.

@hsyodyssey
Copy link
Author

Related logs.

redundant.log

@hsyodyssey hsyodyssey changed the title Redundant adding Accounts when creating a Genesis Block Redundant adding accounts and their balance when creating the Genesis Block Mar 5, 2022
@hsyodyssey hsyodyssey changed the title Redundant adding accounts and their balance when creating the Genesis Block Redundant adding accounts with their balance when creating the Genesis Block Mar 5, 2022
@hsyodyssey hsyodyssey added question Further information is requested invalid This doesn't seem right and removed question Further information is requested labels Mar 5, 2022
@lispc
Copy link

lispc commented May 1, 2022

How did u find this. . . Reading log? Reading code?

@hsyodyssey
Copy link
Author

hsyodyssey commented May 1, 2022

It was triggered once a long time ago somehow..It didn't happen when I tried to reproduce it afterwards. It was probably caused by the iusse in a certain version of MT long ago, which should be fixed now. 

@HAOYUatHZ HAOYUatHZ reopened this Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

4 participants