Skip to content
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

Deterministic testing integration #671

Open
wants to merge 41 commits into
base: release-candidate
Choose a base branch
from

Conversation

NIXBNT
Copy link
Collaborator

@NIXBNT NIXBNT commented May 23, 2024

The deterministic testing is a critical component to the testing infrastructure.
This PR rebases onto the release candidate with some important fixes.
Most critically, an additional logging component has be (re)added into the transaction txt files that are created following a successful transaction

@NIXBNT NIXBNT requested review from barakman and platonfloria May 23, 2024 05:15
Copy link
Collaborator

@barakman barakman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR should not be merged before PR #651 is merged.

"name":"createStrategy",
"stateMutability":"payable",
"inputs":[{"internalType":"Token","name":"token0","type":"address"},{"internalType":"Token","name":"token1","type":"address"},{"components":[{"internalType":"uint128","name":"y","type":"uint128"},{"internalType":"uint128","name":"z","type":"uint128"},{"internalType":"uint64","name":"A","type":"uint64"},{"internalType":"uint64","name":"B","type":"uint64"}],"internalType":"structOrder[2]","name":"orders","type":"tuple[2]"}],
"outputs":[{"internalType":"uint256","name":"","type":"uint256"}]
Copy link
Collaborator

@barakman barakman May 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two contract functions (createStrategy and deleteStrategy) are functions which change the state of the contract (aka write functions).

They are not supposed to ever be used by the bot, even though they can technically be executed in read-only mode (aka static call).

If this is indeed how you're using them, then there is very likely a better way (i.e., calling an actual read function in the same contract).

@@ -358,7 +358,7 @@ def _run(
)
return

tx_hash, tx_receipt = self._handle_trade_instructions(CCm, arb_mode, r, replay_from_block)
tx_hash, tx_receipt, log_dict = self._handle_trade_instructions(CCm, arb_mode, r, replay_from_block)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No changes in this file until PR #651 is merged

@@ -132,9 +133,9 @@ def validate_and_submit_transaction(
self.cfg.logger.info(f"Waiting for transaction {tx_hash} receipt")
tx_receipt = self._wait_for_transaction_receipt(tx_hash)
self.cfg.logger.info(f"Transaction receipt: {dumps(tx_receipt, indent=4)}")
return tx_hash, tx_receipt
return tx_hash, tx_receipt, log_dict
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passing an additional input parameter just in order to return it seems futile.
You can easily determine on the caller function that log_dict is valid if and only if tx_hash and tx_receipt are valid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants