Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checked spelling #503

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/typos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# https://github.com/crate-ci/typos/blob/master/docs/github-action.md

name: Typos

on: [pull_request]

jobs:
run:
name: Spell check with Typos
runs-on: ubuntu-latest
steps:
- name: clone repo
uses: actions/checkout@v4

- name: check spelling
uses: crate-ci/typos@master
8 changes: 4 additions & 4 deletions account/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import (
)

var (
ErrNotAllParametersSet = errors.New("Not all neccessary parameters have been set")
ErrTxnTypeUnSupported = errors.New("Unsupported transction type")
ErrTxnVersionUnSupported = errors.New("Unsupported transction version")
ErrNotAllParametersSet = errors.New("Not all necessary parameters have been set")
ErrTxnTypeUnSupported = errors.New("Unsupported transaction type")
ErrTxnVersionUnSupported = errors.New("Unsupported transaction version")
ErrFeltToBigInt = errors.New("Felt to BigInt error")
)

Expand Down Expand Up @@ -939,7 +939,7 @@ func FmtCallDataCairo0(callArray []rpc.FunctionCall) []*felt.Felt {
return calldata
}

// FmtCallDataCairo2 generates the calldata for the given function calls for Cairo 2 contracs.
// FmtCallDataCairo2 generates the calldata for the given function calls for Cairo 2 contracts.
//
// Parameters:
// - fnCalls: a slice of rpc.FunctionCall containing the function calls.
Expand Down
2 changes: 1 addition & 1 deletion curve/curve.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package curve

/*
Although the library adheres to the 'elliptic/curve' interface.
All testing has been done against library function explicity.
All testing has been done against library function explicitly.
It is recommended to use in the same way(i.e. `curve.Sign` and not `ecdsa.Sign`).
*/
import (
Expand Down
2 changes: 1 addition & 1 deletion curve/curve_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ func TestGeneral_HashAndSign(t *testing.T) {
big.NewInt(1953658213),
})
if err != nil {
t.Errorf("Hasing elements: %v\n", err)
t.Errorf("Hashing elements: %v\n", err)
}

priv, _ := Curve.GetRandomPrivateKey()
Expand Down
6 changes: 3 additions & 3 deletions hash/hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func CalculateTransactionHashCommon(
// The hash is calculated using the PoseidonArray function from the Curve package.
// The elements used in the hash calculation include the contract class version, constructor entry point, external entry point, L1 handler entry point, ABI, and Sierra program.
// The ABI is converted to bytes and then hashed using the StarknetKeccak function from the Curve package.
// Finally, the ContractClassVersionHash, ExternalHash, L1HandleHash, ConstructorHash, ABIHash, and SierraProgamHash are combined using the PoseidonArray function from the Curve package.
// Finally, the ContractClassVersionHash, ExternalHash, L1HandleHash, ConstructorHash, ABIHash, and SierraProgramHash are combined using the PoseidonArray function from the Curve package.
//
// Parameters:
// - contract: A contract class object of type rpc.ContractClass.
Expand All @@ -84,14 +84,14 @@ func ClassHash(contract rpc.ContractClass) (*felt.Felt, error) {
ConstructorHash := hashEntryPointByType(contract.EntryPointsByType.Constructor)
ExternalHash := hashEntryPointByType(contract.EntryPointsByType.External)
L1HandleHash := hashEntryPointByType(contract.EntryPointsByType.L1Handler)
SierraProgamHash := curve.Curve.PoseidonArray(contract.SierraProgram...)
SierraProgramHash := curve.Curve.PoseidonArray(contract.SierraProgram...)
ABIHash, err := curve.Curve.StarknetKeccak([]byte(contract.ABI))
if err != nil {
return nil, err
}

// https://docs.starknet.io/documentation/architecture_and_concepts/Network_Architecture/transactions/#deploy_account_hash_calculation
return curve.Curve.PoseidonArray(ContractClassVersionHash, ExternalHash, L1HandleHash, ConstructorHash, ABIHash, SierraProgamHash), nil
return curve.Curve.PoseidonArray(ContractClassVersionHash, ExternalHash, L1HandleHash, ConstructorHash, ABIHash, SierraProgramHash), nil
}

// hashEntryPointByType calculates the hash of an entry point by type.
Expand Down
4 changes: 2 additions & 2 deletions hash/hash_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import (
"github.com/test-go/testify/require"
)

// TestUnmarshalCasmClassHash is a test function that tests the unmarshaling of a CasmClass hash.
// TestUnmarshalCasmClassHash is a test function that tests the unmarshalling of a CasmClass hash.
//
// It reads the content of the "./tests/hello_starknet_compiled.casm.json" file and unmarshals it into a contracts.CasmClass variable.
// The function returns an assertion error if there is an error reading the file or unmarshaling the content.
// The function returns an assertion error if there is an error reading the file or unmarshalling the content.
// Parameters:
// - t: A testing.T object used for running the test and reporting any failures.
// Returns:
Expand Down
2 changes: 1 addition & 1 deletion rpc/json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func TestJSONMultiTypeArrayWithDuck(t *testing.T) {
}
}

// TestJSONMixingStructWithMap tests the JSON unmarshaling of a struct that mixes fields and a map.
// TestJSONMixingStructWithMap tests the JSON unmarshalling of a struct that mixes fields and a map.
//
// This function checks if the JSON content can be successfully unmarshaled into a struct that contains
// a mixture of fields and a map (map[string]interface{}).
Expand Down
6 changes: 3 additions & 3 deletions rpc/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func (s SyncStatus) MarshalJSON() ([]byte, error) {
// -data: It takes a byte slice as input representing the JSON data to be unmarshaled.
//
// Returns:
// - error: an error if the unmarshaling fails
// - error: an error if the unmarshalling fails
func (s *SyncStatus) UnmarshalJSON(data []byte) error {
return json.Unmarshal(data, s)

Expand Down Expand Up @@ -213,7 +213,7 @@ const (
// Parameters:
// - data: It takes a byte slice as a parameter, which represents the JSON data to be unmarshalled
// Returns:
// - error: an error if the unmarshaling fails
// - error: an error if the unmarshalling fails
func (ts *TxnExecutionStatus) UnmarshalJSON(data []byte) error {
unquoted, err := strconv.Unquote(string(data))
if err != nil {
Expand Down Expand Up @@ -270,7 +270,7 @@ const (
// Parameters:
// - data: It takes a byte slice as a parameter, which represents the JSON data to be unmarshalled
// Returns:
// - error: an error if the unmarshaling fails
// - error: an error if the unmarshalling fails
func (ts *TxnFinalityStatus) UnmarshalJSON(data []byte) error {
unquoted, err := strconv.Unquote(string(data))
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions rpc/types_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ const (
// UnmarshalJSON unmarshals the JSON representation of a BlockStatus.
//
// It takes in a byte slice containing the JSON data to be unmarshaled.
// The function returns an error if there is an issue unmarshaling the data.
// The function returns an error if there is an issue unmarshalling the data.
//
// Parameters:
// - data: It takes a byte slice as a parameter, which represents the JSON data to be unmarshaled
// Returns:
// - error: an error if the unmarshaling fails
// - error: an error if the unmarshalling fails
func (bs *BlockStatus) UnmarshalJSON(data []byte) error {
unquoted, err := strconv.Unquote(string(data))
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion rpc/types_block_transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ func (txns *BlockTransactions) UnmarshalJSON(data []byte) error {
// - t: The interface{} to be unmarshalled
// Returns:
// - BlockTransaction: a BlockTransaction
// - error: an error if the unmarshaling process fails
// - error: an error if the unmarshalling process fails
func unmarshalBlockTxn(t interface{}) (BlockTransaction, error) {
switch casted := t.(type) {
case map[string]interface{}:
Expand Down
2 changes: 1 addition & 1 deletion rpc/types_contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ type StructABIEntry struct {
// The event name
Name string `json:"name"`

// todo(minumum size should be 1)
// todo(minimum size should be 1)
Size uint64 `json:"size"`

Members []Member `json:"members"`
Expand Down
4 changes: 2 additions & 2 deletions rpc/types_transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ func (txn *UnknownTransaction) UnmarshalJSON(data []byte) error {
// - t: The interface{} to be unmarshalled
// Returns:
// - Transaction: a Transaction object
// - error: an error if the unmarshaling process fails
// - error: an error if the unmarshalling process fails
func unmarshalTxn(t interface{}) (Transaction, error) {
switch casted := t.(type) {
case map[string]interface{}:
Expand Down Expand Up @@ -321,7 +321,7 @@ func unmarshalTxn(t interface{}) (Transaction, error) {
// - v: The interface{} value to be marshaled
// - dst: The interface{} value to be unmarshaled
// Returns:
// - error: An error if the marshaling or unmarshaling process fails
// - error: An error if the marshaling or unmarshalling process fails
func remarshal(v interface{}, dst interface{}) error {
data, err := json.Marshal(v)
if err != nil {
Expand Down
8 changes: 4 additions & 4 deletions rpc/types_transaction_receipt.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ const (
//
// If none of the supported values match the input data, the function returns an error.
//
// nil if the unmarshaling is successful.
// nil if the unmarshalling is successful.
//
// Parameters:
// - data: It takes a byte slice as input representing the JSON data to be unmarshaled
// Returns:
// - error: an error if the unmarshaling fails
// - error: an error if the unmarshalling fails
func (tt *TransactionType) UnmarshalJSON(data []byte) error {
unquoted, err := strconv.Unquote(string(data))
if err != nil {
Expand Down Expand Up @@ -468,7 +468,7 @@ type UnknownTransactionReceipt struct{ TransactionReceipt }
// Parameters:
// - data: It takes a byte slice as a parameter, which represents the JSON data to be unmarshalled
// Returns:
// - error: an error if the unmarshaling fails
// - error: an error if the unmarshalling fails
func (tr *UnknownTransactionReceipt) UnmarshalJSON(data []byte) error {
var dec map[string]interface{}
if err := json.Unmarshal(data, &dec); err != nil {
Expand All @@ -489,7 +489,7 @@ func (tr *UnknownTransactionReceipt) UnmarshalJSON(data []byte) error {
// - t: The interface{} to be unmarshalled
// Returns:
// - TransactionReceipt: a TransactionReceipt
// - error: an error if the unmarshaling fails
// - error: an error if the unmarshalling fails
func unmarshalTransactionReceipt(t interface{}) (TransactionReceipt, error) {
switch casted := t.(type) {
case map[string]interface{}:
Expand Down
4 changes: 2 additions & 2 deletions rpc/write_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func TestDeclareTransaction(t *testing.T) {
t.Fatal("should be able to read file", err)
}
var declareTx AddDeclareTxnInput
require.Nil(t, json.Unmarshal(declareTxJSON, &declareTx), "Error unmarshalling decalreTx")
require.Nil(t, json.Unmarshal(declareTxJSON, &declareTx), "Error unmarshalling declareTx")
test.DeclareTx = declareTx
}

Expand Down Expand Up @@ -178,7 +178,7 @@ func TestAddInvokeTransaction(t *testing.T) {
}
}

func TestAddDeployAccountTansaction(t *testing.T) {
func TestAddDeployAccountTransaction(t *testing.T) {

testConfig := beforeEach(t)

Expand Down
2 changes: 1 addition & 1 deletion typed/typed.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func strToFelt(str string) *felt.Felt {
f.SetBytes(b.Bytes())
return f
}
// TODO: revisit conversation on seperate 'ShortString' conversion
// TODO: revisit conversation on separate 'ShortString' conversion
if asciiRegexp.MatchString(str) {
hexStr := hex.EncodeToString([]byte(str))
if b, ok := new(big.Int).SetString(hexStr, 16); ok {
Expand Down