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

Klaytn -> Kaia in comments (+ lint all files) #2152

Merged
merged 16 commits into from
May 10, 2024
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion accounts/abi/bind/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func NewKeyedTransactor(key *ecdsa.PrivateKey) *TransactOpts {
}
}

// TODO-klaytn: clef related code
// TODO-Kaia: clef related code
/*
// NewClefTransactor is a utility method to easily create a transaction signer
// with a clef backend.
Expand Down
4 changes: 2 additions & 2 deletions accounts/abi/bind/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ type ContractCaller interface {
// CodeAt returns the code of the given account. This is needed to differentiate
// between contract internal errors and the local chain being out of sync.
CodeAt(ctx context.Context, contract common.Address, blockNumber *big.Int) ([]byte, error)
// ContractCall executes a Klaytn contract call with the specified data as the
// ContractCall executes a Kaia contract call with the specified data as the
// input.
CallContract(ctx context.Context, call klaytn.CallMsg, blockNumber *big.Int) ([]byte, error)
}
Expand All @@ -62,7 +62,7 @@ type ContractCaller interface {
type PendingContractCaller interface {
// PendingCodeAt returns the code of the given account in the pending state.
PendingCodeAt(ctx context.Context, contract common.Address) ([]byte, error)
// PendingCallContract executes a Klaytn contract call against the pending state.
// PendingCallContract executes a Kaia contract call against the pending state.
PendingCallContract(ctx context.Context, call klaytn.CallMsg) ([]byte, error)
}

Expand Down
6 changes: 3 additions & 3 deletions accounts/abi/bind/backends/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func (b *BlockchainContractBackend) callContract(call klaytn.CallMsg, block *typ
txContext := blockchain.NewEVMTxContext(msg, block.Header())
blockContext := blockchain.NewEVMBlockContext(block.Header(), b.bc, nil)

// EVM demands the sender to have enough KLAY balance (gasPrice * gasLimit) in buyGas()
// EVM demands the sender to have enough KAIA balance (gasPrice * gasLimit) in buyGas()
// After KIP-71, gasPrice is nonzero baseFee, regardless of the msg.gasPrice (usually 0)
// But our sender (usually 0x0) won't have enough balance. Instead we override gasPrice = 0 here
txContext.GasPrice = big.NewInt(0)
Expand Down Expand Up @@ -173,7 +173,7 @@ func (b *BlockchainContractBackend) getBlockAndState(num *big.Int) (*types.Block
// bind.ContractTransactor defined methods

func (b *BlockchainContractBackend) PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error) {
// TODO-Klaytn this is not pending code but latest code
// TODO-Kaia this is not pending code but latest code
state, err := b.bc.State()
if err != nil {
return nil, err
Expand All @@ -185,7 +185,7 @@ func (b *BlockchainContractBackend) PendingNonceAt(ctx context.Context, account
if b.txPool != nil {
return b.txPool.GetPendingNonce(account), nil
}
// TODO-Klaytn this is not pending nonce but latest nonce
// TODO-Kaia this is not pending nonce but latest nonce
state, err := b.bc.State()
if err != nil {
return 0, err
Expand Down
2 changes: 1 addition & 1 deletion accounts/abi/bind/backends/simulated.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ var (
// DeployBackend, GasEstimator, GasPricer, LogFilterer, PendingContractCaller, TransactionReader, and TransactionSender
type SimulatedBackend struct {
database database.DBManager // In memory database to store our testing data
blockchain *blockchain.BlockChain // Klaytn blockchain to handle the consensus
blockchain *blockchain.BlockChain // Kaia blockchain to handle the consensus

mu sync.Mutex
pendingBlock *types.Block // Currently pending block that will be imported on request
Expand Down
23 changes: 12 additions & 11 deletions accounts/abi/bind/backends/simulated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,17 @@ func TestSimulatedBackend(t *testing.T) {

var testKey, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")

// the following is based on this contract:
// contract T {
// event received(address sender, uint amount, bytes memo);
// event receivedAddr(address sender);
// the following is based on this contract:
// contract T {
// event received(address sender, uint amount, bytes memo);
// event receivedAddr(address sender);
//
// function receive(bytes calldata memo) external payable returns (string memory res) {
// emit received(msg.sender, msg.value, memo);
// emit receivedAddr(msg.sender);
// return "hello world";
// }
// }
// function receive(bytes calldata memo) external payable returns (string memory res) {
// emit received(msg.sender, msg.value, memo);
// emit receivedAddr(msg.sender);
// return "hello world";
// }
// }
const abiJSON = `[ { "constant": false, "inputs": [ { "name": "memo", "type": "bytes" } ], "name": "receive", "outputs": [ { "name": "res", "type": "string" } ], "payable": true, "stateMutability": "payable", "type": "function" }, { "anonymous": false, "inputs": [ { "indexed": false, "name": "sender", "type": "address" }, { "indexed": false, "name": "amount", "type": "uint256" }, { "indexed": false, "name": "memo", "type": "bytes" } ], "name": "received", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "name": "sender", "type": "address" } ], "name": "receivedAddr", "type": "event" } ]`

const (
Expand Down Expand Up @@ -879,7 +879,8 @@ func TestSimulatedBackend_CodeAt(t *testing.T) {
}

// When receive("X") is called with sender 0x00... and value 1, it produces this tx receipt:
// receipt{status=1 cgas=23949 bloom=00000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000040200000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 logs=[log: b6818c8064f645cd82d99b59a1a267d6d61117ef [75fd880d39c1daf53b6547ab6cb59451fc6452d27caa90e5b6649dd8293b9eed] 000000000000000000000000376c47978271565f56deb45495afa69e59c16ab200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000158 9ae378b6d4409eada347a5dc0c180f186cb62dc68fcc0f043425eb917335aa28 0 95d429d309bb9d753954195fe2d69bd140b4ae731b9b5b605c34323de162cf00 0]}
//
// receipt{status=1 cgas=23949 bloom=00000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000040200000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 logs=[log: b6818c8064f645cd82d99b59a1a267d6d61117ef [75fd880d39c1daf53b6547ab6cb59451fc6452d27caa90e5b6649dd8293b9eed] 000000000000000000000000376c47978271565f56deb45495afa69e59c16ab200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000158 9ae378b6d4409eada347a5dc0c180f186cb62dc68fcc0f043425eb917335aa28 0 95d429d309bb9d753954195fe2d69bd140b4ae731b9b5b605c34323de162cf00 0]}
func TestSimulatedBackend_PendingAndCallContract(t *testing.T) {
testAddr := crypto.PubkeyToAddress(testKey.PublicKey)
sim := simTestBackend(testAddr)
Expand Down
12 changes: 6 additions & 6 deletions accounts/abi/bind/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ type CallOpts struct {
}

// TransactOpts is the collection of authorization data required to create a
// valid Klaytn transaction.
// valid Kaia transaction.
type TransactOpts struct {
From common.Address // Klaytn account to send the transaction from
From common.Address // Kaia account to send the transaction from
Nonce *big.Int // Nonce to use for the transaction execution (nil = use pending state)
Signer SignerFn // Method to use for signing the transaction (mandatory)

Expand Down Expand Up @@ -102,11 +102,11 @@ func (m *MetaData) GetAbi() (*abi.ABI, error) {
}

// BoundContract is the base wrapper object that reflects a contract on the
// Klaytn network. It contains a collection of methods that are used by the
// Kaia network. It contains a collection of methods that are used by the
// higher level contract bindings to operate.
type BoundContract struct {
address common.Address // Deployment address of the contract on the Klaytn blockchain
abi abi.ABI // Reflect based ABI to access the correct Klaytn methods
address common.Address // Deployment address of the contract on the Kaia blockchain
abi abi.ABI // Reflect based ABI to access the correct Kaia methods
caller ContractCaller // Read interface to interact with the blockchain
transactor ContractTransactor // Write interface to interact with the blockchain
filterer ContractFilterer // Event filtering to interact with the blockchain
Expand All @@ -124,7 +124,7 @@ func NewBoundContract(address common.Address, abi abi.ABI, caller ContractCaller
}
}

// DeployContract deploys a contract onto the Klaytn network and binds the
// DeployContract deploys a contract onto the Kaia network and binds the
// deployment address with a Go wrapper.
func DeployContract(opts *TransactOpts, abi abi.ABI, bytecode []byte, backend ContractBackend, params ...interface{}) (common.Address, *types.Transaction, *BoundContract, error) {
// Otherwise try to deploy the contract
Expand Down
4 changes: 2 additions & 2 deletions accounts/abi/bind/bind_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1871,7 +1871,7 @@ func TestGolangBindings(t *testing.T) {
}
})
}
// Convert the package to go modules and use the current source for klaytn
// Convert the package to go modules and use the current source for Kaia
moder := exec.Command(gocmd, "mod", "init", "bindtest")
moder.Dir = pkg
if out, err := moder.CombinedOutput(); err != nil {
Expand All @@ -1896,7 +1896,7 @@ func TestGolangBindings(t *testing.T) {
}
}

// TODO-klaytn: change org.ethereum.geth to org.klaytn when ready
// TODO-Kaia: change org.ethereum.geth to org.Kaia when ready
// Tests that java binding generated by the binder is exactly matched.
func TestJavaBindings(t *testing.T) {
cases := []struct {
Expand Down
18 changes: 9 additions & 9 deletions accounts/abi/bind/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@
// Modified and improved for the klaytn development.

/*
Package bind generates Go bindings for Klaytn contracts.
Package bind generates Go bindings for Kaia contracts.

Source Files
# Source Files

Each file provides following features
- auth.go : Provides functions to create transaction signer from a private key or a keystore wallet
- backend.go : Defines various interfaces which work as a backend in deploying / calling a contract and filtering logs
- base.go : Provides functions to deploy a contract, filter / watch logs, invoke a transaction and so on
- bind.go : Provides functions to generate a wrapper around a contract ABI
- template.go : Provides templates to build a binding to use a contract in Go and Java
- topics.go : Provides functions for making and parsing topics
- util.go : Provides utility functions to wait for a transaction to be mined
- auth.go : Provides functions to create transaction signer from a private key or a keystore wallet
- backend.go : Defines various interfaces which work as a backend in deploying / calling a contract and filtering logs
- base.go : Provides functions to deploy a contract, filter / watch logs, invoke a transaction and so on
- bind.go : Provides functions to generate a wrapper around a contract ABI
- template.go : Provides templates to build a binding to use a contract in Go and Java
- topics.go : Provides functions for making and parsing topics
- util.go : Provides utility functions to wait for a transaction to be mined
*/
package bind
26 changes: 13 additions & 13 deletions accounts/abi/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,28 @@
// Modified and improved for the klaytn development.

/*
Package abi implements the Klaytn ABI (Application Binary
Package abi implements the Kaia ABI (Application Binary
Interface).

The Klaytn ABI is strongly typed, known at compile time
The Kaia ABI is strongly typed, known at compile time
and static. This ABI will handle basic type casting; unsigned
to signed and visa versa. It does not handle slice casting such
as unsigned slice to signed slice. Bit size type casting is also
handled. ints with a bit size of 32 will be properly cast to int256,
etc.

Source Files
# Source Files

Each file provides the following features
- abi.go : Provides `ABI` struct which holds information about a contract's context and available invokable methods. It will allow you to type check function calls and packs data accordingly.
- argument.go : Provides `Argument` which holds the name of the argument and the corresponding type.
- error.go : Provides type check functions
- event.go : Provides `Event` struct which is an event potentially triggered by the EVM's LOG mechanism
- method.go : Provides `Method` struct which represents a callable given a `Name` and whether the method is a constant.
- numbers.go : Provides U256 function which converts a big Int into a 256 bit EVM number.
- pack.go : Provides functions which pack bytes slice, element and number
- reflect.go : Provides functions to map an ABI to a struct and detect the type and the kind of a field using reflection
- type.go : Provides `Type` struct which is the reflection of the supported argument type
- unpack.go : Provides functions which read values based on their kind
- abi.go : Provides `ABI` struct which holds information about a contract's context and available invokable methods. It will allow you to type check function calls and packs data accordingly.
- argument.go : Provides `Argument` which holds the name of the argument and the corresponding type.
- error.go : Provides type check functions
- event.go : Provides `Event` struct which is an event potentially triggered by the EVM's LOG mechanism
- method.go : Provides `Method` struct which represents a callable given a `Name` and whether the method is a constant.
- numbers.go : Provides U256 function which converts a big Int into a 256 bit EVM number.
- pack.go : Provides functions which pack bytes slice, element and number
- reflect.go : Provides functions to map an ABI to a struct and detect the type and the kind of a field using reflection
- type.go : Provides `Type` struct which is the reflection of the supported argument type
- unpack.go : Provides functions which read values based on their kind
*/
package abi
1 change: 0 additions & 1 deletion accounts/abi/pack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ func TestPack(t *testing.T) {
}
var packed []byte
packed, err = inAbi.Pack("method", test.unpacked)

if err != nil {
t.Fatalf("test %d (%v) failed: %v", i, test.def, err)
}
Expand Down
4 changes: 2 additions & 2 deletions accounts/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ import (
"github.com/klaytn/klaytn/event"
)

// Account represents a Klaytn account located at a specific location defined
// Account represents a Kaia account located at a specific location defined
// by the optional URL field.
type Account struct {
Address common.Address `json:"address"` // Klaytn account address derived from the key
Address common.Address `json:"address"` // Kaia account address derived from the key
URL URL `json:"url"` // Optional resource locator within a backend
}

Expand Down
17 changes: 9 additions & 8 deletions accounts/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,19 @@
// Modified and improved for the klaytn development.

/*
Package accounts implements high level Klaytn account management.
Package accounts implements high level Kaia account management.

There are several important data structures and their hierarchy is as below
Manager -> Backend -> Wallet -> Account

Source Files
Manager -> Backend -> Wallet -> Account

# Source Files

Each file provides the following features
- accounts.go : Provides `Account` struct and Wallet/Backend interfaces. `Account` represents a Klaytn account located at a specific location defined by the optional URL field. `Wallet` represents a software or hardware wallet and `Backend` is a wallet provider that may contain a batch of accounts they can sign transactions with
- errors.go : Provides various account related error variables and helper functions
- hd.go : Defines derivation paths for Klaytn and parser function to derive the path from a path string. Klaytn uses 8217 as its coin type
- manager.go : Provides `Manager` which is an overarching account manager that can communicate with various backends for signing transactions
- url.go : Provides `URL` struct which represents the canonical identification URL of a wallet or account
- accounts.go : Provides `Account` struct and Wallet/Backend interfaces. `Account` represents a Kaia account located at a specific location defined by the optional URL field. `Wallet` represents a software or hardware wallet and `Backend` is a wallet provider that may contain a batch of accounts they can sign transactions with
- errors.go : Provides various account related error variables and helper functions
- hd.go : Defines derivation paths for Kaia and parser function to derive the path from a path string. Kaia uses 8217 as its coin type
- manager.go : Provides `Manager` which is an overarching account manager that can communicate with various backends for signing transactions
- url.go : Provides `URL` struct which represents the canonical identification URL of a wallet or account
*/
package accounts
6 changes: 3 additions & 3 deletions accounts/hd.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ var DefaultLedgerBaseDerivationPath = DerivationPath{0x80000000 + 44, 0x80000000
// The BIP-32 spec https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki
// defines derivation paths to be of the form:
//
// m / purpose' / coin_type' / account' / change / address_index
// m / purpose' / coin_type' / account' / change / address_index
//
// The BIP-44 spec https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki
// defines that the `purpose` be 44' (or 0x8000002C) for crypto currencies, and
// Klaytn defined the `coin_type` 8217' (or 0x80002019) internally.
// Kaia defined the `coin_type` 8217' (or 0x80002019) internally.
//
// The root path for Klaytn is m/44'/8217'/0'/0 according to the specification
// The root path for Kaia is m/44'/8217'/0'/0 according to the specification
// from https://github.com/ethereum/EIPs/issues/84, albeit it's not set in stone
// yet whether accounts should increment the last component or the children of
// that. We will go with the simpler approach of incrementing the last component.
Expand Down
2 changes: 1 addition & 1 deletion accounts/keystore/account_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func TestWatchNewFile(t *testing.T) {
t.Errorf("got %s, want %s", spew.Sdump(list), spew.Sdump(wantAccounts))
}

// TODO-Klaytn Disabled because this test fails intermittently in CI (Issue #833)
// TODO-Kaia Disabled because this test fails intermittently in CI (Issue #833)
/*
func TestWatchNoDir(t *testing.T) {
t.Parallel()
Expand Down