Skip to content

Commit

Permalink
docs: fix typos (#3747)
Browse files Browse the repository at this point in the history
* docs: Fix typos

* fix tests
  • Loading branch information
BoboTiG authored Jan 30, 2024
1 parent c150fc4 commit 9002ed2
Show file tree
Hide file tree
Showing 23 changed files with 35 additions and 35 deletions.
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ It is un-audited software, use with caution.
## Audit reports

Vyper is constantly changing and improving.
This means the lastest version available may not be audited.
This means the latest version available may not be audited.
We try to ensure the highest security code possible, but occasionally things slip through.

### Compiler Audits
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Following the principles and goals, Vyper **does not** provide the following fea
* **Modifiers**: For example in Solidity you can define a ``function foo() mod1 { ... }``, where ``mod1`` can be defined elsewhere in the code to include a check that is done before execution, a check that is done after execution, some state changes, or possibly other things. Vyper does not have this, because it makes it too easy to write misleading code. ``mod1`` just looks too innocuous for something that could add arbitrary pre-conditions, post-conditions or state changes. Also, it encourages people to write code where the execution jumps around the file, harming auditability. The usual use case for a modifier is something that performs a single check before execution of a program; our recommendation is to simply inline these checks as asserts.
* **Class inheritance**: Class inheritance requires people to jump between multiple files to understand what a program is doing, and requires people to understand the rules of precedence in case of conflicts ("Which class's function ``X`` is the one that's actually used?"). Hence, it makes code too complicated to understand which negatively impacts auditability.
* **Inline assembly**: Adding inline assembly would make it no longer possible to search for a variable name in order to find all instances where that variable is read or modified.
* **Function overloading**: This can cause lots of confusion on which function is called at any given time. Thus it's easier to write missleading code (``foo("hello")`` logs "hello" but ``foo("hello", "world")`` steals your funds). Another problem with function overloading is that it makes the code much harder to search through as you have to keep track on which call refers to which function.
* **Function overloading**: This can cause lots of confusion on which function is called at any given time. Thus it's easier to write misleading code (``foo("hello")`` logs "hello" but ``foo("hello", "world")`` steals your funds). Another problem with function overloading is that it makes the code much harder to search through as you have to keep track on which call refers to which function.
* **Operator overloading**: Operator overloading makes writing misleading code possible. For example ``+`` could be overloaded so that it executes commands that are not visible at a first glance, such as sending funds the user did not want to send.
* **Recursive calling**: Recursive calling makes it impossible to set an upper bound on gas limits, opening the door for gas limit attacks.
* **Infinite-length loops**: Similar to recursive calling, infinite-length loops make it impossible to set an upper bound on gas limits, opening the door for gas limit attacks.
Expand Down
8 changes: 4 additions & 4 deletions docs/release-notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ Fixes:

- Memory corruption issue when performing function calls inside a tuple or another function call (`#2186 <https://github.com/vyperlang/vyper/pull/2186>`_)
- Incorrect function output when using multidimensional arrays (`#2184 <https://github.com/vyperlang/vyper/pull/2184>`_)
- Reduced ambiguity bewteen ``address`` and ``Bytes[20]`` (`#2191 <https://github.com/vyperlang/vyper/pull/2191>`_)
- Reduced ambiguity between ``address`` and ``Bytes[20]`` (`#2191 <https://github.com/vyperlang/vyper/pull/2191>`_)

v0.2.5
******
Expand Down Expand Up @@ -684,7 +684,7 @@ Breaking changes:
- ``@public`` and ``@private`` function decorators have been renamed to ``@external`` and ``@internal`` (VIP `#2065 <https://github.com/vyperlang/vyper/issues/2065>`_)
- The ``@constant`` decorator has been renamed to ``@view`` (VIP `#2040 <https://github.com/vyperlang/vyper/issues/2040>`_)
- Type units have been removed (VIP `#1881 <https://github.com/vyperlang/vyper/issues/1881>`_)
- Event declaraion syntax now resembles that of struct declarations (VIP `#1864 <https://github.com/vyperlang/vyper/issues/1864>`_)
- Event declaration syntax now resembles that of struct declarations (VIP `#1864 <https://github.com/vyperlang/vyper/issues/1864>`_)
- ``log`` is now a statement (VIP `#1864 <https://github.com/vyperlang/vyper/issues/1864>`_)
- Mapping declaration syntax changed to ``HashMap[key_type, value_type]`` (VIP `#1969 <https://github.com/vyperlang/vyper/issues/1969>`_)
- Interfaces are now declared via the ``interface`` keyword instead of ``contract`` (VIP `#1825 <https://github.com/vyperlang/vyper/issues/1825>`_)
Expand Down Expand Up @@ -823,7 +823,7 @@ Some of the bug and stability fixes:
- Fixed stack valency issues in if and for statements (`#1665 <https://github.com/vyperlang/vyper/pull/1665>`_)
- Prevent overflow when using ``sqrt`` on certain datatypes (`#1679 <https://github.com/vyperlang/vyper/pull/1679>`_)
- Prevent shadowing of internal variables (`#1601 <https://github.com/vyperlang/vyper/pull/1601>`_)
- Reject unary substraction on unsigned types (`#1638 <https://github.com/vyperlang/vyper/pull/1638>`_)
- Reject unary subtraction on unsigned types (`#1638 <https://github.com/vyperlang/vyper/pull/1638>`_)
- Disallow ``orelse`` syntax in ``for`` loops (`#1633 <https://github.com/vyperlang/vyper/pull/1633>`_)
- Increased clarity and efficiency of zero-padding (`#1605 <https://github.com/vyperlang/vyper/pull/1605>`_)

Expand Down Expand Up @@ -928,7 +928,7 @@ Here is the old changelog:
* **2019.03.04**: ``create_with_code_of`` has been renamed to ``create_forwarder_to``. (`#1177 <https://github.com/vyperlang/vyper/issues/1177>`_)
* **2019.02.14**: Assigning a persistent contract address can only be done using the ``bar_contact = ERC20(<address>)`` syntax.
* **2019.02.12**: ERC20 interface has to be imported using ``from vyper.interfaces import ERC20`` to use.
* **2019.01.30**: Byte array literals need to be annoted using ``b""``, strings are represented as `""`.
* **2019.01.30**: Byte array literals need to be annotated using ``b""``, strings are represented as `""`.
* **2018.12.12**: Disallow use of ``None``, disallow use of ``del``, implemented ``clear()`` built-in function.
* **2018.11.19**: Change mapping syntax to use ``map()``. (`VIP564 <https://github.com/vyperlang/vyper/issues/564>`_)
* **2018.10.02**: Change the convert style to use types instead of string. (`VIP1026 <https://github.com/vyperlang/vyper/issues/1026>`_)
Expand Down
4 changes: 2 additions & 2 deletions docs/style-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Internal Imports

Internal imports are those between two modules inside the same Vyper package.

* Internal imports **may** use either ``import`` or ``from ..`` syntax. The imported value **shoould** be a module, not an object. Importing modules instead of objects avoids circular dependency issues.
* Internal imports **may** use either ``import`` or ``from ..`` syntax. The imported value **should** be a module, not an object. Importing modules instead of objects avoids circular dependency issues.
* Internal imports **may** be aliased where it aids readability.
* Internal imports **must** use absolute paths. Relative imports cause issues when the module is moved.

Expand Down Expand Up @@ -250,7 +250,7 @@ Maintainers **may** request a rebase, or choose to squash merge pull requests t
Conventional Commits
--------------------

Commit messages **should** adhere to the `Conventional Commits <https://www.conventionalcommits.org/>`_ standard. A convetional commit message is structured as follows:
Commit messages **should** adhere to the `Conventional Commits <https://www.conventionalcommits.org/>`_ standard. A conventional commit message is structured as follows:

::

Expand Down
2 changes: 1 addition & 1 deletion docs/versioning.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ on the type of user, so that users can stay informed about the progress of Vyper
+=============+==============================================+
| Developers | Write smart contracts in Vyper |
+-------------+----------------------------------------------+
| Integrators | Integerating Vyper package or CLI into tools |
| Integrators | Integrating Vyper package or CLI into tools |
+-------------+----------------------------------------------+
| Auditors | Aware of Vyper features and security issues |
+-------------+----------------------------------------------+
Expand Down
2 changes: 1 addition & 1 deletion examples/factory/Factory.vy
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __init__(_exchange_codehash: bytes32):
# For example, allowing the deployer of this contract to change this
# value allows them to use a new contract if the old one has an issue.
# This would trigger a cascade effect across all exchanges that would
# need to be handled appropiately.
# need to be handled appropriately.


@external
Expand Down
6 changes: 3 additions & 3 deletions tests/functional/builtins/codegen/test_send.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ def __default__():

sender.test_send(receiver.address, transact={"gas": 100000})

# no value transfer hapenned, variable was not changed
# no value transfer happened, variable was not changed
assert receiver.last_sender() is None
assert w3.eth.get_balance(sender.address) == 1
assert w3.eth.get_balance(receiver.address) == 0

sender.test_call(receiver.address, transact={"gas": 100000})

# value transfer hapenned, variable was changed
# value transfer happened, variable was changed
assert receiver.last_sender() == sender.address
assert w3.eth.get_balance(sender.address) == 0
assert w3.eth.get_balance(receiver.address) == 1
Expand Down Expand Up @@ -88,7 +88,7 @@ def __default__():

sender.test_send_stipend(receiver.address, transact={"gas": 100000})

# value transfer hapenned, variable was changed
# value transfer happened, variable was changed
assert receiver.last_sender() == sender.address
assert w3.eth.get_balance(sender.address) == 0
assert w3.eth.get_balance(receiver.address) == 1
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def test_end_auction(w3, tester, auction_contract, tx_failed):
with tx_failed():
auction_contract.endAuction()
auction_contract.bid(transact={"value": 1 * 10**10, "from": k2})
# Move block timestamp foreward to reach auction end time
# Move block timestamp forward to reach auction end time
# tester.time_travel(tester.get_block_by_number('latest')['timestamp'] + EXPIRY)
w3.testing.mine(EXPIRY)
balance_before_end = w3.eth.get_balance(k1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def get_balance():


def test_initial_state(w3, tx_failed, get_contract, get_balance, contract_code):
# Inital deposit has to be divisible by two
# Initial deposit has to be divisible by two
with tx_failed():
get_contract(contract_code, value=13)
# Seller puts item up for sale
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def set_lucky(arg1: int128): pass
""",
"""
interface Bar:
# invalud interface declaration (assignment)
# invalid interface declaration (assignment)
def set_lucky(arg1: int128):
arg1 = 1
arg1 = 3
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/syntax/test_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
""",
InvalidType,
),
# reserverd keyword
# reserved keyword
(
"""
wei: constant(uint256) = 1
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/ast/test_natspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def test_partial_natspec():
@external
def foo():
'''
Regular comments preceeding natspec is not allowed
Regular comments preceding natspec is not allowed
@notice this is natspec
'''
pass
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/semantics/test_storage_slots.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
d: public(int128[4])
foo: public(HashMap[uint256, uint256[3]])
dyn_array: DynArray[uint256, 3]
e: public(String[47])
e: public(String[48])
f: public(int256[1])
g: public(StructTwo[2])
h: public(int256[1])
Expand All @@ -31,7 +31,7 @@ def __init__():
self.b = [7, 8]
self.c = b"thisisthirtytwobytesokhowdoyoudo"
self.d = [-1, -2, -3, -4]
self.e = "A realllllly long string but we wont use it all"
self.e = "A realllllly long string but we won't use it all"
self.f = [33]
self.g = [
StructTwo({a: b"hello", b: [-66, 420], c: "another string"}),
Expand Down Expand Up @@ -65,7 +65,7 @@ def test_storage_slots(get_contract):
assert [c.b(i) for i in range(2)] == [7, 8]
assert c.c() == b"thisisthirtytwobytesokhowdoyoudo"
assert [c.d(i) for i in range(4)] == [-1, -2, -3, -4]
assert c.e() == "A realllllly long string but we wont use it all"
assert c.e() == "A realllllly long string but we won't use it all"
assert c.f(0) == 33
assert c.g(0) == (b"hello", [-66, 420], "another string")
assert c.g(1) == (
Expand All @@ -90,7 +90,7 @@ def test_reentrancy_lock(get_contract):
assert [c.b(i) for i in range(2)] == [7, 8]
assert c.c() == b"thisisthirtytwobytesokhowdoyoudo"
assert [c.d(i) for i in range(4)] == [-1, -2, -3, -4]
assert c.e() == "A realllllly long string but we wont use it all"
assert c.e() == "A realllllly long string but we won't use it all"
assert c.f(0) == 33
assert c.g(0) == (b"hello", [-66, 420], "another string")
assert c.g(1) == (
Expand Down
2 changes: 1 addition & 1 deletion vyper/ast/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Conversion between a Python Node and a Vyper Node uses the following rules:
* The type of Vyper node is determined from the `ast_type` field of the Python node.
* Fields listed in `__slots__` may be included and may have a value.
* Fields listed in `_translated_fields` have their key modified prior to being added.
This is used to handle discrepencies in how nodes are structured between different
This is used to handle discrepancies in how nodes are structured between different
Python versions.
* Fields listed in `_only_empty_fields`, if present within the Python AST, must
be `None` or a `SyntaxException` is raised.
Expand Down
2 changes: 1 addition & 1 deletion vyper/ast/grammar.lark
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ _BITAND: "&"
_BITOR: "|"
_BITXOR: "^"

// Comparisions
// Comparisons
_EQ: "=="
_NE: "!="
_LE: "<="
Expand Down
2 changes: 1 addition & 1 deletion vyper/ast/identifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def validate_identifier(attr, ast_node=None):
"mwei",
"twei",
"pwei",
# sentinal constant values
# sentinel constant values
# TODO remove when these are removed from the language
"zero_address",
"empty_bytes32",
Expand Down
2 changes: 1 addition & 1 deletion vyper/ast/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def _commit_inner(self):

outer = self._node_updates[-1]

# register with previous frame in case inner gets commited
# register with previous frame in case inner gets committed
# but outer needs to be rolled back
for (_, k), (metadata, prev) in inner.items():
if (id(metadata), k) not in outer:
Expand Down
4 changes: 2 additions & 2 deletions vyper/codegen/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def __init__(
# Active scopes
self._scopes = set()

# Memory alloctor, keeps track of currently allocated memory.
# Memory allocator, keeps track of currently allocated memory.
# Not intended to be accessed directly
self.memory_allocator = memory_allocator

Expand All @@ -101,7 +101,7 @@ def check_is_not_constant(self, err, expr):
if self.is_constant():
raise StateAccessViolation(f"Cannot {err} from {self.pp_constancy()}", expr)

# convenience propreties
# convenience properties
@property
def is_payable(self):
return self.func_t.is_payable
Expand Down
2 changes: 1 addition & 1 deletion vyper/codegen/memory_allocator.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def partially_allocate(self, size: int) -> int:

class MemoryAllocator:
"""
Low-level memory alloctor. Used to allocate and de-allocate memory slots.
Low-level memory allocator. Used to allocate and de-allocate memory slots.
This object should not be accessed directly. Memory allocation happens via
declaring variables within `Context`.
Expand Down
4 changes: 2 additions & 2 deletions vyper/semantics/types/bytestrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ def validate_literal(self, node: vy_ast.Constant) -> None:

if len(node.value) != self.length:
# should always be constructed with correct length
# at the point that validate_literal is calle.d
# at the point that validate_literal is called
raise CompilerPanic("unreachable")

@property
def size_in_bytes(self):
# the first slot (32 bytes) stores the actual length, and then we reserve
# enough additional slots to store the data if it uses the max available length
# because this data type is single-bytes, we make it so it takes the max 32 byte
# boundary as it's size, instead of giving it a size that is not cleanly divisble by 32
# boundary as it's size, instead of giving it a size that is not cleanly divisible by 32

return 32 + ceil32(self.length)

Expand Down
2 changes: 1 addition & 1 deletion vyper/semantics/types/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def from_InterfaceDef(cls, funcdef: vy_ast.FunctionDef) -> "ContractFunctionT":
-------
ContractFunctionT
"""
# FunctionDef with stateMutability in body (Interface defintions)
# FunctionDef with stateMutability in body (Interface definitions)
body = funcdef.body
if (
len(body) == 1
Expand Down
2 changes: 1 addition & 1 deletion vyper/venom/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ A Venom program may feature basic blocks with multiple CFG inputs and outputs. T

### Code emission

This final pass of the compiler aims to emit EVM assembly recognized by Vyper's assembler. It calcluates the desired stack layout for every basic block, schedules items on the stack and selects instructions. It ensures that deploy code, runtime code, and data segments are arranged according to the assembler's expectations.
This final pass of the compiler aims to emit EVM assembly recognized by Vyper's assembler. It calculates the desired stack layout for every basic block, schedules items on the stack and selects instructions. It ensures that deploy code, runtime code, and data segments are arranged according to the assembler's expectations.

## Future planned passes

Expand Down
4 changes: 2 additions & 2 deletions vyper/venom/ir_node_to_venom.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
]
)

# Instuctions that are mapped to their inverse
# Instructions that are mapped to their inverse
INVERSE_MAPPED_IR_INSTRUCTIONS = {"ne": "eq", "le": "gt", "sle": "sgt", "ge": "lt", "sge": "slt"}

# Instructions that have a direct EVM opcode equivalent and can
Expand Down Expand Up @@ -508,7 +508,7 @@ def _convert_ir_bb(ctx, ir, symbols, variables, allocated_variables):
assert func_t is not None, "exit_to without func_t"

if func_t.is_external:
# Hardcoded contructor special case
# Hardcoded constructor special case
bb = ctx.get_basic_block()
if func_t.name == "__init__":
label = IRLabel(ir.args[0].value, True)
Expand Down

0 comments on commit 9002ed2

Please sign in to comment.