EIP-2929: add tx sender and address into the access list

This commit is contained in:
Wei Tang 2021-04-15 15:52:25 +02:00 committed by rakita
parent aa41520dd1
commit 0fd7c59724

View File

@ -1145,6 +1145,7 @@ impl<'a, B: 'a + StateBackend> Executive<'a, B> {
let mut access_list = AccessList::new(schedule.eip2929); let mut access_list = AccessList::new(schedule.eip2929);
if schedule.eip2929 { if schedule.eip2929 {
access_list.insert_address(sender);
for (address, builtin) in self.machine.builtins() { for (address, builtin) in self.machine.builtins() {
if builtin.is_active(self.info.number) { if builtin.is_active(self.info.number) {
access_list.insert_address(*address); access_list.insert_address(*address);
@ -1234,6 +1235,7 @@ impl<'a, B: 'a + StateBackend> Executive<'a, B> {
&nonce, &nonce,
&t.tx().data, &t.tx().data,
); );
access_list.insert_address(new_address);
let params = ActionParams { let params = ActionParams {
code_address: new_address.clone(), code_address: new_address.clone(),
code_hash: code_hash, code_hash: code_hash,
@ -1257,6 +1259,7 @@ impl<'a, B: 'a + StateBackend> Executive<'a, B> {
(res, out) (res, out)
} }
Action::Call(ref address) => { Action::Call(ref address) => {
access_list.insert_address(address.clone());
let params = ActionParams { let params = ActionParams {
code_address: address.clone(), code_address: address.clone(),
address: address.clone(), address: address.clone(),