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
Deploy the contract below to EVM sidechain testnet. It is important that we keep the version fixed at 0.8.25 as MCOPY (0x5e) is ony available at ^0.8.25.
// SPDX-License-Identifier: MITpragma solidity0.8.25;
contractMCopyTest {
function copyMemory(bytesmemoryinput) publicpurereturns (bytesmemory) {
bytesmemory result =newbytes(input.length);
assembly {
let length :=mload(input) // Load length of inputlet inputPtr :=add(input, 0x20) // Pointer to input data (skip length prefix)let resultPtr :=add(result, 0x20) // Pointer to result data (skip length prefix)mcopy(resultPtr, inputPtr, length) // Perform memory copy using MCOPY
}
return result;
}
function example() publicpurereturns (bytesmemory) {
bytesmemory input =hex"12345600af151531";
returncopyMemory(input);
}
}
Now this is a simple deployment script:
// SPDX-License-Identifier: UNLICENSEDpragma solidity0.8.25;
import {Script, console} from"forge-std/Script.sol";
import {MCopyTest} from"../src/MCopyTest.sol";
contractCounterScriptisScript {
MCopyTest public mCopyTest;
function setUp() public {}
function run() public {
uint256 deployerPrivateKey = vm.envUint("DEPLOYER_PRIVATE_KEY");
vm.startBroadcast(deployerPrivateKey);
mCopyTest =newMCopyTest();
vm.stopBroadcast();
}
}
Running forge script script/MCopyTest.deploy.sol --rpc-url https://rpc-evm-sidechain.xrpl.org --broadcast --verify --verifier blockscout --verifier-url https://explorer.xrplevm.org/api/ will deploy the contract (it is another bug that the contract verifier does not work for code compiled above certain version of solidity, because you won't be able to see the verified contract on Blockscout explorer on https://explorer.xrplevm.org/).
And as we discussed before, it seems that it requires an update from an upstream dependency. I've checked Evmos and it appears that they don't support this opcode at all. have a look at these lines:
So... 0x5e is just missing from the implementation. While we can't resolve this issue immediately, it might be useful to write about unsupported opcodes on public docs so that devs don't waste their time.
Expected behavior
Call to exapmle()(bytes) must succeed without throwing an error.
Actual behavior
The function call throws an error:
Error: server returned an error response: error code -32000: rpc error: code = Internal desc = invalid opcode: opcode 0x5e not defined
The text was updated successfully, but these errors were encountered:
Steps to reproduce
Deploy the contract below to EVM sidechain testnet. It is important that we keep the version fixed at
0.8.25
as MCOPY (0x5e) is ony available at ^0.8.25.Now this is a simple deployment script:
Running
forge script script/MCopyTest.deploy.sol --rpc-url https://rpc-evm-sidechain.xrpl.org --broadcast --verify --verifier blockscout --verifier-url https://explorer.xrplevm.org/api/
will deploy the contract (it is another bug that the contract verifier does not work for code compiled above certain version of solidity, because you won't be able to see the verified contract on Blockscout explorer on https://explorer.xrplevm.org/).An example contract deployed is at https://explorer.xrplevm.org/address/0x836ffb3f6058283f40b331ab8b069278b6aaddb3.
Now on your cli, just run:
cast call 0x836FFB3f6058283f40b331AB8b069278b6AAdDb3 "example()(bytes)" --rpc-url https://rpc-evm-sidechain.xrpl.org
And as we discussed before, it seems that it requires an update from an upstream dependency. I've checked Evmos and it appears that they don't support this opcode at all. have a look at these lines:
So...
0x5e
is just missing from the implementation. While we can't resolve this issue immediately, it might be useful to write about unsupported opcodes on public docs so that devs don't waste their time.Expected behavior
Call to
exapmle()(bytes)
must succeed without throwing an error.Actual behavior
The function call throws an error:
The text was updated successfully, but these errors were encountered: