Skip to content

Implement multisig timelock test#17

Merged
FuzzysTodd merged 1 commit into
SAfrom
FuzzysTodd-patch-7
Nov 12, 2025
Merged

Implement multisig timelock test#17
FuzzysTodd merged 1 commit into
SAfrom
FuzzysTodd-patch-7

Conversation

@FuzzysTodd

Copy link
Copy Markdown
Owner

Add a test for multisig timelock enforcement in transactions.

Add a test for multisig timelock enforcement in transactions.
Copilot AI review requested due to automatic review settings November 12, 2025 00:34
@FuzzysTodd FuzzysTodd merged commit 3fb4165 into SA Nov 12, 2025
2 of 4 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements a test case for multisig timelock enforcement, validating that transactions cannot be executed before the timelock period expires and can be successfully executed afterward.

Key Changes:

  • Added test_multisig_timelock_enforced() function to verify timelock behavior
  • Test proposes a transaction with a 0.001 hour (3.6 second) timelock, verifies execution is blocked before expiry, and succeeds after waiting

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test.py
assert False, "timelock should block execution"
except Exception as e:
assert "timelock" in str(e).lower()
time.sleep(4)

Copilot AI Nov 12, 2025

Copy link

Choose a reason for hiding this comment

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

The hard-coded sleep duration of 4 seconds creates a magic number. Consider calculating this value based on the timelock_hours parameter (0.001 hours = 3.6 seconds) with a small buffer, e.g., time.sleep(0.001 * 3600 + 0.5), to make the relationship explicit and the test more maintainable.

Copilot uses AI. Check for mistakes.
Comment thread test.py
Comment on lines +4 to +6
def test_multisig_timelock_enforced():
s = {"vault": {"ETH":10,"USDC":0}, "spokes": {}, "pending": [], "keys": ["K1","K2","K3"]}
propose_tx(s, {"type":"fund_spoke","spoke":"PaymentScheduler","asset":"ETH","amount":5.0}, timelock_hours=0.001)

Copilot AI Nov 12, 2025

Copy link

Choose a reason for hiding this comment

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

The timelock value of 0.001 hours is a magic number that's difficult to interpret. Consider defining it as a named constant like TIMELOCK_HOURS = 0.001 with a comment explaining it equals 3.6 seconds, improving test readability.

Suggested change
def test_multisig_timelock_enforced():
s = {"vault": {"ETH":10,"USDC":0}, "spokes": {}, "pending": [], "keys": ["K1","K2","K3"]}
propose_tx(s, {"type":"fund_spoke","spoke":"PaymentScheduler","asset":"ETH","amount":5.0}, timelock_hours=0.001)
# Timelock duration for test: 0.001 hours = 3.6 seconds
TIMELOCK_HOURS = 0.001
def test_multisig_timelock_enforced():
s = {"vault": {"ETH":10,"USDC":0}, "spokes": {}, "pending": [], "keys": ["K1","K2","K3"]}
propose_tx(s, {"type":"fund_spoke","spoke":"PaymentScheduler","asset":"ETH","amount":5.0}, timelock_hours=TIMELOCK_HOURS)

Copilot uses AI. Check for mistakes.
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.

2 participants