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

Sign Function Causing Revert in Integration Test #17

Closed
foxytanuki opened this issue Sep 4, 2024 · 1 comment
Closed

Sign Function Causing Revert in Integration Test #17

foxytanuki opened this issue Sep 4, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@foxytanuki
Copy link
Member

foxytanuki commented Sep 4, 2024

Description

The sign function is causing a revert during integration testing. The test for signing fails with an unexpected error, indicating a problem with the contract implementation.

Versions

  • flashbots/suave-geth:v0.2.2
  • go1.22.3 darwin/arm64
  • forge 0.2.0 (5ac78a9 2024-06-02T00:21:13.774292000Z)

Error Details

The test failure occurs in the TestSign/Valid_signing test case with the following error:

Error: Received unexpected error:
error occurred during transaction execution: execution reverted: Signing key not found

Steps to Reproduce

  1. Run Docker and make devnet-up

  2. Switch to the commit 12906d4 on api-integration-check-peace branch.

  3. Run the integration test suite using the following command:

    forge build --via-ir && go test ./src/go/... -count=1
    
  4. Observe the test failure in the TestSign/Valid_signing case.

Additional Information

  • The error suggests that the signing key is not found when attempting to execute the sign function.
  • The test creates an account before attempting to sign, but the signing operation fails.
  • The failure leads to a panic due to a nil pointer dereference, indicating that the test expects a non-nil result from the signing operation.

Possible Causes

  1. The contract's implementation of the sign function may not be correctly handling the case where the signing key is missing.
  2. There might be an issue with how the account is set up or how the signing key is stored/retrieved in the contract.
  3. The test setup may not be correctly initializing the necessary state for signing.

Next Steps

  1. Review the contract's implementation of the sign function, focusing on how it handles missing signing keys.
  2. Verify that the account creation process in the test correctly sets up the necessary state for signing.
  3. Add additional logging or debugging statements in both the contract and the test to identify where exactly the failure occurs.
  4. Consider adding a check in the contract to validate the presence of the signing key before attempting to use it.

Outputs

forge build --via-ir && go test ./src/go/... -count=1
zsh: correct './src/go/...' to './src/go/..' [nyae]? n
[⠊] Compiling...
No files changed, compilation skipped
?   	github.com/mycel-labs/transferable-account/src/go/framework	[no test files]
?   	github.com/mycel-labs/transferable-account/src/go/pb	[no test files]
2024/09/05 08:51:50 warning: TA_STORE_CONTRACT_ADDRESS is not set
2024/09/05 08:51:50 warning: PRIVATE_KEY is not set
2024/09/05 08:51:50 deployed contract at 0xd594760B2A36467ec7F0267382564772D7b0b73c
2024/09/05 08:51:50 transaction hash: 0xd7df141e5ca904e1a0a661a8e611608da2b8e1449581a5659e8fc226640ac073
2024/09/05 08:51:50 transaction hash: 0x2ec099d0274ad95115d8aa4d0045f2c12a93bc4a2f4616bfaa848fa8061c79b2
2024/09/05 08:51:50 transaction hash: 0xd4a6963b7d53f880ae10afbb8525ccd0969c94581c32c915058a9b2d8a39a429
2024/09/05 08:51:50 transaction hash: 0xf79588a250f42f23e7a6d5a4c5c3ac7dab81c0a5f31d23ed68244c73fd889ad5
2024/09/05 08:51:50 transaction hash: 0x0ca5891b09f57806549eff78a4c7acfbdd8991cac111b13dc590f8d565468ab3
2024/09/05 08:51:51 transaction hash: 0xa0ac92b22bdc2e4d534bd836ffc2734aa35e3ff4907a8041afa0f41bb77b40b4
2024/09/05 08:51:51 transaction hash: 0xd664e7fb492708cf2a1cfc07bdcffc69ec6358b1cc871555a7c0a4945aab205d
2024/09/05 08:51:51 transaction hash: 0x768ac8554f585b4336d92a57801b14f98ead357d459468f4b59a7b1e45cd92d6
2024/09/05 08:51:51 transaction hash: 0xc39d7caf572e6471a2f398d222cd9078db7f8de0941f94d02169c68c8a116d8f
2024/09/05 08:51:51 transaction hash: 0x65699b2994e45ef73d51c86b602c45b84749cf7d2d6d88da051ed4170d737b3d
2024/09/05 08:51:51 transaction hash: 0x2207401ef62de7c9d0a2f5b82b1d19ca8ae0215d0e2debfc6dc383d10287b782
2024/09/05 08:51:51 transaction hash: 0x1bf2a1994be431b8cdf1715f29f1f8f562876f55de210e0eaf1e39e6f06fdd61
2024/09/05 08:51:51 transaction hash: 0x9905183699aff975f7af0d78691855cf253a351395c52b98bf349a49136647b5
2024/09/05 08:51:52 transaction hash: 0x81bd1fa3dad5337fb3aecc963a49f81f36017baba03cb39060dc2f4d3935a9e2
2024/09/05 08:51:52 transaction hash: 0x1511d1146aeed04be4166c51183bdee7edbd81b52d604249a3fae5b24cfac551
2024/09/05 08:51:52 transaction hash: 0x503505d0e428ae497f7a658b4bd0fdfb3b8a23b61ee5df06b313f12fc523608a
2024/09/05 08:51:52 transaction hash: 0x5c5a954c8720f0dc9fbf6065f7d5444533d7f4def07d9a2b6442f88be022752b
--- FAIL: TestSign (0.27s)
    server_test.go:598: account: account_id:"0x6847afaa33085e65bd0fdf80a6d1e0a6"  owner:"0xBE69d72ca5f88aCba033a063dF5DBe43a4148De0"  public_key_x:5543637609599159295  public_key_y:17641482234866834874  curve:ECDSA
    --- FAIL: TestSign/Valid_signing (0.00s)
        server_test.go:629:
            	Error Trace:	/Users/foxy/Development/work/mycel-labs/transferable-account/src/go/server_test.go:629
            	Error:      	Received unexpected error:
            	            	error occurred during transaction execution: execution reverted: Signing key not found
            	Test:       	TestSign/Valid_signing
        server_test.go:630:
            	Error Trace:	/Users/foxy/Development/work/mycel-labs/transferable-account/src/go/server_test.go:630
            	Error:      	Expected value not to be nil.
            	Test:       	TestSign/Valid_signing
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x28 pc=0x1052b0ff4]

goroutine 70 [running]:
testing.tRunner.func1.2({0x1056222a0, 0x105e1d490})
	/usr/local/go/src/testing/testing.go:1631 +0x1c4
testing.tRunner.func1()
	/usr/local/go/src/testing/testing.go:1634 +0x33c
panic({0x1056222a0?, 0x105e1d490?})
	/usr/local/go/src/runtime/panic.go:770 +0x124
github.com/mycel-labs/transferable-account/src/go.TestSign.func1(0x1400044a000)
	/Users/foxy/Development/work/mycel-labs/transferable-account/src/go/server_test.go:631 +0x184
testing.tRunner(0x1400044a000, 0x1400045a780)
	/usr/local/go/src/testing/testing.go:1689 +0xec
created by testing.(*T).Run in goroutine 69
	/usr/local/go/src/testing/testing.go:1742 +0x318
FAIL	github.com/mycel-labs/transferable-account/src/go	2.848s
FAIL
@foxytanuki foxytanuki added the bug Something isn't working label Sep 5, 2024
@foxytanuki
Copy link
Member Author

fixed in cf33679 and f130b49

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant