Skip to content

Commit dd129c8

Browse files
authored
Eip 6780 selfdestruct (#5430)
* 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 <[email protected]>
1 parent ef02086 commit dd129c8

File tree

11 files changed

+616
-27
lines changed

11 files changed

+616
-27
lines changed
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
{
2+
"cli": [
3+
"t8n",
4+
"--input.alloc=stdin",
5+
"--input.txs=stdin",
6+
"--input.env=stdin",
7+
"--output.result=stdout",
8+
"--output.alloc=stdout",
9+
"--output.body=stdout",
10+
"--state.fork=Cancun",
11+
"--state.chainid=1",
12+
"--state.reward=0"
13+
],
14+
"stdin": {
15+
"alloc": {
16+
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": {
17+
"nonce": "0x00",
18+
"balance": "0x3635c9adc5dea00000",
19+
"code": "0x",
20+
"storage": {}
21+
},
22+
"0x1111111111111111111111111111111111111111": {
23+
"nonce": "0x00",
24+
"balance": "0x01",
25+
"code": "0x60015f555fff",
26+
"storage": {}
27+
}
28+
},
29+
"txs": [
30+
{
31+
"type": "0x0",
32+
"chainId": "0x1",
33+
"nonce": "0x0",
34+
"gasPrice": "0xa",
35+
"gas": "0x5f5e100",
36+
"value": "0x0",
37+
"input": "0x",
38+
"to": "0x1111111111111111111111111111111111111111",
39+
"sender": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
40+
"v": "0x1b",
41+
"r": "0x7529278ba20a00f86b3659cd9f48285243075a63d7d3083f0f8977da3fc43a6f",
42+
"s": "0x3745796d09090fa3b1aea76626aa0a3153b496f937f5a08b974309858d30e91d"
43+
}
44+
],
45+
"env": {
46+
"currentCoinbase": "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
47+
"currentGasLimit": "10000000000",
48+
"currentNumber": "1",
49+
"currentTimestamp": "1000",
50+
"currentRandom": "0",
51+
"currentDifficulty": "0",
52+
"parentDifficulty": "0",
53+
"parentBaseFee": "7",
54+
"parentGasUsed": "0",
55+
"parentGasLimit": "10000000000",
56+
"parentTimestamp": "0",
57+
"blockHashes": {
58+
"0": "0xb9a3dd3d2865b4f8d6c701d6610a99800ad7e4ace851fb4e8d4e26fc1b7ad8dc"
59+
},
60+
"ommers": [],
61+
"withdrawals": [],
62+
"parentUncleHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
63+
"parentDataGasUsed": "0",
64+
"parentExcessDataGas": "0"
65+
}
66+
},
67+
"stdout": {
68+
"alloc": {
69+
"0x0000000000000000000000000000000000000000": {
70+
"balance": "0x1"
71+
},
72+
"0x1111111111111111111111111111111111111111": {
73+
"code": "0x60015f555fff",
74+
"storage": {
75+
"0x0000000000000000000000000000000000000000000000000000000000000000": "0x0000000000000000000000000000000000000000000000000000000000000001"
76+
},
77+
"balance": "0x0"
78+
},
79+
"0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba": {
80+
"balance": "0x37731"
81+
},
82+
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": {
83+
"balance": "0x3635c9adc5de9472b2",
84+
"nonce": "0x1"
85+
}
86+
},
87+
"body": "0xf863f861800a8405f5e10094111111111111111111111111111111111111111180801ba07529278ba20a00f86b3659cd9f48285243075a63d7d3083f0f8977da3fc43a6fa03745796d09090fa3b1aea76626aa0a3153b496f937f5a08b974309858d30e91d",
88+
"result": {
89+
"stateRoot": "0x3a0e532de836d767cae901aba671040fedc07557d277f7203066f640ed95f78d",
90+
"txRoot": "0x60ae0f99c255ecf6436fdf1b503dbce0b7c84573fd5ed17bbfc7850c444f7bc3",
91+
"receiptsRoot": "0x6b0b401f0a222e669b278b3a0ea50264b2771b63a3ad88f3892b507e4d8dfb2e",
92+
"logsHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
93+
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
94+
"receipts": [
95+
{
96+
"root": "0x",
97+
"status": "0x1",
98+
"cumulativeGasUsed": "0x127bb",
99+
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
100+
"logs": null,
101+
"transactionHash": "0x2b992759a7ca56e96a5d44f118f0edb740a27c6f49482367799918c1e65b673e",
102+
"contractAddress": "0x0000000000000000000000000000000000000000",
103+
"gasUsed": "0x127bb",
104+
"blockHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
105+
"transactionIndex": "0x0"
106+
}
107+
],
108+
"currentDifficulty": null,
109+
"gasUsed": "0x127bb",
110+
"currentBaseFee": "0x7",
111+
"withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
112+
}
113+
}
114+
}
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
{
2+
"cli": [
3+
"t8n",
4+
"--input.alloc=stdin",
5+
"--input.txs=stdin",
6+
"--input.env=stdin",
7+
"--output.result=stdout",
8+
"--output.alloc=stdout",
9+
"--output.body=stdout",
10+
"--state.fork=Cancun",
11+
"--state.chainid=1",
12+
"--state.reward=0"
13+
],
14+
"stdin": {
15+
"alloc": {
16+
"0x095e7baea6a6c7c4c2dfeb977efac326af552d87": {
17+
"balance": "0x0de0b6b3a7640000",
18+
"code": "0x3060005530ff00",
19+
"nonce": "0x00",
20+
"storage": {
21+
}
22+
},
23+
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": {
24+
"balance": "0x0de0b6b3a7640000",
25+
"code": "0x",
26+
"nonce": "0x00",
27+
"storage": {
28+
}
29+
}
30+
},
31+
"txs": [
32+
{
33+
"type": "0x0",
34+
"chainId": "0x1",
35+
"nonce": "0x0",
36+
"gasPrice": "0xa",
37+
"gas": "0x0f4240",
38+
"value": "0x0186a0",
39+
"input": "0x",
40+
"to": "0x095e7baea6a6c7c4c2dfeb977efac326af552d87",
41+
"sender": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
42+
"v": "0x1c",
43+
"r": "0x7bb4986663aec020c016ea3db37ba36e62e9c7d355dc8ed8566b20ce7452b600",
44+
"s": "0x7da62397d8a969f674442837f419001f2671df0f19a45586ed3acfd93e819d82"
45+
}
46+
],
47+
"env": {
48+
"currentCoinbase": "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
49+
"currentGasLimit": "10000000000",
50+
"currentNumber": "1",
51+
"currentTimestamp": "1000",
52+
"currentRandom": "0",
53+
"currentDifficulty": "0",
54+
"parentDifficulty": "0",
55+
"parentBaseFee": "7",
56+
"parentGasUsed": "0",
57+
"parentGasLimit": "10000000000",
58+
"parentTimestamp": "0",
59+
"blockHashes": {
60+
"0": "0xb9a3dd3d2865b4f8d6c701d6610a99800ad7e4ace851fb4e8d4e26fc1b7ad8dc"
61+
},
62+
"ommers": [],
63+
"withdrawals": [],
64+
"parentUncleHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
65+
"parentDataGasUsed": "0",
66+
"parentExcessDataGas": "0"
67+
}
68+
},
69+
"stdout": {
70+
"alloc" : {
71+
"0x095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
72+
"code" : "0x3060005530ff00",
73+
"storage" : {
74+
"0x0000000000000000000000000000000000000000000000000000000000000000" : "0x000000000000000000000000095e7baea6a6c7c4c2dfeb977efac326af552d87"
75+
},
76+
"balance" : "0xde0b6b3a76586a0"
77+
},
78+
"0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : {
79+
"balance" : "0x233c1"
80+
},
81+
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
82+
"balance" : "0xde0b6b3a75b2232",
83+
"nonce" : "0x1"
84+
}
85+
},
86+
"body" : "0xf865f863800a830f424094095e7baea6a6c7c4c2dfeb977efac326af552d87830186a0801ca07bb4986663aec020c016ea3db37ba36e62e9c7d355dc8ed8566b20ce7452b600a07da62397d8a969f674442837f419001f2671df0f19a45586ed3acfd93e819d82",
87+
"result" : {
88+
"stateRoot" : "0xddd3a541e86e2dd0293959736de63e1fad74ae95149f34740b1173378e82527a",
89+
"txRoot" : "0x0cbd46498d79551ba2f4237443d408194f7493f1fd567dbeaf1d53b41b41485a",
90+
"receiptsRoot" : "0xbc67bed8ee77b1d9dd8eb6d6e55abd11e49c50e16832f0c350ae07027c859f19",
91+
"logsHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
92+
"logsBloom" : "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
93+
"receipts" : [
94+
{
95+
"root" : "0x",
96+
"status" : "0x1",
97+
"cumulativeGasUsed" : "0xbbeb",
98+
"logsBloom" : "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
99+
"logs" : null,
100+
"transactionHash" : "0xa87c1a093fe07f3d38db9cde21d05b407f527e88f7c698c9008b6138119d2487",
101+
"contractAddress" : "0x0000000000000000000000000000000000000000",
102+
"gasUsed" : "0xbbeb",
103+
"blockHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
104+
"transactionIndex" : "0x0"
105+
}
106+
],
107+
"currentDifficulty" : null,
108+
"gasUsed" : "0xbbeb",
109+
"currentBaseFee" : "0x7",
110+
"withdrawalsRoot" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
111+
}
112+
}
113+
}
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
{
2+
"cli": [
3+
"t8n",
4+
"--input.alloc=stdin",
5+
"--input.txs=stdin",
6+
"--input.env=stdin",
7+
"--output.result=stdout",
8+
"--output.alloc=stdout",
9+
"--output.body=stdout",
10+
"--state.fork=Cancun",
11+
"--state.chainid=1",
12+
"--state.reward=0"
13+
],
14+
"stdin": {
15+
"alloc": {
16+
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": {
17+
"nonce": "0x00",
18+
"balance": "0x3635c9adc5dea00000",
19+
"code": "0x",
20+
"storage": {}
21+
}
22+
},
23+
"txs": [
24+
{
25+
"type": "0x0",
26+
"chainId": "0x0",
27+
"nonce": "0x0",
28+
"gasPrice": "0xa",
29+
"gas": "0x5f5e100",
30+
"value": "0x0",
31+
"input": "0x600d8060175f39805f80f05f805f805f855af1505ffffe600280600b5f39805ff3fe5fff",
32+
"sender": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
33+
"secretKey": "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
34+
"v": "0x1b",
35+
"r": "0xf2bb558b73cfb96466c41785fdd0f1e367b4703d49653e617cffdb7316a01e87",
36+
"s": "0x11e0423aeea027a1e48dc3adffe2b27652d8154599f10b6f552d51b1fcb632ae"
37+
}
38+
],
39+
"env": {
40+
"currentCoinbase": "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
41+
"currentGasLimit": "10000000000",
42+
"currentNumber": "1",
43+
"currentTimestamp": "1000",
44+
"currentRandom": "0",
45+
"currentDifficulty": "0",
46+
"parentDifficulty": "0",
47+
"parentBaseFee": "7",
48+
"parentGasUsed": "0",
49+
"parentGasLimit": "10000000000",
50+
"parentTimestamp": "0",
51+
"blockHashes": {
52+
"0": "0xc5d4b3d67827b580c95a2a0980670255c15bfb964e8c4183d18971659bd5b6a8"
53+
},
54+
"ommers": [],
55+
"withdrawals": [],
56+
"parentUncleHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
57+
"parentDataGasUsed": "0",
58+
"parentExcessDataGas": "0"
59+
}
60+
},
61+
"stdout": {
62+
"alloc": {
63+
"0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba": {
64+
"balance": "0x48540"
65+
},
66+
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": {
67+
"balance": "0x3635c9adc5de90ee80",
68+
"nonce": "0x1"
69+
}
70+
},
71+
"body": "0xf873f871800a8405f5e1008080a4600d8060175f39805f80f05f805f805f855af1505ffffe600280600b5f39805ff3fe5fff1ba0f2bb558b73cfb96466c41785fdd0f1e367b4703d49653e617cffdb7316a01e87a011e0423aeea027a1e48dc3adffe2b27652d8154599f10b6f552d51b1fcb632ae",
72+
"result": {
73+
"stateRoot": "0x8d6ff9ecb860b2ca140a73ae8591615e384a4e397d859af831b4a475e47ff7b0",
74+
"txRoot": "0x35ab0ce85af281d6e600d467fb3ed12063994cc9e105cbdb4eb1ba65ed9edddf",
75+
"receiptsRoot": "0x2f9ef11d9889ea86d77151c8a6cf578fed535563e1a016e67997d22984ca1bef",
76+
"logsHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
77+
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
78+
"receipts": [
79+
{
80+
"root": "0x",
81+
"status": "0x1",
82+
"cumulativeGasUsed": "0x181c0",
83+
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
84+
"logs": null,
85+
"transactionHash": "0xd954e10ebf0b55b71512b53a6ebae09372ccc6b2bf87b199e8aa8a5c4f757430",
86+
"contractAddress": "0x6295ee1b4f6dd65047762f924ecd367c17eabf8f",
87+
"gasUsed": "0x181c0",
88+
"blockHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
89+
"transactionIndex": "0x0"
90+
}
91+
],
92+
"currentDifficulty": null,
93+
"gasUsed": "0x181c0",
94+
"currentBaseFee": "0x7",
95+
"withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
96+
}
97+
}
98+
}

ethereum/evmtool/src/test/resources/org/hyperledger/besu/evmtool/t8n/cancun-blobs-per-tx.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
"input": "0x",
3737
"to": "0x0000000000000000000000000000000000000100",
3838
"accessList": [],
39-
"protected": true,
4039
"maxFeePerDataGas": "0x1",
4140
"sender": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
4241
"blobVersionedHashes": [

evm/src/main/java/org/hyperledger/besu/evm/MainnetEVMs.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -843,15 +843,18 @@ public static void registerCancunOperations(
843843
final BigInteger chainID) {
844844
registerShanghaiOperations(registry, gasCalculator, chainID);
845845

846-
// EIP-4844 DATAHASH
847-
registry.put(new DataHashOperation(gasCalculator));
848-
849846
// EIP-1153 TSTORE/TLOAD
850847
registry.put(new TStoreOperation(gasCalculator));
851848
registry.put(new TLoadOperation(gasCalculator));
852849

850+
// EIP-4844 DATAHASH
851+
registry.put(new DataHashOperation(gasCalculator));
852+
853853
// EIP-5656 MCOPY
854854
registry.put(new MCopyOperation(gasCalculator));
855+
856+
// EIP-6780 nerf self destruct
857+
registry.put(new SelfDestructOperation(gasCalculator, true));
855858
}
856859

857860
/**

0 commit comments

Comments
 (0)