You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The address of a function type loses the first byte after ABI encoding.
pragma soliditypp ^0.8.0;
contractA {
function add(uinta, uintb, function(uint) external callback) external {
if (callback.address!=address(0)) {
// the callback.address is broken here (lose the first byte)callback(a + b);
}
}
}
contractB {
A contractA;
uintpublic data;
constructor (addressaddr) {
contractA =A(addr);
}
function test() external {
// the following assert is okrequire(this.callback_onAdd.address==address(this));
contractA.add(1, 2, this.callback_onAdd);
}
function callback_onAdd(uintresult) external {
require(msg.sender==address(contractA));
data = result;
}
}
Cause: It's an address format issue, a Vite addresse has 168 bits rather than 160 bits like Ethereum.
The text was updated successfully, but these errors were encountered:
The address of a function type loses the first byte after ABI encoding.
Cause: It's an address format issue, a Vite addresse has 168 bits rather than 160 bits like Ethereum.
The text was updated successfully, but these errors were encountered: