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

Fixed issue - SGX url is unknown during - in PWA subsystem #1521

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 agent/bls.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2800,7 +2800,7 @@ export async function handleSkaleImaVerifyAndSign( joCallData ) {
if( ! joAccount.strURL ) {
joAccount = optsHandleVerifyAndSign.imaState.chainProperties.mn.joAccount;
if( ! joAccount.strSgxURL )
throw new Error( "SGX URL is unknown, cannot sign IMA message(s)" );
throw new Error( "SGX URL is unknown, cannot sign(handle) IMA message(s)" );
if( ! joAccount.strBlsKeyName )
throw new Error( "BLS keys name is unknown, cannot sign IMA message(s)" );
}
Expand Down
65 changes: 61 additions & 4 deletions agent/cli.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -475,10 +475,11 @@ function printHelpUserAccount1( soi ) {
console.log( soi + cc.debug( "--" ) +
cc.bright( "sgx-url-t-chain" ) + cc.sunny( "=" ) + cc.attention( "URL" ) +
cc.debug( "..................." ) + cc.sunny( "SGX server" ) +
cc.notice( " URL for " ) + cc.note( "S<->S Target S-chain" ) +
cc.notice( ". Value is automatically loaded from the " ) +
cc.warning( "SGX_URL_S_CHAIN_TARGET" ) +
cc.notice( " environment variable if not specified." ) );
cc.notice( " URL for " ) + cc.note( "S<->S Target S-chain." ) );
console.log( soi + cc.debug( "--" ) +
cc.bright( "sgx-url" ) + cc.sunny( "=" ) + cc.attention( "URL" ) +
cc.debug( "..................." ) + cc.sunny( "SGX server" ) +
cc.notice( " URL for all chains." ) );
console.log( soi + cc.debug( "--" ) +
cc.bright( "sgx-ecdsa-key-main-net" ) + cc.sunny( "=" ) + cc.error( "name" ) +
cc.debug( "..........." ) + cc.attention( "SGX/ECDSA key name" ) +
Expand All @@ -500,6 +501,10 @@ function printHelpUserAccount1( soi ) {
cc.notice( ". Value is automatically loaded from the " ) +
cc.warning( "SGX_KEY_S_CHAIN_TARGET" ) +
cc.notice( " environment variable if not specified." ) );
console.log( soi + cc.debug( "--" ) +
cc.bright( "sgx-ecdsa-key" ) + cc.sunny( "=" ) + cc.error( "name" ) +
cc.debug( "............" ) + cc.attention( "SGX/ECDSA key name" ) +
cc.notice( " for all chains." ) );
console.log( soi + cc.debug( "--" ) +
cc.bright( "sgx-bls-key-main-net" ) + cc.sunny( "=" ) + cc.error( "name" ) +
cc.debug( "............." ) + cc.attention( "SGX/BLS key name" ) +
Expand All @@ -521,6 +526,10 @@ function printHelpUserAccount1( soi ) {
cc.notice( ". Value is automatically loaded from the " ) +
cc.warning( "BLS_KEY_S_CHAIN_TARGET" ) +
cc.notice( " environment variable if not specified." ) );
console.log( soi + cc.debug( "--" ) +
cc.bright( "sgx-bls-key" ) + cc.sunny( "=" ) + cc.error( "name" ) +
cc.debug( ".............." ) + cc.attention( "SGX/BLS key name" ) +
cc.notice( " for all chains." ) );
console.log( soi + cc.debug( "--" ) +
cc.bright( "sgx-ssl-key-main-net" ) + cc.sunny( "=" ) + cc.attention( "path" ) +
cc.debug( "............." ) + cc.notice( "Path to " ) + cc.note( "SSL key file" ) +
Expand All @@ -544,6 +553,10 @@ function printHelpUserAccount1( soi ) {
cc.notice( ". Value is automatically loaded from the " ) +
cc.warning( "SGX_SSL_KEY_FILE_S_CHAIN_TARGET" ) +
cc.notice( " environment variable if not specified." ) );
console.log( soi + cc.debug( "--" ) +
cc.bright( "sgx-ssl-key" ) + cc.sunny( "=" ) + cc.attention( "path" ) +
cc.debug( ".............." ) + cc.notice( "Path to " ) + cc.note( "SSL key file" ) +
cc.notice( " for " ) + cc.bright( "SGX wallet" ) + cc.notice( " of all chains." ) );
console.log( soi + cc.debug( "--" ) +
cc.bright( "sgx-ssl-cert-main-net" ) + cc.sunny( "=" ) + cc.attention( "path" ) +
cc.debug( "............" ) + cc.notice( "Path to " ) +
Expand All @@ -569,6 +582,10 @@ function printHelpUserAccount1( soi ) {
cc.notice( ". Value is automatically loaded from the " ) +
cc.warning( "SGX_SSL_CERT_FILE_S_CHAIN_TARGET" ) +
cc.notice( " environment variable if not specified." ) );
console.log( soi + cc.debug( "--" ) +
cc.bright( "sgx-ssl-cert" ) + cc.sunny( "=" ) + cc.attention( "path" ) +
cc.debug( "............." ) + cc.notice( "Path to " ) +
cc.note( "SSL certificate file" ) + cc.notice( " for all chains." ) );
console.log( soi + cc.debug( "--" ) +
cc.bright( "address-main-net" ) + cc.sunny( "=" ) + cc.warning( "value" ) +
cc.debug( "................" ) + cc.note( "Main-net" ) + " " +
Expand Down Expand Up @@ -1570,6 +1587,14 @@ function parseSgxArgs( imaState, joArg ) {
imaState.chainProperties.tc.joAccount.strSgxURL = joArg.value;
return true;
}
if( joArg.name == "sgx-url" ) {
owaspUtils.verifyArgumentIsURL( joArg );
imaState.chainProperties.mn.joAccount.strSgxURL =
imaState.chainProperties.sc.joAccount.strSgxURL =
imaState.chainProperties.tc.joAccount.strSgxURL =
joArg.value;
return true;
}
if( joArg.name == "sgx-ecdsa-key-main-net" ) {
owaspUtils.verifyArgumentWithNonEmptyValue( joArg );
imaState.chainProperties.mn.joAccount.strSgxKeyName = joArg.value;
Expand All @@ -1585,6 +1610,14 @@ function parseSgxArgs( imaState, joArg ) {
imaState.chainProperties.tc.joAccount.strSgxKeyName = joArg.value;
return true;
}
if( joArg.name == "sgx-ecdsa-key" ) {
owaspUtils.verifyArgumentWithNonEmptyValue( joArg );
imaState.chainProperties.mn.joAccount.strSgxKeyName =
imaState.chainProperties.sc.joAccount.strSgxKeyName =
imaState.chainProperties.tc.joAccount.strSgxKeyName =
joArg.value;
return true;
}
if( joArg.name == "sgx-bls-key-main-net" ) {
owaspUtils.verifyArgumentWithNonEmptyValue( joArg );
imaState.chainProperties.mn.joAccount.strBlsKeyName = joArg.value;
Expand All @@ -1600,6 +1633,14 @@ function parseSgxArgs( imaState, joArg ) {
imaState.chainProperties.tc.joAccount.strBlsKeyName = joArg.value;
return true;
}
if( joArg.name == "sgx-bls-key" ) {
owaspUtils.verifyArgumentWithNonEmptyValue( joArg );
imaState.chainProperties.mn.joAccount.strBlsKeyName =
imaState.chainProperties.sc.joAccount.strBlsKeyName =
imaState.chainProperties.tc.joAccount.strBlsKeyName =
joArg.value;
return true;
}
if( joArg.name == "sgx-ssl-key-main-net" ) {
owaspUtils.verifyArgumentIsPathToExistingFile( joArg );
imaState.chainProperties.mn.joAccount.strPathSslKey =
Expand All @@ -1618,6 +1659,14 @@ function parseSgxArgs( imaState, joArg ) {
imaUtils.normalizePath( joArg.value );
return true;
}
if( joArg.name == "sgx-ssl-key" ) {
owaspUtils.verifyArgumentIsPathToExistingFile( joArg );
imaState.chainProperties.mn.joAccount.strPathSslKey =
imaState.chainProperties.sc.joAccount.strPathSslKey =
imaState.chainProperties.tc.joAccount.strPathSslKey =
imaUtils.normalizePath( joArg.value );
return true;
}
if( joArg.name == "sgx-ssl-cert-main-net" ) {
owaspUtils.verifyArgumentIsPathToExistingFile( joArg );
imaState.chainProperties.mn.joAccount.strPathSslCert =
Expand All @@ -1636,6 +1685,14 @@ function parseSgxArgs( imaState, joArg ) {
imaUtils.normalizePath( joArg.value );
return true;
}
if( joArg.name == "sgx-ssl-cert" ) {
owaspUtils.verifyArgumentIsPathToExistingFile( joArg );
imaState.chainProperties.mn.joAccount.strPathSslCert =
imaState.chainProperties.sc.joAccount.strPathSslCert =
imaState.chainProperties.tc.joAccount.strPathSslCert =
imaUtils.normalizePath( joArg.value );
return true;
}
return false;
}

Expand Down
8 changes: 4 additions & 4 deletions agent/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ BASE_OPTIONS="--gas-price-multiplier=$GAS_PRICE_MULTIPLIER \
--cid-s-chain=$CID_SCHAIN \
--abi-main-net=$MAINNET_PROXY_PATH \
--abi-s-chain=$SCHAIN_PROXY_PATH \
--sgx-url-s-chain=$SGX_URL \
--sgx-ecdsa-key-s-chain=$ECDSA_KEY_NAME \
--sgx-ssl-key-s-chain=$SGX_SSL_KEY_PATH \
--sgx-ssl-cert-s-chain=$SGX_SSL_CERT_PATH \
--sgx-url=$SGX_URL \
--sgx-ecdsa-key=$ECDSA_KEY_NAME \
--sgx-ssl-key=$SGX_SSL_KEY_PATH \
--sgx-ssl-cert=$SGX_SSL_CERT_PATH \
--address-main-net=$NODE_ADDRESS \
--address-s-chain=$NODE_ADDRESS \
--sign-messages \
Expand Down