Skip to content

Commit 9ee024c

Browse files
committed
chore: placate the linter
1 parent 2bae8dd commit 9ee024c

File tree

5 files changed

+21
-19
lines changed

5 files changed

+21
-19
lines changed

core/state/state.libevm.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727
func GetExtra[SA any](s *StateDB, p types.ExtraPayloads[SA], addr common.Address) SA {
2828
stateObject := s.getStateObject(addr)
2929
if stateObject != nil {
30-
return p.FromPayloadCarrier(&stateObject.data)
30+
return p.StateAccount.Get(&stateObject.data)
3131
}
3232
var zero SA
3333
return zero
@@ -45,9 +45,9 @@ func setExtraOnObject[SA any](s *stateObject, p types.ExtraPayloads[SA], addr co
4545
s.db.journal.append(extraChange[SA]{
4646
payloads: p,
4747
account: &addr,
48-
prev: p.FromPayloadCarrier(&s.data),
48+
prev: p.StateAccount.Get(&s.data),
4949
})
50-
p.SetOnPayloadCarrier(&s.data, extra)
50+
p.StateAccount.Set(&s.data, extra)
5151
}
5252

5353
// extraChange is a [journalEntry] for [SetExtra] / [setExtraOnObject].
@@ -60,5 +60,5 @@ type extraChange[SA any] struct {
6060
func (e extraChange[SA]) dirtied() *common.Address { return e.account }
6161

6262
func (e extraChange[SA]) revert(s *StateDB) {
63-
e.payloads.SetOnPayloadCarrier(&s.getStateObject(*e.account).data, e.prev)
63+
e.payloads.StateAccount.Set(&s.getStateObject(*e.account).data, e.prev)
6464
}

core/state/state.libevm_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func TestGetSetExtra(t *testing.T) {
8787
Root: types.EmptyRootHash,
8888
CodeHash: types.EmptyCodeHash[:],
8989
}
90-
payloads.SetOnPayloadCarrier(want, extra)
90+
payloads.StateAccount.Set(want, extra)
9191

9292
if diff := cmp.Diff(want, got); diff != "" {
9393
t.Errorf("types.FullAccount(%T.Account()) diff (-want +got):\n%s", iter, diff)

core/state/state_object.libevm_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func TestStateObjectEmpty(t *testing.T) {
4646
{
4747
name: "explicit false bool",
4848
registerAndSet: func(acc *types.StateAccount) {
49-
types.RegisterExtras[bool]().SetOnPayloadCarrier(acc, false)
49+
types.RegisterExtras[bool]().StateAccount.Set(acc, false)
5050
},
5151
wantEmpty: true,
5252
},
@@ -60,7 +60,7 @@ func TestStateObjectEmpty(t *testing.T) {
6060
{
6161
name: "true bool",
6262
registerAndSet: func(acc *types.StateAccount) {
63-
types.RegisterExtras[bool]().SetOnPayloadCarrier(acc, true)
63+
types.RegisterExtras[bool]().StateAccount.Set(acc, true)
6464
},
6565
wantEmpty: false,
6666
},

core/types/rlp_payload.libevm.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func RegisterExtras[SA any]() ExtraPayloads[SA] {
4242
}
4343

4444
extra := ExtraPayloads[SA]{
45-
Account: pseudo.NewAccessor[ExtraPayloadCarrier, SA](
45+
StateAccount: pseudo.NewAccessor[ExtraPayloadCarrier, SA](
4646
func(a ExtraPayloadCarrier) *pseudo.Type { return a.extra().payload() },
4747
func(a ExtraPayloadCarrier, t *pseudo.Type) { a.extra().t = t },
4848
),
@@ -91,7 +91,7 @@ func (e *StateAccountExtra) clone() *StateAccountExtra {
9191
// [StateAccount] and [SlimAccount] structs. The only valid way to construct an
9292
// instance is by a call to [RegisterExtras].
9393
type ExtraPayloads[SA any] struct {
94-
Account pseudo.Accessor[ExtraPayloadCarrier, SA]
94+
StateAccount pseudo.Accessor[ExtraPayloadCarrier, SA] // Also provides [SlimAccount] access.
9595
}
9696

9797
func (ExtraPayloads[SA]) cloneStateAccount(s *StateAccountExtra) *StateAccountExtra {
@@ -115,9 +115,9 @@ var _ = []ExtraPayloadCarrier{
115115

116116
// FromPayloadCarrier returns the carriers's payload.
117117
//
118-
// Deprecated: use the equivalent [ExtraPayloads.Account] method.
118+
// Deprecated: use the equivalent [ExtraPayloads.StateAccount] method.
119119
func (e ExtraPayloads[SA]) FromPayloadCarrier(a ExtraPayloadCarrier) SA {
120-
return e.Account.Get(a)
120+
return e.StateAccount.Get(a)
121121
}
122122

123123
// PointerFromPayloadCarrier returns a pointer to the carriers's extra payload.
@@ -128,16 +128,16 @@ func (e ExtraPayloads[SA]) FromPayloadCarrier(a ExtraPayloadCarrier) SA {
128128
// therefore be shared by all copies. If this is not the desired behaviour, use
129129
// [StateAccount.Copy] or [ExtraPayloads.SetOnPayloadCarrier].
130130
//
131-
// Deprecated: use the equivalent [ExtraPayloads.Account] method.
131+
// Deprecated: use the equivalent [ExtraPayloads.StateAccount] method.
132132
func (e ExtraPayloads[SA]) PointerFromPayloadCarrier(a ExtraPayloadCarrier) *SA {
133-
return e.Account.GetPointer(a)
133+
return e.StateAccount.GetPointer(a)
134134
}
135135

136136
// SetOnPayloadCarrier sets the carriers's payload.
137137
//
138-
// Deprecated: use the equivalent [ExtraPayloads.Account] method.
138+
// Deprecated: use the equivalent [ExtraPayloads.StateAccount] method.
139139
func (e ExtraPayloads[SA]) SetOnPayloadCarrier(a ExtraPayloadCarrier, val SA) {
140-
e.Account.Set(a, val)
140+
e.StateAccount.Set(a, val)
141141
}
142142

143143
// A StateAccountExtra carries the extra payload, if any, registered with

core/types/state_account_storage.libevm_test.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ func TestStateAccountExtraViaTrieStorage(t *testing.T) {
6363
{
6464
name: "vanilla geth",
6565
registerAndSetExtra: func(a *types.StateAccount) (*types.StateAccount, assertion) {
66+
//nolint:thelper // It's more useful if this test failure shows this line instead of its call site
6667
return a, func(t *testing.T, got *types.StateAccount) {
6768
assert.Truef(t, a.Extra.Equal(nil), "%T.%T.IsEmpty()", a, a.Extra)
6869
}
@@ -74,7 +75,7 @@ func TestStateAccountExtraViaTrieStorage(t *testing.T) {
7475
registerAndSetExtra: func(a *types.StateAccount) (*types.StateAccount, assertion) {
7576
e := types.RegisterExtras[bool]()
7677
e.SetOnPayloadCarrier(a, true)
77-
return a, func(t *testing.T, got *types.StateAccount) {
78+
return a, func(t *testing.T, got *types.StateAccount) { //nolint:thelper
7879
assert.Truef(t, e.FromPayloadCarrier(got), "")
7980
}
8081
},
@@ -85,7 +86,8 @@ func TestStateAccountExtraViaTrieStorage(t *testing.T) {
8586
registerAndSetExtra: func(a *types.StateAccount) (*types.StateAccount, assertion) {
8687
e := types.RegisterExtras[bool]()
8788
e.SetOnPayloadCarrier(a, false) // the explicit part
88-
return a, func(t *testing.T, got *types.StateAccount) {
89+
90+
return a, func(t *testing.T, got *types.StateAccount) { //nolint:thelper
8991
assert.Falsef(t, e.FromPayloadCarrier(got), "")
9092
}
9193
},
@@ -96,7 +98,7 @@ func TestStateAccountExtraViaTrieStorage(t *testing.T) {
9698
registerAndSetExtra: func(a *types.StateAccount) (*types.StateAccount, assertion) {
9799
e := types.RegisterExtras[bool]()
98100
// Note that `a` is reflected, unchanged (the implicit part).
99-
return a, func(t *testing.T, got *types.StateAccount) {
101+
return a, func(t *testing.T, got *types.StateAccount) { //nolint:thelper
100102
assert.Falsef(t, e.FromPayloadCarrier(got), "")
101103
}
102104
},
@@ -108,7 +110,7 @@ func TestStateAccountExtraViaTrieStorage(t *testing.T) {
108110
e := types.RegisterExtras[arbitraryPayload]()
109111
p := arbitraryPayload{arbitraryData}
110112
e.SetOnPayloadCarrier(a, p)
111-
return a, func(t *testing.T, got *types.StateAccount) {
113+
return a, func(t *testing.T, got *types.StateAccount) { //nolint:thelper
112114
assert.Equalf(t, arbitraryPayload{arbitraryData}, e.FromPayloadCarrier(got), "")
113115
}
114116
},

0 commit comments

Comments
 (0)