Skip to content

Commit

Permalink
merged with develop
Browse files Browse the repository at this point in the history
  • Loading branch information
silaslenihan committed Dec 13, 2024
1 parent 1d74e41 commit 9cac594
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 19 deletions.
92 changes: 92 additions & 0 deletions gotest.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
📦 github.com/smartcontractkit/chainlink-solana/pkg/solana/chainwriter
exit status 1
❌ TestLookupTables (30.04s)
ports.go:37: found open port: 41544
ports.go:37: found open port: 39418
utils.go:215: API server not ready yet (attempt 1)
utils.go:215: Error from API server: rpc call getHealth() on http://127.0.0.1:41544: Post "http://127.0.0.1:41544": dial tcp 127.0.0.1:41544: connect: connection refused
utils.go:215: API server not ready yet (attempt 2)
utils.go:215: Error from API server: rpc call getHealth() on http://127.0.0.1:41544: Post "http://127.0.0.1:41544": dial tcp 127.0.0.1:41544: connect: connection refused
utils.go:215: API server not ready yet (attempt 3)
utils.go:215: Error from API server: rpc call getHealth() on http://127.0.0.1:41544: Post "http://127.0.0.1:41544": dial tcp 127.0.0.1:41544: connect: connection refused
utils.go:215: API server not ready yet (attempt 4)
utils.go:215: Error from API server: rpc call getHealth() on http://127.0.0.1:41544: Post "http://127.0.0.1:41544": dial tcp 127.0.0.1:41544: connect: connection refused
utils.go:215: API server not ready yet (attempt 5)
utils.go:215: Error from API server: rpc call getHealth() on http://127.0.0.1:41544: Post "http://127.0.0.1:41544": dial tcp 127.0.0.1:41544: connect: connection refused
utils.go:215: API server not ready yet (attempt 6)
utils.go:215: Error from API server: rpc call getHealth() on http://127.0.0.1:41544: Post "http://127.0.0.1:41544": dial tcp 127.0.0.1:41544: connect: connection refused
utils.go:215: API server not ready yet (attempt 7)
utils.go:215: Error from API server: rpc call getHealth() on http://127.0.0.1:41544: Post "http://127.0.0.1:41544": dial tcp 127.0.0.1:41544: connect: connection refused
utils.go:215: API server not ready yet (attempt 8)
utils.go:215: Error from API server: rpc call getHealth() on http://127.0.0.1:41544: Post "http://127.0.0.1:41544": dial tcp 127.0.0.1:41544: connect: connection refused
utils.go:215: API server not ready yet (attempt 9)
utils.go:215: Error from API server: rpc call getHealth() on http://127.0.0.1:41544: Post "http://127.0.0.1:41544": dial tcp 127.0.0.1:41544: connect: connection refused
utils.go:215: API server not ready yet (attempt 10)
utils.go:215: Error from API server: rpc call getHealth() on http://127.0.0.1:41544: Post "http://127.0.0.1:41544": dial tcp 127.0.0.1:41544: connect: connection refused
utils.go:215: API server not ready yet (attempt 11)
utils.go:215: Error from API server: rpc call getHealth() on http://127.0.0.1:41544: Post "http://127.0.0.1:41544": dial tcp 127.0.0.1:41544: connect: connection refused
utils.go:215: API server not ready yet (attempt 12)
utils.go:215: Error from API server: rpc call getHealth() on http://127.0.0.1:41544: Post "http://127.0.0.1:41544": dial tcp 127.0.0.1:41544: connect: connection refused
utils.go:215: API server not ready yet (attempt 13)
utils.go:215: Error from API server: rpc call getHealth() on http://127.0.0.1:41544: Post "http://127.0.0.1:41544": dial tcp 127.0.0.1:41544: connect: connection refused
utils.go:215: API server not ready yet (attempt 14)
utils.go:215: Error from API server: rpc call getHealth() on http://127.0.0.1:41544: Post "http://127.0.0.1:41544": dial tcp 127.0.0.1:41544: connect: connection refused
utils.go:215: API server not ready yet (attempt 15)
utils.go:215: Error from API server: rpc call getHealth() on http://127.0.0.1:41544: Post "http://127.0.0.1:41544": dial tcp 127.0.0.1:41544: connect: connection refused
utils.go:215: API server not ready yet (attempt 16)
utils.go:215: Error from API server: rpc call getHealth() on http://127.0.0.1:41544: Post "http://127.0.0.1:41544": dial tcp 127.0.0.1:41544: connect: connection refused
utils.go:215: API server not ready yet (attempt 17)
utils.go:215: Error from API server: rpc call getHealth() on http://127.0.0.1:41544: Post "http://127.0.0.1:41544": dial tcp 127.0.0.1:41544: connect: connection refused
utils.go:215: API server not ready yet (attempt 18)
utils.go:215: Error from API server: rpc call getHealth() on http://127.0.0.1:41544: Post "http://127.0.0.1:41544": dial tcp 127.0.0.1:41544: connect: connection refused
utils.go:215: API server not ready yet (attempt 19)
utils.go:215: Error from API server: rpc call getHealth() on http://127.0.0.1:41544: Post "http://127.0.0.1:41544": dial tcp 127.0.0.1:41544: connect: connection refused
utils.go:215: API server not ready yet (attempt 20)
utils.go:215: Error from API server: rpc call getHealth() on http://127.0.0.1:41544: Post "http://127.0.0.1:41544": dial tcp 127.0.0.1:41544: connect: connection refused
utils.go:215: API server not ready yet (attempt 21)
utils.go:215: Error from API server: rpc call getHealth() on http://127.0.0.1:41544: Post "http://127.0.0.1:41544": dial tcp 127.0.0.1:41544: connect: connection refused
utils.go:215: API server not ready yet (attempt 22)
utils.go:215: Error from API server: rpc call getHealth() on http://127.0.0.1:41544: Post "http://127.0.0.1:41544": dial tcp 127.0.0.1:41544: connect: connection refused
utils.go:215: API server not ready yet (attempt 23)
utils.go:215: Error from API server: rpc call getHealth() on http://127.0.0.1:41544: Post "http://127.0.0.1:41544": dial tcp 127.0.0.1:41544: connect: connection refused
utils.go:215: API server not ready yet (attempt 24)
utils.go:215: Error from API server: rpc call getHealth() on http://127.0.0.1:41544: Post "http://127.0.0.1:41544": dial tcp 127.0.0.1:41544: connect: connection refused
utils.go:215: API server not ready yet (attempt 25)
utils.go:215: Error from API server: rpc call getHealth() on http://127.0.0.1:41544: Post "http://127.0.0.1:41544": dial tcp 127.0.0.1:41544: connect: connection refused
utils.go:215: API server not ready yet (attempt 26)
utils.go:215: Error from API server: rpc call getHealth() on http://127.0.0.1:41544: Post "http://127.0.0.1:41544": dial tcp 127.0.0.1:41544: connect: connection refused
utils.go:215: API server not ready yet (attempt 27)
utils.go:215: Error from API server: rpc call getHealth() on http://127.0.0.1:41544: Post "http://127.0.0.1:41544": dial tcp 127.0.0.1:41544: connect: connection refused
utils.go:215: API server not ready yet (attempt 28)
utils.go:215: Error from API server: rpc call getHealth() on http://127.0.0.1:41544: Post "http://127.0.0.1:41544": dial tcp 127.0.0.1:41544: connect: connection refused
utils.go:215: API server not ready yet (attempt 29)
utils.go:215: Error from API server: rpc call getHealth() on http://127.0.0.1:41544: Post "http://127.0.0.1:41544": dial tcp 127.0.0.1:41544: connect: connection refused
utils.go:215: API server not ready yet (attempt 30)
utils.go:215: Error from API server: rpc call getHealth() on http://127.0.0.1:41544: Post "http://127.0.0.1:41544": dial tcp 127.0.0.1:41544: connect: connection refused
utils.go:215: Cmd output: Error: program file does not exist: /Users/silaslenihan/Desktop/repos/chainlink-solana/contracts/target/deploy/contract-reader-interface.so

Cmd error:
utils.go:215:
Error Trace: /Users/silaslenihan/Desktop/repos/chainlink-solana/pkg/solana/client/test_helpers.go:78
/Users/silaslenihan/Desktop/repos/chainlink-solana/pkg/solana/utils/utils.go:215
/Users/silaslenihan/Desktop/repos/chainlink-solana/pkg/solana/chainwriter/lookups_test.go:279
Error: Should be true
Test: TestLookupTables
test_helpers.go:55:
Error Trace: /Users/silaslenihan/Desktop/repos/chainlink-solana/pkg/solana/client/test_helpers.go:55
/Users/silaslenihan/.asdf/installs/golang/1.23.3/go/src/testing/testing.go:1176
/Users/silaslenihan/.asdf/installs/golang/1.23.3/go/src/testing/testing.go:1354
/Users/silaslenihan/.asdf/installs/golang/1.23.3/go/src/testing/testing.go:1684
/Users/silaslenihan/.asdf/installs/golang/1.23.3/go/src/runtime/panic.go:629
/Users/silaslenihan/.asdf/installs/golang/1.23.3/go/src/testing/testing.go:1006
/Users/silaslenihan/Desktop/repos/chainlink-solana/pkg/solana/client/test_helpers.go:78
/Users/silaslenihan/Desktop/repos/chainlink-solana/pkg/solana/utils/utils.go:215
/Users/silaslenihan/Desktop/repos/chainlink-solana/pkg/solana/chainwriter/lookups_test.go:279
Error: "exit status 1" does not contain "signal: killed"
Test: TestLookupTables
Messages: exit status 1
test_helpers.go:56: solana-test-validator
stdout: Error: program file does not exist: /Users/silaslenihan/Desktop/repos/chainlink-solana/contracts/target/deploy/contract-reader-interface.so

stderr:

22 changes: 11 additions & 11 deletions pkg/solana/txm/txm.go
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ func (txm *Txm) simulateTx(ctx context.Context, tx *solanaGo.Transaction) (res *
}

// processError parses and handles relevant errors found in simulation results
func (txm *Txm) ProcessError(sig solanaGo.Signature, resErr interface{}, simulation bool) (txState TxState, errType TxErrType) {
func (txm *Txm) ProcessError(sig solanaGo.Signature, resErr interface{}, simulation bool) (txState txmutils.TxState, errType TxErrType) {
if resErr != nil {
// handle various errors
// https://github.com/solana-labs/solana/blob/master/sdk/src/transaction/error.rs
Expand All @@ -766,7 +766,7 @@ func (txm *Txm) ProcessError(sig solanaGo.Signature, resErr interface{}, simulat
if simulation {
return txState, NoFailure
}
return Errored, errType
return txmutils.Errored, errType
// transaction is already processed in the chain
case strings.Contains(errStr, "AlreadyProcessed"):
txm.lggr.Debugw("AlreadyProcessed", logValues...)
Expand All @@ -775,39 +775,39 @@ func (txm *Txm) ProcessError(sig solanaGo.Signature, resErr interface{}, simulat
if simulation {
return txState, NoFailure
}
return Errored, errType
return txmutils.Errored, errType
// transaction will encounter execution error/revert
case strings.Contains(errStr, "InstructionError"):
txm.lggr.Debugw("InstructionError", logValues...)
return FatallyErrored, errType
return txmutils.FatallyErrored, errType
// transaction contains an invalid account reference
case strings.Contains(errStr, "InvalidAccountIndex"):
txm.lggr.Debugw("InvalidAccountIndex", logValues...)
return FatallyErrored, errType
return txmutils.FatallyErrored, errType
// transaction loads a writable account that cannot be written
case strings.Contains(errStr, "InvalidWritableAccount"):
txm.lggr.Debugw("InvalidWritableAccount", logValues...)
return FatallyErrored, errType
return txmutils.FatallyErrored, errType
// address lookup table not found
case strings.Contains(errStr, "AddressLookupTableNotFound"):
txm.lggr.Debugw("AddressLookupTableNotFound", logValues...)
return FatallyErrored, errType
return txmutils.FatallyErrored, errType
// attempted to lookup addresses from an invalid account
case strings.Contains(errStr, "InvalidAddressLookupTableData"):
txm.lggr.Debugw("InvalidAddressLookupTableData", logValues...)
return FatallyErrored, errType
return txmutils.FatallyErrored, errType
// address table lookup uses an invalid index
case strings.Contains(errStr, "InvalidAddressLookupTableIndex"):
txm.lggr.Debugw("InvalidAddressLookupTableIndex", logValues...)
return FatallyErrored, errType
return txmutils.FatallyErrored, errType
// attempt to debit an account but found no record of a prior credit.
case strings.Contains(errStr, "AccountNotFound"):
txm.lggr.Debugw("AccountNotFound", logValues...)
return FatallyErrored, errType
return txmutils.FatallyErrored, errType
// attempt to load a program that does not exist
case strings.Contains(errStr, "ProgramAccountNotFound"):
txm.lggr.Debugw("ProgramAccountNotFound", logValues...)
return FatallyErrored, errType
return txmutils.FatallyErrored, errType
// unrecognized errors (indicates more concerning failures)
default:
// if simulating, return TxFailSimOther if error unknown
Expand Down
17 changes: 9 additions & 8 deletions pkg/solana/txm/txm_unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/smartcontractkit/chainlink-solana/pkg/solana/fees"
solanatxm "github.com/smartcontractkit/chainlink-solana/pkg/solana/txm"
keyMocks "github.com/smartcontractkit/chainlink-solana/pkg/solana/txm/mocks"
txmutils "github.com/smartcontractkit/chainlink-solana/pkg/solana/txm/utils"

"github.com/smartcontractkit/chainlink-common/pkg/logger"
"github.com/smartcontractkit/chainlink-common/pkg/utils"
Expand Down Expand Up @@ -174,12 +175,12 @@ func TestTxm_ProcessError(t *testing.T) {
// returns no failure if BlockhashNotFound encountered during simulation
txState, errType := txm.ProcessError(solana.Signature{}, err, true)
require.Equal(t, solanatxm.NoFailure, errType)
require.Equal(t, solanatxm.NotFound, txState) // default enum value
require.Equal(t, txmutils.NotFound, txState) // default enum value

// returns error if BlockhashNotFound encountered during normal processing
txState, errType = txm.ProcessError(solana.Signature{}, err, false)
require.Equal(t, solanatxm.TxFailRevert, errType)
require.Equal(t, solanatxm.Errored, txState) // default enum value
require.Equal(t, txmutils.Errored, txState) // default enum value
})
t.Run("process AlreadyProcessed error", func(t *testing.T) {
t.Parallel()
Expand All @@ -191,12 +192,12 @@ func TestTxm_ProcessError(t *testing.T) {
// returns no failure if AlreadyProcessed encountered during simulation
txState, errType := txm.ProcessError(solana.Signature{}, err, true)
require.Equal(t, solanatxm.NoFailure, errType)
require.Equal(t, solanatxm.NotFound, txState) // default enum value
require.Equal(t, txmutils.NotFound, txState) // default enum value

// returns error if AlreadyProcessed encountered during normal processing
txState, errType = txm.ProcessError(solana.Signature{}, err, false)
require.Equal(t, solanatxm.TxFailRevert, errType)
require.Equal(t, solanatxm.Errored, txState) // default enum value
require.Equal(t, txmutils.Errored, txState) // default enum value
})
t.Run("process fatal error cases", func(t *testing.T) {
t.Parallel()
Expand All @@ -212,12 +213,12 @@ func TestTxm_ProcessError(t *testing.T) {
// returns fatal error if InstructionError encountered during simulation
txState, errType := txm.ProcessError(solana.Signature{}, err, true)
require.Equal(t, solanatxm.TxFailSimRevert, errType)
require.Equal(t, solanatxm.FatallyErrored, txState) // default enum value
require.Equal(t, txmutils.FatallyErrored, txState) // default enum value

// returns fatal error if InstructionError encountered during normal processing
txState, errType = txm.ProcessError(solana.Signature{}, err, false)
require.Equal(t, solanatxm.TxFailRevert, errType)
require.Equal(t, solanatxm.FatallyErrored, txState) // default enum value
require.Equal(t, txmutils.FatallyErrored, txState) // default enum value
})
}
})
Expand All @@ -231,12 +232,12 @@ func TestTxm_ProcessError(t *testing.T) {
// returns fatal error if InstructionError encountered during simulation
txState, errType := txm.ProcessError(solana.Signature{}, err, true)
require.Equal(t, solanatxm.TxFailSimOther, errType)
require.Equal(t, solanatxm.Errored, txState) // default enum value
require.Equal(t, txmutils.Errored, txState) // default enum value

// returns fatal error if InstructionError encountered during normal processing
txState, errType = txm.ProcessError(solana.Signature{}, err, false)
require.Equal(t, solanatxm.TxFailRevert, errType)
require.Equal(t, solanatxm.Errored, txState) // default enum value
require.Equal(t, txmutils.Errored, txState) // default enum value
})
}

Expand Down
2 changes: 2 additions & 0 deletions pkg/solana/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os"
"path/filepath"
"runtime"
"strings"
"testing"
"time"

Expand Down Expand Up @@ -210,6 +211,7 @@ func SetupTestValidatorWithAnchorPrograms(t *testing.T, pathToAnchorConfig strin

flags := []string{}
for k, v := range anchorData.Programs.Localnet {
k = strings.Replace(k, "-", "_", -1)
flags = append(flags, "--upgradeable-program", v, filepath.Join(ContractsDir, k+".so"), upgradeAuthority)
}
url, _ := client.SetupLocalSolNodeWithFlags(t, flags...)
Expand Down

0 comments on commit 9cac594

Please sign in to comment.