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

minor refactors #199

Merged
merged 30 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
cc3db0a
updating proto names
ap0calypse644 Oct 14, 2024
2487795
updting contract and autocli
ap0calypse644 Oct 15, 2024
5721979
renaming aggr-keyshare to decryption-key
ap0calypse644 Oct 17, 2024
113a8a7
update protos
bowenyou Oct 17, 2024
6e600d1
renaming updating proto files
ap0calypse644 Oct 17, 2024
cfab00b
audit changes
ap0calypse644 Oct 18, 2024
7034a46
audit changes
ap0calypse644 Oct 18, 2024
3f1d3d2
audit changes
ap0calypse644 Oct 21, 2024
e26090c
fix naming in comments
bowenyou Oct 21, 2024
37e34ef
audit changes
ap0calypse644 Oct 21, 2024
89f7077
renamed some logic
bowenyou Oct 21, 2024
071e062
slowly refactor
bowenyou Oct 21, 2024
0a5202a
Fix build error
p0p3yee Oct 21, 2024
45208ac
Update test script function names
p0p3yee Oct 21, 2024
3cc76ae
Fix pep module unit tests failing
p0p3yee Oct 21, 2024
1da4b78
Fix keyshare module unit test failing
p0p3yee Oct 21, 2024
4a3c890
Fix query all keyshare request unit tests failing
p0p3yee Oct 21, 2024
b0f1df2
Fix keyshare module test script failing
p0p3yee Oct 21, 2024
32c97d3
Update stop.sh script to kill all process properly
p0p3yee Oct 21, 2024
2b3f0b7
.
bowenyou Oct 21, 2024
ae5f443
fix AggKey to DecryptionKey
bowenyou Oct 21, 2024
69526c4
fix naming in lanes/app
bowenyou Oct 22, 2024
94061b5
audit changes
ap0calypse644 Oct 22, 2024
4646de0
audit changes
ap0calypse644 Oct 22, 2024
71f1fa5
Fix all integration test all script error
p0p3yee Oct 23, 2024
c64e2d5
fix test contract build error
bowenyou Oct 23, 2024
a96d438
audit changes
ap0calypse644 Oct 23, 2024
7076bfd
Fix pep script error
p0p3yee Oct 23, 2024
3cb81a2
Fix makefile error
p0p3yee Oct 23, 2024
5ccc6be
removing local dependency on cosmos-sdk
ap0calypse644 Oct 24, 2024
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ integration-test-all: init-test-framework \
init-relayer \
test-keyshare-module
-@rm -rf ./data
-@killall fairyringd 2>/dev/null
./scripts/tests/stop.sh

devnet-up: init-devnet
@echo "Fairyring Devnet is now running in the background, run 'make devnet-down' to stop devnet."
Expand Down
28 changes: 16 additions & 12 deletions abci/checktx/keyshare_check_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
)

// CheckTxHandler is a wrapper around baseapp's CheckTx method that allows us to
// verify aggregated keyshare transactions against the latest committed state. All other transactions
// verify keyshare transactions against the latest committed state. All other transactions
// are executed normally using base app's CheckTx. This defines all of the
// dependencies that are required to verify a keyshare transaction.
type KeyshareCheckTxHandler struct {
Expand All @@ -27,9 +27,9 @@ type KeyshareCheckTxHandler struct {
// bid transactions.
txDecoder sdk.TxDecoder

// KeyShareLane is utilized to retrieve the keyshare info of a transaction and to
// KeyshareLane is utilized to retrieve the keyshare info of a transaction and to
// insert a Keyshare transaction into the application-side mempool.
keyShareLane KeyShareLaneI
keyshareLane KeyshareLaneI

// anteHandler is utilized to verify the bid transaction against the latest
// committed state.
Expand All @@ -39,11 +39,11 @@ type KeyshareCheckTxHandler struct {
checkTxHandler CheckTx
}

// KeyShareLaneI is the interface that defines all of the dependencies that
// KeyshareLaneI is the interface that defines all of the dependencies that
// are required to interact with the top of block lane.
type KeyShareLaneI interface {
// GetKeyShareInfo is utilized to retrieve the Keyshare info of a transaction.
GetKeyShareInfo(tx sdk.Tx) (*peptypes.AggregatedKeyShare, error)
type KeyshareLaneI interface {
// GetDecryptionKeyInfo is utilized to retrieve the Keyshare info of a transaction.
GetDecryptionKeyInfo(tx sdk.Tx) (*peptypes.DecryptionKey, error)

// Insert is utilized to insert a transaction into the application-side mempool.
Insert(ctx context.Context, tx sdk.Tx) error
Expand Down Expand Up @@ -80,14 +80,14 @@ type BaseApp interface {
func NewKeyshareCheckTxHandler(
baseApp BaseApp,
txDecoder sdk.TxDecoder,
keyshareLane KeyShareLaneI,
keyshareLane KeyshareLaneI,
anteHandler sdk.AnteHandler,
checkTxHandler CheckTx,
) *KeyshareCheckTxHandler {
return &KeyshareCheckTxHandler{
baseApp: baseApp,
txDecoder: txDecoder,
keyShareLane: keyshareLane,
keyshareLane: keyshareLane,
anteHandler: anteHandler,
checkTxHandler: checkTxHandler,
}
Expand All @@ -112,7 +112,7 @@ func (handler *KeyshareCheckTxHandler) CheckTx() CheckTx {
}

// Attempt to get the keyshare info of the transaction.
ksInfo, err := handler.keyShareLane.GetKeyShareInfo(tx)
ksInfo, err := handler.keyshareLane.GetDecryptionKeyInfo(tx)
if err != nil {
return sdkerrors.ResponseCheckTxWithEvents(fmt.Errorf("failed to get keyshare info: %w", err), 0, 0, nil, false), err
}
Expand All @@ -134,7 +134,7 @@ func (handler *KeyshareCheckTxHandler) CheckTx() CheckTx {
}

// If the keyshare transaction is valid, we know we can insert it into the mempool for consideration in the next block.
if err := handler.keyShareLane.Insert(ctx, tx); err != nil {
if err := handler.keyshareLane.Insert(ctx, tx); err != nil {
return sdkerrors.ResponseCheckTxWithEvents(fmt.Errorf("invalid keyshare tx; failed to insert keyshare transaction into mempool: %w", err), gasInfo.GasWanted, gasInfo.GasUsed, nil, false), err
}

Expand All @@ -147,7 +147,11 @@ func (handler *KeyshareCheckTxHandler) CheckTx() CheckTx {
}

// ValidateKeyshareTx is utilized to verify the keyshare transaction against the latest committed state.
func (handler *KeyshareCheckTxHandler) ValidateKeyshareTx(ctx sdk.Context, ksTx sdk.Tx, ksInfo *peptypes.AggregatedKeyShare) (sdk.GasInfo, error) {
func (handler *KeyshareCheckTxHandler) ValidateKeyshareTx(
ctx sdk.Context,
ksTx sdk.Tx,
ksInfo *peptypes.DecryptionKey,
) (sdk.GasInfo, error) {
// Verify the keyshare transaction.
ctx, err := handler.anteHandler(ctx, ksTx, false)
if err != nil {
Expand Down
Loading