Skip to content

Commit

Permalink
Merge branch 'main' into feat/concurrency-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
beer-1 committed Nov 19, 2024
2 parents 3a753e8 + aef4430 commit 84fd0fb
Show file tree
Hide file tree
Showing 28 changed files with 104 additions and 46 deletions.
11 changes: 11 additions & 0 deletions .github/config/.codespellignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cips
pullrequest
keypair
pastTime
hasTables
Nam
EyT
upTo
initia
minitia
expRes
28 changes: 28 additions & 0 deletions .github/workflows/spellcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Spell Check

on:
pull_request:

jobs:
spellcheck:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Run codespell
continue-on-error: true
run: |
sudo apt-get install codespell -y
codespell -w --skip="*.pulsar.go,*.pb.go,*.pb.gw.go,*.cosmos_orm.go,*.json,*.git,*.js,crypto/keys,fuzz,*.h,proto/tendermint,*.bin,go.sum,go.work.sum,go.mod,statik.go,*.map,swagger.yaml" --ignore-words=.github/config/.codespellignore
- uses: peter-evans/[email protected]
if: github.event_name != 'pull_request'
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore: fix typos"
title: "chore: fix typos"
branch: "chore/fix-typos"
delete-branch: true
body: |
This PR fixes typos in the codebase.
Please review it, and merge if everything is fine.
If there are proto changes, run `make proto-gen` and commit the changes.
2 changes: 1 addition & 1 deletion Dockerfile.arm64
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM arm64v8/golang:1.22-bullseye AS go-builder
# Install minimum necessary dependencies, build Cosmos SDK, remove packages
RUN apt update
RUN apt install -y curl git build-essential ca-certificates
# debug: for live editting in the image
# debug: for live editing in the image
RUN apt install -y vim

WORKDIR /code
Expand Down
19 changes: 13 additions & 6 deletions app/ante/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper"

opchildante "github.com/initia-labs/OPinit/x/opchild/ante"
opchildtypes "github.com/initia-labs/OPinit/x/opchild/types"
opchildkeeper "github.com/initia-labs/OPinit/x/opchild/keeper"
"github.com/initia-labs/initia/app/ante/accnum"
"github.com/initia-labs/initia/app/ante/sigverify"
evmante "github.com/initia-labs/minievm/x/evm/ante"
Expand All @@ -28,8 +28,8 @@ type HandlerOptions struct {
ante.HandlerOptions
Codec codec.BinaryCodec
IBCkeeper *ibckeeper.Keeper
OPChildKeeper opchildtypes.AnteKeeper
AuctionKeeper auctionkeeper.Keeper
OPChildKeeper *opchildkeeper.Keeper
AuctionKeeper *auctionkeeper.Keeper
EVMKeeper EVMKeeper

TxEncoder sdk.TxEncoder
Expand All @@ -44,18 +44,24 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
if options.AccountKeeper == nil {
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "account keeper is required for ante builder")
}

if options.BankKeeper == nil {
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "bank keeper is required for ante builder")
}

if options.SignModeHandler == nil {
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "sign mode handler is required for ante builder")
}

if options.EVMKeeper == nil {
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "EVM keeper is required for ante builder")
}
if options.IBCkeeper == nil {
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "IBC keeper is required for ante builder")
}
if options.OPChildKeeper == nil {
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "OPChild keeper is required for ante builder")
}
if options.AuctionKeeper == nil {
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "Auction keeper is required for ante builder")
}

sigGasConsumer := options.SigGasConsumer
if sigGasConsumer == nil {
Expand Down Expand Up @@ -100,6 +106,7 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
evmante.NewIncrementSequenceDecorator(options.AccountKeeper),
ibcante.NewRedundantRelayDecorator(options.IBCkeeper),
auctionante.NewAuctionDecorator(options.AuctionKeeper, options.TxEncoder, options.MevLane),
opchildante.NewRedundantBridgeDecorator(options.OPChildKeeper),
}

return sdk.ChainAnteDecorators(anteDecorators...), nil
Expand Down
2 changes: 1 addition & 1 deletion app/blocksdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func setupBlockSDK(
Codec: app.appCodec,
OPChildKeeper: app.OPChildKeeper,
TxEncoder: app.txConfig.TxEncoder(),
AuctionKeeper: *app.AuctionKeeper,
AuctionKeeper: app.AuctionKeeper,
MevLane: mevLane,
FreeLane: freeLane,
EVMKeeper: app.EVMKeeper,
Expand Down
2 changes: 1 addition & 1 deletion app/ibc-hooks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ msg := MsgCall{

### ICS20 packet structure

So given the details above, we propogate the implied ICS20 packet data structure.
So given the details above, we propagate the implied ICS20 packet data structure.
ICS20 is JSON native, so we use JSON for the memo format.

```json
Expand Down
2 changes: 1 addition & 1 deletion app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ func NewAppKeeper(
appKeepers.OracleKeeper = &oracleKeeper

// Add the oracle keeper as a hook to market map keeper so new market map entries can be created
// and propogated to the oracle keeper.
// and propagated to the oracle keeper.
appKeepers.MarketMapKeeper.SetHooks(appKeepers.OracleKeeper.Hooks())

appKeepers.OPChildKeeper = opchildkeeper.NewKeeper(
Expand Down
2 changes: 1 addition & 1 deletion client/docs/statik/statik.go

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions client/docs/swagger-ui/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38209,6 +38209,10 @@ paths:
items:
type: string
description: the list of addresses that are allowed to pay zero fee.
hook_max_gas:
type: string
format: uint64
title: Max gas for hook execution of `MsgFinalizeTokenDeposit`
description: >-
QueryParamsResponse is response type for the Query/Params RPC
method.
Expand Down Expand Up @@ -67499,6 +67503,10 @@ definitions:
items:
type: string
description: the list of addresses that are allowed to pay zero fee.
hook_max_gas:
type: string
format: uint64
title: Max gas for hook execution of `MsgFinalizeTokenDeposit`
description: Params defines the set of opchild parameters.
opinit.opchild.v1.QueryBaseDenomResponse:
type: object
Expand Down Expand Up @@ -67658,6 +67666,10 @@ definitions:
items:
type: string
description: the list of addresses that are allowed to pay zero fee.
hook_max_gas:
type: string
format: uint64
title: Max gas for hook execution of `MsgFinalizeTokenDeposit`
description: QueryParamsResponse is response type for the Query/Params RPC method.
opinit.opchild.v1.QueryValidatorResponse:
type: object
Expand Down
4 changes: 2 additions & 2 deletions contrib/devtools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ tools-stamp: statik runsim
touch $@

# Install the runsim binary with a temporary workaround of entering an outside
# directory as the "go install" command ignores the -mod option and will polute the
# directory as the "go install" command ignores the -mod option and will pollute the
# go.{mod, sum} files.
#
# ref: https://github.com/golang/go/issues/30515
Expand All @@ -67,7 +67,7 @@ $(STATIK):
@(cd /tmp && go install github.com/rakyll/[email protected])

# Install the runsim binary with a temporary workaround of entering an outside
# directory as the "go install" command ignores the -mod option and will polute the
# directory as the "go install" command ignores the -mod option and will pollute the
# go.{mod, sum} files.
#
# ref: https://github.com/golang/go/issues/30515
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ require (
github.com/hashicorp/go-metrics v0.5.3
github.com/hashicorp/golang-lru/v2 v2.0.7
github.com/holiman/uint256 v1.3.1
github.com/initia-labs/OPinit v0.5.7
github.com/initia-labs/OPinit v0.6.0
github.com/initia-labs/initia v0.6.1
github.com/initia-labs/kvindexer v0.1.9
github.com/initia-labs/kvindexer/submodules/block v0.1.0
Expand Down Expand Up @@ -178,7 +178,7 @@ require (
github.com/iancoleman/strcase v0.3.0 // indirect
github.com/improbable-eng/grpc-web v0.15.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/initia-labs/OPinit/api v0.5.7 // indirect
github.com/initia-labs/OPinit/api v0.6.0 // indirect
github.com/initia-labs/kvindexer/submodules/tx v0.1.0 // indirect
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1433,10 +1433,10 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
github.com/initia-labs/OPinit v0.5.7 h1:25G0o2VXcO4EXzh9afdTdsXl1PTdYG9VMUx4efmWCuM=
github.com/initia-labs/OPinit v0.5.7/go.mod h1:lx1amLMszculwPu8ln+btJno38UV28fd2nP7XC88ZeE=
github.com/initia-labs/OPinit/api v0.5.7 h1:jghTmrrDEmowrqSpy7iL7IW9xJh40rn/S1y/LrwPkyE=
github.com/initia-labs/OPinit/api v0.5.7/go.mod h1:gHK6DEWb3/DqQD5LjKirUx9jilAh2UioXanoQdgqVfU=
github.com/initia-labs/OPinit v0.6.0 h1:V9jQf8+PjNctLX31FHMGUsk6fpnygVJO1WYzCmBMzkU=
github.com/initia-labs/OPinit v0.6.0/go.mod h1:gDpCh4Zx94mihwgzP/PLav8eVHLroZBu3dFyzCy8iIs=
github.com/initia-labs/OPinit/api v0.6.0 h1:Q3hDHpTd9EqlDfY/OryCKIwuXYWJxGJdGfJicV1RjL4=
github.com/initia-labs/OPinit/api v0.6.0/go.mod h1:gHK6DEWb3/DqQD5LjKirUx9jilAh2UioXanoQdgqVfU=
github.com/initia-labs/cometbft v0.0.0-20241113064430-a371e2dc387f h1:PpYBvJ0L58bAgH7KwS/7GBEUphLnhf4fnTLua9uOov8=
github.com/initia-labs/cometbft v0.0.0-20241113064430-a371e2dc387f/go.mod h1:y7+6kPknafzWlkSMCekzXC81wpRf1pcVAUnO0wRy9lQ=
github.com/initia-labs/cometbft-client v0.0.0-20240924071428-ef115cefa07e h1:k+pg63SFozCAK4LZFSiZtof6z69Tlu0O/Zftj1aAwes=
Expand Down
10 changes: 5 additions & 5 deletions integration-tests/erc721_transfer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ func (suite *KeeperTestSuite) convertAppToMApp(chain *ibctesting.TestChain) {
genBals[i] = balance
}

mapp := minievmapp.SetupWithGenesisAccounts(chain.Vals.Copy(), genAccs, genBals...)
baseapp.SetChainID(chain.ChainID)(mapp.GetBaseApp())
chain.App = mapp
chain.Codec = mapp.AppCodec()
chain.TxConfig = mapp.TxConfig()
miniApp := minievmapp.SetupWithGenesisAccounts(chain.Vals.Copy(), genAccs, genBals...)
baseapp.SetChainID(chain.ChainID)(miniApp.GetBaseApp())
chain.App = miniApp
chain.Codec = miniApp.AppCodec()
chain.TxConfig = miniApp.TxConfig()

chain.CurrentHeader = cmtproto.Header{
ChainID: chain.ChainID,
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ require (
github.com/iancoleman/strcase v0.3.0 // indirect
github.com/improbable-eng/grpc-web v0.15.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/initia-labs/OPinit v0.5.7 // indirect
github.com/initia-labs/OPinit/api v0.5.7 // indirect
github.com/initia-labs/OPinit v0.6.0 // indirect
github.com/initia-labs/OPinit/api v0.6.0 // indirect
github.com/initia-labs/kvindexer v0.1.9 // indirect
github.com/initia-labs/kvindexer/submodules/block v0.1.0 // indirect
github.com/initia-labs/kvindexer/submodules/evm-tx v0.1.2 // indirect
Expand Down
6 changes: 2 additions & 4 deletions integration-tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1393,10 +1393,8 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
github.com/initia-labs/OPinit v0.5.7 h1:25G0o2VXcO4EXzh9afdTdsXl1PTdYG9VMUx4efmWCuM=
github.com/initia-labs/OPinit v0.5.7/go.mod h1:lx1amLMszculwPu8ln+btJno38UV28fd2nP7XC88ZeE=
github.com/initia-labs/OPinit/api v0.5.7 h1:jghTmrrDEmowrqSpy7iL7IW9xJh40rn/S1y/LrwPkyE=
github.com/initia-labs/OPinit/api v0.5.7/go.mod h1:gHK6DEWb3/DqQD5LjKirUx9jilAh2UioXanoQdgqVfU=
github.com/initia-labs/OPinit v0.6.0 h1:V9jQf8+PjNctLX31FHMGUsk6fpnygVJO1WYzCmBMzkU=
github.com/initia-labs/OPinit/api v0.6.0 h1:Q3hDHpTd9EqlDfY/OryCKIwuXYWJxGJdGfJicV1RjL4=
github.com/initia-labs/cometbft v0.0.0-20241113064430-a371e2dc387f h1:PpYBvJ0L58bAgH7KwS/7GBEUphLnhf4fnTLua9uOov8=
github.com/initia-labs/cometbft v0.0.0-20241113064430-a371e2dc387f/go.mod h1:y7+6kPknafzWlkSMCekzXC81wpRf1pcVAUnO0wRy9lQ=
github.com/initia-labs/evm v0.0.0-20241108055119-3d312736d7fb h1:oyH9gg/4f7uMCIJYnSpp7wa1NrGjSMsXTtypUfrsPLU=
Expand Down
6 changes: 3 additions & 3 deletions jsonrpc/backend/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ type AccMut struct {

// acquireAccMut acquires the mutex for the account with the given senderHex
// and increments the reference count. If the mutex does not exist, it is created.
func (b *JSONRPCBackend) acquireAccMut(senderHex string) {
func (b *JSONRPCBackend) acquireAccMut(senderHex string) *AccMut {
// critical section for rc and create
b.mut.Lock()
accMut, ok := b.accMuts[senderHex]
Expand All @@ -205,13 +205,13 @@ func (b *JSONRPCBackend) acquireAccMut(senderHex string) {
// critical section end

accMut.mut.Lock()
return accMut
}

// releaseAccMut releases the mutex for the account with the given senderHex
// and decrements the reference count. If the reference count reaches zero,
// the mutex is deleted.
func (b *JSONRPCBackend) releaseAccMut(senderHex string) {
accMut := b.accMuts[senderHex]
func (b *JSONRPCBackend) releaseAccMut(senderHex string, accMut *AccMut) {
accMut.mut.Unlock()

// critical section for rc and delete
Expand Down
4 changes: 2 additions & 2 deletions jsonrpc/backend/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ func (b *JSONRPCBackend) SendTx(tx *coretypes.Transaction) error {
senderHex := hexutil.Encode(sender.Bytes())

// hold mutex for each sender
b.acquireAccMut(senderHex)
defer b.releaseAccMut(senderHex)
accMut := b.acquireAccMut(senderHex)
defer b.releaseAccMut(senderHex, accMut)

checkCtx := b.app.GetContextForCheckTx(nil)
if acc := b.app.AccountKeeper.GetAccount(checkCtx, sender); acc != nil {
Expand Down
2 changes: 1 addition & 1 deletion jsonrpc/namespaces/eth/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ func (api *EthAPI) GetUncleCountByBlockNumber(_ rpc.BlockNumber) hexutil.Uint {
}

// *************************************
// * pow(leagcy) *
// * pow(legacy) *
// *************************************

// Hashrate returns the current node's hashrate. Always 0.
Expand Down
2 changes: 1 addition & 1 deletion x/evm/contracts/counter/Counter.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion x/evm/contracts/erc20/ERC20.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion x/evm/contracts/erc20_acl/ERC20ACL.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion x/evm/contracts/erc20_factory/ERC20Factory.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion x/evm/contracts/erc20_wrapper/ERC20Wrapper.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion x/evm/contracts/i_cosmos/ICosmos.sol
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ interface ICosmos {
Options memory options
) external returns (bool dummy);

// query a whitelisted cosmos querys.
// query a whitelisted cosmos queries.
//
// example)
// path: "/connect.oracle.v2.Query/GetPrices"
Expand Down
2 changes: 1 addition & 1 deletion x/evm/contracts/initia_erc20/InitiaERC20.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion x/evm/keeper/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ func (k Keeper) dispatchMessage(parentCtx sdk.Context, request types.ExecuteRequ
// emit submessage event
parentCtx.EventManager().EmitEvent(event)

// if callback exists, execute it with parent context becuase it's already committed
// if callback exists, execute it with parent context because it's already committed
if callbackId > 0 {
inputBz, err := k.cosmosCallbackABI.Pack("callback", callbackId, success)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions x/evm/keeper/context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ func Test_GetHash(t *testing.T) {
require.Equal(t, hash100, [32]byte(queryRes))
require.Empty(t, logs)

// vaild query
// valid query
queryInputBz, err = parsed.Pack("get_blockhash", uint64(101))
require.NoError(t, err)

Expand All @@ -207,7 +207,7 @@ func Test_GetHash(t *testing.T) {
require.Equal(t, hash101, [32]byte(queryRes))
require.Empty(t, logs)

// vaild query
// valid query
queryInputBz, err = parsed.Pack("get_blockhash", uint64(356))
require.NoError(t, err)

Expand Down
2 changes: 2 additions & 0 deletions x/evm/types/types.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 84fd0fb

Please sign in to comment.