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

feat: ope poc #26

Draft
wants to merge 24 commits into
base: basechain/abci2.0/develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
568d863
feat: Integration ope interface
dudong2 Oct 16, 2024
203f3e8
feat: Apply native action
dudong2 Oct 17, 2024
fcf207c
Fix: Native action revert issue
dudong2 Oct 17, 2024
bc2e971
chore: Sync with cronos memiavl store version
dudong2 Oct 17, 2024
5a21bcb
Revert "chore: Sync with cronos memiavl store version"
dudong2 Oct 17, 2024
67b6546
feat: Move cronos/store to basechain/store
dudong2 Oct 17, 2024
9c0810b
feat: Apply native fee
dudong2 Oct 18, 2024
f94d262
Problem: block gas meter not compatible with parallel tx execution (#…
yihuang Apr 3, 2024
be661e5
Problem: sender address verification is not decoupled from execution …
yihuang Sep 22, 2023
0be5835
Fix: Use statedb.Transfer instead of core.Transfer
dudong2 Oct 18, 2024
2c65555
feat: Replace transient store from evm module to object store
dudong2 Oct 18, 2024
0f2a18a
chore: cosmos-sdk
dudong2 Oct 21, 2024
3b49d2c
feat: Concurrent checktx
dudong2 Oct 21, 2024
8908324
feat: cosmos-sdk/store
dudong2 Oct 23, 2024
c332e85
Problem: parallel transaction execution is not supported (#414)
yihuang Apr 8, 2024
d1c8b82
Problem: fee deduction not compatible with parallel execution (#447)
yihuang Apr 2, 2024
562c45b
Problem: evm transfer is not efficient (#448)
yihuang Apr 2, 2024
4cbdb83
Problem: transient store usage not compatible with parallel tx execut…
yihuang Apr 3, 2024
462baa9
Problem: block gas meter not compatible with parallel tx execution (#…
yihuang Apr 3, 2024
7c8b457
Problem: params not cached in object store (#454)
yihuang Apr 5, 2024
12efbd1
Problem: block-stm tx executor bad worst case performance (#522)
yihuang Sep 11, 2024
3af5795
Problem: pre-estimation don't run in parallel (#523)
yihuang Sep 12, 2024
12e303c
chore: Recover un-intendedly removed func
dudong2 Oct 25, 2024
3e8c341
feat: Sync eth antehandler logic with cronosfeat: Apply crypto-org-ch…
dudong2 Oct 25, 2024
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
388 changes: 233 additions & 155 deletions api/ethermint/evm/v1/tx.pulsar.go

Large diffs are not rendered by default.

72 changes: 37 additions & 35 deletions app/ante/ante_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (suite AnteTestSuite) TestAnteHandler() {
suite.Require().NoError(acc.SetSequence(1))
suite.app.AccountKeeper.SetAccount(suite.ctx, acc)

suite.app.EvmKeeper.SetBalance(suite.ctx, addr, big.NewInt(10000000000))
suite.app.EvmKeeper.SetBalance(suite.ctx, addr, big.NewInt(10000000000), evmtypes.DefaultEVMDenom)

suite.app.FeeMarketKeeper.SetBaseFee(suite.ctx, big.NewInt(100))
}
Expand All @@ -96,7 +96,7 @@ func (suite AnteTestSuite) TestAnteHandler() {
nil,
nil,
)
signedContractTx.From = addr.Hex()
signedContractTx.From = addr.Bytes()

tx := suite.CreateTestTx(signedContractTx, privKey, 1, false)
return tx
Expand All @@ -117,7 +117,7 @@ func (suite AnteTestSuite) TestAnteHandler() {
nil,
nil,
)
signedContractTx.From = addr.Hex()
signedContractTx.From = addr.Bytes()

tx := suite.CreateTestTx(signedContractTx, privKey, 1, false)
return tx
Expand All @@ -138,7 +138,7 @@ func (suite AnteTestSuite) TestAnteHandler() {
nil,
nil,
)
signedContractTx.From = addr.Hex()
signedContractTx.From = addr.Bytes()

tx := suite.CreateTestTx(signedContractTx, privKey, 1, false)
return tx
Expand All @@ -160,7 +160,7 @@ func (suite AnteTestSuite) TestAnteHandler() {
nil,
nil,
)
signedTx.From = addr.Hex()
signedTx.From = addr.Bytes()

tx := suite.CreateTestTx(signedTx, privKey, 1, false)
return tx
Expand All @@ -182,7 +182,7 @@ func (suite AnteTestSuite) TestAnteHandler() {
nil,
nil,
)
signedTx.From = addr.Hex()
signedTx.From = addr.Bytes()

tx := suite.CreateTestTx(signedTx, privKey, 1, false)
return tx
Expand All @@ -204,7 +204,7 @@ func (suite AnteTestSuite) TestAnteHandler() {
nil,
nil,
)
signedTx.From = addr.Hex()
signedTx.From = addr.Bytes()

tx := suite.CreateTestTx(signedTx, privKey, 1, false)
return tx
Expand All @@ -225,7 +225,7 @@ func (suite AnteTestSuite) TestAnteHandler() {
nil,
nil,
)
signedTx.From = addr.Hex()
signedTx.From = addr.Bytes()

tx := suite.CreateTestTx(signedTx, privKey, 1, false)
return tx
Expand All @@ -235,7 +235,7 @@ func (suite AnteTestSuite) TestAnteHandler() {
"fail - CheckTx (cosmos tx is not valid)",
func() sdk.Tx {
signedTx := evmtypes.NewTx(suite.app.EvmKeeper.ChainID(), 1, &to, big.NewInt(10), 100000, big.NewInt(1), nil, nil, nil, nil)
signedTx.From = addr.Hex()
signedTx.From = addr.Bytes()

txBuilder := suite.CreateTestTxBuilder(signedTx, privKey, 1, false)
// bigger than MaxGasWanted
Expand All @@ -247,7 +247,7 @@ func (suite AnteTestSuite) TestAnteHandler() {
"fail - CheckTx (memo too long)",
func() sdk.Tx {
signedTx := evmtypes.NewTx(suite.app.EvmKeeper.ChainID(), 1, &to, big.NewInt(10), 100000, big.NewInt(1), nil, nil, nil, nil)
signedTx.From = addr.Hex()
signedTx.From = addr.Bytes()

txBuilder := suite.CreateTestTxBuilder(signedTx, privKey, 1, false)
txBuilder.SetMemo(strings.Repeat("*", 257))
Expand All @@ -258,7 +258,7 @@ func (suite AnteTestSuite) TestAnteHandler() {
"fail - CheckTx (ExtensionOptionsEthereumTx not set)",
func() sdk.Tx {
signedTx := evmtypes.NewTx(suite.app.EvmKeeper.ChainID(), 1, &to, big.NewInt(10), 100000, big.NewInt(1), nil, nil, nil, nil)
signedTx.From = addr.Hex()
signedTx.From = addr.Bytes()

txBuilder := suite.CreateTestTxBuilder(signedTx, privKey, 1, false, true)
return txBuilder.GetTx()
Expand All @@ -272,7 +272,7 @@ func (suite AnteTestSuite) TestAnteHandler() {
nonce, err := suite.app.AccountKeeper.GetSequence(suite.ctx, acc.GetAddress())
suite.Require().NoError(err)
signedTx := evmtypes.NewTx(suite.app.EvmKeeper.ChainID(), nonce, &to, big.NewInt(10), 100000, big.NewInt(1), nil, nil, nil, nil)
signedTx.From = addr.Hex()
signedTx.From = addr.Bytes()

tx := suite.CreateTestTx(signedTx, privKey, 1, true)
return tx
Expand All @@ -284,7 +284,7 @@ func (suite AnteTestSuite) TestAnteHandler() {
nonce, err := suite.app.AccountKeeper.GetSequence(suite.ctx, acc.GetAddress())
suite.Require().NoError(err)
signedTx := evmtypes.NewTx(suite.app.EvmKeeper.ChainID(), nonce, &to, big.NewInt(10), 100000, big.NewInt(1), nil, nil, nil, nil)
signedTx.From = addr.Hex()
signedTx.From = addr.Bytes()

txBuilder := suite.CreateTestTxBuilder(signedTx, privKey, 1, false)
txBuilder.SetMemo("memo for cosmos tx not allowed")
Expand All @@ -297,7 +297,7 @@ func (suite AnteTestSuite) TestAnteHandler() {
nonce, err := suite.app.AccountKeeper.GetSequence(suite.ctx, acc.GetAddress())
suite.Require().NoError(err)
signedTx := evmtypes.NewTx(suite.app.EvmKeeper.ChainID(), nonce, &to, big.NewInt(10), 100000, big.NewInt(1), nil, nil, nil, nil)
signedTx.From = addr.Hex()
signedTx.From = addr.Bytes()

txBuilder := suite.CreateTestTxBuilder(signedTx, privKey, 1, false)
txBuilder.SetTimeoutHeight(10)
Expand All @@ -310,7 +310,7 @@ func (suite AnteTestSuite) TestAnteHandler() {
nonce, err := suite.app.AccountKeeper.GetSequence(suite.ctx, acc.GetAddress())
suite.Require().NoError(err)
signedTx := evmtypes.NewTx(suite.app.EvmKeeper.ChainID(), nonce, &to, big.NewInt(10), 100000, big.NewInt(1), nil, nil, nil, nil)
signedTx.From = addr.Hex()
signedTx.From = addr.Bytes()

txBuilder := suite.CreateTestTxBuilder(signedTx, privKey, 1, false)

Expand All @@ -330,7 +330,7 @@ func (suite AnteTestSuite) TestAnteHandler() {
nonce, err := suite.app.AccountKeeper.GetSequence(suite.ctx, acc.GetAddress())
suite.Require().NoError(err)
signedTx := evmtypes.NewTx(suite.app.EvmKeeper.ChainID(), nonce, &to, big.NewInt(10), 100000, big.NewInt(1), nil, nil, nil, nil)
signedTx.From = addr.Hex()
signedTx.From = addr.Bytes()

txBuilder := suite.CreateTestTxBuilder(signedTx, privKey, 1, false)

Expand Down Expand Up @@ -590,10 +590,12 @@ func (suite AnteTestSuite) TestAnteHandler() {
nil,
nil,
)
msg.From = addr.Hex()
msg.From = addr.Bytes()
tx := suite.CreateTestTx(msg, privKey, 1, false)
msg = tx.GetMsgs()[0].(*evmtypes.MsgEthereumTx)
msg.From = addr.Hex()
msg.From = addr.Bytes()
// arbitrary modify
msg.From[0] = msg.From[0] + 1
return tx
}, true, false, false,
},
Expand Down Expand Up @@ -907,7 +909,7 @@ func (suite AnteTestSuite) TestAnteHandler() {
nil,
nil,
)
ethTx.From = addr.Hex()
ethTx.From = addr.Bytes()

msg := authz.NewMsgExec(
sdk.AccAddress(privKey.PubKey().Address()),
Expand Down Expand Up @@ -977,7 +979,7 @@ func (suite AnteTestSuite) TestAnteHandlerWithDynamicTxFee() {
nil,
&types.AccessList{},
)
signedContractTx.From = addr.Hex()
signedContractTx.From = addr.Bytes()

tx := suite.CreateTestTx(signedContractTx, privKey, 1, false)
return tx
Expand All @@ -999,7 +1001,7 @@ func (suite AnteTestSuite) TestAnteHandlerWithDynamicTxFee() {
nil,
&types.AccessList{},
)
signedContractTx.From = addr.Hex()
signedContractTx.From = addr.Bytes()

tx := suite.CreateTestTx(signedContractTx, privKey, 1, false)
return tx
Expand All @@ -1021,7 +1023,7 @@ func (suite AnteTestSuite) TestAnteHandlerWithDynamicTxFee() {
nil,
&types.AccessList{},
)
signedContractTx.From = addr.Hex()
signedContractTx.From = addr.Bytes()

tx := suite.CreateTestTx(signedContractTx, privKey, 1, false)
return tx
Expand All @@ -1044,7 +1046,7 @@ func (suite AnteTestSuite) TestAnteHandlerWithDynamicTxFee() {
nil,
&types.AccessList{},
)
signedTx.From = addr.Hex()
signedTx.From = addr.Bytes()

tx := suite.CreateTestTx(signedTx, privKey, 1, false)
return tx
Expand All @@ -1067,7 +1069,7 @@ func (suite AnteTestSuite) TestAnteHandlerWithDynamicTxFee() {
nil,
&types.AccessList{},
)
signedTx.From = addr.Hex()
signedTx.From = addr.Bytes()

tx := suite.CreateTestTx(signedTx, privKey, 1, false)
return tx
Expand All @@ -1090,7 +1092,7 @@ func (suite AnteTestSuite) TestAnteHandlerWithDynamicTxFee() {
nil,
&types.AccessList{},
)
signedTx.From = addr.Hex()
signedTx.From = addr.Bytes()

tx := suite.CreateTestTx(signedTx, privKey, 1, false)
return tx
Expand All @@ -1113,7 +1115,7 @@ func (suite AnteTestSuite) TestAnteHandlerWithDynamicTxFee() {
nil,
&types.AccessList{},
)
signedTx.From = addr.Hex()
signedTx.From = addr.Bytes()

tx := suite.CreateTestTx(signedTx, privKey, 1, false)
return tx
Expand All @@ -1136,7 +1138,7 @@ func (suite AnteTestSuite) TestAnteHandlerWithDynamicTxFee() {
nil,
&types.AccessList{},
)
signedTx.From = addr.Hex()
signedTx.From = addr.Bytes()

txBuilder := suite.CreateTestTxBuilder(signedTx, privKey, 1, false)
// bigger than MaxGasWanted
Expand All @@ -1161,7 +1163,7 @@ func (suite AnteTestSuite) TestAnteHandlerWithDynamicTxFee() {
nil,
&types.AccessList{},
)
signedTx.From = addr.Hex()
signedTx.From = addr.Bytes()

txBuilder := suite.CreateTestTxBuilder(signedTx, privKey, 1, false)
txBuilder.SetMemo(strings.Repeat("*", 257))
Expand All @@ -1184,7 +1186,7 @@ func (suite AnteTestSuite) TestAnteHandlerWithDynamicTxFee() {
nil,
&types.AccessList{},
)
signedContractTx.From = addr.Hex()
signedContractTx.From = addr.Bytes()

tx := suite.CreateTestTx(signedContractTx, privKey, 1, false)
return tx
Expand All @@ -1205,7 +1207,7 @@ func (suite AnteTestSuite) TestAnteHandlerWithDynamicTxFee() {
suite.app.AccountKeeper.SetAccount(suite.ctx, acc)

suite.ctx = suite.ctx.WithIsCheckTx(tc.checkTx).WithIsReCheckTx(tc.reCheckTx)
suite.app.EvmKeeper.SetBalance(suite.ctx, addr, big.NewInt((ethparams.InitialBaseFee+10)*100000))
suite.app.EvmKeeper.SetBalance(suite.ctx, addr, big.NewInt((ethparams.InitialBaseFee+10)*100000), evmtypes.DefaultEVMDenom)
_, err := suite.anteHandler(suite.ctx, tc.txFn(), false)
if tc.expPass {
suite.Require().NoError(err)
Expand Down Expand Up @@ -1243,7 +1245,7 @@ func (suite AnteTestSuite) TestAnteHandlerWithParams() {
nil,
&types.AccessList{},
)
signedContractTx.From = addr.Hex()
signedContractTx.From = addr.Bytes()

tx := suite.CreateTestTx(signedContractTx, privKey, 1, false)
return tx
Expand All @@ -1265,7 +1267,7 @@ func (suite AnteTestSuite) TestAnteHandlerWithParams() {
nil,
&types.AccessList{},
)
signedContractTx.From = addr.Hex()
signedContractTx.From = addr.Bytes()

tx := suite.CreateTestTx(signedContractTx, privKey, 1, false)
return tx
Expand All @@ -1288,7 +1290,7 @@ func (suite AnteTestSuite) TestAnteHandlerWithParams() {
nil,
&types.AccessList{},
)
signedTx.From = addr.Hex()
signedTx.From = addr.Bytes()

tx := suite.CreateTestTx(signedTx, privKey, 1, false)
return tx
Expand All @@ -1311,7 +1313,7 @@ func (suite AnteTestSuite) TestAnteHandlerWithParams() {
nil,
&types.AccessList{},
)
signedTx.From = addr.Hex()
signedTx.From = addr.Bytes()

tx := suite.CreateTestTx(signedTx, privKey, 1, false)
return tx
Expand All @@ -1334,7 +1336,7 @@ func (suite AnteTestSuite) TestAnteHandlerWithParams() {
suite.app.AccountKeeper.SetAccount(suite.ctx, acc)

suite.ctx = suite.ctx.WithIsCheckTx(true)
suite.app.EvmKeeper.SetBalance(suite.ctx, addr, big.NewInt((ethparams.InitialBaseFee+10)*100000))
suite.app.EvmKeeper.SetBalance(suite.ctx, addr, big.NewInt((ethparams.InitialBaseFee+10)*100000), evmtypes.DefaultEVMDenom)
_, err := suite.anteHandler(suite.ctx, tc.txFn(), false)
if tc.expErr == nil {
suite.Require().NoError(err)
Expand Down
12 changes: 7 additions & 5 deletions app/ante/authz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ func (suite *AnteTestSuite) TestRejectDeliverMsgsInAuthz() {
_, testAddresses, err := generatePrivKeyAddressPairs(10)
suite.Require().NoError(err)

fromAddr := []byte{0, 0}

testcases := []struct {
name string
msgs []sdk.Msg
Expand All @@ -238,7 +240,7 @@ func (suite *AnteTestSuite) TestRejectDeliverMsgsInAuthz() {
msgs: []sdk.Msg{
newGenericMsgGrant(
testAddresses,
sdk.MsgTypeURL(&evmtypes.MsgEthereumTx{}),
sdk.MsgTypeURL(&evmtypes.MsgEthereumTx{From: fromAddr}),
),
},
expectedCode: sdkerrors.ErrUnauthorized.ABCICode(),
Expand All @@ -258,7 +260,7 @@ func (suite *AnteTestSuite) TestRejectDeliverMsgsInAuthz() {
msgs: []sdk.Msg{
newGenericMsgGrant(
testAddresses,
sdk.MsgTypeURL(&evmtypes.MsgEthereumTx{}),
sdk.MsgTypeURL(&evmtypes.MsgEthereumTx{From: fromAddr}),
),
},
expectedCode: sdkerrors.ErrUnauthorized.ABCICode(),
Expand All @@ -271,7 +273,7 @@ func (suite *AnteTestSuite) TestRejectDeliverMsgsInAuthz() {
testAddresses[1],
[]sdk.Msg{
createMsgSend(testAddresses),
&evmtypes.MsgEthereumTx{},
&evmtypes.MsgEthereumTx{From: fromAddr},
},
),
},
Expand All @@ -284,7 +286,7 @@ func (suite *AnteTestSuite) TestRejectDeliverMsgsInAuthz() {
testAddresses[1],
2,
[]sdk.Msg{
&evmtypes.MsgEthereumTx{},
&evmtypes.MsgEthereumTx{From: fromAddr},
},
),
},
Expand Down Expand Up @@ -326,7 +328,7 @@ func (suite *AnteTestSuite) TestRejectDeliverMsgsInAuthz() {
bz, err := txEncoder(tx)
suite.Require().NoError(err)

resCheckTx, _ := suite.app.CheckTx(
resCheckTx, _ := suite.app.CheckTxSync(
&abci.RequestCheckTx{
Tx: bz,
Type: abci.CheckTxType_New,
Expand Down
3 changes: 1 addition & 2 deletions app/ante/eip712.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func NewLegacyCosmosAnteHandlerEip712(options HandlerOptions) sdk.AnteHandler {
NewMinGasPriceDecorator(options.FeeMarketKeeper, options.EvmKeeper),
authante.NewValidateMemoDecorator(options.AccountKeeper),
authante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
authante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker),
NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker),
// SetPubKeyDecorator must be called before all signature verification decorators
authante.NewSetPubKeyDecorator(options.AccountKeeper),
authante.NewValidateSigCountDecorator(options.AccountKeeper),
Expand All @@ -71,7 +71,6 @@ func NewLegacyCosmosAnteHandlerEip712(options HandlerOptions) sdk.AnteHandler {
NewLegacyEip712SigVerificationDecorator(options.AccountKeeper, options.SignModeHandler),
authante.NewIncrementSequenceDecorator(options.AccountKeeper),
ibcante.NewRedundantRelayDecorator(options.IBCKeeper),
NewGasWantedDecorator(options.EvmKeeper, options.FeeMarketKeeper),
)
}

Expand Down
Loading
Loading