Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into elmato/store-overhead…
Browse files Browse the repository at this point in the history
…-storage-price
  • Loading branch information
elmato committed Aug 16, 2024
2 parents 6ed4c13 + b732367 commit b5669f1
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 96 deletions.
8 changes: 2 additions & 6 deletions .cicd/defaults.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{
"leap-dev":{
"target":"5",
"prerelease":false
},
"leap":{
"target":"5",
"antelope-spring-dev":{
"target":"main",
"prerelease":false
},
"cdt":{
Expand Down
111 changes: 41 additions & 70 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,6 @@ on:
pull_request:
workflow_dispatch:
inputs:
override-leap-dev:
description: Override leap-dev target
type: string
override-leap-dev-prerelease:
type: choice
description: Override leap-dev prelease
options:
- default
- true
- false
override-leap:
description: Override leap target
type: string
override-leap-prerelease:
type: choice
description: Override leap prelease
options:
- default
- true
- false
override-cdt:
description: 'Override cdt target'
type: string
Expand Down Expand Up @@ -153,10 +133,8 @@ jobs:
name: Determine Versions
runs-on: ubuntu-latest
outputs:
leap-dev-target: ${{steps.versions.outputs.leap-dev-target}}
leap-dev-prerelease: ${{steps.versions.outputs.leap-dev-prerelease}}
leap-target: ${{steps.versions.outputs.leap-target}}
leap-prerelease: ${{steps.versions.outputs.leap-prerelease}}
antelope-spring-dev-target: ${{steps.versions.outputs.antelope-spring-dev-target}}
antelope-spring-dev-prerelease: ${{steps.versions.outputs.antelope-spring-dev-prerelease}}
cdt-target: ${{steps.versions.outputs.cdt-target}}
cdt-prerelease: ${{steps.versions.outputs.cdt-prerelease}}
eos-evm-contract-target: ${{steps.versions.outputs.eos-evm-contract-target}}
Expand All @@ -169,28 +147,14 @@ jobs:
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
DEFAULTS_JSON=$(curl -sSfL $(gh api https://api.github.com/repos/${{github.repository}}/contents/.cicd/defaults.json?ref=${{github.sha}} --jq .download_url))
echo leap-dev-target=$(echo "$DEFAULTS_JSON" | jq -r '."leap-dev".target') >> $GITHUB_OUTPUT
echo leap-dev-prerelease=$(echo "$DEFAULTS_JSON" | jq -r '."leap-dev".prerelease') >> $GITHUB_OUTPUT
echo leap-target=$(echo "$DEFAULTS_JSON" | jq -r '."leap".target') >> $GITHUB_OUTPUT
echo leap-prerelease=$(echo "$DEFAULTS_JSON" | jq -r '."leap".prerelease') >> $GITHUB_OUTPUT
echo antelope-spring-dev-target=$(echo "$DEFAULTS_JSON" | jq -r '."antelope-spring-dev".target') >> $GITHUB_OUTPUT
echo antelope-spring-dev-prerelease=$(echo "$DEFAULTS_JSON" | jq -r '."antelope-spring-dev".prerelease') >> $GITHUB_OUTPUT
echo cdt-target=$(echo "$DEFAULTS_JSON" | jq -r '."cdt".target') >> $GITHUB_OUTPUT
echo cdt-prerelease=$(echo "$DEFAULTS_JSON" | jq -r '."cdt".prerelease') >> $GITHUB_OUTPUT
echo eos-evm-contract-target=$(echo "$DEFAULTS_JSON" | jq -r '."eos-evm-contract".target') >> $GITHUB_OUTPUT
echo eos-evm-contract-prerelease=$(echo "$DEFAULTS_JSON" | jq -r '."eos-evm-contract".prerelease') >> $GITHUB_OUTPUT
echo eos-evm-miner-target=$(echo "$DEFAULTS_JSON" | jq -r '."eos-evm-miner".target') >> $GITHUB_OUTPUT
if [[ "${{inputs.override-leap-dev}}" != "" ]]; then
echo leap-dev-target=${{inputs.override-leap-dev}} >> $GITHUB_OUTPUT
fi
if [[ "${{inputs.override-leap-dev-prerelease}}" == +(true|false) ]]; then
echo leap-dev-prerelease=${{inputs.override-leap-dev-prerelease}} >> $GITHUB_OUTPUT
fi
if [[ "${{inputs.override-leap}}" != "" ]]; then
echo leap-target=${{inputs.override-leap}} >> $GITHUB_OUTPUT
fi
if [[ "${{inputs.override-leap-prerelease}}" == +(true|false) ]]; then
echo leap-prerelease=${{inputs.override-leap-prerelease}} >> $GITHUB_OUTPUT
fi
if [[ "${{inputs.override-cdt}}" != "" ]]; then
echo cdt-target=${{inputs.override-cdt}} >> $GITHUB_OUTPUT
fi
Expand Down Expand Up @@ -230,48 +194,55 @@ jobs:
apt update
apt upgrade -y
- name: Download CDT
- name: Download cdt
uses: AntelopeIO/asset-artifact-download-action@v3
with:
owner: AntelopeIO
repo: cdt
file: 'cdt_.*amd64.deb'
target: '${{needs.versions.outputs.cdt-target}}'
prereleases: ${{fromJSON(needs.versions.outputs.cdt-prerelease)}}
file: 'cdt_.*amd64.deb'
token: ${{ secrets.GITHUB_TOKEN }}

- name: Install CDT
run: apt-get install -y ./cdt*.deb
artifact-name: cdt_ubuntu_package_amd64

- name: Download leap-dev binary
- name: Download antelope-spring-dev
uses: AntelopeIO/asset-artifact-download-action@v3
with:
owner: AntelopeIO
repo: leap
target: '${{needs.versions.outputs.leap-dev-target}}'
prereleases: ${{fromJSON(needs.versions.outputs.leap-dev-prerelease)}}
file: 'leap-dev.*ubuntu22\.04_amd64.deb'
container-package: experimental-binaries
artifact-name: leap-dev-ubuntu22-amd64
token: ${{ secrets.GITHUB_TOKEN }}

- name: Download leap binary
repo: spring
file: 'antelope-spring-dev.*ubuntu22\.04_amd64.deb'
target: '${{needs.versions.outputs.antelope-spring-dev-target}}'
prereleases: ${{fromJSON(needs.versions.outputs.antelope-spring-dev-prerelease)}}
artifact-name: antelope-spring-dev-ubuntu22-amd64
container-package: antelope-spring-experimental-binaries

- name: Download antelope-spring binary
uses: AntelopeIO/asset-artifact-download-action@v3
with:
owner: AntelopeIO
repo: leap
target: '${{needs.versions.outputs.leap-target}}'
prereleases: ${{fromJSON(needs.versions.outputs.leap-prerelease)}}
file: 'leap_.*_amd64.deb'
artifact-name: leap-deb-amd64
token: ${{ secrets.GITHUB_TOKEN }}
repo: spring
file: 'antelope-spring_.*_amd64.deb'
target: '${{needs.versions.outputs.antelope-spring-dev-target}}'
prereleases: ${{fromJSON(needs.versions.outputs.antelope-spring-dev-prerelease)}}
artifact-name: antelope-spring-deb-amd64

- name: Install Leap
- name: Install packages
run: |
apt-get install -y ./leap*.deb
- name: Link Leap TestHarness Module (fix for v4 of leap)
run: ln -s /usr/share/leap_testing/tests/TestHarness /usr/lib/python3/dist-packages/TestHarness
apt-get update && apt-get upgrade -y
apt install -y ./*.deb
apt-get install -y cmake
rm ./*.deb
echo "=== after install packages ==="
ls -ltr /usr
ls -ltr /usr/bin/
ls -ltr /usr/lib/
ls -ltr /usr/share/
echo "=== files in /usr/share/spring_testing ==="
ls -ltr /usr/share/spring_testing/
echo "=== files in /usr/share/spring_testing/bin ==="
ls -ltr /usr/share/spring_testing/bin/
- name: Link Spring TestHarness Module
run: ln -s /usr/share/spring_testing/tests/TestHarness /usr/lib/python3/dist-packages/TestHarness

- name: Download EOS EVM Contract
uses: AntelopeIO/asset-artifact-download-action@v3
Expand Down Expand Up @@ -437,11 +408,11 @@ jobs:
- name: Prepare Logs
if: failure()
run: |
tar -czf leap-int-test-logs.tar.gz test_run_root/* ws_test_run_root/*
tar -czf sprint-int-test-logs.tar.gz test_run_root/* ws_test_run_root/*
- name: Upload logs from failed tests
uses: actions/upload-artifact@v3
if: failure()
with:
name: leap-int-test-logs.tar.gz
path: leap-int-test-logs.tar.gz
name: spring-int-test-logs.tar.gz
path: spring-int-test-logs.tar.gz
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ include(cmake/conan.cmake)
set(VERSION_MAJOR 1)
set(VERSION_MINOR 0)
set(VERSION_PATCH 0)
set(VERSION_SUFFIX rc4)
#set(VERSION_SUFFIX rc4)

if(VERSION_SUFFIX)
set(VERSION_FULL "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}-${VERSION_SUFFIX}")
Expand Down
2 changes: 1 addition & 1 deletion src/rpc_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void rpc_plugin::set_program_options( appbase::options_description& cli, appbase
"maximum number of rpc readers")
("api-spec", boost::program_options::value<std::string>()->default_value("eth"),
"comma separated api spec, possible values: debug,engine,eth,net,parity,erigon,txpool,trace,web3")
("chain-id", boost::program_options::value<uint32_t>()->default_value(silkworm::kEOSEVMLocalTestnetConfig.chain_id),
("chain-id", boost::program_options::value<uint32_t>()->default_value(25555),
"override chain-id")
("rpc-quirk-flag", boost::program_options::value<uint64_t>()->default_value(0),
"rpc quirk flag")
Expand Down
42 changes: 24 additions & 18 deletions tests/nodeos_eos_evm_different_token_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@
evmRPCPOpen = None
eosEvmMinerPOpen = None

def get_raw_transaction(signed_trx):
if hasattr(signed_trx, 'raw_transaction'):
return signed_trx.raw_transaction
else:
return signed_trx.rawTransaction

def interact_with_storage_contract(dest, nonce):
for i in range(1, 5): # execute a few
Utils.Print("Execute ETH contract")
Expand All @@ -111,7 +117,7 @@ def interact_with_storage_contract(dest, nonce):
chainId=evmChainId
), evmSendKey)

actData = {"miner":minerAcc.name, "rlptx":Web3.to_hex(signed_trx.rawTransaction)[2:]}
actData = {"miner":minerAcc.name, "rlptx":Web3.to_hex(get_raw_transaction(signed_trx))[2:]}
retValue = prodNode.pushMessage(evmAcc.name, "pushtx", json.dumps(actData), '-p {0}'.format(minerAcc.name))
assert retValue[0], "pushtx to ETH contract failed."
Utils.Print("\tBlock#", retValue[1]["processed"]["block_num"])
Expand Down Expand Up @@ -383,7 +389,7 @@ def getAccountGasBalance(node, account):
cmd="set account permission " + defertest2Acc.name + " active --add-code -p " + defertest2Acc.name + "@active"
prodNode.processCleosCmd(cmd, cmd, silentErrors=False, returnType=ReturnType.raw)

trans = prodNode.pushMessage(evmAcc.name, "init", "{\"chainid\":15555, \"token_contract\":\"gasgasgasgas\", \"fee_params\": {\"gas_price\": \"10000000000\", \"miner_cut\": 10000, \"ingress_bridge_fee\": \"0.00000000 GAS\"}}", '-p eosio.evm')
trans = prodNode.pushMessage(evmAcc.name, "init", "{\"chainid\":18888, \"token_contract\":\"gasgasgasgas\", \"fee_params\": {\"gas_price\": \"10000000000\", \"miner_cut\": 10000, \"ingress_bridge_fee\": \"0.00000000 GAS\"}}", '-p eosio.evm')

prodNode.waitForTransBlockIfNeeded(trans[1], True)
transId=prodNode.getTransId(trans[1])
Expand All @@ -398,7 +404,7 @@ def getAccountGasBalance(node, account):
},
"coinbase": "0x0000000000000000000000000000000000000000",
"config": {
"chainId": 15555,
"chainId": 18888,
"homesteadBlock": 0,
"eip150Block": 0,
"eip155Block": 0,
Expand Down Expand Up @@ -455,7 +461,7 @@ def getAccountGasBalance(node, account):
if not (i+1) % 20: time.sleep(1)

Utils.Print("Send balance")
evmChainId = 15555
evmChainId = 18888
fromAdd = "f39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
toAdd = '0x9edf022004846bc987799d552d1b8485b317b7ed'
amount = 100
Expand All @@ -473,7 +479,7 @@ def getAccountGasBalance(node, account):
chainId=evmChainId
), evmSendKey)

actData = {"miner":minerAcc.name, "rlptx":Web3.to_hex(signed_trx.rawTransaction)[2:]}
actData = {"miner":minerAcc.name, "rlptx":Web3.to_hex(get_raw_transaction(signed_trx))[2:]}
trans = prodNode.pushMessage(evmAcc.name, "pushtx", json.dumps(actData), '-p {0}'.format(minerAcc.name))
prodNode.waitForTransBlockIfNeeded(trans[1], True)

Expand All @@ -499,7 +505,7 @@ def getAccountGasBalance(node, account):
chainId=evmChainId
), evmSendKey)

actData = {"miner":minerAcc.name, "rlptx":Web3.to_hex(signed_trx.rawTransaction)[2:]}
actData = {"miner":minerAcc.name, "rlptx":Web3.to_hex(get_raw_transaction(signed_trx))[2:]}
Utils.Print("Send balance again, with correct nonce")
retValue = prodNode.pushMessage(evmAcc.name, "pushtx", json.dumps(actData), '-p {0}'.format(minerAcc.name), silentErrors=True)
assert retValue[0], f"push trx should have succeeded: {retValue}"
Expand All @@ -518,14 +524,14 @@ def getAccountGasBalance(node, account):
chainId=evmChainId
), evmSendKey)

actData = {"miner":minerAcc.name, "rlptx":Web3.to_hex(signed_trx.rawTransaction)[2:]}
actData = {"miner":minerAcc.name, "rlptx":Web3.to_hex(get_raw_transaction(signed_trx))[2:]}
Utils.Print("Send balance again, with invalid chainid")
retValue = prodNode.pushMessage(evmAcc.name, "pushtx", json.dumps(actData), '-p {0}'.format(minerAcc.name), silentErrors=True)
assert not retValue[0], f"push trx should have failed: {retValue}"

# correct values for continuing
nonce -= 1
evmChainId = 15555
evmChainId = 18888

Utils.Print("Simple Solidity contract")
# // SPDX-License-Identifier: GPL-3.0
Expand All @@ -540,7 +546,7 @@ def getAccountGasBalance(node, account):
# }
# }
nonce += 1
evmChainId = 15555
evmChainId = 18888
gasP = getGasPrice()
signed_trx = w3.eth.account.sign_transaction(dict(
nonce=nonce,
Expand All @@ -550,7 +556,7 @@ def getAccountGasBalance(node, account):
chainId=evmChainId
), evmSendKey)

actData = {"miner":minerAcc.name, "rlptx":Web3.to_hex(signed_trx.rawTransaction)[2:]}
actData = {"miner":minerAcc.name, "rlptx":Web3.to_hex(get_raw_transaction(signed_trx))[2:]}
retValue = prodNode.pushMessage(evmAcc.name, "pushtx", json.dumps(actData), '-p {0}'.format(minerAcc.name))
assert retValue[0], f"push trx should have succeeded: {retValue}"
nonce = interact_with_storage_contract(makeContractAddress(fromAdd, nonce), nonce)
Expand Down Expand Up @@ -675,7 +681,7 @@ def getAccountGasBalance(node, account):
data=b'',
chainId=evmChainId
), evmSendKey)
actData = {"miner":minerAcc.name, "rlptx":Web3.to_hex(signed_trx.rawTransaction)[2:]}
actData = {"miner":minerAcc.name, "rlptx":Web3.to_hex(get_raw_transaction(signed_trx))[2:]}
trans = prodNode.pushMessage(evmAcc.name, "pushtx", json.dumps(actData), '-p {0}'.format(minerAcc.name), silentErrors=True)
prodNode.waitForTransBlockIfNeeded(trans[1], True)
row4=prodNode.getTableRow(evmAcc.name, evmAcc.name, "account", 4) # 4th balance of this integration test
Expand Down Expand Up @@ -708,7 +714,7 @@ def getAccountGasBalance(node, account):
data=b'',
chainId=evmChainId
), evmSendKey)
actData = {"miner":minerAcc.name, "rlptx":Web3.to_hex(signed_trx.rawTransaction)[2:]}
actData = {"miner":minerAcc.name, "rlptx":Web3.to_hex(get_raw_transaction(signed_trx))[2:]}
trans = prodNode.pushMessage(evmAcc.name, "pushtx", json.dumps(actData), '-p {0}'.format(minerAcc.name), silentErrors=True)
prodNode.waitForTransBlockIfNeeded(trans[1], True)
row4=prodNode.getTableRow(evmAcc.name, evmAcc.name, "account", 4) # 4th balance of this integration test
Expand Down Expand Up @@ -757,12 +763,12 @@ def getAccountGasBalance(node, account):
gas=1000000,
gasPrice=getGasPrice(),
data=Web3.to_bytes(hexstr='608060405234801561001057600080fd5b50610284806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80630a79309b1461003b578063d09de08a1461006b575b600080fd5b61005560048036038101906100509190610176565b610075565b60405161006291906101bc565b60405180910390f35b6100736100bd565b005b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919061010c90610206565b9190505550565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061014382610118565b9050919050565b61015381610138565b811461015e57600080fd5b50565b6000813590506101708161014a565b92915050565b60006020828403121561018c5761018b610113565b5b600061019a84828501610161565b91505092915050565b6000819050919050565b6101b6816101a3565b82525050565b60006020820190506101d160008301846101ad565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610211826101a3565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610243576102426101d7565b5b60018201905091905056fea264697066735822122026d27f46966ee75c7a8b2a43923c8796438013de730eb9eec6c24ff581913d6864736f6c63430008120033'),
chainId=15555
chainId=18888
), accSpecialKey)

# Deploy "Increment" contract
increment_contract = makeContractAddress(accSpecialAdd, special_nonce)
actData = {"miner":minerAcc.name, "rlptx":Web3.to_hex(signed_trx.rawTransaction)[2:]}
actData = {"miner":minerAcc.name, "rlptx":Web3.to_hex(get_raw_transaction(signed_trx))[2:]}
trans = prodNode.pushMessage(evmAcc.name, "pushtx", json.dumps(actData), '-p {0}'.format(minerAcc.name), silentErrors=True)
prodNode.waitForTransBlockIfNeeded(trans[1], True);

Expand All @@ -774,10 +780,10 @@ def getAccountGasBalance(node, account):
gasPrice=getGasPrice(),
to=Web3.to_checksum_address(increment_contract),
data=Web3.to_bytes(hexstr='D09DE08A'), # sha3(increment())=0xD09DE08A
chainId=15555
chainId=18888
), accSpecialKey)

actData = {"miner":minerAcc.name, "rlptx":Web3.to_hex(signed_trx.rawTransaction)[2:]}
actData = {"miner":minerAcc.name, "rlptx":Web3.to_hex(get_raw_transaction(signed_trx))[2:]}
trans = prodNode.pushMessage(evmAcc.name, "pushtx", json.dumps(actData), '-p {0}'.format(minerAcc.name), silentErrors=False)
prodNode.waitForTransBlockIfNeeded(trans[1], True);

Expand Down Expand Up @@ -835,7 +841,7 @@ def getAccountGasBalance(node, account):
data=b'',
chainId=evmChainId
), evmSendKey)
actData = {"recipient":defertestAcc.name, "account":evmAcc.name, "miner":minerAcc.name, "rlptx":Web3.to_hex(signed_trx.rawTransaction)[2:], "rlptx2":Web3.to_hex(signed_trx2.rawTransaction)[2:]}
actData = {"recipient":defertestAcc.name, "account":evmAcc.name, "miner":minerAcc.name, "rlptx":Web3.to_hex(get_raw_transaction(signed_trx))[2:], "rlptx2":Web3.to_hex(get_raw_transaction(signed_trx2))[2:]}
trans = prodNode.pushMessage(defertest2Acc.name, "notifytest", json.dumps(actData), '-p {0}'.format(defertest2Acc.name), silentErrors=False)
prodNode.waitForTransBlockIfNeeded(trans[1], True)
row4=prodNode.getTableRow(evmAcc.name, evmAcc.name, "account", 4) # 4th balance of this integration test
Expand Down Expand Up @@ -971,7 +977,7 @@ def get_block(num):
data=b'',
chainId=evmChainId
), evmSendKey)
actData = {"miner":minerAcc.name, "rlptx":Web3.to_hex(signed_trx.rawTransaction)[2:]}
actData = {"miner":minerAcc.name, "rlptx":Web3.to_hex(get_raw_transaction(signed_trx))[2:]}
trans = prodNode.pushMessage(evmAcc.name, "pushtx", json.dumps(actData), '-p {0}'.format(minerAcc.name), silentErrors=False)
prodNode.waitForTransBlockIfNeeded(trans[1], True)
row4=prodNode.getTableRow(evmAcc.name, evmAcc.name, "account", 4) # 4th balance of this integration test
Expand Down
Loading

0 comments on commit b5669f1

Please sign in to comment.