-
Notifications
You must be signed in to change notification settings - Fork 871
Oracle parallel #334
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
Merged
Merged
Oracle parallel #334
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
ebde95b
[oracle] Remove oracle prevote (#249)
udpatil 92fa0aa
[acl] Add oracle parallelization dependencies
udpatil 26b5c91
[loadtest] Add oracle voting to loadtest
udpatil ec203f2
go mod tidy
udpatil ef2a71c
modified key import
udpatil 3252b6b
adjust loadtest
udpatil 0f19b29
remove none msg type
udpatil 32f481c
update config
udpatil c9d1f31
add non message type
udpatil 0073c5b
add validation unit tests for oracle mapping
udpatil 0fd95f0
refactor loadtest and use new sei-cosmos tag
udpatil b2e788e
fix loadtest config
udpatil 1caca9b
add loadtest to makefile
udpatil e1154b5
fix
udpatil 6d1879d
fix tabs
udpatil 51039ac
lint
udpatil cbba91c
go mod tidy
udpatil 219704d
refactor loadtest to separate function
udpatil 2012519
fix
udpatil 4306057
fix refactor
udpatil File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| package acloraclemapping | ||
|
|
||
| import ( | ||
| "fmt" | ||
|
|
||
| sdk "github.com/cosmos/cosmos-sdk/types" | ||
| sdkacltypes "github.com/cosmos/cosmos-sdk/types/accesscontrol" | ||
| aclkeeper "github.com/cosmos/cosmos-sdk/x/accesscontrol/keeper" | ||
| acltypes "github.com/cosmos/cosmos-sdk/x/accesscontrol/types" | ||
| utils "github.com/sei-protocol/sei-chain/aclmapping/utils" | ||
| oracletypes "github.com/sei-protocol/sei-chain/x/oracle/types" | ||
| ) | ||
|
|
||
| var ErrorInvalidMsgType = fmt.Errorf("invalid message received for oracle module") | ||
|
|
||
| func GetOracleDependencyGenerator() aclkeeper.DependencyGeneratorMap { | ||
| dependencyGeneratorMap := make(aclkeeper.DependencyGeneratorMap) | ||
|
|
||
| // vote | ||
| voteKey := acltypes.GenerateMessageKey(&oracletypes.MsgAggregateExchangeRateVote{}) | ||
| dependencyGeneratorMap[voteKey] = MsgVoteDependencyGenerator | ||
|
|
||
| return dependencyGeneratorMap | ||
| } | ||
|
|
||
| func MsgVoteDependencyGenerator(keeper aclkeeper.Keeper, ctx sdk.Context, msg sdk.Msg) ([]sdkacltypes.AccessOperation, error) { | ||
| msgVote, ok := msg.(*oracletypes.MsgAggregateExchangeRateVote) | ||
| if !ok { | ||
| return []sdkacltypes.AccessOperation{}, ErrorInvalidMsgType | ||
| } | ||
|
|
||
| accessOperations := []sdkacltypes.AccessOperation{ | ||
| // validate feeder | ||
| // read feeder delegation for val addr - READ | ||
| { | ||
| ResourceType: sdkacltypes.ResourceType_KV_ORACLE_FEEDERS, | ||
| AccessType: sdkacltypes.AccessType_READ, | ||
| IdentifierTemplate: msgVote.Validator, | ||
| }, | ||
| // read validator from staking - READ | ||
| // validator is bonded check - READ | ||
| // (both covered by below) | ||
| { | ||
| ResourceType: sdkacltypes.ResourceType_KV_STAKING, | ||
| AccessType: sdkacltypes.AccessType_READ, | ||
| IdentifierTemplate: msgVote.Validator, | ||
| }, | ||
| // get vote target (for all exchange rate tuples) -> blanket read on that prefix - READ | ||
| { | ||
| ResourceType: sdkacltypes.ResourceType_KV_ORACLE_VOTE_TARGETS, | ||
| AccessType: sdkacltypes.AccessType_READ, | ||
| IdentifierTemplate: utils.DefaultIDTemplate, | ||
| }, | ||
|
|
||
| // set exchange rate vote - WRITE | ||
| { | ||
| ResourceType: sdkacltypes.ResourceType_KV_ORACLE_AGGREGATE_VOTES, | ||
| AccessType: sdkacltypes.AccessType_READ, | ||
| IdentifierTemplate: msgVote.Validator, | ||
| }, | ||
| // Last Operation should always be a commit | ||
| { | ||
| ResourceType: sdkacltypes.ResourceType_ANY, | ||
| AccessType: sdkacltypes.AccessType_COMMIT, | ||
| IdentifierTemplate: utils.DefaultIDTemplate, | ||
| }, | ||
| } | ||
| return accessOperations, nil | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| package acloraclemapping | ||
|
|
||
| import ( | ||
| "testing" | ||
| "time" | ||
|
|
||
| "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" | ||
| acltypes "github.com/cosmos/cosmos-sdk/x/accesscontrol/types" | ||
| "github.com/sei-protocol/sei-chain/app" | ||
| oracletypes "github.com/sei-protocol/sei-chain/x/oracle/types" | ||
| "github.com/stretchr/testify/require" | ||
| ) | ||
|
|
||
| func TestMsgVoteDependencyGenerator(t *testing.T) { | ||
| tm := time.Now().UTC() | ||
| valPub := secp256k1.GenPrivKey().PubKey() | ||
|
|
||
| testWrapper := app.NewTestWrapper(t, tm, valPub) | ||
|
|
||
| oracleVote := oracletypes.MsgAggregateExchangeRateVote{ | ||
| ExchangeRates: "1usei", | ||
| Feeder: "test", | ||
| Validator: "validator", | ||
| } | ||
|
|
||
| accessOps, err := MsgVoteDependencyGenerator(testWrapper.App.AccessControlKeeper, testWrapper.Ctx, &oracleVote) | ||
| require.NoError(t, err) | ||
| err = acltypes.ValidateAccessOps(accessOps) | ||
| require.NoError(t, err) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this part of the cherry-picked changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup, it removed the
prevoteandcombined votefrom oracleThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, this exact change wasn't cherry picked, but I removed this to match the removal in the cherry picked section