Skip to content

Commit

Permalink
[aclmapping] Modify staking dependencies for max vote power change (#475
Browse files Browse the repository at this point in the history
)

* [aclmapping] Modify staking dependencies for max vote power change

* update go mod
  • Loading branch information
udpatil authored Jan 4, 2023
1 parent 89500f2 commit 52033df
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
14 changes: 14 additions & 0 deletions aclmapping/staking/mappings.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,13 @@ func MsgDelegateDependencyGenerator(keeper aclkeeper.Keeper, ctx sdk.Context, ms
IdentifierTemplate: validatorKey,
},

// Get last total power for max voting power check
{
AccessType: sdkacltypes.AccessType_READ,
ResourceType: sdkacltypes.ResourceType_KV_STAKING_TOTAL_POWER,
IdentifierTemplate: hex.EncodeToString(stakingtypes.LastTotalPowerKey),
},

// Last Operation should always be a commit
*acltypes.CommitAccessOp(),
}
Expand Down Expand Up @@ -647,6 +654,13 @@ func MsgBeginRedelegateDependencyGenerator(keeper aclkeeper.Keeper, ctx sdk.Cont
IdentifierTemplate: dstValidatorKey,
},

// Get last total power for max voting power check
{
AccessType: sdkacltypes.AccessType_READ,
ResourceType: sdkacltypes.ResourceType_KV_STAKING_TOTAL_POWER,
IdentifierTemplate: hex.EncodeToString(stakingtypes.LastTotalPowerKey),
},

// Last Operation should always be a commit
*acltypes.CommitAccessOp(),
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ require (

replace (
github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8.0
github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.1.364
github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.1.372
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
github.com/keybase/go-keychain => github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4
github.com/tendermint/tendermint => github.com/sei-protocol/sei-tendermint v0.1.106
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1067,8 +1067,8 @@ github.com/seccomp/libseccomp-golang v0.9.2-0.20210429002308-3879420cc921/go.mod
github.com/securego/gosec/v2 v2.11.0 h1:+PDkpzR41OI2jrw1q6AdXZCbsNGNGT7pQjal0H0cArI=
github.com/securego/gosec/v2 v2.11.0/go.mod h1:SX8bptShuG8reGC0XS09+a4H2BoWSJi+fscA+Pulbpo=
github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY=
github.com/sei-protocol/sei-cosmos v0.1.364 h1:1mDZMzW/mDxOJG1oIP3w0hHVYGxa0iW4A9QoCcpTStg=
github.com/sei-protocol/sei-cosmos v0.1.364/go.mod h1:pmWgLJxzDS+WMVvBWoncAnlXBjb0lFJvMw5ULbjWVwc=
github.com/sei-protocol/sei-cosmos v0.1.372 h1:PEU0uTwqh35JV7/aj8IT3nPHvmE0KtCjpJAjDCzEpSQ=
github.com/sei-protocol/sei-cosmos v0.1.372/go.mod h1:pmWgLJxzDS+WMVvBWoncAnlXBjb0lFJvMw5ULbjWVwc=
github.com/sei-protocol/sei-tendermint v0.1.106 h1:CN/jjNxfvZgzL20w3ss8OqtcLIXl8r3WA1B23or7ob4=
github.com/sei-protocol/sei-tendermint v0.1.106/go.mod h1:Olwbjyagrpoxj5DAUhHxMTWDVEfQ3FYdpypaJ3+6Hs8=
github.com/sei-protocol/sei-tm-db v0.0.5 h1:3WONKdSXEqdZZeLuWYfK5hP37TJpfaUa13vAyAlvaQY=
Expand Down
6 changes: 3 additions & 3 deletions runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def runtest_exists(dir):
return os.path.exists(f"{dir}/runtest.sh")

def run():
cpu_count = multiprocessing.cpu_count()
cpu_count = max(multiprocessing.cpu_count() - 2, 1)
print(f"Starting tests on {cpu_count} processes")

dirs = get_directories_with_go_test()
Expand All @@ -28,7 +28,7 @@ def run():
pool = multiprocessing.Pool(cpu_count)
commands = []
results = []

for dir in dirs:
if runtest_exists(dir):
command = f"cd {root}/{dir}; ./runtest.sh"
Expand All @@ -43,7 +43,7 @@ def run():
print(result)
if "FAIL" in result:
success = False

if success:
print("test success")
else:
Expand Down

0 comments on commit 52033df

Please sign in to comment.