Skip to content

Commit

Permalink
feat(tracer): remove contract size field
Browse files Browse the repository at this point in the history
  • Loading branch information
0xfourzerofour committed Sep 14, 2023
1 parent ea5b0a8 commit 02be392
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 30 deletions.
11 changes: 1 addition & 10 deletions crates/rundler/src/common/simulation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,16 +243,6 @@ where
}
}

for (addr, size) in &phase.contract_size {
if *addr != context.entity_infos.sender_address() && size.contract_size <= 2 {
violations.push(SimulationViolation::UsedForbiddenOpcode(
entity,
*addr,
ViolationOpCode(size.opcode),
));
}
}

for precompile in &phase.forbidden_precompiles_used {
let (contract, precompile) = parse_combined_tracer_str(precompile)?;
violations.push(SimulationViolation::UsedForbiddenPrecompile(
Expand Down Expand Up @@ -552,6 +542,7 @@ struct ValidationContext {
block_id: BlockId,
entity_infos: EntityInfos,
tracer_out: TracerOutput,

entry_point_out: ValidationOutput,
is_unstaked_wallet_creation: bool,
entities_needing_stake: Vec<EntityType>,
Expand Down
1 change: 0 additions & 1 deletion crates/rundler/src/common/tracer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ pub struct Phase {
pub called_non_entry_point_with_value: bool,
pub ran_out_of_gas: bool,
pub undeployed_contract_accesses: Vec<Address>,
pub contract_size: HashMap<Address, ContractSize>,
pub ext_code_access_info: HashMap<Address, Opcode>,
}

Expand Down
18 changes: 0 additions & 18 deletions crates/rundler/tracer/src/validationTracer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ interface Phase {
calledNonEntryPointWithValue: boolean;
ranOutOfGas: boolean;
undeployedContractAccesses: string[];
contractSize: Record<string, ContractSize>;
extCodeAccessInfo: Record<string, string>;
}

Expand All @@ -32,11 +31,6 @@ interface StorageAccess {
slots: string[];
}

interface ContractSize {
contractSize: number;
opcode: string;
}

interface RelevantStepData {
opcode: string
stackTop3: any[]
Expand All @@ -48,15 +42,13 @@ type InternalPhase = Omit<
| "storageAccesses"
| "addressesCallingWithValue"
| "undeployedContractAccesses"
| "contractSize"
| "extCodeAccessInfo"
> & {
forbiddenOpcodesUsed: StringSet;
forbiddenPrecompilesUsed: StringSet;
storageAccesses: Record<string, StringSet>;
addressesCallingWithValue: StringSet;
undeployedContractAccesses: StringSet;
contractSize: Record<string, ContractSize>;
extCodeAccessInfo: Record<string, string>;
};

Expand Down Expand Up @@ -135,7 +127,6 @@ type StringSet = Record<string, boolean | undefined>;
calledNonEntryPointWithValue: false,
ranOutOfGas: false,
undeployedContractAccesses: {},
contractSize: {},
extCodeAccessInfo: {},

};
Expand All @@ -146,7 +137,6 @@ type StringSet = Record<string, boolean | undefined>;
calledBannedEntryPointMethod,
calledNonEntryPointWithValue,
ranOutOfGas,
contractSize,
extCodeAccessInfo,
} = currentPhase;
const forbiddenOpcodesUsed = Object.keys(currentPhase.forbiddenOpcodesUsed);
Expand Down Expand Up @@ -174,7 +164,6 @@ type StringSet = Record<string, boolean | undefined>;
calledNonEntryPointWithValue,
ranOutOfGas,
undeployedContractAccesses,
contractSize,
extCodeAccessInfo,
};
phases.push(phase);
Expand Down Expand Up @@ -359,13 +348,6 @@ type StringSet = Record<string, boolean | undefined>;
const address = toAddress(log.stack.peek(index).toString(16));
const addressHex = toHex(address);

if (currentPhase.contractSize[addressHex] == null && !PRECOMPILE_WHILTELIST[addressHex]) {
currentPhase.contractSize[addressHex] = {
contractSize: db.getCode(address).length,
opcode
}
}

if (!isPrecompiled(address)) {
if (
!accessedContractAddresses[addressHex] ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
ports:
- "3000:3000"
- "8080:8080"
command: bash -c "sleep 10; /usr/local/bin/rundler node"
command: bash -c "sleep 20; /usr/local/bin/rundler node"
environment:
- RUST_LOG=debug
- ENTRY_POINTS=0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789
Expand Down

0 comments on commit 02be392

Please sign in to comment.