CI Setup (#19)

This commit is contained in:
Aleksandr Bezobchuk
2023-03-14 10:23:27 -04:00
committed by GitHub
parent 1c96a6c3c2
commit 0d475f632d
14 changed files with 176 additions and 40 deletions
+8 -8
View File
@@ -99,15 +99,15 @@ func (k Keeper) ValidateAuctionBundle(ctx sdk.Context, bidder sdk.AccAddress, tr
// as long as all subsequent transactions are signed by the bidder.
if len(prevSigners) == 0 {
if seenBidder {
return fmt.Errorf("bundle contains transactions signed by multiple parties. possible front-running or sandwich attack.")
} else {
seenBidder = true
prevSigners = map[string]bool{bidder.String(): true}
filterSigners(prevSigners, txSigners)
return fmt.Errorf("bundle contains transactions signed by multiple parties; possible front-running or sandwich attack")
}
if len(prevSigners) == 0 {
return fmt.Errorf("bundle contains transactions signed by multiple parties. possible front-running or sandwich attack.")
}
seenBidder = true
prevSigners = map[string]bool{bidder.String(): true}
filterSigners(prevSigners, txSigners)
if len(prevSigners) == 0 {
return fmt.Errorf("bundle contains transactions signed by multiple parties; possible front-running or sandwich attack")
}
}
}
+10 -12
View File
@@ -16,15 +16,15 @@ import (
func (suite *IntegrationTestSuite) TestValidateAuctionMsg() {
var (
// Tx building variables
accounts []Account = []Account{} // tracks the order of signers in the bundle
balance sdk.Coins = sdk.NewCoins(sdk.NewCoin("foo", sdk.NewInt(10000)))
bid sdk.Coins = sdk.NewCoins(sdk.NewCoin("foo", sdk.NewInt(1000)))
accounts = []Account{} // tracks the order of signers in the bundle
balance = sdk.NewCoins(sdk.NewCoin("foo", sdk.NewInt(10000)))
bid = sdk.NewCoins(sdk.NewCoin("foo", sdk.NewInt(1000)))
// Auction params
maxBundleSize uint32 = 10
reserveFee sdk.Coins = sdk.NewCoins(sdk.NewCoin("foo", sdk.NewInt(1000)))
minBuyInFee sdk.Coins = sdk.NewCoins(sdk.NewCoin("foo", sdk.NewInt(1000)))
escrowAddress sdk.AccAddress = sdk.AccAddress([]byte("escrow"))
maxBundleSize uint32 = 10
reserveFee = sdk.NewCoins(sdk.NewCoin("foo", sdk.NewInt(1000)))
minBuyInFee = sdk.NewCoins(sdk.NewCoin("foo", sdk.NewInt(1000)))
escrowAddress = sdk.AccAddress([]byte("escrow"))
)
rnd := rand.New(rand.NewSource(time.Now().Unix()))
@@ -160,11 +160,9 @@ func (suite *IntegrationTestSuite) TestValidateAuctionMsg() {
}
func (suite *IntegrationTestSuite) TestValidateBundle() {
var (
// TODO: Update this to be multi-dimensional to test multi-sig
// https://github.com/skip-mev/pob/issues/14
accounts []Account // tracks the order of signers in the bundle
)
// TODO: Update this to be multi-dimensional to test multi-sig
// https://github.com/skip-mev/pob/issues/14
var accounts []Account // tracks the order of signers in the bundle
rng := rand.New(rand.NewSource(time.Now().Unix()))
bidder := RandomAccounts(rng, 1)[0]
+1 -3
View File
@@ -7,9 +7,7 @@ import (
"github.com/skip-mev/pob/x/auction/types"
)
var (
_ types.QueryServer = QueryServer{}
)
var _ types.QueryServer = QueryServer{}
// QueryServer defines the auction module's gRPC querier service.
type QueryServer struct {
+1 -3
View File
@@ -8,9 +8,7 @@ import (
"github.com/skip-mev/pob/x/auction/types"
)
var (
_ types.MsgServer = MsgServer{}
)
var _ types.MsgServer = MsgServer{}
// MsgServer is the wrapper for the auction module's msg service.
type MsgServer struct {
+3 -2
View File
@@ -129,9 +129,10 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw
func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion }
// BeginBlock returns the begin blocker for the auction module.
func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {}
func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} //nolint
// EndBlock returns the end blocker for the auction module. It returns no validator updates.
func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate {
func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { //nolint
return []abci.ValidatorUpdate{}
}
+2 -4
View File
@@ -18,7 +18,5 @@ const (
prefixParams = iota + 1
)
var (
// KeyPrefixParams is the store key for the auction module's parameters.
KeyParams = []byte{prefixParams}
)
// KeyParams is the store key for the auction module's parameters.
var KeyParams = []byte{prefixParams}
-2
View File
@@ -72,7 +72,6 @@ func TestMsgAuctionBid(t *testing.T) {
for _, tc := range cases {
t.Run(tc.description, func(t *testing.T) {
err := tc.msg.ValidateBasic()
if tc.expectPass {
if err != nil {
@@ -115,7 +114,6 @@ func TestMsgUpdateParams(t *testing.T) {
for _, tc := range cases {
t.Run(tc.description, func(t *testing.T) {
err := tc.msg.ValidateBasic()
if tc.expectPass {
if err != nil {
+5 -5
View File
@@ -10,11 +10,11 @@ var (
// TODO: Choose reasonable default values.
//
// Ref: https://github.com/skip-mev/pob/issues/7
DefaultMaxBundleSize uint32 = 0
DefaultEscrowAccountAddress = ""
DefaultReserveFee = sdk.Coins{}
DefaultMinBuyInFee = sdk.Coins{}
DefaultMinBidIncrement = sdk.Coins{}
DefaultMaxBundleSize uint32
DefaultEscrowAccountAddress string
DefaultReserveFee = sdk.Coins{}
DefaultMinBuyInFee = sdk.Coins{}
DefaultMinBidIncrement = sdk.Coins{}
)
// NewParams returns a new Params instance with the provided values.