Skip to content

Commit

Permalink
update API usage, new parameters location range and transfer elements…
Browse files Browse the repository at this point in the history
… need to be passed
  • Loading branch information
turbolent committed Mar 1, 2024
1 parent 2fdbf62 commit f19e509
Showing 1 changed file with 177 additions and 144 deletions.
321 changes: 177 additions & 144 deletions fvm/evm/stdlib/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,73 +112,85 @@ func (e abiDecodingError) Error() string {

func reportABIEncodingComputation(
inter *interpreter.Interpreter,
locationRange interpreter.LocationRange,
values *interpreter.ArrayValue,
evmAddressTypeID common.TypeID,
reportComputation func(intensity uint),
) {
values.Iterate(inter, func(element interpreter.Value) (resume bool) {
switch value := element.(type) {
case *interpreter.StringValue:
// Dynamic variables, such as strings, are encoded
// in 2+ chunks of 32 bytes. The first chunk contains
// the index where information for the string begin,
// the second chunk contains the number of bytes the
// string occupies, and the third chunk contains the
// value of the string itself.
computation := uint(2 * abiEncodingByteSize)
stringLength := len(value.Str)
chunks := math.Ceil(float64(stringLength) / float64(abiEncodingByteSize))
computation += uint(chunks * abiEncodingByteSize)
reportComputation(computation)

case interpreter.BoolValue,
interpreter.UInt8Value,
interpreter.UInt16Value,
interpreter.UInt32Value,
interpreter.UInt64Value,
interpreter.UInt128Value,
interpreter.UInt256Value,
interpreter.Int8Value,
interpreter.Int16Value,
interpreter.Int32Value,
interpreter.Int64Value,
interpreter.Int128Value,
interpreter.Int256Value:

// Numeric and bool variables are also static variables
// with a fixed size of 32 bytes.
reportComputation(abiEncodingByteSize)

case *interpreter.CompositeValue:
if value.TypeID() == evmAddressTypeID {
// EVM addresses are static variables with a fixed
// size of 32 bytes.
values.Iterate(
inter,
func(element interpreter.Value) (resume bool) {
switch value := element.(type) {
case *interpreter.StringValue:
// Dynamic variables, such as strings, are encoded
// in 2+ chunks of 32 bytes. The first chunk contains
// the index where information for the string begin,
// the second chunk contains the number of bytes the
// string occupies, and the third chunk contains the
// value of the string itself.
computation := uint(2 * abiEncodingByteSize)
stringLength := len(value.Str)
chunks := math.Ceil(float64(stringLength) / float64(abiEncodingByteSize))
computation += uint(chunks * abiEncodingByteSize)
reportComputation(computation)

case interpreter.BoolValue,
interpreter.UInt8Value,
interpreter.UInt16Value,
interpreter.UInt32Value,
interpreter.UInt64Value,
interpreter.UInt128Value,
interpreter.UInt256Value,
interpreter.Int8Value,
interpreter.Int16Value,
interpreter.Int32Value,
interpreter.Int64Value,
interpreter.Int128Value,
interpreter.Int256Value:

// Numeric and bool variables are also static variables
// with a fixed size of 32 bytes.
reportComputation(abiEncodingByteSize)
} else {

case *interpreter.CompositeValue:
if value.TypeID() == evmAddressTypeID {
// EVM addresses are static variables with a fixed
// size of 32 bytes.
reportComputation(abiEncodingByteSize)
} else {
panic(abiEncodingError{
Type: value.StaticType(inter),
})
}
case *interpreter.ArrayValue:
// Dynamic variables, such as arrays & slices, are encoded
// in 2+ chunks of 32 bytes. The first chunk contains
// the index where information for the array begin,
// the second chunk contains the number of bytes the
// array occupies, and the third chunk contains the
// values of the array itself.
computation := uint(2 * abiEncodingByteSize)
reportComputation(computation)
reportABIEncodingComputation(
inter,
locationRange,
value,
evmAddressTypeID,
reportComputation,
)

default:
panic(abiEncodingError{
Type: value.StaticType(inter),
Type: element.StaticType(inter),
})
}
case *interpreter.ArrayValue:
// Dynamic variables, such as arrays & slices, are encoded
// in 2+ chunks of 32 bytes. The first chunk contains
// the index where information for the array begin,
// the second chunk contains the number of bytes the
// array occupies, and the third chunk contains the
// values of the array itself.
computation := uint(2 * abiEncodingByteSize)
reportComputation(computation)
reportABIEncodingComputation(inter, value, evmAddressTypeID, reportComputation)

default:
panic(abiEncodingError{
Type: element.StaticType(inter),
})
}

// continue iteration
return true
})
// continue iteration
return true
},
false,

Check failure on line 191 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Lint (./)

too many arguments in call to values.Iterate

Check failure on line 191 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Lint (./)

too many arguments in call to values.Iterate

Check failure on line 191 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/execution/ingestion)

too many arguments in call to values.Iterate

Check failure on line 191 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/execution/ingestion)

too many arguments in call to values.Iterate

Check failure on line 191 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/execution/computation)

too many arguments in call to values.Iterate

Check failure on line 191 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/execution/computation)

too many arguments in call to values.Iterate

Check failure on line 191 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (admin)

too many arguments in call to values.Iterate

Check failure on line 191 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (admin)

too many arguments in call to values.Iterate

Check failure on line 191 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/execution)

too many arguments in call to values.Iterate

Check failure on line 191 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/execution)

too many arguments in call to values.Iterate

Check failure on line 191 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/verification)

too many arguments in call to values.Iterate

Check failure on line 191 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/verification)

too many arguments in call to values.Iterate

Check failure on line 191 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/collection)

too many arguments in call to values.Iterate

Check failure on line 191 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/collection)

too many arguments in call to values.Iterate

Check failure on line 191 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (storage)

too many arguments in call to values.Iterate

Check failure on line 191 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (storage)

too many arguments in call to values.Iterate

Check failure on line 191 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (fvm)

too many arguments in call to values.Iterate

Check failure on line 191 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (fvm)

too many arguments in call to values.Iterate

Check failure on line 191 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/access)

too many arguments in call to values.Iterate

Check failure on line 191 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/access)

too many arguments in call to values.Iterate

Check failure on line 191 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (consensus)

too many arguments in call to values.Iterate

Check failure on line 191 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (consensus)

too many arguments in call to values.Iterate

Check failure on line 191 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (others)

too many arguments in call to values.Iterate

Check failure on line 191 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (others)

too many arguments in call to values.Iterate

Check failure on line 191 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (utils)

too many arguments in call to values.Iterate

Check failure on line 191 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (utils)

too many arguments in call to values.Iterate

Check failure on line 191 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (module)

too many arguments in call to values.Iterate

Check failure on line 191 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (module)

too many arguments in call to values.Iterate

Check failure on line 191 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/common)

too many arguments in call to values.Iterate

Check failure on line 191 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/common)

too many arguments in call to values.Iterate

Check failure on line 191 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (cmd)

too many arguments in call to values.Iterate

Check failure on line 191 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (cmd)

too many arguments in call to values.Iterate

Check failure on line 191 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine)

too many arguments in call to values.Iterate

Check failure on line 191 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine)

too many arguments in call to values.Iterate
locationRange,
)
}

// EVM.encodeABI
Expand Down Expand Up @@ -221,6 +233,7 @@ func newInternalEVMTypeEncodeABIFunction(

reportABIEncodingComputation(
inter,
locationRange,
valuesArray,
evmAddressTypeID,
func(intensity uint) {
Expand All @@ -233,24 +246,29 @@ func newInternalEVMTypeEncodeABIFunction(
values := make([]any, 0, size)
arguments := make(gethABI.Arguments, 0, size)

valuesArray.Iterate(inter, func(element interpreter.Value) (resume bool) {
value, ty, err := encodeABI(
inter,
locationRange,
element,
element.StaticType(inter),
evmAddressTypeID,
)
if err != nil {
panic(err)
}

values = append(values, value)
arguments = append(arguments, gethABI.Argument{Type: ty})

// continue iteration
return true
})
valuesArray.Iterate(
inter,
func(element interpreter.Value) (resume bool) {
value, ty, err := encodeABI(
inter,
locationRange,
element,
element.StaticType(inter),
evmAddressTypeID,
)
if err != nil {
panic(err)
}

values = append(values, value)
arguments = append(arguments, gethABI.Argument{Type: ty})

// continue iteration
return true
},
false,

Check failure on line 269 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Lint (./)

too many arguments in call to valuesArray.Iterate

Check failure on line 269 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Lint (./)

too many arguments in call to valuesArray.Iterate

Check failure on line 269 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/execution/ingestion)

too many arguments in call to valuesArray.Iterate

Check failure on line 269 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/execution/ingestion)

too many arguments in call to valuesArray.Iterate

Check failure on line 269 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/execution/computation)

too many arguments in call to valuesArray.Iterate

Check failure on line 269 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/execution/computation)

too many arguments in call to valuesArray.Iterate

Check failure on line 269 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (admin)

too many arguments in call to valuesArray.Iterate

Check failure on line 269 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (admin)

too many arguments in call to valuesArray.Iterate

Check failure on line 269 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/execution)

too many arguments in call to valuesArray.Iterate

Check failure on line 269 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/execution)

too many arguments in call to valuesArray.Iterate

Check failure on line 269 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/verification)

too many arguments in call to valuesArray.Iterate

Check failure on line 269 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/verification)

too many arguments in call to valuesArray.Iterate

Check failure on line 269 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/collection)

too many arguments in call to valuesArray.Iterate

Check failure on line 269 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/collection)

too many arguments in call to valuesArray.Iterate

Check failure on line 269 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (storage)

too many arguments in call to valuesArray.Iterate

Check failure on line 269 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (storage)

too many arguments in call to valuesArray.Iterate

Check failure on line 269 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (fvm)

too many arguments in call to valuesArray.Iterate

Check failure on line 269 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (fvm)

too many arguments in call to valuesArray.Iterate

Check failure on line 269 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/access)

too many arguments in call to valuesArray.Iterate

Check failure on line 269 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/access)

too many arguments in call to valuesArray.Iterate

Check failure on line 269 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (consensus)

too many arguments in call to valuesArray.Iterate

Check failure on line 269 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (consensus)

too many arguments in call to valuesArray.Iterate

Check failure on line 269 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (others)

too many arguments in call to valuesArray.Iterate

Check failure on line 269 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (others)

too many arguments in call to valuesArray.Iterate

Check failure on line 269 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (utils)

too many arguments in call to valuesArray.Iterate

Check failure on line 269 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (utils)

too many arguments in call to valuesArray.Iterate

Check failure on line 269 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (module)

too many arguments in call to valuesArray.Iterate

Check failure on line 269 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (module)

too many arguments in call to valuesArray.Iterate

Check failure on line 269 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/common)

too many arguments in call to valuesArray.Iterate

Check failure on line 269 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/common)

too many arguments in call to valuesArray.Iterate

Check failure on line 269 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (cmd)

too many arguments in call to valuesArray.Iterate

Check failure on line 269 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (cmd)

too many arguments in call to valuesArray.Iterate

Check failure on line 269 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine)

too many arguments in call to valuesArray.Iterate

Check failure on line 269 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine)

too many arguments in call to valuesArray.Iterate
locationRange,
)

encodedValues, err := arguments.Pack(values...)
if err != nil {
Expand Down Expand Up @@ -542,26 +560,31 @@ func encodeABI(
}

var index int
value.Iterate(inter, func(element interpreter.Value) (resume bool) {
value.Iterate(
inter,
func(element interpreter.Value) (resume bool) {

arrayElement, _, err := encodeABI(
inter,
locationRange,
element,
element.StaticType(inter),
evmAddressTypeID,
)
if err != nil {
panic(err)
}
arrayElement, _, err := encodeABI(
inter,
locationRange,
element,
element.StaticType(inter),
evmAddressTypeID,
)
if err != nil {
panic(err)
}

result.Index(index).Set(reflect.ValueOf(arrayElement))
result.Index(index).Set(reflect.ValueOf(arrayElement))

index++
index++

// continue iteration
return true
})
// continue iteration
return true
},
false,

Check failure on line 585 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Lint (./)

too many arguments in call to value.Iterate

Check failure on line 585 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Lint (./)

too many arguments in call to value.Iterate

Check failure on line 585 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/execution/ingestion)

too many arguments in call to value.Iterate

Check failure on line 585 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/execution/ingestion)

too many arguments in call to value.Iterate

Check failure on line 585 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/execution/computation)

too many arguments in call to value.Iterate

Check failure on line 585 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/execution/computation)

too many arguments in call to value.Iterate

Check failure on line 585 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (admin)

too many arguments in call to value.Iterate

Check failure on line 585 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (admin)

too many arguments in call to value.Iterate

Check failure on line 585 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/execution)

too many arguments in call to value.Iterate

Check failure on line 585 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/execution)

too many arguments in call to value.Iterate

Check failure on line 585 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/verification)

too many arguments in call to value.Iterate

Check failure on line 585 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/verification)

too many arguments in call to value.Iterate

Check failure on line 585 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/collection)

too many arguments in call to value.Iterate

Check failure on line 585 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/collection)

too many arguments in call to value.Iterate

Check failure on line 585 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (storage)

too many arguments in call to value.Iterate

Check failure on line 585 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (storage)

too many arguments in call to value.Iterate

Check failure on line 585 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (fvm)

too many arguments in call to value.Iterate

Check failure on line 585 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (fvm)

too many arguments in call to value.Iterate

Check failure on line 585 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/access)

too many arguments in call to value.Iterate

Check failure on line 585 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/access)

too many arguments in call to value.Iterate

Check failure on line 585 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (consensus)

too many arguments in call to value.Iterate

Check failure on line 585 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (consensus)

too many arguments in call to value.Iterate

Check failure on line 585 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (others)

too many arguments in call to value.Iterate

Check failure on line 585 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (others)

too many arguments in call to value.Iterate

Check failure on line 585 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (utils)

too many arguments in call to value.Iterate

Check failure on line 585 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (utils)

too many arguments in call to value.Iterate

Check failure on line 585 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (module)

too many arguments in call to value.Iterate

Check failure on line 585 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (module)

too many arguments in call to value.Iterate

Check failure on line 585 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/common)

too many arguments in call to value.Iterate

Check failure on line 585 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/common)

too many arguments in call to value.Iterate

Check failure on line 585 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (cmd)

too many arguments in call to value.Iterate

Check failure on line 585 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (cmd)

too many arguments in call to value.Iterate

Check failure on line 585 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine)

too many arguments in call to value.Iterate

Check failure on line 585 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine)

too many arguments in call to value.Iterate
locationRange,
)

return result.Interface(), arrayGethABIType, nil
}
Expand Down Expand Up @@ -631,31 +654,36 @@ func newInternalEVMTypeDecodeABIFunction(
}

var arguments gethABI.Arguments
typesArray.Iterate(inter, func(element interpreter.Value) (resume bool) {
typeValue, ok := element.(interpreter.TypeValue)
if !ok {
panic(errors.NewUnreachableError())
}

staticType := typeValue.Type

gethABITy, ok := gethABIType(staticType, evmAddressTypeID)
if !ok {
panic(abiDecodingError{
Type: staticType,
})
}

arguments = append(
arguments,
gethABI.Argument{
Type: gethABITy,
},
)

// continue iteration
return true
})
typesArray.Iterate(
inter,
func(element interpreter.Value) (resume bool) {
typeValue, ok := element.(interpreter.TypeValue)
if !ok {
panic(errors.NewUnreachableError())
}

staticType := typeValue.Type

gethABITy, ok := gethABIType(staticType, evmAddressTypeID)
if !ok {
panic(abiDecodingError{
Type: staticType,
})
}

arguments = append(
arguments,
gethABI.Argument{
Type: gethABITy,
},
)

// continue iteration
return true
},
false,

Check failure on line 684 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Lint (./)

too many arguments in call to typesArray.Iterate

Check failure on line 684 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/execution/ingestion)

too many arguments in call to typesArray.Iterate

Check failure on line 684 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/execution/ingestion)

too many arguments in call to typesArray.Iterate

Check failure on line 684 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/execution/computation)

too many arguments in call to typesArray.Iterate

Check failure on line 684 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/execution/computation)

too many arguments in call to typesArray.Iterate

Check failure on line 684 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (admin)

too many arguments in call to typesArray.Iterate

Check failure on line 684 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (admin)

too many arguments in call to typesArray.Iterate

Check failure on line 684 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/execution)

too many arguments in call to typesArray.Iterate

Check failure on line 684 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/execution)

too many arguments in call to typesArray.Iterate

Check failure on line 684 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/verification)

too many arguments in call to typesArray.Iterate

Check failure on line 684 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/verification)

too many arguments in call to typesArray.Iterate

Check failure on line 684 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/collection)

too many arguments in call to typesArray.Iterate

Check failure on line 684 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/collection)

too many arguments in call to typesArray.Iterate

Check failure on line 684 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (storage)

too many arguments in call to typesArray.Iterate

Check failure on line 684 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (storage)

too many arguments in call to typesArray.Iterate

Check failure on line 684 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (fvm)

too many arguments in call to typesArray.Iterate

Check failure on line 684 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (fvm)

too many arguments in call to typesArray.Iterate

Check failure on line 684 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/access)

too many arguments in call to typesArray.Iterate

Check failure on line 684 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/access)

too many arguments in call to typesArray.Iterate

Check failure on line 684 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (consensus)

too many arguments in call to typesArray.Iterate

Check failure on line 684 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (consensus)

too many arguments in call to typesArray.Iterate

Check failure on line 684 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (others)

too many arguments in call to typesArray.Iterate

Check failure on line 684 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (others)

too many arguments in call to typesArray.Iterate

Check failure on line 684 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (utils)

too many arguments in call to typesArray.Iterate

Check failure on line 684 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (utils)

too many arguments in call to typesArray.Iterate

Check failure on line 684 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (module)

too many arguments in call to typesArray.Iterate

Check failure on line 684 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (module)

too many arguments in call to typesArray.Iterate

Check failure on line 684 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/common)

too many arguments in call to typesArray.Iterate

Check failure on line 684 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/common)

too many arguments in call to typesArray.Iterate

Check failure on line 684 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (cmd)

too many arguments in call to typesArray.Iterate

Check failure on line 684 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (cmd)

too many arguments in call to typesArray.Iterate

Check failure on line 684 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine)

too many arguments in call to typesArray.Iterate

Check failure on line 684 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine)

too many arguments in call to typesArray.Iterate
locationRange,
)

decodedValues, err := arguments.Unpack(data)
if err != nil {
Expand All @@ -665,33 +693,38 @@ func newInternalEVMTypeDecodeABIFunction(
var index int
values := make([]interpreter.Value, 0, len(decodedValues))

typesArray.Iterate(inter, func(element interpreter.Value) (resume bool) {
typeValue, ok := element.(interpreter.TypeValue)
if !ok {
panic(errors.NewUnreachableError())
}

staticType := typeValue.Type

value, err := decodeABI(
inter,
locationRange,
decodedValues[index],
staticType,
location,
evmAddressTypeID,
)
if err != nil {
panic(err)
}

index++

values = append(values, value)

// continue iteration
return true
})
typesArray.Iterate(
inter,
func(element interpreter.Value) (resume bool) {
typeValue, ok := element.(interpreter.TypeValue)
if !ok {
panic(errors.NewUnreachableError())
}

staticType := typeValue.Type

value, err := decodeABI(
inter,
locationRange,
decodedValues[index],
staticType,
location,
evmAddressTypeID,
)
if err != nil {
panic(err)
}

index++

values = append(values, value)

// continue iteration
return true
},
false,

Check failure on line 725 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Lint (./)

too many arguments in call to typesArray.Iterate

Check failure on line 725 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/execution/ingestion)

too many arguments in call to typesArray.Iterate

Check failure on line 725 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/execution/ingestion)

too many arguments in call to typesArray.Iterate

Check failure on line 725 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/execution/computation)

too many arguments in call to typesArray.Iterate

Check failure on line 725 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/execution/computation)

too many arguments in call to typesArray.Iterate

Check failure on line 725 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (admin)

too many arguments in call to typesArray.Iterate

Check failure on line 725 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (admin)

too many arguments in call to typesArray.Iterate

Check failure on line 725 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/execution)

too many arguments in call to typesArray.Iterate

Check failure on line 725 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/execution)

too many arguments in call to typesArray.Iterate

Check failure on line 725 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/verification)

too many arguments in call to typesArray.Iterate

Check failure on line 725 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/verification)

too many arguments in call to typesArray.Iterate

Check failure on line 725 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/collection)

too many arguments in call to typesArray.Iterate

Check failure on line 725 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/collection)

too many arguments in call to typesArray.Iterate

Check failure on line 725 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (storage)

too many arguments in call to typesArray.Iterate

Check failure on line 725 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (storage)

too many arguments in call to typesArray.Iterate

Check failure on line 725 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (fvm)

too many arguments in call to typesArray.Iterate

Check failure on line 725 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (fvm)

too many arguments in call to typesArray.Iterate

Check failure on line 725 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/access)

too many arguments in call to typesArray.Iterate

Check failure on line 725 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/access)

too many arguments in call to typesArray.Iterate

Check failure on line 725 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (consensus)

too many arguments in call to typesArray.Iterate

Check failure on line 725 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (consensus)

too many arguments in call to typesArray.Iterate

Check failure on line 725 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (others)

too many arguments in call to typesArray.Iterate

Check failure on line 725 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (others)

too many arguments in call to typesArray.Iterate

Check failure on line 725 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (utils)

too many arguments in call to typesArray.Iterate

Check failure on line 725 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (utils)

too many arguments in call to typesArray.Iterate

Check failure on line 725 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (module)

too many arguments in call to typesArray.Iterate

Check failure on line 725 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (module)

too many arguments in call to typesArray.Iterate

Check failure on line 725 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/common)

too many arguments in call to typesArray.Iterate

Check failure on line 725 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine/common)

too many arguments in call to typesArray.Iterate

Check failure on line 725 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (cmd)

too many arguments in call to typesArray.Iterate

Check failure on line 725 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (cmd)

too many arguments in call to typesArray.Iterate

Check failure on line 725 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine)

too many arguments in call to typesArray.Iterate

Check failure on line 725 in fvm/evm/stdlib/contract.go

View workflow job for this annotation

GitHub Actions / Unit Tests (engine)

too many arguments in call to typesArray.Iterate
locationRange,
)

arrayType := interpreter.NewVariableSizedStaticType(
inter,
Expand Down

0 comments on commit f19e509

Please sign in to comment.