lilypad icon indicating copy to clipboard operation
lilypad copied to clipboard

Investigate broken web3 SDK unit tests

Open bgins opened this issue 1 year ago • 4 comments

Our web3 SDK unit tests currently fail with an invalid length, need 256 bits error:

$ go test ./pkg/web3/sdk_test.go
--- FAIL: TestGetBalance (0.35s)
    sdk_test.go:63: Failed to create Web3SDK: invalid length, need 256 bits
--- FAIL: TestGetBlockNumber (0.42s)
    sdk_test.go:76: Failed to create Web3SDK: invalid length, need 256 bits
FAIL
FAIL	command-line-arguments	1.154s
FAIL

Let's investigate why these tests are failing. We may need to update the tests or fixtures, but this could indicate a bug in the code base.

bgins avatar Sep 24 '24 18:09 bgins

Quick check: Possibly related to private key being set. The invalid length, need 256 bits error is from the ECDSA key conversation of the private key.

alvin-reyes avatar Sep 27 '24 00:09 alvin-reyes

We don't have a private key set on the configuration so we need to inject this on the github action.

alvin-reyes avatar Sep 27 '24 00:09 alvin-reyes

I confirm what @alvin-reyes said. I also ran it locally and managed to run it with a private key: ❯ go test ./web3/sdk_test.go ok command-line-arguments 1.884s

@bgins, where exactly does this test run, is it a github action?

Rodebrechtd avatar Oct 06 '24 07:10 Rodebrechtd

I confirm what @alvin-reyes said. I also ran it locally and managed to run it with a private key: ❯ go test ./web3/sdk_test.go ok command-line-arguments 1.884s

@bgins, where exactly does this test run, is it a github action?

At the moment, we are only running the web3 tests in CI.

https://github.com/Lilypad-Tech/lilypad/blob/90a248d4ad12d5f49d6518917537f45db989674f/.github/workflows/test.yml#L23 https://github.com/Lilypad-Tech/lilypad/blob/90a248d4ad12d5f49d6518917537f45db989674f/stack#L337-L340

We should run the Go unit tests there as well once we fix any broken tests.

For the moment, we can run these tests from the root of the project with go test ./pkg/web3/sdk_test.go.

bgins avatar Oct 08 '24 21:10 bgins