mirror of
https://github.com/vacp2p/linea-monorepo.git
synced 2026-01-09 04:08:01 -05:00
[Chore] - use defined account for opcode testing (#671)
* use defined account for opcode testing * add output to show execution
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import { getRequiredEnvVar } from "../common/helpers/environment";
|
||||
import { ethers } from "ethers";
|
||||
import { TransactionReceipt, ethers } from "ethers";
|
||||
import { abi as opcodeTesterAbi } from "./static-artifacts/OpcodeTester.json";
|
||||
|
||||
async function main() {
|
||||
@@ -31,9 +31,19 @@ async function main() {
|
||||
|
||||
for (let i = 1; i <= executionRunCount; i++) {
|
||||
console.log(`Executing all opcodes for runs ${i} of ${executionRunCount}`);
|
||||
const valueBeforeExecution = await opcodeTester.rollingBlockDetailComputations();
|
||||
const executeTx = await opcodeTester.executeAllOpcodes({ gasLimit: 5_000_000 });
|
||||
const receipt = await executeTx.wait();
|
||||
console.log(` - Gas used in run: ${receipt?.gasUsed}`);
|
||||
const receipt: TransactionReceipt = await executeTx.wait();
|
||||
const valueAfterExecution = await opcodeTester.rollingBlockDetailComputations();
|
||||
|
||||
if (valueBeforeExecution == valueAfterExecution) {
|
||||
throw "No state changes were persisted!";
|
||||
}
|
||||
|
||||
console.log(` - Gas used in run: ${receipt?.gasUsed} at block number=${receipt?.blockNumber}`);
|
||||
console.log(
|
||||
` - State variable rollingBlockDetailComputations changed from=${valueBeforeExecution} to=${valueAfterExecution} `,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -3,7 +3,7 @@ pragma solidity 0.8.19;
|
||||
|
||||
import { TokenBridge } from "../../../bridging/token/TokenBridge.sol";
|
||||
|
||||
/// @custom:oz-upgrades-unsafe-allow missing-initializer
|
||||
/// @custom:oz-upgrades-unsafe-allow missing-initializer
|
||||
contract TestTokenBridge is TokenBridge {
|
||||
function testReturnDataToString(bytes memory _data) public pure returns (string memory) {
|
||||
return _returnDataToString(_data);
|
||||
|
||||
@@ -3,7 +3,7 @@ pragma solidity 0.8.19;
|
||||
|
||||
import { L2MessageService } from "../../../messaging/l2/L2MessageService.sol";
|
||||
|
||||
/// @custom:oz-upgrades-unsafe-allow missing-initializer
|
||||
/// @custom:oz-upgrades-unsafe-allow missing-initializer
|
||||
contract TestL2MessageService is L2MessageService {
|
||||
address public originalSender;
|
||||
bool private reentryDone;
|
||||
|
||||
@@ -6,7 +6,7 @@ import { ErrorAndDestructionTesting } from "./ErrorAndDestructionTesting.sol";
|
||||
contract OpcodeTester {
|
||||
mapping(bytes2 => uint256) public opcodeExecutions;
|
||||
address public yulContract;
|
||||
bytes32 rollingBlockDetailComputations;
|
||||
bytes32 public rollingBlockDetailComputations;
|
||||
|
||||
// The opcodes are logged here for completeness sake even though not used.
|
||||
// NOTE: For looping we make it 2 bytes instead of one, so the real value is actually missing the 00 from 0x0001 (0x01) etc.
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
"balance": "90000000000000000000001",
|
||||
"@WARNING": "FOR LOCAL DEV ONLY - DO NOT REUSE THESE KEYS ELSEWHERE",
|
||||
"@privateKey": "8f2a55949038a9610f50fb23b5883af3b4ecb3c3bb792cbcefbd1542c692be63",
|
||||
"@comment": "account 1, can be used as end user"
|
||||
"@comment": "Used for OPCODE testing, do not use elsewhere"
|
||||
},
|
||||
"627306090abaB3A6e1400e9345bC60c78a8BEf57": {
|
||||
"balance": "90000000000000000000002",
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
"fe3b557e8fb62b89f4916b721be55ceb828dbd73": {
|
||||
"@WARNING": "FOR LOCAL DEV ONLY - DO NOT REUSE THESE KEYS ELSEWHERE",
|
||||
"privateKey": "8f2a55949038a9610f50fb23b5883af3b4ecb3c3bb792cbcefbd1542c692be63",
|
||||
"comment": "account 1, can be used as end user",
|
||||
"comment": "Used for OPCODE testing, do not use elsewhere",
|
||||
"balance": "90000000000000000000001"
|
||||
},
|
||||
"627306090abaB3A6e1400e9345bC60c78a8BEf57": {
|
||||
|
||||
@@ -108,17 +108,17 @@ deploy-contracts:
|
||||
deploy-l2-evm-opcode-tester:
|
||||
# WARNING: FOR LOCAL DEV ONLY - DO NOT REUSE THESE KEYS ELSEWHERE
|
||||
cd contracts/; \
|
||||
PRIVATE_KEY=0x1dd171cec7e2995408b5513004e8207fe88d6820aeff0d82463b3e41df251aae \
|
||||
PRIVATE_KEY=0x8f2a55949038a9610f50fb23b5883af3b4ecb3c3bb792cbcefbd1542c692be63 \
|
||||
RPC_URL=http:\\localhost:8545/ \
|
||||
npx ts-node local-deployments-artifacts/deployLondonEvmTestingFramework.ts
|
||||
|
||||
evm-opcode-tester-execute-all-opcodes: OPCODE_TEST_CONTRACT_ADDRESS:=0x997FC3aF1F193Cbdc013060076c67A13e218980e
|
||||
evm-opcode-tester-execute-all-opcodes: OPCODE_TEST_CONTRACT_ADDRESS:=0xa50a51c09a5c451C52BB714527E1974b686D8e77
|
||||
evm-opcode-tester-execute-all-opcodes:
|
||||
# WARNING: FOR LOCAL DEV ONLY - DO NOT REUSE THESE KEYS ELSEWHERE
|
||||
cd contracts/; \
|
||||
OPCODE_TEST_CONTRACT_ADDRESS=$(OPCODE_TEST_CONTRACT_ADDRESS) \
|
||||
NUMBER_OF_RUNS=3 \
|
||||
PRIVATE_KEY=0x1dd171cec7e2995408b5513004e8207fe88d6820aeff0d82463b3e41df251aae \
|
||||
PRIVATE_KEY=0x8f2a55949038a9610f50fb23b5883af3b4ecb3c3bb792cbcefbd1542c692be63 \
|
||||
RPC_URL=http:\\localhost:8545/ \
|
||||
npx ts-node local-deployments-artifacts/executeAllOpcodes.ts
|
||||
|
||||
|
||||
Reference in New Issue
Block a user