Skip to content

Commit 7a8a48d

Browse files
authored
Merge pull request #458 from rex4539/typos
Fix typos
2 parents a0af750 + f6685fe commit 7a8a48d

File tree

14 files changed

+45
-45
lines changed

14 files changed

+45
-45
lines changed

hevm.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ test-suite test
328328
main-is:
329329
test.hs
330330

331-
-- these tests require network access so we split them into a seperate test
331+
-- these tests require network access so we split them into a separate test
332332
-- suite to make it easy to skip them when running nix-build
333333
test-suite rpc-tests
334334
import:

src/EVM.hs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ exec1 = do
375375
OpShr -> stackOp2 g_verylow Expr.shr
376376
OpSar -> stackOp2 g_verylow Expr.sar
377377

378-
-- more accurately refered to as KECCAK
378+
-- more accurately referred to as KECCAK
379379
OpSha3 ->
380380
case stk of
381381
xOffset:xSize:xs ->
@@ -997,7 +997,7 @@ callChecks this xGas xContext xTo xValue xInOffset xInSize xOutOffset xOutSize x
997997
next
998998
else continue (toGas gas')
999999
case (fromBal, xValue) of
1000-
-- we're not transfering any value, and can skip the balance check
1000+
-- we're not transferring any value, and can skip the balance check
10011001
(_, Lit 0) -> burn (cost - gas') checkCallDepth
10021002

10031003
-- from is in the state, we check if they have enough balance
@@ -1376,7 +1376,7 @@ finalize = do
13761376
case Expr.toList output of
13771377
Nothing ->
13781378
partial $
1379-
UnexpectedSymbolicArg pc' "runtime code cannot have an abstract lentgh" (wrap [output])
1379+
UnexpectedSymbolicArg pc' "runtime code cannot have an abstract length" (wrap [output])
13801380
Just ops ->
13811381
onContractCode $ RuntimeCode (SymbolicRuntimeCode ops)
13821382
_ ->
@@ -1683,7 +1683,7 @@ cheatActions =
16831683
let callerAddr = vm.state.caller
16841684
fetchAccount contractAddr $ \contractAcct -> fetchAccount callerAddr $ \callerAcct -> do
16851685
let
1686-
-- the current contract is persited across forks
1686+
-- the current contract is persisted across forks
16871687
newContracts = Map.insert callerAddr callerAcct $
16881688
Map.insert contractAddr contractAcct forkState.env.contracts
16891689
newEnv = (forkState.env :: Env) { contracts = newContracts }
@@ -1893,7 +1893,7 @@ create self this xSize xGas xValue xs newAddr initCode = do
18931893
-- concrete region (initCode) followed by a potentially symbolic region
18941894
-- (arguments).
18951895
--
1896-
-- when constructing a contract that has symbolic construcor args, we
1896+
-- when constructing a contract that has symbolic constructor args, we
18971897
-- need to apply some heuristics to convert the (unstructured) initcode
18981898
-- in memory into this structured representation. The (unsound, bad,
18991899
-- hacky) way that we do this, is by: looking for the first potentially
@@ -2418,7 +2418,7 @@ vmOpIx vm =
24182418
do self <- currentContract vm
24192419
self.opIxMap SV.!? vm.state.pc
24202420

2421-
-- Maps operation indicies into a pair of (bytecode index, operation)
2421+
-- Maps operation indices into a pair of (bytecode index, operation)
24222422
mkCodeOps :: ContractCode -> V.Vector (Int, Op)
24232423
mkCodeOps contractCode =
24242424
let l = case contractCode of

src/EVM/ABI.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
2525
Nested sequences are encoded recursively with no special treatment.
2626
27-
Calldata args are encoded as heterogenous sequences sans length prefix.
27+
Calldata args are encoded as heterogeneous sequences sans length prefix.
2828
2929
-}
3030
module EVM.ABI

src/EVM/Expr.hs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,11 @@ sar = op2 SAR (\x y ->
205205
-- | Extracts the byte at a given index from a Buf.
206206
--
207207
-- We do our best to return a concrete value wherever possible, but fallback to
208-
-- an abstract expresion if nescessary. Note that a Buf is an infinite
208+
-- an abstract expression if necessary. Note that a Buf is an infinite
209209
-- structure, so reads outside of the bounds of a ConcreteBuf return 0. This is
210210
-- inline with the semantics of calldata and memory, but not of returndata.
211211

212-
-- fuly concrete reads
212+
-- fully concrete reads
213213
readByte :: Expr EWord -> Expr Buf -> Expr Byte
214214
readByte (Lit x) (ConcreteBuf b)
215215
= if x <= unsafeInto (maxBound :: Int) && i < BS.length b
@@ -235,7 +235,7 @@ readByte i@(Lit x) (CopySlice (Lit srcOffset) (Lit dstOffset) (Lit size) src dst
235235
then readByte (Lit $ x - (dstOffset - srcOffset)) src
236236
else readByte i dst
237237
readByte i@(Lit x) buf@(CopySlice _ (Lit dstOffset) (Lit size) _ dst)
238-
-- the byte we are trying to read is compeletely outside of the sliced region
238+
-- the byte we are trying to read is completely outside of the sliced region
239239
= if x - dstOffset >= size
240240
then readByte i dst
241241
else ReadByte (Lit x) buf
@@ -269,7 +269,7 @@ readWord idx b@(WriteWord idx' val buf)
269269
readWord (Lit idx) b@(CopySlice (Lit srcOff) (Lit dstOff) (Lit size) src dst)
270270
-- the region we are trying to read is enclosed in the sliced region
271271
| (idx - dstOff) < size && 32 <= size - (idx - dstOff) = readWord (Lit $ srcOff + (idx - dstOff)) src
272-
-- the region we are trying to read is compeletely outside of the sliced region
272+
-- the region we are trying to read is completely outside of the sliced region
273273
| (idx - dstOff) >= size && (idx - dstOff) <= (maxBound :: W256) - 31 = readWord (Lit idx) dst
274274
-- the region we are trying to read partially overlaps the sliced region
275275
| otherwise = readWordFromBytes (Lit idx) b
@@ -343,7 +343,7 @@ copySlice a@(Lit srcOffset) b@(Lit dstOffset) c@(Lit size) d@(ConcreteBuf src) e
343343
-- copying 32 bytes can be rewritten to a WriteWord on dst (e.g. CODECOPY of args during constructors)
344344
copySlice srcOffset dstOffset (Lit 32) src dst = writeWord dstOffset (readWord srcOffset src) dst
345345

346-
-- concrete indicies & abstract src (may produce a concrete result if we are
346+
-- concrete indices & abstract src (may produce a concrete result if we are
347347
-- copying from a concrete region of src)
348348
copySlice s@(Lit srcOffset) d@(Lit dstOffset) sz@(Lit size) src ds@(ConcreteBuf dst)
349349
| dstOffset < maxBytes, size < maxBytes, srcOffset + (size-1) > srcOffset = let
@@ -355,7 +355,7 @@ copySlice s@(Lit srcOffset) d@(Lit dstOffset) sz@(Lit size) src ds@(ConcreteBuf
355355
else CopySlice s d sz src ds
356356
| otherwise = CopySlice s d sz src ds
357357

358-
-- abstract indicies
358+
-- abstract indices
359359
copySlice srcOffset dstOffset size src dst = CopySlice srcOffset dstOffset size src dst
360360

361361

@@ -412,7 +412,7 @@ writeWord offset val src = WriteWord offset val src
412412
-- | Returns the length of a given buffer
413413
--
414414
-- If there are any writes to abstract locations, or CopySlices with an
415-
-- abstract size or dstOffset, an abstract expresion will be returned.
415+
-- abstract size or dstOffset, an abstract expression will be returned.
416416
bufLength :: Expr Buf -> Expr EWord
417417
bufLength = bufLengthEnv mempty False
418418

@@ -473,12 +473,12 @@ concretePrefix b = V.create $ do
473473
inputLen = case bufLength b of
474474
Lit s -> if s > maxIdx
475475
then internalError "concretePrefix: input buffer size exceeds 500mb"
476-
-- unafeInto: s is <= 500,000,000
476+
-- unsafeInto: s is <= 500,000,000
477477
else Just (unsafeInto s)
478478
_ -> Nothing
479479

480-
-- recursively reads succesive bytes from `b` until we reach a symbolic
481-
-- byte returns the larged index read from and a reference to the mutable
480+
-- recursively reads successive bytes from `b` until we reach a symbolic
481+
-- byte returns the large index read from and a reference to the mutable
482482
-- vec (might not be the same as the input because of the call to grow)
483483
go :: forall s . Int -> MVector s Word8 -> ST s (Int, MVector s Word8)
484484
go i v
@@ -529,7 +529,7 @@ toList buf = case bufLength buf of
529529
fromList :: V.Vector (Expr Byte) -> Expr Buf
530530
fromList bs = case Prelude.and (fmap isLitByte bs) of
531531
True -> ConcreteBuf . BS.pack . V.toList . V.mapMaybe maybeLitByte $ bs
532-
-- we want to minimize the size of the resulting expresion, so we do two passes:
532+
-- we want to minimize the size of the resulting expression, so we do two passes:
533533
-- 1. write all concrete bytes to some base buffer
534534
-- 2. write all symbolic writes on top of this buffer
535535
-- this is safe because each write in the input vec is to a single byte at a distinct location
@@ -640,7 +640,7 @@ readStorage w st = go (simplify w) st
640640

641641
-- the chance of adding a value <= 2^32 to any given keccack output
642642
-- leading to an overflow is effectively zero. the chance of an overflow
643-
-- occuring here is 2^32/2^256 = 2^-224, which is close enough to zero
643+
-- occurring here is 2^32/2^256 = 2^-224, which is close enough to zero
644644
-- for our purposes. This lets us completely simplify reads from write
645645
-- chains involving writes to arrays at literal offsets.
646646
(Lit a, Add (Lit b) (Keccak _) ) | a < 256, b < maxW32 -> go slot prev
@@ -1147,7 +1147,7 @@ simplifyProp prop =
11471147
where
11481148
go :: Prop -> Prop
11491149

1150-
-- LT/LEq comparisions
1150+
-- LT/LEq comparisons
11511151
go (PLT (Var _) (Lit 0)) = PBool False
11521152
go (PLEq (Lit 0) (Var _)) = PBool True
11531153
go (PLT (Lit val) (Var _)) | val == maxLit = PBool False
@@ -1298,7 +1298,7 @@ indexWord :: Expr EWord -> Expr EWord -> Expr Byte
12981298
-- Simplify masked reads:
12991299
--
13001300
--
1301-
-- reads across the mask boundry
1301+
-- reads across the mask boundary
13021302
-- return an abstract expression
13031303
--
13041304
--
@@ -1322,7 +1322,7 @@ indexWord :: Expr EWord -> Expr EWord -> Expr Byte
13221322
-- indexWord 31 reads from the LSB
13231323
--
13241324
indexWord i@(Lit idx) e@(And (Lit mask) w)
1325-
-- if the mask is all 1s then read from the undelrying word
1325+
-- if the mask is all 1s then read from the underlying word
13261326
-- we need this case to avoid overflow
13271327
| mask == fullWordMask = indexWord (Lit idx) w
13281328
-- if the index is a read from the masked region then read from the underlying word
@@ -1337,7 +1337,7 @@ indexWord i@(Lit idx) e@(And (Lit mask) w)
13371337
, isByteAligned mask
13381338
, idx < unmaskedBytes
13391339
= LitByte 0
1340-
-- if the mask is not a power of 2, or it does not align with a byte boundry return an abstract expression
1340+
-- if the mask is not a power of 2, or it does not align with a byte boundary return an abstract expression
13411341
| idx <= 31 = IndexWord i e
13421342
-- reads outside the range of the source word return 0
13431343
| otherwise = LitByte 0

src/EVM/Keccak.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ injProp (k1@(Keccak b1), k2@(Keccak b2)) =
6565
injProp _ = internalError "expected keccak expression"
6666

6767

68-
-- Takes a list of props, find all keccak occurences and generates two kinds of assumptions:
68+
-- Takes a list of props, find all keccak occurrences and generates two kinds of assumptions:
6969
-- 1. Minimum output value: That the output of the invocation is greater than
7070
-- 256 (needed to avoid spurious counterexamples due to storage collisions
7171
-- with solidity mappings & value type storage slots)

src/EVM/SMT.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ flattenBufs cex = do
119119
bs <- mapM collapse cex.buffers
120120
pure $ cex{ buffers = bs }
121121

122-
-- | Attemps to collapse a compressed buffer representation down to a flattened one
122+
-- | Attempts to collapse a compressed buffer representation down to a flattened one
123123
collapse :: BufModel -> Maybe BufModel
124124
collapse model = case toBuf model of
125125
Just (ConcreteBuf b) -> Just $ Flat b
@@ -696,7 +696,7 @@ exprToSMT = \case
696696
Mul a b -> op2 "bvmul" a b
697697
Exp a b -> case b of
698698
Lit b' -> expandExp a b'
699-
_ -> internalError "cannot encode symbolic exponentation into SMT"
699+
_ -> internalError "cannot encode symbolic exponentiation into SMT"
700700
Min a b ->
701701
let aenc = exprToSMT a
702702
benc = exprToSMT b in
@@ -1099,7 +1099,7 @@ getBufs getVal bufs = foldM getBuf mempty bufs
10991099
p -> parseErr p
11001100

11011101
-- | Takes a Map containing all reads from a store with an abstract base, as
1102-
-- well as the conrete part of the storage prestate and returns a fully
1102+
-- well as the concrete part of the storage prestate and returns a fully
11031103
-- concretized storage
11041104
getStore
11051105
:: (Text -> IO Text)

src/EVM/Solidity.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ makeSrcMaps = (\case (_, Fe, _) -> Nothing; x -> Just (done x))
282282

283283
go c (xs, state, p) = (xs, internalError ("srcmap: y u " ++ show c ++ " in state" ++ show state ++ "?!?"), p)
284284

285-
-- | Reads all solc ouput json files found under the provided filepath and returns them merged into a BuildOutput
285+
-- | Reads all solc output json files found under the provided filepath and returns them merged into a BuildOutput
286286
readBuildOutput :: FilePath -> ProjectType -> IO (Either String BuildOutput)
287287
readBuildOutput root DappTools = do
288288
let outDir = root </> "out"

src/EVM/Solvers.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ mkTimeout t = T.pack $ show $ (1000 *)$ case t of
253253
Nothing -> 300 :: Natural
254254
Just t' -> t'
255255

256-
-- | Arguments used when spawing a solver instance
256+
-- | Arguments used when spawning a solver instance
257257
solverArgs :: Solver -> Maybe Natural -> [Text]
258258
solverArgs solver timeout = case solver of
259259
Bitwuzla ->
@@ -299,7 +299,7 @@ spawnSolver solver timeout = do
299299
pure solverInstance
300300
Custom _ -> pure solverInstance
301301

302-
-- | Cleanly shutdown a running solver instnace
302+
-- | Cleanly shutdown a running solver instance
303303
stopSolver :: SolverInstance -> IO ()
304304
stopSolver (SolverInstance _ stdin stdout process) = cleanupProcess (Just stdin, Just stdout, Nothing, process)
305305

src/EVM/SymExec.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ reachable solvers e = do
521521
Unsat -> pure ([query], Nothing)
522522
r -> internalError $ "Invalid solver result: " <> show r
523523

524-
-- | Extract contraints stored in Expr End nodes
524+
-- | Extract constraints stored in Expr End nodes
525525
extractProps :: Expr End -> [Prop]
526526
extractProps = \case
527527
ITE _ _ _ -> []
@@ -838,7 +838,7 @@ formatCex cd sig m@(SMTCex _ _ _ store blockContext txContext) = T.unlines $
838838
where
839839
-- we attempt to produce a model for calldata by substituting all variables
840840
-- and buffers provided by the model into the original calldata expression.
841-
-- If we have a concrete result then we diplay it, otherwise we diplay
841+
-- If we have a concrete result then we display it, otherwise we display
842842
-- `Any`. This is a little bit of a hack (and maybe unsound?), but we need
843843
-- it for branches that do not refer to calldata at all (e.g. the top level
844844
-- callvalue check inserted by solidity in contracts that don't have any
@@ -915,7 +915,7 @@ prettyCalldata cex buf sig types = head (T.splitOn "(" sig) <> "(" <> body <> ")
915915

916916
-- | If the expression contains any symbolic values, default them to some
917917
-- concrete value The intuition here is that if we still have symbolic values
918-
-- in our calldata expression after substituing in our cex, then they can have
918+
-- in our calldata expression after substituting in our cex, then they can have
919919
-- any value and we can safely pick a random value. This is a bit unsatisfying,
920920
-- we should really be doing smth like: https://github.com/ethereum/hevm/issues/334
921921
-- but it's probably good enough for now

src/EVM/Types.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ mkUnpackedDoubleWord "Word512" ''Word256 "Int512" ''Int256 ''Word256
6969
-- Conversions -------------------------------------------------------------------------------------
7070

7171

72-
-- We ignore hlint to supress the warnings about `fromIntegral` and friends here
72+
-- We ignore hlint to suppress the warnings about `fromIntegral` and friends here
7373
#ifndef __HLINT__
7474

7575
instance From Addr Integer where from = fromIntegral
@@ -131,7 +131,7 @@ data EType
131131
| End
132132
deriving (Typeable)
133133

134-
-- Variables refering to a global environment
134+
-- Variables referring to a global environment
135135
data GVar (a :: EType) where
136136
BufVar :: Int -> GVar Buf
137137
StoreVar :: Int -> GVar Storage
@@ -141,7 +141,7 @@ deriving instance Eq (GVar a)
141141
deriving instance Ord (GVar a)
142142

143143
{- |
144-
Expr implements an abstract respresentation of an EVM program
144+
Expr implements an abstract representation of an EVM program
145145
146146
This type can give insight into the provenance of a term which is useful,
147147
both for the aesthetic purpose of printing terms in a richer way, but also to
@@ -1379,7 +1379,7 @@ formatString bs =
13791379
Right s -> "\"" <> T.unpack s <> "\""
13801380
Left _ -> "❮utf8 decode failed❯: " <> (show $ ByteStringS bs)
13811381

1382-
-- |'paddedShowHex' displays a number in hexidecimal and pads the number
1382+
-- |'paddedShowHex' displays a number in hexadecimal and pads the number
13831383
-- with 0 so that it has a minimum length of @w@.
13841384
paddedShowHex :: (Show a, Integral a) => Int -> a -> String
13851385
paddedShowHex w n = pad ++ str

0 commit comments

Comments
 (0)