Skip to content

Commit 2dbe32e

Browse files
committed
add ACL type for wei balance
1 parent a65af36 commit 2dbe32e

File tree

6 files changed

+24
-13
lines changed

6 files changed

+24
-13
lines changed

aclmapping/evm/mappings.go

+7
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ func TransactionDependencyGenerator(_ aclkeeper.Keeper, evmKeeper evmkeeper.Keep
4747
ops = appendRWBalanceOps(ops, state.GetCoinbaseAddress(ctx))
4848
sender := sdk.AccAddress(evmMsg.Derived.SenderSeiAddr)
4949
ops = appendRWBalanceOps(ops, sender)
50+
ops = append(ops,
51+
sdkacltypes.AccessOperation{
52+
AccessType: sdkacltypes.AccessType_READ,
53+
ResourceType: sdkacltypes.ResourceType_KV_BANK_WEI_BALANCE,
54+
IdentifierTemplate: hex.EncodeToString(append(banktypes.WeiBalancesPrefix, sender...)),
55+
},
56+
)
5057

5158
tx, _ := evmMsg.AsTransaction()
5259
toAddress := tx.To()

aclmapping/evm/mappings_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ func cacheTxContext(ctx sdk.Context) (sdk.Context, sdk.CacheMultiStore) {
7575
func (suite *KeeperTestSuite) buildSendMsgTo(to common.Address, amt *big.Int) *types.MsgEVMTransaction {
7676
txData := ethtypes.DynamicFeeTx{
7777
Nonce: 0,
78-
GasFeeCap: big.NewInt(1),
79-
Gas: 21000,
78+
GasFeeCap: big.NewInt(1000000000),
79+
Gas: 30000,
8080
To: &to,
8181
Value: amt,
8282
Data: []byte(""),

aclmapping/utils/resource_type.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,11 @@ var StoreKeyToResourceTypePrefixMap = aclsdktypes.StoreKeyToResourceTypePrefixMa
6262
aclsdktypes.ResourceType_KV_DEX_MEM_DEPOSIT: dextypes.KeyPrefix(dextypes.MemDepositKey),
6363
},
6464
banktypes.StoreKey: {
65-
aclsdktypes.ResourceType_KV_BANK: aclsdktypes.EmptyPrefix,
66-
aclsdktypes.ResourceType_KV_BANK_BALANCES: banktypes.BalancesPrefix,
67-
aclsdktypes.ResourceType_KV_BANK_SUPPLY: banktypes.SupplyKey,
68-
aclsdktypes.ResourceType_KV_BANK_DENOM: banktypes.DenomMetadataPrefix,
65+
aclsdktypes.ResourceType_KV_BANK: aclsdktypes.EmptyPrefix,
66+
aclsdktypes.ResourceType_KV_BANK_BALANCES: banktypes.BalancesPrefix,
67+
aclsdktypes.ResourceType_KV_BANK_SUPPLY: banktypes.SupplyKey,
68+
aclsdktypes.ResourceType_KV_BANK_DENOM: banktypes.DenomMetadataPrefix,
69+
aclsdktypes.ResourceType_KV_BANK_WEI_BALANCE: banktypes.WeiBalancesPrefix,
6970
},
7071
banktypes.DeferredCacheStoreKey: {
7172
aclsdktypes.ResourceType_KV_BANK_DEFERRED: aclsdktypes.EmptyPrefix,

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ require (
322322
replace (
323323
github.com/CosmWasm/wasmd => github.com/sei-protocol/sei-wasmd v0.0.2
324324
github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8.0
325-
github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.2.66-evm-12
325+
github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.2.66-evm-13
326326
github.com/cosmos/iavl => github.com/sei-protocol/sei-iavl v0.1.7
327327
github.com/cosmos/ibc-go/v3 => github.com/sei-protocol/sei-ibc-go/v3 v3.2.0
328328
github.com/ethereum/go-ethereum => github.com/sei-protocol/go-ethereum v1.13.5-sei

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -1325,8 +1325,8 @@ github.com/sei-protocol/go-ethereum v1.13.5-sei h1:050SdAmqc3JWULg69daOXaVRvowwp
13251325
github.com/sei-protocol/go-ethereum v1.13.5-sei/go.mod h1:kcRZmuzRn1lVejiFNTz4l4W7imnpq1bDAnuKS/RyhbQ=
13261326
github.com/sei-protocol/goutils v0.0.2 h1:Bfa7Sv+4CVLNM20QcpvGb81B8C5HkQC/kW1CQpIbXDA=
13271327
github.com/sei-protocol/goutils v0.0.2/go.mod h1:iYE2DuJfEnM+APPehr2gOUXfuLuPsVxorcDO+Tzq9q8=
1328-
github.com/sei-protocol/sei-cosmos v0.2.66-evm-12 h1:gBT79tL0sRKn/tIRxONNTfe2Gpqlf1L7QU1MErnY/ms=
1329-
github.com/sei-protocol/sei-cosmos v0.2.66-evm-12/go.mod h1:FrJ75cMf1+Mx/AVWGzpcrCtvBoXd1wurJSRHCtP0cvQ=
1328+
github.com/sei-protocol/sei-cosmos v0.2.66-evm-13 h1:BK9WSVu66oY8p8Cx8EbwvDJO0G/MQPq35gI5rc1lcmY=
1329+
github.com/sei-protocol/sei-cosmos v0.2.66-evm-13/go.mod h1:FrJ75cMf1+Mx/AVWGzpcrCtvBoXd1wurJSRHCtP0cvQ=
13301330
github.com/sei-protocol/sei-iavl v0.1.7 h1:cUdHDBkxs0FF/kOt1qCVLm0K+Bqaw92/dbZSgn4kxiA=
13311331
github.com/sei-protocol/sei-iavl v0.1.7/go.mod h1:7PfkEVT5dcoQE+s/9KWdoXJ8VVVP1QpYYPLdxlkSXFk=
13321332
github.com/sei-protocol/sei-ibc-go/v3 v3.2.0 h1:T8V75OEWKvYDraPZZKilprl7ZkahZYGo40crxNL4unc=

x/evm/state/statedb.go

+7-4
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,13 @@ func (s *DBImpl) GetStorageRoot(common.Address) common.Hash {
109109
func (s *DBImpl) Copy() vm.StateDB {
110110
newCtx := s.ctx.WithMultiStore(s.ctx.MultiStore().CacheMultiStore())
111111
return &DBImpl{
112-
ctx: newCtx,
113-
snapshottedCtxs: append(s.snapshottedCtxs, s.ctx),
114-
k: s.k,
115-
err: s.err,
112+
ctx: newCtx,
113+
snapshottedCtxs: append(s.snapshottedCtxs, s.ctx),
114+
k: s.k,
115+
middleManAddress: s.middleManAddress,
116+
coinbaseAddress: s.coinbaseAddress,
117+
simulation: s.simulation,
118+
err: s.err,
116119
}
117120
}
118121

0 commit comments

Comments
 (0)