Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
472 changes: 472 additions & 0 deletions eth/tracers/live/tx_gas_dimension.go

Large diffs are not rendered by default.

326 changes: 0 additions & 326 deletions eth/tracers/live/tx_gas_dimension_by_opcode.go

This file was deleted.

44 changes: 44 additions & 0 deletions eth/tracers/logger/access_list_tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ func (al accessList) addAddress(address common.Address) {
}
}

// hasAddress checks if an address is in the accesslist.
func (al accessList) hasAddress(address common.Address) bool {
_, ok := al[address]
return ok
}

// addSlot adds a storage slot to the accesslist.
func (al accessList) addSlot(address common.Address, slot common.Hash) {
// Set address if not previously present
Expand All @@ -55,6 +61,12 @@ func (al accessList) addSlot(address common.Address, slot common.Hash) {
al[address][slot] = struct{}{}
}

// hasSlot checks if a storage slot is in the accesslist.
func (al accessList) hasSlot(address common.Address, slot common.Hash) bool {
_, ok := al[address][slot]
return ok
}

// equal checks if the content of the current access list is the same as the
// content of the other one.
func (al accessList) equal(other accessList) bool {
Expand Down Expand Up @@ -146,6 +158,28 @@ func (a *AccessListTracer) OnOpcode(pc uint64, opcode byte, gas, cost uint64, sc
a.list.addAddress(addr)
}
}
/*
if op == vm.CREATE {
nonce := a.env.StateDB.GetNonce(caller)
addr := crypto.CreateAddress(caller, nonce)
a.lookupAccount(addr)
a.created[addr] = true
}
if stackLen >= 4 && op == vm.CREATE2 {
offset := stackData[stackLen-2]
size := stackData[stackLen-3]
init, err := internal.GetMemoryCopyPadded(scope.MemoryData(), int64(offset.Uint64()), int64(size.Uint64()))
if err != nil {
log.Warn("failed to copy CREATE2 input", "err", err, "tracer", "prestateTracer", "offset", offset, "size", size)
return
}
inithash := crypto.Keccak256(init)
salt := stackData[stackLen-4]
addr := crypto.CreateAddress2(caller, salt.Bytes32(), inithash)
a.lookupAccount(addr)
a.created[addr] = true
}
*/
}

// AccessList returns the current accesslist maintained by the tracer.
Expand All @@ -157,3 +191,13 @@ func (a *AccessListTracer) AccessList() types.AccessList {
func (a *AccessListTracer) Equal(other *AccessListTracer) bool {
return a.list.equal(other.list)
}

// HasAddress checks if an address is in the accesslist.
func (a *AccessListTracer) HasAddress(address common.Address) bool {
return a.list.hasAddress(address)
}

// HasSlot checks if a storage slot is in the accesslist.
func (a *AccessListTracer) HasSlot(address common.Address, slot common.Hash) bool {
return a.list.hasSlot(address, slot)
}
Loading
Loading