Skip to content

Commit

Permalink
feat: contract call offchain data (#3)
Browse files Browse the repository at this point in the history
* feat: rest-service skeleton

The REST API will be used by the users to provide the payload for the
contract call.

Signed-off-by: Guilherme Felipe da Silva <[email protected]>

* feat(rest-service): call contract with offchain data

Signed-off-by: Guilherme Felipe da Silva <[email protected]>

* chore: ignore `storage` file

Signed-off-by: Guilherme Felipe da Silva <[email protected]>

* chore: remove dead code

Signed-off-by: Guilherme Felipe da Silva <[email protected]>

* chore: update solana-axelar

Signed-off-by: Guilherme Felipe da Silva <[email protected]>

* fix(rest-service): serialize test runs

Otherwise we try to bind the same port several times.

Signed-off-by: Guilherme Felipe da Silva <[email protected]>

* fix(rest-service): make shutdown sender available

We might need to send the shutdown signal from outside the service, thus
it's a good idea to make it available. The first place where we see the
need is in the tests as we need to gracefully shutdown the server after
every test to avoid trying to bind on the same port over and over.

Signed-off-by: Guilherme Felipe da Silva <[email protected]>

* fix: rest-service binding error in tests

Seems like using the test_serial crate is not enough, nor shutting down
the http server gracefully. Let's try to limit the threads used by
nextest.

Signed-off-by: Guilherme Felipe da Silva <[email protected]>

* feat: add health endpoint to signal the server is up

And use it in the tests instead of `sleep`.

Signed-off-by: Guilherme Felipe da Silva <[email protected]>

---------

Signed-off-by: Guilherme Felipe da Silva <[email protected]>
  • Loading branch information
frenzox authored Dec 13, 2024
1 parent 776ab6f commit aa58319
Show file tree
Hide file tree
Showing 19 changed files with 1,021 additions and 38 deletions.
6 changes: 6 additions & 0 deletions .config/nextest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[test-groups]
rest-service-same-port = { max-threads = 1 }

[[profile.default.overrides]]
filter = 'package(rest-service)'
test-group = 'rest-service-same-port'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ target/
*.key
config.toml
store
storage
117 changes: 90 additions & 27 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 13 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ solana-listener = { path = "crates/solana-listener" }
common-serde-utils = { path = "crates/common-serde-utils" }
solana-event-forwarder = { path = "crates/solana-event-forwarder" }
solana-tx-pusher = { path = "crates/solana-tx-pusher" }
rest-service = { path = "crates/rest-service" }
retrying-solana-http-sender = { path = "crates/retrying-solana-http-sender" }
solana-gateway-task-processor = { path = "crates/solana-gateway-task-processor" }
effective-tx-sender = { path = "crates/effective-tx-sender" }
Expand All @@ -79,13 +80,13 @@ relayer-amplifier-state = { git = "https://github.com/eigerco/axelar-relayer-cor
core-common-serde-utils = { git = "https://github.com/eigerco/axelar-relayer-core.git", package = "common-serde-utils", branch = "main" }

# Solana Gateway
axelar-solana-gateway = { git = "https://github.com/eigerco/solana-axelar.git", rev = "91c8cf2", features = ["no-entrypoint"] }
axelar-solana-its = { git = "https://github.com/eigerco/solana-axelar.git", rev = "91c8cf2", features = ["no-entrypoint"] }
axelar-solana-governance = { git = "https://github.com/eigerco/solana-axelar.git", rev = "91c8cf2", features = ["no-entrypoint"] }
gateway-event-stack = { git = "https://github.com/eigerco/solana-axelar.git", rev = "91c8cf2" }
axelar-solana-encoding = { git = "https://github.com/eigerco/solana-axelar.git", rev = "91c8cf2" }
axelar-message-primitives = { git = "https://github.com/eigerco/solana-axelar.git", rev = "91c8cf2" }
axelar-executable = { git = "https://github.com/eigerco/solana-axelar.git", rev = "91c8cf2" }
axelar-solana-gateway = { git = "https://github.com/eigerco/solana-axelar.git", rev = "e212e33", features = ["no-entrypoint"] }
axelar-solana-its = { git = "https://github.com/eigerco/solana-axelar.git", rev = "e212e33", features = ["no-entrypoint"] }
axelar-solana-governance = { git = "https://github.com/eigerco/solana-axelar.git", rev = "e212e33", features = ["no-entrypoint"] }
gateway-event-stack = { git = "https://github.com/eigerco/solana-axelar.git", rev = "e212e33" }
axelar-solana-encoding = { git = "https://github.com/eigerco/solana-axelar.git", rev = "e212e33" }
axelar-message-primitives = { git = "https://github.com/eigerco/solana-axelar.git", rev = "e212e33" }
axelar-executable = { git = "https://github.com/eigerco/solana-axelar.git", rev = "e212e33" }

# CLI
clap = { version = "4", features = ["derive"] }
Expand Down Expand Up @@ -120,17 +121,20 @@ serde_json = "1"
simd-json = "0.14"

# Tests
mockall = "0.13"
pretty_assertions = "1"
rstest = { version = "0.23" }
serial_test = "3.2"
test-log = { version = "0.2", features = ["trace"], default-features = false }
pretty_assertions = "1"
mockall = "0.13"

# Errors
eyre = "0.6"
color-eyre = "0.6"

# HTTP
axum = "0.7.9"
reqwest = { version = "0.12", default-features = false, features = ["json", "gzip", "deflate", "rustls-tls", "stream", "http2"] }
tower-http = { version = "0.6.2", features = ["trace"] }

# Solana
solana-client = "=2.0.16"
Expand Down
Loading

0 comments on commit aa58319

Please sign in to comment.