Skip to content

Commit

Permalink
Ignore deprecated calls
Browse files Browse the repository at this point in the history
On a per-call basis, to re-evaluate when introducing new ones.
  • Loading branch information
LuisPH3 committed Jul 15, 2024
1 parent 5353fe0 commit 3746be5
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
12 changes: 6 additions & 6 deletions go/ct/utils/adapter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func TestAdapter_ParameterConversion(t *testing.T) {
},
func(p tosca.Parameters) (any, any) {
ctxt := p.Context
return tosca.Word{}, ctxt.GetCommittedStorage(tosca.Address{}, tosca.Key{})
return tosca.Word{}, ctxt.GetCommittedStorage(tosca.Address{}, tosca.Key{}) //nolint:staticcheck
},
},
"storage-original-specified": {
Expand All @@ -175,7 +175,7 @@ func TestAdapter_ParameterConversion(t *testing.T) {
ctxt := p.Context
key1 := tosca.Key(cc.NewU256(1).Bytes32be())
val2 := tosca.Word(cc.NewU256(2).Bytes32be())
return val2, ctxt.GetCommittedStorage(tosca.Address{}, key1)
return val2, ctxt.GetCommittedStorage(tosca.Address{}, key1) //nolint:staticcheck
},
},
"cold-slot": {
Expand All @@ -184,7 +184,7 @@ func TestAdapter_ParameterConversion(t *testing.T) {
},
func(p tosca.Parameters) (any, any) {
ctxt := p.Context
_, res := ctxt.IsSlotInAccessList(tosca.Address{}, tosca.Key{})
_, res := ctxt.IsSlotInAccessList(tosca.Address{}, tosca.Key{}) //nolint:staticcheck
return false, res
},
},
Expand All @@ -196,7 +196,7 @@ func TestAdapter_ParameterConversion(t *testing.T) {
},
func(p tosca.Parameters) (any, any) {
ctxt := p.Context
_, res := ctxt.IsSlotInAccessList(tosca.Address{}, tosca.Key{})
_, res := ctxt.IsSlotInAccessList(tosca.Address{}, tosca.Key{}) //nolint:staticcheck
return true, res
},
},
Expand Down Expand Up @@ -310,7 +310,7 @@ func TestAdapter_ParameterConversion(t *testing.T) {
},
func(p tosca.Parameters) (any, any) {
ctxt := p.Context
return false, ctxt.IsAddressInAccessList(tosca.Address{})
return false, ctxt.IsAddressInAccessList(tosca.Address{}) //nolint:staticcheck
},
},
"warm-account-legacy": {
Expand All @@ -320,7 +320,7 @@ func TestAdapter_ParameterConversion(t *testing.T) {
},
func(p tosca.Parameters) (any, any) {
ctxt := p.Context
return true, ctxt.IsAddressInAccessList(tosca.Address{})
return true, ctxt.IsAddressInAccessList(tosca.Address{}) //nolint:staticcheck
},
},
}
Expand Down
8 changes: 4 additions & 4 deletions go/interpreter/geth/geth.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ func (s *stateDbAdapter) GetRefund() uint64 {
}

func (s *stateDbAdapter) GetCommittedState(addr common.Address, key common.Hash) common.Hash {
return common.Hash(s.context.GetCommittedStorage(tosca.Address(addr), tosca.Key(key)))
return common.Hash(s.context.GetCommittedStorage(tosca.Address(addr), tosca.Key(key))) //nolint:staticcheck
}

func (s *stateDbAdapter) GetState(addr common.Address, key common.Hash) common.Hash {
Expand Down Expand Up @@ -329,7 +329,7 @@ func (s *stateDbAdapter) SelfDestruct(addr common.Address) {
}

func (s *stateDbAdapter) HasSelfDestructed(addr common.Address) bool {
return s.context.HasSelfDestructed(tosca.Address(addr))
return s.context.HasSelfDestructed(tosca.Address(addr)) //nolint:staticcheck
}

func (s *stateDbAdapter) Selfdestruct6780(addr common.Address) {
Expand Down Expand Up @@ -361,11 +361,11 @@ func (s *stateDbAdapter) PrepareAccessList(sender common.Address, dest *common.A
}

func (s *stateDbAdapter) AddressInAccessList(addr common.Address) bool {
return s.context.IsAddressInAccessList(tosca.Address(addr))
return s.context.IsAddressInAccessList(tosca.Address(addr)) //nolint:staticcheck
}

func (s *stateDbAdapter) SlotInAccessList(addr common.Address, slot common.Hash) (addressOk bool, slotOk bool) {
return s.context.IsSlotInAccessList(tosca.Address(addr), tosca.Key(slot))
return s.context.IsSlotInAccessList(tosca.Address(addr), tosca.Key(slot)) //nolint:staticcheck
}

func (s *stateDbAdapter) AddAddressToAccessList(addr common.Address) {
Expand Down
16 changes: 8 additions & 8 deletions go/interpreter/lfvm/gas.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ func gasSStoreEIP2200(c *context) (tosca.Gas, error) {
if current == value { // noop (1)
return tosca.Gas(params.SloadGasEIP2200), nil
}
original := c.context.GetCommittedStorage(c.params.Recipient, key)
original := c.context.GetCommittedStorage(c.params.Recipient, key) //nolint:staticcheck
if original == current {
if original == zero { // create slot (2.1.1)
return tosca.Gas(params.SstoreSetGasEIP2200), nil
Expand Down Expand Up @@ -360,7 +360,7 @@ func gasSStoreEIP2929(c *context) (tosca.Gas, error) {
cost = tosca.Gas(0)
)
// Check slot presence in the access list
if addrPresent, slotPresent := c.context.IsSlotInAccessList(c.params.Recipient, slot); !slotPresent {
if addrPresent, slotPresent := c.context.IsSlotInAccessList(c.params.Recipient, slot); !slotPresent { //nolint:staticcheck
if !addrPresent {
c.status = ERROR
return 0, errors.New("address was not present in access list during sstore op")
Expand All @@ -374,7 +374,7 @@ func gasSStoreEIP2929(c *context) (tosca.Gas, error) {
if current == value { // noop (1)
return cost + tosca.Gas(params.WarmStorageReadCostEIP2929), nil // SLOAD_GAS
}
original := c.context.GetCommittedStorage(c.params.Recipient, slot)
original := c.context.GetCommittedStorage(c.params.Recipient, slot) //nolint:staticcheck
if original == current {
if original == zero { // create slot (2.1.1)
return cost + tosca.Gas(params.SstoreSetGasEIP2200), nil
Expand Down Expand Up @@ -404,7 +404,7 @@ func gasSStoreEIP2929(c *context) (tosca.Gas, error) {
func gasEip2929AccountCheck(c *context, address tosca.Address) error {
if c.isBerlin() {
// Charge extra for cold locations.
if !c.context.IsAddressInAccessList(address) {
if !c.context.IsAddressInAccessList(address) { //nolint:staticcheck
if !c.UseGas(tosca.Gas(params.ColdAccountAccessCostEIP2929 - params.WarmStorageReadCostEIP2929)) {
return errOutOfGas
}
Expand All @@ -419,7 +419,7 @@ func addressInAccessList(c *context) (warmAccess bool, coldCost tosca.Gas, err e
if c.isBerlin() {
addr := tosca.Address(c.stack.Back(1).Bytes20())
// Check slot presence in the access list
warmAccess = c.context.IsAddressInAccessList(addr)
warmAccess = c.context.IsAddressInAccessList(addr) //nolint:staticcheck
// The WarmStorageReadCostEIP2929 (100) is already deducted in the form of a constant cost, so
// the cost to charge for cold access, if any, is Cold - Warm
coldCost = tosca.Gas(params.ColdAccountAccessCostEIP2929 - params.WarmStorageReadCostEIP2929)
Expand All @@ -443,7 +443,7 @@ func gasSelfdestruct(c *context) tosca.Gas {
if !c.context.AccountExists(address) && c.context.GetBalance(c.params.Recipient) != (tosca.Value{}) {
gas += tosca.Gas(params.CreateBySelfdestructGas)
}
if !c.context.HasSelfDestructed(c.params.Recipient) {
if !c.context.HasSelfDestructed(c.params.Recipient) { //nolint:staticcheck
c.refund += tosca.Gas(params.SelfdestructRefundGas)
}
return gas
Expand All @@ -454,7 +454,7 @@ func gasSelfdestructEIP2929(c *context) tosca.Gas {
gas tosca.Gas
address = tosca.Address(c.stack.Back(0).Bytes20())
)
if !c.context.IsAddressInAccessList(address) {
if !c.context.IsAddressInAccessList(address) { //nolint:staticcheck
// If the caller cannot afford the cost, this change will be rolled back
c.context.AccessAccount(address)
gas = tosca.Gas(params.ColdAccountAccessCostEIP2929)
Expand All @@ -465,7 +465,7 @@ func gasSelfdestructEIP2929(c *context) tosca.Gas {
}
// do this only for Berlin and not after London fork
if c.isBerlin() && !c.isLondon() {
if !c.context.HasSelfDestructed(c.params.Recipient) {
if !c.context.HasSelfDestructed(c.params.Recipient) { //nolint:staticcheck
c.refund += tosca.Gas(params.SelfdestructRefundGas)
}
}
Expand Down
2 changes: 1 addition & 1 deletion go/interpreter/lfvm/instructions.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ func opSload(c *context) {
slot := tosca.Key(top.Bytes32())
if c.isBerlin() {
// Check slot presence in the access list
if _, slotPresent := c.context.IsSlotInAccessList(c.params.Recipient, slot); !slotPresent {
if _, slotPresent := c.context.IsSlotInAccessList(c.params.Recipient, slot); !slotPresent { //nolint:staticcheck
// If the caller cannot afford the cost, this change will be rolled back
// If he does afford it, we can skip checking the same thing later on, during execution
c.context.AccessStorage(c.params.Recipient, slot)
Expand Down

0 comments on commit 3746be5

Please sign in to comment.