assembly - 为什么即使包含 JUMPDEST 也无法跳转到指令?

标签 assembly ethereum opcode evm stack-machine

这是我的整个程序。其背后的原因是以太坊上的程序越大,加载它的成本就越高(因为每字节的 Gas 成本非常高)。

CALLER
CALLDATASIZE
ISZERO
PUSH1 0x07
JUMPI
PUSH3 0x5b6000
SSTORE

所以我要跳入 PUSH3 0x5b6000 但如果我们反汇编 0x5b6000 那么这意味着

JUMPDEST
PUSH1 0x00

因此,由于 evm 操作码编码为 fully variable length (除了 PUSHxx 之外,所有指令都是一个字节长)并且我跳进了 JUMPDEST,为什么 this transaction 会这样?失败?

黄皮书中哪里指定前往 JUMPDEST 并不是有效跳转目的地的唯一要求?

最佳答案

我不确定 yellow paper 是哪个版本最初提出此问题时可用,但以下是 Istanbul 尔版本第 13 页的摘录:

9.4.3. Jump Destination Validity. We previously used D as the function to determine the set of valid jump destinations given the code that is being run. We define this as any position in the code occupied by a JUMPDEST instruction.

All such positions must be on valid instruction boundaries, rather than sitting in the data portion of PUSH operations and must appear within the explicitly defined portion of the code (rather than in the implicitly defined STOP operations that trail it).

这是 geth source location对此进行分析的代码。

关于assembly - 为什么即使包含 JUMPDEST 也无法跳转到指令?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64413862/

相关文章:

assembly - 为什么 BIOS 需要在第二条指令中将(看似)随机地址中的值与零进行比较?

组装 8086 |数组的总和,打印多位数字

ethereum - 未处理拒绝错误: This contract object doesn't have address set yet,请先设置一个地址

javascript - 类型错误 : Cannot read property '_alreadyWrapped' of undefined

opcode - PPC 的 rdtsc 操作码的等价物是什么?

c - 编程以填充我们系统的 L1 或 L2 缓存

c - 为什么 sizeof(size_t) 不是 1?

java - Web3J |找不到源 "@openzeppelin/contracts/token/ERC721/ERC721.sol": File not found

assembly - 各种 MOV 操作码之间有什么区别?