Skip to content

Commit

Permalink
refactor: refactor icon's, eth's, btp, ibc bridge kurtosis and go pac…
Browse files Browse the repository at this point in the history
…kage of contract configuration, bridge btp (#197)

* refactor: refactor argument passing in icon's starlark and Go packages

* chore:change DiveRemotePackagePath in constant.go and RunStarlarkPackage to RunStarlarkRemotePackage in icon.go

* refactor: refactor argument passing  in icon's, eth's btp  setup starklark package

* refactor:  refactor icon's, eth's, btp, ibc bridge  kurtosis and go package of contract configuration, bridge btp
  • Loading branch information
abhiyana authored Oct 16, 2023
1 parent ecabd48 commit 181c6bc
Show file tree
Hide file tree
Showing 17 changed files with 1,425 additions and 743 deletions.
5 changes: 1 addition & 4 deletions cli/commands/bridge/relays/btp.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,7 @@ func runBtpSetupByRunningNodes(diveContext *common.DiveContext, enclaveCtx *encl

func runBtpSetupForAlreadyRunningNodes(diveContext *common.DiveContext, enclaveCtx *enclaves.EnclaveContext, mainFunctionName string, srcChain string, dstChain string, srcChainServiceName string, dstChainServiceName string, bridge bool, srcChainServiceResponse string, dstChainServiceResponse string) {

configData := fmt.Sprintf(`{"links": {"src":"%s","dst":"%s"},"chains" : { "%s" : %s,"%s" : %s},"contracts" : {"%s" : {},"%s" : {}},"bridge" : "%s"}`, srcChain, dstChain, srcChainServiceName, srcChainServiceResponse, dstChainServiceName, dstChainServiceResponse, srcChainServiceName, dstChainServiceName, strconv.FormatBool(bridge))

params := fmt.Sprintf(`{"src_chain":"%s", "dst_chain":"%s", "config_data":%s, "src_service_name":"%s", "dst_service_name":"%s"}`, srcChain, dstChain, configData, srcChainServiceName, dstChainServiceName)

params := fmt.Sprintf(`{"src_chain":"%s","dst_chain":"%s", "src_chain_config":%s, "dst_chain_config":%s, "bridge":%s}`, chainA, chainB, srcChainServiceResponse, dstChainServiceResponse, strconv.FormatBool(bridge))
starlarkConfig := diveContext.GetStarlarkRunConfig(params, common.DiveBridgeScript, mainFunctionName)
data, _, err := enclaveCtx.RunStarlarkRemotePackage(diveContext.Ctx, common.DiveRemotePackagePath, starlarkConfig)

Expand Down
2 changes: 1 addition & 1 deletion cli/commands/bridge/relays/ibc.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func startCosmosChainsAndSetupIbcRelay(diveContext *common.DiveContext, enclaveC

func setupIbcRelayforAlreadyRunningCosmosChain(diveContext *common.DiveContext, enclaveCtx *enclaves.EnclaveContext, chainA, chainB, chainAServiceResponse, chainBServiceResponse string) (string, error) {

params := fmt.Sprintf(`{"src_chain_config":%s,"dst_chain_config":%s, "args":{"links": {"src": "%s", "dst": "%s"}, "src_config":{"data":{}}, "dst_config":{"data":{}}}}`, chainAServiceResponse, chainBServiceResponse, chainA, chainB)
params := fmt.Sprintf(`{"src_chain":"%s","dst_chain":"%s", "src_chain_config":%s, "dst_chain_config":%s}`, chainA, chainB, chainAServiceResponse, chainBServiceResponse)

executionResult, err := runStarlarkPackage(diveContext, enclaveCtx, params, "run_cosmos_ibc_relay_for_already_running_chains")

Expand Down
224 changes: 26 additions & 198 deletions main.star

Large diffs are not rendered by default.

64 changes: 64 additions & 0 deletions package_io/input_parser.star
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ def get_args_data(args):
bridge = bridge,
)




def generate_new_config_data(links, srcchain_service_name, dst_chain_service_name, bridge):
config_data = ""
if bridge == "":
Expand Down Expand Up @@ -68,6 +71,67 @@ def generate_new_config_data(links, srcchain_service_name, dst_chain_service_nam

return config_data



def generate_new_config_data_for_ibc(src_chain, dst_chain, srcchain_service_name, dst_chain_service_name):

config_data = {
"links": {
"src": "%s" % src_chain,
"dst": "%s" % dst_chain
},
"chains": {
"%s" % srcchain_service_name: {},
"%s" % dst_chain_service_name: {},
},
"contracts": {
"%s" % srcchain_service_name: {},
"%s" % dst_chain_service_name: {},
},
}

return config_data


def generate_new_config_data_for_btp(src_chain, dst_chain, srcchain_service_name, dst_chain_service_name, bridge):
config_data = ""
if bridge == "":
config_data = {
"links": {
"src": "%s" % src_chain,
"dst": "%s" % dst_chain
},
"chains": {
"%s" % srcchain_service_name: {},
"%s" % dst_chain_service_name: {},
},
"contracts": {
"%s" % srcchain_service_name: {},
"%s" % dst_chain_service_name: {},
},
}
else:

config_data = {
"links": {
"src": "%s" % src_chain,
"dst": "%s" % dst_chain
},
"chains": {
"%s" % srcchain_service_name: {},
"%s" % dst_chain_service_name: {},
},
"contracts": {
"%s" % srcchain_service_name: {},
"%s" % dst_chain_service_name: {},
},
"bridge": "%s" % bridge
}

return config_data



def generate_new_config_data_cosmvm_cosmvm(links, srcchain_service_name, dst_chain_service_name):
config_data = {
"links": links,
Expand Down
Loading

0 comments on commit 181c6bc

Please sign in to comment.