-
Notifications
You must be signed in to change notification settings - Fork 20
Re-enable disabled tests requiring bridge #1083
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
Open
voidash
wants to merge
2
commits into
main
Choose a base branch
from
enable-tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 10 additions & 8 deletions
18
functional-tests/tests/evm/evm_withdraw_indirect_with_contract_balance.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 15 additions & 10 deletions
25
functional-tests/tests/evm/evm_withdraw_indirect_with_msg_sender_value.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,44 @@ | ||
import logging | ||
|
||
import flexitest | ||
|
||
from envs import net_settings, testenv | ||
from envs.rollup_params_cfg import RollupConfig | ||
from mixins.bridge_out_precompile_contract_mixin import BridgePrecompileMixin | ||
from utils import ProverClientSettings, get_priv_keys | ||
from utils.constants import SATS_TO_WEI | ||
|
||
|
||
@flexitest.register | ||
class ContractBridgeOutWithSenderValueTest(BridgePrecompileMixin): | ||
def __init__(self, ctx: flexitest.InitContext): | ||
fast_batch_settings = net_settings.get_fast_batch_settings() | ||
ctx.set_env( | ||
testenv.BasicEnvConfig(pre_generate_blocks=101, rollup_settings=fast_batch_settings) | ||
testenv.BasicEnvConfig( | ||
101, | ||
prover_client_settings=ProverClientSettings.new_with_proving(), | ||
rollup_settings=net_settings.get_fast_batch_settings(), | ||
auto_generate_blocks=True, | ||
) | ||
) | ||
|
||
def main(self, ctx: flexitest.RunContext): | ||
logging.warn("test temporarily disabled") | ||
return | ||
priv_keys = get_priv_keys(ctx) | ||
|
||
# deposit once | ||
self.deposit(ctx, self.bridge_eth_account.address, self.bridge_pk) | ||
# deposit twice | ||
self.deposit(ctx, self.web3.address, priv_keys) | ||
self.deposit(ctx, self.web3.address, priv_keys) | ||
print(self.web3.address) | ||
|
||
cfg: RollupConfig = ctx.env.rollup_cfg() | ||
deposit_amount = cfg.deposit_amount | ||
|
||
# Call the contract function | ||
# TODO: use self.txs.deploy and self.txs.call | ||
contract_instance = self.w3.eth.contract( | ||
# check balance | ||
contract_instance = self.web3.eth.contract( | ||
abi=self.abi, address=self.deployed_contract_receipt.contractAddress | ||
) | ||
tx_hash = contract_instance.functions.withdraw(self.bosd).transact( | ||
{"gas": 5_000_000, "value": deposit_amount * SATS_TO_WEI} | ||
) | ||
|
||
tx_receipt = self.w3.eth.wait_for_transaction_receipt(tx_hash, timeout=30) | ||
tx_receipt = self.web3.eth.wait_for_transaction_receipt(tx_hash, timeout=30) | ||
assert tx_receipt.status == 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
from threading import Thread | ||
from typing import Any, TypeVar | ||
|
||
import base58 | ||
from bitcoinlib.services.bitcoind import BitcoindClient | ||
from strata_utils import convert_to_xonly_pk, musig_aggregate_pks | ||
|
||
|
@@ -652,3 +653,28 @@ def check_initial_eth_balance(rethrpc, address, debug_fn=print): | |
balance = int(rethrpc.eth_getBalance(address), 16) | ||
debug_fn(f"Strata Balance before deposits: {balance}") | ||
assert balance == 0, "Strata balance is not expected (should be zero initially)" | ||
|
||
|
||
def get_priv_keys(ctx, env=None): | ||
if env is None: | ||
path = os.path.join(ctx.datadir_root, f"_{ctx.name}", "_init") | ||
else: | ||
path = os.path.join(ctx.datadir_root, env, "_init") | ||
|
||
print(path) | ||
priv_keys = [] | ||
opkeys = sorted( | ||
filter(lambda file: file.startswith("opkey"), os.listdir(path)), | ||
key=lambda x: int("".join(filter(str.isdigit, x))), | ||
) | ||
print(opkeys) | ||
Comment on lines
+664
to
+670
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are these prints needed? If so then use Edit: oh I see these were from before this PR, it'd be good to convert over the prints in these updated tests |
||
for filename in opkeys: | ||
if not filename.startswith("op"): | ||
continue | ||
|
||
full_path = os.path.join(path, filename) | ||
with open(full_path) as f: | ||
content = f.read().strip() | ||
decoded = base58.b58decode(content)[:-4] # remove checksum | ||
priv_keys.append(decoded) | ||
return priv_keys |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is basically doing a "wait until EVM tx included in block" operation. If there isn't already waiter for this then can we add it to one so it's available everywhere?