smallBankTC

package
v1.9.0-tc.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2022 License: MIT, Apache-2.0 Imports: 18 Imported by: 0

README

smallBankTC

Test Case Description

smallBankTC is based on the SmallBank benchmark in BlockBench.

For your reference, the original description of SmallBank benchmark in the SIGMOD paper is like the below:

Unlike YCSB which does not consider transactions, Smallbank is a popular benchmark for OLTP workload. It consists of three tables and four basic procedures simulating basic operations on bank accounts. Smallbank is implemented as a smart contract which simply transfers money from one account to another.

smallBankTC tests basic bank operations using the SmallBank smart contract. The test Go functions in smallBankTC.go and their corresponding function in the SmallBank smart contract are described in the table below.

Function Description
Almagate Call the almagate function in the SmallBank contract, which moves the entire balance in one's checking account to the other's saving account
GetBalance Call the getBalance function in the SmallBank contract, which returns the balance sum of one's checking and saving accounts
UpdateBalance Call the updateBalance function in the SmallBank contract, which adds a given value to one's checking account
UpdateSaving Call the updateSaving function in the SmallBank contract, which adds a given value to one's saving account
SendPayment Call the sendPayment function in the SmallBank contract, which pays (or moves) a requested value from one's checking account to the other's
WriteCheck Call the writeCheck function in the SmallBank contract, which tries to mimic the action of issuing a check (however, the implementation logic looks weird)
Run Randomly invoke one test function among Almagate, GetBalance, UpdateBalance, UpdateSaving, SendPayment, and WriteCheck

How to Set the Maximum Number of Users

The environment variable SMALLBANK_MAX_NUM_USERS can be used to change the maximum number of users, whose default value is 100000. For example,

$ SMALLBANK_MAX_NUM_USERS=200000 ./klayslave ...

Note that the number of users can affect the performance of this test case because the smart contract's state could be increased depending on the number of different users.

Source Files

This directory has the following source files.

References

Documentation

Overview

Package smallBankTC implements BlockBench's SmallBank benchmark for Klaytn and Locust. See README.md for more details.

Index

Constants

View Source
const Name = "smallBankTC"
View Source
const SmallBankABI = "" /* 1413-byte string literal not displayed */

SmallBankABI is the input ABI used to generate the binding from.

View Source
const SmallBankBin = `` /* 5352-byte string literal not displayed */

SmallBankBin is the compiled bytecode used for deploying new contracts.

View Source
const SmallBankBinRuntime = `` /* 5288-byte string literal not displayed */

SmallBankBinRuntime is the compiled bytecode used for adding genesis block without deploying code.

Variables

This section is empty.

Functions

func Almagate

func Almagate()

Almagate tests the almagate function in the SmallBank contract.

func GetBalance

func GetBalance()

GetBalance tests the getBalance function in the SmallBank contract.

func Init

func Init(accs []*account.Account, endpoint string, gp *big.Int)

Init initializes cliPool and accGrp; and also deploys the smart contract.

func Run

func Run()

Run randomly calls one test case.

func SendPayment

func SendPayment()

SendPayment tests the sendPayment function in the SmallBank contract.

func UpdateBalance

func UpdateBalance()

UpdateBalance tests the updateBalance function in the SmallBank contract.

func UpdateSaving

func UpdateSaving()

UpdateSaving tests the updateSaving function in the SmallBank contract.

func WriteCheck

func WriteCheck()

WriteCheck tests the writeCheck function in the SmallBank contract.

Types

type SmallBank

type SmallBank struct {
	SmallBankCaller     // Read-only binding to the contract
	SmallBankTransactor // Write-only binding to the contract
	SmallBankFilterer   // Log filterer for contract events
}

SmallBank is an auto generated Go binding around an GXP contract.

func DeploySmallBank

func DeploySmallBank(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *SmallBank, error)

DeploySmallBank deploys a new GXP contract, binding an instance of SmallBank to it.

func NewSmallBank

func NewSmallBank(address common.Address, backend bind.ContractBackend) (*SmallBank, error)

NewSmallBank creates a new instance of SmallBank, bound to a specific deployed contract.

type SmallBankCaller

type SmallBankCaller struct {
	// contains filtered or unexported fields
}

SmallBankCaller is an auto generated read-only Go binding around an GXP contract.

func NewSmallBankCaller

func NewSmallBankCaller(address common.Address, caller bind.ContractCaller) (*SmallBankCaller, error)

NewSmallBankCaller creates a new read-only instance of SmallBank, bound to a specific deployed contract.

func (*SmallBankCaller) GetBalance

func (_SmallBank *SmallBankCaller) GetBalance(opts *bind.CallOpts, arg0 string) (*big.Int, error)

GetBalance is a free data retrieval call binding the contract method 0x3a51d246.

Solidity: function getBalance(arg0 string) constant returns(balance uint256)

type SmallBankCallerRaw

type SmallBankCallerRaw struct {
	Contract *SmallBankCaller // Generic read-only contract binding to access the raw methods on
}

SmallBankCallerRaw is an auto generated low-level read-only Go binding around an GXP contract.

func (*SmallBankCallerRaw) Call

func (_SmallBank *SmallBankCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error

Call invokes the (constant) contract method with params as input values and sets the output to result. The result type might be a single field for simple returns, a slice of interfaces for anonymous returns and a struct for named returns.

type SmallBankCallerSession

type SmallBankCallerSession struct {
	Contract *SmallBankCaller // Generic contract caller binding to set the session for
	CallOpts bind.CallOpts    // Call options to use throughout this session
}

SmallBankCallerSession is an auto generated read-only Go binding around an GXP contract, with pre-set call options.

func (*SmallBankCallerSession) GetBalance

func (_SmallBank *SmallBankCallerSession) GetBalance(arg0 string) (*big.Int, error)

GetBalance is a free data retrieval call binding the contract method 0x3a51d246.

Solidity: function getBalance(arg0 string) constant returns(balance uint256)

type SmallBankFilterer

type SmallBankFilterer struct {
	// contains filtered or unexported fields
}

SmallBankFilterer is an auto generated log filtering Go binding around an GXP contract events.

func NewSmallBankFilterer

func NewSmallBankFilterer(address common.Address, filterer bind.ContractFilterer) (*SmallBankFilterer, error)

NewSmallBankFilterer creates a new log filterer instance of SmallBank, bound to a specific deployed contract.

type SmallBankRaw

type SmallBankRaw struct {
	Contract *SmallBank // Generic contract binding to access the raw methods on
}

SmallBankRaw is an auto generated low-level Go binding around an GXP contract.

func (*SmallBankRaw) Call

func (_SmallBank *SmallBankRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error

Call invokes the (constant) contract method with params as input values and sets the output to result. The result type might be a single field for simple returns, a slice of interfaces for anonymous returns and a struct for named returns.

func (*SmallBankRaw) Transact

func (_SmallBank *SmallBankRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error)

Transact invokes the (paid) contract method with params as input values.

func (*SmallBankRaw) Transfer

func (_SmallBank *SmallBankRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error)

Transfer initiates a plain transaction to move funds to the contract, calling its default method if one is available.

type SmallBankSession

type SmallBankSession struct {
	Contract     *SmallBank        // Generic contract binding to set the session for
	CallOpts     bind.CallOpts     // Call options to use throughout this session
	TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
}

SmallBankSession is an auto generated Go binding around an GXP contract, with pre-set call and transact options.

func (*SmallBankSession) Almagate

func (_SmallBank *SmallBankSession) Almagate(arg0 string, arg1 string) (*types.Transaction, error)

Almagate is a paid mutator transaction binding the contract method 0x901d706f.

Solidity: function almagate(arg0 string, arg1 string) returns()

func (*SmallBankSession) GetBalance

func (_SmallBank *SmallBankSession) GetBalance(arg0 string) (*big.Int, error)

GetBalance is a free data retrieval call binding the contract method 0x3a51d246.

Solidity: function getBalance(arg0 string) constant returns(balance uint256)

func (*SmallBankSession) SendPayment

func (_SmallBank *SmallBankSession) SendPayment(arg0 string, arg1 string, arg2 *big.Int) (*types.Transaction, error)

SendPayment is a paid mutator transaction binding the contract method 0xca305435.

Solidity: function sendPayment(arg0 string, arg1 string, arg2 uint256) returns()

func (*SmallBankSession) UpdateBalance

func (_SmallBank *SmallBankSession) UpdateBalance(arg0 string, arg1 *big.Int) (*types.Transaction, error)

UpdateBalance is a paid mutator transaction binding the contract method 0x870187eb.

Solidity: function updateBalance(arg0 string, arg1 uint256) returns()

func (*SmallBankSession) UpdateSaving

func (_SmallBank *SmallBankSession) UpdateSaving(arg0 string, arg1 *big.Int) (*types.Transaction, error)

UpdateSaving is a paid mutator transaction binding the contract method 0x0b488b37.

Solidity: function updateSaving(arg0 string, arg1 uint256) returns()

func (*SmallBankSession) WriteCheck

func (_SmallBank *SmallBankSession) WriteCheck(arg0 string, arg1 *big.Int) (*types.Transaction, error)

WriteCheck is a paid mutator transaction binding the contract method 0x0be8374d.

Solidity: function writeCheck(arg0 string, arg1 uint256) returns()

type SmallBankTransactor

type SmallBankTransactor struct {
	// contains filtered or unexported fields
}

SmallBankTransactor is an auto generated write-only Go binding around an GXP contract.

func NewSmallBankTransactor

func NewSmallBankTransactor(address common.Address, transactor bind.ContractTransactor) (*SmallBankTransactor, error)

NewSmallBankTransactor creates a new write-only instance of SmallBank, bound to a specific deployed contract.

func (*SmallBankTransactor) Almagate

func (_SmallBank *SmallBankTransactor) Almagate(opts *bind.TransactOpts, arg0 string, arg1 string) (*types.Transaction, error)

Almagate is a paid mutator transaction binding the contract method 0x901d706f.

Solidity: function almagate(arg0 string, arg1 string) returns()

func (*SmallBankTransactor) SendPayment

func (_SmallBank *SmallBankTransactor) SendPayment(opts *bind.TransactOpts, arg0 string, arg1 string, arg2 *big.Int) (*types.Transaction, error)

SendPayment is a paid mutator transaction binding the contract method 0xca305435.

Solidity: function sendPayment(arg0 string, arg1 string, arg2 uint256) returns()

func (*SmallBankTransactor) UpdateBalance

func (_SmallBank *SmallBankTransactor) UpdateBalance(opts *bind.TransactOpts, arg0 string, arg1 *big.Int) (*types.Transaction, error)

UpdateBalance is a paid mutator transaction binding the contract method 0x870187eb.

Solidity: function updateBalance(arg0 string, arg1 uint256) returns()

func (*SmallBankTransactor) UpdateSaving

func (_SmallBank *SmallBankTransactor) UpdateSaving(opts *bind.TransactOpts, arg0 string, arg1 *big.Int) (*types.Transaction, error)

UpdateSaving is a paid mutator transaction binding the contract method 0x0b488b37.

Solidity: function updateSaving(arg0 string, arg1 uint256) returns()

func (*SmallBankTransactor) WriteCheck

func (_SmallBank *SmallBankTransactor) WriteCheck(opts *bind.TransactOpts, arg0 string, arg1 *big.Int) (*types.Transaction, error)

WriteCheck is a paid mutator transaction binding the contract method 0x0be8374d.

Solidity: function writeCheck(arg0 string, arg1 uint256) returns()

type SmallBankTransactorRaw

type SmallBankTransactorRaw struct {
	Contract *SmallBankTransactor // Generic write-only contract binding to access the raw methods on
}

SmallBankTransactorRaw is an auto generated low-level write-only Go binding around an GXP contract.

func (*SmallBankTransactorRaw) Transact

func (_SmallBank *SmallBankTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error)

Transact invokes the (paid) contract method with params as input values.

func (*SmallBankTransactorRaw) Transfer

func (_SmallBank *SmallBankTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error)

Transfer initiates a plain transaction to move funds to the contract, calling its default method if one is available.

type SmallBankTransactorSession

type SmallBankTransactorSession struct {
	Contract     *SmallBankTransactor // Generic contract transactor binding to set the session for
	TransactOpts bind.TransactOpts    // Transaction auth options to use throughout this session
}

SmallBankTransactorSession is an auto generated write-only Go binding around an GXP contract, with pre-set transact options.

func (*SmallBankTransactorSession) Almagate

func (_SmallBank *SmallBankTransactorSession) Almagate(arg0 string, arg1 string) (*types.Transaction, error)

Almagate is a paid mutator transaction binding the contract method 0x901d706f.

Solidity: function almagate(arg0 string, arg1 string) returns()

func (*SmallBankTransactorSession) SendPayment

func (_SmallBank *SmallBankTransactorSession) SendPayment(arg0 string, arg1 string, arg2 *big.Int) (*types.Transaction, error)

SendPayment is a paid mutator transaction binding the contract method 0xca305435.

Solidity: function sendPayment(arg0 string, arg1 string, arg2 uint256) returns()

func (*SmallBankTransactorSession) UpdateBalance

func (_SmallBank *SmallBankTransactorSession) UpdateBalance(arg0 string, arg1 *big.Int) (*types.Transaction, error)

UpdateBalance is a paid mutator transaction binding the contract method 0x870187eb.

Solidity: function updateBalance(arg0 string, arg1 uint256) returns()

func (*SmallBankTransactorSession) UpdateSaving

func (_SmallBank *SmallBankTransactorSession) UpdateSaving(arg0 string, arg1 *big.Int) (*types.Transaction, error)

UpdateSaving is a paid mutator transaction binding the contract method 0x0b488b37.

Solidity: function updateSaving(arg0 string, arg1 uint256) returns()

func (*SmallBankTransactorSession) WriteCheck

func (_SmallBank *SmallBankTransactorSession) WriteCheck(arg0 string, arg1 *big.Int) (*types.Transaction, error)

WriteCheck is a paid mutator transaction binding the contract method 0x0be8374d.

Solidity: function writeCheck(arg0 string, arg1 uint256) returns()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL