Skip to content

Commit

Permalink
comit
Browse files Browse the repository at this point in the history
  • Loading branch information
nimross committed May 28, 2023
1 parent 99992a1 commit 08f5608
Show file tree
Hide file tree
Showing 18 changed files with 2,168 additions and 262 deletions.
2 changes: 1 addition & 1 deletion app/ante/eip712_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func (suite *EIP712TestSuite) SetupTest() {
// Genesis states
evmGs := evmtypes.NewGenesisState(
evmtypes.NewParams(
"ablack", // evmDenom
"afury", // evmDenom
false, // allowedUnprotectedTxs
true, // enableCreate
true, // enableCall
Expand Down
20 changes: 10 additions & 10 deletions app/ante/min_gas_filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func TestEvmMinGasFilter(t *testing.T) {

ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()})
tApp.GetEvmKeeper().SetParams(ctx, evmtypes.Params{
EvmDenom: "ablack",
EvmDenom: "afury",
})

testCases := []struct {
Expand All @@ -54,19 +54,19 @@ func TestEvmMinGasFilter(t *testing.T) {
mustParseDecCoins("0.001ublack"),
},
{
"zero ublack gas price, min ablack price",
mustParseDecCoins("0ublack;100000ablack"),
mustParseDecCoins("0ublack"), // ablack is removed
"zero ublack gas price, min afury price",
mustParseDecCoins("0ublack;100000afury"),
mustParseDecCoins("0ublack"), // afury is removed
},
{
"zero ublack gas price, min ablack price, other token",
mustParseDecCoins("0ublack;100000ablack;0.001other"),
mustParseDecCoins("0ublack;0.001other"), // ablack is removed
"zero ublack gas price, min afury price, other token",
mustParseDecCoins("0ublack;100000afury;0.001other"),
mustParseDecCoins("0ublack;0.001other"), // afury is removed
},
{
"non-zero ublack gas price, min ablack price",
mustParseDecCoins("0.25ublack;100000ablack;0.001other"),
mustParseDecCoins("0.25ublack;0.001other"), // ablack is removed
"non-zero ublack gas price, min afury price",
mustParseDecCoins("0.25ublack;100000afury;0.001other"),
mustParseDecCoins("0.25ublack;0.001other"), // afury is removed
},
}

Expand Down
2 changes: 1 addition & 1 deletion ci/env/black-internal-testnet/genesis.json
Original file line number Diff line number Diff line change
Expand Up @@ -1230,7 +1230,7 @@
}
],
"params": {
"evm_denom": "ablack",
"evm_denom": "afury",
"enable_create": true,
"enable_call": true,
"extra_eips": [],
Expand Down
2 changes: 1 addition & 1 deletion ci/env/black-protonet/genesis.json
Original file line number Diff line number Diff line change
Expand Up @@ -1488,7 +1488,7 @@
}
],
"params": {
"evm_denom": "ablack",
"evm_denom": "afury",
"enable_create": true,
"enable_call": true,
"extra_eips": [],
Expand Down
2 changes: 1 addition & 1 deletion contrib/devnet/init-new-chain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ $BINARY collect-gentxs
sed -in-place='' 's/stake/ublack/g' $DATA/config/genesis.json

# Replace the default evm denom of aphoton with ublack
sed -in-place='' 's/aphoton/ablack/g' $DATA/config/genesis.json
sed -in-place='' 's/aphoton/afury/g' $DATA/config/genesis.json

# Zero out the total supply so it gets recalculated during InitGenesis
jq '.app_state.bank.supply = []' $DATA/config/genesis.json|sponge $DATA/config/genesis.json
Expand Down
2 changes: 1 addition & 1 deletion docs/core/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -3724,7 +3724,7 @@ BalanceAccount defines an account in the evmutil module.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `address` | [bytes](#bytes) | | |
| `balance` | [string](#string) | | balance indicates the amount of ablack owned by the address. |
| `balance` | [string](#string) | | balance indicates the amount of afury owned by the address. |



Expand Down
1,906 changes: 1,906 additions & 0 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion proto/black/evmutil/v1beta1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ message Account {
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"
];

// balance indicates the amount of ablack owned by the address.
// balance indicates the amount of afury owned by the address.
string balance = 2 [
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
Expand Down
6 changes: 3 additions & 3 deletions tests/e2e/e2e_min_fees_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ func (suite *IntegrationTestSuite) TestEthGasPriceReturnsMinFee() {
minGasPrices, err := getMinFeeFromAppToml(suite.BlackHomePath())
suite.NoError(err)

// evm uses ablack, get ablack min fee
evmMinGas := minGasPrices.AmountOf("ablack").TruncateInt().BigInt()
// evm uses afury, get afury min fee
evmMinGas := minGasPrices.AmountOf("afury").TruncateInt().BigInt()

// returns eth_gasPrice, units in black
gasPrice, err := suite.Black.EvmClient.SuggestGasPrice(context.Background())
Expand All @@ -39,7 +39,7 @@ func (suite *IntegrationTestSuite) TestEvmRespectsMinFee() {
// get min gas price for evm (from app.toml)
minFees, err := getMinFeeFromAppToml(suite.BlackHomePath())
suite.NoError(err)
minGasPrice := minFees.AmountOf("ablack").TruncateInt()
minGasPrice := minFees.AmountOf("afury").TruncateInt()

// attempt tx with less than min gas price (min fee - 1)
tooLowGasPrice := minGasPrice.Sub(sdk.OneInt()).BigInt()
Expand Down
10 changes: 5 additions & 5 deletions tests/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
)

var (
minEvmGasPrice = big.NewInt(1e10) // ablack
minEvmGasPrice = big.NewInt(1e10) // afury
)

func ublack(amt int64) sdk.Coin {
Expand Down Expand Up @@ -72,9 +72,9 @@ func (suite *IntegrationTestSuite) TestFundedAccount() {
suite.Equal(funds, *res.Balance)

// check balance via EVM query
ablackBal, err := suite.Black.EvmClient.BalanceAt(context.Background(), acc.EvmAddress, nil)
afuryBal, err := suite.Black.EvmClient.BalanceAt(context.Background(), acc.EvmAddress, nil)
suite.NoError(err)
suite.Equal(funds.Amount.MulRaw(1e12).BigInt(), ablackBal)
suite.Equal(funds.Amount.MulRaw(1e12).BigInt(), afuryBal)
}

// example test that signs & broadcasts an EVM tx
Expand All @@ -93,7 +93,7 @@ func (suite *IntegrationTestSuite) TestTransferOverEVM() {
suite.Equal(uint64(0), nonce) // sanity check. the account should have no prior txs

// transfer black over EVM
blackToTransfer := big.NewInt(1e18) // 1 BLACK; ablack has 18 decimals.
blackToTransfer := big.NewInt(1e18) // 1 BLACK; afury has 18 decimals.
req := util.EvmTxRequest{
Tx: ethtypes.NewTransaction(nonce, to, blackToTransfer, 1e5, minEvmGasPrice, nil),
Data: "any ol' data to track this through the system",
Expand All @@ -105,7 +105,7 @@ func (suite *IntegrationTestSuite) TestTransferOverEVM() {
// evm txs refund unused gas. so to know the expected balance we need to know how much gas was used.
ublackUsedForGas := sdkmath.NewIntFromBigInt(minEvmGasPrice).
Mul(sdkmath.NewIntFromUint64(res.Receipt.GasUsed)).
QuoRaw(1e12) // convert ablack to ublack
QuoRaw(1e12) // convert afury to ublack

// expect (9 - gas used) BLACK remaining in account.
balance := suite.Black.QuerySdkForBalances(acc.SdkAddress)
Expand Down
Loading

0 comments on commit 08f5608

Please sign in to comment.