-
Notifications
You must be signed in to change notification settings - Fork 189
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
Validator set pruning using relayed Validator sets #327
Changes from all commits
cf1e86c
021e5aa
e77ff22
b981eeb
fcf01c4
3548c96
c13d12e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,6 +111,14 @@ func (a AttestationHandler) Handle(ctx sdk.Context, att types.Attestation, claim | |
|
||
// Add to denom-erc20 mapping | ||
a.keeper.setCosmosOriginatedDenomToERC20(ctx, claim.CosmosDenom, claim.TokenContract) | ||
case *types.MsgValsetUpdatedClaim: | ||
// TODO here we should check the contents of the validator set against | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please open an issue. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
// the store, if they differ we should take some action to indicate to the | ||
// user that bridge highjacking has occurred | ||
a.keeper.SetLastObservedValset(ctx, types.Valset{ | ||
Nonce: claim.ValsetNonce, | ||
Members: claim.Members, | ||
}) | ||
|
||
default: | ||
return sdkerrors.Wrapf(types.ErrInvalid, "event type: %s", claim.GetType()) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -439,6 +439,46 @@ func (k msgServer) LogicCallExecutedClaim(c context.Context, msg *types.MsgLogic | |
return &types.MsgLogicCallExecutedClaimResponse{}, nil | ||
} | ||
|
||
// ValsetUpdatedClaim handles claims for executing a validator set update on Ethereum | ||
func (k msgServer) ValsetUpdateClaim(c context.Context, msg *types.MsgValsetUpdatedClaim) (*types.MsgValsetUpdatedClaimResponse, error) { | ||
ctx := sdk.UnwrapSDKContext(c) | ||
|
||
orchaddr, _ := sdk.AccAddressFromBech32(msg.Orchestrator) | ||
validator := k.GetOrchestratorValidator(ctx, orchaddr) | ||
if validator == nil { | ||
return nil, sdkerrors.Wrap(types.ErrUnknown, "validator") | ||
} | ||
|
||
// return an error if the validator isn't in the active set | ||
val := k.StakingKeeper.Validator(ctx, validator) | ||
if val == nil || !val.IsBonded() { | ||
return nil, sdkerrors.Wrap(sdkerrors.ErrorInvalidSigner, "validator not in acitve set") | ||
} | ||
|
||
any, err := codectypes.NewAnyWithValue(msg) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
// Add the claim to the store | ||
_, err = k.Attest(ctx, msg, any) | ||
if err != nil { | ||
return nil, sdkerrors.Wrap(err, "create attestation") | ||
} | ||
|
||
// Emit the handle message event | ||
ctx.EventManager().EmitEvent( | ||
sdk.NewEvent( | ||
sdk.EventTypeMessage, | ||
sdk.NewAttribute(sdk.AttributeKeyModule, msg.Type()), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The message type is not the module. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is generally the pattern we use in the file. So if this is an issue we should open an issue and change it throughout the fie. |
||
// TODO: maybe return something better here? is this the right string representation? | ||
sdk.NewAttribute(types.AttributeKeyAttestationID, string(types.GetAttestationKey(msg.EventNonce, msg.ClaimHash()))), | ||
), | ||
) | ||
|
||
return &types.MsgValsetUpdatedClaimResponse{}, nil | ||
} | ||
|
||
func (k msgServer) CancelSendToEth(c context.Context, msg *types.MsgCancelSendToEth) (*types.MsgCancelSendToEthResponse, error) { | ||
ctx := sdk.UnwrapSDKContext(c) | ||
sender, err := sdk.AccAddressFromBech32(msg.Sender) | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
please open a issue.
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.
#342