Skip to content

Commit

Permalink
Merge branch 'develop' into 'master'
Browse files Browse the repository at this point in the history
Develop

See merge request in3/c/in3-core!335
  • Loading branch information
simon-jentzsch committed Aug 17, 2020
2 parents 828fbdb + a8a9cb1 commit 987f853
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 42 deletions.
16 changes: 8 additions & 8 deletions c/ci-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ release_mac_and_wasm:
- tar -zcv --exclude=*cmake* -f in3_${CI_COMMIT_TAG}_mac.tar.gz in3-mac-wasm/
- IPFS_RESPONSE=$(curl -X POST https://api.pinata.cloud/pinning/pinFileToIPFS -H 'Content-Type:multipart/form-data' -H 'pinata_api_key:'"$PINATA_API_KEY" -H 'pinata_secret_api_key:'"$PINATA_SECRET_API_KEY" -F file=@in3_${CI_COMMIT_TAG}_mac.tar.gz -F 'pinataMetadata={"name":"in3_'${CI_COMMIT_TAG}'_mac.tar.gz","keyValues":{"version":"${CI_COMMIT_TAG}"}}' -F 'pinataOptions={"cidVersion":0}')
- "IPFS_HASH=$(echo $IPFS_RESPONSE | sed -e 's/[{}]/''/g' | awk -v RS=',' -F: '/IpfsHash/ {print $2}')"
- ghr -u slockIt -r in3-c $CI_COMMIT_TAG in3_${CI_COMMIT_TAG}_mac.tar.gz
- ghr -u blockchainsllc -r in3-c $CI_COMMIT_TAG in3_${CI_COMMIT_TAG}_mac.tar.gz
- tar -zcv --exclude=in3-mac-wasm/python --exclude=in3-mac-wasm/java --exclude=in3-mac-wasm/bin --exclude=in3-mac-wasm/lib --exclude=*cmake* -f in3_${CI_COMMIT_TAG}_wasm.tar.gz in3-mac-wasm/
- IPFS_RESPONSE=$(curl -X POST https://api.pinata.cloud/pinning/pinFileToIPFS -H 'Content-Type:multipart/form-data' -H 'pinata_api_key:'"$PINATA_API_KEY" -H 'pinata_secret_api_key:'"$PINATA_SECRET_API_KEY" -F file=@in3_${CI_COMMIT_TAG}_wasm.tar.gz -F 'pinataMetadata={"name":"in3_'${CI_COMMIT_TAG}'_wasm.tar.gz","keyValues":{"version":"${CI_COMMIT_TAG}"}}' -F 'pinataOptions={"cidVersion":0}')
- "IPFS_HASH=$(echo $IPFS_RESPONSE | sed -e 's/[{}]/''/g' | awk -v RS=',' -F: '/IpfsHash/ {print $2}')"
- echo "Mac release:" $IPFS_HASH >> in3-mac-wasm/mac_release_ipfs_hash.txt
- ghr -u slockIt -r in3-c $CI_COMMIT_TAG in3_${CI_COMMIT_TAG}_wasm.tar.gz
- ghr -u blockchainsllc -r in3-c $CI_COMMIT_TAG in3_${CI_COMMIT_TAG}_wasm.tar.gz
- cd in3-mac-wasm
artifacts:
paths:
Expand Down Expand Up @@ -143,7 +143,7 @@ release_x64:
- IPFS_RESPONSE=$(curl -X POST https://api.pinata.cloud/pinning/pinFileToIPFS -H 'Content-Type:multipart/form-data' -H 'pinata_api_key:'"$PINATA_API_KEY" -H 'pinata_secret_api_key:'"$PINATA_SECRET_API_KEY" -F file=@in3_${CI_COMMIT_TAG}_x64.tar.gz -F 'pinataMetadata={"name":"in3_'${CI_COMMIT_TAG}'_mac.tar.gz","keyValues":{"version":"${CI_COMMIT_TAG}"}}' -F 'pinataOptions={"cidVersion":0}')
- "IPFS_HASH=$(echo $IPFS_RESPONSE | sed -e 's/[{}]/''/g' | awk -v RS=',' -F: '/IpfsHash/ {print $2}')"
- echo "x64 release:" $IPFS_HASH >> in3-x64/x64_release_ipfs_hash.txt
- ghr -u slockIt -r in3-c $CI_COMMIT_TAG in3_${CI_COMMIT_TAG}_x64.tar.gz
- ghr -u blockchainsllc -r in3-c $CI_COMMIT_TAG in3_${CI_COMMIT_TAG}_x64.tar.gz
- cd in3-x64
artifacts:
paths:
Expand Down Expand Up @@ -180,7 +180,7 @@ release_x86:
- IPFS_RESPONSE=$(curl -X POST https://api.pinata.cloud/pinning/pinFileToIPFS -H 'Content-Type:multipart/form-data' -H 'pinata_api_key:'"$PINATA_API_KEY" -H 'pinata_secret_api_key:'"$PINATA_SECRET_API_KEY" -F file=@in3_${CI_COMMIT_TAG}_x86.tar.gz -F 'pinataMetadata={"name":"in3_'${CI_COMMIT_TAG}'_x86.tar.gz","keyValues":{"version":"${CI_COMMIT_TAG}"}}' -F 'pinataOptions={"cidVersion":0}')
- "IPFS_HASH=$(echo $IPFS_RESPONSE | sed -e 's/[{}]/''/g' | awk -v RS=',' -F: '/IpfsHash/ {print $2}')"
- echo "x86 release:" $IPFS_HASH >> in3-x86/x86_release_ipfs_hash.txt
- ghr -u slockIt -r in3-c $CI_COMMIT_TAG in3_${CI_COMMIT_TAG}_x86.tar.gz
- ghr -u blockchainsllc -r in3-c $CI_COMMIT_TAG in3_${CI_COMMIT_TAG}_x86.tar.gz
- cd in3-x86
artifacts:
paths:
Expand Down Expand Up @@ -217,7 +217,7 @@ release_arm7:
- IPFS_RESPONSE=$(curl -X POST https://api.pinata.cloud/pinning/pinFileToIPFS -H 'Content-Type:multipart/form-data' -H 'pinata_api_key:'"$PINATA_API_KEY" -H 'pinata_secret_api_key:'"$PINATA_SECRET_API_KEY" -F file=@in3_${CI_COMMIT_TAG}_arm7.tar.gz -F 'pinataMetadata={"name":"in3_'${CI_COMMIT_TAG}'_arm7.tar.gz","keyValues":{"version":"${CI_COMMIT_TAG}"}}' -F 'pinataOptions={"cidVersion":0}')
- "IPFS_HASH=$(echo $IPFS_RESPONSE | sed -e 's/[{}]/''/g' | awk -v RS=',' -F: '/IpfsHash/ {print $2}')"
- echo "arm7 release:" $IPFS_HASH >> in3-arm7/arm7_release_ipfs_hash.txt
- ghr -u slockIt -r in3-c $CI_COMMIT_TAG in3_${CI_COMMIT_TAG}_arm7.tar.gz
- ghr -u blockchainsllc -r in3-c $CI_COMMIT_TAG in3_${CI_COMMIT_TAG}_arm7.tar.gz
- cd in3-arm7
artifacts:
paths:
Expand Down Expand Up @@ -258,7 +258,7 @@ release_win:
- IPFS_RESPONSE=$(curl -X POST https://api.pinata.cloud/pinning/pinFileToIPFS -H 'Content-Type:multipart/form-data' -H 'pinata_api_key:'"$PINATA_API_KEY" -H 'pinata_secret_api_key:'"$PINATA_SECRET_API_KEY" -F file=@in3_${CI_COMMIT_TAG}_windows.tar.gz -F 'pinataMetadata={"name":"in3_'${CI_COMMIT_TAG}'_windows.tar.gz","keyValues":{"version":"${CI_COMMIT_TAG}"}}' -F 'pinataOptions={"cidVersion":0}')
- "IPFS_HASH=$(echo $IPFS_RESPONSE | sed -e 's/[{}]/''/g' | awk -v RS=',' -F: '/IpfsHash/ {print $2}')"
- echo "windows release:" $IPFS_HASH >> in3-win/win_release_ipfs_hash.txt
- ghr -u slockIt -r in3-c $CI_COMMIT_TAG in3_${CI_COMMIT_TAG}_windows.tar.gz
- ghr -u blockchainsllc -r in3-c $CI_COMMIT_TAG in3_${CI_COMMIT_TAG}_windows.tar.gz
- cd in3-win
artifacts:
paths:
Expand Down Expand Up @@ -423,7 +423,7 @@ brew_release:
- sed -e '5s/.*/sha256 '"\"$sha256_hash"\"'/' in3.rb > in3.rb.tmp && mv in3.rb.tmp in3.rb
- git add in3.rb
- git commit -m "updated version and hash"
- git push https://${GITHUB_USER_NAME}:${GITHUB_TOKEN}@github.com/slockit/homebrew-in3.git --all
- git push https://${GITHUB_USER_NAME}:${GITHUB_TOKEN}@github.com/blockchainsllc/homebrew-in3.git --all

github_body_release:
stage: release
Expand All @@ -443,4 +443,4 @@ github_body_release:
- cat in3-x86/x86_release_ipfs_hash.txt >> release_ipfs_hash.txt
- cat in3-arm7/arm7_release_ipfs_hash.txt >> release_ipfs_hash.txt
- cat in3-win/win_release_ipfs_hash.txt >> release_ipfs_hash.txt
- ghr -u slockIt -r in3-c -b "$(cat release_ipfs_hash.txt)" $CI_COMMIT_TAG release_ipfs_hash.txt
- ghr -u blockchainsllc -r in3-c -b "$(cat release_ipfs_hash.txt)" $CI_COMMIT_TAG release_ipfs_hash.txt
22 changes: 11 additions & 11 deletions c/src/core/client/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@

#define IN3_PROTO_VER "2.1.0" /**< the protocol version used when sending requests from the this client */

#define CHAIN_ID_MULTICHAIN 0x0 /**< chain_id working with all known chains */
#define CHAIN_ID_MAINNET 0x01 /**< chain_id for mainnet */
#define CHAIN_ID_KOVAN 0x2a /**< chain_id for kovan */
#define CHAIN_ID_TOBALABA 0x44d /**< chain_id for tobalaba */
#define CHAIN_ID_GOERLI 0x5 /**< chain_id for goerlii */
#define CHAIN_ID_EVAN 0x4b1 /**< chain_id for evan */
#define CHAIN_ID_EWC 0xf6 /**< chain_id for ewc */
#define CHAIN_ID_IPFS 0x7d0 /**< chain_id for ipfs */
#define CHAIN_ID_BTC 0x99 /**< chain_id for btc */
#define CHAIN_ID_LOCAL 0xFFFF /**< chain_id for local chain */
#define DEF_REPL_LATEST_BLK 6 /**< default replace_latest_block */
#define CHAIN_ID_MULTICHAIN 0x0 /**< chain_id working with all known chains */
#define CHAIN_ID_MAINNET 0x01 /**< chain_id for mainnet */
#define CHAIN_ID_KOVAN 0x2a /**< chain_id for kovan */
#define CHAIN_ID_TOBALABA 0x44d /**< chain_id for tobalaba */
#define CHAIN_ID_GOERLI 0x5 /**< chain_id for goerlii */
#define CHAIN_ID_EVAN 0x4b1 /**< chain_id for evan */
#define CHAIN_ID_EWC 0xf6 /**< chain_id for ewc */
#define CHAIN_ID_IPFS 0x7d0 /**< chain_id for ipfs */
#define CHAIN_ID_BTC 0x99 /**< chain_id for btc */
#define CHAIN_ID_LOCAL 0x11 /**< chain_id for local chain */
#define DEF_REPL_LATEST_BLK 6 /**< default replace_latest_block */

/**
* type for a chain_id.
Expand Down
2 changes: 1 addition & 1 deletion c/src/core/client/client_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ static in3_ret_t in3_client_init(in3_t* c, chain_id_t chain_id) {
init_ewf(chain++);

if (!chain_id || chain_id == CHAIN_ID_LOCAL) {
initChain(chain, 0xFFFF, "f0fb87f4757c77ea3416afe87f36acaa0496c7e9", NULL, 1, 1, CHAIN_ETH, NULL);
initChain(chain, 0x11, "f0fb87f4757c77ea3416afe87f36acaa0496c7e9", NULL, 1, 1, CHAIN_ETH, NULL);
initNode(chain++, 0, "784bfa9eb182c3a02dbeb5285e3dba92d717e07a", "http://localhost:8545");
}
if (chain_id && chain == c->chains) {
Expand Down
1 change: 0 additions & 1 deletion c/test/unit_tests/test_ethapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,6 @@ static void test_eth_getblock_txcount_hash(void) {
static void test_eth_getblock_hash(void) {
in3_t* in3 = init_in3(mock_transport, 0x5);
bytes32_t blk_hash;
// 0x9cd22d209f24344147494d05d13f335b6e63af930abdc60f3db63627589e1438
hex_to_bytes("0x1c9d592c4ad3fba02f7aa063e8048b3ff12551fd377e78061ab6ad146cc8df4d", -1, blk_hash, 32);

//eth_block_t* block = eth_getBlockByNumber(in3, BLKNUM_EARLIEST(), false);
Expand Down
2 changes: 1 addition & 1 deletion java/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,4 @@ release_maven:
script:
- touch settings.xml
- echo $MAVEN_SETTINGS > settings.xml
- mvn -s settings.xml deploy:deploy-file -DgroupId=it.slock -DartifactId=in3 -Dversion=$CI_COMMIT_TAG -Dpackaging=jar -Dfile=java_build/lib/in3.jar -DrepositoryId=github -Durl=https://maven.pkg.github.com/slockit/in3-c
- mvn -s settings.xml deploy:deploy-file -DgroupId=it.blockchainsllc -DartifactId=in3 -Dversion=$CI_COMMIT_TAG -Dpackaging=jar -Dfile=java_build/lib/in3.jar -DrepositoryId=github -Durl=https://maven.pkg.github.com/blockchainsllc/in3-c
20 changes: 11 additions & 9 deletions rust/in3-rs/src/in3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,25 @@ pub mod chain {
pub type ChainId = u32;

/// Chain Id representing set of all supported chains
pub const MULTICHAIN: u32 = 0x0;
pub const MULTICHAIN: u32 = in3_sys::CHAIN_ID_MULTICHAIN;
/// Chain Id for mainnet
pub const MAINNET: u32 = 0x01;
pub const MAINNET: u32 = in3_sys::CHAIN_ID_MAINNET;
/// Chain Id for kovan
pub const KOVAN: u32 = 0x2a;
pub const KOVAN: u32 = in3_sys::CHAIN_ID_KOVAN;
/// Chain Id for tobalaba
pub const TOBALABA: u32 = 0x44d;
pub const TOBALABA: u32 = in3_sys::CHAIN_ID_TOBALABA;
/// Chain Id for goerli
pub const GOERLI: u32 = 0x5;
pub const GOERLI: u32 = in3_sys::CHAIN_ID_GOERLI;
/// Chain Id for evan
pub const EVAN: u32 = 0x4b1;
pub const EVAN: u32 = in3_sys::CHAIN_ID_EVAN;
/// Chain Id for EWC
pub const EWC: u32 = in3_sys::CHAIN_ID_EWC;
/// Chain Id for IPFS
pub const IPFS: u32 = 0x7d0;
pub const IPFS: u32 = in3_sys::CHAIN_ID_IPFS;
/// Chain Id for bitcoin
pub const BTC: u32 = 0x99;
pub const BTC: u32 = in3_sys::CHAIN_ID_BTC;
/// Chain Id for local chains
pub const LOCAL: u32 = 0xffff;
pub const LOCAL: u32 = in3_sys::CHAIN_ID_LOCAL;
}

struct Ctx {
Expand Down
51 changes: 40 additions & 11 deletions scripts/qemu_xtensa.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,41 @@
#!/bin/bash
xtensa-softmmu/qemu-system-xtensa -nographic -semihosting -machine esp32 -drive file=flash_image.bin,if=mtd,format=raw -nographic -vga none -net none -global driver=timer.esp32.timg,property=wdt_disable,value=true -no-reboot 2> /dev/null > test_out.txt
# search for the result of the test
grep "IN3 TEST PASSED" ./test_out.txt
out="$?"
if [ "$out" -eq 1 ] ; then
echo "TEST FAILED"
exit 1
else
echo "TEST SUCCESS!"
exit 0
fi

xtensa_run() {
# kill xtensa processes
pids=$(ps aux | grep "[q]emu-system-xtensa" |awk '{print $2}')
for pi in $pids; do kill -9 $pi; done
# run qemu with timeout
timeout --foreground 100s xtensa-softmmu/qemu-system-xtensa -nographic -semihosting -machine esp32 -drive file=flash_image.bin,if=mtd,format=raw -nographic -vga none -net none -global driver=timer.esp32.timg,property=wdt_disable,value=true -no-reboot | tee test.txt
# search for the result of the test
if [ -f ./test.txt ]; then
grep "IN3 TEST PASSED" ./test.txt
out="$?"
if [ "$out" -eq 0 ] ; then
return 0
else
return 1
fi
else
return 1
fi
}

retry() {
local -r -i max_attempts="$1"; shift
local -i attempt_num=0
echo $max_attempts
until [ ${attempt_num} -ge ${max_attempts} ]
do
xtensa_run
local res=$?
if [ "$res" -eq 0 ] ; then
echo "TEST SUCCESS"
exit 0
else
echo "TEST FAILED... RETRYING"
fi
sleep $(( attempt_num++ ))

done
}
retry 3

0 comments on commit 987f853

Please sign in to comment.