interface Inter {
function transfer(bytes4) external;
}
contract Test {
function encodeCall() external returns (bytes memory) {
return abi.encodeCall(Inter.transfer,("1234"));
}
}
上述合约在 0.8.12 和 0.8.13+ 之间,运行结果不同。0.8.11- 无法编译。
0.8.12运行结果
0xa0e1b085000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000043132333400000000000000000000000000000000000000000000000000000000
0.8.13运行结果
0xa0e1b0853132333400000000000000000000000000000000000000000000000000000000
0.8.17运行结果
0xa0e1b0853132333400000000000000000000000000000000000000000000000000000000
evm --code 0x608060405234801561001057600080fd5b506004361061002b5760003560e01c80632a13ce6014610030575b600080fd5b61004a60048036038101906100459190610343565b610060565b6040516100579190610414565b60405180910390f35b60608160405160240161007391906105b6565b6040516020818303038152906040526376fb65fb60e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050919050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610121826100d8565b810181811067ffffffffffffffff821117156101405761013f6100e9565b5b80604052505050565b60006101536100bf565b905061015f8282610118565b919050565b600067ffffffffffffffff82111561017f5761017e6100e9565b5b602082029050602081019050919050565b600080fd5b600067ffffffffffffffff8211156101b0576101af6100e9565b5b602082029050602081019050919050565b6000819050919050565b6101d4816101c1565b81146101df57600080fd5b50565b6000813590506101f1816101cb565b92915050565b600061020a61020584610195565b610149565b9050808382526020820190506020840283018581111561022d5761022c610190565b5b835b81811015610256578061024288826101e2565b84526020840193505060208101905061022f565b5050509392505050565b600082601f830112610275576102746100d3565b5b81356102858482602086016101f7565b91505092915050565b60006102a161029c84610164565b610149565b905080838252602082019050602084028301858111156102c4576102c3610190565b5b835b8181101561030b57803567ffffffffffffffff8111156102e9576102e86100d3565b5b8086016102f68982610260565b855260208501945050506020810190506102c6565b5050509392505050565b600082601f83011261032a576103296100d3565b5b813561033a84826020860161028e565b91505092915050565b600060208284031215610359576103586100c9565b5b600082013567ffffffffffffffff811115610377576103766100ce565b5b61038384828501610315565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156103c65780820151818401526020810190506103ab565b838111156103d5576000848401525b50505050565b60006103e68261038c565b6103f08185610397565b93506104008185602086016103a8565b610409816100d8565b840191505092915050565b6000602082019050818103600083015261042e81846103db565b905092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b610497816101c1565b82525050565b60006104a9838361048e565b60208301905092915050565b6000602082019050919050565b60006104cd82610462565b6104d7818561046d565b93506104e28361047e565b8060005b838110156105135781516104fa888261049d565b9750610505836104b5565b9250506001810190506104e6565b5085935050505092915050565b600061052c83836104c2565b905092915050565b6000602082019050919050565b600061054c82610436565b6105568185610441565b93508360208202850161056885610452565b8060005b858110156105a457848403895281516105858582610520565b945061059083610534565b925060208a0199505060018101905061056c565b50829750879550505050505092915050565b600060208201905081810360008301526105d08184610541565b90509291505056fea2646970667358221220b846f04a1efeebdb31cf4d6b1e99ba9158d9b61187d79de83fdb3b6a4135ab3464736f6c634300080c0033 --input 0x2a13ce6000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001 run
interface Inter {
function transfer(bytes32[][] memory) external;
}
contract Test {
function encodeCall(bytes32[][] memory to) external returns (bytes memory) {
return abi.encodeCall(Inter.transfer, (to));
}
}
该合约在 evm 1.10.4-stable
和 Remix VM ( London )
中执行结果不同。
合约字节码