Skip to content

Commit

Permalink
Eip 6780 selfdestruct (#5430)
Browse files Browse the repository at this point in the history
* track CREATE/CREATE2/create-tx in a new "creates" field in the MessageFrame
* re-wrote Self-Destruct logic for clarity and optional EIP-6780 semantics.

Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com>
  • Loading branch information
shemnon committed Jul 24, 2023
1 parent ef02086 commit dd129c8
Show file tree
Hide file tree
Showing 11 changed files with 616 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
{
"cli": [
"t8n",
"--input.alloc=stdin",
"--input.txs=stdin",
"--input.env=stdin",
"--output.result=stdout",
"--output.alloc=stdout",
"--output.body=stdout",
"--state.fork=Cancun",
"--state.chainid=1",
"--state.reward=0"
],
"stdin": {
"alloc": {
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": {
"nonce": "0x00",
"balance": "0x3635c9adc5dea00000",
"code": "0x",
"storage": {}
},
"0x1111111111111111111111111111111111111111": {
"nonce": "0x00",
"balance": "0x01",
"code": "0x60015f555fff",
"storage": {}
}
},
"txs": [
{
"type": "0x0",
"chainId": "0x1",
"nonce": "0x0",
"gasPrice": "0xa",
"gas": "0x5f5e100",
"value": "0x0",
"input": "0x",
"to": "0x1111111111111111111111111111111111111111",
"sender": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"v": "0x1b",
"r": "0x7529278ba20a00f86b3659cd9f48285243075a63d7d3083f0f8977da3fc43a6f",
"s": "0x3745796d09090fa3b1aea76626aa0a3153b496f937f5a08b974309858d30e91d"
}
],
"env": {
"currentCoinbase": "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentGasLimit": "10000000000",
"currentNumber": "1",
"currentTimestamp": "1000",
"currentRandom": "0",
"currentDifficulty": "0",
"parentDifficulty": "0",
"parentBaseFee": "7",
"parentGasUsed": "0",
"parentGasLimit": "10000000000",
"parentTimestamp": "0",
"blockHashes": {
"0": "0xb9a3dd3d2865b4f8d6c701d6610a99800ad7e4ace851fb4e8d4e26fc1b7ad8dc"
},
"ommers": [],
"withdrawals": [],
"parentUncleHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"parentDataGasUsed": "0",
"parentExcessDataGas": "0"
}
},
"stdout": {
"alloc": {
"0x0000000000000000000000000000000000000000": {
"balance": "0x1"
},
"0x1111111111111111111111111111111111111111": {
"code": "0x60015f555fff",
"storage": {
"0x0000000000000000000000000000000000000000000000000000000000000000": "0x0000000000000000000000000000000000000000000000000000000000000001"
},
"balance": "0x0"
},
"0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba": {
"balance": "0x37731"
},
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": {
"balance": "0x3635c9adc5de9472b2",
"nonce": "0x1"
}
},
"body": "0xf863f861800a8405f5e10094111111111111111111111111111111111111111180801ba07529278ba20a00f86b3659cd9f48285243075a63d7d3083f0f8977da3fc43a6fa03745796d09090fa3b1aea76626aa0a3153b496f937f5a08b974309858d30e91d",
"result": {
"stateRoot": "0x3a0e532de836d767cae901aba671040fedc07557d277f7203066f640ed95f78d",
"txRoot": "0x60ae0f99c255ecf6436fdf1b503dbce0b7c84573fd5ed17bbfc7850c444f7bc3",
"receiptsRoot": "0x6b0b401f0a222e669b278b3a0ea50264b2771b63a3ad88f3892b507e4d8dfb2e",
"logsHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"receipts": [
{
"root": "0x",
"status": "0x1",
"cumulativeGasUsed": "0x127bb",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"logs": null,
"transactionHash": "0x2b992759a7ca56e96a5d44f118f0edb740a27c6f49482367799918c1e65b673e",
"contractAddress": "0x0000000000000000000000000000000000000000",
"gasUsed": "0x127bb",
"blockHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"transactionIndex": "0x0"
}
],
"currentDifficulty": null,
"gasUsed": "0x127bb",
"currentBaseFee": "0x7",
"withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
{
"cli": [
"t8n",
"--input.alloc=stdin",
"--input.txs=stdin",
"--input.env=stdin",
"--output.result=stdout",
"--output.alloc=stdout",
"--output.body=stdout",
"--state.fork=Cancun",
"--state.chainid=1",
"--state.reward=0"
],
"stdin": {
"alloc": {
"0x095e7baea6a6c7c4c2dfeb977efac326af552d87": {
"balance": "0x0de0b6b3a7640000",
"code": "0x3060005530ff00",
"nonce": "0x00",
"storage": {
}
},
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": {
"balance": "0x0de0b6b3a7640000",
"code": "0x",
"nonce": "0x00",
"storage": {
}
}
},
"txs": [
{
"type": "0x0",
"chainId": "0x1",
"nonce": "0x0",
"gasPrice": "0xa",
"gas": "0x0f4240",
"value": "0x0186a0",
"input": "0x",
"to": "0x095e7baea6a6c7c4c2dfeb977efac326af552d87",
"sender": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"v": "0x1c",
"r": "0x7bb4986663aec020c016ea3db37ba36e62e9c7d355dc8ed8566b20ce7452b600",
"s": "0x7da62397d8a969f674442837f419001f2671df0f19a45586ed3acfd93e819d82"
}
],
"env": {
"currentCoinbase": "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentGasLimit": "10000000000",
"currentNumber": "1",
"currentTimestamp": "1000",
"currentRandom": "0",
"currentDifficulty": "0",
"parentDifficulty": "0",
"parentBaseFee": "7",
"parentGasUsed": "0",
"parentGasLimit": "10000000000",
"parentTimestamp": "0",
"blockHashes": {
"0": "0xb9a3dd3d2865b4f8d6c701d6610a99800ad7e4ace851fb4e8d4e26fc1b7ad8dc"
},
"ommers": [],
"withdrawals": [],
"parentUncleHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"parentDataGasUsed": "0",
"parentExcessDataGas": "0"
}
},
"stdout": {
"alloc" : {
"0x095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
"code" : "0x3060005530ff00",
"storage" : {
"0x0000000000000000000000000000000000000000000000000000000000000000" : "0x000000000000000000000000095e7baea6a6c7c4c2dfeb977efac326af552d87"
},
"balance" : "0xde0b6b3a76586a0"
},
"0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : {
"balance" : "0x233c1"
},
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "0xde0b6b3a75b2232",
"nonce" : "0x1"
}
},
"body" : "0xf865f863800a830f424094095e7baea6a6c7c4c2dfeb977efac326af552d87830186a0801ca07bb4986663aec020c016ea3db37ba36e62e9c7d355dc8ed8566b20ce7452b600a07da62397d8a969f674442837f419001f2671df0f19a45586ed3acfd93e819d82",
"result" : {
"stateRoot" : "0xddd3a541e86e2dd0293959736de63e1fad74ae95149f34740b1173378e82527a",
"txRoot" : "0x0cbd46498d79551ba2f4237443d408194f7493f1fd567dbeaf1d53b41b41485a",
"receiptsRoot" : "0xbc67bed8ee77b1d9dd8eb6d6e55abd11e49c50e16832f0c350ae07027c859f19",
"logsHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"logsBloom" : "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"receipts" : [
{
"root" : "0x",
"status" : "0x1",
"cumulativeGasUsed" : "0xbbeb",
"logsBloom" : "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"logs" : null,
"transactionHash" : "0xa87c1a093fe07f3d38db9cde21d05b407f527e88f7c698c9008b6138119d2487",
"contractAddress" : "0x0000000000000000000000000000000000000000",
"gasUsed" : "0xbbeb",
"blockHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"transactionIndex" : "0x0"
}
],
"currentDifficulty" : null,
"gasUsed" : "0xbbeb",
"currentBaseFee" : "0x7",
"withdrawalsRoot" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
{
"cli": [
"t8n",
"--input.alloc=stdin",
"--input.txs=stdin",
"--input.env=stdin",
"--output.result=stdout",
"--output.alloc=stdout",
"--output.body=stdout",
"--state.fork=Cancun",
"--state.chainid=1",
"--state.reward=0"
],
"stdin": {
"alloc": {
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": {
"nonce": "0x00",
"balance": "0x3635c9adc5dea00000",
"code": "0x",
"storage": {}
}
},
"txs": [
{
"type": "0x0",
"chainId": "0x0",
"nonce": "0x0",
"gasPrice": "0xa",
"gas": "0x5f5e100",
"value": "0x0",
"input": "0x600d8060175f39805f80f05f805f805f855af1505ffffe600280600b5f39805ff3fe5fff",
"sender": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"secretKey": "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
"v": "0x1b",
"r": "0xf2bb558b73cfb96466c41785fdd0f1e367b4703d49653e617cffdb7316a01e87",
"s": "0x11e0423aeea027a1e48dc3adffe2b27652d8154599f10b6f552d51b1fcb632ae"
}
],
"env": {
"currentCoinbase": "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentGasLimit": "10000000000",
"currentNumber": "1",
"currentTimestamp": "1000",
"currentRandom": "0",
"currentDifficulty": "0",
"parentDifficulty": "0",
"parentBaseFee": "7",
"parentGasUsed": "0",
"parentGasLimit": "10000000000",
"parentTimestamp": "0",
"blockHashes": {
"0": "0xc5d4b3d67827b580c95a2a0980670255c15bfb964e8c4183d18971659bd5b6a8"
},
"ommers": [],
"withdrawals": [],
"parentUncleHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"parentDataGasUsed": "0",
"parentExcessDataGas": "0"
}
},
"stdout": {
"alloc": {
"0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba": {
"balance": "0x48540"
},
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": {
"balance": "0x3635c9adc5de90ee80",
"nonce": "0x1"
}
},
"body": "0xf873f871800a8405f5e1008080a4600d8060175f39805f80f05f805f805f855af1505ffffe600280600b5f39805ff3fe5fff1ba0f2bb558b73cfb96466c41785fdd0f1e367b4703d49653e617cffdb7316a01e87a011e0423aeea027a1e48dc3adffe2b27652d8154599f10b6f552d51b1fcb632ae",
"result": {
"stateRoot": "0x8d6ff9ecb860b2ca140a73ae8591615e384a4e397d859af831b4a475e47ff7b0",
"txRoot": "0x35ab0ce85af281d6e600d467fb3ed12063994cc9e105cbdb4eb1ba65ed9edddf",
"receiptsRoot": "0x2f9ef11d9889ea86d77151c8a6cf578fed535563e1a016e67997d22984ca1bef",
"logsHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"receipts": [
{
"root": "0x",
"status": "0x1",
"cumulativeGasUsed": "0x181c0",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"logs": null,
"transactionHash": "0xd954e10ebf0b55b71512b53a6ebae09372ccc6b2bf87b199e8aa8a5c4f757430",
"contractAddress": "0x6295ee1b4f6dd65047762f924ecd367c17eabf8f",
"gasUsed": "0x181c0",
"blockHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"transactionIndex": "0x0"
}
],
"currentDifficulty": null,
"gasUsed": "0x181c0",
"currentBaseFee": "0x7",
"withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"input": "0x",
"to": "0x0000000000000000000000000000000000000100",
"accessList": [],
"protected": true,
"maxFeePerDataGas": "0x1",
"sender": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"blobVersionedHashes": [
Expand Down
9 changes: 6 additions & 3 deletions evm/src/main/java/org/hyperledger/besu/evm/MainnetEVMs.java
Original file line number Diff line number Diff line change
Expand Up @@ -843,15 +843,18 @@ public static void registerCancunOperations(
final BigInteger chainID) {
registerShanghaiOperations(registry, gasCalculator, chainID);

// EIP-4844 DATAHASH
registry.put(new DataHashOperation(gasCalculator));

// EIP-1153 TSTORE/TLOAD
registry.put(new TStoreOperation(gasCalculator));
registry.put(new TLoadOperation(gasCalculator));

// EIP-4844 DATAHASH
registry.put(new DataHashOperation(gasCalculator));

// EIP-5656 MCOPY
registry.put(new MCopyOperation(gasCalculator));

// EIP-6780 nerf self destruct
registry.put(new SelfDestructOperation(gasCalculator, true));
}

/**
Expand Down

0 comments on commit dd129c8

Please sign in to comment.