-
Notifications
You must be signed in to change notification settings - Fork 1
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
Implement E2E infrastructure for skyline system #13
base: feat/skyline
Are you sure you want to change the base?
Conversation
I have read the CLA Document and I hereby sign the CLA |
@@ -330,6 +415,51 @@ func (a *ApexSystem) GenerateConfigs() error { | |||
}) | |||
} | |||
|
|||
func (a *ApexSystem) GenerateSkylineConfigs() error { |
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.
No need for two public functions. There should be two private functions and one existing public function that calls those two in an if-else statement, depending on some config (IsReactor
or IsSkyline
if that is not already in the config).
@@ -355,14 +382,27 @@ func (ec *TestCardanoChain) BridgingRequest( | |||
}) | |||
} | |||
|
|||
exchangeRates := []sendtx.ExchangeRateEntry{ |
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.
this is hardcoded (this is not place to set config parameters). Call extern function via some interface or put these in config
@@ -137,4 +137,8 @@ func (t *TestApexChainDummy) CreateMetadata( | |||
return nil, nil | |||
} | |||
|
|||
func (t *TestApexChainDummy) SetNativeTokenName(string) { |
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.
remove this from all the files
@@ -0,0 +1,77 @@ | |||
package cardanofw |
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.
No need two have two separate files for skyline and reactor. Just depending on config (IsReactor
) execute one of constructor methods. Everything else is the same
@@ -15,7 +15,7 @@ type ITestApexChain interface { | |||
CreateWallets(validator *TestApexValidator) error | |||
CreateAddresses(bladeAdmin *crypto.ECDSAKey, bridgeURL string) error | |||
FundWallets(ctx context.Context) error | |||
RegisterChain(validator *TestApexValidator) error | |||
RegisterChain(validator *TestApexValidator, system string) error |
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.
system string
should be some config parameter IsSkyline
or IsReactor
. interface method should not be changed
@@ -211,14 +212,56 @@ func (a *ApexSystem) InitContracts(ctx context.Context) error { | |||
return nil | |||
} | |||
|
|||
func (a *ApexSystem) GetTokenName(chainId string, networkType cardanowallet.CardanoNetworkType) string { |
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.
consider passing t *testing.T
as parameter (t.Helper()
is mandatory) and do require.NoError instead of _
@@ -259,6 +315,35 @@ func (a *ApexSystem) FundWallets(ctx context.Context) error { | |||
}) | |||
} | |||
|
|||
func (a *ApexSystem) FundWalletsSkyline(ctx context.Context) error { |
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.
This method should not exists
if there are tokens in configuration than tokens should be funded too
Just put token fund part of the code in cardano-chain (with if condition of-course)
func (ec *TestCardanoChain) RegisterChain(validator *TestApexValidator) error { | ||
return validator.RegisterChain(ec.ChainID(), ec.config.InitialHotWalletAmount, ChainTypeCardano) | ||
func (ec *TestCardanoChain) RegisterChain(validator *TestApexValidator, system string) error { | ||
if system == "skyline" { |
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.
just call
return validator.RegisterChain(ec.ChainID(), ec.config.InitialHotWalletAmount, ec.config.InitialHotWalletTokenAmount, ChainTypeCardano)```
there is no need for two cases
@@ -450,3 +490,11 @@ func (ec *TestCardanoChain) submitTx( | |||
return txHash, nil | |||
}, infracommon.WithRetryCount(retryCount), infracommon.WithRetryWaitTime(retryWaitTime)) | |||
} | |||
|
|||
func GetExchangeRate(sourceChainID string, destinationChainID string) (float64, error) { |
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.
remove this... we will later add dynamic exchange rate through some interface implementation
networkType cardanowallet.CardanoNetworkType, txProvider cardanowallet.ITxProvider, | ||
minterUser *TestApexUser, addrToFund string, lovelaceFundAmount uint64, tokenFundAmount uint64, | ||
) (*cardanowallet.TokenAmount, error) { | ||
minterWallet, _ := minterUser.GetCardanoWallet(chain) |
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.
duplicate code from GetTokenName
change that to receive wallet and than use here also
Description
Please provide a detailed description of what was done in this PR
Changes include
Breaking changes
Please complete this section if any breaking changes have been made, otherwise delete it
Checklist
Testing
Manual tests
Please complete this section if you ran manual tests for this functionality, otherwise delete it
Documentation update
Please link the documentation update PR in this section if it's present, otherwise delete it
Additional comments
Please post additional comments in this section if you have them, otherwise delete it