taiko-mono icon indicating copy to clipboard operation
taiko-mono copied to clipboard

fix(protocol): assembly Error fix

Open cryptoryda opened this issue 1 year ago • 2 comments

Error:
Compiler run failed:
Error (4619): Function "mcopy" not found.
   --> contracts/automata-attestation/utils/BytesUtils.sol:273:13:
    |
273 |             mcopy(dest, src, len)
    |             ^^^^^

We can solve this using :

 function memcpy(uint256 dest, uint256 src, uint256 len) private pure {
        assembly {
            for {
                let i := 0
            } lt(i, len) {
                i := add(i, 32)
            } { 
                mstore(add(dest, i), mload(add(src, i)))
            }
        }
    }

This loop copies 32 bytes at a time until the specified length is reached. Note that this implementation assumes that the length is a multiple of 32.

cryptoryda avatar Feb 19 '24 10:02 cryptoryda

I don't have to error. Are you using the right compiler version?

dantaik avatar Feb 19 '24 11:02 dantaik

Yes the right complier version is being used

cryptoryda avatar Feb 19 '24 13:02 cryptoryda

Use --evm-version cancun

adaki2004 avatar Feb 20 '24 02:02 adaki2004