Skip to content
This repository has been archived by the owner on Dec 15, 2023. It is now read-only.

genesis block, create block endpoint, performace optimizations, initial boot optimization, fix 188 #189

Merged
merged 30 commits into from
Aug 4, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
0ec3578
fix(118) warning on zero division with normal response
tabaktoni Jul 21, 2022
3ea96c8
fix: test zero gas price
tabaktoni Jul 21, 2022
22aa29b
fix: replace lstrip with split for rpc method name
tabaktoni Jul 21, 2022
092aee8
Feature: do initialization on package run, this slows down initial st…
tabaktoni Jul 22, 2022
28d52f5
Feature create empty block
tabaktoni Jul 22, 2022
6cf5d47
feature: boot indicator, refactor wrapper async
tabaktoni Jul 22, 2022
17845f0
revert RPC fix
tabaktoni Jul 22, 2022
5ea9bc1
Merge branch 'master' into fix/188-zero-division-gas-price
tabaktoni Jul 22, 2022
9958e44
Fix: validate transaction_receipts exist, exstrast to fun
tabaktoni Jul 25, 2022
c254ea5
FIx: removed async call
tabaktoni Jul 25, 2022
06f2b43
Fix: Lints and Transaction_receipts in empty block instead of None tr…
tabaktoni Jul 25, 2022
3ee69da
Merge branch 'master' into fix/188-zero-division-gas-price
tabaktoni Jul 25, 2022
bcb6f24
Fix: Tests
tabaktoni Jul 25, 2022
a95e31a
Fix: Tests with Genesis block
tabaktoni Jul 27, 2022
34be494
Fix: remove time testing, lint, initialize in server main instead of …
tabaktoni Jul 27, 2022
b8457e5
Merge branch 'master' into fix/188-zero-division-gas-price
tabaktoni Jul 27, 2022
393a28a
Feat: create_block docs and test
tabaktoni Jul 27, 2022
06a9fc6
Fix: test function naming
tabaktoni Jul 27, 2022
935e5f5
fix: cleanup
tabaktoni Aug 2, 2022
e0d7d7f
fix: remove check by timestamp
tabaktoni Aug 2, 2022
5e51da4
feature: added pylint quotes extension
tabaktoni Aug 2, 2022
c6fe2c6
Fix: test enhanced
tabaktoni Aug 2, 2022
7e5943d
fix: post create_block
tabaktoni Aug 2, 2022
909ec2e
fix: tipfeler and quotes
tabaktoni Aug 2, 2022
c2f0fcb
Merge branch 'master' into fix/188-zero-division-gas-price
tabaktoni Aug 2, 2022
199f4dd
cleanup
tabaktoni Aug 2, 2022
1455f70
Merge branch 'master' into fix/188-zero-division-gas-price
tabaktoni Aug 3, 2022
9fcf2d5
Fix: test and clenup
tabaktoni Aug 3, 2022
d78e17e
Merge branch 'master' into fix/188-zero-division-gas-price
tabaktoni Aug 3, 2022
7d95ac2
fix: starknet cleanup after merge, test
tabaktoni Aug 3, 2022
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
9 changes: 7 additions & 2 deletions starknet_devnet/starknet_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,15 +385,20 @@ async def calculate_actual_fee(self, external_tx: InvokeFunction):
)
tabaktoni marked this conversation as resolved.
Show resolved Hide resolved

gas_price = state.state.block_info.gas_price
gas_usage = tx_fee // gas_price
gas_usage = tx_fee // gas_price if gas_price else 0

return {
result = {
"overall_fee": tx_fee,
"unit": "wei",
"gas_price": gas_price,
"gas_usage": gas_usage,
}

if state.state.block_info.block_timestamp == 0:
result["warning"] = "block isn't produced"
tabaktoni marked this conversation as resolved.
Show resolved Hide resolved
FabijanC marked this conversation as resolved.
Show resolved Hide resolved

return result

def increase_block_time(self, time_s: int):
"""Increases the block time by `time_s`."""
self.block_info_generator.increase_time(time_s)
Expand Down
22 changes: 22 additions & 0 deletions test/test_estimate_fee.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,28 @@ def send_estimate_fee_with_requests(req_dict: dict):
json=req_dict
)

@devnet_in_background()
def test_estimate_fee_without_block_zero_gas():
"""Call without transaction, expect pass with gas_price zero"""
response = send_estimate_fee_with_requests({
"entry_point_selector": "0x2f0b3c5710379609eb5495f1ecd348cb28167711b73609fe565a72734550354",
"calldata": [
"1786654640273905855542517570545751199272449814774211541121677632577420730552",
"1000000000000000000000",
"0"
],
"signature": [],
"contract_address": "0x62230ea046a9a5fbc261ac77d03c8d41e5d442db2284587570ab46455fd2488"
})

assert response.status_code == 200
response_parsed = response.json()
assert response_parsed["gas_price"] == 0
assert response_parsed["gas_usage"] == 0
assert response_parsed["overall_fee"] == 0
assert response_parsed["unit"] == "wei"
assert response_parsed["warning"] == "block isn't produced"

@pytest.mark.estimate_fee
@devnet_in_background()
def test_estimate_fee_in_unknown_address():
Expand Down