Skip to content

Commit

Permalink
Merge pull request AmazingAng#516 from DNCBA/patch-2
Browse files Browse the repository at this point in the history
fix[DiveEVM2017]: Part6.md bytes count error
  • Loading branch information
AmazingAng authored Jun 30, 2023
2 parents 242bd67 + 7ecb90d commit df01b88
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions Topics/Translation/DiveEVM2017/DiveEVM2017-Part6.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ pragma solidity ^0.4.18;
contract Logger {
function Logger() public {
log0(0xc0fefe);
log0(0xc0fefefe);
}
}
```

生成的汇编可以分为两半。前半部分将日志数据(`0xc0fefe`​)从堆栈复制到内存中。后半部分将 `log0`​ 指令的参数放在堆栈上,告诉它在内存中加载数据的位置。
生成的汇编可以分为两半。前半部分将日志数据(`0xc0fefefe`​)从堆栈复制到内存中。后半部分将 `log0`​ 指令的参数放在堆栈上,告诉它在内存中加载数据的位置。

带注释的汇编:

Expand All @@ -89,19 +89,19 @@ memory: { 0x40 => 0x60 }

tag_1:
// copy data into memory
0xc0fefe
[0xc0fefe]
0xc0fefefe
[0xc0fefefe]
mload(0x40)
[0x60 0xc0fefe]
[0x60 0xc0fefefe]
swap1
[0xc0fefe 0x60]
[0xc0fefefe 0x60]
dup2
[0x60 0xc0fefe 0x60]
[0x60 0xc0fefefe 0x60]
mstore
[0x60]
memory: {
0x40 => 0x60
0x60 => 0xc0fefe
0x60 => 0xc0fefefe
}

// calculate data start position and size
Expand Down Expand Up @@ -163,7 +163,7 @@ pragma solidity ^0.4.18;
contract Logger {
function Logger() public {
log2(0xc0fefe, 0xaaaa1111, 0xbbbb2222);
log2(0xc0fefefe, 0xaaaa1111, 0xbbbb2222);
}
}
```
Expand All @@ -177,7 +177,7 @@ tag_1:
0xaaaa1111
// copy data into memory
0xc0fefe
0xc0fefefe
mload(0x40)
swap1
dup2
Expand All @@ -194,12 +194,12 @@ tag_1:
log2
```
数据还是 `0xc0fefe`​,复制到内存。在执行 `log2`​ 之前,EVM 的状态如下所示:
数据还是 `0xc0fefefe`​,复制到内存。在执行 `log2`​ 之前,EVM 的状态如下所示:
```shell
stack: [0x60 0x20 0xaaaa1111 0xbbbb2222]
memory: {
0x60: 0xc0fefe
0x60: 0xc0fefefe
}
log2
Expand Down Expand Up @@ -668,4 +668,4 @@ BloomBits[776] => 32768 bit vector (4096 byte)
日志设施的两种替代设计选择可能是:
* 允许更多数量的主题,尽管更多主题会降低用于按主题索引日志的布隆过滤器的有效性。
* 允许主题具有任意数量的字节。为什么不呢?
* 允许主题具有任意数量的字节。为什么不呢?

0 comments on commit df01b88

Please sign in to comment.