diff --git a/suave/gen/main.go b/suave/gen/main.go index 15be86e24..cf4d69a7a 100644 --- a/suave/gen/main.go +++ b/suave/gen/main.go @@ -397,8 +397,8 @@ address public constant {{encodeAddrName .Name}} = {{end}} // Returns whether execution is off- or on-chain -function isConfidential() internal view returns (bool b) { - (bool success, bytes memory isConfidentialBytes) = IS_CONFIDENTIAL_ADDR.staticcall(""); +function isConfidential() internal returns (bool b) { + (bool success, bytes memory isConfidentialBytes) = IS_CONFIDENTIAL_ADDR.call(""); if (!success) { revert PeekerReverted(IS_CONFIDENTIAL_ADDR, isConfidentialBytes); } @@ -411,9 +411,9 @@ function isConfidential() internal view returns (bool b) { } {{range .Functions}} -function {{.Name}}({{range .Input}}{{styp .Typ}} {{.Name}}, {{end}}) internal view returns ({{range .Output.Fields}}{{styp .Typ}}, {{end}}) { +function {{.Name}}({{range .Input}}{{styp .Typ}} {{.Name}}, {{end}}) internal returns ({{range .Output.Fields}}{{styp .Typ}}, {{end}}) { {{if .IsConfidential}}require(isConfidential());{{end}} - (bool success, bytes memory data) = {{encodeAddrName .Name}}.staticcall(abi.encode({{range .Input}}{{.Name}}, {{end}})); + (bool success, bytes memory data) = {{encodeAddrName .Name}}.call(abi.encode({{range .Input}}{{.Name}}, {{end}})); if (!success) { revert PeekerReverted({{encodeAddrName .Name}}, data); } diff --git a/suave/sol/libraries/Suave.sol b/suave/sol/libraries/Suave.sol index 7109a4295..d04249e9b 100644 --- a/suave/sol/libraries/Suave.sol +++ b/suave/sol/libraries/Suave.sol @@ -97,8 +97,8 @@ library Suave { address public constant SUBMIT_ETH_BLOCK_TO_RELAY = 0x0000000000000000000000000000000042100002; // Returns whether execution is off- or on-chain - function isConfidential() internal view returns (bool b) { - (bool success, bytes memory isConfidentialBytes) = IS_CONFIDENTIAL_ADDR.staticcall(""); + function isConfidential() internal returns (bool b) { + (bool success, bytes memory isConfidentialBytes) = IS_CONFIDENTIAL_ADDR.call(""); if (!success) { revert PeekerReverted(IS_CONFIDENTIAL_ADDR, isConfidentialBytes); } @@ -112,10 +112,9 @@ library Suave { function buildEthBlock(BuildBlockArgs memory blockArgs, DataId dataId, string memory namespace) internal - view returns (bytes memory, bytes memory) { - (bool success, bytes memory data) = BUILD_ETH_BLOCK.staticcall(abi.encode(blockArgs, dataId, namespace)); + (bool success, bytes memory data) = BUILD_ETH_BLOCK.call(abi.encode(blockArgs, dataId, namespace)); if (!success) { revert PeekerReverted(BUILD_ETH_BLOCK, data); } @@ -123,8 +122,8 @@ library Suave { return abi.decode(data, (bytes, bytes)); } - function confidentialInputs() internal view returns (bytes memory) { - (bool success, bytes memory data) = CONFIDENTIAL_INPUTS.staticcall(abi.encode()); + function confidentialInputs() internal returns (bytes memory) { + (bool success, bytes memory data) = CONFIDENTIAL_INPUTS.call(abi.encode()); if (!success) { revert PeekerReverted(CONFIDENTIAL_INPUTS, data); } @@ -132,8 +131,8 @@ library Suave { return data; } - function confidentialRetrieve(DataId dataId, string memory key) internal view returns (bytes memory) { - (bool success, bytes memory data) = CONFIDENTIAL_RETRIEVE.staticcall(abi.encode(dataId, key)); + function confidentialRetrieve(DataId dataId, string memory key) internal returns (bytes memory) { + (bool success, bytes memory data) = CONFIDENTIAL_RETRIEVE.call(abi.encode(dataId, key)); if (!success) { revert PeekerReverted(CONFIDENTIAL_RETRIEVE, data); } @@ -141,15 +140,15 @@ library Suave { return data; } - function confidentialStore(DataId dataId, string memory key, bytes memory value) internal view { - (bool success, bytes memory data) = CONFIDENTIAL_STORE.staticcall(abi.encode(dataId, key, value)); + function confidentialStore(DataId dataId, string memory key, bytes memory value) internal { + (bool success, bytes memory data) = CONFIDENTIAL_STORE.call(abi.encode(dataId, key, value)); if (!success) { revert PeekerReverted(CONFIDENTIAL_STORE, data); } } - function doHTTPRequest(HttpRequest memory request) internal view returns (bytes memory) { - (bool success, bytes memory data) = DO_HTTPREQUEST.staticcall(abi.encode(request)); + function doHTTPRequest(HttpRequest memory request) internal returns (bytes memory) { + (bool success, bytes memory data) = DO_HTTPREQUEST.call(abi.encode(request)); if (!success) { revert PeekerReverted(DO_HTTPREQUEST, data); } @@ -157,8 +156,8 @@ library Suave { return abi.decode(data, (bytes)); } - function ethcall(address contractAddr, bytes memory input1) internal view returns (bytes memory) { - (bool success, bytes memory data) = ETHCALL.staticcall(abi.encode(contractAddr, input1)); + function ethcall(address contractAddr, bytes memory input1) internal returns (bytes memory) { + (bool success, bytes memory data) = ETHCALL.call(abi.encode(contractAddr, input1)); if (!success) { revert PeekerReverted(ETHCALL, data); } @@ -166,9 +165,9 @@ library Suave { return abi.decode(data, (bytes)); } - function extractHint(bytes memory bundleData) internal view returns (bytes memory) { + function extractHint(bytes memory bundleData) internal returns (bytes memory) { require(isConfidential()); - (bool success, bytes memory data) = EXTRACT_HINT.staticcall(abi.encode(bundleData)); + (bool success, bytes memory data) = EXTRACT_HINT.call(abi.encode(bundleData)); if (!success) { revert PeekerReverted(EXTRACT_HINT, data); } @@ -176,8 +175,8 @@ library Suave { return data; } - function fetchDataRecords(uint64 cond, string memory namespace) internal view returns (DataRecord[] memory) { - (bool success, bytes memory data) = FETCH_DATA_RECORDS.staticcall(abi.encode(cond, namespace)); + function fetchDataRecords(uint64 cond, string memory namespace) internal returns (DataRecord[] memory) { + (bool success, bytes memory data) = FETCH_DATA_RECORDS.call(abi.encode(cond, namespace)); if (!success) { revert PeekerReverted(FETCH_DATA_RECORDS, data); } @@ -185,9 +184,9 @@ library Suave { return abi.decode(data, (DataRecord[])); } - function fillMevShareBundle(DataId dataId) internal view returns (bytes memory) { + function fillMevShareBundle(DataId dataId) internal returns (bytes memory) { require(isConfidential()); - (bool success, bytes memory data) = FILL_MEV_SHARE_BUNDLE.staticcall(abi.encode(dataId)); + (bool success, bytes memory data) = FILL_MEV_SHARE_BUNDLE.call(abi.encode(dataId)); if (!success) { revert PeekerReverted(FILL_MEV_SHARE_BUNDLE, data); } @@ -195,8 +194,8 @@ library Suave { return data; } - function newBuilder() internal view returns (string memory) { - (bool success, bytes memory data) = NEW_BUILDER.staticcall(abi.encode()); + function newBuilder() internal returns (string memory) { + (bool success, bytes memory data) = NEW_BUILDER.call(abi.encode()); if (!success) { revert PeekerReverted(NEW_BUILDER, data); } @@ -209,9 +208,9 @@ library Suave { address[] memory allowedPeekers, address[] memory allowedStores, string memory dataType - ) internal view returns (DataRecord memory) { + ) internal returns (DataRecord memory) { (bool success, bytes memory data) = - NEW_DATA_RECORD.staticcall(abi.encode(decryptionCondition, allowedPeekers, allowedStores, dataType)); + NEW_DATA_RECORD.call(abi.encode(decryptionCondition, allowedPeekers, allowedStores, dataType)); if (!success) { revert PeekerReverted(NEW_DATA_RECORD, data); } @@ -230,10 +229,9 @@ library Suave { function signEthTransaction(bytes memory txn, string memory chainId, string memory signingKey) internal - view returns (bytes memory) { - (bool success, bytes memory data) = SIGN_ETH_TRANSACTION.staticcall(abi.encode(txn, chainId, signingKey)); + (bool success, bytes memory data) = SIGN_ETH_TRANSACTION.call(abi.encode(txn, chainId, signingKey)); if (!success) { revert PeekerReverted(SIGN_ETH_TRANSACTION, data); } @@ -241,9 +239,9 @@ library Suave { return abi.decode(data, (bytes)); } - function signMessage(bytes memory digest, string memory signingKey) internal view returns (bytes memory) { + function signMessage(bytes memory digest, string memory signingKey) internal returns (bytes memory) { require(isConfidential()); - (bool success, bytes memory data) = SIGN_MESSAGE.staticcall(abi.encode(digest, signingKey)); + (bool success, bytes memory data) = SIGN_MESSAGE.call(abi.encode(digest, signingKey)); if (!success) { revert PeekerReverted(SIGN_MESSAGE, data); } @@ -251,8 +249,8 @@ library Suave { return abi.decode(data, (bytes)); } - function simulateBundle(bytes memory bundleData) internal view returns (uint64) { - (bool success, bytes memory data) = SIMULATE_BUNDLE.staticcall(abi.encode(bundleData)); + function simulateBundle(bytes memory bundleData) internal returns (uint64) { + (bool success, bytes memory data) = SIMULATE_BUNDLE.call(abi.encode(bundleData)); if (!success) { revert PeekerReverted(SIMULATE_BUNDLE, data); } @@ -262,10 +260,9 @@ library Suave { function simulateTransaction(string memory sessionid, bytes memory txn) internal - view returns (SimulateTransactionResult memory) { - (bool success, bytes memory data) = SIMULATE_TRANSACTION.staticcall(abi.encode(sessionid, txn)); + (bool success, bytes memory data) = SIMULATE_TRANSACTION.call(abi.encode(sessionid, txn)); if (!success) { revert PeekerReverted(SIMULATE_TRANSACTION, data); } @@ -275,11 +272,10 @@ library Suave { function submitBundleJsonRPC(string memory url, string memory method, bytes memory params) internal - view returns (bytes memory) { require(isConfidential()); - (bool success, bytes memory data) = SUBMIT_BUNDLE_JSON_RPC.staticcall(abi.encode(url, method, params)); + (bool success, bytes memory data) = SUBMIT_BUNDLE_JSON_RPC.call(abi.encode(url, method, params)); if (!success) { revert PeekerReverted(SUBMIT_BUNDLE_JSON_RPC, data); } @@ -287,13 +283,9 @@ library Suave { return data; } - function submitEthBlockToRelay(string memory relayUrl, bytes memory builderBid) - internal - view - returns (bytes memory) - { + function submitEthBlockToRelay(string memory relayUrl, bytes memory builderBid) internal returns (bytes memory) { require(isConfidential()); - (bool success, bytes memory data) = SUBMIT_ETH_BLOCK_TO_RELAY.staticcall(abi.encode(relayUrl, builderBid)); + (bool success, bytes memory data) = SUBMIT_ETH_BLOCK_TO_RELAY.call(abi.encode(relayUrl, builderBid)); if (!success) { revert PeekerReverted(SUBMIT_ETH_BLOCK_TO_RELAY, data); } diff --git a/suave/sol/standard_peekers/bundles.sol b/suave/sol/standard_peekers/bundles.sol index aff8a761c..b8a85c9f5 100644 --- a/suave/sol/standard_peekers/bundles.sol +++ b/suave/sol/standard_peekers/bundles.sol @@ -307,7 +307,7 @@ contract EthBlockContract is AnyBundleContract { uint64 blockHeight, Suave.DataId[] memory records, string memory namespace - ) public view returns (Suave.DataRecord memory, bytes memory) { + ) public returns (Suave.DataRecord memory, bytes memory) { address[] memory allowedPeekers = new address[](2); allowedPeekers[0] = address(this); allowedPeekers[1] = Suave.BUILD_ETH_BLOCK; @@ -331,7 +331,7 @@ contract EthBlockContract is AnyBundleContract { return (dataRecord, builderBid); } - function unlock(Suave.DataId dataId, bytes memory signedBlindedHeader) public view returns (bytes memory) { + function unlock(Suave.DataId dataId, bytes memory signedBlindedHeader) public returns (bytes memory) { require(Suave.isConfidential()); // TODO: verify the header is correct