Skip to content
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

AnteDecorator #5006

Merged
merged 42 commits into from
Oct 10, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
1960993
start decorator changes
AdityaSripal Aug 28, 2019
12244c5
start replacing ante logic with decorators
AdityaSripal Aug 30, 2019
5a46ceb
Fix build errors
AdityaSripal Sep 5, 2019
bdcf294
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into ad…
AdityaSripal Sep 5, 2019
ac19f18
fix some tests
AdityaSripal Sep 6, 2019
9a0eac7
fix baseapp tests
AdityaSripal Sep 9, 2019
725f5cf
fix auth tests
AdityaSripal Sep 12, 2019
ff5f1f7
start individual decorator tests
AdityaSripal Sep 14, 2019
73e2739
add signature tests
AdityaSripal Sep 17, 2019
77bc7c6
complete sig tests
AdityaSripal Sep 17, 2019
baf5bfb
fix all test errors
AdityaSripal Sep 17, 2019
71e07ce
remove unnecessary &
AdityaSripal Sep 18, 2019
3b3a74f
fix linter errors
AdityaSripal Sep 18, 2019
6303bec
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into ad…
AdityaSripal Sep 18, 2019
e52e89d
interface all decorators except sigs
AdityaSripal Sep 18, 2019
ac8209d
check signer lenght in sigverify
AdityaSripal Sep 19, 2019
b93ca36
Apply suggestions from bez code review
AdityaSripal Sep 22, 2019
5825e81
complete bez suggestions
AdityaSripal Sep 29, 2019
441c050
fix merge conflicts
AdityaSripal Sep 29, 2019
2f22251
create sigTx interface
AdityaSripal Oct 1, 2019
975ad0e
linting
AdityaSripal Oct 1, 2019
c5ede73
finish linting except TODO
AdityaSripal Oct 1, 2019
9a5cb61
make auth tx interfaces extend sdk.Tx
AdityaSripal Oct 1, 2019
e7ec478
Merge branch 'master' into aditya/ante-decorator
alexanderbez Oct 2, 2019
634c1aa
test docs, replace FeeCoins with GetFee
AdityaSripal Oct 2, 2019
66144bf
Merge branch 'aditya/ante-decorator' of https://github.com/cosmos/cos…
AdityaSripal Oct 2, 2019
0c39cd9
Apply suggestions from fede code review
AdityaSripal Oct 2, 2019
29e85bf
address tim comments
AdityaSripal Oct 3, 2019
f1964cf
Merge branch 'aditya/ante-decorator' of https://github.com/cosmos/cos…
AdityaSripal Oct 3, 2019
b6d9166
Merge branch 'master' into aditya/ante-decorator
fedekunze Oct 8, 2019
0fd1234
add order comments
AdityaSripal Oct 8, 2019
aad9673
Add Schwarzenegger art
AdityaSripal Oct 8, 2019
5ce99da
add assertions that StdTx implements all necessary decorator interfaces
AdityaSripal Oct 8, 2019
bd79e58
Merge branch 'aditya/ante-decorator' of https://github.com/cosmos/cos…
AdityaSripal Oct 8, 2019
2f54876
documentation and CHANGELOG
AdityaSripal Oct 9, 2019
a4ef3ec
Run goimports
alexanderbez Oct 9, 2019
33cc17a
Update ChainAnteDecorators godoc
alexanderbez Oct 10, 2019
882fac5
Changelog entries cleanup
alexanderbez Oct 10, 2019
163da7f
Changelog entries cleanup
alexanderbez Oct 10, 2019
492cf0d
Merge branch 'master' into aditya/ante-decorator
alexanderbez Oct 10, 2019
1b1a779
Fix formatter
alexanderbez Oct 10, 2019
440a05c
Merge branch 'master' into aditya/ante-decorator
alexanderbez Oct 10, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
make auth tx interfaces extend sdk.Tx
  • Loading branch information
AdityaSripal committed Oct 1, 2019
commit 9a5cb61ccf6153cbd028f21a55a9e6331f853e3d
1 change: 1 addition & 0 deletions x/auth/ante/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

// Tx with a Gas() method is needed to use SetUpContextDecorator
type GasTx interface {
sdk.Tx
Gas() uint64
}

Expand Down
7 changes: 7 additions & 0 deletions x/auth/ante/sigverify.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ func init() {
// This is where apps can define their own PubKey
type SignatureVerificationGasConsumer = func(meter sdk.GasMeter, sig []byte, pubkey crypto.PubKey, params types.Params) error

// SigVerifiableTx defines a tx interface for all signature verification decorators
type SigVerifiableTx interface {
sdk.Tx
GetSignatures() [][]byte
GetSigners() []sdk.AccAddress
GetPubKeys() []crypto.PubKey // If signer already has pubkey in context, this list will have nil in its place
Expand All @@ -42,6 +44,7 @@ type SigVerifiableTx interface {

// SetPubKeyDecorator sets PubKeys in context for any signer which does not already have pubkey set
// PubKeys must be set in context for all signers before any other sigverify decorators run
// CONTRACT: Tx must implement SigVerifiableTx interface
type SetPubKeyDecorator struct {
ak keeper.AccountKeeper
}
Expand Down Expand Up @@ -91,6 +94,7 @@ func (spkd SetPubKeyDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate b
// Consume parameter-defined amount of gas for each signature according to the passed-in SignatureVerificationGasConsumer function
// before calling the next AnteHandler
// CONTRACT: Pubkeys are set in context for all signers before this decorator runs
// CONTRACT: Tx must implement SigVerifiableTx interface
type SigGasConsumeDecorator struct {
ak keeper.AccountKeeper
sigGasConsumer SignatureVerificationGasConsumer
Expand Down Expand Up @@ -144,6 +148,7 @@ func (sgcd SigGasConsumeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simula
// increment sequence of each signer and set updated account back in store
// Call next AnteHandler
// CONTRACT: Pubkeys are set in context for all signers before this decorator runs
// CONTRACT: Tx must implement SigVerifiableTx interface
type SigVerificationDecorator struct {
ak keeper.AccountKeeper
}
Expand Down Expand Up @@ -200,6 +205,7 @@ func (svd SigVerificationDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simul

// Increments sequences of all signers.
// Use this decorator to prevent replay attacks
// CONTRACT: Tx must implement SigVerifiableTx interface
type IncrementSequenceDecorator struct {
ak keeper.AccountKeeper
}
Expand Down Expand Up @@ -231,6 +237,7 @@ func (isd IncrementSequenceDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, sim
// ValidateSigCountDecorator takes in Params and returns errors if there are too many signatures in the tx for the given params
// otherwise it calls next AnteHandler
// Use this decorator to set parameterized limit on number of signatures in tx
// CONTRACT: Tx must implement SigVerifiableTx interface
type ValidateSigCountDecorator struct {
ak keeper.AccountKeeper
}
Expand Down