Skip to content

Commit

Permalink
Merge pull request #159 from BoostryJP/loop-test
Browse files Browse the repository at this point in the history
Add load module for payload timeout verification
  • Loading branch information
YoshihitoAso authored Mar 15, 2024
2 parents 11faff4 + e3529ce commit 39fb79a
Show file tree
Hide file tree
Showing 13 changed files with 130 additions and 14 deletions.
2 changes: 1 addition & 1 deletion ibet-for-fin-network/general/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN apk add --no-cache make gcc musl-dev linux-headers git

RUN git clone https://github.com/BoostryJP/quorum.git && \
cd quorum/ && \
git checkout v2.3.0_beta1
git checkout v2.3.0_beta2
RUN cd quorum/ && \
make geth bootnode && \
mv build/bin/geth /usr/local/bin && \
Expand Down
2 changes: 1 addition & 1 deletion ibet-for-fin-network/validator/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN apk add --no-cache make gcc musl-dev linux-headers git

RUN git clone https://github.com/BoostryJP/quorum.git && \
cd quorum/ && \
git checkout v2.3.0_beta1
git checkout v2.3.0_beta2
RUN cd quorum/ && \
make geth bootnode && \
mv build/bin/geth /usr/local/bin && \
Expand Down
2 changes: 1 addition & 1 deletion ibet-network/general/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN apk add --no-cache make gcc musl-dev linux-headers git

RUN git clone https://github.com/BoostryJP/quorum.git && \
cd quorum/ && \
git checkout v2.3.0_beta1
git checkout v2.3.0_beta2
RUN cd quorum/ && \
make geth bootnode && \
mv build/bin/geth /usr/local/bin && \
Expand Down
2 changes: 1 addition & 1 deletion ibet-network/validator/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN apk add --no-cache make gcc musl-dev linux-headers git

RUN git clone https://github.com/BoostryJP/quorum.git && \
cd quorum/ && \
git checkout v2.3.0_beta1
git checkout v2.3.0_beta2
RUN cd quorum/ && \
make geth bootnode && \
mv build/bin/geth /usr/local/bin && \
Expand Down
10 changes: 5 additions & 5 deletions local-network/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3'
services:
validator-0:
hostname: validator-0
image: ghcr.io/boostryjp/ibet-localnet/validator:v2.3.0_beta1
image: ghcr.io/boostryjp/ibet-localnet/validator:v2.3.0_beta2
volumes:
- /home/ubuntu/quorum_data/v0:/eth
environment:
Expand All @@ -24,7 +24,7 @@ services:
restart: always
validator-1:
hostname: validator-1
image: ghcr.io/boostryjp/ibet-localnet/validator:v2.3.0_beta1
image: ghcr.io/boostryjp/ibet-localnet/validator:v2.3.0_beta2
volumes:
- /home/ubuntu/quorum_data/v1:/eth
environment:
Expand All @@ -46,7 +46,7 @@ services:
restart: always
validator-2:
hostname: validator-2
image: ghcr.io/boostryjp/ibet-localnet/validator:v2.3.0_beta1
image: ghcr.io/boostryjp/ibet-localnet/validator:v2.3.0_beta2
volumes:
- /home/ubuntu/quorum_data/v2:/eth
environment:
Expand All @@ -68,7 +68,7 @@ services:
restart: always
validator-3:
hostname: validator-3
image: ghcr.io/boostryjp/ibet-localnet/validator:v2.3.0_beta1
image: ghcr.io/boostryjp/ibet-localnet/validator:v2.3.0_beta2
volumes:
- /home/ubuntu/quorum_data/v3:/eth
environment:
Expand All @@ -90,7 +90,7 @@ services:
restart: always
general-0:
hostname: general-0
image: ghcr.io/boostryjp/ibet-localnet/general:v2.3.0_beta1
image: ghcr.io/boostryjp/ibet-localnet/general:v2.3.0_beta2
volumes:
- /home/ubuntu/quorum_data/g0:/eth
environment:
Expand Down
2 changes: 1 addition & 1 deletion local-network/general/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN apk add --no-cache make gcc musl-dev linux-headers git

RUN git clone https://github.com/BoostryJP/quorum.git && \
cd quorum/ && \
git checkout v2.3.0_beta1
git checkout v2.3.0_beta2
RUN cd quorum/ && \
make geth bootnode && \
mv build/bin/geth /usr/local/bin && \
Expand Down
2 changes: 1 addition & 1 deletion local-network/validator/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN apk add --no-cache make gcc musl-dev linux-headers git

RUN git clone https://github.com/BoostryJP/quorum.git && \
cd quorum/ && \
git checkout v2.3.0_beta1
git checkout v2.3.0_beta2
RUN cd quorum/ && \
make geth bootnode && \
mv build/bin/geth /usr/local/bin && \
Expand Down
2 changes: 1 addition & 1 deletion test-network/general/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN apk add --no-cache make gcc musl-dev linux-headers git

RUN git clone https://github.com/BoostryJP/quorum.git && \
cd quorum/ && \
git checkout v2.3.0_beta1
git checkout v2.3.0_beta2
RUN cd quorum/ && \
make geth bootnode && \
mv build/bin/geth /usr/local/bin && \
Expand Down
2 changes: 1 addition & 1 deletion test-network/validator/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN apk add --no-cache make gcc musl-dev linux-headers git

RUN git clone https://github.com/BoostryJP/quorum.git && \
cd quorum/ && \
git checkout v2.3.0_beta1
git checkout v2.3.0_beta2
RUN cd quorum/ && \
make geth bootnode && \
mv build/bin/geth /usr/local/bin && \
Expand Down
2 changes: 1 addition & 1 deletion tests/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# Used common
ZERO_ADDRESS = "0x0000000000000000000000000000000000000000"
CONTRACT_PATH = f"{os.path.dirname(__file__)}/contracts"
CONTRACT_NAME = "E2ETest"
CONTRACT_NAME = os.environ.get("CONTRACT_NAME") or "E2ETest"
ACCOUNT_NAME = "test_user"
ACCOUNT_PASSWORD = "password"

Expand Down
31 changes: 31 additions & 0 deletions tests/contracts/Loop.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* Copyright BOOSTRY Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* See the License for the specific language governing permissions and
* limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/

pragma solidity ^0.8.0;

/// @title Loop 10000
contract Loop {

constructor() {}

/// loop 10000
function loop10000() public {
for (uint256 i = 0; i < 10000; i++) {}
}
}
53 changes: 53 additions & 0 deletions tests/loop.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
"""
Copyright BOOSTRY Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
SPDX-License-Identifier: Apache-2.0
"""

import secrets

from eth_utils import keccak, to_checksum_address
from coincurve import PublicKey
from web3 import Web3
from web3.middleware import geth_poa_middleware

from tests.config import WEB3_HTTP_PROVIDER, CHAIN_ID, DEPLOYED_CONTRACT_ADDRESS
from tests.util import ContractUtils

contract = ContractUtils.get_contract(DEPLOYED_CONTRACT_ADDRESS)
web3 = Web3(Web3.HTTPProvider(WEB3_HTTP_PROVIDER))
web3.middleware_onion.inject(geth_poa_middleware, layer=0)
web3.strict_bytes_type_checking = False


for i in range(1000):
private_key = keccak(secrets.token_bytes(32))
public_key = PublicKey.from_valid_secret(private_key).format(compressed=False)[1:]
addr = to_checksum_address(keccak(public_key)[-20:])
nonce = web3.eth.get_transaction_count(addr)
tx = contract.functions.loop10000().build_transaction(
transaction={
"chainId": CHAIN_ID,
"from": addr,
"gas": 100000000,
"gasPrice": 0,
"nonce": nonce
}
)
signed_tx = web3.eth.account.sign_transaction(
transaction_dict=tx, private_key=private_key
)
tx_hash = web3.eth.send_raw_transaction(signed_tx.rawTransaction.hex())
32 changes: 32 additions & 0 deletions tests/loop_deploy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""
Copyright BOOSTRY Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
SPDX-License-Identifier: Apache-2.0
"""

import os
import sys

path = os.path.join(os.path.dirname(__file__), "../")
sys.path.append(path)

from tests.util import ContractUtils

# Deploy
args = []
contract_address, _, _ = ContractUtils.deploy_contract(args)

print(f"DEPLOYED_CONTRACT_ADDRESS={contract_address}")

0 comments on commit 39fb79a

Please sign in to comment.