Skip to content

Commit 4ccde5a

Browse files
committed
Remove redundant check for composite type
1 parent 4399e59 commit 4ccde5a

1 file changed

Lines changed: 10 additions & 14 deletions

File tree

fvm/evm/impl/abi.go

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -586,24 +586,20 @@ func goType(
586586
return reflect.ArrayOf(stdlib.EVMBytes32Length, reflect.TypeOf(byte(0))), true
587587
}
588588

589-
// This check for Cadence structs, has to be after the above checks,
590-
// which are also structs defined in the EVM system contract:
589+
gethABIType, ok := gethABIType(
590+
context,
591+
staticType,
592+
evmTypeIDs,
593+
)
594+
// All user-defined Cadence structs, are ABI encoded/decoded as Solidity tuples.
595+
// Except for the structs defined in the EVM system contract:
591596
// - `EVM.EVMAddress`
592597
// - `EVM.EVMBytes`
593598
// - `EVM.EVMBytes4`
594599
// - `EVM.EVMBytes32`
595-
semaType := interpreter.MustConvertStaticToSemaType(staticType, context)
596-
if compositeType := asTupleEncodableCompositeType(semaType); compositeType != nil {
597-
tupleGethABIType, ok := gethABIType(
598-
context,
599-
staticType,
600-
evmTypeIDs,
601-
)
602-
if !ok {
603-
return nil, false
604-
}
605-
606-
return tupleGethABIType.TupleType, true
600+
// These have their own ABI encoding/decoding format.
601+
if ok && gethABIType.T == gethABI.TupleTy {
602+
return gethABIType.TupleType, true
607603
}
608604

609605
return nil, false

0 commit comments

Comments
 (0)