diff --git a/Cargo.lock b/Cargo.lock index 48ed36f567..25fc1df504 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3071,7 +3071,7 @@ dependencies = [ [[package]] name = "fortuna" -version = "9.1.1" +version = "9.2.0" dependencies = [ "anyhow", "axum 0.6.20", diff --git a/apps/fortuna/Cargo.toml b/apps/fortuna/Cargo.toml index 1f45ee12ca..0f4024ad9e 100644 --- a/apps/fortuna/Cargo.toml +++ b/apps/fortuna/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fortuna" -version = "9.1.2" +version = "9.2.0" edition = "2021" [lib] diff --git a/apps/fortuna/migrations/20250801232728_add_callback_fields.down.sql b/apps/fortuna/migrations/20250801232728_add_callback_fields.down.sql deleted file mode 100644 index 28e9082af4..0000000000 --- a/apps/fortuna/migrations/20250801232728_add_callback_fields.down.sql +++ /dev/null @@ -1,4 +0,0 @@ --- Remove callback_failed, callback_return_value, and callback_gas_used from the requests table. -ALTER TABLE request DROP COLUMN callback_failed; -ALTER TABLE request DROP COLUMN callback_return_value; -ALTER TABLE request DROP COLUMN callback_gas_used; diff --git a/apps/fortuna/migrations/20250801232728_add_callback_fields.up.sql b/apps/fortuna/migrations/20250801232728_add_callback_fields.up.sql deleted file mode 100644 index 113b43f9ad..0000000000 --- a/apps/fortuna/migrations/20250801232728_add_callback_fields.up.sql +++ /dev/null @@ -1,4 +0,0 @@ --- Add callback_failed, callback_return_value, and callback_gas_used to the requests table. -ALTER TABLE request ADD COLUMN callback_failed INTEGER; -ALTER TABLE request ADD COLUMN callback_return_value VARCHAR; -ALTER TABLE request ADD COLUMN callback_gas_used VARCHAR(100); diff --git a/apps/fortuna/migrations/20250707000000_init.down.sql b/apps/fortuna/migrations/20250807000000_init.down.sql similarity index 100% rename from apps/fortuna/migrations/20250707000000_init.down.sql rename to apps/fortuna/migrations/20250807000000_init.down.sql diff --git a/apps/fortuna/migrations/20250707000000_init.up.sql b/apps/fortuna/migrations/20250807000000_init.up.sql similarity index 88% rename from apps/fortuna/migrations/20250707000000_init.up.sql rename to apps/fortuna/migrations/20250807000000_init.up.sql index 609351b70f..4ec14695fe 100644 --- a/apps/fortuna/migrations/20250707000000_init.up.sql +++ b/apps/fortuna/migrations/20250807000000_init.up.sql @@ -3,8 +3,8 @@ CREATE TABLE request( network_id INTEGER NOT NULL, provider VARCHAR(40) NOT NULL, sequence INTEGER NOT NULL, - created_at INTEGER NOT NULL, - last_updated_at INTEGER NOT NULL, + created_at BIGINT NOT NULL, + last_updated_at BIGINT NOT NULL, state VARCHAR(10) NOT NULL, request_block_number INTEGER NOT NULL, request_tx_hash VARCHAR(64) NOT NULL, @@ -16,9 +16,11 @@ CREATE TABLE request( info TEXT, gas_used VARCHAR(100), gas_limit VARCHAR(100) NOT NULL, + callback_failed INTEGER, + callback_return_value VARCHAR, + callback_gas_used VARCHAR(100), PRIMARY KEY (network_id, sequence, provider, request_tx_hash) ); - CREATE INDEX request__network_id__state__created_at ON request(network_id, state, created_at); CREATE INDEX request__network_id__created_at ON request(network_id, created_at); CREATE INDEX request__sender__network_id__state__created_at ON request(sender, network_id, state, created_at); @@ -31,6 +33,7 @@ CREATE INDEX request__sequence__state__created_at ON request(sequence, state, cr CREATE INDEX request__sequence__created_at ON request(sequence, created_at); CREATE INDEX request__state__created_at ON request(state, created_at); CREATE INDEX request__created_at ON request(created_at); - -CREATE INDEX request__request_tx_hash ON request (request_tx_hash) WHERE request_tx_hash IS NOT NULL; -CREATE INDEX request__reveal_tx_hash ON request (reveal_tx_hash) WHERE reveal_tx_hash IS NOT NULL; +CREATE INDEX request__request_tx_hash ON request (request_tx_hash) +WHERE request_tx_hash IS NOT NULL; +CREATE INDEX request__reveal_tx_hash ON request (reveal_tx_hash) +WHERE reveal_tx_hash IS NOT NULL; diff --git a/apps/fortuna/src/history.rs b/apps/fortuna/src/history.rs index a278af9208..af00b58a70 100644 --- a/apps/fortuna/src/history.rs +++ b/apps/fortuna/src/history.rs @@ -51,6 +51,7 @@ pub enum RequestEntryState { /// the error code and any additional returned data. Note that "" often indicates an out-of-gas error. /// If the callback returns more than 256 bytes, only the first 256 bytes of the callback return value are included. /// NOTE: This field is the raw bytes returned from the callback, not hex-decoded. The client should decode it as needed. + #[schema(example = "0x4e487b710000000000000000000000000000000000000000000000000000000000000011", value_type = String)] callback_return_value: Bytes, /// How much gas the callback used. #[schema(example = "567890", value_type = String)]