rm withdrawn EIP-2315 (#2309)
* rm withdrawn EIP-2315 * copyright year linting * EVMC
This commit is contained in:
parent
c5b3081828
commit
d9375858fe
|
@ -21,7 +21,6 @@ import
|
|||
chronicles,
|
||||
confutils,
|
||||
confutils/defs,
|
||||
stew/byteutils,
|
||||
confutils/std/net
|
||||
],
|
||||
eth/[common, net/utils, net/nat, p2p/bootnodes, p2p/enode, p2p/discoveryv5/enr],
|
||||
|
@ -532,23 +531,6 @@ func parseCmdArg(T: type NetworkId, p: string): T
|
|||
func completeCmdArg(T: type NetworkId, val: string): seq[string] =
|
||||
return @[]
|
||||
|
||||
func parseCmdArg(T: type UInt256, p: string): T
|
||||
{.gcsafe, raises: [ValueError].} =
|
||||
parse(p, T)
|
||||
|
||||
func completeCmdArg(T: type UInt256, val: string): seq[string] =
|
||||
return @[]
|
||||
|
||||
func parseCmdArg(T: type EthAddress, p: string): T
|
||||
{.gcsafe, raises: [ValueError].}=
|
||||
try:
|
||||
result = hexToByteArray(p, 20)
|
||||
except CatchableError:
|
||||
raise newException(ValueError, "failed to parse EthAddress")
|
||||
|
||||
func completeCmdArg(T: type EthAddress, val: string): seq[string] =
|
||||
return @[]
|
||||
|
||||
func parseCmdArg*(T: type enr.Record, p: string): T {.raises: [ValueError].} =
|
||||
if not fromURI(result, p):
|
||||
raise newException(ValueError, "Invalid ENR")
|
||||
|
|
|
@ -104,7 +104,7 @@ template sstoreEvmcOrNetGasMetering(cpt, slot, newValue: untyped, coldAccess = 0
|
|||
else:
|
||||
sstoreNetGasMeteringImpl(cpt, slot, newValue, coldAccess)
|
||||
|
||||
proc jumpImpl(c: Computation; jumpTarget: UInt256) {.catchRaise.} =
|
||||
func jumpImpl(c: Computation; jumpTarget: UInt256) {.catchRaise.} =
|
||||
if jumpTarget >= c.code.len.u256:
|
||||
raise newException(
|
||||
InvalidJumpDestination, "Invalid Jump Destination")
|
||||
|
@ -126,7 +126,7 @@ proc jumpImpl(c: Computation; jumpTarget: UInt256) {.catchRaise.} =
|
|||
# ------------------------------------------------------------------------------
|
||||
|
||||
const
|
||||
popOp: Vm2OpFn = proc (k: var Vm2Ctx) {.catchRaise.} =
|
||||
popOp: Vm2OpFn = func (k: var Vm2Ctx) {.catchRaise.} =
|
||||
## 0x50, Remove item from stack.
|
||||
discard k.cpt.stack.popInt
|
||||
|
||||
|
@ -256,35 +256,35 @@ const
|
|||
|
||||
# -------
|
||||
|
||||
jumpOp: Vm2OpFn = proc (k: var Vm2Ctx) {.catchRaise.} =
|
||||
jumpOp: Vm2OpFn = func (k: var Vm2Ctx) {.catchRaise.} =
|
||||
## 0x56, Alter the program counter
|
||||
let (jumpTarget) = k.cpt.stack.popInt(1)
|
||||
jumpImpl(k.cpt, jumpTarget)
|
||||
|
||||
jumpIOp: Vm2OpFn = proc (k: var Vm2Ctx) {.catchRaise.} =
|
||||
jumpIOp: Vm2OpFn = func (k: var Vm2Ctx) {.catchRaise.} =
|
||||
## 0x57, Conditionally alter the program counter.
|
||||
let (jumpTarget, testedValue) = k.cpt.stack.popInt(2)
|
||||
if testedValue.isZero.not:
|
||||
jumpImpl(k.cpt, jumpTarget)
|
||||
|
||||
pcOp: Vm2OpFn = proc (k: var Vm2Ctx) {.catchRaise.} =
|
||||
pcOp: Vm2OpFn = func (k: var Vm2Ctx) {.catchRaise.} =
|
||||
## 0x58, Get the value of the program counter prior to the increment
|
||||
## corresponding to this instruction.
|
||||
k.cpt.stack.push:
|
||||
max(k.cpt.code.pc - 1, 0)
|
||||
|
||||
msizeOp: Vm2OpFn = proc (k: var Vm2Ctx) {.catchRaise.} =
|
||||
msizeOp: Vm2OpFn = func (k: var Vm2Ctx) {.catchRaise.} =
|
||||
## 0x59, Get the size of active memory in bytes.
|
||||
k.cpt.stack.push:
|
||||
k.cpt.memory.len
|
||||
|
||||
gasOp: Vm2OpFn = proc (k: var Vm2Ctx) {.catchRaise.} =
|
||||
gasOp: Vm2OpFn = func (k: var Vm2Ctx) {.catchRaise.} =
|
||||
## 0x5a, Get the amount of available gas, including the corresponding
|
||||
## reduction for the cost of this instruction.
|
||||
k.cpt.stack.push:
|
||||
k.cpt.gasMeter.gasRemaining
|
||||
|
||||
jumpDestOp: Vm2OpFn = proc (k: var Vm2Ctx) =
|
||||
jumpDestOp: Vm2OpFn = func (k: var Vm2Ctx) =
|
||||
## 0x5b, Mark a valid destination for jumps. This operation has no effect
|
||||
## on machine state during execution.
|
||||
discard
|
||||
|
@ -318,50 +318,6 @@ const
|
|||
|
||||
k.cpt.memory.copy(dstPos, srcPos, len)
|
||||
|
||||
#[
|
||||
EIP-2315: temporary disabled
|
||||
Reason : not included in berlin hard fork
|
||||
beginSubOp: Vm2OpFn = proc (k: var Vm2Ctx) =
|
||||
## 0x5c, Marks the entry point to a subroutine
|
||||
raise newException(
|
||||
OutOfGas,
|
||||
"Abort: Attempt to execute BeginSub opcode")
|
||||
|
||||
|
||||
returnSubOp: Vm2OpFn = proc (k: var Vm2Ctx) =
|
||||
## 0x5d, Returns control to the caller of a subroutine.
|
||||
if k.cpt.returnStack.len == 0:
|
||||
raise newException(
|
||||
OutOfGas,
|
||||
"Abort: invalid returnStack during ReturnSub")
|
||||
k.cpt.code.pc = k.cpt.returnStack.pop()
|
||||
|
||||
|
||||
jumpSubOp: Vm2OpFn = proc (k: var Vm2Ctx) =
|
||||
## 0x5e, Transfers control to a subroutine.
|
||||
let (jumpTarget) = k.cpt.stack.popInt(1)
|
||||
|
||||
if jumpTarget >= k.cpt.code.len.u256:
|
||||
raise newException(
|
||||
InvalidJumpDestination, "JumpSub destination exceeds code len")
|
||||
|
||||
let returnPC = k.cpt.code.pc
|
||||
let jt = jumpTarget.truncate(int)
|
||||
k.cpt.code.pc = jt
|
||||
|
||||
let nextOpcode = k.cpt.code.peek
|
||||
if nextOpcode != BeginSub:
|
||||
raise newException(
|
||||
InvalidJumpDestination, "Invalid JumpSub destination")
|
||||
|
||||
if k.cpt.returnStack.len == 1023:
|
||||
raise newException(
|
||||
FullStack, "Out of returnStack")
|
||||
|
||||
k.cpt.returnStack.add returnPC
|
||||
inc k.cpt.code.pc
|
||||
]#
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Public, op exec table entries
|
||||
# ------------------------------------------------------------------------------
|
||||
|
@ -532,34 +488,6 @@ const
|
|||
run: mCopyOp,
|
||||
post: vm2OpIgnore))]
|
||||
|
||||
#[
|
||||
EIP-2315: temporary disabled
|
||||
Reason : not included in berlin hard fork
|
||||
(opCode: BeginSub, ## 0x5c, Begin subroutine
|
||||
forks: Vm2OpBerlinAndLater,
|
||||
name: "beginSub",
|
||||
info: " Marks the entry point to a subroutine",
|
||||
exec: (prep: vm2OpIgnore,
|
||||
run: beginSubOp,
|
||||
post: vm2OpIgnore)),
|
||||
|
||||
(opCode: ReturnSub, ## 0x5d, Return
|
||||
forks: Vm2OpBerlinAndLater,
|
||||
name: "returnSub",
|
||||
info: "Returns control to the caller of a subroutine",
|
||||
exec: (prep: vm2OpIgnore,
|
||||
run: returnSubOp,
|
||||
post: vm2OpIgnore)),
|
||||
|
||||
(opCode: JumpSub, ## 0x5e, Call subroutine
|
||||
forks: Vm2OpBerlinAndLater,
|
||||
name: "jumpSub",
|
||||
info: "Transfers control to a subroutine",
|
||||
exec: (prep: vm2OpIgnore,
|
||||
run: jumpSubOp,
|
||||
post: vm2OpIgnore))]
|
||||
]#
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# End
|
||||
# ------------------------------------------------------------------------------
|
||||
|
|
|
@ -35,17 +35,12 @@ proc setupTxContext*(vmState: BaseVMState,
|
|||
vmState.determineFork
|
||||
vmState.gasCosts = vmState.fork.forkToSchedule
|
||||
|
||||
# FIXME-awkwardFactoring: the factoring out of the pre and
|
||||
# post parts feels awkward to me, but for now I'd really like
|
||||
# not to have too much duplicated code between sync and async.
|
||||
# --Adam
|
||||
|
||||
proc preExecComputation(c: Computation) =
|
||||
if not c.msg.isCreate:
|
||||
c.vmState.mutateStateDB:
|
||||
db.incNonce(c.msg.sender)
|
||||
|
||||
proc postExecComputation(c: Computation) =
|
||||
func postExecComputation(c: Computation) =
|
||||
if c.isSuccess:
|
||||
if c.fork < FkLondon:
|
||||
# EIP-3529: Reduction in refunds
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
hacknet/
|
|
@ -1,41 +0,0 @@
|
|||
{
|
||||
"config": {
|
||||
"chainId": 1,
|
||||
"homesteadBlock": 0,
|
||||
"daoForkBlock": 0,
|
||||
"daoForkSupport": true,
|
||||
"eip150Block": 0,
|
||||
"eip155Block": 0,
|
||||
"eip158Block": 0,
|
||||
"byzantiumBlock": 0,
|
||||
"constantinopleBlock": 0,
|
||||
"petersburgBlock": 0,
|
||||
"istanbulBlock": 0,
|
||||
"muirGlacierBlock": 0,
|
||||
"berlinBlock": 0,
|
||||
"londonBlock": 0,
|
||||
"clique": {
|
||||
"period": 5,
|
||||
"epoch": 30000
|
||||
},
|
||||
"terminalTotalDifficulty": 0
|
||||
},
|
||||
"genesis": {
|
||||
"nonce": "0x42",
|
||||
"timestamp": "0x0",
|
||||
"extraData": "0x0000000000000000000000000000000000000000000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"gasLimit": "0x1C9C380",
|
||||
"difficulty": "0x400000000",
|
||||
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"coinbase": "0x0000000000000000000000000000000000000000",
|
||||
"alloc": {
|
||||
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": {
|
||||
"balance": "0x6d6172697573766477000000"
|
||||
}
|
||||
},
|
||||
"number": "0x0",
|
||||
"gasUsed": "0x0",
|
||||
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"baseFeePerGas": "0x7"
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
set -Eeuo pipefail
|
||||
|
||||
# https://notes.ethereum.org/@9AeMAlpyQYaAAyuj47BzRw/rkwW3ceVY
|
||||
#
|
||||
# git clone --branch merge-interop-spec https://github.com/MariusVanDerWijden/go-ethereum.git
|
||||
#
|
||||
# Last checked against geth as of
|
||||
# commit d6b04900423634d27be1178edf46622394085bb9 (HEAD -> merge-interop-spec, origin/merge-interop-spec)
|
||||
# Author: Marius van der Wijden <m.vanderwijden@live.de>
|
||||
# Date: Wed Sep 29 19:24:56 2021 +0200
|
||||
#
|
||||
# eth/catalyst: fix random in payload, payloadid as hexutil
|
||||
|
||||
# Get the payload
|
||||
resp_get_payload=$(curl -sX POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"engine_getPayloadV1","params":["0x0"],"id":67}' http://localhost:8550)
|
||||
echo "engine_getPayloadV1 response: ${resp_get_payload}"
|
||||
|
||||
expected_resp_get_payload='{"jsonrpc":"2.0","id":67,"result":{"blockHash":"0xb084c10440f05f5a23a55d1d7ebcb1b3892935fb56f23cdc9a7f42c348eed174","parentHash":"0xa0513a503d5bd6e89a144c3268e5b7e9da9dbf63df125a360e3950a7d0d67131","coinbase":"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b","stateRoot":"0xca3149fa9e37db08d1cd49c9061db1002ef1cd58db2210f2115c8c989b2bdf45","receiptRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","random":"0x0000000000000000000000000000000000000000000000000000000000000000","blockNumber":"0x1","gasLimit":"0x989680","gasUsed":"0x0","timestamp":"0x5","extraData":"0x","baseFeePerGas":"0x0","transactions":[]}}'
|
||||
empirical_resp_get_payload='{"jsonrpc":"2.0","id":67,"result":{"blockHash":"0x7a694c5e6e372e6f865b073c101c2fba01f899f16480eb13f7e333a3b7e015bc","parentHash":"0xa0513a503d5bd6e89a144c3268e5b7e9da9dbf63df125a360e3950a7d0d67131","coinbase":"0x0000000000000000000000000000000000000000","stateRoot":"0xca3149fa9e37db08d1cd49c9061db1002ef1cd58db2210f2115c8c989b2bdf45","receiptRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","random":"0x0000000000000000000000000000000000000000000000000000000000000000","blockNumber":"0x1","gasLimit":"0x989680","gasUsed":"0x0","timestamp":"0x5","extraData":"0x","baseFeePerGas":"0x0","transactions":[]}}'
|
||||
[[ ${resp_get_payload} == ${expected_resp_get_payload} ]] || [[ ${resp_get_payload} == ${empirical_resp_get_payload} ]] || (echo "Unexpected response to engine_getPayloadV1"; false)
|
||||
|
||||
# Execute the payload
|
||||
# Needed two tweaks vs upstream note: (a) add blockNumber field and (b) switch receiptRoots to receiptRoot
|
||||
resp_execute_payload=$(curl -sX POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"engine_executePayloadV1","params":[{"blockHash":"0x3559e851470f6e7bbed1db474980683e8c315bfce99b2a6ef47c057c04de7858","parentHash":"0x3b8fb240d288781d4aac94d3fd16809ee413bc99294a085798a589dae51ddd4a","coinbase":"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b","stateRoot":"0xca3149fa9e37db08d1cd49c9061db1002ef1cd58db2210f2115c8c989b2bdf45","receiptRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","random":"0x0000000000000000000000000000000000000000000000000000000000000000","blockNumber":"0x1","gasLimit":"0x1c9c380","gasUsed":"0x0","timestamp":"0x5","extraData":"0x","baseFeePerGas":"0x7","transactions":[]}],"id":67}' http://localhost:8550)
|
||||
[[ ${resp_execute_payload} == '{"jsonrpc":"2.0","id":67,"result":{"status":"VALID"}}' ]] || (echo "Unexpected response to engine_executePayloadV1"; false)
|
||||
|
||||
# Update the fork choice
|
||||
resp_fork_choice_updated=$(curl -sX POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"engine_forkchoiceUpdatedV1","params":[{"headBlockHash":"0x3559e851470f6e7bbed1db474980683e8c315bfce99b2a6ef47c057c04de7858", "finalizedBlockHash":"0x3559e851470f6e7bbed1db474980683e8c315bfce99b2a6ef47c057c04de7858"}],"id":67}' http://localhost:8550)
|
||||
[[ ${resp_consensus_validated} == '{"jsonrpc":"2.0","id":67,"result":null}' ]] || (echo "Unexpected response to engine_forkchoiceUpdatedV1"; false)
|
||||
|
||||
echo "Execution test vectors for Merge passed"
|
|
@ -1,26 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -eu
|
||||
|
||||
SCRIPT_DIR=$(cd $(dirname "$0") && pwd)
|
||||
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
if [[ ! -d hacknet ]]; then
|
||||
git clone https://github.com/karalabe/hacknet/
|
||||
fi
|
||||
|
||||
DATA_DIR=hacknet/data/nimbus-eth1
|
||||
mkdir -p $DATA_DIR
|
||||
|
||||
BOOT_NODE=enode://e95870e55cf62fd3d7091d7e0254d10ead007a1ac64ea071296a603d94694b8d92b49f9a3d3851d9aa95ee1452de8b854e0d5e095ef58cc25e7291e7588f4dfc@35.178.114.73:30303
|
||||
|
||||
$SCRIPT_DIR/../../build/nimbus \
|
||||
--log-level:DEBUG \
|
||||
--data-dir:"$SCRIPT_DIR/$DATA_DIR" \
|
||||
--custom-network:"$SCRIPT_DIR/hacknet/v2/genesis.json" \
|
||||
--bootstrap-node:$BOOT_NODE \
|
||||
--network:1337002 \
|
||||
--engine-api \
|
||||
--rpc
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
# set -Eeuo pipefail
|
||||
|
||||
# https://notes.ethereum.org/@9AeMAlpyQYaAAyuj47BzRw/rkwW3ceVY
|
||||
|
||||
# To increase verbosity: debug.verbosity(4)
|
||||
# MetaMask seed phrase for address with balance is:
|
||||
# lecture manual soon title cloth uncle gesture cereal common fruit tooth crater
|
||||
|
||||
set -eu
|
||||
|
||||
SCRIPT_DIR=$(cd $(dirname "$0") && pwd)
|
||||
|
||||
DATA_DIR=$(mktemp -d)
|
||||
echo Using data dir ${DATA_DIR}
|
||||
|
||||
$SCRIPT_DIR/../../build/nimbus \
|
||||
--log-level:TRACE \
|
||||
--data-dir:"${DATA_DIR}" \
|
||||
--custom-network:"$SCRIPT_DIR/amphora-interop-genesis-m1.json" \
|
||||
--network:0 \
|
||||
--engine-api \
|
||||
--engine-api-port:8545 \
|
||||
--rpc \
|
||||
--nat:none --discovery:none \
|
||||
--import-key:"$SCRIPT_DIR/signer-key.txt" \
|
||||
--engine-signer:0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b
|
||||
|
|
@ -1 +0,0 @@
|
|||
0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8
|
|
@ -1,5 +1,5 @@
|
|||
# Nimbus
|
||||
# Copyright (c) 2018-2023 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-2024 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
|
||||
# * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
|
||||
|
@ -31,7 +31,8 @@ const
|
|||
FkIstanbul: "Istanbul",
|
||||
FkBerlin: "Berlin",
|
||||
FkLondon: "London",
|
||||
FkParis: "Merge"
|
||||
FkParis: "Merge",
|
||||
FkPrague: "Prague",
|
||||
}.toTable
|
||||
|
||||
nameToFork* = revmap(forkNames)
|
||||
|
|
Loading…
Reference in New Issue