Skip to content

Commit b1a96e1

Browse files
authored
Update quick-start.mdx
1 parent 3b4b414 commit b1a96e1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/pages/testing/quick-start.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ contract ExampleTest is Test {
6060

6161
### How it works
6262

63-
`HyperCore` is a contract that replicates HyperCore state and behaviour for tests. It inherits three contracts: `CoreState.sol`, which holds all state (accounts, spot balances, perp positions and margin, staking, vault equity); `CoreView.sol`, which exposes read functions used by precompiles; and `CoreExecution.sol`, which applies all writes such as token/native transfers, spot and perp orders, vault transfers, staking and delegations, and more. Precompile reads go through `CoreView.sol`, so they return the simulator’s updated state.
63+
`HyperCore` replicates HyperCore state and behaviour for tests. It holds all state (accounts, spot balances, perp positions and margin, staking, vault equity) and exposes read functions used by precompiles.
6464

65-
Precompile calls are handled by `PrecompileSim.sol`, which is etched at each precompile address. When a precompile is called, its fallback forwards the read into `HyperCore` via the matching `CoreView` function. `CoreView` then does a conditional: if the value is already initialized in local state, it returns that; if not, it performs a live RPC read via `RealL1Read.sol` and returns the onchain value.
65+
Precompile calls are handled by `PrecompileSim.sol`, which is etched at each precompile address. When a precompile is called, its fallback forwards the read into `HyperCore` via the matching `CoreView` function. `CoreView` functions check if the value is already initialized in local state and returns that; if not, it performs a live RPC read via `RealL1Read.sol` and returns the onchain value.
6666

67-
CoreWriter actions are handled through `CoreWriterSim.sol`. It encodes all incoming CoreWriter calls into an ordered queue. When `CoreSimulatorLib.nextBlock()` is called to advance to the next block, it executes the queued actions in order by calling the relevant `execute*` functions on `HyperCore` and applies their state changes. Before applying each write, `CoreExecution` runs initializers (`initAccountWithToken`, `initAccount`, `initAccountWithPerp`) to initialise the required state by fetching current onchain values via `RealL1Read.sol` then the local state is updated, and subsequent precompile reads come from the stored state, not another RPC call.
67+
CoreWriter actions are handled through `CoreWriterSim.sol`. It encodes all incoming CoreWriter calls into an ordered queue. When `CoreSimulatorLib.nextBlock()` is called to advance to the next block, it executes the queued actions by calling the relevant execute functions on `HyperCore` and applies their state changes. Before applying each write, CoreExecution runs initializers to initialise the relevant state by fetching current onchain values, then the local state is updated, and subsequent precompile reads come from the stored state, not another RPC call.
6868

0 commit comments

Comments
 (0)