core: fix typos (#1237)

fixes various typos in core

Co-authored-by: 0xbstn <bastien-bouge@hotmail.fr>
This commit is contained in:
Daniel Liu 2025-07-26 17:42:50 +08:00 committed by GitHub
parent 32b929e781
commit 5561c27308
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 11 additions and 11 deletions

View file

@ -31,13 +31,13 @@ type ContractRef interface {
// AccountRef implements ContractRef. // AccountRef implements ContractRef.
// //
// Account references are used during EVM initialisation and // Account references are used during EVM initialisation and
// it's primary use is to fetch addresses. Removing this object // its primary use is to fetch addresses. Removing this object
// proves difficult because of the cached jump destinations which // proves difficult because of the cached jump destinations which
// are fetched from the parent contract (i.e. the caller), which // are fetched from the parent contract (i.e. the caller), which
// is a ContractRef. // is a ContractRef.
type AccountRef common.Address type AccountRef common.Address
// Address casts AccountRef to a Address // Address casts AccountRef to an Address
func (ar AccountRef) Address() common.Address { return (common.Address)(ar) } func (ar AccountRef) Address() common.Address { return (common.Address)(ar) }
// Contract represents an ethereum contract in the state database. It contains // Contract represents an ethereum contract in the state database. It contains

View file

@ -653,7 +653,7 @@ func BenchmarkPrecompiledRipeMD(bench *testing.B) {
benchmarkPrecompiled("03", t, bench) benchmarkPrecompiled("03", t, bench)
} }
// Benchmarks the sample inputs from the identiy precompile. // Benchmarks the sample inputs from the identity precompile.
func BenchmarkPrecompiledIdentity(bench *testing.B) { func BenchmarkPrecompiledIdentity(bench *testing.B) {
t := precompiledTest{ t := precompiledTest{
input: "38d18acb67d25c8bb9942764b62f18e17054f66a817bd4295423adf9ed98873e000000000000000000000000000000000000000000000000000000000000001b38d18acb67d25c8bb9942764b62f18e17054f66a817bd4295423adf9ed98873e789d1dd423d25f0772d2748d60f7e4b81bb14d086eba8e8e8efb6dcff8a4ae02", input: "38d18acb67d25c8bb9942764b62f18e17054f66a817bd4295423adf9ed98873e000000000000000000000000000000000000000000000000000000000000001b38d18acb67d25c8bb9942764b62f18e17054f66a817bd4295423adf9ed98873e789d1dd423d25f0772d2748d60f7e4b81bb14d086eba8e8e8efb6dcff8a4ae02",

View file

@ -105,7 +105,7 @@ func gasSStore(evm *EVM, contract *Contract, stack *Stack, mem *Memory, memorySi
// Legacy rules should be applied if we are in Petersburg (removal of EIP-1283) // Legacy rules should be applied if we are in Petersburg (removal of EIP-1283)
// OR Constantinople is not active // OR Constantinople is not active
if evm.chainRules.IsPetersburg || !evm.chainRules.IsConstantinople { if evm.chainRules.IsPetersburg || !evm.chainRules.IsConstantinople {
// This checks for 3 scenario's and calculates gas accordingly: // This checks for 3 scenarios and calculates gas accordingly:
// //
// 1. From a zero-value address to a non-zero value (NEW VALUE) // 1. From a zero-value address to a non-zero value (NEW VALUE)
// 2. From a non-zero value address to a zero-value address (DELETE) // 2. From a non-zero value address to a zero-value address (DELETE)

View file

@ -45,7 +45,7 @@ type EVMInterpreter struct {
table *JumpTable table *JumpTable
hasher crypto.KeccakState // Keccak256 hasher instance shared across opcodes hasher crypto.KeccakState // Keccak256 hasher instance shared across opcodes
hasherBuf common.Hash // Keccak256 hasher result array shared aross opcodes hasherBuf common.Hash // Keccak256 hasher result array shared across opcodes
readOnly bool // Whether to throw on stateful modifications readOnly bool // Whether to throw on stateful modifications
returnData []byte // Last CALL's return data for subsequent reuse returnData []byte // Last CALL's return data for subsequent reuse
@ -149,7 +149,7 @@ func (in *EVMInterpreter) Run(contract *Contract, input []byte, readOnly bool) (
debug = in.evm.Config.Tracer != nil debug = in.evm.Config.Tracer != nil
) )
// Don't move this deferred function, it's placed before the capturestate-deferred method, // Don't move this deferred function, it's placed before the capturestate-deferred method,
// so that it get's executed _after_: the capturestate needs the stacks before // so that it gets executed _after_: the capturestate needs the stacks before
// they are returned to the pools // they are returned to the pools
defer func() { defer func() {
returnStack(stack) returnStack(stack)

View file

@ -20,7 +20,7 @@ import (
"github.com/XinFinOrg/XDPoSChain/params" "github.com/XinFinOrg/XDPoSChain/params"
) )
// LookupInstructionSet returns the instructionset for the fork configured by // LookupInstructionSet returns the instruction set for the fork configured by
// the rules. // the rules.
func LookupInstructionSet(rules params.Rules) (JumpTable, error) { func LookupInstructionSet(rules params.Rules) (JumpTable, error) {
switch { switch {
@ -52,7 +52,7 @@ func LookupInstructionSet(rules params.Rules) (JumpTable, error) {
return newFrontierInstructionSet(), nil return newFrontierInstructionSet(), nil
} }
// Stack returns the mininum and maximum stack requirements. // Stack returns the minimum and maximum stack requirements.
func (op *operation) Stack() (int, int) { func (op *operation) Stack() (int, int) {
return op.minStack, op.maxStack return op.minStack, op.maxStack
} }

View file

@ -22,7 +22,7 @@ import (
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
// TestJumpTableCopy tests that deep copy is necessery to prevent modify shared jump table // TestJumpTableCopy tests that deep copy is necessary to prevent modify shared jump table
func TestJumpTableCopy(t *testing.T) { func TestJumpTableCopy(t *testing.T) {
tbl := newEip1559InstructionSet() tbl := newEip1559InstructionSet()
require.Equal(t, uint64(0), tbl[SLOAD].constantGas) require.Equal(t, uint64(0), tbl[SLOAD].constantGas)

View file

@ -219,7 +219,7 @@ var (
gasSStoreEIP3529 = makeGasSStoreFunc(params.SstoreClearsScheduleRefundEIP3529) gasSStoreEIP3529 = makeGasSStoreFunc(params.SstoreClearsScheduleRefundEIP3529)
) )
// makeSelfdestructGasFn can create the selfdestruct dynamic gas function for EIP-2929 and EIP-2539 // makeSelfdestructGasFn can create the selfdestruct dynamic gas function for EIP-2929 and EIP-3539
func makeSelfdestructGasFn(refundsEnabled bool) gasFunc { func makeSelfdestructGasFn(refundsEnabled bool) gasFunc {
gasFunc := func(evm *EVM, contract *Contract, stack *Stack, mem *Memory, memorySize uint64) (uint64, error) { gasFunc := func(evm *EVM, contract *Contract, stack *Stack, mem *Memory, memorySize uint64) (uint64, error) {
var ( var (

View file

@ -671,7 +671,7 @@ func TestColdAccountAccessCost(t *testing.T) {
for ii, op := range tracer.StructLogs() { for ii, op := range tracer.StructLogs() {
t.Logf("%d: %v %d", ii, op.OpName(), op.GasCost) t.Logf("%d: %v %d", ii, op.OpName(), op.GasCost)
} }
t.Fatalf("tescase %d, gas report wrong, step %d, have %d want %d", i, tc.step, have, want) t.Fatalf("testcase %d, gas report wrong, step %d, have %d want %d", i, tc.step, have, want)
} }
} }
} }