diff --git a/src/Nethermind/Chains/eip4844_devnet.json b/src/Nethermind/Chains/eip4844_devnet.json new file mode 100644 index 00000000000..32e58ff62f8 --- /dev/null +++ b/src/Nethermind/Chains/eip4844_devnet.json @@ -0,0 +1,91 @@ + { + "name": "Eip4844Devnet", + "dataDir": "eip4844-devnet", + "engine": { + "clique": { + "params": { + "period": 5, + "epoch": 30000 + } + } + }, + "params": { + "terminalTotalDifficulty": "2", + "terminalPowBlockNumber": 1, + "chainID": "1", + "networkID": "1332", + "eip140Transition": "0x0", + "eip145Transition": "0x0", + "eip150Transition": "0x0", + "eip155Transition": "0x0", + "eip160Transition": "0x0", + "eip161abcTransition": "0x0", + "eip161dTransition": "0x0", + "eip211Transition": "0x0", + "eip214Transition": "0x0", + "eip658Transition": "0x0", + "eip1014Transition": "0x0", + "eip1052Transition": "0x0", + "eip1283Transition": "0x0", + "eip1283DisableTransition": "0x0", + "eip152Transition": "0x0", + "eip1108Transition": "0x0", + "eip1344Transition": "0x0", + "eip1884Transition": "0x0", + "eip2028Transition": "0x0", + "eip2200Transition": "0x0", + "eip2565Transition": "0x0", + "eip2929Transition": "0x0", + "eip2930Transition": "0x0", + "maxCodeSizeTransition": "0x0", + "eip1559Transition": "0x0", + "eip4895TransitionTimestamp": "0x0", + "eip4844TransitionTimestamp": "0x0" + }, + "genesis": { + "author": "0x0000000000000000000000000000000000000000", + "difficulty": "0x0", + "extraData": "0x0000000000000000000000000000000000000000000000000000000000000000BB427322C6C4Ed83cDCA287337AeF5bA734D01100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "gasLimit": "30000000", + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "seal": { + "ethereum": { + "nonce": "0x42", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000" + } + }, + "timestamp": 0, + "baseFeePerGas": "0x7" + }, + "accounts": { + "0x8A04d14125D0FDCDc742F4A05C051De07232EDa4": { + "code": "0x60806040526004361061003f5760003560e01c806301ffc9a7146100445780632289511814610079578063621fd1301461008e578063c5f2892f146100b0575b600080fd5b34801561005057600080fd5b5061006461005f366004610cdd565b6100d3565b60405190151581526020015b60405180910390f35b61008c610087366004610d57565b61010a565b005b34801561009a57600080fd5b506100a3610942565b6040516100709190610e56565b3480156100bc57600080fd5b506100c5610954565b604051908152602001610070565b60006001600160e01b031982166301ffc9a760e01b148061010457506001600160e01b03198216638564090760e01b145b92915050565b6030861461016e5760405162461bcd60e51b815260206004820152602660248201527f4465706f736974436f6e74726163743a20696e76616c6964207075626b6579206044820152650d8cadccee8d60d31b60648201526084015b60405180910390fd5b602084146101dd5760405162461bcd60e51b815260206004820152603660248201527f4465706f736974436f6e74726163743a20696e76616c696420776974686472616044820152750eec2d8bec6e4cac8cadce8d2c2d8e640d8cadccee8d60531b6064820152608401610165565b6060821461023f5760405162461bcd60e51b815260206004820152602960248201527f4465706f736974436f6e74726163743a20696e76616c6964207369676e6174756044820152680e4ca40d8cadccee8d60bb1b6064820152608401610165565b670de0b6b3a76400003410156102a65760405162461bcd60e51b815260206004820152602660248201527f4465706f736974436f6e74726163743a206465706f7369742076616c756520746044820152656f6f206c6f7760d01b6064820152608401610165565b6102b4633b9aca0034610e7f565b1561031d5760405162461bcd60e51b815260206004820152603360248201527f4465706f736974436f6e74726163743a206465706f7369742076616c7565206e6044820152726f74206d756c7469706c65206f66206777656960681b6064820152608401610165565b600061032d633b9aca0034610ea9565b905067ffffffffffffffff8111156103975760405162461bcd60e51b815260206004820152602760248201527f4465706f736974436f6e74726163743a206465706f7369742076616c756520746044820152660dede40d0d2ced60cb1b6064820152608401610165565b60006103a282610b29565b90507f649bbc62d0e31342afea4e5cd82d4049e7e1ee912fc0889aa790803be39038c589898989858a8a6103d7602054610b29565b6040516103eb989796959493929190610ee6565b60405180910390a1600060028a8a600060801b60405160200161041093929190610f59565b60408051601f198184030181529082905261042a91610f80565b602060405180830381855afa158015610447573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061046a9190610f9c565b9050600060028061047e6040848a8c610fb5565b60405160200161048f929190610fdf565b60408051601f19818403018152908290526104a991610f80565b602060405180830381855afa1580156104c6573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906104e99190610f9c565b60026104f8896040818d610fb5565b60405161050c929190600090602001610fef565b60408051601f198184030181529082905261052691610f80565b602060405180830381855afa158015610543573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906105669190610f9c565b60408051602081019390935282015260600160408051601f198184030181529082905261059291610f80565b602060405180830381855afa1580156105af573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906105d29190610f9c565b90506000600280848c8c6040516020016105ee93929190611001565b60408051601f198184030181529082905261060891610f80565b602060405180830381855afa158015610625573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906106489190610f9c565b604051600290610661908890600090889060200161101b565b60408051601f198184030181529082905261067b91610f80565b602060405180830381855afa158015610698573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906106bb9190610f9c565b60408051602081019390935282015260600160408051601f19818403018152908290526106e791610f80565b602060405180830381855afa158015610704573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906107279190610f9c565b90508581146107bb5760405162461bcd60e51b815260206004820152605460248201527f4465706f736974436f6e74726163743a207265636f6e7374727563746564204460448201527f65706f7369744461746120646f6573206e6f74206d6174636820737570706c6960648201527319590819195c1bdcda5d17d9185d1857dc9bdbdd60621b608482015260a401610165565b60016107c960206002611137565b6107d39190611143565b6020541061082d5760405162461bcd60e51b815260206004820152602160248201527f4465706f736974436f6e74726163743a206d65726b6c6520747265652066756c6044820152601b60fa1b6064820152608401610165565b600160206000828254610840919061115a565b909155505060205460005b602081101561092957816001166001141561088357826000826020811061087457610874611172565b01555061093995505050505050565b60026000826020811061089857610898611172565b0154604080516020810192909252810185905260600160408051601f19818403018152908290526108c891610f80565b602060405180830381855afa1580156108e5573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906109089190610f9c565b9250610915600283610ea9565b91508061092181611188565b91505061084b565b506109326111a3565b5050505050505b50505050505050565b606061094f602054610b29565b905090565b6020546000908190815b6020811015610aa55781600116600114156109ff5760026000826020811061098857610988611172565b0154604080516020810192909252810185905260600160408051601f19818403018152908290526109b891610f80565b602060405180830381855afa1580156109d5573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906109f89190610f9c565b9250610a86565b60028360218360208110610a1557610a15611172565b015460408051602081019390935282015260600160408051601f1981840301815290829052610a4391610f80565b602060405180830381855afa158015610a60573d6000803e3d6000fd5b5050506040513d601f19601f82011682018060405250810190610a839190610f9c565b92505b610a91600283610ea9565b915080610a9d81611188565b91505061095e565b50600282610ab4602054610b29565b604051610ac89291906000906020016111b9565b60408051601f1981840301815290829052610ae291610f80565b602060405180830381855afa158015610aff573d6000803e3d6000fd5b5050506040513d601f19601f82011682018060405250810190610b229190610f9c565b9250505090565b60408051600880825281830190925260609160208201818036833701905050905060c082901b8060071a60f81b82600081518110610b6957610b69611172565b60200101906001600160f81b031916908160001a9053508060061a60f81b82600181518110610b9a57610b9a611172565b60200101906001600160f81b031916908160001a9053508060051a60f81b82600281518110610bcb57610bcb611172565b60200101906001600160f81b031916908160001a9053508060041a60f81b82600381518110610bfc57610bfc611172565b60200101906001600160f81b031916908160001a9053508060031a60f81b82600481518110610c2d57610c2d611172565b60200101906001600160f81b031916908160001a9053508060021a60f81b82600581518110610c5e57610c5e611172565b60200101906001600160f81b031916908160001a9053508060011a60f81b82600681518110610c8f57610c8f611172565b60200101906001600160f81b031916908160001a9053508060001a60f81b82600781518110610cc057610cc0611172565b60200101906001600160f81b031916908160001a90535050919050565b600060208284031215610cef57600080fd5b81356001600160e01b031981168114610d0757600080fd5b9392505050565b60008083601f840112610d2057600080fd5b50813567ffffffffffffffff811115610d3857600080fd5b602083019150836020828501011115610d5057600080fd5b9250929050565b60008060008060008060006080888a031215610d7257600080fd5b873567ffffffffffffffff80821115610d8a57600080fd5b610d968b838c01610d0e565b909950975060208a0135915080821115610daf57600080fd5b610dbb8b838c01610d0e565b909750955060408a0135915080821115610dd457600080fd5b50610de18a828b01610d0e565b989b979a50959894979596606090950135949350505050565b60005b83811015610e15578181015183820152602001610dfd565b83811115610e24576000848401525b50505050565b60008151808452610e42816020860160208601610dfa565b601f01601f19169290920160200192915050565b602081526000610d076020830184610e2a565b634e487b7160e01b600052601260045260246000fd5b600082610e8e57610e8e610e69565b500690565b634e487b7160e01b600052601160045260246000fd5b600082610eb857610eb8610e69565b500490565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60a081526000610efa60a083018a8c610ebd565b8281036020840152610f0d81898b610ebd565b90508281036040840152610f218188610e2a565b90508281036060840152610f36818688610ebd565b90508281036080840152610f4a8185610e2a565b9b9a5050505050505050505050565b828482376fffffffffffffffffffffffffffffffff19919091169101908152601001919050565b60008251610f92818460208701610dfa565b9190910192915050565b600060208284031215610fae57600080fd5b5051919050565b60008085851115610fc557600080fd5b83861115610fd257600080fd5b5050820193919092039150565b8183823760009101908152919050565b82848237909101908152602001919050565b838152818360208301376000910160200190815292915050565b6000845161102d818460208901610dfa565b67ffffffffffffffff199490941691909301908152601881019190915260380192915050565b600181815b8085111561108e57816000190482111561107457611074610e93565b8085161561108157918102915b93841c9390800290611058565b509250929050565b6000826110a557506001610104565b816110b257506000610104565b81600181146110c857600281146110d2576110ee565b6001915050610104565b60ff8411156110e3576110e3610e93565b50506001821b610104565b5060208310610133831016604e8410600b8410161715611111575081810a610104565b61111b8383611053565b806000190482111561112f5761112f610e93565b029392505050565b6000610d078383611096565b60008282101561115557611155610e93565b500390565b6000821982111561116d5761116d610e93565b500190565b634e487b7160e01b600052603260045260246000fd5b600060001982141561119c5761119c610e93565b5060010190565b634e487b7160e01b600052600160045260246000fd5b838152600083516111d1816020850160208801610dfa565b67ffffffffffffffff1993909316919092016020810191909152603801939250505056fea26469706673582212201a15ba22b4bc8fe3cfe3ed05ece5280ba6ad3a4847ce90dd74a06d53f0907a8a64736f6c63430008090033", + "storage": { + "0x0000000000000000000000000000000000000000000000000000000000000000": "0x3294cf82a58a8ccea2ab14768c45bd3a3d16ca02685fe619f46b5e8964722e1a", + "0x0000000000000000000000000000000000000000000000000000000000000001": "0xd32fd9eded28310711155ca8b78b29373d35511905e063f90585f97a372a8f29", + "0x0000000000000000000000000000000000000000000000000000000000000002": "0xa02f79d5a09a5d0964d5b2befb082d3528d28407da1da541e199f742ed477d68", + "0x0000000000000000000000000000000000000000000000000000000000000020": "0x0000000000000000000000000000000000000000000000000000000000000005" + }, + "balance": "0x3782dace9d9000000" + }, + "0xBB427322C6C4Ed83cDCA287337AeF5bA734D0110": { + "balance": "0x152d02c7e14af6800000" + }, + "0x10F5d45854e038071485AC9e402308cF80D2d2fE": { + "balance": "0x152d02c7e14af6800000" + }, + "0x60E61a5b5787aCBDAB431Ac7cAFEB1eFbF9b4d9e": { + "balance": "0x152d02c7e14af6800000" + }, + "0x00000000000000000000000000000000000000014": { + "builtin": { + "name": "point_evaluation", + "pricing": { + "alt_bn128_pairing": { + "base": 50000 + } + } + } + } + } + } diff --git a/src/Nethermind/Chains/eip4844_local.json b/src/Nethermind/Chains/eip4844_local.json new file mode 100644 index 00000000000..5c4844d4f6f --- /dev/null +++ b/src/Nethermind/Chains/eip4844_local.json @@ -0,0 +1,70 @@ +{ + "name": "Eip4844Local", + "dataDir": "eip4844_local", + "engine": { + "clique": { + "params": { + "period": 5, + "epoch": 30000 + } + } + }, + "params": { + "terminalTotalDifficulty": "2", + "terminalPowBlockNumber": 1, + "chainID": "1", + "networkID": "69", + "maximumExtraDataSize": "1000000", + "eip140Transition": "0x0", + "eip145Transition": "0x0", + "eip150Transition": "0x0", + "eip155Transition": "0x0", + "eip160Transition": "0x0", + "eip161abcTransition": "0x0", + "eip161dTransition": "0x0", + "eip211Transition": "0x0", + "eip214Transition": "0x0", + "eip658Transition": "0x0", + "eip1014Transition": "0x0", + "eip1052Transition": "0x0", + "eip1283Transition": "0x0", + "eip1283DisableTransition": "0x0", + "eip152Transition": "0x0", + "eip1108Transition": "0x0", + "eip1344Transition": "0x0", + "eip1884Transition": "0x0", + "eip2028Transition": "0x0", + "eip2200Transition": "0x0", + "eip2565Transition": "0x0", + "eip2929Transition": "0x0", + "eip2930Transition": "0x0", + "maxCodeSizeTransition": "0x0", + "eip1559Transition": "0x0", + "eip4895TransitionTimestamp": "0x0", + "eip4844TransitionTimestamp": "0x0" + }, + "genesis": { + "author": "0x0000000000000000000000000000000000000000", + "difficulty": "0x0", + "extraData": "0x0000000000000000000000000000000000000000000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "gasLimit": "0x1C9C380", + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "seal": { + "ethereum": { + "nonce": "0x42", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000" + } + }, + "timestamp": 0, + "baseFeePerGas": "0x7" + }, + "accounts": { + "0x8A04d14125D0FDCDc742F4A05C051De07232EDa4": { + "code": "0x60806040526004361061003f5760003560e01c806301ffc9a714610044578063228951181461008c578063621fd130146101a2578063c5f2892f1461022c575b600080fd5b34801561005057600080fd5b506100786004803603602081101561006757600080fd5b50356001600160e01b031916610253565b604080519115158252519081900360200190f35b6101a0600480360360808110156100a257600080fd5b8101906020810181356401000000008111156100bd57600080fd5b8201836020820111156100cf57600080fd5b803590602001918460018302840111640100000000831117156100f157600080fd5b91939092909160208101903564010000000081111561010f57600080fd5b82018360208201111561012157600080fd5b8035906020019184600183028401116401000000008311171561014357600080fd5b91939092909160208101903564010000000081111561016157600080fd5b82018360208201111561017357600080fd5b8035906020019184600183028401116401000000008311171561019557600080fd5b91935091503561028a565b005b3480156101ae57600080fd5b506101b7610ce6565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101f15781810151838201526020016101d9565b50505050905090810190601f16801561021e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561023857600080fd5b50610241610cf8565b60408051918252519081900360200190f35b60006001600160e01b031982166301ffc9a760e01b148061028457506001600160e01b03198216638564090760e01b145b92915050565b603086146102c95760405162461bcd60e51b81526004018080602001828103825260268152602001806112516026913960400191505060405180910390fd5b602084146103085760405162461bcd60e51b81526004018080602001828103825260368152602001806111e86036913960400191505060405180910390fd5b606082146103475760405162461bcd60e51b81526004018080602001828103825260298152602001806112c46029913960400191505060405180910390fd5b670de0b6b3a764000034101561038e5760405162461bcd60e51b815260040180806020018281038252602681526020018061129e6026913960400191505060405180910390fd5b633b9aca003406156103d15760405162461bcd60e51b815260040180806020018281038252603381526020018061121e6033913960400191505060405180910390fd5b633b9aca00340467ffffffffffffffff81111561041f5760405162461bcd60e51b81526004018080602001828103825260278152602001806112776027913960400191505060405180910390fd5b606061042a82610fc6565b90507f649bbc62d0e31342afea4e5cd82d4049e7e1ee912fc0889aa790803be39038c589898989858a8a61045f602054610fc6565b6040805160a0808252810189905290819060208201908201606083016080840160c085018e8e80828437600083820152601f01601f191690910187810386528c815260200190508c8c808284376000838201819052601f909101601f191690920188810386528c5181528c51602091820193918e019250908190849084905b838110156104f65781810151838201526020016104de565b50505050905090810190601f1680156105235780820380516001836020036101000a031916815260200191505b5086810383528881526020018989808284376000838201819052601f909101601f19169092018881038452895181528951602091820193918b019250908190849084905b8381101561057f578181015183820152602001610567565b50505050905090810190601f1680156105ac5780820380516001836020036101000a031916815260200191505b509d505050505050505050505050505060405180910390a1600060028a8a600060801b604051602001808484808284376fffffffffffffffffffffffffffffffff199094169190930190815260408051600f19818403018152601090920190819052815191955093508392506020850191508083835b602083106106415780518252601f199092019160209182019101610622565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610680573d6000803e3d6000fd5b5050506040513d602081101561069557600080fd5b5051905060006002806106ab6040848a8c61114a565b6040516020018083838082843780830192505050925050506040516020818303038152906040526040518082805190602001908083835b602083106107015780518252601f1990920191602091820191016106e2565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610740573d6000803e3d6000fd5b5050506040513d602081101561075557600080fd5b50516002610766896040818d61114a565b60405160009060200180848480828437919091019283525050604080518083038152602092830191829052805190945090925082918401908083835b602083106107c15780518252601f1990920191602091820191016107a2565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610800573d6000803e3d6000fd5b5050506040513d602081101561081557600080fd5b5051604080516020818101949094528082019290925280518083038201815260609092019081905281519192909182918401908083835b6020831061086b5780518252601f19909201916020918201910161084c565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa1580156108aa573d6000803e3d6000fd5b5050506040513d60208110156108bf57600080fd5b50516040805160208101858152929350600092600292839287928f928f92018383808284378083019250505093505050506040516020818303038152906040526040518082805190602001908083835b6020831061092e5780518252601f19909201916020918201910161090f565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa15801561096d573d6000803e3d6000fd5b5050506040513d602081101561098257600080fd5b50516040518651600291889160009188916020918201918291908601908083835b602083106109c25780518252601f1990920191602091820191016109a3565b6001836020036101000a0380198251168184511680821785525050505050509050018367ffffffffffffffff191667ffffffffffffffff1916815260180182815260200193505050506040516020818303038152906040526040518082805190602001908083835b60208310610a495780518252601f199092019160209182019101610a2a565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610a88573d6000803e3d6000fd5b5050506040513d6020811015610a9d57600080fd5b5051604080516020818101949094528082019290925280518083038201815260609092019081905281519192909182918401908083835b60208310610af35780518252601f199092019160209182019101610ad4565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610b32573d6000803e3d6000fd5b5050506040513d6020811015610b4757600080fd5b50519050858114610b895760405162461bcd60e51b81526004018080602001828103825260548152602001806111946054913960600191505060405180910390fd5b60205463ffffffff11610bcd5760405162461bcd60e51b81526004018080602001828103825260218152602001806111736021913960400191505060405180910390fd5b602080546001019081905560005b6020811015610cda578160011660011415610c0d578260008260208110610bfe57fe5b015550610cdd95505050505050565b600260008260208110610c1c57fe5b01548460405160200180838152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b60208310610c745780518252601f199092019160209182019101610c55565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610cb3573d6000803e3d6000fd5b5050506040513d6020811015610cc857600080fd5b50519250600282049150600101610bdb565b50fe5b50505050505050565b6060610cf3602054610fc6565b905090565b6020546000908190815b6020811015610ea9578160011660011415610ddb57600260008260208110610d2657fe5b01548460405160200180838152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b60208310610d7e5780518252601f199092019160209182019101610d5f565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610dbd573d6000803e3d6000fd5b5050506040513d6020811015610dd257600080fd5b50519250610e9b565b60028360218360208110610deb57fe5b015460405160200180838152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b60208310610e425780518252601f199092019160209182019101610e23565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610e81573d6000803e3d6000fd5b5050506040513d6020811015610e9657600080fd5b505192505b600282049150600101610d02565b50600282610eb8602054610fc6565b600060401b6040516020018084815260200183805190602001908083835b60208310610ef55780518252601f199092019160209182019101610ed6565b51815160209384036101000a600019018019909216911617905267ffffffffffffffff199590951692019182525060408051808303600719018152601890920190819052815191955093508392850191508083835b60208310610f695780518252601f199092019160209182019101610f4a565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa158015610fa8573d6000803e3d6000fd5b5050506040513d6020811015610fbd57600080fd5b50519250505090565b60408051600880825281830190925260609160208201818036833701905050905060c082901b8060071a60f81b8260008151811061100057fe5b60200101906001600160f81b031916908160001a9053508060061a60f81b8260018151811061102b57fe5b60200101906001600160f81b031916908160001a9053508060051a60f81b8260028151811061105657fe5b60200101906001600160f81b031916908160001a9053508060041a60f81b8260038151811061108157fe5b60200101906001600160f81b031916908160001a9053508060031a60f81b826004815181106110ac57fe5b60200101906001600160f81b031916908160001a9053508060021a60f81b826005815181106110d757fe5b60200101906001600160f81b031916908160001a9053508060011a60f81b8260068151811061110257fe5b60200101906001600160f81b031916908160001a9053508060001a60f81b8260078151811061112d57fe5b60200101906001600160f81b031916908160001a90535050919050565b60008085851115611159578182fd5b83861115611165578182fd5b505082019391909203915056fe4465706f736974436f6e74726163743a206d65726b6c6520747265652066756c6c4465706f736974436f6e74726163743a207265636f6e7374727563746564204465706f7369744461746120646f6573206e6f74206d6174636820737570706c696564206465706f7369745f646174615f726f6f744465706f736974436f6e74726163743a20696e76616c6964207769746864726177616c5f63726564656e7469616c73206c656e6774684465706f736974436f6e74726163743a206465706f7369742076616c7565206e6f74206d756c7469706c65206f6620677765694465706f736974436f6e74726163743a20696e76616c6964207075626b6579206c656e6774684465706f736974436f6e74726163743a206465706f7369742076616c756520746f6f20686967684465706f736974436f6e74726163743a206465706f7369742076616c756520746f6f206c6f774465706f736974436f6e74726163743a20696e76616c6964207369676e6174757265206c656e677468a164736f6c634300060b000a", + "balance": "0x0" + }, + "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": { + "balance": "0x6d6172697573766477000000" + } + } +} diff --git a/src/Nethermind/Nethermind.Consensus/Processing/BlockProcessor.cs b/src/Nethermind/Nethermind.Consensus/Processing/BlockProcessor.cs index 54b058a5031..a7b2d7ab729 100644 --- a/src/Nethermind/Nethermind.Consensus/Processing/BlockProcessor.cs +++ b/src/Nethermind/Nethermind.Consensus/Processing/BlockProcessor.cs @@ -283,7 +283,9 @@ private Block PrepareBlockForProcessing(Block suggestedBlock) AuRaSignature = bh.AuRaSignature, ReceiptsRoot = bh.ReceiptsRoot, BaseFeePerGas = bh.BaseFeePerGas, - IsPostMerge = bh.IsPostMerge + ExcessDataGas = bh.ExcessDataGas, + IsPostMerge = bh.IsPostMerge, + ParentExcessDataGas = bh.ParentExcessDataGas, }; return suggestedBlock.CreateCopy(headerForProcessing); diff --git a/src/Nethermind/Nethermind.Consensus/Validators/TxValidator.cs b/src/Nethermind/Nethermind.Consensus/Validators/TxValidator.cs index 10c3ecc0a2e..7f04025b6bf 100644 --- a/src/Nethermind/Nethermind.Consensus/Validators/TxValidator.cs +++ b/src/Nethermind/Nethermind.Consensus/Validators/TxValidator.cs @@ -51,7 +51,8 @@ public bool IsWellFormed(Transaction transaction, IReleaseSpec releaseSpec) while for an init it will be empty */ ValidateSignature(transaction.Signature, releaseSpec) && ValidateChainId(transaction) && - Validate1559GasFields(transaction, releaseSpec); + Validate1559GasFields(transaction, releaseSpec) && + Validate4844Fields(transaction, releaseSpec); } private bool ValidateTxType(Transaction transaction, IReleaseSpec releaseSpec) @@ -64,6 +65,8 @@ private bool ValidateTxType(Transaction transaction, IReleaseSpec releaseSpec) return releaseSpec.UseTxAccessLists; case TxType.EIP1559: return releaseSpec.IsEip1559Enabled; + case TxType.Blob: + return releaseSpec.IsEip4844Enabled; default: return false; } @@ -85,6 +88,7 @@ private bool ValidateChainId(Transaction transaction) return true; case TxType.AccessList: case TxType.EIP1559: + case TxType.Blob: return transaction.ChainId == _chainIdValue; default: return false; @@ -118,5 +122,10 @@ private bool ValidateSignature(Signature? signature, IReleaseSpec spec) return !spec.ValidateChainId || (signature.V == 27 || signature.V == 28); } + + private bool Validate4844Fields(Transaction transaction, IReleaseSpec spec) + { + return transaction.Type != TxType.Blob || spec.IsEip4844Enabled ^ transaction.MaxFeePerDataGas is null; + } } } diff --git a/src/Nethermind/Nethermind.Core.Test/Builders/TransactionBuilder.cs b/src/Nethermind/Nethermind.Core.Test/Builders/TransactionBuilder.cs index 04011cb2834..d770d31b4bf 100644 --- a/src/Nethermind/Nethermind.Core.Test/Builders/TransactionBuilder.cs +++ b/src/Nethermind/Nethermind.Core.Test/Builders/TransactionBuilder.cs @@ -144,6 +144,17 @@ public TransactionBuilder WithSenderAddress(Address? address) return this; } + public TransactionBuilder WithBlobHashes() + { + TestObjectInternal.BlobVersionedHashes = new byte[][] + { + Convert.FromHexString("013DABCDABCDABCDABCDABCDABCDABCDABCDABCDABCDABCDABCDABCDABCDABCD"), + Convert.FromHexString("012DABCDABCDABCDABCDABCDABCDABCDABCDABCDABCDABCDABCDABCDABCDABCD"), + Convert.FromHexString("011DABCDABCDABCDABCDABCDABCDABCDABCDABCDABCDABCDABCDABCDABCDABCD"), + }; + return this; + } + public TransactionBuilder WithSignature(Signature signature) { TestObjectInternal.Signature = signature; diff --git a/src/Nethermind/Nethermind.Core/Block.cs b/src/Nethermind/Nethermind.Core/Block.cs index 44e82d7c2d4..21b227649c0 100644 --- a/src/Nethermind/Nethermind.Core/Block.cs +++ b/src/Nethermind/Nethermind.Core/Block.cs @@ -100,6 +100,8 @@ public Block(BlockHeader blockHeader) public UInt256 BaseFeePerGas => Header.BaseFeePerGas; // do not add setter here + public UInt256? ExcessDataGas => Header.ExcessDataGas; // do not add setter here + public bool IsPostMerge => Header.IsPostMerge; // do not add setter here public bool IsBodyMissing => Header.HasBody && Body.IsEmpty; diff --git a/src/Nethermind/Nethermind.Core/BlockHeader.cs b/src/Nethermind/Nethermind.Core/BlockHeader.cs index 4bbbed5e7ee..f255db870d7 100644 --- a/src/Nethermind/Nethermind.Core/BlockHeader.cs +++ b/src/Nethermind/Nethermind.Core/BlockHeader.cs @@ -37,7 +37,9 @@ public BlockHeader( long number, long gasLimit, ulong timestamp, - byte[] extraData) + byte[] extraData, + UInt256? excessDataGas, + UInt256 parentExcessDataGas) { ParentHash = parentHash; UnclesHash = unclesHash; @@ -47,6 +49,20 @@ public BlockHeader( GasLimit = gasLimit; Timestamp = timestamp; ExtraData = extraData; + ExcessDataGas = excessDataGas; + ParentExcessDataGas = parentExcessDataGas; + } + + public BlockHeader( + Keccak parentHash, + Keccak unclesHash, + Address beneficiary, + in UInt256 difficulty, + long number, + long gasLimit, + ulong timestamp, + byte[] extraData) : this(parentHash, unclesHash, beneficiary, difficulty, number, gasLimit, timestamp, extraData, null, UInt256.MaxValue) + { } public WeakReference? MaybeParent { get; set; } @@ -76,12 +92,15 @@ public BlockHeader( public byte[]? AuRaSignature { get; set; } public long? AuRaStep { get; set; } public UInt256 BaseFeePerGas { get; set; } + public UInt256? ExcessDataGas { get; set; } public bool HasBody => UnclesHash != Keccak.OfAnEmptySequenceRlp || TxRoot != Keccak.EmptyTreeHash; public string SealEngineType { get; set; } = Nethermind.Core.SealEngineType.Ethash; // ToDo we need to set this flag after reading block from db public bool IsPostMerge { get; set; } + // For blob gas calculation + public UInt256 ParentExcessDataGas { get; set; } = UInt256.MaxValue; public string ToString(string indent) { @@ -102,6 +121,10 @@ public string ToString(string indent) builder.AppendLine($"{indent}Receipts Root: {ReceiptsRoot}"); builder.AppendLine($"{indent}State Root: {StateRoot}"); builder.AppendLine($"{indent}BaseFeePerGas: {BaseFeePerGas}"); + if (ExcessDataGas is not null) + { + builder.AppendLine($"{indent}ExcessDataGas: {ExcessDataGas}"); + } builder.AppendLine($"{indent}IsPostMerge: {IsPostMerge}"); builder.AppendLine($"{indent}TotalDifficulty: {TotalDifficulty}"); diff --git a/src/Nethermind/Nethermind.Core/Specs/IReleaseSpec.cs b/src/Nethermind/Nethermind.Core/Specs/IReleaseSpec.cs index 90f06bb5114..cbb8c450d53 100644 --- a/src/Nethermind/Nethermind.Core/Specs/IReleaseSpec.cs +++ b/src/Nethermind/Nethermind.Core/Specs/IReleaseSpec.cs @@ -278,6 +278,11 @@ public interface IReleaseSpec /// bool IsEip3860Enabled { get; } + /// + /// Blob transactions + /// + bool IsEip4844Enabled { get; } + /// /// Should transactions be validated against chainId. /// @@ -292,6 +297,8 @@ public interface IReleaseSpec public long Eip1559TransitionBlock { get; } + public ulong Eip4844TransitionTimestamp { get; } + // STATE related public bool ClearEmptyAccountWhenTouched => IsEip158Enabled; diff --git a/src/Nethermind/Nethermind.Core/Transaction.cs b/src/Nethermind/Nethermind.Core/Transaction.cs index b372d6f19af..7ea3c59de4d 100644 --- a/src/Nethermind/Nethermind.Core/Transaction.cs +++ b/src/Nethermind/Nethermind.Core/Transaction.cs @@ -43,6 +43,7 @@ public class Transaction public UInt256 MaxFeePerGas => IsEip1559 ? DecodedMaxFeePerGas : GasPrice; public bool IsEip1559 => Type == TxType.EIP1559; public bool IsEip2930 => Type == TxType.AccessList; + public bool IsEip4844 => Type == TxType.Blob; public long GasLimit { get; set; } public Address? To { get; set; } public UInt256 Value { get; set; } @@ -57,6 +58,13 @@ public class Transaction public UInt256 Timestamp { get; set; } public AccessList? AccessList { get; set; } // eip2930 + public UInt256? MaxFeePerDataGas { get; set; } // eip4844 + public byte[][]? BlobVersionedHashes { get; set; } // eip4844 + + // Network form of blob transaction fields + public byte[][]? BlobKzgs { get; set; } + public byte[][]? Blobs { get; set; } + public byte[]? Proof { get; set; } /// /// Service transactions are free. The field added to handle baseFee validation after 1559 @@ -102,6 +110,10 @@ public string ToString(string indent) builder.AppendLine($"{indent}ChainId: {Signature?.ChainId}"); builder.AppendLine($"{indent}Timestamp: {Timestamp}"); + if (IsEip4844) + { + builder.AppendLine($"{indent}BlobVersionedHashes: {BlobVersionedHashes?.Length}"); + } return builder.ToString(); } diff --git a/src/Nethermind/Nethermind.Core/TxType.cs b/src/Nethermind/Nethermind.Core/TxType.cs index 3d28b1dbfed..3c0ea928e25 100644 --- a/src/Nethermind/Nethermind.Core/TxType.cs +++ b/src/Nethermind/Nethermind.Core/TxType.cs @@ -21,6 +21,7 @@ public enum TxType : byte { Legacy = 0, AccessList = 1, - EIP1559 = 2 + EIP1559 = 2, + Blob = 5, } } diff --git a/src/Nethermind/Nethermind.Evm.Test/InvalidOpcodeTests.cs b/src/Nethermind/Nethermind.Evm.Test/InvalidOpcodeTests.cs index 6f3aa4f873c..d3ad5fc11e6 100644 --- a/src/Nethermind/Nethermind.Evm.Test/InvalidOpcodeTests.cs +++ b/src/Nethermind/Nethermind.Evm.Test/InvalidOpcodeTests.cs @@ -138,6 +138,23 @@ public class InvalidOpcodeTests : VirtualMachineTestsBase ) )))))).ToArray(); + private static readonly Instruction[] ShardingForkInstructions = + FrontierInstructions.Union( + HomesteadInstructions.Union( + ByzantiumInstructions.Union( + ConstantinopleFixInstructions.Union( + IstanbulInstructions.Union( + BerlinInstructions.Union( + LondonInstructions.Union( + ShanghaiInstructions.Union( + new Instruction[] + { + // TODO: Add DATAHASH + } + ) + ) + )))))).ToArray(); + private Dictionary _validOpcodes = new() { @@ -152,7 +169,8 @@ private Dictionary _validOpcodes { MainnetSpecProvider.BerlinBlockNumber, BerlinInstructions }, { MainnetSpecProvider.LondonBlockNumber, LondonInstructions }, { MainnetSpecProvider.ShanghaiActivation, ShanghaiInstructions }, - { (long.MaxValue, ulong.MaxValue), ShanghaiInstructions } + { MainnetSpecProvider.ShardingForkActivation, ShardingForkInstructions }, + { (long.MaxValue, ulong.MaxValue), ShardingForkInstructions } }; private const string InvalidOpCodeErrorMessage = "BadInstruction"; @@ -176,6 +194,7 @@ protected override ILogManager GetLogManager() [TestCase(MainnetSpecProvider.BerlinBlockNumber)] [TestCase(MainnetSpecProvider.LondonBlockNumber)] [TestCase(MainnetSpecProvider.GrayGlacierBlockNumber, MainnetSpecProvider.ShanghaiBlockTimestamp)] + [TestCase(MainnetSpecProvider.GrayGlacierBlockNumber, MainnetSpecProvider.ShardingForkBlockTimestamp)] [TestCase(long.MaxValue, ulong.MaxValue)] public void Test(long blockNumber, ulong? timestamp = null) { diff --git a/src/Nethermind/Nethermind.Facade/BlockchainBridge.cs b/src/Nethermind/Nethermind.Facade/BlockchainBridge.cs index 2d3a6c91b76..87208f0c82d 100644 --- a/src/Nethermind/Nethermind.Facade/BlockchainBridge.cs +++ b/src/Nethermind/Nethermind.Facade/BlockchainBridge.cs @@ -275,7 +275,9 @@ private void CallAndRestore( blockHeader.Number, blockHeader.GasLimit, blockHeader.Timestamp, - blockHeader.ExtraData) + blockHeader.ExtraData, + blockHeader.ExcessDataGas, + blockHeader.ParentExcessDataGas) { BaseFeePerGas = blockHeader.BaseFeePerGas, }; diff --git a/src/Nethermind/Nethermind.Init/Steps/InitRlp.cs b/src/Nethermind/Nethermind.Init/Steps/InitRlp.cs index ea1196591f1..b79352fefe3 100644 --- a/src/Nethermind/Nethermind.Init/Steps/InitRlp.cs +++ b/src/Nethermind/Nethermind.Init/Steps/InitRlp.cs @@ -47,6 +47,7 @@ public virtual Task Execute(CancellationToken _) } HeaderDecoder.Eip1559TransitionBlock = _api.SpecProvider.GenesisSpec.Eip1559TransitionBlock; + HeaderDecoder.Eip4844TransitionTimestamp = _api.SpecProvider.GenesisSpec.Eip4844TransitionTimestamp; return Task.CompletedTask; } diff --git a/src/Nethermind/Nethermind.JsonRpc/Data/TransactionForRpc.cs b/src/Nethermind/Nethermind.JsonRpc/Data/TransactionForRpc.cs index 301573a8052..1685752f789 100644 --- a/src/Nethermind/Nethermind.JsonRpc/Data/TransactionForRpc.cs +++ b/src/Nethermind/Nethermind.JsonRpc/Data/TransactionForRpc.cs @@ -104,6 +104,8 @@ public TransactionForRpc() public AccessListItemForRpc[]? AccessList { get; set; } + public UInt256? MaxFeePerDataGas { get; set; } // eip4844 + public UInt256? V { get; set; } public UInt256? S { get; set; } @@ -137,6 +139,11 @@ public TransactionForRpc() tx.GasPrice = MaxPriorityFeePerGas ?? 0; } + if (tx.IsEip4844) + { + tx.MaxFeePerDataGas = MaxFeePerDataGas; + } + return tx; } @@ -155,7 +162,8 @@ public TransactionForRpc() Data = Data ?? Input, Type = Type, AccessList = TryGetAccessList(), - ChainId = chainId + ChainId = chainId, + MaxFeePerDataGas = MaxFeePerDataGas, }; if (tx.IsEip1559) @@ -164,6 +172,11 @@ public TransactionForRpc() tx.DecodedMaxFeePerGas = MaxFeePerGas ?? 0; } + if (tx.IsEip4844) + { + tx.MaxFeePerDataGas = MaxFeePerDataGas; + } + return tx; } diff --git a/src/Nethermind/Nethermind.JsonRpc/Modules/Eth/BlockForRpc.cs b/src/Nethermind/Nethermind.JsonRpc/Modules/Eth/BlockForRpc.cs index 892edc74068..92a7ea470c9 100644 --- a/src/Nethermind/Nethermind.JsonRpc/Modules/Eth/BlockForRpc.cs +++ b/src/Nethermind/Nethermind.JsonRpc/Modules/Eth/BlockForRpc.cs @@ -68,6 +68,11 @@ public BlockForRpc(Block block, bool includeFullTransactionData, ISpecProvider s { BaseFeePerGas = block.Header.BaseFeePerGas; } + + if (spec.IsEip4844Enabled) + { + ExcessDataGas = block.Header.ExcessDataGas; + } } Number = block.Number; @@ -123,5 +128,8 @@ public BlockForRpc(Block block, bool includeFullTransactionData, ISpecProvider s public IEnumerable Transactions { get; set; } public Keccak TransactionsRoot { get; set; } public IEnumerable Uncles { get; set; } + + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public UInt256? ExcessDataGas { get; set; } } } diff --git a/src/Nethermind/Nethermind.Merge.Plugin/Data/V1/ExecutionPayloadV1.cs b/src/Nethermind/Nethermind.Merge.Plugin/Data/V1/ExecutionPayloadV1.cs index f0fed63ade6..579eb956514 100644 --- a/src/Nethermind/Nethermind.Merge.Plugin/Data/V1/ExecutionPayloadV1.cs +++ b/src/Nethermind/Nethermind.Merge.Plugin/Data/V1/ExecutionPayloadV1.cs @@ -19,6 +19,7 @@ using Nethermind.Core; using Nethermind.Core.Crypto; using Nethermind.Int256; +using Nethermind.Serialization.Json; using Nethermind.Serialization.Rlp; using Nethermind.State.Proofs; using Newtonsoft.Json; @@ -60,6 +61,7 @@ public ExecutionPayloadV1(Block block) ExtraData = block.ExtraData!; Timestamp = block.Timestamp; BaseFeePerGas = block.BaseFeePerGas; + ExcessDataGas = block.ExcessDataGas; } public bool TryGetBlock(out Block? block, UInt256? totalDifficulty = null) @@ -76,7 +78,8 @@ public bool TryGetBlock(out Block? block, UInt256? totalDifficulty = null) BaseFeePerGas = BaseFeePerGas, Nonce = 0, MixHash = PrevRandao, - Author = FeeRecipient + Author = FeeRecipient, + ExcessDataGas = ExcessDataGas }; Transaction[] transactions = GetTransactions(); header.TxRoot = new TxTrie(transactions).RootHash; @@ -109,6 +112,9 @@ public bool TryGetBlock(out Block? block, UInt256? totalDifficulty = null) public byte[] ExtraData { get; set; } = Array.Empty(); public UInt256 BaseFeePerGas { get; set; } + [JsonConverter(typeof(NullableUInt256Converter))] + public UInt256? ExcessDataGas { get; set; } + [JsonProperty(NullValueHandling = NullValueHandling.Include)] public Keccak? BlockHash { get; set; } = null!; diff --git a/src/Nethermind/Nethermind.Runner/Nethermind.Runner.csproj b/src/Nethermind/Nethermind.Runner/Nethermind.Runner.csproj index 2d96158ac92..62a2315f336 100644 --- a/src/Nethermind/Nethermind.Runner/Nethermind.Runner.csproj +++ b/src/Nethermind/Nethermind.Runner/Nethermind.Runner.csproj @@ -101,6 +101,9 @@ + + + <_ContentIncludedByDefault Remove="Contracts\EntryPoint.json" /> diff --git a/src/Nethermind/Nethermind.Runner/Properties/launchSettings.json b/src/Nethermind/Nethermind.Runner/Properties/launchSettings.json index ed2a8b9427d..d7a46a50c61 100644 --- a/src/Nethermind/Nethermind.Runner/Properties/launchSettings.json +++ b/src/Nethermind/Nethermind.Runner/Properties/launchSettings.json @@ -28,6 +28,27 @@ "ASPNETCORE_ENVIRONMENT": "Development" } }, + "Eip4844 Devnet": { + "commandName": "Project", + "commandLineArgs": "-c eip4844_devnet -dd %NETHERMIND_DATA_DIR%", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "Eip4844 Local": { + "commandName": "Project", + "commandLineArgs": "-c eip4844_local -dd %NETHERMIND_DATA_DIR%", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "Eip4844 Local Trace": { + "commandName": "Project", + "commandLineArgs": "-c eip4844_local -dd %NETHERMIND_DATA_DIR% --log TRACE", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, "Energy Web": { "commandName": "Project", "commandLineArgs": "-c energyweb -dd %NETHERMIND_DATA_DIR% --JsonRpc.Enabled true", diff --git a/src/Nethermind/Nethermind.Runner/configs/eip4844_devnet.cfg b/src/Nethermind/Nethermind.Runner/configs/eip4844_devnet.cfg new file mode 100644 index 00000000000..7dd4a0048be --- /dev/null +++ b/src/Nethermind/Nethermind.Runner/configs/eip4844_devnet.cfg @@ -0,0 +1,49 @@ +{ + "Init": { + "ChainSpecPath": "chainspec/eip4844_devnet.json", + "GenesisHash": "0xcad78043b630d48d19856a93a7469e104772dd8675567fb22bb38d165d2aa7e6", + "LogFileName": "eip4844_devnet.logs.txt", + "MemoryHint": 1024000000 + }, + "TxPool": { + "Size": 1024 + }, + "Pruning": { + "Mode": "Hybrid" + }, + "Sync": { + "FastSync": true, + "SnapSync": true, + "FastBlocks": true, + "FastSyncCatchUpHeightDelta": "4096" + }, + "Discovery": { + "Bootnodes": "enode://fdefa8b36717bd246ce338e952a3b949e608158d06c74c8b9e207439f70bfc63da27b7a4c4161a14722f7d4a256fda9c93a6dd5c26624b6a523dca2cd852ad97@34.121.33.53:30303,enode://13f2c3f2811231c384cbea2690e769321a4804a2eafb2e4c656f76c7e52624fffcfbc2a52a0a932b4dde0b321f29fb9229777126a91db9b10b26dfa2d93ce32b@34.122.190.151:30303,enode://71475ca7e915bfbe9958688fa3d5af127a0353ead52a2fff1216d374a5b8dd6a67ced237a9b52b1b9cb1a90160ce2019eaacfacbf750ecbeba8e0f439b7f930b@34.173.8.43:30303" + }, + "JsonRpc": { + "Enabled": true, + "EnabledModules": [ + "Admin", + "Eth", + "Subscribe", + "Trace", + "TxPool", + "Web3", + "Personal", + "Proof", + "Net", + "Parity", + "Health", + "Debug" + ], + "Port": 8545, + "UnsecureDevNoRpcAuthentication": true, + "AdditionalRpcUrls": [ + "http://localhost:8551|http;ws|net;eth;subscribe;engine;web3;client" + ] + }, + "Merge": { + "Enabled": true, + "SecondsPerSlot": 6 + } +} diff --git a/src/Nethermind/Nethermind.Runner/configs/eip4844_docker.cfg b/src/Nethermind/Nethermind.Runner/configs/eip4844_docker.cfg new file mode 100644 index 00000000000..3263affd2d0 --- /dev/null +++ b/src/Nethermind/Nethermind.Runner/configs/eip4844_docker.cfg @@ -0,0 +1,58 @@ +{ + "Init": { + "ChainSpecPath": "chainspec/eip4844_local.json", + "GenesisHash": "0x033931fc47c599fae7058806e8fd0e131e0bf73b2e026cded18267578b09cf2e", + "LogFileName": "eip4844_local.logs.txt", + "MemoryHint": 1024000000 + }, + "TxPool": { + "Size": 1024 + }, + "Metrics": { + "NodeName": "Etho" + }, + "Pruning": { + "Mode": "Hybrid" + }, + "Sync": { + "FastSync": true, + "SnapSync": true, + "FastBlocks": true, + "FastSyncCatchUpHeightDelta": "128" + }, + "Discovery": { + "Bootnodes": "enode://c97e956a20f0214b8304bf42e723b2b8f723bbf1064e981d4267c37c326c77503b383b607dd785ddea04112c855f360ac3d4fca999aa26306a02a2c048256879@execution-node:30303" + }, + "JsonRpc": { + "Enabled": true, + "EnabledModules": [ + "Admin", + "Eth", + "Subscribe", + "Engine", + "Trace", + "TxPool", + "Web3", + "Personal", + "Proof", + "Net", + "Parity", + "Health", + "Debug" + ], + "Host": "0.0.0.0", + "UnsecureDevNoRpcAuthentication": true, + "Port": 8545, + "AdditionalRpcUrls": [ + "http://0.0.0.0:8551|http;ws|net;eth;subscribe;engine;web3;client;health" + ] + }, + "Merge": { + "Enabled": true, + "SecondsPerSlot": 6 + }, + "HealthChecks": { + "Enabled": true, + "UIEnabled": true + } +} diff --git a/src/Nethermind/Nethermind.Runner/configs/eip4844_local.cfg b/src/Nethermind/Nethermind.Runner/configs/eip4844_local.cfg new file mode 100644 index 00000000000..51e350e32ac --- /dev/null +++ b/src/Nethermind/Nethermind.Runner/configs/eip4844_local.cfg @@ -0,0 +1,58 @@ +{ + "Init": { + "ChainSpecPath": "chainspec/eip4844_local.json", + "GenesisHash": "0x033931fc47c599fae7058806e8fd0e131e0bf73b2e026cded18267578b09cf2e", + "LogFileName": "eip4844_local.logs.txt", + "MemoryHint": 1024000000 + }, + "TxPool": { + "Size": 1024 + }, + "Metrics": { + "NodeName": "Etho" + }, + "Pruning": { + "Mode": "Hybrid" + }, + "Sync": { + "FastSync": true, + "SnapSync": true, + "FastBlocks": true, + "FastSyncCatchUpHeightDelta": "128" + }, + "Discovery": { + "Bootnodes": "enode://c97e956a20f0214b8304bf42e723b2b8f723bbf1064e981d4267c37c326c77503b383b607dd785ddea04112c855f360ac3d4fca999aa26306a02a2c048256879@127.0.0.1:30304" + }, + "JsonRpc": { + "Enabled": true, + "EnabledModules": [ + "Admin", + "Eth", + "Subscribe", + "Engine", + "Trace", + "TxPool", + "Web3", + "Personal", + "Proof", + "Net", + "Parity", + "Health", + "Debug" + ], + "Host": "0.0.0.0", + "UnsecureDevNoRpcAuthentication": true, + "Port": 8547, + "AdditionalRpcUrls": [ + "http://0.0.0.0:8551|http;ws|net;eth;subscribe;engine;web3;client;health" + ] + }, + "Merge": { + "Enabled": true, + "SecondsPerSlot": 6 + }, + "HealthChecks": { + "Enabled": true, + "UIEnabled": true + } +} diff --git a/src/Nethermind/Nethermind.Serialization.Rlp/HeaderDecoder.cs b/src/Nethermind/Nethermind.Serialization.Rlp/HeaderDecoder.cs index 10558a9f427..3b456699b1c 100644 --- a/src/Nethermind/Nethermind.Serialization.Rlp/HeaderDecoder.cs +++ b/src/Nethermind/Nethermind.Serialization.Rlp/HeaderDecoder.cs @@ -27,6 +27,7 @@ public class HeaderDecoder : IRlpValueDecoder, IRlpStreamDecoder, IRlpStreamDecoder= Eip4844TransitionTimestamp) + { + blockHeader.ExcessDataGas = decoderContext.DecodeUInt256(); + } + if ((rlpBehaviors & RlpBehaviors.AllowExtraData) != RlpBehaviors.AllowExtraData) { decoderContext.Check(headerCheck); @@ -156,6 +162,11 @@ public class HeaderDecoder : IRlpValueDecoder, IRlpStreamDecoder= Eip4844TransitionTimestamp) + { + blockHeader.ExcessDataGas = rlpStream.DecodeUInt256(); + } + if ((rlpBehaviors & RlpBehaviors.AllowExtraData) != RlpBehaviors.AllowExtraData) { rlpStream.Check(headerCheck); @@ -207,6 +218,11 @@ public void Encode(RlpStream rlpStream, BlockHeader? header, RlpBehaviors rlpBeh { rlpStream.Encode(header.BaseFeePerGas); } + + if (header.Timestamp >= Eip4844TransitionTimestamp && header.ExcessDataGas is not null) + { + rlpStream.Encode(header.ExcessDataGas.Value); + } } public Rlp Encode(BlockHeader? item, RlpBehaviors rlpBehaviors = RlpBehaviors.None) @@ -244,7 +260,8 @@ private static int GetContentLength(BlockHeader? item, RlpBehaviors rlpBehaviors + Rlp.LengthOf(item.GasUsed) + Rlp.LengthOf(item.Timestamp) + Rlp.LengthOf(item.ExtraData) - + (item.Number < Eip1559TransitionBlock ? 0 : Rlp.LengthOf(item.BaseFeePerGas)); + + (item.Number < Eip1559TransitionBlock ? 0 : Rlp.LengthOf(item.BaseFeePerGas)) + + (item.Timestamp < Eip4844TransitionTimestamp ? 0 : item.ExcessDataGas.HasValue ? Rlp.LengthOf(item.ExcessDataGas.Value) : 0); if (notForSealing) { diff --git a/src/Nethermind/Nethermind.Specs.Test/OverridableReleaseSpec.cs b/src/Nethermind/Nethermind.Specs.Test/OverridableReleaseSpec.cs index b845f3f7aac..88fa9845105 100644 --- a/src/Nethermind/Nethermind.Specs.Test/OverridableReleaseSpec.cs +++ b/src/Nethermind/Nethermind.Specs.Test/OverridableReleaseSpec.cs @@ -126,6 +126,7 @@ public OverridableReleaseSpec(IReleaseSpec spec) public bool IsEip3529Enabled => _spec.IsEip3529Enabled; public bool IsEip3541Enabled => _spec.IsEip3541Enabled; + public bool IsEip4844Enabled => _spec.IsEip4844Enabled; public bool IsEip3607Enabled { get; set; } public bool IsEip158IgnoredAccount(Address address) @@ -146,6 +147,19 @@ public long Eip1559TransitionBlock } } + private ulong? _overridenEip4844TransitionTimeStamp; + public ulong Eip4844TransitionTimestamp + { + get + { + return _overridenEip4844TransitionTimeStamp ?? _spec.Eip4844TransitionTimestamp; + } + set + { + _overridenEip4844TransitionTimeStamp = value; + } + } + public Address? Eip1559FeeCollector => _spec.Eip1559FeeCollector; public bool IsEip1153Enabled => _spec.IsEip1153Enabled; public bool IsEip3675Enabled => _spec.IsEip3675Enabled; diff --git a/src/Nethermind/Nethermind.Specs/ChainSpecStyle/ChainParameters.cs b/src/Nethermind/Nethermind.Specs/ChainSpecStyle/ChainParameters.cs index 0ae99f86445..f3a06f8b7b2 100644 --- a/src/Nethermind/Nethermind.Specs/ChainSpecStyle/ChainParameters.cs +++ b/src/Nethermind/Nethermind.Specs/ChainSpecStyle/ChainParameters.cs @@ -129,5 +129,7 @@ public class ChainParameters /// this feild will indicate the timestamp at which this EIP3651 will be enabled. /// public ulong? Eip3651TransitionTimestamp { get; set; } + + public ulong? Eip4844TransitionTimestamp { get; set; } } } diff --git a/src/Nethermind/Nethermind.Specs/ChainSpecStyle/ChainSpec.cs b/src/Nethermind/Nethermind.Specs/ChainSpecStyle/ChainSpec.cs index 90aae3c6e94..a07a1ee1ac5 100644 --- a/src/Nethermind/Nethermind.Specs/ChainSpecStyle/ChainSpec.cs +++ b/src/Nethermind/Nethermind.Specs/ChainSpecStyle/ChainSpec.cs @@ -91,5 +91,7 @@ public class ChainSpec public UInt256? TerminalTotalDifficulty { get; set; } public ulong? ShanghaiTimestamp { get; set; } + + public long? ShardingForkBlockNumber { get; set; } } } diff --git a/src/Nethermind/Nethermind.Specs/ChainSpecStyle/ChainSpecBasedSpecProvider.cs b/src/Nethermind/Nethermind.Specs/ChainSpecStyle/ChainSpecBasedSpecProvider.cs index d5f89971d6b..8e1e23146ca 100644 --- a/src/Nethermind/Nethermind.Specs/ChainSpecStyle/ChainSpecBasedSpecProvider.cs +++ b/src/Nethermind/Nethermind.Specs/ChainSpecStyle/ChainSpecBasedSpecProvider.cs @@ -183,6 +183,7 @@ private void FillReleaseSpec(ReleaseSpec releaseSpec, long releaseStartBlock, ul releaseSpec.IsEip2200Enabled = (_chainSpec.Parameters.Eip2200Transition ?? long.MaxValue) <= releaseStartBlock || (_chainSpec.Parameters.Eip1706Transition ?? long.MaxValue) <= releaseStartBlock && releaseSpec.IsEip1283Enabled; releaseSpec.IsEip1559Enabled = (_chainSpec.Parameters.Eip1559Transition ?? long.MaxValue) <= releaseStartBlock; releaseSpec.Eip1559TransitionBlock = _chainSpec.Parameters.Eip1559Transition ?? long.MaxValue; + releaseSpec.Eip4844TransitionTimestamp = _chainSpec.Parameters.Eip4844TransitionTimestamp ?? ulong.MaxValue; releaseSpec.IsEip2315Enabled = (_chainSpec.Parameters.Eip2315Transition ?? long.MaxValue) <= releaseStartBlock; releaseSpec.IsEip2537Enabled = (_chainSpec.Parameters.Eip2537Transition ?? long.MaxValue) <= releaseStartBlock; releaseSpec.IsEip2565Enabled = (_chainSpec.Parameters.Eip2565Transition ?? long.MaxValue) <= releaseStartBlock; @@ -192,6 +193,7 @@ private void FillReleaseSpec(ReleaseSpec releaseSpec, long releaseStartBlock, ul releaseSpec.IsEip3541Enabled = (_chainSpec.Parameters.Eip3541Transition ?? long.MaxValue) <= releaseStartBlock; releaseSpec.IsEip3529Enabled = (_chainSpec.Parameters.Eip3529Transition ?? long.MaxValue) <= releaseStartBlock; releaseSpec.IsEip3607Enabled = (_chainSpec.Parameters.Eip3607Transition ?? long.MaxValue) <= releaseStartBlock; + releaseSpec.IsEip4844Enabled = (_chainSpec.Parameters.Eip4844TransitionTimestamp ?? ulong.MaxValue) <= releaseStartTimestamp; releaseSpec.ValidateChainId = (_chainSpec.Parameters.ValidateChainIdTransition ?? 0) <= releaseStartBlock; releaseSpec.ValidateReceipts = ((_chainSpec.Parameters.ValidateReceiptsTransition > 0) ? Math.Max(_chainSpec.Parameters.ValidateReceiptsTransition ?? 0, _chainSpec.Parameters.Eip658Transition ?? 0) : 0) <= releaseStartBlock; releaseSpec.Eip1559FeeCollector = releaseSpec.IsEip1559Enabled && (_chainSpec.Parameters.Eip1559FeeCollectorTransition ?? long.MaxValue) <= releaseStartBlock ? _chainSpec.Parameters.Eip1559FeeCollector : null; diff --git a/src/Nethermind/Nethermind.Specs/ChainSpecStyle/ChainSpecLoader.cs b/src/Nethermind/Nethermind.Specs/ChainSpecStyle/ChainSpecLoader.cs index fc00df1ae55..1991c8488b6 100644 --- a/src/Nethermind/Nethermind.Specs/ChainSpecStyle/ChainSpecLoader.cs +++ b/src/Nethermind/Nethermind.Specs/ChainSpecStyle/ChainSpecLoader.cs @@ -148,6 +148,7 @@ private void LoadParameters(ChainSpecJson chainSpecJson, ChainSpec chainSpec) Eip3529Transition = chainSpecJson.Params.Eip3529Transition, Eip3607Transition = chainSpecJson.Params.Eip3607Transition, Eip1153TransitionTimestamp = chainSpecJson.Params.Eip1153TransitionTimestamp, + Eip4844TransitionTimestamp = chainSpecJson.Params.Eip4844TransitionTimestamp, TransactionPermissionContract = chainSpecJson.Params.TransactionPermissionContract, TransactionPermissionContractTransition = chainSpecJson.Params.TransactionPermissionContractTransition, ValidateChainIdTransition = chainSpecJson.Params.ValidateChainIdTransition, diff --git a/src/Nethermind/Nethermind.Specs/ChainSpecStyle/Json/ChainSpecParamsJson.cs b/src/Nethermind/Nethermind.Specs/ChainSpecStyle/Json/ChainSpecParamsJson.cs index c45efcfd66b..1616e82a41f 100644 --- a/src/Nethermind/Nethermind.Specs/ChainSpecStyle/Json/ChainSpecParamsJson.cs +++ b/src/Nethermind/Nethermind.Specs/ChainSpecStyle/Json/ChainSpecParamsJson.cs @@ -148,5 +148,7 @@ internal class ChainSpecParamsJson public ulong? Eip1153TransitionTimestamp { get; set; } public ulong? Eip3651TransitionTimestamp { get; set; } + + public ulong? Eip4844TransitionTimestamp { get; set; } } } diff --git a/src/Nethermind/Nethermind.Specs/Forks/16_ShardingFork.cs b/src/Nethermind/Nethermind.Specs/Forks/16_ShardingFork.cs new file mode 100644 index 00000000000..084ad3d6e26 --- /dev/null +++ b/src/Nethermind/Nethermind.Specs/Forks/16_ShardingFork.cs @@ -0,0 +1,38 @@ +// Copyright (c) 2021 Demerzel Solutions Limited +// This file is part of the Nethermind library. +// +// The Nethermind library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The Nethermind library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the Nethermind. If not, see . +// + +using System.Threading; +using Nethermind.Core.Specs; + +namespace Nethermind.Specs.Forks +{ + /// + /// ShardingFork is a temporary name for a fork that potentially will be merged into Shanghai + /// + public class ShardingFork : Shanghai + { + private static IReleaseSpec _instance; + + protected ShardingFork() + { + Name = "ShardingFork"; + IsEip4844Enabled = true; + } + + public new static IReleaseSpec Instance => LazyInitializer.EnsureInitialized(ref _instance, () => new ShardingFork()); + } +} diff --git a/src/Nethermind/Nethermind.Specs/MainNetSpecProvider.cs b/src/Nethermind/Nethermind.Specs/MainNetSpecProvider.cs index 8b469a343d3..b82b5157876 100644 --- a/src/Nethermind/Nethermind.Specs/MainNetSpecProvider.cs +++ b/src/Nethermind/Nethermind.Specs/MainNetSpecProvider.cs @@ -54,7 +54,8 @@ public IReleaseSpec GetSpec(ForkActivation forkActivation) => { BlockNumber: < ArrowGlacierBlockNumber } => London.Instance, { BlockNumber: < GrayGlacierBlockNumber } => ArrowGlacier.Instance, { Timestamp: null } or { Timestamp: < ShanghaiBlockTimestamp } => GrayGlacier.Instance, - _ => Shanghai.Instance + { Timestamp: < ShardingForkBlockTimestamp } => Shanghai.Instance, + _ => ShardingFork.Instance }; public const long HomesteadBlockNumber = 1_150_000; @@ -70,11 +71,13 @@ public IReleaseSpec GetSpec(ForkActivation forkActivation) => public const long LondonBlockNumber = 12_965_000; public const long ArrowGlacierBlockNumber = 13_773_000; public const long GrayGlacierBlockNumber = 15_050_000; - public const ulong ShanghaiBlockTimestamp = ulong.MaxValue - 4; + public const ulong ShanghaiBlockTimestamp = ulong.MaxValue - 5; + public const ulong ShardingForkBlockTimestamp = ulong.MaxValue - 4; public const ulong CancunBlockTimestamp = ulong.MaxValue - 3; public const ulong PragueBlockTimestamp = ulong.MaxValue - 2; public const ulong OsakaBlockTimestamp = ulong.MaxValue - 1; public static ForkActivation ShanghaiActivation = (15_050_000, ShanghaiBlockTimestamp); + public static ForkActivation ShardingForkActivation = (15_050_000, ShardingForkBlockTimestamp); public static ForkActivation CancunActivation = (15_050_000, CancunBlockTimestamp); public static ForkActivation PragueActivation = (15_050_000, PragueBlockTimestamp); public static ForkActivation OsakaActivation = (15_050_000, OsakaBlockTimestamp); diff --git a/src/Nethermind/Nethermind.Specs/ReleaseSpec.cs b/src/Nethermind/Nethermind.Specs/ReleaseSpec.cs index aa9bf4e5fcf..4ddf93251c8 100644 --- a/src/Nethermind/Nethermind.Specs/ReleaseSpec.cs +++ b/src/Nethermind/Nethermind.Specs/ReleaseSpec.cs @@ -74,6 +74,7 @@ public class ReleaseSpec : IReleaseSpec public bool ValidateChainId { get; set; } public bool ValidateReceipts { get; set; } public long Eip1559TransitionBlock { get; set; } + public ulong Eip4844TransitionTimestamp { get; set; } = ulong.MaxValue; public Address Eip1559FeeCollector { get; set; } public UInt256? Eip1559BaseFeeMinValue { get; set; } public bool IsEip1153Enabled { get; set; } @@ -81,5 +82,6 @@ public class ReleaseSpec : IReleaseSpec public bool IsEip3651Enabled { get; set; } public bool IsEip3855Enabled { get; set; } public bool IsEip3860Enabled { get; set; } + public bool IsEip4844Enabled { get; set; } } } diff --git a/src/Nethermind/Nethermind.Specs/SystemTransactionReleaseSpec.cs b/src/Nethermind/Nethermind.Specs/SystemTransactionReleaseSpec.cs index 43b2e22fafd..00b297e947f 100644 --- a/src/Nethermind/Nethermind.Specs/SystemTransactionReleaseSpec.cs +++ b/src/Nethermind/Nethermind.Specs/SystemTransactionReleaseSpec.cs @@ -28,6 +28,7 @@ public SystemTransactionReleaseSpec(IReleaseSpec spec) { _spec = spec; } + public bool IsEip4844Enabled => _spec.IsEip4844Enabled; public string Name => "System"; @@ -129,6 +130,8 @@ public bool IsEip158IgnoredAccount(Address address) public long Eip1559TransitionBlock => _spec.Eip1559TransitionBlock; + public ulong Eip4844TransitionTimestamp => _spec.Eip4844TransitionTimestamp; + public Address Eip1559FeeCollector => _spec.Eip1559FeeCollector; public bool IsEip1153Enabled => _spec.IsEip1153Enabled; public bool IsEip3675Enabled => _spec.IsEip3675Enabled;